@verbaly/mcp 0.38.0 โ†’ 0.39.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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
  <img src="https://raw.githubusercontent.com/AronSoto/verbaly/develop/assets/logo.png" alt="Verbaly" width="300" />
3
3
  </p>
4
4
 
5
- <p align="center"><em>MCP server for Verbaly: translation status, missing keys, extraction and machine translation as tools for coding agents.</em></p>
5
+ <p align="center"><em>MCP server for Verbaly: diagnosis, onboarding, extraction, coverage and machine translation as tools for coding agents.</em></p>
6
6
 
7
7
  <p align="center">
8
8
  <a href="https://www.npmjs.com/package/@verbaly/mcp"><img src="https://img.shields.io/npm/v/@verbaly/mcp?logo=npm&color=cb3837" alt="npm version" /></a>
@@ -11,7 +11,9 @@
11
11
 
12
12
  ---
13
13
 
14
- Your coding agent (Claude Code, Cursor, or any MCP client) gets first-class access to the Verbaly cycle: it can see the translation coverage, list exactly what's missing, extract new messages and machine-translate the gaps, all against your real `verbaly.config` and catalogs. No shell parsing, no guessed file paths.
14
+ Your coding agent (Claude Code, Cursor, or any MCP client) gets first-class access to the Verbaly cycle: it can diagnose the setup, wrap hardcoded text in an existing codebase, extract new messages, read the coverage, list exactly what is missing and machine-translate the gaps, all against your real `verbaly.config` and catalogs. No shell parsing, no guessed file paths.
15
+
16
+ Every tool answers with **structured output** as well as text, so an agent reads numbers and lists instead of parsing a sentence that may be worded differently next release.
15
17
 
16
18
  ## ๐Ÿš€ Install
17
19
 
@@ -33,18 +35,22 @@ The server reads the project from its working directory; pass `--root <path>` (o
33
35
 
34
36
  ## ๐Ÿงฐ Tools
35
37
 
36
- | Tool | What it does |
37
- | ------------------- | ------------------------------------------------------------------------------------------------------------------------ |
38
- | `verbaly_status` | Coverage per locale: total messages, translated counts, drafts awaiting review. Read-only. |
39
- | `verbaly_missing` | Missing translations and unknown keys (the same gate `verbaly check` runs in CI). Read-only. |
40
- | `verbaly_extract` | Scan sources, add new messages to the catalogs, refresh the generated types. `dryRun` previews; `prune` drops dead keys. |
41
- | `verbaly_translate` | Fill missing entries with the configured provider (default: Claude). Output is saved as drafts awaiting human review. |
38
+ | Tool | What it does |
39
+ | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
40
+ | `verbaly_doctor` | Diagnose the whole setup: config, catalogs, plugin, types, unreadable files, orphan keys, every gate failure. Start here. Read-only. |
41
+ | `verbaly_wrap` | Find hardcoded text in JSX/TSX and wrap it so the compiler can extract it. This is how an existing codebase is onboarded. |
42
+ | `verbaly_extract` | Scan sources, add new messages to the catalogs, refresh the generated types. `dryRun` previews; `prune` drops dead keys. |
43
+ | `verbaly_status` | Coverage per locale: total messages, translated counts, drafts awaiting review. Read-only. |
44
+ | `verbaly_missing` | Missing translations, unknown keys and broken ones (the same gate `verbaly check` runs in CI). Read-only. |
45
+ | `verbaly_translate` | Fill missing entries with the configured provider (default: Claude). Output is saved as drafts awaiting human review. |
46
+
47
+ Machine translations stay drafts until a human accepts them (`verbaly review --approve`), so an agent can fill gaps without silently shipping unreviewed text. **No tool here can approve a draft**, on purpose.
42
48
 
43
- Machine translations stay drafts until a human accepts them (`verbaly review --approve`), so an agent can fill gaps without silently shipping unreviewed text.
49
+ `verbaly_translate` never loses work it already paid for: a batch the provider does not answer is retried, and if it still fails it comes back in `failed` with its keys while everything else is written. Retrying asks only for what is left.
44
50
 
45
51
  ## ๐Ÿ“š Docs
46
52
 
47
- Full guide: [verbaly-web.vercel.app/docs/reference/cli#agents](https://verbaly-web.vercel.app/docs/reference/cli#agents)
53
+ Full guide: [verbaly-web.vercel.app/docs/guide/agents](https://verbaly-web.vercel.app/docs/guide/agents)
48
54
 
49
55
  ## License
50
56
 
package/dist/cli.js CHANGED
@@ -3,15 +3,26 @@ import { createRequire } from "node:module";
3
3
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
4
  import { parseArgs } from "node:util";
5
5
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
6
- import { check, collectOrigins, counted, effectiveDrafts, extractProject, formatCheckResult, formatCheckWarnings, formatStatusResult, loadCatalogs, loadConfig, loadDrafts, markDrafts, pruneCatalogs, resolveProvider, saveDrafts, status, syncCatalogs, translateCatalogs, writeCatalog, writeDts } from "@verbaly/compiler";
6
+ import { check, collectOrigins, counted, doctor, effectiveDrafts, extractProject, formatCheckResult, formatCheckWarnings, formatDoctorEntry, formatStatusResult, formatTranslateFailures, loadCatalogs, loadConfig, loadDrafts, markDrafts, pruneCatalogs, resolveProvider, saveDrafts, status, syncCatalogs, translateCatalogs, wrapProject, writeCatalog, writeDts } from "@verbaly/compiler";
7
7
  import { z } from "zod";
8
8
  //#region src/server.ts
9
9
  const { version } = createRequire(import.meta.url)("../package.json");
10
- const text = (body) => ({ content: [{
11
- type: "text",
12
- text: body
13
- }] });
10
+ const reply = (body, data) => ({
11
+ content: [{
12
+ type: "text",
13
+ text: body
14
+ }],
15
+ structuredContent: data
16
+ });
14
17
  const rootInput = z.string().optional().describe("Project root holding verbaly.config (defaults to the server working directory)");
18
+ const perLocale = z.array(z.object({
19
+ locale: z.string(),
20
+ keys: z.array(z.string())
21
+ }));
22
+ const byLocale = (record) => Object.entries(record).map(([locale, keys]) => ({
23
+ locale,
24
+ keys
25
+ }));
15
26
  function createVerbalyMcp(options = {}) {
16
27
  const server = new McpServer({
17
28
  name: "verbaly",
@@ -35,12 +46,23 @@ function createVerbalyMcp(options = {}) {
35
46
  title: "Translation coverage",
36
47
  description: "Translation coverage of the Verbaly project: total messages, translated count per locale and machine translations awaiting review (drafts). Read-only.",
37
48
  inputSchema: { root: rootInput },
49
+ outputSchema: {
50
+ messages: z.number().describe("Messages the project has, source catalog plus code"),
51
+ source: z.string().describe("Source locale"),
52
+ locales: z.array(z.object({
53
+ locale: z.string(),
54
+ translated: z.number(),
55
+ total: z.number(),
56
+ drafts: z.number().describe("Machine translations awaiting human review"),
57
+ broken: z.number().describe("Present but not rendering what the source renders")
58
+ }))
59
+ },
38
60
  annotations: { readOnlyHint: true }
39
61
  }, guarded(async ({ root }) => {
40
62
  const cfg = await config(root);
41
63
  const registry = await extractProject(cfg);
42
64
  const result = status(cfg, loadCatalogs(cfg), registry, loadDrafts(cfg));
43
- return text(formatStatusResult(result));
65
+ return reply(formatStatusResult(result), { ...result });
44
66
  }));
45
67
  server.registerTool("verbaly_missing", {
46
68
  title: "Missing and broken translations",
@@ -49,20 +71,109 @@ function createVerbalyMcp(options = {}) {
49
71
  root: rootInput,
50
72
  drafts: z.boolean().optional().describe("Also list machine translations awaiting human review")
51
73
  },
74
+ outputSchema: {
75
+ ok: z.boolean().describe("Whether `verbaly check` would pass (warnings never fail it)"),
76
+ missing: z.array(z.object({
77
+ locale: z.string(),
78
+ key: z.string(),
79
+ source: z.string().optional()
80
+ })),
81
+ unknown: z.array(z.object({
82
+ key: z.string(),
83
+ files: z.array(z.string())
84
+ })),
85
+ broken: z.array(z.object({
86
+ locale: z.string(),
87
+ key: z.string(),
88
+ severity: z.enum(["error", "warning"]),
89
+ issue: z.string()
90
+ })),
91
+ unreviewed: perLocale
92
+ },
52
93
  annotations: { readOnlyHint: true }
53
94
  }, guarded(async ({ root, drafts }) => {
54
95
  const cfg = await config(root);
55
96
  const registry = await extractProject(cfg);
56
97
  const catalogs = loadCatalogs(cfg);
57
98
  const result = check(cfg, catalogs, registry);
58
- const unreviewed = drafts ? Object.entries(effectiveDrafts(loadDrafts(cfg), catalogs)) : [];
99
+ const unreviewed = drafts ? byLocale(effectiveDrafts(loadDrafts(cfg), catalogs)) : [];
59
100
  const lines = [];
60
101
  if (!result.ok) lines.push(formatCheckResult(result));
61
102
  const warnings = formatCheckWarnings(result);
62
103
  if (warnings) lines.push(`warnings (the gate still passes):\n${warnings}`);
63
- for (const [locale, keys] of unreviewed) if (keys.length) lines.push(`[${locale}] ${keys.length} unreviewed: ${keys.join(", ")}`);
64
- if (lines.length === 0) return text("all translations complete");
65
- return text(lines.join("\n"));
104
+ for (const { locale, keys } of unreviewed) if (keys.length) lines.push(`[${locale}] ${keys.length} unreviewed: ${keys.join(", ")}`);
105
+ return reply(lines.length === 0 ? "all translations complete" : lines.join("\n"), {
106
+ ...result,
107
+ unreviewed
108
+ });
109
+ }));
110
+ server.registerTool("verbaly_doctor", {
111
+ title: "Diagnose the setup",
112
+ description: "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.",
113
+ inputSchema: { root: rootInput },
114
+ outputSchema: {
115
+ ok: z.boolean().describe("False when an entry is an error, which is when the CLI exits 1"),
116
+ entries: z.array(z.object({
117
+ level: z.enum([
118
+ "ok",
119
+ "warn",
120
+ "error"
121
+ ]),
122
+ check: z.string(),
123
+ message: z.string(),
124
+ fix: z.string().optional().describe("What to run or change, when there is one")
125
+ }))
126
+ },
127
+ annotations: { readOnlyHint: true }
128
+ }, guarded(async ({ root }) => {
129
+ const cfg = await config(root);
130
+ const result = await doctor(cfg);
131
+ const health = result.ok ? "setup looks healthy" : "problems found";
132
+ const head = `${counted(result.entries.length, "check")}, ${health}`;
133
+ return reply([head, ...result.entries.map(formatDoctorEntry)].join("\n"), { ...result });
134
+ }));
135
+ server.registerTool("verbaly_wrap", {
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.",
138
+ inputSchema: {
139
+ root: rootInput,
140
+ write: z.boolean().optional().describe("Apply the rewrites instead of only reporting")
141
+ },
142
+ outputSchema: {
143
+ files: z.number().describe("JSX/TSX files scanned"),
144
+ write: z.boolean(),
145
+ changed: z.array(z.string()).describe("Files the rewrite touched, or would touch"),
146
+ wrapped: z.array(z.object({
147
+ file: z.string(),
148
+ line: z.number(),
149
+ text: z.string(),
150
+ kind: z.enum(["text", "attribute"]),
151
+ attribute: z.string().optional()
152
+ })),
153
+ skipped: z.array(z.object({
154
+ file: z.string(),
155
+ line: z.number(),
156
+ text: z.string(),
157
+ reason: z.string()
158
+ }))
159
+ }
160
+ }, guarded(async ({ root, write }) => {
161
+ const cfg = await config(root);
162
+ 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) {
165
+ const attr = entry.kind === "attribute" ? `${entry.attribute} -> ` : "";
166
+ lines.push(` ${entry.file}:${entry.line} ${attr}"${entry.text}"`);
167
+ }
168
+ if (result.skipped.length > 0) {
169
+ lines.push(" needs a human:");
170
+ for (const entry of result.skipped) lines.push(` ${entry.file}:${entry.line} "${entry.text}" (${entry.reason})`);
171
+ }
172
+ if (write && result.changed.length > 0) lines.push(" next: make t available where TS complains, then run verbaly_extract");
173
+ return reply(lines.join("\n"), {
174
+ ...result,
175
+ write: write === true
176
+ });
66
177
  }));
67
178
  server.registerTool("verbaly_extract", {
68
179
  title: "Extract messages",
@@ -71,32 +182,55 @@ function createVerbalyMcp(options = {}) {
71
182
  root: rootInput,
72
183
  prune: z.boolean().optional().describe("Drop keys no longer referenced (deletes their translations)"),
73
184
  dryRun: z.boolean().optional().describe("Report what would change, write nothing")
185
+ },
186
+ outputSchema: {
187
+ messages: z.number(),
188
+ locales: z.array(z.string()),
189
+ dryRun: z.boolean(),
190
+ added: perLocale,
191
+ pruned: perLocale
74
192
  }
75
193
  }, guarded(async ({ root, prune, dryRun }) => {
76
194
  const cfg = await config(root);
77
195
  const registry = await extractProject(cfg);
78
196
  const catalogs = loadCatalogs(cfg);
79
197
  const lines = [];
80
- if (prune) {
81
- const removed = pruneCatalogs(cfg, catalogs, registry);
82
- for (const [locale, keys] of Object.entries(removed)) lines.push(dryRun ? `${locale}: would prune ${keys.length}: ${keys.join(", ")}` : `${locale}: ${keys.length} pruned`);
83
- }
84
- const { added } = syncCatalogs(cfg, catalogs, registry);
198
+ const pruned = prune ? byLocale(pruneCatalogs(cfg, catalogs, registry)) : [];
199
+ for (const { locale, keys } of pruned) lines.push(dryRun ? `${locale}: would prune ${keys.length}: ${keys.join(", ")}` : `${locale}: ${keys.length} pruned`);
200
+ const added = byLocale(syncCatalogs(cfg, catalogs, registry).added);
85
201
  if (!dryRun) {
86
202
  for (const locale of cfg.locales) writeCatalog(cfg, locale, catalogs[locale] ?? {});
87
203
  if (cfg.dts !== false) writeDts(cfg, catalogs[cfg.sourceLocale] ?? {}, cfg.dts);
88
204
  }
89
- lines.unshift(`${counted(registry.messages().size, "message")} ยท locales: ${cfg.locales.join(", ")}${dryRun ? " (dry run, nothing written)" : ""}`);
90
- for (const [locale, keys] of Object.entries(added)) lines.push(`${locale}: ${dryRun ? `would add ${keys.length}` : `+${keys.length} added`}`);
91
- return text(lines.join("\n"));
205
+ const messages = registry.messages().size;
206
+ lines.unshift(`${counted(messages, "message")} ยท locales: ${cfg.locales.join(", ")}${dryRun ? " (dry run, nothing written)" : ""}`);
207
+ for (const { locale, keys } of added) lines.push(`${locale}: ${dryRun ? `would add ${keys.length}` : `+${keys.length} added`}`);
208
+ return reply(lines.join("\n"), {
209
+ messages,
210
+ locales: cfg.locales,
211
+ dryRun: dryRun === true,
212
+ added,
213
+ pruned
214
+ });
92
215
  }));
93
216
  server.registerTool("verbaly_translate", {
94
217
  title: "Machine-translate missing entries",
95
- description: "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`). dryRun lists what would be translated without calling the provider.",
218
+ description: "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.",
96
219
  inputSchema: {
97
220
  root: rootInput,
98
221
  locales: z.array(z.string()).optional().describe("Target locales (default: all)"),
99
222
  dryRun: z.boolean().optional().describe("List missing entries per locale, call no provider")
223
+ },
224
+ outputSchema: {
225
+ dryRun: z.boolean(),
226
+ translated: perLocale.describe("Saved as drafts, a human still has to approve them"),
227
+ invalid: perLocale.describe("Rejected: params or tags were not preserved"),
228
+ failed: z.array(z.object({
229
+ locale: z.string(),
230
+ keys: z.array(z.string()),
231
+ error: z.string()
232
+ })).describe("Batches the provider never answered, safe to retry"),
233
+ pending: perLocale.describe("dryRun only: what would be translated")
100
234
  }
101
235
  }, guarded(async ({ root, locales, dryRun }) => {
102
236
  const cfg = await config(root);
@@ -105,26 +239,35 @@ function createVerbalyMcp(options = {}) {
105
239
  const result = await translateCatalogs(cfg, catalogs, provider, {
106
240
  locales,
107
241
  batchSize: cfg.translate.batchSize,
242
+ concurrency: cfg.translate.concurrency,
243
+ retries: cfg.translate.retries,
108
244
  dryRun,
109
245
  origins: dryRun ? void 0 : await collectOrigins(cfg)
110
246
  });
247
+ const data = {
248
+ dryRun: dryRun === true,
249
+ translated: byLocale(result.translated),
250
+ invalid: byLocale(result.invalid),
251
+ failed: result.failed,
252
+ pending: byLocale(result.pending)
253
+ };
111
254
  if (dryRun) {
112
- const entries = Object.entries(result.pending);
113
- if (entries.length === 0) return text("nothing to translate");
114
- return text(entries.map(([locale, keys]) => `${locale}: ${keys.length} missing: ${keys.join(", ")}`).join("\n"));
255
+ const lines = data.pending.map(({ locale, keys }) => `${locale}: ${keys.length} missing: ${keys.join(", ")}`);
256
+ return reply(lines.length === 0 ? "nothing to translate" : lines.join("\n"), data);
115
257
  }
116
258
  const lines = [];
117
259
  const drafts = loadDrafts(cfg);
118
- for (const locale of Object.keys(result.translated)) {
260
+ for (const { locale, keys } of data.translated) {
119
261
  writeCatalog(cfg, locale, catalogs[locale] ?? {});
120
- markDrafts(drafts, locale, result.translated[locale]);
121
- lines.push(`${locale}: +${result.translated[locale].length} translated (draft)`);
262
+ markDrafts(drafts, locale, keys);
263
+ lines.push(`${locale}: +${keys.length} translated (draft)`);
122
264
  }
123
- if (Object.keys(result.translated).length > 0) saveDrafts(cfg, drafts);
124
- for (const [locale, keys] of Object.entries(result.invalid)) lines.push(`${locale}: ${keys.length} rejected (params/tags not preserved): ${keys.join(", ")}`);
125
- if (lines.length === 0) return text("nothing to translate");
126
- lines.push("drafts await human review: verbaly review (--approve accepts them)");
127
- return text(lines.join("\n"));
265
+ if (data.translated.length > 0) saveDrafts(cfg, drafts);
266
+ for (const { locale, keys } of data.invalid) lines.push(`${locale}: ${keys.length} rejected (params/tags not preserved): ${keys.join(", ")}`);
267
+ lines.push(...formatTranslateFailures(result.failed));
268
+ if (lines.length === 0) return reply("nothing to translate", data);
269
+ if (data.translated.length > 0) lines.push("drafts await human review: verbaly review (--approve accepts them)");
270
+ return reply(lines.join("\n"), data);
128
271
  }));
129
272
  return server;
130
273
  }
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 effectiveDrafts,\n extractProject,\n formatCheckResult,\n formatCheckWarnings,\n formatStatusResult,\n loadCatalogs,\n loadConfig,\n loadDrafts,\n markDrafts,\n pruneCatalogs,\n resolveProvider,\n saveDrafts,\n status,\n syncCatalogs,\n translateCatalogs,\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\nconst text = (body: string): CallToolResult => ({ content: [{ type: 'text', text: body }] });\n\nconst rootInput = z\n .string()\n .optional()\n .describe('Project root holding verbaly.config (defaults to the server working directory)');\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 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 text(formatStatusResult(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 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 ? Object.entries(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 if (lines.length === 0) return text('all translations complete');\n return text(lines.join('\\n'));\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 },\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 if (prune) {\n const removed = pruneCatalogs(cfg, catalogs, registry);\n for (const [locale, keys] of Object.entries(removed)) {\n lines.push(\n dryRun\n ? `${locale}: would prune ${keys.length}: ${keys.join(', ')}`\n : `${locale}: ${keys.length} pruned`,\n );\n }\n }\n const { added } = syncCatalogs(cfg, catalogs, registry);\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 lines.unshift(\n `${counted(registry.messages().size, 'message')} ยท locales: ${cfg.locales.join(', ')}${dryRun ? ' (dry run, nothing written)' : ''}`,\n );\n for (const [locale, keys] of Object.entries(added)) {\n lines.push(`${locale}: ${dryRun ? `would add ${keys.length}` : `+${keys.length} added`}`);\n }\n return text(lines.join('\\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`). 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 },\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 dryRun,\n origins: dryRun ? undefined : await collectOrigins(cfg),\n });\n\n if (dryRun) {\n const entries = Object.entries(result.pending);\n if (entries.length === 0) return text('nothing to translate');\n return text(\n entries\n .map(([locale, keys]) => `${locale}: ${keys.length} missing: ${keys.join(', ')}`)\n .join('\\n'),\n );\n }\n\n const lines: string[] = [];\n const drafts = loadDrafts(cfg);\n for (const locale of Object.keys(result.translated)) {\n writeCatalog(cfg, locale, catalogs[locale] ?? {});\n markDrafts(drafts, locale, result.translated[locale]!);\n lines.push(`${locale}: +${result.translated[locale]!.length} translated (draft)`);\n }\n if (Object.keys(result.translated).length > 0) saveDrafts(cfg, drafts);\n for (const [locale, keys] of Object.entries(result.invalid)) {\n lines.push(\n `${locale}: ${keys.length} rejected (params/tags not preserved): ${keys.join(', ')}`,\n );\n }\n if (lines.length === 0) return text('nothing to translate');\n lines.push('drafts await human review: verbaly review (--approve accepts them)');\n return text(lines.join('\\n'));\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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/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,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,MAAM,iBAAiB,iBAAiB,QAAQ,MAAM,UAAU,KAAK;CAC7E,QAAQ,WAAW;AACrB"}
package/dist/index.js CHANGED
@@ -1,14 +1,25 @@
1
1
  import { createRequire } from "node:module";
2
2
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
- import { check, collectOrigins, counted, effectiveDrafts, extractProject, formatCheckResult, formatCheckWarnings, formatStatusResult, loadCatalogs, loadConfig, loadDrafts, markDrafts, pruneCatalogs, resolveProvider, saveDrafts, status, syncCatalogs, translateCatalogs, writeCatalog, writeDts } from "@verbaly/compiler";
3
+ import { check, collectOrigins, counted, doctor, effectiveDrafts, extractProject, formatCheckResult, formatCheckWarnings, formatDoctorEntry, formatStatusResult, formatTranslateFailures, loadCatalogs, loadConfig, loadDrafts, markDrafts, pruneCatalogs, resolveProvider, saveDrafts, status, syncCatalogs, translateCatalogs, wrapProject, writeCatalog, writeDts } from "@verbaly/compiler";
4
4
  import { z } from "zod";
5
5
  //#region src/server.ts
6
6
  const { version } = createRequire(import.meta.url)("../package.json");
7
- const text = (body) => ({ content: [{
8
- type: "text",
9
- text: body
10
- }] });
7
+ const reply = (body, data) => ({
8
+ content: [{
9
+ type: "text",
10
+ text: body
11
+ }],
12
+ structuredContent: data
13
+ });
11
14
  const rootInput = z.string().optional().describe("Project root holding verbaly.config (defaults to the server working directory)");
15
+ const perLocale = z.array(z.object({
16
+ locale: z.string(),
17
+ keys: z.array(z.string())
18
+ }));
19
+ const byLocale = (record) => Object.entries(record).map(([locale, keys]) => ({
20
+ locale,
21
+ keys
22
+ }));
12
23
  function createVerbalyMcp(options = {}) {
13
24
  const server = new McpServer({
14
25
  name: "verbaly",
@@ -32,12 +43,23 @@ function createVerbalyMcp(options = {}) {
32
43
  title: "Translation coverage",
33
44
  description: "Translation coverage of the Verbaly project: total messages, translated count per locale and machine translations awaiting review (drafts). Read-only.",
34
45
  inputSchema: { root: rootInput },
46
+ outputSchema: {
47
+ messages: z.number().describe("Messages the project has, source catalog plus code"),
48
+ source: z.string().describe("Source locale"),
49
+ locales: z.array(z.object({
50
+ locale: z.string(),
51
+ translated: z.number(),
52
+ total: z.number(),
53
+ drafts: z.number().describe("Machine translations awaiting human review"),
54
+ broken: z.number().describe("Present but not rendering what the source renders")
55
+ }))
56
+ },
35
57
  annotations: { readOnlyHint: true }
36
58
  }, guarded(async ({ root }) => {
37
59
  const cfg = await config(root);
38
60
  const registry = await extractProject(cfg);
39
61
  const result = status(cfg, loadCatalogs(cfg), registry, loadDrafts(cfg));
40
- return text(formatStatusResult(result));
62
+ return reply(formatStatusResult(result), { ...result });
41
63
  }));
42
64
  server.registerTool("verbaly_missing", {
43
65
  title: "Missing and broken translations",
@@ -46,20 +68,109 @@ function createVerbalyMcp(options = {}) {
46
68
  root: rootInput,
47
69
  drafts: z.boolean().optional().describe("Also list machine translations awaiting human review")
48
70
  },
71
+ outputSchema: {
72
+ ok: z.boolean().describe("Whether `verbaly check` would pass (warnings never fail it)"),
73
+ missing: z.array(z.object({
74
+ locale: z.string(),
75
+ key: z.string(),
76
+ source: z.string().optional()
77
+ })),
78
+ unknown: z.array(z.object({
79
+ key: z.string(),
80
+ files: z.array(z.string())
81
+ })),
82
+ broken: z.array(z.object({
83
+ locale: z.string(),
84
+ key: z.string(),
85
+ severity: z.enum(["error", "warning"]),
86
+ issue: z.string()
87
+ })),
88
+ unreviewed: perLocale
89
+ },
49
90
  annotations: { readOnlyHint: true }
50
91
  }, guarded(async ({ root, drafts }) => {
51
92
  const cfg = await config(root);
52
93
  const registry = await extractProject(cfg);
53
94
  const catalogs = loadCatalogs(cfg);
54
95
  const result = check(cfg, catalogs, registry);
55
- const unreviewed = drafts ? Object.entries(effectiveDrafts(loadDrafts(cfg), catalogs)) : [];
96
+ const unreviewed = drafts ? byLocale(effectiveDrafts(loadDrafts(cfg), catalogs)) : [];
56
97
  const lines = [];
57
98
  if (!result.ok) lines.push(formatCheckResult(result));
58
99
  const warnings = formatCheckWarnings(result);
59
100
  if (warnings) lines.push(`warnings (the gate still passes):\n${warnings}`);
60
- for (const [locale, keys] of unreviewed) if (keys.length) lines.push(`[${locale}] ${keys.length} unreviewed: ${keys.join(", ")}`);
61
- if (lines.length === 0) return text("all translations complete");
62
- return text(lines.join("\n"));
101
+ for (const { locale, keys } of unreviewed) if (keys.length) lines.push(`[${locale}] ${keys.length} unreviewed: ${keys.join(", ")}`);
102
+ return reply(lines.length === 0 ? "all translations complete" : lines.join("\n"), {
103
+ ...result,
104
+ unreviewed
105
+ });
106
+ }));
107
+ server.registerTool("verbaly_doctor", {
108
+ title: "Diagnose the setup",
109
+ description: "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.",
110
+ inputSchema: { root: rootInput },
111
+ outputSchema: {
112
+ ok: z.boolean().describe("False when an entry is an error, which is when the CLI exits 1"),
113
+ entries: z.array(z.object({
114
+ level: z.enum([
115
+ "ok",
116
+ "warn",
117
+ "error"
118
+ ]),
119
+ check: z.string(),
120
+ message: z.string(),
121
+ fix: z.string().optional().describe("What to run or change, when there is one")
122
+ }))
123
+ },
124
+ annotations: { readOnlyHint: true }
125
+ }, guarded(async ({ root }) => {
126
+ const cfg = await config(root);
127
+ const result = await doctor(cfg);
128
+ const health = result.ok ? "setup looks healthy" : "problems found";
129
+ const head = `${counted(result.entries.length, "check")}, ${health}`;
130
+ return reply([head, ...result.entries.map(formatDoctorEntry)].join("\n"), { ...result });
131
+ }));
132
+ server.registerTool("verbaly_wrap", {
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.",
135
+ inputSchema: {
136
+ root: rootInput,
137
+ write: z.boolean().optional().describe("Apply the rewrites instead of only reporting")
138
+ },
139
+ outputSchema: {
140
+ files: z.number().describe("JSX/TSX files scanned"),
141
+ write: z.boolean(),
142
+ changed: z.array(z.string()).describe("Files the rewrite touched, or would touch"),
143
+ wrapped: z.array(z.object({
144
+ file: z.string(),
145
+ line: z.number(),
146
+ text: z.string(),
147
+ kind: z.enum(["text", "attribute"]),
148
+ attribute: z.string().optional()
149
+ })),
150
+ skipped: z.array(z.object({
151
+ file: z.string(),
152
+ line: z.number(),
153
+ text: z.string(),
154
+ reason: z.string()
155
+ }))
156
+ }
157
+ }, guarded(async ({ root, write }) => {
158
+ const cfg = await config(root);
159
+ 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) {
162
+ const attr = entry.kind === "attribute" ? `${entry.attribute} -> ` : "";
163
+ lines.push(` ${entry.file}:${entry.line} ${attr}"${entry.text}"`);
164
+ }
165
+ if (result.skipped.length > 0) {
166
+ lines.push(" needs a human:");
167
+ for (const entry of result.skipped) lines.push(` ${entry.file}:${entry.line} "${entry.text}" (${entry.reason})`);
168
+ }
169
+ if (write && result.changed.length > 0) lines.push(" next: make t available where TS complains, then run verbaly_extract");
170
+ return reply(lines.join("\n"), {
171
+ ...result,
172
+ write: write === true
173
+ });
63
174
  }));
64
175
  server.registerTool("verbaly_extract", {
65
176
  title: "Extract messages",
@@ -68,32 +179,55 @@ function createVerbalyMcp(options = {}) {
68
179
  root: rootInput,
69
180
  prune: z.boolean().optional().describe("Drop keys no longer referenced (deletes their translations)"),
70
181
  dryRun: z.boolean().optional().describe("Report what would change, write nothing")
182
+ },
183
+ outputSchema: {
184
+ messages: z.number(),
185
+ locales: z.array(z.string()),
186
+ dryRun: z.boolean(),
187
+ added: perLocale,
188
+ pruned: perLocale
71
189
  }
72
190
  }, guarded(async ({ root, prune, dryRun }) => {
73
191
  const cfg = await config(root);
74
192
  const registry = await extractProject(cfg);
75
193
  const catalogs = loadCatalogs(cfg);
76
194
  const lines = [];
77
- if (prune) {
78
- const removed = pruneCatalogs(cfg, catalogs, registry);
79
- for (const [locale, keys] of Object.entries(removed)) lines.push(dryRun ? `${locale}: would prune ${keys.length}: ${keys.join(", ")}` : `${locale}: ${keys.length} pruned`);
80
- }
81
- const { added } = syncCatalogs(cfg, catalogs, registry);
195
+ const pruned = prune ? byLocale(pruneCatalogs(cfg, catalogs, registry)) : [];
196
+ for (const { locale, keys } of pruned) lines.push(dryRun ? `${locale}: would prune ${keys.length}: ${keys.join(", ")}` : `${locale}: ${keys.length} pruned`);
197
+ const added = byLocale(syncCatalogs(cfg, catalogs, registry).added);
82
198
  if (!dryRun) {
83
199
  for (const locale of cfg.locales) writeCatalog(cfg, locale, catalogs[locale] ?? {});
84
200
  if (cfg.dts !== false) writeDts(cfg, catalogs[cfg.sourceLocale] ?? {}, cfg.dts);
85
201
  }
86
- lines.unshift(`${counted(registry.messages().size, "message")} ยท locales: ${cfg.locales.join(", ")}${dryRun ? " (dry run, nothing written)" : ""}`);
87
- for (const [locale, keys] of Object.entries(added)) lines.push(`${locale}: ${dryRun ? `would add ${keys.length}` : `+${keys.length} added`}`);
88
- return text(lines.join("\n"));
202
+ const messages = registry.messages().size;
203
+ lines.unshift(`${counted(messages, "message")} ยท locales: ${cfg.locales.join(", ")}${dryRun ? " (dry run, nothing written)" : ""}`);
204
+ for (const { locale, keys } of added) lines.push(`${locale}: ${dryRun ? `would add ${keys.length}` : `+${keys.length} added`}`);
205
+ return reply(lines.join("\n"), {
206
+ messages,
207
+ locales: cfg.locales,
208
+ dryRun: dryRun === true,
209
+ added,
210
+ pruned
211
+ });
89
212
  }));
90
213
  server.registerTool("verbaly_translate", {
91
214
  title: "Machine-translate missing entries",
92
- description: "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`). dryRun lists what would be translated without calling the provider.",
215
+ description: "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.",
93
216
  inputSchema: {
94
217
  root: rootInput,
95
218
  locales: z.array(z.string()).optional().describe("Target locales (default: all)"),
96
219
  dryRun: z.boolean().optional().describe("List missing entries per locale, call no provider")
220
+ },
221
+ outputSchema: {
222
+ dryRun: z.boolean(),
223
+ translated: perLocale.describe("Saved as drafts, a human still has to approve them"),
224
+ invalid: perLocale.describe("Rejected: params or tags were not preserved"),
225
+ failed: z.array(z.object({
226
+ locale: z.string(),
227
+ keys: z.array(z.string()),
228
+ error: z.string()
229
+ })).describe("Batches the provider never answered, safe to retry"),
230
+ pending: perLocale.describe("dryRun only: what would be translated")
97
231
  }
98
232
  }, guarded(async ({ root, locales, dryRun }) => {
99
233
  const cfg = await config(root);
@@ -102,26 +236,35 @@ function createVerbalyMcp(options = {}) {
102
236
  const result = await translateCatalogs(cfg, catalogs, provider, {
103
237
  locales,
104
238
  batchSize: cfg.translate.batchSize,
239
+ concurrency: cfg.translate.concurrency,
240
+ retries: cfg.translate.retries,
105
241
  dryRun,
106
242
  origins: dryRun ? void 0 : await collectOrigins(cfg)
107
243
  });
244
+ const data = {
245
+ dryRun: dryRun === true,
246
+ translated: byLocale(result.translated),
247
+ invalid: byLocale(result.invalid),
248
+ failed: result.failed,
249
+ pending: byLocale(result.pending)
250
+ };
108
251
  if (dryRun) {
109
- const entries = Object.entries(result.pending);
110
- if (entries.length === 0) return text("nothing to translate");
111
- return text(entries.map(([locale, keys]) => `${locale}: ${keys.length} missing: ${keys.join(", ")}`).join("\n"));
252
+ const lines = data.pending.map(({ locale, keys }) => `${locale}: ${keys.length} missing: ${keys.join(", ")}`);
253
+ return reply(lines.length === 0 ? "nothing to translate" : lines.join("\n"), data);
112
254
  }
113
255
  const lines = [];
114
256
  const drafts = loadDrafts(cfg);
115
- for (const locale of Object.keys(result.translated)) {
257
+ for (const { locale, keys } of data.translated) {
116
258
  writeCatalog(cfg, locale, catalogs[locale] ?? {});
117
- markDrafts(drafts, locale, result.translated[locale]);
118
- lines.push(`${locale}: +${result.translated[locale].length} translated (draft)`);
259
+ markDrafts(drafts, locale, keys);
260
+ lines.push(`${locale}: +${keys.length} translated (draft)`);
119
261
  }
120
- if (Object.keys(result.translated).length > 0) saveDrafts(cfg, drafts);
121
- for (const [locale, keys] of Object.entries(result.invalid)) lines.push(`${locale}: ${keys.length} rejected (params/tags not preserved): ${keys.join(", ")}`);
122
- if (lines.length === 0) return text("nothing to translate");
123
- lines.push("drafts await human review: verbaly review (--approve accepts them)");
124
- return text(lines.join("\n"));
262
+ if (data.translated.length > 0) saveDrafts(cfg, drafts);
263
+ for (const { locale, keys } of data.invalid) lines.push(`${locale}: ${keys.length} rejected (params/tags not preserved): ${keys.join(", ")}`);
264
+ lines.push(...formatTranslateFailures(result.failed));
265
+ if (lines.length === 0) return reply("nothing to translate", data);
266
+ if (data.translated.length > 0) lines.push("drafts await human review: verbaly review (--approve accepts them)");
267
+ return reply(lines.join("\n"), data);
125
268
  }));
126
269
  return server;
127
270
  }
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 effectiveDrafts,\n extractProject,\n formatCheckResult,\n formatCheckWarnings,\n formatStatusResult,\n loadCatalogs,\n loadConfig,\n loadDrafts,\n markDrafts,\n pruneCatalogs,\n resolveProvider,\n saveDrafts,\n status,\n syncCatalogs,\n translateCatalogs,\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\nconst text = (body: string): CallToolResult => ({ content: [{ type: 'text', text: body }] });\n\nconst rootInput = z\n .string()\n .optional()\n .describe('Project root holding verbaly.config (defaults to the server working directory)');\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 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 text(formatStatusResult(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 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 ? Object.entries(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 if (lines.length === 0) return text('all translations complete');\n return text(lines.join('\\n'));\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 },\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 if (prune) {\n const removed = pruneCatalogs(cfg, catalogs, registry);\n for (const [locale, keys] of Object.entries(removed)) {\n lines.push(\n dryRun\n ? `${locale}: would prune ${keys.length}: ${keys.join(', ')}`\n : `${locale}: ${keys.length} pruned`,\n );\n }\n }\n const { added } = syncCatalogs(cfg, catalogs, registry);\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 lines.unshift(\n `${counted(registry.messages().size, 'message')} ยท locales: ${cfg.locales.join(', ')}${dryRun ? ' (dry run, nothing written)' : ''}`,\n );\n for (const [locale, keys] of Object.entries(added)) {\n lines.push(`${locale}: ${dryRun ? `would add ${keys.length}` : `+${keys.length} added`}`);\n }\n return text(lines.join('\\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`). 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 },\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 dryRun,\n origins: dryRun ? undefined : await collectOrigins(cfg),\n });\n\n if (dryRun) {\n const entries = Object.entries(result.pending);\n if (entries.length === 0) return text('nothing to translate');\n return text(\n entries\n .map(([locale, keys]) => `${locale}: ${keys.length} missing: ${keys.join(', ')}`)\n .join('\\n'),\n );\n }\n\n const lines: string[] = [];\n const drafts = loadDrafts(cfg);\n for (const locale of Object.keys(result.translated)) {\n writeCatalog(cfg, locale, catalogs[locale] ?? {});\n markDrafts(drafts, locale, result.translated[locale]!);\n lines.push(`${locale}: +${result.translated[locale]!.length} translated (draft)`);\n }\n if (Object.keys(result.translated).length > 0) saveDrafts(cfg, drafts);\n for (const [locale, keys] of Object.entries(result.invalid)) {\n lines.push(\n `${locale}: ${keys.length} rejected (params/tags not preserved): ${keys.join(', ')}`,\n );\n }\n if (lines.length === 0) return text('nothing to translate');\n lines.push('drafts await human review: verbaly review (--approve accepts them)');\n return text(lines.join('\\n'));\n }),\n );\n\n return server;\n}\n"],"mappings":";;;;;AA4BA,MAAM,EAAE,YAAY,cAAc,YAAY,GAAG,CAAC,CAAC,iBAAiB;AAMpE,MAAM,QAAQ,UAAkC,EAAE,SAAS,CAAC;CAAE,MAAM;CAAQ,MAAM;AAAK,CAAC,EAAE;AAE1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AM,SAAS,WAAW,GAAG;EAC7B,KAAK,MAAM,UAAU,OAAO,KAAK,OAAO,UAAU,GAAG;GACnD,aAAa,KAAK,QAAQ,SAAS,WAAW,CAAC,CAAC;GAChD,WAAW,QAAQ,QAAQ,OAAO,WAAW,OAAQ;GACrD,MAAM,KAAK,GAAG,OAAO,KAAK,OAAO,WAAW,OAAO,CAAE,OAAO,oBAAoB;EAClF;EACA,IAAI,OAAO,KAAK,OAAO,UAAU,CAAC,CAAC,SAAS,GAAG,WAAW,KAAK,MAAM;EACrE,KAAK,MAAM,CAAC,QAAQ,SAAS,OAAO,QAAQ,OAAO,OAAO,GACxD,MAAM,KACJ,GAAG,OAAO,IAAI,KAAK,OAAO,yCAAyC,KAAK,KAAK,IAAI,GACnF;EAEF,IAAI,MAAM,WAAW,GAAG,OAAO,KAAK,sBAAsB;EAC1D,MAAM,KAAK,oEAAoE;EAC/E,OAAO,KAAK,MAAM,KAAK,IAAI,CAAC;CAC9B,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. 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,CAAC,CAAC,SAAS,eAAe;GAC3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AAI,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,7 +1,7 @@
1
1
  {
2
2
  "name": "@verbaly/mcp",
3
- "version": "0.38.0",
4
- "description": "MCP server for Verbaly: translation status, missing keys, extraction and machine translation as tools for coding agents.",
3
+ "version": "0.39.0",
4
+ "description": "MCP server for Verbaly: diagnosis, onboarding, extraction, coverage and machine translation as tools for coding agents.",
5
5
  "keywords": [
6
6
  "i18n",
7
7
  "mcp",
@@ -16,7 +16,7 @@
16
16
  "url": "git+https://github.com/AronSoto/verbaly.git",
17
17
  "directory": "packages/mcp"
18
18
  },
19
- "homepage": "https://verbaly-web.vercel.app/docs/reference/cli",
19
+ "homepage": "https://verbaly-web.vercel.app/docs/guide/agents",
20
20
  "bugs": {
21
21
  "url": "https://github.com/AronSoto/verbaly/issues"
22
22
  },
@@ -45,7 +45,7 @@
45
45
  "dependencies": {
46
46
  "@modelcontextprotocol/sdk": "^1.30.0",
47
47
  "zod": "^4.4.3",
48
- "@verbaly/compiler": "^0.38.0"
48
+ "@verbaly/compiler": "^0.39.0"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/node": "^26.2.0"