@langlink/l10n-mcp 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -13,68 +13,88 @@ import { homedir } from "node:os";
13
13
  import { dirname, join } from "node:path";
14
14
  var SERVER_NAME = "langlink";
15
15
  var PACKAGE = "@langlink/l10n-mcp";
16
- function stdio(name) {
17
- return { command: "npx", args: ["-y", PACKAGE] };
16
+ function packageSpec(updateMode, version) {
17
+ if (updateMode === "pinned") {
18
+ if (!version) throw new Error("--pinned requires an exact version, e.g. --pinned 0.1.1");
19
+ if (!/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u.test(version)) throw new Error("--pinned version must be exact SemVer");
20
+ return `${PACKAGE}@${version}`;
21
+ }
22
+ return `${PACKAGE}@latest`;
23
+ }
24
+ function stdio(updateMode, version) {
25
+ return { command: "npx", args: ["-y", packageSpec(updateMode, version)] };
26
+ }
27
+ function updateNote(updateMode) {
28
+ return updateMode === "latest" ? "Uses @latest: each new MCP process can pick up the latest release; pin with --pinned <version> for reproducibility." : "Uses an exact pinned version; update by changing the version in the config.";
18
29
  }
19
30
  function json(value) {
20
31
  return `${JSON.stringify(value, null, 2)}
21
32
  `;
22
33
  }
23
- function clientRecipe(client, home = homedir()) {
34
+ function clientRecipe(client, home = homedir(), updateMode = "latest", version) {
35
+ const withUpdate = { updateMode };
24
36
  switch (client) {
25
37
  case "codex":
26
38
  return {
39
+ ...withUpdate,
27
40
  client,
28
41
  path: join(home, ".codex/config.toml"),
29
42
  format: "toml",
30
43
  content: `[mcp_servers.${SERVER_NAME}]
31
44
  command = "npx"
32
- args = ["-y", "${PACKAGE}"]
45
+ args = ["-y", "${packageSpec(updateMode, version)}"]
33
46
  startup_timeout_sec = 30
34
47
  tool_timeout_sec = 120
35
48
  `,
36
49
  notes: [
37
50
  "Codex CLI reads this from ~/.codex/config.toml.",
38
- "Equivalent command: codex mcp add langlink -- npx -y @langlink/l10n-mcp"
51
+ `Equivalent command: codex mcp add langlink -- npx -y ${packageSpec(updateMode, version)}`,
52
+ updateNote(updateMode)
39
53
  ]
40
54
  };
41
55
  case "workbuddy":
42
56
  return {
57
+ ...withUpdate,
43
58
  client,
44
59
  path: join(home, ".workbuddy/mcp.json"),
45
60
  format: "json",
46
- content: json({ mcpServers: { [SERVER_NAME]: stdio(SERVER_NAME) } }),
47
- notes: ["WorkBuddy also exposes MCP configuration in its UI."]
61
+ content: json({ mcpServers: { [SERVER_NAME]: stdio(updateMode, version) } }),
62
+ notes: ["WorkBuddy also exposes MCP configuration in its UI.", updateNote(updateMode)]
48
63
  };
49
64
  case "zcode":
50
65
  return {
66
+ ...withUpdate,
51
67
  client,
52
68
  path: join(home, ".zcode/cli/config.json"),
53
69
  format: "json",
54
- content: json({ mcp: { servers: { [SERVER_NAME]: { ...stdio(SERVER_NAME), env: {} } } } }),
70
+ content: json({ mcp: { servers: { [SERVER_NAME]: { ...stdio(updateMode, version), env: {} } } } }),
55
71
  notes: [
56
72
  "ZCode user config is ~/.zcode/cli/config.json with mcp.servers.",
57
- "Alternatively merge the generic mcpServers shape into ~/.agents/mcp.json."
73
+ "Alternatively merge the generic mcpServers shape into ~/.agents/mcp.json.",
74
+ updateNote(updateMode)
58
75
  ]
59
76
  };
60
77
  case "trae":
61
78
  return {
79
+ ...withUpdate,
62
80
  client,
63
81
  path: null,
64
82
  format: "json",
65
- content: json({ mcpServers: { [SERVER_NAME]: stdio(SERVER_NAME) } }),
83
+ content: json({ mcpServers: { [SERVER_NAME]: stdio(updateMode, version) } }),
66
84
  notes: [
67
85
  "Trae manages MCP servers through its MCP settings UI; paste the JSON snippet there.",
68
- "No stable user-level config path was verified, so this command never writes Trae config."
86
+ "No stable user-level config path was verified, so this command never writes Trae config.",
87
+ updateNote(updateMode)
69
88
  ]
70
89
  };
71
90
  case "agents":
72
91
  return {
92
+ ...withUpdate,
73
93
  client,
74
94
  path: join(home, ".agents/mcp.json"),
75
95
  format: "json",
76
- content: json({ mcpServers: { [SERVER_NAME]: stdio(SERVER_NAME) } }),
77
- notes: ["Shared ~/.agents/mcp.json convention; ZCode can import this file."]
96
+ content: json({ mcpServers: { [SERVER_NAME]: stdio(updateMode, version) } }),
97
+ notes: ["Shared ~/.agents/mcp.json convention; ZCode can import this file.", updateNote(updateMode)]
78
98
  };
79
99
  }
80
100
  }
@@ -2651,7 +2671,13 @@ async function runConfigCommand(args) {
2651
2671
  if (clients.length === 0) {
2652
2672
  throw new Error("--client must be one of codex, workbuddy, zcode, trae, agents, all");
2653
2673
  }
2654
- const recipes = clients.map((client) => clientRecipe(client, home));
2674
+ const pinnedIndex = args.indexOf("--pinned");
2675
+ const pinnedVersion = pinnedIndex >= 0 ? args[pinnedIndex + 1] : void 0;
2676
+ const updateMode = pinnedIndex >= 0 ? "pinned" : "latest";
2677
+ if (updateMode === "pinned" && !pinnedVersion) {
2678
+ throw new Error("--pinned requires an exact version, e.g. --pinned 0.1.1");
2679
+ }
2680
+ const recipes = clients.map((client) => clientRecipe(client, home, updateMode, pinnedVersion));
2655
2681
  if (write) {
2656
2682
  const results = [];
2657
2683
  for (const recipe of recipes) results.push(await writeRecipe(recipe));
@@ -2681,7 +2707,7 @@ async function main() {
2681
2707
  return;
2682
2708
  }
2683
2709
  if (command === "--help" || command === "-h") {
2684
- console.log("Usage: langlink-l10n-mcp [config [--client codex|workbuddy|zcode|trae|agents|all] [--write] [--json] [--home DIR]]");
2710
+ console.log("Usage: langlink-l10n-mcp [config [--client codex|workbuddy|zcode|trae|agents|all] [--write] [--json] [--home DIR] [--pinned <exact-version>]]");
2685
2711
  return;
2686
2712
  }
2687
2713
  const server = createL10nMcpServer({