@daghis/teamcity-mcp 1.10.7 → 1.10.8

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.
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "1.10.7"
2
+ ".": "1.10.8"
3
3
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.10.8](https://github.com/Daghis/teamcity-mcp/compare/teamcity-mcp-v1.10.7...teamcity-mcp-v1.10.8) (2025-10-07)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **teamcity:** send snapshot options separately (238) ([fc9b313](https://github.com/Daghis/teamcity-mcp/commit/fc9b31379feccded78db5a35e1dc6f5ad13dccbd))
9
+ * **teamcity:** send snapshot options separately (238) ([6af8ea6](https://github.com/Daghis/teamcity-mcp/commit/6af8ea63dcc7dfae915a55287f3e1bc31e0a5c03))
10
+
3
11
  ## [1.10.7](https://github.com/Daghis/teamcity-mcp/compare/teamcity-mcp-v1.10.6...teamcity-mcp-v1.10.7) (2025-10-06)
4
12
 
5
13
 
package/dist/index.js CHANGED
@@ -2342,6 +2342,13 @@ var defaultTypeFor = (dependencyType) => {
2342
2342
  return void 0;
2343
2343
  }
2344
2344
  };
2345
+ var SNAPSHOT_DEPENDENCY_OPTION_KEYS = /* @__PURE__ */ new Set([
2346
+ "run-build-on-the-same-agent",
2347
+ "sync-revisions",
2348
+ "take-successful-builds-only",
2349
+ "take-started-build-with-same-revisions",
2350
+ "do-not-run-new-build-if-there-is-a-suitable-one"
2351
+ ]);
2345
2352
  var toStringRecord2 = (input) => {
2346
2353
  if (!input) {
2347
2354
  return {};
@@ -2381,6 +2388,30 @@ var recordToProperties2 = (record) => {
2381
2388
  property: entries.map(([name, value]) => ({ name, value }))
2382
2389
  };
2383
2390
  };
2391
+ var optionsToRecord = (options) => {
2392
+ if (!options) {
2393
+ return {};
2394
+ }
2395
+ const optionEntries = options?.option;
2396
+ const collection = Array.isArray(optionEntries) ? optionEntries : optionEntries != null ? [optionEntries] : [];
2397
+ const map = {};
2398
+ for (const item of collection) {
2399
+ if (!item?.name) {
2400
+ continue;
2401
+ }
2402
+ map[item.name] = item.value != null ? String(item.value) : "";
2403
+ }
2404
+ return map;
2405
+ };
2406
+ var recordToOptions = (record) => {
2407
+ const entries = Object.entries(record);
2408
+ if (entries.length === 0) {
2409
+ return void 0;
2410
+ }
2411
+ return {
2412
+ option: entries.map(([name, value]) => ({ name, value }))
2413
+ };
2414
+ };
2384
2415
  var mergeRecords2 = (base, override) => {
2385
2416
  const merged = { ...base };
2386
2417
  for (const [key, value] of Object.entries(override)) {
@@ -2412,6 +2443,25 @@ var propertiesToXml = (properties) => {
2412
2443
  }
2413
2444
  return `<properties>${nodes.join("")}</properties>`;
2414
2445
  };
2446
+ var optionsToXml = (options) => {
2447
+ if (!options) {
2448
+ return void 0;
2449
+ }
2450
+ const entries = options.option;
2451
+ const list = Array.isArray(entries) ? entries : entries != null ? [entries] : [];
2452
+ if (list.length === 0) {
2453
+ return void 0;
2454
+ }
2455
+ const nodes = list.filter((item) => item?.name).map((item) => {
2456
+ const name = item?.name ?? "";
2457
+ const value = item?.value != null ? String(item.value) : "";
2458
+ return `<option name="${escapeXml(name)}" value="${escapeXml(value)}"/>`;
2459
+ });
2460
+ if (nodes.length === 0) {
2461
+ return void 0;
2462
+ }
2463
+ return `<options>${nodes.join("")}</options>`;
2464
+ };
2415
2465
  var sourceBuildTypeToXml = (source) => {
2416
2466
  if (!source || typeof source !== "object") {
2417
2467
  return void 0;
@@ -2458,6 +2508,10 @@ var dependencyToXml = (dependencyType, payload) => {
2458
2508
  if (propertiesXml) {
2459
2509
  fragments.push(propertiesXml);
2460
2510
  }
2511
+ const optionsXml = optionsToXml(payload.options);
2512
+ if (optionsXml) {
2513
+ fragments.push(optionsXml);
2514
+ }
2461
2515
  return `<${root}${attributesToString(attributes)}>${fragments.join("")}</${root}>`;
2462
2516
  };
2463
2517
  var prepareArtifactRequest = (payload) => ({
@@ -2572,7 +2626,7 @@ var BuildDependencyManager = class {
2572
2626
  const response = await this.client.modules.buildTypes.getSnapshotDependency(
2573
2627
  buildTypeId,
2574
2628
  dependencyId,
2575
- "id,type,disabled,properties(property(name,value)),'source-buildType'(id)",
2629
+ "id,type,disabled,properties(property(name,value)),options(option(name,value)),'source-buildType'(id)",
2576
2630
  JSON_GET_HEADERS2
2577
2631
  );
2578
2632
  return response.data;
@@ -2584,9 +2638,42 @@ var BuildDependencyManager = class {
2584
2638
  }
2585
2639
  }
2586
2640
  buildPayload(dependencyType, existing, input) {
2587
- const baseProps = propertiesToRecord2(existing?.properties);
2588
- const mergedProps = mergeRecords2(baseProps, toStringRecord2(input.properties));
2641
+ const existingSnapshot = existing;
2642
+ const baseProperties = propertiesToRecord2(existing?.properties);
2643
+ const inputPropertyRecord = toStringRecord2(input.properties);
2644
+ const inputExplicitOptions = toStringRecord2(input.options);
2645
+ let optionOverrides = {};
2646
+ let propertyOverrides = inputPropertyRecord;
2647
+ let baseOptions = {};
2648
+ if (dependencyType === "snapshot") {
2649
+ baseOptions = optionsToRecord(existingSnapshot?.options);
2650
+ const knownOptionKeys = /* @__PURE__ */ new Set([
2651
+ ...Object.keys(baseOptions),
2652
+ ...Object.keys(inputExplicitOptions)
2653
+ ]);
2654
+ for (const key of SNAPSHOT_DEPENDENCY_OPTION_KEYS) {
2655
+ knownOptionKeys.add(key);
2656
+ }
2657
+ const derivedOptionOverrides = { ...inputExplicitOptions };
2658
+ const derivedPropertyOverrides = {};
2659
+ for (const [key, value] of Object.entries(inputPropertyRecord)) {
2660
+ if (knownOptionKeys.has(key)) {
2661
+ derivedOptionOverrides[key] = value;
2662
+ } else {
2663
+ derivedPropertyOverrides[key] = value;
2664
+ }
2665
+ }
2666
+ optionOverrides = derivedOptionOverrides;
2667
+ propertyOverrides = derivedPropertyOverrides;
2668
+ } else if (Object.keys(inputExplicitOptions).length > 0) {
2669
+ optionOverrides = inputExplicitOptions;
2670
+ }
2671
+ const mergedProps = mergeRecords2(baseProperties, propertyOverrides);
2589
2672
  const properties = recordToProperties2(mergedProps);
2673
+ let mergedOptions = {};
2674
+ if (dependencyType === "snapshot") {
2675
+ mergedOptions = mergeRecords2(baseOptions, optionOverrides);
2676
+ }
2590
2677
  const resolvedType = input.type ?? existing?.type ?? defaultTypeFor(dependencyType);
2591
2678
  const payload = {
2592
2679
  ...existing ?? {},
@@ -2597,6 +2684,16 @@ var BuildDependencyManager = class {
2597
2684
  }
2598
2685
  if (properties) {
2599
2686
  payload.properties = properties;
2687
+ } else {
2688
+ delete payload.properties;
2689
+ }
2690
+ if (dependencyType === "snapshot") {
2691
+ const options = recordToOptions(mergedOptions);
2692
+ if (options) {
2693
+ payload.options = options;
2694
+ } else {
2695
+ delete payload.options;
2696
+ }
2600
2697
  }
2601
2698
  const dependsOn = input.dependsOn ?? existing?.["source-buildType"]?.id;
2602
2699
  if (dependsOn) {
@@ -41535,6 +41632,10 @@ var FULL_MODE_TOOLS = [
41535
41632
  type: "object",
41536
41633
  description: "Dependency properties (e.g. cleanDestinationDirectory, pathRules)"
41537
41634
  },
41635
+ options: {
41636
+ type: "object",
41637
+ description: "Snapshot dependency options (e.g. run-build-on-the-same-agent)"
41638
+ },
41538
41639
  type: {
41539
41640
  type: "string",
41540
41641
  description: "Override dependency type value sent to TeamCity"
@@ -41552,6 +41653,7 @@ var FULL_MODE_TOOLS = [
41552
41653
  dependencyId: import_zod4.z.string().min(1).optional(),
41553
41654
  dependsOn: import_zod4.z.string().min(1).optional(),
41554
41655
  properties: import_zod4.z.record(import_zod4.z.string(), propertyValue).optional(),
41656
+ options: import_zod4.z.record(import_zod4.z.string(), propertyValue).optional(),
41555
41657
  type: import_zod4.z.string().min(1).optional(),
41556
41658
  disabled: import_zod4.z.boolean().optional()
41557
41659
  }).superRefine((value, ctx) => {
@@ -41583,6 +41685,7 @@ var FULL_MODE_TOOLS = [
41583
41685
  dependencyType: typed.dependencyType,
41584
41686
  dependsOn: typed.dependsOn,
41585
41687
  properties: typed.properties,
41688
+ options: typed.options,
41586
41689
  type: typed.type,
41587
41690
  disabled: typed.disabled
41588
41691
  });
@@ -41601,6 +41704,7 @@ var FULL_MODE_TOOLS = [
41601
41704
  dependencyType: typed.dependencyType,
41602
41705
  dependsOn: typed.dependsOn,
41603
41706
  properties: typed.properties,
41707
+ options: typed.options,
41604
41708
  type: typed.type,
41605
41709
  disabled: typed.disabled
41606
41710
  });