@taiga-ai/mcp-server 0.35.0-dev.750 → 0.35.0-dev.752

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 (2) hide show
  1. package/dist/index.js +92 -17
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -22324,6 +22324,7 @@ var TaigaClient = class {
22324
22324
  if (opts?.factoryId) params.set("factoryId", opts.factoryId);
22325
22325
  if (opts?.status) params.set("status", opts.status);
22326
22326
  if (opts?.slug) params.set("slug", opts.slug);
22327
+ if (opts?.address) params.set("address", opts.address);
22327
22328
  if (opts?.repository) params.set("repository", opts.repository);
22328
22329
  if (opts?.repositoryHost) params.set("repositoryHost", opts.repositoryHost);
22329
22330
  if (opts?.limit) params.set("limit", String(opts.limit));
@@ -23211,6 +23212,58 @@ const PRODUCT_DOCUMENT_DISPLAY_NAMES = {
23211
23212
  };
23212
23213
  const PRODUCT_DOCUMENT_ORIGINS = ["plan", "reality"];
23213
23214
  //#endregion
23215
+ //#region ../../packages/types/dist/route-key.js
23216
+ /**
23217
+ * How a factory or a product is addressed in a URL (PRO-591): its slug, for a
23218
+ * person to read, then its slug id, which names it -- as Linear addresses a
23219
+ * project (`sync-engine-d72b9984b8d8`).
23220
+ *
23221
+ * The slug follows the name (PRO-534), so a rename changes it, and an address
23222
+ * built from the slug alone stopped resolving the moment it did: links in
23223
+ * email and chat, bookmarks, another person's open tab. The slug id is set
23224
+ * once and never changes, and a route resolves by it alone, so an address
23225
+ * made before any number of renames still opens the same record, which the
23226
+ * app then redirects to its current slug.
23227
+ */
23228
+ /**
23229
+ * A slug id: twelve lowercase hex characters, 48 random bits. Made by the
23230
+ * database's `gen_random_bytes`, or by the client's `crypto` for a factory it
23231
+ * creates through sync; unique within an organization, which a unique index
23232
+ * enforces rather than a check before the write.
23233
+ */
23234
+ const SLUG_ID_PATTERN = /^[0-9a-f]{12}$/;
23235
+ /** A uuid, as a product's address carried it before PRO-541. */
23236
+ const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
23237
+ /**
23238
+ * A record's address segment: `<slug>-<slugId>`. Every link to a factory or a
23239
+ * product is built from this, never from the slug alone, which the next
23240
+ * rename breaks.
23241
+ *
23242
+ * The slug id alone instead while the slug is not known yet (a factory
23243
+ * created through sync, whose slug the server makes), and for a slug of four
23244
+ * hex groups (`12345678-1234-1234-1234`), whose address would read as a uuid,
23245
+ * which a route takes for a product's id. Either way the address ends in the
23246
+ * slug id, so `slugIdOf` reads it back from every address this makes.
23247
+ */
23248
+ function routeKey(record) {
23249
+ if (record.slug === "") return record.slugId;
23250
+ const address = `${record.slug}-${record.slugId}`;
23251
+ return UUID_PATTERN.test(address) ? record.slugId : address;
23252
+ }
23253
+ /**
23254
+ * The slug id an address segment names: its last hyphen-separated part, when
23255
+ * that is one. A segment that ends in one is resolved by it alone, never by a
23256
+ * slug that reads the same, so an address goes on naming its record, and
23257
+ * names nothing once that record is deleted. Undefined for an address from
23258
+ * before slug ids (a bare slug, or a product's uuid, whose last group is
23259
+ * twelve hex characters too), which resolves the way it always did.
23260
+ */
23261
+ function slugIdOf(segment) {
23262
+ if (UUID_PATTERN.test(segment)) return void 0;
23263
+ const last = segment.slice(segment.lastIndexOf("-") + 1);
23264
+ return SLUG_ID_PATTERN.test(last) ? last : void 0;
23265
+ }
23266
+ //#endregion
23214
23267
  //#region ../../packages/types/dist/backlog.js
23215
23268
  /** Dispositions that end an item's pipeline life: settled work neither blocks
23216
23269
  * dependants nor counts toward completion denominators. */
@@ -25145,7 +25198,7 @@ const PRODUCT_NETWORK_ACCESS = ["allowlist", "unrestricted"];
25145
25198
  * reads as deleted) and fields they explain would simply be missing. So it
25146
25199
  * refuses to start, and says what to do.
25147
25200
  */
25148
- function apiLevelProblem(introspection, apiUrl, required = 5, version = SERVER_VERSION) {
25201
+ function apiLevelProblem(introspection, apiUrl, required = 6, version = SERVER_VERSION) {
25149
25202
  const offered = introspection.mcpApiLevel ?? 0;
25150
25203
  if (offered >= required) return null;
25151
25204
  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.`;
@@ -25382,7 +25435,7 @@ const pagination = {
25382
25435
  limit: number$1().int().min(1).max(100).optional().describe("Max results (default 25)"),
25383
25436
  cursor: string$2().max(256).optional().describe("The previous page's nextCursor; omit for the first page")
25384
25437
  };
25385
- const slug = string$2().max(63).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, "A slug is lowercase words joined by hyphens").describe("Product slug, as it appears in Taiga URLs");
25438
+ const slug = string$2().max(76).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, "A slug is lowercase words joined by hyphens").describe("The segment after /products/ in its Taiga URL (web-shop-5d060fa7460e), or its slug");
25386
25439
  const remoteUrl = string$2().min(1).max(2048).describe("The git remote URL of a checkout (git remote get-url origin): https://, git@host:owner/repo.git or ssh://");
25387
25440
  //#endregion
25388
25441
  //#region src/tools/catalogue.ts
@@ -27104,6 +27157,15 @@ async function withFactoryNames(client, rows) {
27104
27157
  throw error;
27105
27158
  }
27106
27159
  }
27160
+ /**
27161
+ * What a list search matches of a row's address (PRO-3690): the address, as a
27162
+ * person copies it from a Taiga URL, and the query itself when it ends in the
27163
+ * row's slug id -- an address made before a rename, whose slug is the old one.
27164
+ */
27165
+ function addressText(row, query) {
27166
+ const slugId = slugIdOf(query.trim().toLowerCase());
27167
+ return slugId !== void 0 && slugId === row.slugId ? [routeKey(row), query] : [routeKey(row)];
27168
+ }
27107
27169
  /** Factory pages read to name products' factories. */
27108
27170
  const FACTORY_PAGES = 10;
27109
27171
  /** A list's name search: part of a name, any case. */
@@ -27236,10 +27298,10 @@ function describeMiss(type, wanted, timelines, product) {
27236
27298
  return parts.join(" ");
27237
27299
  }
27238
27300
  /**
27239
- * One product from whichever name the caller has: its ID, its slug (through
27240
- * the list's slug filter) or the git remote of a checkout (through the
27241
- * repository filter). Exactly one of the three; a remote linked to several
27242
- * products is ambiguous and says so.
27301
+ * One product from whichever name the caller has: its ID, its address or slug
27302
+ * (through the list's address filter, PRO-3690) or the git remote of a
27303
+ * checkout (through the repository filter). Exactly one of the three; a remote
27304
+ * linked to several products is ambiguous and says so.
27243
27305
  */
27244
27306
  async function resolveProductRef(client, ref, accepted, usage) {
27245
27307
  const refusal = (code, message) => ({ refusal: {
@@ -27262,11 +27324,15 @@ async function resolveProductRef(client, ref, accepted, usage) {
27262
27324
  return refusal(apiFailureCode(error), error instanceof TaigaApiError && error.status === 404 ? "No product with that ID the key can see. taiga_list_products (query finds one by name) shows the ones it can; a slug or git remote URL names one too." : `No product with that ID the key can see (${apiFailureText(error)}); taiga_list_products shows the ones it can.`);
27263
27325
  }
27264
27326
  if (ref.slug) {
27265
- const [product] = (await client.listProducts({
27266
- slug: ref.slug,
27327
+ const [byAddress] = (await client.listProducts({
27328
+ address: ref.slug,
27267
27329
  limit: 1
27268
27330
  })).data;
27269
- if (!product) return refusal("NOT_FOUND", `No product you can see has the slug "${ref.slug}". taiga_list_products shows the ones you can.`);
27331
+ const product = byAddress ?? (slugIdOf(ref.slug) === void 0 || ref.slug.length > 63 ? void 0 : (await client.listProducts({
27332
+ slug: ref.slug,
27333
+ limit: 1
27334
+ })).data[0]);
27335
+ if (!product) return refusal("NOT_FOUND", `No product you can see has the address or slug "${ref.slug}". taiga_list_products shows the ones you can.`);
27270
27336
  return { product };
27271
27337
  }
27272
27338
  const remote = parseRemote(ref.remoteUrl);
@@ -27301,9 +27367,9 @@ async function factoryMissing(client, factoryId) {
27301
27367
  function registerProductTools(server, client) {
27302
27368
  if (client.hasCapability("factories:read")) server.registerTool("taiga_list_factories", {
27303
27369
  title: "List factories",
27304
- description: "List the organization's factories (the groups that own products), with their IDs. query finds one by name.",
27370
+ description: "List the organization's factories (the groups that own products), with their IDs. query finds one by name, slug or the segment after /factories/ in its Taiga URL.",
27305
27371
  inputSchema: object({
27306
- query: query("factory name"),
27372
+ query: query("factory name or slug, or its Taiga URL segment"),
27307
27373
  ...pagination
27308
27374
  }),
27309
27375
  annotations: READ_ONLY
@@ -27313,10 +27379,15 @@ function registerProductTools(server, client) {
27313
27379
  return toolResult(page(result.data, result.nextCursor));
27314
27380
  }
27315
27381
  if (params.cursor !== void 0) return toolError("VALIDATION_ERROR", SEARCH_WITH_CURSOR);
27382
+ const text = params.query;
27316
27383
  const found = await searchPages((cursor) => client.listFactories({
27317
27384
  limit: 100,
27318
27385
  cursor
27319
- }), params.query, (row) => [row.name, row.slug], params.limit ?? 25, void 0, (row) => row.name);
27386
+ }), text, (row) => [
27387
+ row.name,
27388
+ row.slug,
27389
+ ...addressText(row, text)
27390
+ ], params.limit ?? 25, void 0, (row) => row.name);
27320
27391
  return toolResult({
27321
27392
  ...page(found.rows, null),
27322
27393
  ...found.more ? { more: SEARCH_NOTE } : {},
@@ -27326,9 +27397,9 @@ function registerProductTools(server, client) {
27326
27397
  if (client.hasCapability("products:read")) {
27327
27398
  server.registerTool("taiga_list_products", {
27328
27399
  title: "List products",
27329
- description: "List the organization's products, with their IDs. query finds one by name or slug. Each row says its factory and status; discoveryStep says how far a product in setup is (null once it is active). Inside a git checkout, taiga_get_product_context takes the remote URL instead. standing: true adds each product's policy standing (violations by severity), for questions across products.",
27400
+ description: "List the organization's products, with their IDs. query finds one by name, slug or the segment after /products/ in its Taiga URL. Each row says its factory and status; discoveryStep says how far a product in setup is (null once it is active). Inside a git checkout, taiga_get_product_context takes the remote URL instead. standing: true adds each product's policy standing (violations by severity), for questions across products.",
27330
27401
  inputSchema: object({
27331
- query: query("product name or slug"),
27402
+ query: query("product name or slug, or its Taiga URL segment"),
27332
27403
  factoryId: idInput("factory", "taiga_list_factories (query finds one by name) gives it").optional().describe("Only the products of this factory"),
27333
27404
  status: _enum(PRODUCT_STATUSES).optional().describe("Filter by status: draft until the product finishes setup in Taiga, active after that, archived when retired."),
27334
27405
  standing: boolean().optional().describe("Add each product's policy standing: violations by severity and controls met (one read each, so a page holds 25 at most)"),
@@ -27356,7 +27427,11 @@ function registerProductTools(server, client) {
27356
27427
  status: filters.status,
27357
27428
  limit: 100,
27358
27429
  cursor
27359
- }), text, (row) => [row.name, row.slug], filters.limit ?? 25, void 0, (row) => row.name);
27430
+ }), text, (row) => [
27431
+ row.name,
27432
+ row.slug,
27433
+ ...addressText(row, text)
27434
+ ], filters.limit ?? 25, void 0, (row) => row.name);
27360
27435
  if (found.rows.length === 0 && filters.factoryId) {
27361
27436
  const missing = await factoryMissing(client, filters.factoryId);
27362
27437
  if (missing) return missing;
@@ -45296,7 +45371,7 @@ async function served$1(read, miss) {
45296
45371
  function registerPrompts(server, client) {
45297
45372
  if (client.hasCapability("products:read")) server.registerPrompt("taiga_start_session", {
45298
45373
  title: "Start a session on a product",
45299
- description: "Open a coding session with everything Taiga knows about the product: its factory instructions, specification and architecture, the policies that apply, the open backlog and the latest runs. Name the product by the git remote URL of the checkout, its slug or its ID.",
45374
+ description: "Open a coding session with everything Taiga knows about the product: its factory instructions, specification and architecture, the policies that apply, the open backlog and the latest runs. Name the product by the git remote URL of the checkout, the segment after /products/ in its Taiga URL, or its ID.",
45300
45375
  argsSchema: object({
45301
45376
  slug: slug.optional(),
45302
45377
  productId: productId.optional(),
@@ -45307,7 +45382,7 @@ function registerPrompts(server, client) {
45307
45382
  "slug",
45308
45383
  "productId",
45309
45384
  "remoteUrl"
45310
- ], "Pass the slug as the first argument (/taiga_start_session <slug>, the slug from the Taiga URL); taiga_list_products lists the slugs.");
45385
+ ], "Pass the segment after /products/ in its Taiga URL as the first argument (/taiga_start_session <slug>, such as web-shop-5d060fa7460e); taiga_list_products lists the products.");
45311
45386
  if ("refusal" in resolved) refuse(resolved.refusal);
45312
45387
  return message([
45313
45388
  "You are working on a product managed in Taiga. The fenced JSON below is its context: the product and",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taiga-ai/mcp-server",
3
- "version": "0.35.0-dev.750",
3
+ "version": "0.35.0-dev.752",
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",