@daghis/teamcity-mcp 1.3.4 → 1.3.5

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.3.5](https://github.com/Daghis/teamcity-mcp/compare/v1.3.4...v1.3.5) (2025-09-19)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **tools:** repair manage_build_steps updates ([#154](https://github.com/Daghis/teamcity-mcp/issues/154)) ([b557e44](https://github.com/Daghis/teamcity-mcp/commit/b557e4424d5129de9d3b6e3240e1a876488da040))
9
+
3
10
  ## [1.3.4](https://github.com/Daghis/teamcity-mcp/compare/v1.3.3...v1.3.4) (2025-09-19)
4
11
 
5
12
 
package/dist/index.js CHANGED
@@ -1317,6 +1317,9 @@ var BuildConfigurationUpdateManager = class {
1317
1317
  }
1318
1318
  };
1319
1319
 
1320
+ // src/teamcity/utils/build-locator.ts
1321
+ var toBuildLocator = (buildId) => buildId.includes(":") ? buildId : `id:${buildId}`;
1322
+
1320
1323
  // src/teamcity/build-results-manager.ts
1321
1324
  var BuildResultsManager = class _BuildResultsManager {
1322
1325
  client;
@@ -1399,7 +1402,7 @@ var BuildResultsManager = class _BuildResultsManager {
1399
1402
  */
1400
1403
  async fetchBuildSummary(buildId) {
1401
1404
  const response = await this.client.modules.builds.getBuild(
1402
- this.toBuildLocator(buildId),
1405
+ toBuildLocator(buildId),
1403
1406
  _BuildResultsManager.fields
1404
1407
  );
1405
1408
  return response.data;
@@ -1455,7 +1458,7 @@ var BuildResultsManager = class _BuildResultsManager {
1455
1458
  async fetchArtifacts(buildId, options) {
1456
1459
  try {
1457
1460
  const response = await this.client.modules.builds.getFilesListOfBuild(
1458
- this.toBuildLocator(buildId)
1461
+ toBuildLocator(buildId)
1459
1462
  );
1460
1463
  const artifactListing = response.data;
1461
1464
  let artifacts = artifactListing.file ?? [];
@@ -1507,7 +1510,7 @@ var BuildResultsManager = class _BuildResultsManager {
1507
1510
  async fetchStatistics(buildId) {
1508
1511
  try {
1509
1512
  const response = await this.client.modules.builds.getBuildStatisticValues(
1510
- this.toBuildLocator(buildId)
1513
+ toBuildLocator(buildId)
1511
1514
  );
1512
1515
  const payload = response.data;
1513
1516
  const properties = payload.property ?? [];
@@ -1573,8 +1576,9 @@ var BuildResultsManager = class _BuildResultsManager {
1573
1576
  */
1574
1577
  async fetchDependencies(buildId) {
1575
1578
  try {
1576
- const response = await this.client.request(
1577
- (ctx) => ctx.axios.get(`${ctx.baseUrl}/app/rest/builds/id:${buildId}/snapshot-dependencies`)
1579
+ const response = await this.client.modules.builds.getAllBuilds(
1580
+ `snapshotDependency:(to:(id:${buildId}))`,
1581
+ "build(id,number,buildTypeId,status)"
1578
1582
  );
1579
1583
  const depsData = response.data;
1580
1584
  const builds = depsData.build ?? [];
@@ -1606,20 +1610,18 @@ var BuildResultsManager = class _BuildResultsManager {
1606
1610
  const baseUrl = this.client.getApiConfig().baseUrl;
1607
1611
  return baseUrl.endsWith("/") ? baseUrl.slice(0, -1) : baseUrl;
1608
1612
  }
1609
- toBuildLocator(buildId) {
1610
- return buildId.includes(":") ? buildId : `id:${buildId}`;
1611
- }
1612
1613
  async downloadArtifactContent(buildId, artifactPath) {
1613
1614
  const normalizedPath = artifactPath.split("/").map((segment) => encodeURIComponent(segment)).join("/");
1614
- const response = await this.client.request(
1615
- (ctx) => ctx.axios.get(
1616
- `${ctx.baseUrl}/app/rest/builds/id:${buildId}/artifacts/content/${normalizedPath}`,
1617
- {
1618
- responseType: "arraybuffer"
1619
- }
1620
- )
1615
+ const buildLocator = toBuildLocator(buildId);
1616
+ const response = await this.client.modules.builds.downloadFileOfBuild(
1617
+ `content/${normalizedPath}`,
1618
+ buildLocator,
1619
+ void 0,
1620
+ void 0,
1621
+ { responseType: "arraybuffer" }
1621
1622
  );
1622
- return response.data;
1623
+ const axiosResponse = response;
1624
+ return axiosResponse.data ?? new ArrayBuffer(0);
1623
1625
  }
1624
1626
  /**
1625
1627
  * Parse TeamCity date format
@@ -36242,7 +36244,7 @@ var TeamCityAPI = class _TeamCityAPI {
36242
36244
  return response.data;
36243
36245
  }
36244
36246
  async getBuild(buildId) {
36245
- const response = await this.builds.getBuild(this.toBuildLocator(buildId));
36247
+ const response = await this.builds.getBuild(toBuildLocator(buildId));
36246
36248
  return response.data;
36247
36249
  }
36248
36250
  async triggerBuild(buildTypeId, branchName, comment) {
@@ -36333,7 +36335,7 @@ var TeamCityAPI = class _TeamCityAPI {
36333
36335
  }
36334
36336
  async listBuildArtifacts(buildId, options) {
36335
36337
  return this.builds.getFilesListOfBuild(
36336
- this.toBuildLocator(buildId),
36338
+ toBuildLocator(buildId),
36337
36339
  options?.basePath,
36338
36340
  options?.locator,
36339
36341
  options?.fields,
@@ -36351,16 +36353,13 @@ var TeamCityAPI = class _TeamCityAPI {
36351
36353
  );
36352
36354
  }
36353
36355
  async getBuildStatistics(buildId, fields) {
36354
- return this.builds.getBuildStatisticValues(this.toBuildLocator(buildId), fields);
36356
+ return this.builds.getBuildStatisticValues(toBuildLocator(buildId), fields);
36355
36357
  }
36356
36358
  async listChangesForBuild(buildId, fields) {
36357
36359
  return this.changes.getAllChanges(`build:(id:${buildId})`, fields);
36358
36360
  }
36359
36361
  async listSnapshotDependencies(buildId) {
36360
- const response = await this.builds.getBuild(
36361
- this.toBuildLocator(buildId),
36362
- "snapshot-dependencies"
36363
- );
36362
+ const response = await this.builds.getBuild(toBuildLocator(buildId), "snapshot-dependencies");
36364
36363
  const dependencies = response.data["snapshot-dependencies"];
36365
36364
  if (dependencies == null) {
36366
36365
  return response;
@@ -36393,9 +36392,6 @@ var TeamCityAPI = class _TeamCityAPI {
36393
36392
  this.instance = void 0;
36394
36393
  this.instanceConfig = void 0;
36395
36394
  }
36396
- toBuildLocator(buildId) {
36397
- return buildId.includes(":") ? buildId : `id:${buildId}`;
36398
- }
36399
36395
  createApi(apiCtor) {
36400
36396
  return new apiCtor(this.config, this.baseUrl, this.axiosInstance);
36401
36397
  }
@@ -39215,16 +39211,39 @@ var FULL_MODE_TOOLS = [
39215
39211
  error: "Step ID is required for update action"
39216
39212
  });
39217
39213
  }
39218
- const props = Object.entries(typedArgs.properties ?? {});
39219
- for (const [k, v] of props) {
39220
- await adapter.modules.buildTypes.setBuildStepParameter(
39221
- typedArgs.buildTypeId,
39222
- typedArgs.stepId,
39223
- k,
39224
- String(v),
39225
- { headers: { "Content-Type": "text/plain", Accept: "application/json" } }
39226
- );
39214
+ const updatePayload = {};
39215
+ if (typedArgs.name != null) {
39216
+ updatePayload["name"] = typedArgs.name;
39227
39217
  }
39218
+ if (typedArgs.type != null) {
39219
+ updatePayload["type"] = typedArgs.type;
39220
+ }
39221
+ const rawProps = typedArgs.properties ?? {};
39222
+ const stepProps = Object.fromEntries(
39223
+ Object.entries(rawProps).map(([k, v]) => [k, String(v)])
39224
+ );
39225
+ if (stepProps["script.content"]) {
39226
+ stepProps["use.custom.script"] = stepProps["use.custom.script"] ?? "true";
39227
+ stepProps["script.type"] = stepProps["script.type"] ?? "customScript";
39228
+ }
39229
+ if (Object.keys(stepProps).length > 0) {
39230
+ updatePayload["properties"] = {
39231
+ property: Object.entries(stepProps).map(([name, value]) => ({ name, value }))
39232
+ };
39233
+ }
39234
+ if (Object.keys(updatePayload).length === 0) {
39235
+ return json({
39236
+ success: false,
39237
+ action: "update_build_step",
39238
+ error: "No update fields provided"
39239
+ });
39240
+ }
39241
+ await adapter.modules.buildTypes.replaceBuildStep(
39242
+ typedArgs.buildTypeId,
39243
+ typedArgs.stepId,
39244
+ void 0,
39245
+ updatePayload
39246
+ );
39228
39247
  return json({
39229
39248
  success: true,
39230
39249
  action: "update_build_step",