@taiga-ai/mcp-server 0.43.0-rc.1249 → 0.45.0-dev.1251

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 (3) hide show
  1. package/README.md +10 -10
  2. package/dist/index.js +99 -22
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -14,7 +14,7 @@ You need an access key, made in Taiga under **Settings > Account > MCP**, where
14
14
 
15
15
  Create the key first, and choose when it expires: in 30 days, 90 days, a year, or never. Taiga copies it to your clipboard, shows it once, and keeps it on the page until you say you have saved it, so copying the setup next does not lose it.
16
16
 
17
- The same page shows the setup for your client and environment, with the key already filled in where a config file needs it, and a one-click install for Cursor. The examples here pin a release (`@taiga-ai/mcp-server@0.43.0`), so an install runs the version you chose rather than whatever `latest` is at the next start.
17
+ The same page shows the setup for your client and environment, with the key already filled in where a config file needs it, and a one-click install for Cursor. The examples here pin a release (`@taiga-ai/mcp-server@0.45.0`), so an install runs the version you chose rather than whatever `latest` is at the next start.
18
18
 
19
19
  ## Install
20
20
 
@@ -23,29 +23,29 @@ The same page shows the setup for your client and environment, with the key alre
23
23
  Run the command. When it asks for your access key, paste it once and press Enter. Nothing appears as you paste (PowerShell shows asterisks), and the key stays out of your shell history:
24
24
 
25
25
  ```sh
26
- printf 'Taiga access key: ' && read -rs TAIGA_API_KEY && echo && claude mcp add taiga --scope user -e TAIGA_API_KEY="$TAIGA_API_KEY" -- npx -y @taiga-ai/mcp-server@0.43.0
26
+ printf 'Taiga access key: ' && read -rs TAIGA_API_KEY && echo && claude mcp add taiga --scope user -e TAIGA_API_KEY="$TAIGA_API_KEY" -- npx -y @taiga-ai/mcp-server@0.45.0
27
27
  ```
28
28
 
29
29
  ```sh
30
- printf 'Taiga access key: ' && read -rs TAIGA_API_KEY && echo && codex mcp add taiga --env TAIGA_API_KEY="$TAIGA_API_KEY" -- npx -y @taiga-ai/mcp-server@0.43.0
30
+ printf 'Taiga access key: ' && read -rs TAIGA_API_KEY && echo && codex mcp add taiga --env TAIGA_API_KEY="$TAIGA_API_KEY" -- npx -y @taiga-ai/mcp-server@0.45.0
31
31
  ```
32
32
 
33
33
  ```sh
34
- printf 'Taiga access key: ' && read -rs TAIGA_API_KEY && echo && copilot mcp add taiga --env TAIGA_API_KEY="$TAIGA_API_KEY" -- npx -y @taiga-ai/mcp-server@0.43.0
34
+ printf 'Taiga access key: ' && read -rs TAIGA_API_KEY && echo && copilot mcp add taiga --env TAIGA_API_KEY="$TAIGA_API_KEY" -- npx -y @taiga-ai/mcp-server@0.45.0
35
35
  ```
36
36
 
37
37
  On Windows, in PowerShell (Claude Code and Copilot start `npx` through `cmd /c`; the quoted `'--'` survives npm's PowerShell shims):
38
38
 
39
39
  ```powershell
40
- $k = Read-Host 'Taiga access key' -AsSecureString; claude mcp add taiga --scope user -e "TAIGA_API_KEY=$([Net.NetworkCredential]::new('', $k).Password)" '--' cmd /c npx -y @taiga-ai/mcp-server@0.43.0
40
+ $k = Read-Host 'Taiga access key' -AsSecureString; claude mcp add taiga --scope user -e "TAIGA_API_KEY=$([Net.NetworkCredential]::new('', $k).Password)" '--' cmd /c npx -y @taiga-ai/mcp-server@0.45.0
41
41
  ```
42
42
 
43
43
  ```powershell
44
- $k = Read-Host 'Taiga access key' -AsSecureString; codex mcp add taiga --env "TAIGA_API_KEY=$([Net.NetworkCredential]::new('', $k).Password)" '--' npx -y @taiga-ai/mcp-server@0.43.0
44
+ $k = Read-Host 'Taiga access key' -AsSecureString; codex mcp add taiga --env "TAIGA_API_KEY=$([Net.NetworkCredential]::new('', $k).Password)" '--' npx -y @taiga-ai/mcp-server@0.45.0
45
45
  ```
46
46
 
47
47
  ```powershell
48
- $k = Read-Host 'Taiga access key' -AsSecureString; copilot mcp add taiga --env "TAIGA_API_KEY=$([Net.NetworkCredential]::new('', $k).Password)" '--' cmd /c npx -y @taiga-ai/mcp-server@0.43.0
48
+ $k = Read-Host 'Taiga access key' -AsSecureString; copilot mcp add taiga --env "TAIGA_API_KEY=$([Net.NetworkCredential]::new('', $k).Password)" '--' cmd /c npx -y @taiga-ai/mcp-server@0.45.0
49
49
  ```
50
50
 
51
51
  The Copilot command also sets up the GitHub Copilot app. If you have the app but no `copilot` command, add the server to `~/.copilot/mcp-config.json` instead, beside any servers already there. It holds your key, so keep it out of repositories:
@@ -56,7 +56,7 @@ The Copilot command also sets up the GitHub Copilot app. If you have the app but
56
56
  "taiga": {
57
57
  "type": "local",
58
58
  "command": "npx",
59
- "args": ["-y", "@taiga-ai/mcp-server@0.43.0"],
59
+ "args": ["-y", "@taiga-ai/mcp-server@0.45.0"],
60
60
  "env": { "TAIGA_API_KEY": "YOUR_ACCESS_KEY" },
61
61
  "tools": ["*"]
62
62
  }
@@ -73,7 +73,7 @@ Most clients read the same `mcpServers` block. Add it with your key in place of
73
73
  "mcpServers": {
74
74
  "taiga": {
75
75
  "command": "npx",
76
- "args": ["-y", "@taiga-ai/mcp-server@0.43.0"],
76
+ "args": ["-y", "@taiga-ai/mcp-server@0.45.0"],
77
77
  "env": { "TAIGA_API_KEY": "YOUR_ACCESS_KEY" }
78
78
  }
79
79
  }
@@ -101,7 +101,7 @@ In `.vscode/mcp.json`. VS Code reads `servers`, and prompts for the key once and
101
101
  "taiga": {
102
102
  "type": "stdio",
103
103
  "command": "npx",
104
- "args": ["-y", "@taiga-ai/mcp-server@0.43.0"],
104
+ "args": ["-y", "@taiga-ai/mcp-server@0.45.0"],
105
105
  "env": { "TAIGA_API_KEY": "${input:taiga-api-key}" }
106
106
  }
107
107
  }
package/dist/index.js CHANGED
@@ -39399,7 +39399,7 @@ const BY_ARGUMENT = {
39399
39399
  replacesLinkId: "taiga_list_product_repositories lists the product's repository links.",
39400
39400
  linkableRepositoryId: "taiga_list_linkable_repositories lists the repositories the GitHub, GitLab and Azure DevOps connections reach, with their ids.",
39401
39401
  installationId: "taiga_list_linkable_repositories lists the connected GitHub accounts, GitLab and Azure DevOps connections.",
39402
- jobId: "A job ID is what the tool that started the job returned (taiga_request_initiatives, taiga_start_import).",
39402
+ jobId: "A job ID is the job's ID that the tool that started it returned (as id or jobId); an initiative or run ID is not one.",
39403
39403
  factoryId: "taiga_list_factories lists the factories the key can see.",
39404
39404
  findingId: "taiga_list_findings lists a product's findings.",
39405
39405
  violationId: "taiga_get_policy_standing lists a product's policy violations.",
@@ -39414,8 +39414,31 @@ const BY_ARGUMENT = {
39414
39414
  * feature is off) blames neither.
39415
39415
  */
39416
39416
  const licenseMiss = (hint) => (said) => /\blicen[cs]e\b/i.test(said) ? hint : /\b(product|project) not found/i.test(said) ? BY_ARGUMENT["productId"] : void 0;
39417
+ /**
39418
+ * A document's miss (PRO-5099): "No draft found to publish" names neither the product nor the factory, and giving
39419
+ * every ID's hint told the model its correct product ID was the mistake. The read of that scope's documents says
39420
+ * which exist, drafts included; anything else is the scope's own miss.
39421
+ */
39422
+ const documentMiss = (read, scope) => (said) => {
39423
+ if (/\bdraft\b|\bno published\b|\bdocuments?\b/i.test(said) && !/\b(product|project|factory|team) not found/i.test(said)) return `${read} says which documents exist, drafts included.`;
39424
+ return scope && MISSING_THING[scope]?.test(said) ? BY_ARGUMENT[scope] : void 0;
39425
+ };
39426
+ const PRODUCT_DOCUMENTS = documentMiss("taiga_get_product_document (productId, without type)", "productId");
39427
+ const FACTORY_DOCUMENTS = documentMiss("taiga_get_factory_document (factoryId)", "factoryId");
39428
+ const ORGANIZATION_DOCUMENTS = documentMiss("taiga_get_organization_document (without type)", null);
39417
39429
  /** Where an argument means something else on one tool, or the tool's 404 needs its own word. */
39418
39430
  const BY_TOOL = {
39431
+ taiga_publish_product_document: PRODUCT_DOCUMENTS,
39432
+ taiga_mark_product_document_reviewed: PRODUCT_DOCUMENTS,
39433
+ taiga_delete_product_document: PRODUCT_DOCUMENTS,
39434
+ taiga_regenerate_product_document: PRODUCT_DOCUMENTS,
39435
+ taiga_update_product_document: PRODUCT_DOCUMENTS,
39436
+ taiga_remove_product_document_section: PRODUCT_DOCUMENTS,
39437
+ taiga_publish_factory_document: FACTORY_DOCUMENTS,
39438
+ taiga_update_factory_document: FACTORY_DOCUMENTS,
39439
+ taiga_publish_organization_document: ORGANIZATION_DOCUMENTS,
39440
+ taiga_update_organization_document: ORGANIZATION_DOCUMENTS,
39441
+ taiga_get_design_token_sync: () => "taiga_sync_design_tokens starts a sync and returns its job's ID.",
39419
39442
  taiga_allow_license: licenseMiss("taiga_list_packages (productId) summarizes the product's licenses as its findings name them; a license with no finding there has nothing to allow or reopen."),
39420
39443
  taiga_list_licenses: licenseMiss("taiga_list_licenses without license lists the licenses in use, and taiga_list_packages (productId) one product's, spelled as their findings spell them."),
39421
39444
  taiga_resolve_action: () => "taiga_list_action_required lists the items with their IDs.",
@@ -41592,7 +41615,7 @@ function describeMiss(type, wanted, timelines, product) {
41592
41615
  const parts = [`No published ${wanted} ${name} (${type}) for this product.`];
41593
41616
  const rows = (side) => timelines[side] ?? [];
41594
41617
  if (rows(other).some((row) => row.type === type && isPublished(row))) parts.push(`It is published on the ${other} side: call again with origin '${other}'.`);
41595
- else for (const side of [wanted, other]) if (rows(side).some((row) => row.type === type && !isPublished(row))) parts.push(`A draft of it exists on the ${side} side, unpublished.`);
41618
+ else for (const side of [wanted, other]) if (rows(side).some((row) => row.type === type && !isPublished(row))) parts.push(side === "plan" ? "A draft of it exists on the plan side, unpublished: draft: true reads it." : `A draft of it exists on the ${side} side, unpublished.`);
41596
41619
  for (const o of PRODUCT_DOCUMENT_ORIGINS) {
41597
41620
  const side = timelines[o];
41598
41621
  const label = `${o[0].toUpperCase()}${o.slice(1)} documents`;
@@ -41772,23 +41795,33 @@ function registerProductTools(server, client) {
41772
41795
  }));
41773
41796
  server.registerTool("taiga_get_product_document", {
41774
41797
  title: "Get product document",
41775
- description: "Read a product's documents. The plan timeline (specification, architecture, threat model and more) says what to build; the reality timeline says what the code does: read it before changing code. Without type, the list. sections: [] gives the outline, then name the sections you need. versions: true lists the published versions; version reads one. A specification not yet published reads as its draft and its seven sections.",
41798
+ description: "Read a product's documents. The plan timeline (specification, architecture, threat model and more) says what to build; the reality timeline says what the code does: read it before changing code. Without type, the list. sections: [] gives the outline, then name the sections you need. versions: true lists the published versions; version reads one. draft: true reads the unpublished draft a write left, with sections as on a published read. A specification not yet published, of a product started from scratch, reads as its draft and its seven sections.",
41776
41799
  inputSchema: object({
41777
41800
  productId,
41778
41801
  type: _enum(PRODUCT_DOCUMENT_TYPES).optional().describe("Document type; omit to list what the product has on both timelines"),
41779
41802
  origin: originInput,
41780
41803
  sections: sectionsInput,
41781
41804
  versions: boolean().optional().describe("true: list the published versions, newest first, without content"),
41782
- version: number$1().int().positive().optional().describe("Read this published version instead of the latest (versions: true lists them)")
41805
+ version: number$1().int().positive().optional().describe("Read this published version instead of the latest (versions: true lists them)"),
41806
+ draft: boolean().optional().describe("true: read the unpublished draft (plan timeline) instead of the published version")
41783
41807
  }),
41784
41808
  annotations: READ_ONLY
41785
41809
  }, (params) => runTool(async () => {
41786
41810
  if (params.type === void 0) {
41787
- if (params.sections || params.origin || params.versions || params.version !== void 0) return toolError("VALIDATION_ERROR", "Name the document (type) to read one timeline or its sections.");
41811
+ if (params.sections || params.origin || params.versions || params.version !== void 0 || params.draft) return toolError("VALIDATION_ERROR", "Name the document (type) to read one timeline or its sections.");
41788
41812
  const { unlistable: _unlistable, ...timelines } = await documentTimelines(client, params.productId);
41789
41813
  return toolResult(timelines);
41790
41814
  }
41791
41815
  const type = params.type;
41816
+ if (params.draft) {
41817
+ if (params.versions || params.version !== void 0) return toolError("VALIDATION_ERROR", "draft reads the unpublished draft; versions and version read published ones.");
41818
+ if (params.origin === "reality") return toolError("VALIDATION_ERROR", "Drafts are written on the plan timeline; leave origin out or use plan.");
41819
+ const draft = (await client.getProductDocumentDraft(params.productId, type)).data;
41820
+ if (!draft) return toolError("NOT_FOUND", `There is no draft of ${productDocumentName(type)} (${type}). taiga_update_product_document writes one; without draft, this reads the published version.`);
41821
+ const doc = stripProvenance(draft);
41822
+ if (!params.sections) return toolResult(doc);
41823
+ return sectionReadResult(doc, params.sections, `plan ${type} draft`);
41824
+ }
41792
41825
  let product;
41793
41826
  if (!params.origin) product = (await client.getProduct(params.productId)).data;
41794
41827
  const origin = params.origin ?? defaultOriginFor(product, type);
@@ -41821,13 +41854,14 @@ function registerProductTools(server, client) {
41821
41854
  return sectionReadResult(doc, params.sections, `${origin} ${type}`);
41822
41855
  } catch (error) {
41823
41856
  if (!(error instanceof TaigaApiError) || error.status !== 404) throw error;
41824
- if (type === "specification" && origin === "plan") {
41857
+ if (type === "specification" && origin === "plan") product ??= (await client.getProduct(params.productId)).data;
41858
+ if (type === "specification" && origin === "plan" && !isImportedProduct(product)) {
41825
41859
  const draft = (await client.getProductDocumentDraft(params.productId, type)).data;
41826
41860
  return toolResult({
41827
41861
  type,
41828
41862
  origin,
41829
41863
  published: false,
41830
- draft: draft ? draftRead(stripProvenance(draft), params.sections) : null,
41864
+ draft: draft ? draftRead(stripProvenance(draft), params.sections, "plan specification draft") : null,
41831
41865
  sections: SPECIFICATION_SECTIONS.map((section) => ({
41832
41866
  id: section.id,
41833
41867
  heading: specificationHeading(section),
@@ -41843,9 +41877,9 @@ function registerProductTools(server, client) {
41843
41877
  }
41844
41878
  }
41845
41879
  /** A draft as `sections` asks for it, as sectionReadResult answers a published read; the whole draft without. */
41846
- function draftRead(doc, sections) {
41880
+ function draftRead(doc, sections, label) {
41847
41881
  if (!sections) return doc;
41848
- const first = sectionReadResult(doc, sections, "plan specification draft").content[0];
41882
+ const first = sectionReadResult(doc, sections, label).content[0];
41849
41883
  return first?.type === "text" ? JSON.parse(first.text) : doc;
41850
41884
  }
41851
41885
  //#endregion
@@ -41889,6 +41923,8 @@ function sectionIdFrom(readTool) {
41889
41923
  return string$2().min(1).describe(`Section id -- the keys of \`data.sections\` in ${readTool}, e.g. summary, scope, apiDesign. An id that does not exist yet adds a section.`);
41890
41924
  }
41891
41925
  const sectionContentInput = string$2().describe("The full new Markdown text of the section; it replaces the old text");
41926
+ /** Reads the unpublished draft a write left, so a model can review a document it wrote before anyone publishes it. */
41927
+ const draftInput = boolean().optional().describe("true: read the unpublished draft instead of the published version");
41892
41928
  const tenantDocumentType = _enum(TENANT_DOCUMENT_TYPES).describe("Document type: the policy_* ones are policies");
41893
41929
  /** Everything the model needs back from a write, without the content it already holds. */
41894
41930
  function documentSummary(doc) {
@@ -42139,10 +42175,11 @@ function policiesNamed(sections) {
42139
42175
  function registerDocumentTools(server, client) {
42140
42176
  if (client.hasCapability("tenant:documents:read")) server.registerTool("taiga_get_organization_document", {
42141
42177
  title: "Get an organization document",
42142
- description: "Read the organization's policies and other documents, which apply to every product. Without type, the list. Policies are long: sections: [] gives the outline, then name the sections, or a control id such as SEC-5.1 (which names its policy, so type can be left out).",
42178
+ description: "Read the organization's policies and other documents, which apply to every product. Without type, the list. Policies are long: sections: [] gives the outline, then name the sections, or a control id such as SEC-5.1 (which names its policy, so type can be left out). draft: true reads the unpublished draft a write left.",
42143
42179
  inputSchema: object({
42144
42180
  type: tenantDocumentType.optional(),
42145
42181
  sections: policySectionsInput,
42182
+ draft: draftInput,
42146
42183
  ...pagination
42147
42184
  }),
42148
42185
  annotations: READ_ONLY
@@ -42154,6 +42191,7 @@ function registerDocumentTools(server, client) {
42154
42191
  sections: params.sections?.map((id) => id.toUpperCase())
42155
42192
  } : params;
42156
42193
  if (args.type === void 0) {
42194
+ if (args.draft) return toolError("VALIDATION_ERROR", "Name the document (type) whose draft to read.");
42157
42195
  if (args.sections) return toolError("VALIDATION_ERROR", named.length > 1 ? `Those control ids are in different policies (${named.join(", ")}): read one type at a time.` : notControls(args.sections).length > 0 && notControls(args.sections).length < args.sections.length ? `Not a control id: ${notControls(args.sections).join(", ")}. A control id such as SEC-5.1 names its policy; any other section id needs type.` : "Name the document (type) to read its sections; a control id such as SEC-5.1 names its policy itself, but one of a family that spans policies (GDPR, NIS2) does not.");
42158
42196
  const result = await client.listTenantDocuments({
42159
42197
  limit: args.limit,
@@ -42163,8 +42201,12 @@ function registerDocumentTools(server, client) {
42163
42201
  }
42164
42202
  const type = args.type;
42165
42203
  if (args.limit !== void 0 || args.cursor !== void 0) return toolError("VALIDATION_ERROR", params.type === void 0 ? "limit and cursor page the list, which takes no sections; drop them to read the control." : "limit and cursor page the list; omit type to list, or drop them to read.");
42204
+ const draft = args.draft ? (await client.getTenantDocumentDraft(type)).data : null;
42205
+ if (args.draft) {
42206
+ if (!draft) return toolError("NOT_FOUND", `There is no draft of ${type}. taiga_update_organization_document writes one; without draft, this reads the published version.`);
42207
+ }
42166
42208
  try {
42167
- const doc = stripProvenance((await client.getTenantDocument(type)).data);
42209
+ const doc = stripProvenance((draft ? { data: draft } : await client.getTenantDocument(type)).data);
42168
42210
  const read = args.sections ? sectionReadResult(doc, args.sections, type, { controlIds: POLICY_TYPES.includes(type) }) : toolResult(doc);
42169
42211
  if (type !== DESIGN_STANDARDS) return read;
42170
42212
  const tokens = isRecord$1(doc.data) ? doc.data.tokens : void 0;
@@ -42178,14 +42220,14 @@ function registerDocumentTools(server, client) {
42178
42220
  ...shown,
42179
42221
  tokens
42180
42222
  } },
42181
- tokenAlignment: await alignmentOf(client, "published")
42223
+ tokenAlignment: await alignmentOf(client, args.draft ? "draft" : "published")
42182
42224
  });
42183
42225
  } catch (error) {
42184
42226
  if (!(error instanceof TaigaApiError) || error.status !== 404) throw error;
42185
42227
  const [draft, all] = await Promise.allSettled([client.getTenantDocumentDraft(type), client.listTenantDocuments({ limit: 100 })]);
42186
42228
  const parts = [`No published ${type}.`];
42187
42229
  if (draft.status === "fulfilled") {
42188
- parts.push(draft.value.data ? "A draft exists; taiga_publish_organization_document publishes it once the person asks." : "There is no draft either.");
42230
+ parts.push(draft.value.data ? "A draft exists (draft: true reads it); taiga_publish_organization_document publishes it once the person asks." : "There is no draft either.");
42189
42231
  if (draft.value.data && type === DESIGN_STANDARDS) {
42190
42232
  const draftAlignment = await alignmentOf(client, "draft");
42191
42233
  parts.push(`Draft tokens (${draftAlignment.status}): ${draftAlignment.message}`);
@@ -42233,19 +42275,25 @@ function registerDocumentTools(server, client) {
42233
42275
  }
42234
42276
  if (client.hasCapability("factories:read")) server.registerTool("taiga_get_factory_document", {
42235
42277
  title: "Get factory instructions",
42236
- description: "Read a factory's instructions: the domain, tech preferences and conventions its products follow.",
42278
+ description: "Read a factory's instructions: the domain, tech preferences and conventions its products follow. draft: true reads the unpublished draft a write left.",
42237
42279
  inputSchema: object({
42238
42280
  factoryId: idInput("factory", "taiga_list_factories (query finds one by name) gives it"),
42239
- type: _enum(FACTORY_DOCUMENT_TYPES).default("factory_instructions").describe("Document type")
42281
+ type: _enum(FACTORY_DOCUMENT_TYPES).default("factory_instructions").describe("Document type"),
42282
+ draft: draftInput
42240
42283
  }),
42241
42284
  annotations: READ_ONLY
42242
42285
  }, (params) => runTool(async () => {
42286
+ if (params.draft) {
42287
+ const draft = (await client.getFactoryDocumentDraft(params.factoryId, params.type)).data;
42288
+ if (draft) return toolResult(stripProvenance(draft));
42289
+ return toolError("NOT_FOUND", `There is no draft of ${params.type}. taiga_update_factory_document writes one; without draft, this reads the published version.`);
42290
+ }
42243
42291
  try {
42244
42292
  return toolResult(stripProvenance((await client.getFactoryDocument(params.factoryId, params.type)).data));
42245
42293
  } catch (error) {
42246
42294
  if (!(error instanceof TaigaApiError) || error.status !== 404) throw error;
42247
42295
  await client.getFactory(params.factoryId);
42248
- const detail = await client.getFactoryDocumentDraft(params.factoryId, params.type).then((draft) => draft.data ? "A draft exists; taiga_publish_factory_document publishes it once the person asks." : "There is no draft either: write one with taiga_update_factory_document, then publish it when the person asks.").catch((reason) => {
42296
+ const detail = await client.getFactoryDocumentDraft(params.factoryId, params.type).then((draft) => draft.data ? "A draft exists (draft: true reads it); taiga_publish_factory_document publishes it once the person asks." : "There is no draft either: write one with taiga_update_factory_document, then publish it when the person asks.").catch((reason) => {
42249
42297
  if (reason instanceof TaigaApiError && reason.status === 404) throw reason;
42250
42298
  return failedLookup("The draft", reason);
42251
42299
  });
@@ -43983,9 +44031,33 @@ async function knowledgeLinks(client, item, documentIds) {
43983
44031
  };
43984
44032
  }
43985
44033
  /** What an edit that changed nothing left as it was. */
43986
- function unchangedWhat(criteria, knowledge) {
43987
- if (criteria && knowledge) return "The criteria and linked knowledge are as they were";
43988
- return criteria ? "The criteria are as they were" : "The linked knowledge is as it was";
44034
+ function unchangedWhat(criteria, knowledge, plain = []) {
44035
+ const parts = [
44036
+ ...plain.map((key) => `the ${key}`),
44037
+ ...criteria ? ["the criteria"] : [],
44038
+ ...knowledge ? ["the linked knowledge"] : []
44039
+ ];
44040
+ const plural = parts.length > 1 || criteria || plain.includes("dependencies");
44041
+ const named = parts.length === 1 ? parts[0] : `${parts.slice(0, -1).join(", ")} and ${parts.at(-1).replace(/^the /, "")}`;
44042
+ return `${named.charAt(0).toUpperCase()}${named.slice(1)} ${plural ? "are as they were" : "is as it was"}`;
44043
+ }
44044
+ /** The fields of an initiative an edit sets as plain values, read back and compared as they are. */
44045
+ const PLAIN_FIELDS = [
44046
+ "title",
44047
+ "description",
44048
+ "priority",
44049
+ "estimate",
44050
+ "category",
44051
+ "dependencies"
44052
+ ];
44053
+ /** Whether a field already holds what an edit sends: dependencies as a set, the rest as they are. */
44054
+ function sameValue(held, sent) {
44055
+ if (Array.isArray(held) && Array.isArray(sent)) return held.length === sent.length && [...held].map(String).sort((a, b) => a.localeCompare(b)).join("\n") === [...sent].map(String).sort((a, b) => a.localeCompare(b)).join("\n");
44056
+ return held === sent;
44057
+ }
44058
+ /** Each field an edit set, as the initiative now holds it; a description by its length, which the model just sent. */
44059
+ function setFields(item, plain) {
44060
+ return Object.fromEntries(plain.map((key) => key === "description" ? ["descriptionCharacters", item.description.length] : [key, item[key]]));
43989
44061
  }
43990
44062
  /**
43991
44063
  * A criterion as the edit takes it: its text, and whether it needs an
@@ -44073,7 +44145,8 @@ function registerEdit(server, client) {
44073
44145
  if (lacking.length > 0) return toolError("FORBIDDEN", `Linking knowledge reads the initiative and each file, and needs ${lacking.join(", ")}, which this key lacks.`);
44074
44146
  }
44075
44147
  if (acceptanceCriteria !== void 0 && !client.hasCapability("backlog:read")) return toolError("FORBIDDEN", "Editing acceptance criteria reads the current ones first and needs backlog:read, which this key lacks.");
44076
- const current = acceptanceCriteria !== void 0 || documentIds !== void 0 ? (await client.getBacklogItem(id)).data : null;
44148
+ const plain = PLAIN_FIELDS.filter((key) => fields[key] !== void 0);
44149
+ const current = acceptanceCriteria !== void 0 || documentIds !== void 0 || plain.length > 0 && client.hasCapability("backlog:read") ? (await client.getBacklogItem(id)).data : null;
44077
44150
  let links;
44078
44151
  if (documentIds !== void 0 && current) {
44079
44152
  const checked = await knowledgeLinks(client, current, documentIds);
@@ -44086,9 +44159,10 @@ function registerEdit(server, client) {
44086
44159
  if (criteriaSpec(carried) !== criteriaSpec(current.acceptanceCriteria)) criteria = carried;
44087
44160
  }
44088
44161
  const linksChange = links?.changed === true;
44089
- if (current && criteria === void 0 && !linksChange && Object.values(fields).every((v) => v === void 0)) return toolResult({
44162
+ const plainSame = current !== null && plain.every((key) => sameValue(current[key], fields[key]));
44163
+ if (current && criteria === void 0 && !linksChange && fields.assigneeId === void 0 && plainSame && (plain.length > 0 || acceptanceCriteria !== void 0 || documentIds !== void 0)) return toolResult({
44090
44164
  ...outcomeOf(current),
44091
- unchanged: `${unchangedWhat(acceptanceCriteria !== void 0, documentIds !== void 0)}; nothing was written.`
44165
+ unchanged: `${unchangedWhat(acceptanceCriteria !== void 0, documentIds !== void 0, plain)}; nothing was written.`
44092
44166
  });
44093
44167
  let item;
44094
44168
  try {
@@ -44108,12 +44182,15 @@ function registerEdit(server, client) {
44108
44182
  throw error;
44109
44183
  }
44110
44184
  const assigned = fields.assigneeId !== void 0 ? { assigneeId: fields.assigneeId } : {};
44185
+ const set = setFields(item, plain);
44111
44186
  if (!links) return toolResult({
44112
44187
  ...outcomeOf(item),
44188
+ ...set,
44113
44189
  ...assigned
44114
44190
  });
44115
44191
  return toolResult({
44116
44192
  ...outcomeOf(item),
44193
+ ...set,
44117
44194
  ...assigned,
44118
44195
  linkedKnowledge: links.linked,
44119
44196
  unlinkedKnowledge: links.unlinked
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taiga-ai/mcp-server",
3
- "version": "0.43.0-rc.1249",
3
+ "version": "0.45.0-dev.1251",
4
4
  "description": "Taiga for AI coding assistants: read products, policies, initiatives and runs, and operate the line, over MCP",
5
5
  "mcpName": "ga.tai/mcp-server",
6
6
  "license": "UNLICENSED",