@daghis/teamcity-mcp 0.1.2 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/.commitlintrc.mjs +25 -0
  2. package/.github/dependabot.yml +38 -0
  3. package/.github/workflows/ci.yml +26 -22
  4. package/.github/workflows/codeql.yml +1 -1
  5. package/.github/workflows/commitlint.yml +3 -3
  6. package/.github/workflows/publish.yml +22 -2
  7. package/AGENTS.md +61 -0
  8. package/CHANGELOG.md +14 -0
  9. package/README.md +8 -0
  10. package/THIRD_PARTY_NOTICES.md +58 -0
  11. package/dist/index.js +390 -322
  12. package/dist/index.js.map +4 -4
  13. package/dist/src/middleware/global-error-handler.d.ts.map +1 -1
  14. package/dist/src/teamcity/auth.d.ts.map +1 -1
  15. package/dist/src/teamcity-client/api/agent-api.d.ts +15 -15
  16. package/dist/src/teamcity-client/api/agent-pool-api.d.ts +14 -14
  17. package/dist/src/teamcity-client/api/agent-type-api.d.ts +1 -1
  18. package/dist/src/teamcity-client/api/audit-api.d.ts +2 -2
  19. package/dist/src/teamcity-client/api/avatar-api.d.ts +4 -4
  20. package/dist/src/teamcity-client/api/build-api.d.ts +57 -57
  21. package/dist/src/teamcity-client/api/build-queue-api.d.ts +14 -14
  22. package/dist/src/teamcity-client/api/build-type-api.d.ts +109 -109
  23. package/dist/src/teamcity-client/api/change-api.d.ts +10 -10
  24. package/dist/src/teamcity-client/api/cloud-instance-api.d.ts +10 -10
  25. package/dist/src/teamcity-client/api/deployment-dashboard-api.d.ts +9 -9
  26. package/dist/src/teamcity-client/api/global-server-settings-api.d.ts +2 -2
  27. package/dist/src/teamcity-client/api/group-api.d.ts +16 -16
  28. package/dist/src/teamcity-client/api/health-api.d.ts +4 -4
  29. package/dist/src/teamcity-client/api/investigation-api.d.ts +6 -6
  30. package/dist/src/teamcity-client/api/mute-api.d.ts +6 -6
  31. package/dist/src/teamcity-client/api/node-api.d.ts +6 -6
  32. package/dist/src/teamcity-client/api/problem-api.d.ts +2 -2
  33. package/dist/src/teamcity-client/api/problem-occurrence-api.d.ts +2 -2
  34. package/dist/src/teamcity-client/api/project-api.d.ts +48 -48
  35. package/dist/src/teamcity-client/api/role-api.d.ts +8 -8
  36. package/dist/src/teamcity-client/api/root-api.d.ts +4 -4
  37. package/dist/src/teamcity-client/api/server-api.d.ts +18 -18
  38. package/dist/src/teamcity-client/api/server-authentication-settings-api.d.ts +2 -2
  39. package/dist/src/teamcity-client/api/test-api.d.ts +2 -2
  40. package/dist/src/teamcity-client/api/test-occurrence-api.d.ts +2 -2
  41. package/dist/src/teamcity-client/api/user-api.d.ts +28 -28
  42. package/dist/src/teamcity-client/api/vcs-root-api.d.ts +14 -14
  43. package/dist/src/teamcity-client/api/vcs-root-instance-api.d.ts +17 -17
  44. package/dist/src/teamcity-client/api/versioned-settings-api.d.ts +15 -15
  45. package/dist/src/tools.d.ts.map +1 -1
  46. package/package.json +14 -13
  47. package/scripts/build.cjs +25 -6
  48. package/scripts/generate-third-party-notices.cjs +71 -0
  49. package/src/middleware/global-error-handler.ts +11 -0
  50. package/src/teamcity/auth.ts +13 -9
  51. package/src/tools.ts +20 -6
  52. package/.commitlintrc.js +0 -3
  53. package/TODO.md +0 -80
@@ -0,0 +1,25 @@
1
+ export default {
2
+ extends: ['@commitlint/config-conventional'],
3
+ rules: {
4
+ // Allow Dependabot-style commit bodies with long URLs/metadata
5
+ 'body-max-line-length': [0, 'always'],
6
+ 'type-enum': [
7
+ 2,
8
+ 'always',
9
+ [
10
+ 'build',
11
+ 'chore',
12
+ 'ci',
13
+ 'docs',
14
+ 'feat',
15
+ 'fix',
16
+ 'perf',
17
+ 'refactor',
18
+ 'revert',
19
+ 'style',
20
+ 'test',
21
+ 'deps'
22
+ ]
23
+ ]
24
+ }
25
+ };
@@ -0,0 +1,38 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "npm"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
7
+ day: "monday"
8
+ time: "06:00"
9
+ timezone: "UTC"
10
+ open-pull-requests-limit: 10
11
+ labels:
12
+ - "dependencies"
13
+ commit-message:
14
+ prefix: "deps"
15
+ include: "scope"
16
+ groups:
17
+ minor-and-patch:
18
+ update-types:
19
+ - "minor"
20
+ - "patch"
21
+
22
+ - package-ecosystem: "github-actions"
23
+ directory: "/"
24
+ schedule:
25
+ interval: "weekly"
26
+ day: "monday"
27
+ time: "06:00"
28
+ timezone: "UTC"
29
+ labels:
30
+ - "dependencies"
31
+ commit-message:
32
+ prefix: "deps"
33
+ include: "scope"
34
+ groups:
35
+ actions-minor-and-patch:
36
+ update-types:
37
+ - "minor"
38
+ - "patch"
@@ -10,14 +10,15 @@ on:
10
10
 
11
11
  permissions:
12
12
  contents: read
13
+ checks: write
13
14
 
14
15
  jobs:
15
16
  lint:
16
17
  name: Lint (no fix)
17
18
  runs-on: ubuntu-latest
18
19
  steps:
19
- - uses: actions/checkout@v4
20
- - uses: actions/setup-node@v4
20
+ - uses: actions/checkout@v5
21
+ - uses: actions/setup-node@v5
21
22
  with:
22
23
  node-version: 20.x
23
24
  cache: npm
@@ -28,8 +29,8 @@ jobs:
28
29
  name: Format check
29
30
  runs-on: ubuntu-latest
30
31
  steps:
31
- - uses: actions/checkout@v4
32
- - uses: actions/setup-node@v4
32
+ - uses: actions/checkout@v5
33
+ - uses: actions/setup-node@v5
33
34
  with:
34
35
  node-version: 20.x
35
36
  cache: npm
@@ -40,8 +41,8 @@ jobs:
40
41
  name: Typecheck
41
42
  runs-on: ubuntu-latest
42
43
  steps:
43
- - uses: actions/checkout@v4
44
- - uses: actions/setup-node@v4
44
+ - uses: actions/checkout@v5
45
+ - uses: actions/setup-node@v5
45
46
  with:
46
47
  node-version: 20.x
47
48
  cache: npm
@@ -56,8 +57,8 @@ jobs:
56
57
  matrix:
57
58
  shard: [1, 2, 3, 4]
58
59
  steps:
59
- - uses: actions/checkout@v4
60
- - uses: actions/setup-node@v4
60
+ - uses: actions/checkout@v5
61
+ - uses: actions/setup-node@v5
61
62
  with:
62
63
  node-version: 20.x
63
64
  cache: npm
@@ -67,28 +68,31 @@ jobs:
67
68
  JEST_JUNIT_OUTPUT: ./coverage/junit-${{ matrix.shard }}.xml
68
69
  JEST_JUNIT_CLASSNAME: "{filepath}"
69
70
  run: npm run test:coverage:ci -- --reporters=default --reporters=jest-junit --shard=${{ matrix.shard }}/4 --passWithNoTests
71
+ - name: Upload test results to Codecov
72
+ if: ${{ !cancelled() && github.actor != 'dependabot[bot]' }}
73
+ uses: codecov/test-results-action@v1
74
+ with:
75
+ token: ${{ secrets.CODECOV_TOKEN }}
76
+ files: ./coverage/junit-${{ matrix.shard }}.xml
70
77
  - name: Upload coverage to Codecov
71
- if: success()
72
- uses: codecov/codecov-action@v4
78
+ if: ${{ success() && github.actor != 'dependabot[bot]' }}
79
+ uses: codecov/codecov-action@v5
73
80
  with:
74
81
  files: ./coverage/lcov.info
75
82
  flags: unittests
76
83
  name: codecov-coverage
77
84
  token: ${{ secrets.CODECOV_TOKEN }}
78
- fail_ci_if_error: false
79
- - name: Upload test results to Codecov
80
- if: ${{ !cancelled() }}
81
- uses: codecov/test-results-action@v1
85
+ fail_ci_if_error: true
86
+ - name: Analyze bundle
87
+ run: npm run build:bundle
88
+ - name: Upload bundle analysis to Codecov
89
+ if: ${{ success() && github.actor != 'dependabot[bot]' && hashFiles('coverage/bundles/*.json') != '' }}
90
+ uses: codecov/codecov-action@v5
82
91
  with:
92
+ plugin: javascript-bundle
93
+ files: ./coverage/bundles/*.json
83
94
  token: ${{ secrets.CODECOV_TOKEN }}
84
- files: ./coverage/junit-${{ matrix.shard }}.xml
85
- - name: Upload coverage artifact
86
- if: always()
87
- uses: actions/upload-artifact@v4
88
- with:
89
- name: coverage-shard-${{ matrix.shard }}
90
- path: coverage/
91
- if-no-files-found: ignore
95
+ fail_ci_if_error: true
92
96
 
93
97
  aggregate:
94
98
  name: Lint, Typecheck, Test (Node 20)
@@ -20,7 +20,7 @@ jobs:
20
20
 
21
21
  steps:
22
22
  - name: Checkout repository
23
- uses: actions/checkout@v4
23
+ uses: actions/checkout@v5
24
24
 
25
25
  - name: Initialize CodeQL
26
26
  uses: github/codeql-action/init@v3
@@ -11,10 +11,10 @@ jobs:
11
11
  commitlint:
12
12
  runs-on: ubuntu-latest
13
13
  steps:
14
- - uses: actions/checkout@v4
14
+ - uses: actions/checkout@v5
15
15
  with:
16
16
  fetch-depth: 0
17
- - uses: wagoid/commitlint-github-action@v5
17
+ - uses: wagoid/commitlint-github-action@v6
18
18
  with:
19
- configFile: .commitlintrc.js
19
+ configFile: .commitlintrc.mjs
20
20
  commitDepth: 1
@@ -20,10 +20,10 @@ jobs:
20
20
  runs-on: ubuntu-latest
21
21
  steps:
22
22
  - name: Checkout
23
- uses: actions/checkout@v4
23
+ uses: actions/checkout@v5
24
24
 
25
25
  - name: Setup Node.js
26
- uses: actions/setup-node@v4
26
+ uses: actions/setup-node@v5
27
27
  with:
28
28
  node-version: 20.x
29
29
  registry-url: 'https://registry.npmjs.org'
@@ -39,7 +39,27 @@ jobs:
39
39
  - name: Verify package contents
40
40
  run: npm pack --dry-run
41
41
 
42
+ - name: Read package version
43
+ id: pkg
44
+ run: |
45
+ node -e "console.log('version=' + require('./package.json').version)" >> "$GITHUB_OUTPUT"
46
+
47
+ - name: Check if version already exists on npm
48
+ id: exists
49
+ run: |
50
+ set -e
51
+ PKG_NAME=$(node -p -e "require('./package.json').name")
52
+ VERSION=${{ steps.pkg.outputs.version }}
53
+ if npm view "${PKG_NAME}@${VERSION}" version > /dev/null 2>&1; then
54
+ echo "exists=true" >> "$GITHUB_OUTPUT"
55
+ echo "Version ${VERSION} already published for ${PKG_NAME}; skipping publish."
56
+ else
57
+ echo "exists=false" >> "$GITHUB_OUTPUT"
58
+ echo "Version ${VERSION} not found on registry; will publish."
59
+ fi
60
+
42
61
  - name: Publish to npm
62
+ if: steps.exists.outputs.exists == 'false'
43
63
  env:
44
64
  NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
45
65
  NPM_CONFIG_PROVENANCE: 'true'
package/AGENTS.md CHANGED
@@ -66,3 +66,64 @@
66
66
  await initializeTeamCity();
67
67
  await triggerBuild('MyBuildTypeId', 'refs/heads/main');
68
68
  ```
69
+
70
+ ## GitHub CLI (gh) Usage
71
+
72
+ Use GitHub CLI to examine/update issues and manage PRs. Prefer body files over literal `\n` to ensure proper newlines in descriptions.
73
+
74
+ ### Setup
75
+ - Verify install: `gh --version`
76
+ - Authenticate: `gh auth login` (HTTPS, GitHub.com, device or browser flow)
77
+ - Set repo context: `gh repo view` (should show `Daghis/teamcity-mcp`)
78
+
79
+ ### Issues: Inspect and Update
80
+ - List open issues: `gh issue list --state open`
81
+ - View details (JSON): `gh issue view 18 --json number,title,state,labels,assignees,body,url`
82
+ - View formatted: `gh issue view 18`
83
+ - Edit title/body: `gh issue edit 18 --title "New title" --body-file ./notes/issue-18.md`
84
+ - Add/remove labels: `gh issue edit 18 --add-label enhancement --remove-label bug`
85
+ - Assign/unassign: `gh issue edit 18 --add-assignee user1 --remove-assignee user2`
86
+ - Comment: `gh issue comment 18 --body-file ./notes/comment.md`
87
+ - Close/reopen: `gh issue close 18` | `gh issue reopen 18`
88
+
89
+ ### PRs: Create, Update, Review
90
+ - Create PR from current branch:
91
+ - Minimal: `gh pr create --fill`
92
+ - Explicit: `gh pr create --base main --head feat/my-change --title "feat: ..." --body-file ./pr.md`
93
+ - Link issue: include `Closes #18` in the PR body.
94
+ - Edit PR after creation:
95
+ - Update title/body: `gh pr edit 31 --title "..." --body-file ./pr.md`
96
+ - Change base: `gh pr edit 31 --base main`
97
+ - Add labels: `gh pr edit 31 --add-label dependencies`
98
+ - Mark draft/ready: `gh pr ready 31` | `gh pr create --draft ...`
99
+ - Checkout PR branch: `gh pr checkout 31`
100
+ - List/open PRs: `gh pr list --state open` | `gh pr view 31 --web`
101
+ - Reviews: `gh pr review 31 --approve` | `--request-changes --body-file ./review.md`
102
+ - Merge (maintainers): `gh pr merge 31 --squash --delete-branch` (ensure checks are green)
103
+
104
+ ### CI: Checks and Runs
105
+ - PR status: `gh pr status` (current repo) or `gh pr view 31 --json statusCheckRollup`
106
+ - List workflow runs (current branch): `gh run list --branch $(git branch --show-current)`
107
+ - View a run: `gh run view <run-id> --log`
108
+ - Rerun a run (maintainers): `gh run rerun <run-id>`
109
+
110
+ ### Advanced: Direct API with gh
111
+ - Commit check-runs: `gh api repos/:owner/:repo/commits/<sha>/check-runs --paginate`
112
+ - Combined status: `gh api repos/:owner/:repo/commits/<sha>/status`
113
+ - PR payload: `gh pr view 31 --json headRefName,headRefOid,mergeable,mergeStateStatus`
114
+
115
+ ### Good Practices and Examples
116
+ - Use body files to preserve newlines and bullets:
117
+ - Create file: `cat > /tmp/pr.md <<'MD'
118
+ Title and summary paragraph.
119
+
120
+ Bullets
121
+ - Point A
122
+ - Point B
123
+
124
+ Closes #18.
125
+ MD`
126
+ - Apply: `gh pr edit 31 --body-file /tmp/pr.md`
127
+ - Keep commit subjects under 100 chars (commitlint default via `@commitlint/config-conventional`).
128
+ - For Dependabot PRs: repository secrets aren’t available. Our CI skips Codecov uploads for `dependabot[bot]` but still runs tests and checks.
129
+ - For forked PRs: treat as untrusted (no secrets). Avoid running steps that require secrets or write permissions unless guarded.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.1](https://github.com/Daghis/teamcity-mcp/compare/v0.2.0...v0.2.1) (2025-09-12)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **mcp:** normalize TeamCity errors and wrap server info/metrics with runTool ([#53](https://github.com/Daghis/teamcity-mcp/issues/53)) ([2c8ab85](https://github.com/Daghis/teamcity-mcp/commit/2c8ab855a85e5faec4216a498c089e3a1a93ed7b))
9
+
10
+ ## [0.2.0](https://github.com/Daghis/teamcity-mcp/compare/v0.1.2...v0.2.0) (2025-09-11)
11
+
12
+
13
+ ### Features
14
+
15
+ * add Codecov bundle analysis ([#28](https://github.com/Daghis/teamcity-mcp/issues/28)) ([87c3de8](https://github.com/Daghis/teamcity-mcp/commit/87c3de85af34bec5b071d82612d67ba4d5a52702))
16
+
3
17
  ## 0.1.2 (2025-09-11)
4
18
 
5
19
 
package/README.md CHANGED
@@ -3,6 +3,7 @@
3
3
  [![CI](https://github.com/Daghis/teamcity-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/Daghis/teamcity-mcp/actions/workflows/ci.yml)
4
4
  [![CodeQL](https://github.com/Daghis/teamcity-mcp/actions/workflows/codeql.yml/badge.svg)](https://github.com/Daghis/teamcity-mcp/actions/workflows/codeql.yml)
5
5
  [![codecov](https://codecov.io/gh/Daghis/teamcity-mcp/branch/main/graph/badge.svg)](https://codecov.io/gh/Daghis/teamcity-mcp)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
6
7
 
7
8
  A Model Control Protocol (MCP) server that bridges AI coding assistants with JetBrains TeamCity CI/CD server, enabling natural language control of builds, tests, and deployments.
8
9
 
@@ -183,8 +184,15 @@ npm run typecheck
183
184
 
184
185
  # Build for production
185
186
  npm run build
187
+
188
+ # Analyze bundle for Codecov
189
+ npm run build:bundle
186
190
  ```
187
191
 
192
+ ### Bundle analysis in CI
193
+
194
+ The CI workflow runs `npm run build:bundle` and uploads the generated `coverage/bundles` JSON using `codecov/codecov-action` with the `javascript-bundle` plugin.
195
+
188
196
  ## Project Structure
189
197
 
190
198
  ```
@@ -0,0 +1,58 @@
1
+ # Third-Party Notices
2
+
3
+ This project includes third-party software. The following lists the direct dependencies and their licenses as resolved in this workspace. For full license texts, see each package’s own repository or the copies included in `node_modules/<package>/LICENSE` when present.
4
+
5
+ If a dependency is not currently installed in `node_modules`, its version or license may be shown as UNKNOWN below; consult the package’s metadata for definitive terms.
6
+
7
+ Last updated: 2025-09-11
8
+
9
+ ## Production Dependencies
10
+
11
+ - @modelcontextprotocol/sdk 0.5.0 — MIT
12
+ - ajv 8.17.1 — MIT
13
+ - ajv-formats 3.0.1 — MIT
14
+ - axios 1.11.0 — MIT
15
+ - dotenv 16.6.1 — BSD-2-Clause
16
+ - express 4.21.2 — MIT
17
+ - inversify 7.9.1 — MIT
18
+ - morgan 1.10.1 — MIT
19
+ - reflect-metadata 0.2.2 — Apache-2.0
20
+ - tslib 2.8.1 — 0BSD
21
+ - uuid 11.1.0 — MIT
22
+ - winston 3.17.0 — MIT
23
+ - zod 3.25.76 — MIT
24
+
25
+ ## Development Dependencies
26
+
27
+ - @esbuild-plugins/tsconfig-paths 0.1.2 — ISC
28
+ - @openapitools/openapi-generator-cli 2.23.1 — Apache-2.0
29
+ - @trivago/prettier-plugin-sort-imports 5.2.2 — Apache-2.0
30
+ - @types/ajv 0.0.5 — MIT
31
+ - @types/express 4.17.23 — MIT
32
+ - @types/jest 29.5.14 — MIT
33
+ - @types/js-yaml 4.0.9 — MIT
34
+ - @types/morgan 1.9.10 — MIT
35
+ - @types/node 20.19.11 — MIT
36
+ - @types/uuid 10.0.0 — MIT
37
+ - @typescript-eslint/eslint-plugin 6.21.0 — MIT
38
+ - @typescript-eslint/parser 6.21.0 — BSD-2-Clause
39
+ - axios-retry 4.5.0 — Apache-2.0
40
+ - esbuild 0.25.9 — MIT
41
+ - eslint 8.57.1 — MIT
42
+ - eslint-config-prettier 9.1.2 — MIT
43
+ - eslint-import-resolver-typescript 4.4.4 — ISC
44
+ - eslint-plugin-import 2.32.0 — MIT
45
+ - eslint-plugin-prettier 5.5.4 — MIT
46
+ - jest 29.7.0 — MIT
47
+ - jest-junit 16.0.0 — Apache-2.0
48
+ - js-yaml 4.1.0 — MIT
49
+ - prettier 3.6.2 — MIT
50
+ - ts-jest 29.4.1 — MIT
51
+ - tsc-alias 1.8.16 — MIT
52
+ - tsconfig-paths 4.2.0 — MIT
53
+ - tsx 4.20.5 — MIT
54
+ - typescript 5.9.2 — Apache-2.0
55
+
56
+ ---
57
+
58
+ Note: This document is provided for convenience and does not modify any license terms. All third-party packages remain the property of their respective copyright holders and are licensed under their own terms.