@verbaly/mcp 0.48.0 → 0.49.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 +23 -10
- package/dist/cli.js +173 -61
- package/dist/cli.js.map +1 -1
- package/dist/index.js +173 -61
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
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: diagnosis, onboarding, extraction, coverage and machine translation as tools for coding agents.</em></p>
|
|
5
|
+
<p align="center"><em>MCP server for Verbaly: setup, diagnosis, onboarding, extraction, coverage and machine translation as tools for coding agents, plus resources that let them read your catalogs.</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>
|
|
@@ -35,16 +35,29 @@ The server reads the project from its working directory; pass `--root <path>` (o
|
|
|
35
35
|
|
|
36
36
|
## 🧰 Tools
|
|
37
37
|
|
|
38
|
-
| Tool | What it does
|
|
39
|
-
| ------------------- |
|
|
40
|
-
| `
|
|
41
|
-
| `
|
|
42
|
-
| `
|
|
43
|
-
| `
|
|
44
|
-
| `
|
|
45
|
-
| `
|
|
38
|
+
| Tool | What it does |
|
|
39
|
+
| ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
40
|
+
| `verbaly_init` | Create the config and the catalogs, and detect the bundler or meta-framework so the answer names what to add. Writes files, keeps what is already there. |
|
|
41
|
+
| `verbaly_doctor` | Diagnose the whole setup: config, catalogs, plugin, types, unreadable files, orphan keys, every gate failure. Start here. Read-only. |
|
|
42
|
+
| `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. |
|
|
43
|
+
| `verbaly_extract` | Scan sources, add new messages to the catalogs, refresh the generated types. `dryRun` previews; `prune` drops dead keys. |
|
|
44
|
+
| `verbaly_status` | Coverage per locale: total messages, translated counts, drafts awaiting review. Read-only. |
|
|
45
|
+
| `verbaly_missing` | Missing translations, unknown keys and broken ones (the same gate `verbaly check` runs in CI). Read-only. |
|
|
46
|
+
| `verbaly_translate` | Fill missing entries with the configured provider (default: Claude). Output is saved as drafts awaiting human review. |
|
|
47
|
+
| `verbaly_drafts` | Every machine translation still waiting for a human, each with its source text and what the provider wrote. Read-only, and it cannot approve. |
|
|
46
48
|
|
|
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.
|
|
49
|
+
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. `verbaly_drafts` is the other half of that promise: it shows each one next to its source, so the human deciding can actually read what they are accepting.
|
|
50
|
+
|
|
51
|
+
## 📖 Resources
|
|
52
|
+
|
|
53
|
+
Reading the project is an address, not a call, so these cost no tool invocation:
|
|
54
|
+
|
|
55
|
+
| Resource | What it holds |
|
|
56
|
+
| ---------------------------- | ---------------------------------------------------------------------------------------------------------- |
|
|
57
|
+
| `verbaly://config` | Source locale, every locale, the catalog directory and where the language lives in the url. Read it first. |
|
|
58
|
+
| `verbaly://catalog/{locale}` | Every message of one locale, flattened the way the runtime reads it. An empty value means untranslated. |
|
|
59
|
+
|
|
60
|
+
**This is the only way to read what a message says.** Every tool works in keys and counts, which is enough to report a gap and not enough to review a translation or write one in context.
|
|
48
61
|
|
|
49
62
|
`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.
|
|
50
63
|
|
package/dist/cli.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
4
|
import { parseArgs } from "node:util";
|
|
5
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
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";
|
|
5
|
+
import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
6
|
+
import { check, collectOrigins, counted, doctor, effectiveDrafts, extractProject, formatCheckResult, formatCheckWarnings, formatDoctorEntry, formatStatusResult, formatTranslateFailures, init, 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");
|
|
@@ -42,70 +42,80 @@ function createVerbalyMcp(options = {}) {
|
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
|
-
server.
|
|
46
|
-
title: "
|
|
47
|
-
description: "
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
45
|
+
server.registerResource("verbaly-config", "verbaly://config", {
|
|
46
|
+
title: "Project shape",
|
|
47
|
+
description: "The resolved Verbaly config: source locale, every locale, the catalog directory and where the language lives in the url. Read this before reasoning about anything else in the project.",
|
|
48
|
+
mimeType: "application/json"
|
|
49
|
+
}, async (uri) => {
|
|
50
|
+
const cfg = await config();
|
|
51
|
+
const shape = {
|
|
52
|
+
root: cfg.root,
|
|
53
|
+
sourceLocale: cfg.sourceLocale,
|
|
54
|
+
locales: cfg.locales,
|
|
55
|
+
localesDeclared: cfg.localesDeclared,
|
|
56
|
+
dir: cfg.dir,
|
|
57
|
+
routing: cfg.routing,
|
|
58
|
+
include: cfg.include
|
|
59
|
+
};
|
|
60
|
+
return { contents: [{
|
|
61
|
+
uri: uri.href,
|
|
62
|
+
mimeType: "application/json",
|
|
63
|
+
text: JSON.stringify(shape, null, 2)
|
|
64
|
+
}] };
|
|
65
|
+
});
|
|
66
|
+
server.registerResource("verbaly-catalog", new ResourceTemplate("verbaly://catalog/{locale}", { list: async () => {
|
|
67
|
+
return { resources: (await config()).locales.map((locale) => ({
|
|
68
|
+
name: `${locale} catalog`,
|
|
69
|
+
uri: `verbaly://catalog/${locale}`,
|
|
70
|
+
mimeType: "application/json"
|
|
71
|
+
})) };
|
|
72
|
+
} }), {
|
|
73
|
+
title: "Locale catalog",
|
|
74
|
+
description: "Every message of one locale, keyed the way the runtime sees them: a nested catalog arrives flattened, and an empty value means untranslated. This is the only way to read what a message actually says.",
|
|
75
|
+
mimeType: "application/json"
|
|
76
|
+
}, async (uri, { locale }) => {
|
|
77
|
+
const cfg = await config();
|
|
78
|
+
const name = String(locale);
|
|
79
|
+
if (!cfg.locales.includes(name)) {
|
|
80
|
+
const have = cfg.locales.join(", ");
|
|
81
|
+
throw new Error(`[verbaly] unknown locale "${name}": the project has ${have}`);
|
|
82
|
+
}
|
|
83
|
+
const catalog = loadCatalogs(cfg)[name] ?? {};
|
|
84
|
+
return { contents: [{
|
|
85
|
+
uri: uri.href,
|
|
86
|
+
mimeType: "application/json",
|
|
87
|
+
text: JSON.stringify(catalog, null, 2)
|
|
88
|
+
}] };
|
|
89
|
+
});
|
|
90
|
+
server.registerTool("verbaly_init", {
|
|
91
|
+
title: "Set up Verbaly in a project",
|
|
92
|
+
description: "Create the config file and the locale catalogs, and detect the bundler or meta-framework so the answer names the package to add and the line to wire (what `verbaly init` does). Writes files, and a file already there is kept rather than overwritten. Run this when doctor says there is no config.",
|
|
70
93
|
inputSchema: {
|
|
71
94
|
root: rootInput,
|
|
72
|
-
|
|
95
|
+
dir: z.string().optional().describe("Directory for the catalogs (default: locales)"),
|
|
96
|
+
sourceLocale: z.string().optional().describe("The language you write in (default: en)"),
|
|
97
|
+
locales: z.array(z.string()).optional().describe("Every locale, source included")
|
|
73
98
|
},
|
|
74
99
|
outputSchema: {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
key: z.string(),
|
|
88
|
-
severity: z.enum(["error", "warning"]),
|
|
89
|
-
issue: z.string()
|
|
90
|
-
})),
|
|
91
|
-
unreviewed: perLocale
|
|
92
|
-
},
|
|
93
|
-
annotations: { readOnlyHint: true }
|
|
94
|
-
}, guarded(async ({ root, drafts }) => {
|
|
95
|
-
const cfg = await config(root);
|
|
96
|
-
const registry = await extractProject(cfg);
|
|
97
|
-
const catalogs = loadCatalogs(cfg);
|
|
98
|
-
const result = check(cfg, catalogs, registry);
|
|
99
|
-
const unreviewed = drafts ? byLocale(effectiveDrafts(loadDrafts(cfg), catalogs)) : [];
|
|
100
|
-
const lines = [];
|
|
101
|
-
if (!result.ok) lines.push(formatCheckResult(result, cfg.root));
|
|
102
|
-
const warnings = formatCheckWarnings(result);
|
|
103
|
-
if (warnings) lines.push(`warnings (the gate still passes):\n${warnings}`);
|
|
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
|
|
100
|
+
created: z.array(z.string()).describe("Files written, relative to the project root"),
|
|
101
|
+
skipped: z.array(z.string()).describe("Files already there, left untouched"),
|
|
102
|
+
host: z.string().optional().describe("Bundler or meta-framework detected from the dependencies"),
|
|
103
|
+
configFile: z.string(),
|
|
104
|
+
next: z.array(z.string()).describe("What a human still has to do, in order")
|
|
105
|
+
}
|
|
106
|
+
}, guarded(async ({ root, dir, sourceLocale, locales }) => {
|
|
107
|
+
const result = await init({
|
|
108
|
+
root: root ?? options.root,
|
|
109
|
+
dir,
|
|
110
|
+
sourceLocale,
|
|
111
|
+
locales
|
|
108
112
|
});
|
|
113
|
+
const lines = [];
|
|
114
|
+
if (result.created.length) lines.push(`created: ${result.created.join(", ")}`);
|
|
115
|
+
if (result.skipped.length) lines.push(`kept (already there): ${result.skipped.join(", ")}`);
|
|
116
|
+
if (result.host) lines.push(`detected: ${result.host}`);
|
|
117
|
+
lines.push(...result.next.map((step, i) => `${i + 1}. ${step}`));
|
|
118
|
+
return reply(lines.join("\n"), { ...result });
|
|
109
119
|
}));
|
|
110
120
|
server.registerTool("verbaly_doctor", {
|
|
111
121
|
title: "Diagnose the setup",
|
|
@@ -228,6 +238,71 @@ function createVerbalyMcp(options = {}) {
|
|
|
228
238
|
pruned
|
|
229
239
|
});
|
|
230
240
|
}));
|
|
241
|
+
server.registerTool("verbaly_status", {
|
|
242
|
+
title: "Translation coverage",
|
|
243
|
+
description: "Translation coverage of the Verbaly project: total messages, translated count per locale and machine translations awaiting review (drafts). Read-only.",
|
|
244
|
+
inputSchema: { root: rootInput },
|
|
245
|
+
outputSchema: {
|
|
246
|
+
messages: z.number().describe("Messages the project has, source catalog plus code"),
|
|
247
|
+
source: z.string().describe("Source locale"),
|
|
248
|
+
locales: z.array(z.object({
|
|
249
|
+
locale: z.string(),
|
|
250
|
+
translated: z.number(),
|
|
251
|
+
total: z.number(),
|
|
252
|
+
drafts: z.number().describe("Machine translations awaiting human review"),
|
|
253
|
+
broken: z.number().describe("Present but not rendering what the source renders")
|
|
254
|
+
}))
|
|
255
|
+
},
|
|
256
|
+
annotations: { readOnlyHint: true }
|
|
257
|
+
}, guarded(async ({ root }) => {
|
|
258
|
+
const cfg = await config(root);
|
|
259
|
+
const registry = await extractProject(cfg);
|
|
260
|
+
const result = status(cfg, loadCatalogs(cfg), registry, loadDrafts(cfg));
|
|
261
|
+
return reply(formatStatusResult(result), { ...result });
|
|
262
|
+
}));
|
|
263
|
+
server.registerTool("verbaly_missing", {
|
|
264
|
+
title: "Missing and broken translations",
|
|
265
|
+
description: "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.",
|
|
266
|
+
inputSchema: {
|
|
267
|
+
root: rootInput,
|
|
268
|
+
drafts: z.boolean().optional().describe("Also list machine translations awaiting human review")
|
|
269
|
+
},
|
|
270
|
+
outputSchema: {
|
|
271
|
+
ok: z.boolean().describe("Whether `verbaly check` would pass (warnings never fail it)"),
|
|
272
|
+
missing: z.array(z.object({
|
|
273
|
+
locale: z.string(),
|
|
274
|
+
key: z.string(),
|
|
275
|
+
source: z.string().optional()
|
|
276
|
+
})),
|
|
277
|
+
unknown: z.array(z.object({
|
|
278
|
+
key: z.string(),
|
|
279
|
+
files: z.array(z.string())
|
|
280
|
+
})),
|
|
281
|
+
broken: z.array(z.object({
|
|
282
|
+
locale: z.string(),
|
|
283
|
+
key: z.string(),
|
|
284
|
+
severity: z.enum(["error", "warning"]),
|
|
285
|
+
issue: z.string()
|
|
286
|
+
})),
|
|
287
|
+
unreviewed: perLocale
|
|
288
|
+
},
|
|
289
|
+
annotations: { readOnlyHint: true }
|
|
290
|
+
}, guarded(async ({ root, drafts }) => {
|
|
291
|
+
const cfg = await config(root);
|
|
292
|
+
const registry = await extractProject(cfg);
|
|
293
|
+
const catalogs = loadCatalogs(cfg);
|
|
294
|
+
const result = check(cfg, catalogs, registry);
|
|
295
|
+
const unreviewed = drafts ? byLocale(effectiveDrafts(loadDrafts(cfg), catalogs)) : [];
|
|
296
|
+
const lines = [];
|
|
297
|
+
if (!result.ok) lines.push(formatCheckResult(result, cfg.root));
|
|
298
|
+
const warnings = formatCheckWarnings(result);
|
|
299
|
+
if (warnings) lines.push(`warnings (the gate still passes):\n${warnings}`);
|
|
300
|
+
for (const { locale, keys } of unreviewed) if (keys.length) lines.push(`[${locale}] ${keys.length} unreviewed: ${keys.join(", ")}`);
|
|
301
|
+
return reply(lines.length === 0 ? "all translations complete" : lines.join("\n"), {
|
|
302
|
+
...result,
|
|
303
|
+
unreviewed
|
|
304
|
+
});
|
|
305
|
+
}));
|
|
231
306
|
server.registerTool("verbaly_translate", {
|
|
232
307
|
title: "Machine-translate missing entries",
|
|
233
308
|
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.",
|
|
@@ -284,6 +359,43 @@ function createVerbalyMcp(options = {}) {
|
|
|
284
359
|
if (data.translated.length > 0) lines.push("drafts await human review: verbaly review (--approve accepts them)");
|
|
285
360
|
return reply(lines.join("\n"), data);
|
|
286
361
|
}));
|
|
362
|
+
server.registerTool("verbaly_drafts", {
|
|
363
|
+
title: "Machine translations awaiting review",
|
|
364
|
+
description: "Every machine translation still waiting for a human, each with the source text and what the provider wrote, so a person can read both and decide. Read-only. Approving is deliberately not a tool here and never will be: a machine translation is unreviewed by definition, so accepting one is `verbaly review --approve`, run by a human.",
|
|
365
|
+
inputSchema: {
|
|
366
|
+
root: rootInput,
|
|
367
|
+
locales: z.array(z.string()).optional().describe("Target locales (default: all)")
|
|
368
|
+
},
|
|
369
|
+
outputSchema: {
|
|
370
|
+
total: z.number(),
|
|
371
|
+
entries: z.array(z.object({
|
|
372
|
+
locale: z.string(),
|
|
373
|
+
key: z.string(),
|
|
374
|
+
source: z.string().describe("What the message says in the source locale"),
|
|
375
|
+
translated: z.string().describe("What the provider wrote, still unreviewed")
|
|
376
|
+
}))
|
|
377
|
+
},
|
|
378
|
+
annotations: { readOnlyHint: true }
|
|
379
|
+
}, guarded(async ({ root, locales }) => {
|
|
380
|
+
const cfg = await config(root);
|
|
381
|
+
const catalogs = loadCatalogs(cfg);
|
|
382
|
+
const source = catalogs[cfg.sourceLocale] ?? {};
|
|
383
|
+
const pending = effectiveDrafts(loadDrafts(cfg), catalogs);
|
|
384
|
+
const wanted = locales ?? cfg.locales;
|
|
385
|
+
const entries = Object.entries(pending).filter(([locale]) => wanted.includes(locale)).flatMap(([locale, keys]) => keys.map((key) => ({
|
|
386
|
+
locale,
|
|
387
|
+
key,
|
|
388
|
+
source: source[key] ?? "",
|
|
389
|
+
translated: catalogs[locale]?.[key] ?? ""
|
|
390
|
+
})));
|
|
391
|
+
const body = entries.length ? entries.map((e) => `[${e.locale}] ${e.key}
|
|
392
|
+
source: ${e.source}
|
|
393
|
+
draft: ${e.translated}`).join("\n") : "nothing awaiting review";
|
|
394
|
+
return reply(body, {
|
|
395
|
+
total: entries.length,
|
|
396
|
+
entries
|
|
397
|
+
});
|
|
398
|
+
}));
|
|
287
399
|
return server;
|
|
288
400
|
}
|
|
289
401
|
//#endregion
|
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, cfg.root));\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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["../src/server.ts","../src/cli.ts"],"sourcesContent":["import { McpServer, ResourceTemplate } 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 init,\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 // resources, not tools: reading the project is an address, and it must not spend a tool call\n server.registerResource(\n 'verbaly-config',\n 'verbaly://config',\n {\n title: 'Project shape',\n description:\n 'The resolved Verbaly config: source locale, every locale, the catalog directory and where the language lives in the url. Read this before reasoning about anything else in the project.',\n mimeType: 'application/json',\n },\n async (uri) => {\n const cfg = await config();\n const shape = {\n root: cfg.root,\n sourceLocale: cfg.sourceLocale,\n locales: cfg.locales,\n localesDeclared: cfg.localesDeclared,\n dir: cfg.dir,\n routing: cfg.routing,\n include: cfg.include,\n };\n return {\n contents: [\n { uri: uri.href, mimeType: 'application/json', text: JSON.stringify(shape, null, 2) },\n ],\n };\n },\n );\n\n server.registerResource(\n 'verbaly-catalog',\n new ResourceTemplate('verbaly://catalog/{locale}', {\n list: async () => {\n const cfg = await config();\n return {\n resources: cfg.locales.map((locale) => ({\n name: `${locale} catalog`,\n uri: `verbaly://catalog/${locale}`,\n mimeType: 'application/json',\n })),\n };\n },\n }),\n {\n title: 'Locale catalog',\n description:\n 'Every message of one locale, keyed the way the runtime sees them: a nested catalog arrives flattened, and an empty value means untranslated. This is the only way to read what a message actually says.',\n mimeType: 'application/json',\n },\n async (uri, { locale }) => {\n const cfg = await config();\n const name = String(locale);\n if (!cfg.locales.includes(name)) {\n const have = cfg.locales.join(', ');\n throw new Error(`[verbaly] unknown locale \"${name}\": the project has ${have}`);\n }\n const catalog = loadCatalogs(cfg)[name] ?? {};\n return {\n contents: [\n { uri: uri.href, mimeType: 'application/json', text: JSON.stringify(catalog, null, 2) },\n ],\n };\n },\n );\n\n server.registerTool(\n 'verbaly_init',\n {\n title: 'Set up Verbaly in a project',\n description:\n 'Create the config file and the locale catalogs, and detect the bundler or meta-framework so the answer names the package to add and the line to wire (what `verbaly init` does). Writes files, and a file already there is kept rather than overwritten. Run this when doctor says there is no config.',\n inputSchema: {\n root: rootInput,\n dir: z.string().optional().describe('Directory for the catalogs (default: locales)'),\n sourceLocale: z.string().optional().describe('The language you write in (default: en)'),\n locales: z.array(z.string()).optional().describe('Every locale, source included'),\n },\n outputSchema: {\n created: z.array(z.string()).describe('Files written, relative to the project root'),\n skipped: z.array(z.string()).describe('Files already there, left untouched'),\n host: z\n .string()\n .optional()\n .describe('Bundler or meta-framework detected from the dependencies'),\n configFile: z.string(),\n next: z.array(z.string()).describe('What a human still has to do, in order'),\n },\n },\n guarded(async ({ root, dir, sourceLocale, locales }) => {\n const result = await init({ root: root ?? options.root, dir, sourceLocale, locales });\n const lines: string[] = [];\n if (result.created.length) lines.push(`created: ${result.created.join(', ')}`);\n if (result.skipped.length) lines.push(`kept (already there): ${result.skipped.join(', ')}`);\n if (result.host) lines.push(`detected: ${result.host}`);\n lines.push(...result.next.map((step, i) => `${i + 1}. ${step}`));\n return reply(lines.join('\\n'), { ...result });\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_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, cfg.root));\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_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 server.registerTool(\n 'verbaly_drafts',\n {\n title: 'Machine translations awaiting review',\n description:\n 'Every machine translation still waiting for a human, each with the source text and what the provider wrote, so a person can read both and decide. Read-only. Approving is deliberately not a tool here and never will be: a machine translation is unreviewed by definition, so accepting one is `verbaly review --approve`, run by a human.',\n inputSchema: {\n root: rootInput,\n locales: z.array(z.string()).optional().describe('Target locales (default: all)'),\n },\n outputSchema: {\n total: z.number(),\n entries: z.array(\n z.object({\n locale: z.string(),\n key: z.string(),\n source: z.string().describe('What the message says in the source locale'),\n translated: z.string().describe('What the provider wrote, still unreviewed'),\n }),\n ),\n },\n annotations: { readOnlyHint: true },\n },\n guarded(async ({ root, locales }) => {\n const cfg = await config(root);\n const catalogs = loadCatalogs(cfg);\n const source = catalogs[cfg.sourceLocale] ?? {};\n const pending = effectiveDrafts(loadDrafts(cfg), catalogs);\n const wanted = locales ?? cfg.locales;\n const entries = Object.entries(pending)\n .filter(([locale]) => wanted.includes(locale))\n .flatMap(([locale, keys]) =>\n keys.map((key) => ({\n locale,\n key,\n source: source[key] ?? '',\n translated: catalogs[locale]?.[key] ?? '',\n })),\n );\n const body = entries.length\n ? entries\n .map((e) => `[${e.locale}] ${e.key}\n source: ${e.source}\n draft: ${e.translated}`)\n .join('\\n')\n : 'nothing awaiting review';\n return reply(body, { total: entries.length, entries });\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"],"mappings":";;;;;;;;AAiCA,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,OAA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import { createRequire } from "node:module";
|
|
2
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
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";
|
|
2
|
+
import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { check, collectOrigins, counted, doctor, effectiveDrafts, extractProject, formatCheckResult, formatCheckWarnings, formatDoctorEntry, formatStatusResult, formatTranslateFailures, init, 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");
|
|
@@ -39,70 +39,80 @@ function createVerbalyMcp(options = {}) {
|
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
|
-
server.
|
|
43
|
-
title: "
|
|
44
|
-
description: "
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
42
|
+
server.registerResource("verbaly-config", "verbaly://config", {
|
|
43
|
+
title: "Project shape",
|
|
44
|
+
description: "The resolved Verbaly config: source locale, every locale, the catalog directory and where the language lives in the url. Read this before reasoning about anything else in the project.",
|
|
45
|
+
mimeType: "application/json"
|
|
46
|
+
}, async (uri) => {
|
|
47
|
+
const cfg = await config();
|
|
48
|
+
const shape = {
|
|
49
|
+
root: cfg.root,
|
|
50
|
+
sourceLocale: cfg.sourceLocale,
|
|
51
|
+
locales: cfg.locales,
|
|
52
|
+
localesDeclared: cfg.localesDeclared,
|
|
53
|
+
dir: cfg.dir,
|
|
54
|
+
routing: cfg.routing,
|
|
55
|
+
include: cfg.include
|
|
56
|
+
};
|
|
57
|
+
return { contents: [{
|
|
58
|
+
uri: uri.href,
|
|
59
|
+
mimeType: "application/json",
|
|
60
|
+
text: JSON.stringify(shape, null, 2)
|
|
61
|
+
}] };
|
|
62
|
+
});
|
|
63
|
+
server.registerResource("verbaly-catalog", new ResourceTemplate("verbaly://catalog/{locale}", { list: async () => {
|
|
64
|
+
return { resources: (await config()).locales.map((locale) => ({
|
|
65
|
+
name: `${locale} catalog`,
|
|
66
|
+
uri: `verbaly://catalog/${locale}`,
|
|
67
|
+
mimeType: "application/json"
|
|
68
|
+
})) };
|
|
69
|
+
} }), {
|
|
70
|
+
title: "Locale catalog",
|
|
71
|
+
description: "Every message of one locale, keyed the way the runtime sees them: a nested catalog arrives flattened, and an empty value means untranslated. This is the only way to read what a message actually says.",
|
|
72
|
+
mimeType: "application/json"
|
|
73
|
+
}, async (uri, { locale }) => {
|
|
74
|
+
const cfg = await config();
|
|
75
|
+
const name = String(locale);
|
|
76
|
+
if (!cfg.locales.includes(name)) {
|
|
77
|
+
const have = cfg.locales.join(", ");
|
|
78
|
+
throw new Error(`[verbaly] unknown locale "${name}": the project has ${have}`);
|
|
79
|
+
}
|
|
80
|
+
const catalog = loadCatalogs(cfg)[name] ?? {};
|
|
81
|
+
return { contents: [{
|
|
82
|
+
uri: uri.href,
|
|
83
|
+
mimeType: "application/json",
|
|
84
|
+
text: JSON.stringify(catalog, null, 2)
|
|
85
|
+
}] };
|
|
86
|
+
});
|
|
87
|
+
server.registerTool("verbaly_init", {
|
|
88
|
+
title: "Set up Verbaly in a project",
|
|
89
|
+
description: "Create the config file and the locale catalogs, and detect the bundler or meta-framework so the answer names the package to add and the line to wire (what `verbaly init` does). Writes files, and a file already there is kept rather than overwritten. Run this when doctor says there is no config.",
|
|
67
90
|
inputSchema: {
|
|
68
91
|
root: rootInput,
|
|
69
|
-
|
|
92
|
+
dir: z.string().optional().describe("Directory for the catalogs (default: locales)"),
|
|
93
|
+
sourceLocale: z.string().optional().describe("The language you write in (default: en)"),
|
|
94
|
+
locales: z.array(z.string()).optional().describe("Every locale, source included")
|
|
70
95
|
},
|
|
71
96
|
outputSchema: {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
key: z.string(),
|
|
85
|
-
severity: z.enum(["error", "warning"]),
|
|
86
|
-
issue: z.string()
|
|
87
|
-
})),
|
|
88
|
-
unreviewed: perLocale
|
|
89
|
-
},
|
|
90
|
-
annotations: { readOnlyHint: true }
|
|
91
|
-
}, guarded(async ({ root, drafts }) => {
|
|
92
|
-
const cfg = await config(root);
|
|
93
|
-
const registry = await extractProject(cfg);
|
|
94
|
-
const catalogs = loadCatalogs(cfg);
|
|
95
|
-
const result = check(cfg, catalogs, registry);
|
|
96
|
-
const unreviewed = drafts ? byLocale(effectiveDrafts(loadDrafts(cfg), catalogs)) : [];
|
|
97
|
-
const lines = [];
|
|
98
|
-
if (!result.ok) lines.push(formatCheckResult(result, cfg.root));
|
|
99
|
-
const warnings = formatCheckWarnings(result);
|
|
100
|
-
if (warnings) lines.push(`warnings (the gate still passes):\n${warnings}`);
|
|
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
|
|
97
|
+
created: z.array(z.string()).describe("Files written, relative to the project root"),
|
|
98
|
+
skipped: z.array(z.string()).describe("Files already there, left untouched"),
|
|
99
|
+
host: z.string().optional().describe("Bundler or meta-framework detected from the dependencies"),
|
|
100
|
+
configFile: z.string(),
|
|
101
|
+
next: z.array(z.string()).describe("What a human still has to do, in order")
|
|
102
|
+
}
|
|
103
|
+
}, guarded(async ({ root, dir, sourceLocale, locales }) => {
|
|
104
|
+
const result = await init({
|
|
105
|
+
root: root ?? options.root,
|
|
106
|
+
dir,
|
|
107
|
+
sourceLocale,
|
|
108
|
+
locales
|
|
105
109
|
});
|
|
110
|
+
const lines = [];
|
|
111
|
+
if (result.created.length) lines.push(`created: ${result.created.join(", ")}`);
|
|
112
|
+
if (result.skipped.length) lines.push(`kept (already there): ${result.skipped.join(", ")}`);
|
|
113
|
+
if (result.host) lines.push(`detected: ${result.host}`);
|
|
114
|
+
lines.push(...result.next.map((step, i) => `${i + 1}. ${step}`));
|
|
115
|
+
return reply(lines.join("\n"), { ...result });
|
|
106
116
|
}));
|
|
107
117
|
server.registerTool("verbaly_doctor", {
|
|
108
118
|
title: "Diagnose the setup",
|
|
@@ -225,6 +235,71 @@ function createVerbalyMcp(options = {}) {
|
|
|
225
235
|
pruned
|
|
226
236
|
});
|
|
227
237
|
}));
|
|
238
|
+
server.registerTool("verbaly_status", {
|
|
239
|
+
title: "Translation coverage",
|
|
240
|
+
description: "Translation coverage of the Verbaly project: total messages, translated count per locale and machine translations awaiting review (drafts). Read-only.",
|
|
241
|
+
inputSchema: { root: rootInput },
|
|
242
|
+
outputSchema: {
|
|
243
|
+
messages: z.number().describe("Messages the project has, source catalog plus code"),
|
|
244
|
+
source: z.string().describe("Source locale"),
|
|
245
|
+
locales: z.array(z.object({
|
|
246
|
+
locale: z.string(),
|
|
247
|
+
translated: z.number(),
|
|
248
|
+
total: z.number(),
|
|
249
|
+
drafts: z.number().describe("Machine translations awaiting human review"),
|
|
250
|
+
broken: z.number().describe("Present but not rendering what the source renders")
|
|
251
|
+
}))
|
|
252
|
+
},
|
|
253
|
+
annotations: { readOnlyHint: true }
|
|
254
|
+
}, guarded(async ({ root }) => {
|
|
255
|
+
const cfg = await config(root);
|
|
256
|
+
const registry = await extractProject(cfg);
|
|
257
|
+
const result = status(cfg, loadCatalogs(cfg), registry, loadDrafts(cfg));
|
|
258
|
+
return reply(formatStatusResult(result), { ...result });
|
|
259
|
+
}));
|
|
260
|
+
server.registerTool("verbaly_missing", {
|
|
261
|
+
title: "Missing and broken translations",
|
|
262
|
+
description: "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.",
|
|
263
|
+
inputSchema: {
|
|
264
|
+
root: rootInput,
|
|
265
|
+
drafts: z.boolean().optional().describe("Also list machine translations awaiting human review")
|
|
266
|
+
},
|
|
267
|
+
outputSchema: {
|
|
268
|
+
ok: z.boolean().describe("Whether `verbaly check` would pass (warnings never fail it)"),
|
|
269
|
+
missing: z.array(z.object({
|
|
270
|
+
locale: z.string(),
|
|
271
|
+
key: z.string(),
|
|
272
|
+
source: z.string().optional()
|
|
273
|
+
})),
|
|
274
|
+
unknown: z.array(z.object({
|
|
275
|
+
key: z.string(),
|
|
276
|
+
files: z.array(z.string())
|
|
277
|
+
})),
|
|
278
|
+
broken: z.array(z.object({
|
|
279
|
+
locale: z.string(),
|
|
280
|
+
key: z.string(),
|
|
281
|
+
severity: z.enum(["error", "warning"]),
|
|
282
|
+
issue: z.string()
|
|
283
|
+
})),
|
|
284
|
+
unreviewed: perLocale
|
|
285
|
+
},
|
|
286
|
+
annotations: { readOnlyHint: true }
|
|
287
|
+
}, guarded(async ({ root, drafts }) => {
|
|
288
|
+
const cfg = await config(root);
|
|
289
|
+
const registry = await extractProject(cfg);
|
|
290
|
+
const catalogs = loadCatalogs(cfg);
|
|
291
|
+
const result = check(cfg, catalogs, registry);
|
|
292
|
+
const unreviewed = drafts ? byLocale(effectiveDrafts(loadDrafts(cfg), catalogs)) : [];
|
|
293
|
+
const lines = [];
|
|
294
|
+
if (!result.ok) lines.push(formatCheckResult(result, cfg.root));
|
|
295
|
+
const warnings = formatCheckWarnings(result);
|
|
296
|
+
if (warnings) lines.push(`warnings (the gate still passes):\n${warnings}`);
|
|
297
|
+
for (const { locale, keys } of unreviewed) if (keys.length) lines.push(`[${locale}] ${keys.length} unreviewed: ${keys.join(", ")}`);
|
|
298
|
+
return reply(lines.length === 0 ? "all translations complete" : lines.join("\n"), {
|
|
299
|
+
...result,
|
|
300
|
+
unreviewed
|
|
301
|
+
});
|
|
302
|
+
}));
|
|
228
303
|
server.registerTool("verbaly_translate", {
|
|
229
304
|
title: "Machine-translate missing entries",
|
|
230
305
|
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.",
|
|
@@ -281,6 +356,43 @@ function createVerbalyMcp(options = {}) {
|
|
|
281
356
|
if (data.translated.length > 0) lines.push("drafts await human review: verbaly review (--approve accepts them)");
|
|
282
357
|
return reply(lines.join("\n"), data);
|
|
283
358
|
}));
|
|
359
|
+
server.registerTool("verbaly_drafts", {
|
|
360
|
+
title: "Machine translations awaiting review",
|
|
361
|
+
description: "Every machine translation still waiting for a human, each with the source text and what the provider wrote, so a person can read both and decide. Read-only. Approving is deliberately not a tool here and never will be: a machine translation is unreviewed by definition, so accepting one is `verbaly review --approve`, run by a human.",
|
|
362
|
+
inputSchema: {
|
|
363
|
+
root: rootInput,
|
|
364
|
+
locales: z.array(z.string()).optional().describe("Target locales (default: all)")
|
|
365
|
+
},
|
|
366
|
+
outputSchema: {
|
|
367
|
+
total: z.number(),
|
|
368
|
+
entries: z.array(z.object({
|
|
369
|
+
locale: z.string(),
|
|
370
|
+
key: z.string(),
|
|
371
|
+
source: z.string().describe("What the message says in the source locale"),
|
|
372
|
+
translated: z.string().describe("What the provider wrote, still unreviewed")
|
|
373
|
+
}))
|
|
374
|
+
},
|
|
375
|
+
annotations: { readOnlyHint: true }
|
|
376
|
+
}, guarded(async ({ root, locales }) => {
|
|
377
|
+
const cfg = await config(root);
|
|
378
|
+
const catalogs = loadCatalogs(cfg);
|
|
379
|
+
const source = catalogs[cfg.sourceLocale] ?? {};
|
|
380
|
+
const pending = effectiveDrafts(loadDrafts(cfg), catalogs);
|
|
381
|
+
const wanted = locales ?? cfg.locales;
|
|
382
|
+
const entries = Object.entries(pending).filter(([locale]) => wanted.includes(locale)).flatMap(([locale, keys]) => keys.map((key) => ({
|
|
383
|
+
locale,
|
|
384
|
+
key,
|
|
385
|
+
source: source[key] ?? "",
|
|
386
|
+
translated: catalogs[locale]?.[key] ?? ""
|
|
387
|
+
})));
|
|
388
|
+
const body = entries.length ? entries.map((e) => `[${e.locale}] ${e.key}
|
|
389
|
+
source: ${e.source}
|
|
390
|
+
draft: ${e.translated}`).join("\n") : "nothing awaiting review";
|
|
391
|
+
return reply(body, {
|
|
392
|
+
total: entries.length,
|
|
393
|
+
entries
|
|
394
|
+
});
|
|
395
|
+
}));
|
|
284
396
|
return server;
|
|
285
397
|
}
|
|
286
398
|
//#endregion
|
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, cfg.root));\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,EA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,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"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/server.ts"],"sourcesContent":["import { McpServer, ResourceTemplate } 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 init,\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 // resources, not tools: reading the project is an address, and it must not spend a tool call\n server.registerResource(\n 'verbaly-config',\n 'verbaly://config',\n {\n title: 'Project shape',\n description:\n 'The resolved Verbaly config: source locale, every locale, the catalog directory and where the language lives in the url. Read this before reasoning about anything else in the project.',\n mimeType: 'application/json',\n },\n async (uri) => {\n const cfg = await config();\n const shape = {\n root: cfg.root,\n sourceLocale: cfg.sourceLocale,\n locales: cfg.locales,\n localesDeclared: cfg.localesDeclared,\n dir: cfg.dir,\n routing: cfg.routing,\n include: cfg.include,\n };\n return {\n contents: [\n { uri: uri.href, mimeType: 'application/json', text: JSON.stringify(shape, null, 2) },\n ],\n };\n },\n );\n\n server.registerResource(\n 'verbaly-catalog',\n new ResourceTemplate('verbaly://catalog/{locale}', {\n list: async () => {\n const cfg = await config();\n return {\n resources: cfg.locales.map((locale) => ({\n name: `${locale} catalog`,\n uri: `verbaly://catalog/${locale}`,\n mimeType: 'application/json',\n })),\n };\n },\n }),\n {\n title: 'Locale catalog',\n description:\n 'Every message of one locale, keyed the way the runtime sees them: a nested catalog arrives flattened, and an empty value means untranslated. This is the only way to read what a message actually says.',\n mimeType: 'application/json',\n },\n async (uri, { locale }) => {\n const cfg = await config();\n const name = String(locale);\n if (!cfg.locales.includes(name)) {\n const have = cfg.locales.join(', ');\n throw new Error(`[verbaly] unknown locale \"${name}\": the project has ${have}`);\n }\n const catalog = loadCatalogs(cfg)[name] ?? {};\n return {\n contents: [\n { uri: uri.href, mimeType: 'application/json', text: JSON.stringify(catalog, null, 2) },\n ],\n };\n },\n );\n\n server.registerTool(\n 'verbaly_init',\n {\n title: 'Set up Verbaly in a project',\n description:\n 'Create the config file and the locale catalogs, and detect the bundler or meta-framework so the answer names the package to add and the line to wire (what `verbaly init` does). Writes files, and a file already there is kept rather than overwritten. Run this when doctor says there is no config.',\n inputSchema: {\n root: rootInput,\n dir: z.string().optional().describe('Directory for the catalogs (default: locales)'),\n sourceLocale: z.string().optional().describe('The language you write in (default: en)'),\n locales: z.array(z.string()).optional().describe('Every locale, source included'),\n },\n outputSchema: {\n created: z.array(z.string()).describe('Files written, relative to the project root'),\n skipped: z.array(z.string()).describe('Files already there, left untouched'),\n host: z\n .string()\n .optional()\n .describe('Bundler or meta-framework detected from the dependencies'),\n configFile: z.string(),\n next: z.array(z.string()).describe('What a human still has to do, in order'),\n },\n },\n guarded(async ({ root, dir, sourceLocale, locales }) => {\n const result = await init({ root: root ?? options.root, dir, sourceLocale, locales });\n const lines: string[] = [];\n if (result.created.length) lines.push(`created: ${result.created.join(', ')}`);\n if (result.skipped.length) lines.push(`kept (already there): ${result.skipped.join(', ')}`);\n if (result.host) lines.push(`detected: ${result.host}`);\n lines.push(...result.next.map((step, i) => `${i + 1}. ${step}`));\n return reply(lines.join('\\n'), { ...result });\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_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, cfg.root));\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_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 server.registerTool(\n 'verbaly_drafts',\n {\n title: 'Machine translations awaiting review',\n description:\n 'Every machine translation still waiting for a human, each with the source text and what the provider wrote, so a person can read both and decide. Read-only. Approving is deliberately not a tool here and never will be: a machine translation is unreviewed by definition, so accepting one is `verbaly review --approve`, run by a human.',\n inputSchema: {\n root: rootInput,\n locales: z.array(z.string()).optional().describe('Target locales (default: all)'),\n },\n outputSchema: {\n total: z.number(),\n entries: z.array(\n z.object({\n locale: z.string(),\n key: z.string(),\n source: z.string().describe('What the message says in the source locale'),\n translated: z.string().describe('What the provider wrote, still unreviewed'),\n }),\n ),\n },\n annotations: { readOnlyHint: true },\n },\n guarded(async ({ root, locales }) => {\n const cfg = await config(root);\n const catalogs = loadCatalogs(cfg);\n const source = catalogs[cfg.sourceLocale] ?? {};\n const pending = effectiveDrafts(loadDrafts(cfg), catalogs);\n const wanted = locales ?? cfg.locales;\n const entries = Object.entries(pending)\n .filter(([locale]) => wanted.includes(locale))\n .flatMap(([locale, keys]) =>\n keys.map((key) => ({\n locale,\n key,\n source: source[key] ?? '',\n translated: catalogs[locale]?.[key] ?? '',\n })),\n );\n const body = entries.length\n ? entries\n .map((e) => `[${e.locale}] ${e.key}\n source: ${e.source}\n draft: ${e.translated}`)\n .join('\\n')\n : 'nothing awaiting review';\n return reply(body, { total: entries.length, entries });\n }),\n );\n\n\n return server;\n}\n"],"mappings":";;;;;AAiCA,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,O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E,OAAO;GAChB,SAAS,EAAE,MACT,EAAE,OAAO;IACP,QAAQ,EAAE,OAAO;IACjB,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS,4CAA4C;IACxE,YAAY,EAAE,OAAO,CAAC,CAAC,SAAS,2CAA2C;GAC7E,CAAC,CACH;EACF;EACA,aAAa,EAAE,cAAc,KAAK;CACpC,GACA,QAAQ,OAAO,EAAE,MAAM,cAAc;EACnC,MAAM,MAAM,MAAM,OAAO,IAAI;EAC7B,MAAM,WAAW,aAAa,GAAG;EACjC,MAAM,SAAS,SAAS,IAAI,iBAAiB,CAAC;EAC9C,MAAM,UAAU,gBAAgB,WAAW,GAAG,GAAG,QAAQ;EACzD,MAAM,SAAS,WAAW,IAAI;EAC9B,MAAM,UAAU,OAAO,QAAQ,OAAO,CAAC,CACpC,QAAQ,CAAC,YAAY,OAAO,SAAS,MAAM,CAAC,CAAC,CAC7C,SAAS,CAAC,QAAQ,UACjB,KAAK,KAAK,SAAS;GACjB;GACA;GACA,QAAQ,OAAO,QAAQ;GACvB,YAAY,SAAS,OAAO,GAAG,QAAQ;EACzC,EAAE,CACJ;EACF,MAAM,OAAO,QAAQ,SACjB,QACG,KAAK,MAAM,IAAI,EAAE,OAAO,IAAI,EAAE,IAAI;YACnC,EAAE,OAAO;YACT,EAAE,YAAY,CAAC,CACd,KAAK,IAAI,IACZ;EACJ,OAAO,MAAM,MAAM;GAAE,OAAO,QAAQ;GAAQ;EAAQ,CAAC;CACvD,CAAC,CACH;CAGA,OAAO;AACT"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verbaly/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.49.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",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
47
47
|
"zod": "^4.5.4",
|
|
48
|
-
"@verbaly/compiler": "^0.
|
|
48
|
+
"@verbaly/compiler": "^0.49.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/node": "^26.4.1"
|