@taiga-ai/mcp-server 0.36.0-dev.773 → 0.36.0-dev.775
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/dist/index.js +95 -49
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -23680,11 +23680,22 @@ var TaigaClient = class {
|
|
|
23680
23680
|
async getTenantDocumentDraft(type) {
|
|
23681
23681
|
return this.request("GET", `/tenants/current/documents/${seg(type)}/draft`);
|
|
23682
23682
|
}
|
|
23683
|
+
/**
|
|
23684
|
+
* Save the draft. `expectedRevision` (design_standards only) is the `revision` the edit was built on, or null when
|
|
23685
|
+
* it was built on the published version because no draft existed; the API refuses with 409 `draft_changed` when
|
|
23686
|
+
* the draft is no longer that. With no draft, `expectedPublishedVersion` (the published version the edit was built
|
|
23687
|
+
* on, null when none) is checked the same way. Omitted means no check.
|
|
23688
|
+
*/
|
|
23683
23689
|
async saveTenantDocumentDraft(type, body) {
|
|
23684
23690
|
return this.request("PUT", `/tenants/current/documents/${seg(type)}/draft`, body);
|
|
23685
23691
|
}
|
|
23686
|
-
|
|
23687
|
-
|
|
23692
|
+
/**
|
|
23693
|
+
* Publish the draft. With `requireTokensAligned` the API checks, in the same transaction as the publish, that a
|
|
23694
|
+
* design standards draft's text and tokens agree, and answers 409 `tokens_out_of_line` without publishing when
|
|
23695
|
+
* they do not. The POST stays bodiless.
|
|
23696
|
+
*/
|
|
23697
|
+
async publishTenantDocument(type, options) {
|
|
23698
|
+
return this.request("POST", `/tenants/current/documents/${seg(type)}/publish${query$1({ requireTokensAligned: options?.requireTokensAligned ? true : void 0 })}`);
|
|
23688
23699
|
}
|
|
23689
23700
|
/** Whether the design standards draft's (or published version's) text and tokens were last brought into line. */
|
|
23690
23701
|
async getDesignTokenAlignment(version) {
|
|
@@ -26550,7 +26561,7 @@ const PRODUCT_NETWORK_ACCESS = ["allowlist", "unrestricted"];
|
|
|
26550
26561
|
* reads as deleted) and fields they explain would simply be missing. So it
|
|
26551
26562
|
* refuses to start, and says what to do.
|
|
26552
26563
|
*/
|
|
26553
|
-
function apiLevelProblem(introspection, apiUrl, required =
|
|
26564
|
+
function apiLevelProblem(introspection, apiUrl, required = 8, version = SERVER_VERSION) {
|
|
26554
26565
|
const offered = introspection.mcpApiLevel ?? 0;
|
|
26555
26566
|
if (offered >= required) return null;
|
|
26556
26567
|
return `The Taiga API at ${apiUrl} is older than @taiga-ai/mcp-server ${version} needs (API level ${offered}, needs ${required}). Run the version published for it, or wait for that API to be updated; an earlier release of this package works against it.`;
|
|
@@ -27778,7 +27789,7 @@ function registerMaintenanceTools(server, client) {
|
|
|
27778
27789
|
if (!client.hasCapability("products:read")) return;
|
|
27779
27790
|
server.registerTool("taiga_list_findings", {
|
|
27780
27791
|
title: "List maintenance findings",
|
|
27781
|
-
description: "List the security and dependency problems sweeps found in a product's code: vulnerable dependencies, secrets, insecure code and infrastructure. Each says how urgent it is (tier), where it is, whether the coding agent can fix it, and why Taiga is not fixing it on its own when it holds the fix (autoFixHeld: major_upgrade, daily_limit, attempts_used or
|
|
27792
|
+
description: "List the security and dependency problems sweeps found in a product's code: vulnerable dependencies, secrets, insecure code and infrastructure. Each says how urgent it is (tier), where it is, whether the coding agent can fix it, and why Taiga is not fixing it on its own when it holds the fix (autoFixHeld: major_upgrade, daily_limit, attempts_used, came_back or blocked_by_dependency, which carries blockingPackage and blockingConstraint: the fix version is capped by another dependency's declared constraint). The first page says when the product was last swept, so an empty list is not read as all clear. Findings of one rule in one repository fold into one row per page, so a row's count is that page's (group: false lists each); controlId keeps the ones behind one policy control.",
|
|
27782
27793
|
inputSchema: object({
|
|
27783
27794
|
productId,
|
|
27784
27795
|
controlId: string$2().trim().min(1).max(40).optional().describe("Only the findings that breach this control, such as SEC-5.1 (one page, searched across all)"),
|
|
@@ -28913,11 +28924,23 @@ function documentSummary(doc) {
|
|
|
28913
28924
|
*/
|
|
28914
28925
|
async function editBase(scope) {
|
|
28915
28926
|
const draft = (await scope.getDraft()).data;
|
|
28916
|
-
if (draft) return
|
|
28927
|
+
if (draft) return {
|
|
28928
|
+
base: draft.data,
|
|
28929
|
+
revision: "revision" in draft ? draft.revision : void 0
|
|
28930
|
+
};
|
|
28917
28931
|
try {
|
|
28918
|
-
|
|
28932
|
+
const published = (await scope.getPublished()).data;
|
|
28933
|
+
return {
|
|
28934
|
+
base: published.data,
|
|
28935
|
+
revision: null,
|
|
28936
|
+
publishedVersion: published.version ?? null
|
|
28937
|
+
};
|
|
28919
28938
|
} catch (error) {
|
|
28920
|
-
if (error instanceof TaigaApiError && error.status === 404) return {
|
|
28939
|
+
if (error instanceof TaigaApiError && error.status === 404) return {
|
|
28940
|
+
base: { sections: {} },
|
|
28941
|
+
revision: null,
|
|
28942
|
+
publishedVersion: null
|
|
28943
|
+
};
|
|
28921
28944
|
throw error;
|
|
28922
28945
|
}
|
|
28923
28946
|
}
|
|
@@ -28925,14 +28948,18 @@ async function editBase(scope) {
|
|
|
28925
28948
|
* Edit one section of a document's draft; the edit keeps every other section
|
|
28926
28949
|
* and the section's own metadata, see sections.ts.
|
|
28927
28950
|
*/
|
|
28928
|
-
async function updateSection(scope, type, id, content) {
|
|
28929
|
-
const base = await editBase(scope);
|
|
28951
|
+
async function updateSection(scope, type, id, content, options = {}) {
|
|
28952
|
+
const { base, revision, publishedVersion } = await editBase(scope);
|
|
28930
28953
|
const sections = sectionsOf(base);
|
|
28931
28954
|
if (!sections) return toolError("UNSUPPORTED_DOCUMENT", `Document ${type} is not made of sections and cannot be edited section by section. Edit it in the Taiga app.`);
|
|
28932
|
-
const
|
|
28955
|
+
const edited = {
|
|
28933
28956
|
...base,
|
|
28934
28957
|
sections: applySectionEdit(sections, id, content)
|
|
28935
|
-
}
|
|
28958
|
+
};
|
|
28959
|
+
const saved = await scope.saveDraft(edited, options.sendRevision && revision !== void 0 ? {
|
|
28960
|
+
expectedRevision: revision,
|
|
28961
|
+
...revision === null && publishedVersion !== void 0 ? { expectedPublishedVersion: publishedVersion } : {}
|
|
28962
|
+
} : void 0);
|
|
28936
28963
|
return toolResult({
|
|
28937
28964
|
...documentSummary(saved.data),
|
|
28938
28965
|
section: {
|
|
@@ -28948,7 +28975,10 @@ async function updateSection(scope, type, id, content) {
|
|
|
28948
28975
|
* which are kept: they are the only way the publisher hears of them.
|
|
28949
28976
|
*/
|
|
28950
28977
|
async function publishDraft(scope, extra = {}) {
|
|
28951
|
-
|
|
28978
|
+
return publishedResult(await scope.publish(), extra);
|
|
28979
|
+
}
|
|
28980
|
+
/** The tool result for a publish that went through: the document's summary, the alignment if any, and every warning. */
|
|
28981
|
+
function publishedResult(published, extra) {
|
|
28952
28982
|
const own = extra.warnings ?? [];
|
|
28953
28983
|
const api = published.warnings;
|
|
28954
28984
|
const warnings = own.length === 0 ? api : [...Array.isArray(api) ? api : api ? [api] : [], ...own];
|
|
@@ -28987,9 +29017,28 @@ function withFields(result, fields) {
|
|
|
28987
29017
|
...fields
|
|
28988
29018
|
});
|
|
28989
29019
|
}
|
|
28990
|
-
|
|
29020
|
+
const DRAFT_CHANGED = "The design standards draft changed after this edit read it (a person, an agent or a token sync changed it), so nothing was saved and their change was kept. Read the draft again with taiga_get_organization_document and make the edit again.";
|
|
29021
|
+
/** The reason of a 409 the API sent with a structured `details.reason`, else undefined. */
|
|
29022
|
+
function conflictReason(error) {
|
|
29023
|
+
if (!(error instanceof TaigaApiError) || error.status !== 409) return void 0;
|
|
29024
|
+
const reason = error.details?.["reason"];
|
|
29025
|
+
return typeof reason === "string" && error.details ? {
|
|
29026
|
+
reason,
|
|
29027
|
+
details: error.details
|
|
29028
|
+
} : void 0;
|
|
29029
|
+
}
|
|
29030
|
+
/**
|
|
29031
|
+
* A section edit of the design standards says whether its tokens still match the text. It is saved against the
|
|
29032
|
+
* revision of the draft it read, so a change made since is refused rather than overwritten.
|
|
29033
|
+
*/
|
|
28991
29034
|
async function updateDesignStandardsSection(client, scope, id, content) {
|
|
28992
|
-
|
|
29035
|
+
let saved;
|
|
29036
|
+
try {
|
|
29037
|
+
saved = await updateSection(scope, DESIGN_STANDARDS, id, content, { sendRevision: true });
|
|
29038
|
+
} catch (error) {
|
|
29039
|
+
if (conflictReason(error)?.reason === "draft_changed") return toolError("CONFLICT", DRAFT_CHANGED);
|
|
29040
|
+
throw error;
|
|
29041
|
+
}
|
|
28993
29042
|
if (saved.isError) return saved;
|
|
28994
29043
|
const tokenAlignment = await alignmentOf(client, "draft");
|
|
28995
29044
|
return withFields(saved, {
|
|
@@ -28997,42 +29046,35 @@ async function updateDesignStandardsSection(client, scope, id, content) {
|
|
|
28997
29046
|
...tokenAlignment.status === "aligned" ? {} : { hint: TOKENS_HINT }
|
|
28998
29047
|
});
|
|
28999
29048
|
}
|
|
29049
|
+
/** The refusal a publish of the design standards drew, as a tool error; undefined for any other failure. */
|
|
29050
|
+
function publishRefusal(error) {
|
|
29051
|
+
const conflict = conflictReason(error);
|
|
29052
|
+
if (!conflict) return void 0;
|
|
29053
|
+
if (conflict.reason === "design_job_running") return toolError("CONFLICT", "A design job is updating the draft. If it is a token sync, wait for it with taiga_get_design_token_sync; for any other design job (a derive or a component generation), wait with taiga_wait (jobId). Then publish again. Nothing was published.");
|
|
29054
|
+
if (conflict.reason !== "tokens_out_of_line") return void 0;
|
|
29055
|
+
const found = conflict.details["tokenAlignment"];
|
|
29056
|
+
const tokenAlignment = isRecord$1(found) ? found : void 0;
|
|
29057
|
+
return toolError("TOKENS_OUT_OF_LINE", `${typeof tokenAlignment?.["message"] === "string" ? tokenAlignment["message"] : "The tokens do not match the text."} Bring the tokens in line with taiga_update_design_tokens or taiga_sync_design_tokens, then publish again; to publish them out of line ask again with publishWithTokensOutOfLine: true. Readers and builds keep the published version.`, tokenAlignment ? { tokenAlignment } : void 0);
|
|
29058
|
+
}
|
|
29000
29059
|
/**
|
|
29001
|
-
* Publish the design standards draft
|
|
29002
|
-
*
|
|
29060
|
+
* Publish the design standards draft. The API checks that its text and tokens agree in the same transaction as the
|
|
29061
|
+
* publish, so nothing can change between the check and the publish; unless the caller says to publish them out of
|
|
29062
|
+
* line, a disagreement is refused and nothing is published.
|
|
29003
29063
|
*/
|
|
29004
|
-
async function publishDesignStandards(
|
|
29005
|
-
let
|
|
29064
|
+
async function publishDesignStandards(scope, outOfLineAllowed) {
|
|
29065
|
+
let published;
|
|
29006
29066
|
try {
|
|
29007
|
-
|
|
29067
|
+
published = await scope.publish({ requireTokensAligned: !outOfLineAllowed });
|
|
29008
29068
|
} catch (error) {
|
|
29009
|
-
|
|
29010
|
-
|
|
29069
|
+
const refused = publishRefusal(error);
|
|
29070
|
+
if (refused) return refused;
|
|
29071
|
+
throw error;
|
|
29011
29072
|
}
|
|
29012
|
-
|
|
29013
|
-
|
|
29073
|
+
const tokenAlignment = published.tokenAlignment;
|
|
29074
|
+
if (!tokenAlignment) return publishedResult(published, { warnings: ["The API did not report the token alignment, so this publish was not checked for text and tokens agreeing; read it with taiga_get_organization_document."] });
|
|
29075
|
+
return publishedResult(published, {
|
|
29014
29076
|
tokenAlignment,
|
|
29015
|
-
warnings: [`Published with the tokens out of line (${tokenAlignment.status}): the published text and tokens may disagree, and builds use the tokens.`]
|
|
29016
|
-
});
|
|
29017
|
-
if (published.isError) return published;
|
|
29018
|
-
return confirmPublishedAlignment(client, published, tokenAlignment, outOfLineAllowed);
|
|
29019
|
-
}
|
|
29020
|
-
/**
|
|
29021
|
-
* The check above and the publish are separate requests, so the draft can change between them. What was published
|
|
29022
|
-
* is read back: the result reports the published version's own alignment, and a publish that went out of line
|
|
29023
|
-
* without the caller's say-so is said so in its warnings, never reported as aligned.
|
|
29024
|
-
*/
|
|
29025
|
-
async function confirmPublishedAlignment(client, published, checked, outOfLineAllowed) {
|
|
29026
|
-
const first = published.content[0];
|
|
29027
|
-
if (first?.type !== "text") return published;
|
|
29028
|
-
const after = await alignmentOf(client, "published");
|
|
29029
|
-
if (after.status === "aligned") return withFields(published, { tokenAlignment: after });
|
|
29030
|
-
const body = JSON.parse(first.text);
|
|
29031
|
-
const warnings = Array.isArray(body["warnings"]) ? body["warnings"] : [];
|
|
29032
|
-
const note = after.status === "unknown" ? `The published version's token alignment could not be confirmed after publishing (the check before it said ${checked.status}).` : `The draft changed after the alignment check, so the published text and tokens may disagree (${after.status}), and builds use the tokens. Edit the tokens or start taiga_sync_design_tokens, then publish again.`;
|
|
29033
|
-
return withFields(published, {
|
|
29034
|
-
tokenAlignment: after,
|
|
29035
|
-
...outOfLineAllowed && after.status !== "unknown" ? {} : { warnings: [...warnings, note] }
|
|
29077
|
+
...tokenAlignment.status === "aligned" ? {} : { warnings: [`Published with the tokens out of line (${tokenAlignment.status}): the published text and tokens may disagree, and builds use the tokens.`] }
|
|
29036
29078
|
});
|
|
29037
29079
|
}
|
|
29038
29080
|
/** The section ids that are not control ids at all. GDPR-1.1 is a control id, so it is not among them, though it names no single policy. */
|
|
@@ -29112,12 +29154,16 @@ function registerDocumentTools(server, client) {
|
|
|
29112
29154
|
const tenantScope = (type) => ({
|
|
29113
29155
|
getDraft: () => client.getTenantDocumentDraft(type),
|
|
29114
29156
|
getPublished: () => client.getTenantDocument(type),
|
|
29115
|
-
saveDraft: (data) => client.saveTenantDocumentDraft(type, {
|
|
29116
|
-
|
|
29157
|
+
saveDraft: (data, options) => client.saveTenantDocumentDraft(type, {
|
|
29158
|
+
data,
|
|
29159
|
+
...options?.expectedRevision !== void 0 ? { expectedRevision: options.expectedRevision } : {},
|
|
29160
|
+
...options?.expectedPublishedVersion !== void 0 ? { expectedPublishedVersion: options.expectedPublishedVersion } : {}
|
|
29161
|
+
}),
|
|
29162
|
+
publish: (options) => client.publishTenantDocument(type, options)
|
|
29117
29163
|
});
|
|
29118
29164
|
server.registerTool("taiga_update_organization_document", {
|
|
29119
29165
|
title: "Update a section of an organization document draft",
|
|
29120
|
-
description: "Change one section of an organization document's draft, such as a policy. Readers keep the published version until it is published.",
|
|
29166
|
+
description: "Change one section of an organization document's draft, such as a policy. Readers keep the published version until it is published. A design standards edit is refused (CONFLICT) if the draft changed since it was read.",
|
|
29121
29167
|
inputSchema: object({
|
|
29122
29168
|
type: tenantDocumentType,
|
|
29123
29169
|
sectionId: sectionIdFrom("taiga_get_organization_document"),
|
|
@@ -29127,13 +29173,13 @@ function registerDocumentTools(server, client) {
|
|
|
29127
29173
|
}, (params) => runTool(() => params.type === DESIGN_STANDARDS ? updateDesignStandardsSection(client, tenantScope(params.type), params.sectionId, params.content) : updateSection(tenantScope(params.type), params.type, params.sectionId, params.content)));
|
|
29128
29174
|
server.registerTool("taiga_publish_organization_document", {
|
|
29129
29175
|
title: "Publish an organization document draft",
|
|
29130
|
-
description: "Publish an organization document's draft as its next version, which every agent and person then follows. A design standards draft whose tokens do not match its text is refused (TOKENS_OUT_OF_LINE) unless publishWithTokensOutOfLine is true.",
|
|
29176
|
+
description: "Publish an organization document's draft as its next version, which every agent and person then follows. A design standards draft whose tokens do not match its text is refused (TOKENS_OUT_OF_LINE), checked in the publish itself, unless publishWithTokensOutOfLine is true.",
|
|
29131
29177
|
inputSchema: object({
|
|
29132
29178
|
type: tenantDocumentType,
|
|
29133
29179
|
publishWithTokensOutOfLine: boolean().optional().describe("design_standards only: publish although its tokens may not match its text; the result then carries a warning")
|
|
29134
29180
|
}),
|
|
29135
29181
|
annotations: PUBLISH
|
|
29136
|
-
}, (params) => runTool(() => params.type === DESIGN_STANDARDS ? publishDesignStandards(
|
|
29182
|
+
}, (params) => runTool(() => params.type === DESIGN_STANDARDS ? publishDesignStandards(tenantScope(params.type), params.publishWithTokensOutOfLine === true) : publishDraft(tenantScope(params.type))));
|
|
29137
29183
|
}
|
|
29138
29184
|
if (client.hasCapability("factories:read")) server.registerTool("taiga_get_factory_document", {
|
|
29139
29185
|
title: "Get factory instructions",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taiga-ai/mcp-server",
|
|
3
|
-
"version": "0.36.0-dev.
|
|
3
|
+
"version": "0.36.0-dev.775",
|
|
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",
|