@verbaly/mcp 0.44.0 → 0.46.0

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/cli.js CHANGED
@@ -134,7 +134,7 @@ function createVerbalyMcp(options = {}) {
134
134
  }));
135
135
  server.registerTool("verbaly_wrap", {
136
136
  title: "Wrap hardcoded JSX text",
137
- description: "Find hardcoded user-visible text in JSX/TSX files and wrap it in a t tagged template so the compiler can extract it (what `verbaly wrap` does). This is how an existing codebase is onboarded. Reports only unless write is set. Text it cannot wrap safely (a sentence split across markup, an expression rendering JSX) is listed as needing a human and never rewritten. After writing, make t available where TypeScript complains (React: const t = useT()) and run verbaly_extract.",
137
+ description: "Find hardcoded user-visible text in JSX/TSX files and wrap it in a t tagged template so the compiler can extract it (what `verbaly wrap` does). This is how an existing codebase is onboarded. Reports only unless write is set. Text it cannot wrap safely (a sentence split across markup, an expression rendering JSX) is listed as needing a human and never rewritten. A file that does not bind t is never written either, because the rewrite would not compile: those come back in blocked, with whether the file is a client component, so you can add the binding and run again.",
138
138
  inputSchema: {
139
139
  root: rootInput,
140
140
  write: z.boolean().optional().describe("Apply the rewrites instead of only reporting")
@@ -155,13 +155,21 @@ function createVerbalyMcp(options = {}) {
155
155
  line: z.number(),
156
156
  text: z.string(),
157
157
  reason: z.string()
158
+ })),
159
+ blocked: z.array(z.object({
160
+ file: z.string(),
161
+ texts: z.number(),
162
+ client: z.boolean()
158
163
  }))
159
164
  }
160
165
  }, guarded(async ({ root, write }) => {
161
166
  const cfg = await config(root);
162
167
  const result = await wrapProject(cfg, { write });
163
- const lines = [`${write ? "wrapped" : "would wrap"} ${counted(result.wrapped.length, "text")} in ${counted(result.changed.length, "file")} of ${counted(result.files, "file")} scanned`];
164
- for (const entry of result.wrapped) {
168
+ const blocked = new Set(result.blocked.map((entry) => entry.file));
169
+ const done = result.changed.filter((file) => !blocked.has(file));
170
+ const texts = result.wrapped.filter((entry) => !blocked.has(entry.file));
171
+ const lines = [`${write ? "wrapped" : "would wrap"} ${write ? `${counted(texts.length, "text")} in ${counted(done.length, "file")}` : `${counted(result.wrapped.length, "text")} in ${counted(result.changed.length, "file")}`} of ${counted(result.files, "file")} scanned`];
172
+ for (const entry of write ? texts : result.wrapped) {
165
173
  const attr = entry.kind === "attribute" ? `${entry.attribute} -> ` : "";
166
174
  lines.push(` ${entry.file}:${entry.line} ${attr}"${entry.text}"`);
167
175
  }
@@ -169,7 +177,14 @@ function createVerbalyMcp(options = {}) {
169
177
  lines.push(" needs a human:");
170
178
  for (const entry of result.skipped) lines.push(` ${entry.file}:${entry.line} "${entry.text}" (${entry.reason})`);
171
179
  }
172
- if (write && result.changed.length > 0) lines.push(" next: make t available where TS complains, then run verbaly_extract");
180
+ if (result.blocked.length > 0) {
181
+ lines.push(` nothing written in ${counted(result.blocked.length, "file")} with no t in scope:`);
182
+ for (const entry of result.blocked) {
183
+ const how = entry.client ? "\"use client\", so const t = useT()" : "no \"use client\"";
184
+ lines.push(` ${entry.file} ${counted(entry.texts, "text")}, ${how}`);
185
+ }
186
+ lines.push(" next: bind t there, run verbaly_wrap with write again, then verbaly_extract");
187
+ } else if (write && done.length > 0) lines.push(" next: run verbaly_extract");
173
188
  return reply(lines.join("\n"), {
174
189
  ...result,
175
190
  write: write === true
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","names":[],"sources":["../src/server.ts","../src/cli.ts"],"sourcesContent":["import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';\nimport {\n check,\n collectOrigins,\n counted,\n doctor,\n effectiveDrafts,\n extractProject,\n formatCheckResult,\n formatCheckWarnings,\n formatDoctorEntry,\n formatStatusResult,\n formatTranslateFailures,\n loadCatalogs,\n loadConfig,\n loadDrafts,\n markDrafts,\n pruneCatalogs,\n resolveProvider,\n saveDrafts,\n status,\n syncCatalogs,\n translateCatalogs,\n wrapProject,\n writeCatalog,\n writeDts,\n type ResolvedConfig,\n} from '@verbaly/compiler';\nimport { createRequire } from 'node:module';\nimport { z } from 'zod';\n\nconst { version } = createRequire(import.meta.url)('../package.json') as { version: string };\n\nexport interface VerbalyMcpOptions {\n root?: string;\n}\n\n// text stays the fallback for a client that reads no schema, structuredContent is what agents parse\nconst reply = (body: string, data: Record<string, unknown>): CallToolResult => ({\n content: [{ type: 'text', text: body }],\n structuredContent: data,\n});\n\nconst rootInput = z\n .string()\n .optional()\n .describe('Project root holding verbaly.config (defaults to the server working directory)');\n\nconst perLocale = z.array(z.object({ locale: z.string(), keys: z.array(z.string()) }));\n\n// a locale-keyed record is a dynamic schema an agent cannot read ahead: lists enumerate\nconst byLocale = (record: Record<string, string[]>): Array<{ locale: string; keys: string[] }> =>\n Object.entries(record).map(([locale, keys]) => ({ locale, keys }));\n\nexport function createVerbalyMcp(options: VerbalyMcpOptions = {}): McpServer {\n const server = new McpServer({ name: 'verbaly', version });\n\n const config = (root?: string): Promise<ResolvedConfig> =>\n loadConfig(root ?? options.root ?? process.cwd());\n\n // agents act on messages, not stack traces: every failure comes back as actionable text\n const guarded =\n <A>(run: (args: A) => Promise<CallToolResult>) =>\n async (args: A): Promise<CallToolResult> => {\n try {\n return await run(args);\n } catch (error) {\n return {\n content: [{ type: 'text', text: error instanceof Error ? error.message : String(error) }],\n isError: true,\n };\n }\n };\n\n server.registerTool(\n 'verbaly_status',\n {\n title: 'Translation coverage',\n description:\n 'Translation coverage of the Verbaly project: total messages, translated count per locale and machine translations awaiting review (drafts). Read-only.',\n inputSchema: { root: rootInput },\n outputSchema: {\n messages: z.number().describe('Messages the project has, source catalog plus code'),\n source: z.string().describe('Source locale'),\n locales: z.array(\n z.object({\n locale: z.string(),\n translated: z.number(),\n total: z.number(),\n drafts: z.number().describe('Machine translations awaiting human review'),\n broken: z.number().describe('Present but not rendering what the source renders'),\n }),\n ),\n },\n annotations: { readOnlyHint: true },\n },\n guarded(async ({ root }) => {\n const cfg = await config(root);\n const registry = await extractProject(cfg);\n const result = status(cfg, loadCatalogs(cfg), registry, loadDrafts(cfg));\n return reply(formatStatusResult(result), { ...result });\n }),\n );\n\n server.registerTool(\n 'verbaly_missing',\n {\n title: 'Missing and broken translations',\n description:\n 'List missing translations, unknown keys and translations that exist but cannot render what the source renders (a dropped {param}, a lost rich tag, a flattened plural block), the same gate `verbaly check` runs in CI. Warnings such as an incomplete plural set for the locale are listed too and do not fail the gate. Optionally also lists machine translations awaiting review. Read-only.',\n inputSchema: {\n root: rootInput,\n drafts: z\n .boolean()\n .optional()\n .describe('Also list machine translations awaiting human review'),\n },\n outputSchema: {\n ok: z.boolean().describe('Whether `verbaly check` would pass (warnings never fail it)'),\n missing: z.array(\n z.object({ locale: z.string(), key: z.string(), source: z.string().optional() }),\n ),\n unknown: z.array(z.object({ key: z.string(), files: z.array(z.string()) })),\n broken: z.array(\n z.object({\n locale: z.string(),\n key: z.string(),\n severity: z.enum(['error', 'warning']),\n issue: z.string(),\n }),\n ),\n unreviewed: perLocale,\n },\n annotations: { readOnlyHint: true },\n },\n guarded(async ({ root, drafts }) => {\n const cfg = await config(root);\n const registry = await extractProject(cfg);\n const catalogs = loadCatalogs(cfg);\n const result = check(cfg, catalogs, registry);\n const unreviewed = drafts ? byLocale(effectiveDrafts(loadDrafts(cfg), catalogs)) : [];\n\n const lines: string[] = [];\n if (!result.ok) lines.push(formatCheckResult(result));\n const warnings = formatCheckWarnings(result);\n if (warnings) lines.push(`warnings (the gate still passes):\\n${warnings}`);\n for (const { locale, keys } of unreviewed) {\n if (keys.length) lines.push(`[${locale}] ${keys.length} unreviewed: ${keys.join(', ')}`);\n }\n return reply(lines.length === 0 ? 'all translations complete' : lines.join('\\n'), {\n ...result,\n unreviewed,\n });\n }),\n );\n\n server.registerTool(\n 'verbaly_doctor',\n {\n title: 'Diagnose the setup',\n description:\n 'Diagnose a Verbaly project end to end (what `verbaly doctor` does): the config file, the catalog files and their JSON, the bundler plugin for the detected framework, the generated types, files the parser could not read, t imported from a package that never exports it, orphan keys, and every failure `verbaly check` would report. Run this first when something does not work. Read-only.',\n inputSchema: { root: rootInput },\n outputSchema: {\n ok: z.boolean().describe('False when an entry is an error, which is when the CLI exits 1'),\n entries: z.array(\n z.object({\n level: z.enum(['ok', 'warn', 'error']),\n check: z.string(),\n message: z.string(),\n fix: z.string().optional().describe('What to run or change, when there is one'),\n }),\n ),\n },\n annotations: { readOnlyHint: true },\n },\n guarded(async ({ root }) => {\n const cfg = await config(root);\n const result = await doctor(cfg);\n const health = result.ok ? 'setup looks healthy' : 'problems found';\n const head = `${counted(result.entries.length, 'check')}, ${health}`;\n return reply([head, ...result.entries.map(formatDoctorEntry)].join('\\n'), { ...result });\n }),\n );\n\n server.registerTool(\n 'verbaly_wrap',\n {\n title: 'Wrap hardcoded JSX text',\n description:\n 'Find hardcoded user-visible text in JSX/TSX files and wrap it in a t tagged template so the compiler can extract it (what `verbaly wrap` does). This is how an existing codebase is onboarded. Reports only unless write is set. Text it cannot wrap safely (a sentence split across markup, an expression rendering JSX) is listed as needing a human and never rewritten. After writing, make t available where TypeScript complains (React: const t = useT()) and run verbaly_extract.',\n inputSchema: {\n root: rootInput,\n write: z.boolean().optional().describe('Apply the rewrites instead of only reporting'),\n },\n outputSchema: {\n files: z.number().describe('JSX/TSX files scanned'),\n write: z.boolean(),\n changed: z.array(z.string()).describe('Files the rewrite touched, or would touch'),\n wrapped: z.array(\n z.object({\n file: z.string(),\n line: z.number(),\n text: z.string(),\n kind: z.enum(['text', 'attribute']),\n attribute: z.string().optional(),\n }),\n ),\n skipped: z.array(\n z.object({ file: z.string(), line: z.number(), text: z.string(), reason: z.string() }),\n ),\n },\n },\n guarded(async ({ root, write }) => {\n const cfg = await config(root);\n const result = await wrapProject(cfg, { write });\n const verb = write ? 'wrapped' : 'would wrap';\n const lines = [\n `${verb} ${counted(result.wrapped.length, 'text')} in ${counted(result.changed.length, 'file')} of ${counted(result.files, 'file')} scanned`,\n ];\n for (const entry of result.wrapped) {\n const attr = entry.kind === 'attribute' ? `${entry.attribute} -> ` : '';\n lines.push(` ${entry.file}:${entry.line} ${attr}\"${entry.text}\"`);\n }\n if (result.skipped.length > 0) {\n lines.push(' needs a human:');\n for (const entry of result.skipped) {\n lines.push(` ${entry.file}:${entry.line} \"${entry.text}\" (${entry.reason})`);\n }\n }\n if (write && result.changed.length > 0) {\n lines.push(' next: make t available where TS complains, then run verbaly_extract');\n }\n return reply(lines.join('\\n'), { ...result, write: write === true });\n }),\n );\n\n server.registerTool(\n 'verbaly_extract',\n {\n title: 'Extract messages',\n description:\n 'Scan the source files, add new messages to the locale catalogs and refresh the generated types (what `verbaly extract` does). Writes catalog files unless dryRun is set. prune drops keys no longer referenced in the code, translations included.',\n inputSchema: {\n root: rootInput,\n prune: z\n .boolean()\n .optional()\n .describe('Drop keys no longer referenced (deletes their translations)'),\n dryRun: z.boolean().optional().describe('Report what would change, write nothing'),\n },\n outputSchema: {\n messages: z.number(),\n locales: z.array(z.string()),\n dryRun: z.boolean(),\n added: perLocale,\n pruned: perLocale,\n },\n },\n guarded(async ({ root, prune, dryRun }) => {\n const cfg = await config(root);\n const registry = await extractProject(cfg);\n const catalogs = loadCatalogs(cfg);\n\n const lines: string[] = [];\n const pruned = prune ? byLocale(pruneCatalogs(cfg, catalogs, registry)) : [];\n for (const { locale, keys } of pruned) {\n lines.push(\n dryRun\n ? `${locale}: would prune ${keys.length}: ${keys.join(', ')}`\n : `${locale}: ${keys.length} pruned`,\n );\n }\n const added = byLocale(syncCatalogs(cfg, catalogs, registry).added);\n if (!dryRun) {\n for (const locale of cfg.locales) {\n writeCatalog(cfg, locale, catalogs[locale] ?? {});\n }\n if (cfg.dts !== false) writeDts(cfg, catalogs[cfg.sourceLocale] ?? {}, cfg.dts);\n }\n const messages = registry.messages().size;\n lines.unshift(\n `${counted(messages, 'message')} · locales: ${cfg.locales.join(', ')}${dryRun ? ' (dry run, nothing written)' : ''}`,\n );\n for (const { locale, keys } of added) {\n lines.push(`${locale}: ${dryRun ? `would add ${keys.length}` : `+${keys.length} added`}`);\n }\n return reply(lines.join('\\n'), {\n messages,\n locales: cfg.locales,\n dryRun: dryRun === true,\n added,\n pruned,\n });\n }),\n );\n\n server.registerTool(\n 'verbaly_translate',\n {\n title: 'Machine-translate missing entries',\n description:\n 'Fill missing translations with the configured provider (default: Claude, needs @anthropic-ai/sdk and ANTHROPIC_API_KEY). New translations are saved as drafts awaiting human review (`verbaly review`), which no tool here can approve. A batch the provider never answers is reported in failed and leaves everything else written, so a retry only asks for what is left. dryRun lists what would be translated without calling the provider.',\n inputSchema: {\n root: rootInput,\n locales: z.array(z.string()).optional().describe('Target locales (default: all)'),\n dryRun: z\n .boolean()\n .optional()\n .describe('List missing entries per locale, call no provider'),\n },\n outputSchema: {\n dryRun: z.boolean(),\n translated: perLocale.describe('Saved as drafts, a human still has to approve them'),\n invalid: perLocale.describe('Rejected: params or tags were not preserved'),\n failed: z\n .array(z.object({ locale: z.string(), keys: z.array(z.string()), error: z.string() }))\n .describe('Batches the provider never answered, safe to retry'),\n pending: perLocale.describe('dryRun only: what would be translated'),\n },\n },\n guarded(async ({ root, locales, dryRun }) => {\n const cfg = await config(root);\n const catalogs = loadCatalogs(cfg);\n const provider = await resolveProvider(cfg);\n const result = await translateCatalogs(cfg, catalogs, provider, {\n locales,\n batchSize: cfg.translate.batchSize,\n concurrency: cfg.translate.concurrency,\n retries: cfg.translate.retries,\n dryRun,\n origins: dryRun ? undefined : await collectOrigins(cfg),\n });\n\n const data = {\n dryRun: dryRun === true,\n translated: byLocale(result.translated),\n invalid: byLocale(result.invalid),\n failed: result.failed,\n pending: byLocale(result.pending),\n };\n\n if (dryRun) {\n const lines = data.pending.map(\n ({ locale, keys }) => `${locale}: ${keys.length} missing: ${keys.join(', ')}`,\n );\n return reply(lines.length === 0 ? 'nothing to translate' : lines.join('\\n'), data);\n }\n\n const lines: string[] = [];\n const drafts = loadDrafts(cfg);\n for (const { locale, keys } of data.translated) {\n writeCatalog(cfg, locale, catalogs[locale] ?? {});\n markDrafts(drafts, locale, keys);\n lines.push(`${locale}: +${keys.length} translated (draft)`);\n }\n if (data.translated.length > 0) saveDrafts(cfg, drafts);\n for (const { locale, keys } of data.invalid) {\n lines.push(\n `${locale}: ${keys.length} rejected (params/tags not preserved): ${keys.join(', ')}`,\n );\n }\n lines.push(...formatTranslateFailures(result.failed));\n if (lines.length === 0) return reply('nothing to translate', data);\n if (data.translated.length > 0) {\n lines.push('drafts await human review: verbaly review (--approve accepts them)');\n }\n return reply(lines.join('\\n'), data);\n }),\n );\n\n return server;\n}\n","#!/usr/bin/env node\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport { parseArgs } from 'node:util';\nimport { createVerbalyMcp } from './server';\n\nconst { values } = parseArgs({ options: { root: { type: 'string' } } });\n\ntry {\n await createVerbalyMcp({ root: values.root }).connect(new StdioServerTransport());\n // stdout carries the protocol: any human-facing note goes to stderr\n console.error('[verbaly-mcp] ready (stdio)');\n} catch (error) {\n console.error('[verbaly-mcp]', error instanceof Error ? error.message : error);\n process.exitCode = 1;\n}\n"],"mappings":";;;;;;;;AAgCA,MAAM,EAAE,YAAY,cAAc,YAAY,GAAG,CAAC,CAAC,iBAAiB;AAOpE,MAAM,SAAS,MAAc,UAAmD;CAC9E,SAAS,CAAC;EAAE,MAAM;EAAQ,MAAM;CAAK,CAAC;CACtC,mBAAmB;AACrB;AAEA,MAAM,YAAY,EACf,OAAO,CAAC,CACR,SAAS,CAAC,CACV,SAAS,gFAAgF;AAE5F,MAAM,YAAY,EAAE,MAAM,EAAE,OAAO;CAAE,QAAQ,EAAE,OAAO;CAAG,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC;AAAE,CAAC,CAAC;AAGrF,MAAM,YAAY,WAChB,OAAO,QAAQ,MAAM,CAAC,CAAC,KAAK,CAAC,QAAQ,WAAW;CAAE;CAAQ;AAAK,EAAE;AAEnE,SAAgB,iBAAiB,UAA6B,CAAC,GAAc;CAC3E,MA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EA,MAAM,QAAkB,CAAC;EACzB,MAAM,SAAS,WAAW,GAAG;EAC7B,KAAK,MAAM,EAAE,QAAQ,UAAU,KAAK,YAAY;GAC9C,aAAa,KAAK,QAAQ,SAAS,WAAW,CAAC,CAAC;GAChD,WAAW,QAAQ,QAAQ,IAAI;GAC/B,MAAM,KAAK,GAAG,OAAO,KAAK,KAAK,OAAO,oBAAoB;EAC5D;EACA,IAAI,KAAK,WAAW,SAAS,GAAG,WAAW,KAAK,MAAM;EACtD,KAAK,MAAM,EAAE,QAAQ,UAAU,KAAK,SAClC,MAAM,KACJ,GAAG,OAAO,IAAI,KAAK,OAAO,yCAAyC,KAAK,KAAK,IAAI,GACnF;EAEF,MAAM,KAAK,GAAG,wBAAwB,OAAO,MAAM,CAAC;EACpD,IAAI,MAAM,WAAW,GAAG,OAAO,MAAM,wBAAwB,IAAI;EACjE,IAAI,KAAK,WAAW,SAAS,GAC3B,MAAM,KAAK,oEAAoE;EAEjF,OAAO,MAAM,MAAM,KAAK,IAAI,GAAG,IAAI;CACrC,CAAC,CACH;CAEA,OAAO;AACT;;;AChXA,MAAM,EAAE,WAAW,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,SAAS,EAAE,EAAE,CAAC;AAEtE,IAAI;CACF,MAAM,iBAAiB,EAAE,MAAM,OAAO,KAAK,CAAC,CAAC,CAAC,QAAQ,IAAI,qBAAqB,CAAC;CAEhF,QAAQ,MAAM,6BAA6B;AAC7C,SAAS,OAAO;CACd,QAAQ,MAAM,iBAAiB,iBAAiB,QAAQ,MAAM,UAAU,KAAK;CAC7E,QAAQ,WAAW;AACrB"}
1
+ {"version":3,"file":"cli.js","names":[],"sources":["../src/server.ts","../src/cli.ts"],"sourcesContent":["import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';\nimport {\n check,\n collectOrigins,\n counted,\n doctor,\n effectiveDrafts,\n extractProject,\n formatCheckResult,\n formatCheckWarnings,\n formatDoctorEntry,\n formatStatusResult,\n formatTranslateFailures,\n loadCatalogs,\n loadConfig,\n loadDrafts,\n markDrafts,\n pruneCatalogs,\n resolveProvider,\n saveDrafts,\n status,\n syncCatalogs,\n translateCatalogs,\n wrapProject,\n writeCatalog,\n writeDts,\n type ResolvedConfig,\n} from '@verbaly/compiler';\nimport { createRequire } from 'node:module';\nimport { z } from 'zod';\n\nconst { version } = createRequire(import.meta.url)('../package.json') as { version: string };\n\nexport interface VerbalyMcpOptions {\n root?: string;\n}\n\n// text stays the fallback for a client that reads no schema, structuredContent is what agents parse\nconst reply = (body: string, data: Record<string, unknown>): CallToolResult => ({\n content: [{ type: 'text', text: body }],\n structuredContent: data,\n});\n\nconst rootInput = z\n .string()\n .optional()\n .describe('Project root holding verbaly.config (defaults to the server working directory)');\n\nconst perLocale = z.array(z.object({ locale: z.string(), keys: z.array(z.string()) }));\n\n// a locale-keyed record is a dynamic schema an agent cannot read ahead: lists enumerate\nconst byLocale = (record: Record<string, string[]>): Array<{ locale: string; keys: string[] }> =>\n Object.entries(record).map(([locale, keys]) => ({ locale, keys }));\n\nexport function createVerbalyMcp(options: VerbalyMcpOptions = {}): McpServer {\n const server = new McpServer({ name: 'verbaly', version });\n\n const config = (root?: string): Promise<ResolvedConfig> =>\n loadConfig(root ?? options.root ?? process.cwd());\n\n // agents act on messages, not stack traces: every failure comes back as actionable text\n const guarded =\n <A>(run: (args: A) => Promise<CallToolResult>) =>\n async (args: A): Promise<CallToolResult> => {\n try {\n return await run(args);\n } catch (error) {\n return {\n content: [{ type: 'text', text: error instanceof Error ? error.message : String(error) }],\n isError: true,\n };\n }\n };\n\n server.registerTool(\n 'verbaly_status',\n {\n title: 'Translation coverage',\n description:\n 'Translation coverage of the Verbaly project: total messages, translated count per locale and machine translations awaiting review (drafts). Read-only.',\n inputSchema: { root: rootInput },\n outputSchema: {\n messages: z.number().describe('Messages the project has, source catalog plus code'),\n source: z.string().describe('Source locale'),\n locales: z.array(\n z.object({\n locale: z.string(),\n translated: z.number(),\n total: z.number(),\n drafts: z.number().describe('Machine translations awaiting human review'),\n broken: z.number().describe('Present but not rendering what the source renders'),\n }),\n ),\n },\n annotations: { readOnlyHint: true },\n },\n guarded(async ({ root }) => {\n const cfg = await config(root);\n const registry = await extractProject(cfg);\n const result = status(cfg, loadCatalogs(cfg), registry, loadDrafts(cfg));\n return reply(formatStatusResult(result), { ...result });\n }),\n );\n\n server.registerTool(\n 'verbaly_missing',\n {\n title: 'Missing and broken translations',\n description:\n 'List missing translations, unknown keys and translations that exist but cannot render what the source renders (a dropped {param}, a lost rich tag, a flattened plural block), the same gate `verbaly check` runs in CI. Warnings such as an incomplete plural set for the locale are listed too and do not fail the gate. Optionally also lists machine translations awaiting review. Read-only.',\n inputSchema: {\n root: rootInput,\n drafts: z\n .boolean()\n .optional()\n .describe('Also list machine translations awaiting human review'),\n },\n outputSchema: {\n ok: z.boolean().describe('Whether `verbaly check` would pass (warnings never fail it)'),\n missing: z.array(\n z.object({ locale: z.string(), key: z.string(), source: z.string().optional() }),\n ),\n unknown: z.array(z.object({ key: z.string(), files: z.array(z.string()) })),\n broken: z.array(\n z.object({\n locale: z.string(),\n key: z.string(),\n severity: z.enum(['error', 'warning']),\n issue: z.string(),\n }),\n ),\n unreviewed: perLocale,\n },\n annotations: { readOnlyHint: true },\n },\n guarded(async ({ root, drafts }) => {\n const cfg = await config(root);\n const registry = await extractProject(cfg);\n const catalogs = loadCatalogs(cfg);\n const result = check(cfg, catalogs, registry);\n const unreviewed = drafts ? byLocale(effectiveDrafts(loadDrafts(cfg), catalogs)) : [];\n\n const lines: string[] = [];\n if (!result.ok) lines.push(formatCheckResult(result));\n const warnings = formatCheckWarnings(result);\n if (warnings) lines.push(`warnings (the gate still passes):\\n${warnings}`);\n for (const { locale, keys } of unreviewed) {\n if (keys.length) lines.push(`[${locale}] ${keys.length} unreviewed: ${keys.join(', ')}`);\n }\n return reply(lines.length === 0 ? 'all translations complete' : lines.join('\\n'), {\n ...result,\n unreviewed,\n });\n }),\n );\n\n server.registerTool(\n 'verbaly_doctor',\n {\n title: 'Diagnose the setup',\n description:\n 'Diagnose a Verbaly project end to end (what `verbaly doctor` does): the config file, the catalog files and their JSON, the bundler plugin for the detected framework, the generated types, files the parser could not read, t imported from a package that never exports it, orphan keys, and every failure `verbaly check` would report. Run this first when something does not work. Read-only.',\n inputSchema: { root: rootInput },\n outputSchema: {\n ok: z.boolean().describe('False when an entry is an error, which is when the CLI exits 1'),\n entries: z.array(\n z.object({\n level: z.enum(['ok', 'warn', 'error']),\n check: z.string(),\n message: z.string(),\n fix: z.string().optional().describe('What to run or change, when there is one'),\n }),\n ),\n },\n annotations: { readOnlyHint: true },\n },\n guarded(async ({ root }) => {\n const cfg = await config(root);\n const result = await doctor(cfg);\n const health = result.ok ? 'setup looks healthy' : 'problems found';\n const head = `${counted(result.entries.length, 'check')}, ${health}`;\n return reply([head, ...result.entries.map(formatDoctorEntry)].join('\\n'), { ...result });\n }),\n );\n\n server.registerTool(\n 'verbaly_wrap',\n {\n title: 'Wrap hardcoded JSX text',\n description:\n 'Find hardcoded user-visible text in JSX/TSX files and wrap it in a t tagged template so the compiler can extract it (what `verbaly wrap` does). This is how an existing codebase is onboarded. Reports only unless write is set. Text it cannot wrap safely (a sentence split across markup, an expression rendering JSX) is listed as needing a human and never rewritten. A file that does not bind t is never written either, because the rewrite would not compile: those come back in blocked, with whether the file is a client component, so you can add the binding and run again.',\n inputSchema: {\n root: rootInput,\n write: z.boolean().optional().describe('Apply the rewrites instead of only reporting'),\n },\n outputSchema: {\n files: z.number().describe('JSX/TSX files scanned'),\n write: z.boolean(),\n changed: z.array(z.string()).describe('Files the rewrite touched, or would touch'),\n wrapped: z.array(\n z.object({\n file: z.string(),\n line: z.number(),\n text: z.string(),\n kind: z.enum(['text', 'attribute']),\n attribute: z.string().optional(),\n }),\n ),\n skipped: z.array(\n z.object({ file: z.string(), line: z.number(), text: z.string(), reason: z.string() }),\n ),\n blocked: z.array(\n z.object({ file: z.string(), texts: z.number(), client: z.boolean() }),\n ),\n },\n },\n guarded(async ({ root, write }) => {\n const cfg = await config(root);\n const result = await wrapProject(cfg, { write });\n const blocked = new Set(result.blocked.map((entry) => entry.file));\n const done = result.changed.filter((file) => !blocked.has(file));\n const texts = result.wrapped.filter((entry) => !blocked.has(entry.file));\n const verb = write ? 'wrapped' : 'would wrap';\n const counts = write\n ? `${counted(texts.length, 'text')} in ${counted(done.length, 'file')}`\n : `${counted(result.wrapped.length, 'text')} in ${counted(result.changed.length, 'file')}`;\n const lines = [`${verb} ${counts} of ${counted(result.files, 'file')} scanned`];\n for (const entry of write ? texts : result.wrapped) {\n const attr = entry.kind === 'attribute' ? `${entry.attribute} -> ` : '';\n lines.push(` ${entry.file}:${entry.line} ${attr}\"${entry.text}\"`);\n }\n if (result.skipped.length > 0) {\n lines.push(' needs a human:');\n for (const entry of result.skipped) {\n lines.push(` ${entry.file}:${entry.line} \"${entry.text}\" (${entry.reason})`);\n }\n }\n if (result.blocked.length > 0) {\n lines.push(` nothing written in ${counted(result.blocked.length, 'file')} with no t in scope:`);\n for (const entry of result.blocked) {\n const how = entry.client ? '\"use client\", so const t = useT()' : 'no \"use client\"';\n lines.push(` ${entry.file} ${counted(entry.texts, 'text')}, ${how}`);\n }\n lines.push(' next: bind t there, run verbaly_wrap with write again, then verbaly_extract');\n } else if (write && done.length > 0) {\n lines.push(' next: run verbaly_extract');\n }\n return reply(lines.join('\\n'), { ...result, write: write === true });\n }),\n );\n\n server.registerTool(\n 'verbaly_extract',\n {\n title: 'Extract messages',\n description:\n 'Scan the source files, add new messages to the locale catalogs and refresh the generated types (what `verbaly extract` does). Writes catalog files unless dryRun is set. prune drops keys no longer referenced in the code, translations included.',\n inputSchema: {\n root: rootInput,\n prune: z\n .boolean()\n .optional()\n .describe('Drop keys no longer referenced (deletes their translations)'),\n dryRun: z.boolean().optional().describe('Report what would change, write nothing'),\n },\n outputSchema: {\n messages: z.number(),\n locales: z.array(z.string()),\n dryRun: z.boolean(),\n added: perLocale,\n pruned: perLocale,\n },\n },\n guarded(async ({ root, prune, dryRun }) => {\n const cfg = await config(root);\n const registry = await extractProject(cfg);\n const catalogs = loadCatalogs(cfg);\n\n const lines: string[] = [];\n const pruned = prune ? byLocale(pruneCatalogs(cfg, catalogs, registry)) : [];\n for (const { locale, keys } of pruned) {\n lines.push(\n dryRun\n ? `${locale}: would prune ${keys.length}: ${keys.join(', ')}`\n : `${locale}: ${keys.length} pruned`,\n );\n }\n const added = byLocale(syncCatalogs(cfg, catalogs, registry).added);\n if (!dryRun) {\n for (const locale of cfg.locales) {\n writeCatalog(cfg, locale, catalogs[locale] ?? {});\n }\n if (cfg.dts !== false) writeDts(cfg, catalogs[cfg.sourceLocale] ?? {}, cfg.dts);\n }\n const messages = registry.messages().size;\n lines.unshift(\n `${counted(messages, 'message')} · locales: ${cfg.locales.join(', ')}${dryRun ? ' (dry run, nothing written)' : ''}`,\n );\n for (const { locale, keys } of added) {\n lines.push(`${locale}: ${dryRun ? `would add ${keys.length}` : `+${keys.length} added`}`);\n }\n return reply(lines.join('\\n'), {\n messages,\n locales: cfg.locales,\n dryRun: dryRun === true,\n added,\n pruned,\n });\n }),\n );\n\n server.registerTool(\n 'verbaly_translate',\n {\n title: 'Machine-translate missing entries',\n description:\n 'Fill missing translations with the configured provider (default: Claude, needs @anthropic-ai/sdk and ANTHROPIC_API_KEY). New translations are saved as drafts awaiting human review (`verbaly review`), which no tool here can approve. A batch the provider never answers is reported in failed and leaves everything else written, so a retry only asks for what is left. dryRun lists what would be translated without calling the provider.',\n inputSchema: {\n root: rootInput,\n locales: z.array(z.string()).optional().describe('Target locales (default: all)'),\n dryRun: z\n .boolean()\n .optional()\n .describe('List missing entries per locale, call no provider'),\n },\n outputSchema: {\n dryRun: z.boolean(),\n translated: perLocale.describe('Saved as drafts, a human still has to approve them'),\n invalid: perLocale.describe('Rejected: params or tags were not preserved'),\n failed: z\n .array(z.object({ locale: z.string(), keys: z.array(z.string()), error: z.string() }))\n .describe('Batches the provider never answered, safe to retry'),\n pending: perLocale.describe('dryRun only: what would be translated'),\n },\n },\n guarded(async ({ root, locales, dryRun }) => {\n const cfg = await config(root);\n const catalogs = loadCatalogs(cfg);\n const provider = await resolveProvider(cfg);\n const result = await translateCatalogs(cfg, catalogs, provider, {\n locales,\n batchSize: cfg.translate.batchSize,\n concurrency: cfg.translate.concurrency,\n retries: cfg.translate.retries,\n dryRun,\n origins: dryRun ? undefined : await collectOrigins(cfg),\n });\n\n const data = {\n dryRun: dryRun === true,\n translated: byLocale(result.translated),\n invalid: byLocale(result.invalid),\n failed: result.failed,\n pending: byLocale(result.pending),\n };\n\n if (dryRun) {\n const lines = data.pending.map(\n ({ locale, keys }) => `${locale}: ${keys.length} missing: ${keys.join(', ')}`,\n );\n return reply(lines.length === 0 ? 'nothing to translate' : lines.join('\\n'), data);\n }\n\n const lines: string[] = [];\n const drafts = loadDrafts(cfg);\n for (const { locale, keys } of data.translated) {\n writeCatalog(cfg, locale, catalogs[locale] ?? {});\n markDrafts(drafts, locale, keys);\n lines.push(`${locale}: +${keys.length} translated (draft)`);\n }\n if (data.translated.length > 0) saveDrafts(cfg, drafts);\n for (const { locale, keys } of data.invalid) {\n lines.push(\n `${locale}: ${keys.length} rejected (params/tags not preserved): ${keys.join(', ')}`,\n );\n }\n lines.push(...formatTranslateFailures(result.failed));\n if (lines.length === 0) return reply('nothing to translate', data);\n if (data.translated.length > 0) {\n lines.push('drafts await human review: verbaly review (--approve accepts them)');\n }\n return reply(lines.join('\\n'), data);\n }),\n );\n\n return server;\n}\n","#!/usr/bin/env node\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport { parseArgs } from 'node:util';\nimport { createVerbalyMcp } from './server';\n\nconst { values } = parseArgs({ options: { root: { type: 'string' } } });\n\ntry {\n await createVerbalyMcp({ root: values.root }).connect(new StdioServerTransport());\n // stdout carries the protocol: any human-facing note goes to stderr\n console.error('[verbaly-mcp] ready (stdio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  }));
132
132
  server.registerTool("verbaly_wrap", {
133
133
  title: "Wrap hardcoded JSX text",
134
- description: "Find hardcoded user-visible text in JSX/TSX files and wrap it in a t tagged template so the compiler can extract it (what `verbaly wrap` does). This is how an existing codebase is onboarded. Reports only unless write is set. Text it cannot wrap safely (a sentence split across markup, an expression rendering JSX) is listed as needing a human and never rewritten. After writing, make t available where TypeScript complains (React: const t = useT()) and run verbaly_extract.",
134
+ description: "Find hardcoded user-visible text in JSX/TSX files and wrap it in a t tagged template so the compiler can extract it (what `verbaly wrap` does). This is how an existing codebase is onboarded. Reports only unless write is set. Text it cannot wrap safely (a sentence split across markup, an expression rendering JSX) is listed as needing a human and never rewritten. A file that does not bind t is never written either, because the rewrite would not compile: those come back in blocked, with whether the file is a client component, so you can add the binding and run again.",
135
135
  inputSchema: {
136
136
  root: rootInput,
137
137
  write: z.boolean().optional().describe("Apply the rewrites instead of only reporting")
@@ -152,13 +152,21 @@ function createVerbalyMcp(options = {}) {
152
152
  line: z.number(),
153
153
  text: z.string(),
154
154
  reason: z.string()
155
+ })),
156
+ blocked: z.array(z.object({
157
+ file: z.string(),
158
+ texts: z.number(),
159
+ client: z.boolean()
155
160
  }))
156
161
  }
157
162
  }, guarded(async ({ root, write }) => {
158
163
  const cfg = await config(root);
159
164
  const result = await wrapProject(cfg, { write });
160
- const lines = [`${write ? "wrapped" : "would wrap"} ${counted(result.wrapped.length, "text")} in ${counted(result.changed.length, "file")} of ${counted(result.files, "file")} scanned`];
161
- for (const entry of result.wrapped) {
165
+ const blocked = new Set(result.blocked.map((entry) => entry.file));
166
+ const done = result.changed.filter((file) => !blocked.has(file));
167
+ const texts = result.wrapped.filter((entry) => !blocked.has(entry.file));
168
+ const lines = [`${write ? "wrapped" : "would wrap"} ${write ? `${counted(texts.length, "text")} in ${counted(done.length, "file")}` : `${counted(result.wrapped.length, "text")} in ${counted(result.changed.length, "file")}`} of ${counted(result.files, "file")} scanned`];
169
+ for (const entry of write ? texts : result.wrapped) {
162
170
  const attr = entry.kind === "attribute" ? `${entry.attribute} -> ` : "";
163
171
  lines.push(` ${entry.file}:${entry.line} ${attr}"${entry.text}"`);
164
172
  }
@@ -166,7 +174,14 @@ function createVerbalyMcp(options = {}) {
166
174
  lines.push(" needs a human:");
167
175
  for (const entry of result.skipped) lines.push(` ${entry.file}:${entry.line} "${entry.text}" (${entry.reason})`);
168
176
  }
169
- if (write && result.changed.length > 0) lines.push(" next: make t available where TS complains, then run verbaly_extract");
177
+ if (result.blocked.length > 0) {
178
+ lines.push(` nothing written in ${counted(result.blocked.length, "file")} with no t in scope:`);
179
+ for (const entry of result.blocked) {
180
+ const how = entry.client ? "\"use client\", so const t = useT()" : "no \"use client\"";
181
+ lines.push(` ${entry.file} ${counted(entry.texts, "text")}, ${how}`);
182
+ }
183
+ lines.push(" next: bind t there, run verbaly_wrap with write again, then verbaly_extract");
184
+ } else if (write && done.length > 0) lines.push(" next: run verbaly_extract");
170
185
  return reply(lines.join("\n"), {
171
186
  ...result,
172
187
  write: write === true
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/server.ts"],"sourcesContent":["import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';\nimport {\n check,\n collectOrigins,\n counted,\n doctor,\n effectiveDrafts,\n extractProject,\n formatCheckResult,\n formatCheckWarnings,\n formatDoctorEntry,\n formatStatusResult,\n formatTranslateFailures,\n loadCatalogs,\n loadConfig,\n loadDrafts,\n markDrafts,\n pruneCatalogs,\n resolveProvider,\n saveDrafts,\n status,\n syncCatalogs,\n translateCatalogs,\n wrapProject,\n writeCatalog,\n writeDts,\n type ResolvedConfig,\n} from '@verbaly/compiler';\nimport { createRequire } from 'node:module';\nimport { z } from 'zod';\n\nconst { version } = createRequire(import.meta.url)('../package.json') as { version: string };\n\nexport interface VerbalyMcpOptions {\n root?: string;\n}\n\n// text stays the fallback for a client that reads no schema, structuredContent is what agents parse\nconst reply = (body: string, data: Record<string, unknown>): CallToolResult => ({\n content: [{ type: 'text', text: body }],\n structuredContent: data,\n});\n\nconst rootInput = z\n .string()\n .optional()\n .describe('Project root holding verbaly.config (defaults to the server working directory)');\n\nconst perLocale = z.array(z.object({ locale: z.string(), keys: z.array(z.string()) }));\n\n// a locale-keyed record is a dynamic schema an agent cannot read ahead: lists enumerate\nconst byLocale = (record: Record<string, string[]>): Array<{ locale: string; keys: string[] }> =>\n Object.entries(record).map(([locale, keys]) => ({ locale, keys }));\n\nexport function createVerbalyMcp(options: VerbalyMcpOptions = {}): McpServer {\n const server = new McpServer({ name: 'verbaly', version });\n\n const config = (root?: string): Promise<ResolvedConfig> =>\n loadConfig(root ?? options.root ?? process.cwd());\n\n // agents act on messages, not stack traces: every failure comes back as actionable text\n const guarded =\n <A>(run: (args: A) => Promise<CallToolResult>) =>\n async (args: A): Promise<CallToolResult> => {\n try {\n return await run(args);\n } catch (error) {\n return {\n content: [{ type: 'text', text: error instanceof Error ? error.message : String(error) }],\n isError: true,\n };\n }\n };\n\n server.registerTool(\n 'verbaly_status',\n {\n title: 'Translation coverage',\n description:\n 'Translation coverage of the Verbaly project: total messages, translated count per locale and machine translations awaiting review (drafts). Read-only.',\n inputSchema: { root: rootInput },\n outputSchema: {\n messages: z.number().describe('Messages the project has, source catalog plus code'),\n source: z.string().describe('Source locale'),\n locales: z.array(\n z.object({\n locale: z.string(),\n translated: z.number(),\n total: z.number(),\n drafts: z.number().describe('Machine translations awaiting human review'),\n broken: z.number().describe('Present but not rendering what the source renders'),\n }),\n ),\n },\n annotations: { readOnlyHint: true },\n },\n guarded(async ({ root }) => {\n const cfg = await config(root);\n const registry = await extractProject(cfg);\n const result = status(cfg, loadCatalogs(cfg), registry, loadDrafts(cfg));\n return reply(formatStatusResult(result), { ...result });\n }),\n );\n\n server.registerTool(\n 'verbaly_missing',\n {\n title: 'Missing and broken translations',\n description:\n 'List missing translations, unknown keys and translations that exist but cannot render what the source renders (a dropped {param}, a lost rich tag, a flattened plural block), the same gate `verbaly check` runs in CI. Warnings such as an incomplete plural set for the locale are listed too and do not fail the gate. Optionally also lists machine translations awaiting review. Read-only.',\n inputSchema: {\n root: rootInput,\n drafts: z\n .boolean()\n .optional()\n .describe('Also list machine translations awaiting human review'),\n },\n outputSchema: {\n ok: z.boolean().describe('Whether `verbaly check` would pass (warnings never fail it)'),\n missing: z.array(\n z.object({ locale: z.string(), key: z.string(), source: z.string().optional() }),\n ),\n unknown: z.array(z.object({ key: z.string(), files: z.array(z.string()) })),\n broken: z.array(\n z.object({\n locale: z.string(),\n key: z.string(),\n severity: z.enum(['error', 'warning']),\n issue: z.string(),\n }),\n ),\n unreviewed: perLocale,\n },\n annotations: { readOnlyHint: true },\n },\n guarded(async ({ root, drafts }) => {\n const cfg = await config(root);\n const registry = await extractProject(cfg);\n const catalogs = loadCatalogs(cfg);\n const result = check(cfg, catalogs, registry);\n const unreviewed = drafts ? byLocale(effectiveDrafts(loadDrafts(cfg), catalogs)) : [];\n\n const lines: string[] = [];\n if (!result.ok) lines.push(formatCheckResult(result));\n const warnings = formatCheckWarnings(result);\n if (warnings) lines.push(`warnings (the gate still passes):\\n${warnings}`);\n for (const { locale, keys } of unreviewed) {\n if (keys.length) lines.push(`[${locale}] ${keys.length} unreviewed: ${keys.join(', ')}`);\n }\n return reply(lines.length === 0 ? 'all translations complete' : lines.join('\\n'), {\n ...result,\n unreviewed,\n });\n }),\n );\n\n server.registerTool(\n 'verbaly_doctor',\n {\n title: 'Diagnose the setup',\n description:\n 'Diagnose a Verbaly project end to end (what `verbaly doctor` does): the config file, the catalog files and their JSON, the bundler plugin for the detected framework, the generated types, files the parser could not read, t imported from a package that never exports it, orphan keys, and every failure `verbaly check` would report. Run this first when something does not work. Read-only.',\n inputSchema: { root: rootInput },\n outputSchema: {\n ok: z.boolean().describe('False when an entry is an error, which is when the CLI exits 1'),\n entries: z.array(\n z.object({\n level: z.enum(['ok', 'warn', 'error']),\n check: z.string(),\n message: z.string(),\n fix: z.string().optional().describe('What to run or change, when there is one'),\n }),\n ),\n },\n annotations: { readOnlyHint: true },\n },\n guarded(async ({ root }) => {\n const cfg = await config(root);\n const result = await doctor(cfg);\n const health = result.ok ? 'setup looks healthy' : 'problems found';\n const head = `${counted(result.entries.length, 'check')}, ${health}`;\n return reply([head, ...result.entries.map(formatDoctorEntry)].join('\\n'), { ...result });\n }),\n );\n\n server.registerTool(\n 'verbaly_wrap',\n {\n title: 'Wrap hardcoded JSX text',\n description:\n 'Find hardcoded user-visible text in JSX/TSX files and wrap it in a t tagged template so the compiler can extract it (what `verbaly wrap` does). This is how an existing codebase is onboarded. Reports only unless write is set. Text it cannot wrap safely (a sentence split across markup, an expression rendering JSX) is listed as needing a human and never rewritten. After writing, make t available where TypeScript complains (React: const t = useT()) and run verbaly_extract.',\n inputSchema: {\n root: rootInput,\n write: z.boolean().optional().describe('Apply the rewrites instead of only reporting'),\n },\n outputSchema: {\n files: z.number().describe('JSX/TSX files scanned'),\n write: z.boolean(),\n changed: z.array(z.string()).describe('Files the rewrite touched, or would touch'),\n wrapped: z.array(\n z.object({\n file: z.string(),\n line: z.number(),\n text: z.string(),\n kind: z.enum(['text', 'attribute']),\n attribute: z.string().optional(),\n }),\n ),\n skipped: z.array(\n z.object({ file: z.string(), line: z.number(), text: z.string(), reason: z.string() }),\n ),\n },\n },\n guarded(async ({ root, write }) => {\n const cfg = await config(root);\n const result = await wrapProject(cfg, { write });\n const verb = write ? 'wrapped' : 'would wrap';\n const lines = [\n `${verb} ${counted(result.wrapped.length, 'text')} in ${counted(result.changed.length, 'file')} of ${counted(result.files, 'file')} scanned`,\n ];\n for (const entry of result.wrapped) {\n const attr = entry.kind === 'attribute' ? `${entry.attribute} -> ` : '';\n lines.push(` ${entry.file}:${entry.line} ${attr}\"${entry.text}\"`);\n }\n if (result.skipped.length > 0) {\n lines.push(' needs a human:');\n for (const entry of result.skipped) {\n lines.push(` ${entry.file}:${entry.line} \"${entry.text}\" (${entry.reason})`);\n }\n }\n if (write && result.changed.length > 0) {\n lines.push(' next: make t available where TS complains, then run verbaly_extract');\n }\n return reply(lines.join('\\n'), { ...result, write: write === true });\n }),\n );\n\n server.registerTool(\n 'verbaly_extract',\n {\n title: 'Extract messages',\n description:\n 'Scan the source files, add new messages to the locale catalogs and refresh the generated types (what `verbaly extract` does). Writes catalog files unless dryRun is set. prune drops keys no longer referenced in the code, translations included.',\n inputSchema: {\n root: rootInput,\n prune: z\n .boolean()\n .optional()\n .describe('Drop keys no longer referenced (deletes their translations)'),\n dryRun: z.boolean().optional().describe('Report what would change, write nothing'),\n },\n outputSchema: {\n messages: z.number(),\n locales: z.array(z.string()),\n dryRun: z.boolean(),\n added: perLocale,\n pruned: perLocale,\n },\n },\n guarded(async ({ root, prune, dryRun }) => {\n const cfg = await config(root);\n const registry = await extractProject(cfg);\n const catalogs = loadCatalogs(cfg);\n\n const lines: string[] = [];\n const pruned = prune ? byLocale(pruneCatalogs(cfg, catalogs, registry)) : [];\n for (const { locale, keys } of pruned) {\n lines.push(\n dryRun\n ? `${locale}: would prune ${keys.length}: ${keys.join(', ')}`\n : `${locale}: ${keys.length} pruned`,\n );\n }\n const added = byLocale(syncCatalogs(cfg, catalogs, registry).added);\n if (!dryRun) {\n for (const locale of cfg.locales) {\n writeCatalog(cfg, locale, catalogs[locale] ?? {});\n }\n if (cfg.dts !== false) writeDts(cfg, catalogs[cfg.sourceLocale] ?? {}, cfg.dts);\n }\n const messages = registry.messages().size;\n lines.unshift(\n `${counted(messages, 'message')} · locales: ${cfg.locales.join(', ')}${dryRun ? ' (dry run, nothing written)' : ''}`,\n );\n for (const { locale, keys } of added) {\n lines.push(`${locale}: ${dryRun ? `would add ${keys.length}` : `+${keys.length} added`}`);\n }\n return reply(lines.join('\\n'), {\n messages,\n locales: cfg.locales,\n dryRun: dryRun === true,\n added,\n pruned,\n });\n }),\n );\n\n server.registerTool(\n 'verbaly_translate',\n {\n title: 'Machine-translate missing entries',\n description:\n 'Fill missing translations with the configured provider (default: Claude, needs @anthropic-ai/sdk and ANTHROPIC_API_KEY). New translations are saved as drafts awaiting human review (`verbaly review`), which no tool here can approve. A batch the provider never answers is reported in failed and leaves everything else written, so a retry only asks for what is left. dryRun lists what would be translated without calling the provider.',\n inputSchema: {\n root: rootInput,\n locales: z.array(z.string()).optional().describe('Target locales (default: all)'),\n dryRun: z\n .boolean()\n .optional()\n .describe('List missing entries per locale, call no provider'),\n },\n outputSchema: {\n dryRun: z.boolean(),\n translated: perLocale.describe('Saved as drafts, a human still has to approve them'),\n invalid: perLocale.describe('Rejected: params or tags were not preserved'),\n failed: z\n .array(z.object({ locale: z.string(), keys: z.array(z.string()), error: z.string() }))\n .describe('Batches the provider never answered, safe to retry'),\n pending: perLocale.describe('dryRun only: what would be translated'),\n },\n },\n guarded(async ({ root, locales, dryRun }) => {\n const cfg = await config(root);\n const catalogs = loadCatalogs(cfg);\n const provider = await resolveProvider(cfg);\n const result = await translateCatalogs(cfg, catalogs, provider, {\n locales,\n batchSize: cfg.translate.batchSize,\n concurrency: cfg.translate.concurrency,\n retries: cfg.translate.retries,\n dryRun,\n origins: dryRun ? undefined : await collectOrigins(cfg),\n });\n\n const data = {\n dryRun: dryRun === true,\n translated: byLocale(result.translated),\n invalid: byLocale(result.invalid),\n failed: result.failed,\n pending: byLocale(result.pending),\n };\n\n if (dryRun) {\n const lines = data.pending.map(\n ({ locale, keys }) => `${locale}: ${keys.length} missing: ${keys.join(', ')}`,\n );\n return reply(lines.length === 0 ? 'nothing to translate' : lines.join('\\n'), data);\n }\n\n const lines: string[] = [];\n const drafts = loadDrafts(cfg);\n for (const { locale, keys } of data.translated) {\n writeCatalog(cfg, locale, catalogs[locale] ?? {});\n markDrafts(drafts, locale, keys);\n lines.push(`${locale}: +${keys.length} translated (draft)`);\n }\n if (data.translated.length > 0) saveDrafts(cfg, drafts);\n for (const { locale, keys } of data.invalid) {\n lines.push(\n `${locale}: ${keys.length} rejected (params/tags not preserved): ${keys.join(', ')}`,\n );\n }\n lines.push(...formatTranslateFailures(result.failed));\n if (lines.length === 0) return reply('nothing to translate', data);\n if (data.translated.length > 0) {\n lines.push('drafts await human review: verbaly review (--approve accepts them)');\n }\n return reply(lines.join('\\n'), data);\n }),\n );\n\n return server;\n}\n"],"mappings":";;;;;AAgCA,MAAM,EAAE,YAAY,cAAc,YAAY,GAAG,CAAC,CAAC,iBAAiB;AAOpE,MAAM,SAAS,MAAc,UAAmD;CAC9E,SAAS,CAAC;EAAE,MAAM;EAAQ,MAAM;CAAK,CAAC;CACtC,mBAAmB;AACrB;AAEA,MAAM,YAAY,EACf,OAAO,CAAC,CACR,SAAS,CAAC,CACV,SAAS,gFAAgF;AAE5F,MAAM,YAAY,EAAE,MAAM,EAAE,OAAO;CAAE,QAAQ,EAAE,OAAO;CAAG,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC;AAAE,CAAC,CAAC;AAGrF,MAAM,YAAY,WAChB,OAAO,QAAQ,MAAM,CAAC,CAAC,KAAK,CAAC,QAAQ,WAAW;CAAE;CAAQ;AAAK,EAAE;AAEnE,SAAgB,iBAAiB,UAA6B,CAAC,GAAc;CAC3E,MAAM,SAAS,IAAI,UAAU;EAAE,MAAM;EAAW;CAAQ,CAAC;CAEzD,MAAM,UAAU,SACd,WAAW,QAAQ,QAAQ,QAAQ,QAAQ,IAAI,CAAC;CAGlD,MAAM,WACA,QACJ,OAAO,SAAqC;EAC1C,IAAI;GACF,OAAO,MAAM,IAAI,IAAI;EACvB,SAAS,OAAO;GACd,OAAO;IACL,SAAS,CAAC;KAAE,MAAM;KAAQ,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;IAAE,CAAC;IACxF,SAAS;GACX;EACF;CACF;CAEF,OAAO,aACL,kBACA;EACE,OAAO;EACP,aACE;EACF,aAAa,EAAE,MAAM,UAAU;EAC/B,cAAc;GACZ,UAAU,EAAE,OAAO,CAAC,CAAC,SAAS,oDAAoD;GAClF,QAAQ,EAAE,OAAO,C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MAAM,wBAAwB,IAAI;EACjE,IAAI,KAAK,WAAW,SAAS,GAC3B,MAAM,KAAK,oEAAoE;EAEjF,OAAO,MAAM,MAAM,KAAK,IAAI,GAAG,IAAI;CACrC,CAAC,CACH;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/server.ts"],"sourcesContent":["import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';\nimport {\n check,\n collectOrigins,\n counted,\n doctor,\n effectiveDrafts,\n extractProject,\n formatCheckResult,\n formatCheckWarnings,\n formatDoctorEntry,\n formatStatusResult,\n formatTranslateFailures,\n loadCatalogs,\n loadConfig,\n loadDrafts,\n markDrafts,\n pruneCatalogs,\n resolveProvider,\n saveDrafts,\n status,\n syncCatalogs,\n translateCatalogs,\n wrapProject,\n writeCatalog,\n writeDts,\n type ResolvedConfig,\n} from '@verbaly/compiler';\nimport { createRequire } from 'node:module';\nimport { z } from 'zod';\n\nconst { version } = createRequire(import.meta.url)('../package.json') as { version: string };\n\nexport interface VerbalyMcpOptions {\n root?: string;\n}\n\n// text stays the fallback for a client that reads no schema, structuredContent is what agents parse\nconst reply = (body: string, data: Record<string, unknown>): CallToolResult => ({\n content: [{ type: 'text', text: body }],\n structuredContent: data,\n});\n\nconst rootInput = z\n .string()\n .optional()\n .describe('Project root holding verbaly.config (defaults to the server working directory)');\n\nconst perLocale = z.array(z.object({ locale: z.string(), keys: z.array(z.string()) }));\n\n// a locale-keyed record is a dynamic schema an agent cannot read ahead: lists enumerate\nconst byLocale = (record: Record<string, string[]>): Array<{ locale: string; keys: string[] }> =>\n Object.entries(record).map(([locale, keys]) => ({ locale, keys }));\n\nexport function createVerbalyMcp(options: VerbalyMcpOptions = {}): McpServer {\n const server = new McpServer({ name: 'verbaly', version });\n\n const config = (root?: string): Promise<ResolvedConfig> =>\n loadConfig(root ?? options.root ?? process.cwd());\n\n // agents act on messages, not stack traces: every failure comes back as actionable text\n const guarded =\n <A>(run: (args: A) => Promise<CallToolResult>) =>\n async (args: A): Promise<CallToolResult> => {\n try {\n return await run(args);\n } catch (error) {\n return {\n content: [{ type: 'text', text: error instanceof Error ? error.message : String(error) }],\n isError: true,\n };\n }\n };\n\n server.registerTool(\n 'verbaly_status',\n {\n title: 'Translation coverage',\n description:\n 'Translation coverage of the Verbaly project: total messages, translated count per locale and machine translations awaiting review (drafts). Read-only.',\n inputSchema: { root: rootInput },\n outputSchema: {\n messages: z.number().describe('Messages the project has, source catalog plus code'),\n source: z.string().describe('Source locale'),\n locales: z.array(\n z.object({\n locale: z.string(),\n translated: z.number(),\n total: z.number(),\n drafts: z.number().describe('Machine translations awaiting human review'),\n broken: z.number().describe('Present but not rendering what the source renders'),\n }),\n ),\n },\n annotations: { readOnlyHint: true },\n },\n guarded(async ({ root }) => {\n const cfg = await config(root);\n const registry = await extractProject(cfg);\n const result = status(cfg, loadCatalogs(cfg), registry, loadDrafts(cfg));\n return reply(formatStatusResult(result), { ...result });\n }),\n );\n\n server.registerTool(\n 'verbaly_missing',\n {\n title: 'Missing and broken translations',\n description:\n 'List missing translations, unknown keys and translations that exist but cannot render what the source renders (a dropped {param}, a lost rich tag, a flattened plural block), the same gate `verbaly check` runs in CI. Warnings such as an incomplete plural set for the locale are listed too and do not fail the gate. Optionally also lists machine translations awaiting review. Read-only.',\n inputSchema: {\n root: rootInput,\n drafts: z\n .boolean()\n .optional()\n .describe('Also list machine translations awaiting human review'),\n },\n outputSchema: {\n ok: z.boolean().describe('Whether `verbaly check` would pass (warnings never fail it)'),\n missing: z.array(\n z.object({ locale: z.string(), key: z.string(), source: z.string().optional() }),\n ),\n unknown: z.array(z.object({ key: z.string(), files: z.array(z.string()) })),\n broken: z.array(\n z.object({\n locale: z.string(),\n key: z.string(),\n severity: z.enum(['error', 'warning']),\n issue: z.string(),\n }),\n ),\n unreviewed: perLocale,\n },\n annotations: { readOnlyHint: true },\n },\n guarded(async ({ root, drafts }) => {\n const cfg = await config(root);\n const registry = await extractProject(cfg);\n const catalogs = loadCatalogs(cfg);\n const result = check(cfg, catalogs, registry);\n const unreviewed = drafts ? byLocale(effectiveDrafts(loadDrafts(cfg), catalogs)) : [];\n\n const lines: string[] = [];\n if (!result.ok) lines.push(formatCheckResult(result));\n const warnings = formatCheckWarnings(result);\n if (warnings) lines.push(`warnings (the gate still passes):\\n${warnings}`);\n for (const { locale, keys } of unreviewed) {\n if (keys.length) lines.push(`[${locale}] ${keys.length} unreviewed: ${keys.join(', ')}`);\n }\n return reply(lines.length === 0 ? 'all translations complete' : lines.join('\\n'), {\n ...result,\n unreviewed,\n });\n }),\n );\n\n server.registerTool(\n 'verbaly_doctor',\n {\n title: 'Diagnose the setup',\n description:\n 'Diagnose a Verbaly project end to end (what `verbaly doctor` does): the config file, the catalog files and their JSON, the bundler plugin for the detected framework, the generated types, files the parser could not read, t imported from a package that never exports it, orphan keys, and every failure `verbaly check` would report. Run this first when something does not work. Read-only.',\n inputSchema: { root: rootInput },\n outputSchema: {\n ok: z.boolean().describe('False when an entry is an error, which is when the CLI exits 1'),\n entries: z.array(\n z.object({\n level: z.enum(['ok', 'warn', 'error']),\n check: z.string(),\n message: z.string(),\n fix: z.string().optional().describe('What to run or change, when there is one'),\n }),\n ),\n },\n annotations: { readOnlyHint: true },\n },\n guarded(async ({ root }) => {\n const cfg = await config(root);\n const result = await doctor(cfg);\n const health = result.ok ? 'setup looks healthy' : 'problems found';\n const head = `${counted(result.entries.length, 'check')}, ${health}`;\n return reply([head, ...result.entries.map(formatDoctorEntry)].join('\\n'), { ...result });\n }),\n );\n\n server.registerTool(\n 'verbaly_wrap',\n {\n title: 'Wrap hardcoded JSX text',\n description:\n 'Find hardcoded user-visible text in JSX/TSX files and wrap it in a t tagged template so the compiler can extract it (what `verbaly wrap` does). This is how an existing codebase is onboarded. Reports only unless write is set. Text it cannot wrap safely (a sentence split across markup, an expression rendering JSX) is listed as needing a human and never rewritten. A file that does not bind t is never written either, because the rewrite would not compile: those come back in blocked, with whether the file is a client component, so you can add the binding and run again.',\n inputSchema: {\n root: rootInput,\n write: z.boolean().optional().describe('Apply the rewrites instead of only reporting'),\n },\n outputSchema: {\n files: z.number().describe('JSX/TSX files scanned'),\n write: z.boolean(),\n changed: z.array(z.string()).describe('Files the rewrite touched, or would touch'),\n wrapped: z.array(\n z.object({\n file: z.string(),\n line: z.number(),\n text: z.string(),\n kind: z.enum(['text', 'attribute']),\n attribute: z.string().optional(),\n }),\n ),\n skipped: z.array(\n z.object({ file: z.string(), line: z.number(), text: z.string(), reason: z.string() }),\n ),\n blocked: z.array(\n z.object({ file: z.string(), texts: z.number(), client: z.boolean() }),\n ),\n },\n },\n guarded(async ({ root, write }) => {\n const cfg = await config(root);\n const result = await wrapProject(cfg, { write });\n const blocked = new Set(result.blocked.map((entry) => entry.file));\n const done = result.changed.filter((file) => !blocked.has(file));\n const texts = result.wrapped.filter((entry) => !blocked.has(entry.file));\n const verb = write ? 'wrapped' : 'would wrap';\n const counts = write\n ? `${counted(texts.length, 'text')} in ${counted(done.length, 'file')}`\n : `${counted(result.wrapped.length, 'text')} in ${counted(result.changed.length, 'file')}`;\n const lines = [`${verb} ${counts} of ${counted(result.files, 'file')} scanned`];\n for (const entry of write ? texts : result.wrapped) {\n const attr = entry.kind === 'attribute' ? `${entry.attribute} -> ` : '';\n lines.push(` ${entry.file}:${entry.line} ${attr}\"${entry.text}\"`);\n }\n if (result.skipped.length > 0) {\n lines.push(' needs a human:');\n for (const entry of result.skipped) {\n lines.push(` ${entry.file}:${entry.line} \"${entry.text}\" (${entry.reason})`);\n }\n }\n if (result.blocked.length > 0) {\n lines.push(` nothing written in ${counted(result.blocked.length, 'file')} with no t in scope:`);\n for (const entry of result.blocked) {\n const how = entry.client ? '\"use client\", so const t = useT()' : 'no \"use client\"';\n lines.push(` ${entry.file} ${counted(entry.texts, 'text')}, ${how}`);\n }\n lines.push(' next: bind t there, run verbaly_wrap with write again, then verbaly_extract');\n } else if (write && done.length > 0) {\n lines.push(' next: run verbaly_extract');\n }\n return reply(lines.join('\\n'), { ...result, write: write === true });\n }),\n );\n\n server.registerTool(\n 'verbaly_extract',\n {\n title: 'Extract messages',\n description:\n 'Scan the source files, add new messages to the locale catalogs and refresh the generated types (what `verbaly extract` does). Writes catalog files unless dryRun is set. prune drops keys no longer referenced in the code, translations included.',\n inputSchema: {\n root: rootInput,\n prune: z\n .boolean()\n .optional()\n .describe('Drop keys no longer referenced (deletes their translations)'),\n dryRun: z.boolean().optional().describe('Report what would change, write nothing'),\n },\n outputSchema: {\n messages: z.number(),\n locales: z.array(z.string()),\n dryRun: z.boolean(),\n added: perLocale,\n pruned: perLocale,\n },\n },\n guarded(async ({ root, prune, dryRun }) => {\n const cfg = await config(root);\n const registry = await extractProject(cfg);\n const catalogs = loadCatalogs(cfg);\n\n const lines: string[] = [];\n const pruned = prune ? byLocale(pruneCatalogs(cfg, catalogs, registry)) : [];\n for (const { locale, keys } of pruned) {\n lines.push(\n dryRun\n ? `${locale}: would prune ${keys.length}: ${keys.join(', ')}`\n : `${locale}: ${keys.length} pruned`,\n );\n }\n const added = byLocale(syncCatalogs(cfg, catalogs, registry).added);\n if (!dryRun) {\n for (const locale of cfg.locales) {\n writeCatalog(cfg, locale, catalogs[locale] ?? {});\n }\n if (cfg.dts !== false) writeDts(cfg, catalogs[cfg.sourceLocale] ?? {}, cfg.dts);\n }\n const messages = registry.messages().size;\n lines.unshift(\n `${counted(messages, 'message')} · locales: ${cfg.locales.join(', ')}${dryRun ? ' (dry run, nothing written)' : ''}`,\n );\n for (const { locale, keys } of added) {\n lines.push(`${locale}: ${dryRun ? `would add ${keys.length}` : `+${keys.length} added`}`);\n }\n return reply(lines.join('\\n'), {\n messages,\n locales: cfg.locales,\n dryRun: dryRun === true,\n added,\n pruned,\n });\n }),\n );\n\n server.registerTool(\n 'verbaly_translate',\n {\n title: 'Machine-translate missing entries',\n description:\n 'Fill missing translations with the configured provider (default: Claude, needs @anthropic-ai/sdk and ANTHROPIC_API_KEY). New translations are saved as drafts awaiting human review (`verbaly review`), which no tool here can approve. A batch the provider never answers is reported in failed and leaves everything else written, so a retry only asks for what is left. dryRun lists what would be translated without calling the provider.',\n inputSchema: {\n root: rootInput,\n locales: z.array(z.string()).optional().describe('Target locales (default: all)'),\n dryRun: z\n .boolean()\n .optional()\n .describe('List missing entries per locale, call no provider'),\n },\n outputSchema: {\n dryRun: z.boolean(),\n translated: perLocale.describe('Saved as drafts, a human still has to approve them'),\n invalid: perLocale.describe('Rejected: params or tags were not preserved'),\n failed: z\n .array(z.object({ locale: z.string(), keys: z.array(z.string()), error: z.string() }))\n .describe('Batches the provider never answered, safe to retry'),\n pending: perLocale.describe('dryRun only: what would be translated'),\n },\n },\n guarded(async ({ root, locales, dryRun }) => {\n const cfg = await config(root);\n const catalogs = loadCatalogs(cfg);\n const provider = await resolveProvider(cfg);\n const result = await translateCatalogs(cfg, catalogs, provider, {\n locales,\n batchSize: cfg.translate.batchSize,\n concurrency: cfg.translate.concurrency,\n retries: cfg.translate.retries,\n dryRun,\n origins: dryRun ? undefined : await collectOrigins(cfg),\n });\n\n const data = {\n dryRun: dryRun === true,\n translated: byLocale(result.translated),\n invalid: byLocale(result.invalid),\n failed: result.failed,\n pending: byLocale(result.pending),\n };\n\n if (dryRun) {\n const lines = data.pending.map(\n ({ locale, keys }) => `${locale}: ${keys.length} missing: ${keys.join(', ')}`,\n );\n return reply(lines.length === 0 ? 'nothing to translate' : lines.join('\\n'), data);\n }\n\n const lines: string[] = [];\n const drafts = loadDrafts(cfg);\n for (const { locale, keys } of data.translated) {\n writeCatalog(cfg, locale, catalogs[locale] ?? {});\n markDrafts(drafts, locale, keys);\n lines.push(`${locale}: +${keys.length} translated (draft)`);\n }\n if (data.translated.length > 0) saveDrafts(cfg, drafts);\n for (const { locale, keys } of data.invalid) {\n lines.push(\n `${locale}: ${keys.length} rejected (params/tags not preserved): ${keys.join(', ')}`,\n );\n }\n lines.push(...formatTranslateFailures(result.failed));\n if (lines.length === 0) return reply('nothing to translate', data);\n if (data.translated.length > 0) {\n lines.push('drafts await human review: verbaly review (--approve accepts them)');\n }\n return reply(lines.join('\\n'), data);\n }),\n );\n\n return server;\n}\n"],"mappings":";;;;;AAgCA,MAAM,EAAE,YAAY,cAAc,YAAY,GAAG,CAAC,CAAC,iBAAiB;AAOpE,MAAM,SAAS,MAAc,UAAmD;CAC9E,SAAS,CAAC;EAAE,MAAM;EAAQ,MAAM;CAAK,CAAC;CACtC,mBAAmB;AACrB;AAEA,MAAM,YAAY,EACf,OAAO,CAAC,CACR,SAAS,CAAC,CACV,SAAS,gFAAgF;AAE5F,MAAM,YAAY,EAAE,MAAM,EAAE,OAAO;CAAE,QAAQ,EAAE,OAAO;CAAG,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC;AAAE,CAAC,CAAC;AAGrF,MAAM,YAAY,WAChB,OAAO,QAAQ,MAAM,CAAC,CAAC,KAAK,CAAC,QAAQ,WAAW;CAAE;CAAQ;AAAK,EAAE;AAEnE,SAAgB,iBAAiB,UAA6B,CAAC,GAAc;CAC3E,MAAM,SAAS,IAAI,UAAU;EAAE,MAAM;EAAW;CAAQ,CAAC;CAEzD,MAAM,UAAU,SACd,WAAW,QAAQ,QAAQ,QAAQ,QAAQ,IAAI,CAAC;CAGlD,MAAM,WACA,QACJ,OAAO,SAAqC;EAC1C,IAAI;GACF,OAAO,MAAM,IAAI,IAAI;EACvB,SAAS,OAAO;GACd,OAAO;IACL,SAAS,CAAC;KAAE,MAAM;KAAQ,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;IAAE,CAAC;IACxF,SAAS;GACX;EACF;CACF;CAEF,OAAO,aACL,kBACA;EACE,OAAO;EACP,aACE;EACF,aAAa,EAAE,MAAM,UAAU;EAC/B,cAAc;GACZ,UAAU,EAAE,OAAO,CAAC,CAAC,SAAS,oDAAoD;GAClF,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS,eAAe;GAC3C,SAAS,EAAE,MACT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I,QAAQ;GACV,MAAM,QAAQ,KAAK,QAAQ,KACxB,EAAE,QAAQ,WAAW,GAAG,OAAO,IAAI,KAAK,OAAO,YAAY,KAAK,KAAK,IAAI,GAC5E;GACA,OAAO,MAAM,MAAM,WAAW,IAAI,yBAAyB,MAAM,KAAK,IAAI,GAAG,IAAI;EACnF;EAEA,MAAM,QAAkB,CAAC;EACzB,MAAM,SAAS,WAAW,GAAG;EAC7B,KAAK,MAAM,EAAE,QAAQ,UAAU,KAAK,YAAY;GAC9C,aAAa,KAAK,QAAQ,SAAS,WAAW,CAAC,CAAC;GAChD,WAAW,QAAQ,QAAQ,IAAI;GAC/B,MAAM,KAAK,GAAG,OAAO,KAAK,KAAK,OAAO,oBAAoB;EAC5D;EACA,IAAI,KAAK,WAAW,SAAS,GAAG,WAAW,KAAK,MAAM;EACtD,KAAK,MAAM,EAAE,QAAQ,UAAU,KAAK,SAClC,MAAM,KACJ,GAAG,OAAO,IAAI,KAAK,OAAO,yCAAyC,KAAK,KAAK,IAAI,GACnF;EAEF,MAAM,KAAK,GAAG,wBAAwB,OAAO,MAAM,CAAC;EACpD,IAAI,MAAM,WAAW,GAAG,OAAO,MAAM,wBAAwB,IAAI;EACjE,IAAI,KAAK,WAAW,SAAS,GAC3B,MAAM,KAAK,oEAAoE;EAEjF,OAAO,MAAM,MAAM,KAAK,IAAI,GAAG,IAAI;CACrC,CAAC,CACH;CAEA,OAAO;AACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verbaly/mcp",
3
- "version": "0.44.0",
3
+ "version": "0.46.0",
4
4
  "description": "MCP server for Verbaly: diagnosis, onboarding, extraction, coverage and machine translation as tools for coding agents.",
5
5
  "keywords": [
6
6
  "i18n",
@@ -44,8 +44,8 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "@modelcontextprotocol/sdk": "^1.30.0",
47
- "zod": "^4.4.3",
48
- "@verbaly/compiler": "^0.44.0"
47
+ "zod": "^4.5.4",
48
+ "@verbaly/compiler": "^0.46.0"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/node": "^26.4.0"