@icebreakers/monorepo 5.1.0 → 5.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs CHANGED
@@ -1,14 +1,15 @@
1
- import { d as logger, g as fs, r as cliName, t as initToolingTargets, u as version } from "./types-S6igCe0w.mjs";
1
+ import { d as localize, f as message, m as logger, p as supportedLocales, r as cliName, t as initToolingTargets, u as version, y as fs } from "./types-BS9l6MOk.mjs";
2
2
  import path from "pathe";
3
3
  import process from "node:process";
4
+ import path$1 from "node:path";
4
5
  import os from "node:os";
5
6
  import pc from "picocolors";
6
- import { Command } from "commander";
7
+ import { Command, Option } from "commander";
7
8
  //#region src/cli/commands/ai.ts
8
9
  async function handleAiPromptCreate(cwd, opts) {
9
10
  const [{ input }, { createTimestampFolderName, defaultAgenticBaseDir, generateAgenticTemplate, generateAgenticTemplates, loadAgenticTasks }, { resolveCommandConfig }] = await Promise.all([
10
11
  import("@icebreakers/monorepo-templates"),
11
- import("./commands-BD9u8I6D.mjs").then((n) => n.t),
12
+ import("./commands-BqUFCJA_.mjs").then((n) => n.t),
12
13
  import("./config-p842Knhq.mjs").then((n) => n.n)
13
14
  ]);
14
15
  const aiConfig = await resolveCommandConfig("ai", cwd);
@@ -19,7 +20,7 @@ async function handleAiPromptCreate(cwd, opts) {
19
20
  const tasksFile = opts.tasks ?? aiConfig?.tasksFile;
20
21
  const templateName = opts.name;
21
22
  if (Boolean(tasksFile && !opts.output && !opts.name)) {
22
- if (!tasksFile) throw new Error("tasks file path is required when using tasks mode");
23
+ if (!tasksFile) throw new Error(localize("A tasks file path is required when using tasks mode.", "使用 tasks 模式时必须提供任务文件路径。"));
23
24
  await generateAgenticTemplates(await loadAgenticTasks(tasksFile, cwd), {
24
25
  cwd,
25
26
  baseDir,
@@ -32,7 +33,7 @@ async function handleAiPromptCreate(cwd, opts) {
32
33
  if (!output && !templateName) {
33
34
  const generated = createTimestampFolderName();
34
35
  folderName = ((await input({
35
- message: "提示词将写入哪个文件夹?(可回车确认或自定义)",
36
+ message: localize("Which folder should contain the prompt?", "提示词将写入哪个文件夹?(可回车确认或自定义)"),
36
37
  default: generated
37
38
  }))?.trim?.() ?? generated) || generated;
38
39
  }
@@ -48,7 +49,7 @@ async function handleAiPromptCreate(cwd, opts) {
48
49
  await generateAgenticTemplate(templateOptions);
49
50
  }
50
51
  function registerAiCommands(program, cwd) {
51
- program.command("ai").description("AI 助手工具集").command("prompt").alias("p").description("Prompt 模板命令").command("create").alias("new").description("生成 Agentic 任务提示词模板").option("-o, --output <path>", "输出到指定文件").option("-f, --force", "允许覆盖已存在文件").option("--format <md|json>", "模板格式,默认 md").option("-d, --dir <path>", "默认输出目录(默认 agentic/prompts,下级自动创建时间文件夹),配合 --name / --tasks 使用").option("-n, --name <name>", "使用名称快速生成文件,自动添加后缀").option("-t, --tasks <file>", "从 JSON 数组批量生成模板").action(async (opts) => {
52
+ program.command("ai").description(localize("AI assistant commands", "AI 助手工具集")).command("prompt").alias("p").description(localize("Prompt template commands", "Prompt 模板命令")).command("create").alias("new").description(localize("Generate an agentic task prompt template", "生成 Agentic 任务提示词模板")).option("-o, --output <path>", localize("Write to a specific file", "输出到指定文件")).option("-f, --force", localize("Overwrite an existing file", "允许覆盖已存在文件")).option("--format <md|json>", localize("Template format; defaults to md", "模板格式,默认 md")).option("-d, --dir <path>", localize("Base output directory used with --name or --tasks", "默认输出目录(默认 agentic/prompts,下级自动创建时间文件夹),配合 --name / --tasks 使用")).option("-n, --name <name>", localize("Generate a named file with the correct extension", "使用名称快速生成文件,自动添加后缀")).option("-t, --tasks <file>", localize("Generate templates from a JSON task array", "从 JSON 数组批量生成模板")).action(async (opts) => {
52
53
  await handleAiPromptCreate(cwd, opts);
53
54
  });
54
55
  }
@@ -58,16 +59,16 @@ function formatConfigInspection(inspection) {
58
59
  const commandKeys = Object.keys(inspection.config.commands ?? {});
59
60
  const toolingKeys = Object.keys(inspection.config.tooling ?? {});
60
61
  return [
61
- `cwd: ${inspection.cwd}`,
62
- `file: ${inspection.file ?? "-"}`,
63
- `commands: ${commandKeys.length > 0 ? commandKeys.join(", ") : "-"}`,
64
- `tooling: ${toolingKeys.length > 0 ? toolingKeys.join(", ") : "-"}`
62
+ localize(`cwd: ${inspection.cwd}`, `当前目录:${inspection.cwd}`),
63
+ localize(`file: ${inspection.file ?? "-"}`, `文件:${inspection.file ?? "-"}`),
64
+ localize(`commands: ${commandKeys.length > 0 ? commandKeys.join(", ") : "-"}`, `命令:${commandKeys.length > 0 ? commandKeys.join(", ") : "-"}`),
65
+ localize(`tooling: ${toolingKeys.length > 0 ? toolingKeys.join(", ") : "-"}`, `Tooling:${toolingKeys.length > 0 ? toolingKeys.join(", ") : "-"}`)
65
66
  ].join("\n");
66
67
  }
67
68
  function formatMarkdownTable$5(rows) {
68
69
  const formatCell = (value) => String(value ?? "-").split("|").join("\\|").split("\n").join("<br>");
69
70
  return [
70
- "| Field | Value |",
71
+ localize("| Field | Value |", "| 字段 | 值 |"),
71
72
  "| --- | --- |",
72
73
  ...rows.map(([label, value]) => `| ${label} | ${formatCell(value)} |`)
73
74
  ].join("\n");
@@ -76,7 +77,7 @@ function formatConfigInspectionMarkdown(inspection) {
76
77
  const commandKeys = Object.keys(inspection.config.commands ?? {});
77
78
  const toolingKeys = Object.keys(inspection.config.tooling ?? {});
78
79
  return [
79
- "# Repo config inspection",
80
+ localize("# Repo config inspection", "# Repo 配置检查"),
80
81
  "",
81
82
  formatMarkdownTable$5([
82
83
  ["cwd", inspection.cwd],
@@ -85,11 +86,11 @@ function formatConfigInspectionMarkdown(inspection) {
85
86
  ["tooling", toolingKeys.length]
86
87
  ]),
87
88
  "",
88
- "## Commands",
89
+ localize("## Commands", "## 命令"),
89
90
  "",
90
91
  ...commandKeys.length > 0 ? commandKeys.map((key) => `- ${key}`) : ["- -"],
91
92
  "",
92
- "## Tooling",
93
+ localize("## Tooling", "## Tooling 配置"),
93
94
  "",
94
95
  ...toolingKeys.length > 0 ? toolingKeys.map((key) => `- ${key}`) : ["- -"]
95
96
  ].join("\n");
@@ -119,11 +120,11 @@ async function emitConfigInspection(inspection, opts, cwd) {
119
120
  }
120
121
  const outFile = path.resolve(cwd, opts.out);
121
122
  await fs.outputFile(outFile, `${content}\n`, "utf8");
122
- logger.success(`wrote ${path.relative(cwd, outFile)}`);
123
+ logger.success(localize(`Wrote ${path.relative(cwd, outFile)}`, `已写入 ${path.relative(cwd, outFile)}`));
123
124
  }
124
125
  function registerConfigCommands(program, cwd) {
125
- program.command("config").alias("cfg").description("配置命令").command("inspect").description("输出当前 repoctl 配置文件和已解析配置").alias("i").option("--json", "输出 JSON,方便脚本消费").option("--markdown", "输出 Markdown,方便粘贴到 issue 或 PR").option("--out <file>", "把当前输出写入文件").option("--redact", "脱敏 cwd/configDir/home 绝对路径后再输出").action(async (opts) => {
126
- const { inspectMonorepoConfig } = await import("./commands-BD9u8I6D.mjs").then((n) => n.t);
126
+ program.command("config").alias("cfg").description(localize("Configuration commands", "配置命令")).command("inspect").description(localize("Show the active repoctl config file and resolved configuration", "输出当前 repoctl 配置文件和已解析配置")).alias("i").option("--json", localize("Output JSON for scripts", "输出 JSON,方便脚本消费")).option("--markdown", localize("Output Markdown", "输出 Markdown,方便粘贴到 issue 或 PR")).option("--out <file>", localize("Write output to a file", "把当前输出写入文件")).option("--redact", localize("Redact cwd, configDir, and home paths", "脱敏 cwd/configDir/home 绝对路径后再输出")).action(async (opts) => {
127
+ const { inspectMonorepoConfig } = await import("./commands-BqUFCJA_.mjs").then((n) => n.t);
127
128
  await emitConfigInspection(await inspectMonorepoConfig(cwd), opts, cwd);
128
129
  });
129
130
  }
@@ -132,7 +133,7 @@ function registerConfigCommands(program, cwd) {
132
133
  function formatMarkdownTable$4(rows) {
133
134
  const formatCell = (value) => String(value ?? "-").split("|").join("\\|").split("\n").join("<br>");
134
135
  return [
135
- "| Field | Value |",
136
+ localize("| Field | Value |", "| 字段 | 值 |"),
136
137
  "| --- | --- |",
137
138
  ...rows.map(([label, value]) => `| ${label} | ${formatCell(value)} |`)
138
139
  ].join("\n");
@@ -150,7 +151,7 @@ function formatEnvInfo$1(info) {
150
151
  }
151
152
  function formatEnvInfoMarkdown(info) {
152
153
  return [
153
- "# Repo environment",
154
+ localize("# Repo environment", "# Repo 环境"),
154
155
  "",
155
156
  formatMarkdownTable$4([
156
157
  ["cwd", info.cwd],
@@ -164,7 +165,7 @@ function formatEnvInfoMarkdown(info) {
164
165
  ].join("\n");
165
166
  }
166
167
  function formatEnvPathEntry(label, entry) {
167
- return `${label}: ${entry.relativePath} (${entry.exists ? "exists" : "missing"})`;
168
+ return localize(`${label}: ${entry.relativePath} (${entry.exists ? "exists" : "missing"})`, `${label}:${entry.relativePath}(${entry.exists ? "存在" : "缺失"})`);
168
169
  }
169
170
  function formatEnvPaths(paths) {
170
171
  return [
@@ -185,15 +186,15 @@ function formatEnvPaths(paths) {
185
186
  }
186
187
  function formatEnvPathsMarkdown(paths) {
187
188
  return [
188
- "# Repo paths",
189
+ localize("# Repo paths", "# Repo 路径"),
189
190
  "",
190
191
  formatMarkdownTable$4([["cwd", paths.cwd], ["workspace", paths.workspaceDir]]),
191
192
  "",
192
- "## Files",
193
+ localize("## Files", "## 文件"),
193
194
  "",
194
- "| Path | Relative path | Status |",
195
+ localize("| Path | Relative path | Status |", "| 路径 | 相对路径 | 状态 |"),
195
196
  "| --- | --- | --- |",
196
- ...Object.entries(paths.paths).flatMap(([label, value]) => Array.isArray(value) ? value.map((entry) => [label, entry]) : [[label, value]]).map(([label, entry]) => `| ${label} | ${entry.relativePath} | ${entry.exists ? "exists" : "missing"} |`)
197
+ ...Object.entries(paths.paths).flatMap(([label, value]) => Array.isArray(value) ? value.map((entry) => [label, entry]) : [[label, value]]).map(([label, entry]) => `| ${label} | ${entry.relativePath} | ${entry.exists ? localize("exists", "存在") : localize("missing", "缺失")} |`)
197
198
  ].join("\n");
198
199
  }
199
200
  function formatEnvSnapshot(snapshot) {
@@ -210,11 +211,11 @@ function formatEnvSnapshot(snapshot) {
210
211
  function formatEnvSnapshotMarkdown(snapshot) {
211
212
  const warningsAndFailures = snapshot.doctor.checks.filter((check) => check.status !== "pass");
212
213
  return [
213
- "# Repo environment snapshot",
214
+ localize("# Repo environment snapshot", "# Repo 环境快照"),
214
215
  "",
215
- `Generated at: ${snapshot.generatedAt}`,
216
+ localize(`Generated at: ${snapshot.generatedAt}`, `生成时间:${snapshot.generatedAt}`),
216
217
  "",
217
- "## Environment",
218
+ localize("## Environment", "## 环境"),
218
219
  "",
219
220
  formatMarkdownTable$4([
220
221
  ["cwd", snapshot.env.cwd],
@@ -226,7 +227,7 @@ function formatEnvSnapshotMarkdown(snapshot) {
226
227
  ["platform", `${snapshot.env.platform}/${snapshot.env.arch}`]
227
228
  ]),
228
229
  "",
229
- "## Diagnostics",
230
+ localize("## Diagnostics", "## 诊断"),
230
231
  "",
231
232
  formatMarkdownTable$4([
232
233
  ["doctor pass", snapshot.doctor.summary.pass],
@@ -236,12 +237,12 @@ function formatEnvSnapshotMarkdown(snapshot) {
236
237
  ]),
237
238
  "",
238
239
  ...warningsAndFailures.length > 0 ? [
239
- "## Doctor findings",
240
+ localize("## Doctor findings", "## Doctor 问题"),
240
241
  "",
241
- ...warningsAndFailures.map((check) => `- ${check.status}: ${check.title}${check.fix ? ` (fix: ${check.fix})` : ""}`),
242
+ ...warningsAndFailures.map((check) => localize(`- ${check.status}: ${check.title}${check.fix ? ` (fix: ${check.fix})` : ""}`, `- ${check.status}: ${check.title}${check.fix ? `(修复:${check.fix})` : ""}`)),
242
243
  ""
243
244
  ] : [],
244
- "## Check plan",
245
+ localize("## Check plan", "## 检查计划"),
245
246
  "",
246
247
  ...snapshot.checkPlan.commands.map((command) => `- \`${command.command}\` - ${command.description}`)
247
248
  ].join("\n");
@@ -321,7 +322,7 @@ function formatEnvSupportBundle(bundle) {
321
322
  function formatMarkdownTable$3(rows) {
322
323
  const formatCell = (value) => String(value ?? "-").split("|").join("\\|").split("\n").join("<br>");
323
324
  return [
324
- "| Field | Value |",
325
+ localize("| Field | Value |", "| 字段 | 值 |"),
325
326
  "| --- | --- |",
326
327
  ...rows.map(([label, value]) => `| ${label} | ${formatCell(value)} |`)
327
328
  ].join("\n");
@@ -329,11 +330,11 @@ function formatMarkdownTable$3(rows) {
329
330
  function formatSupportBundleMarkdown(bundle) {
330
331
  const warningsAndFailures = bundle.doctor.checks.filter((check) => check.status !== "pass");
331
332
  return [
332
- "# Repo support bundle",
333
+ localize("# Repo support bundle", "# Repo 支持信息包"),
333
334
  "",
334
- `Generated at: ${bundle.generatedAt}`,
335
+ localize(`Generated at: ${bundle.generatedAt}`, `生成时间:${bundle.generatedAt}`),
335
336
  "",
336
- "## Environment",
337
+ localize("## Environment", "## 环境"),
337
338
  "",
338
339
  formatMarkdownTable$3([
339
340
  ["cwd", bundle.env.cwd],
@@ -345,7 +346,7 @@ function formatSupportBundleMarkdown(bundle) {
345
346
  ["platform", `${bundle.env.platform}/${bundle.env.arch}`]
346
347
  ]),
347
348
  "",
348
- "## Diagnostics",
349
+ localize("## Diagnostics", "## 诊断"),
349
350
  "",
350
351
  formatMarkdownTable$3([
351
352
  ["doctor pass", bundle.doctor.summary.pass],
@@ -356,16 +357,16 @@ function formatSupportBundleMarkdown(bundle) {
356
357
  ]),
357
358
  "",
358
359
  ...warningsAndFailures.length > 0 ? [
359
- "## Doctor findings",
360
+ localize("## Doctor findings", "## Doctor 问题"),
360
361
  "",
361
- ...warningsAndFailures.map((check) => `- ${check.status}: ${check.title}${check.fix ? ` (fix: ${check.fix})` : ""}`),
362
+ ...warningsAndFailures.map((check) => localize(`- ${check.status}: ${check.title}${check.fix ? ` (fix: ${check.fix})` : ""}`, `- ${check.status}: ${check.title}${check.fix ? `(修复:${check.fix})` : ""}`)),
362
363
  ""
363
364
  ] : [],
364
- "## Check plan",
365
+ localize("## Check plan", "## 检查计划"),
365
366
  "",
366
367
  ...bundle.checkPlan.commands.map((command) => `- \`${command.command}\` - ${command.description}`),
367
368
  "",
368
- "## Report paths",
369
+ localize("## Report paths", "## 报告路径"),
369
370
  "",
370
371
  formatMarkdownTable$3([
371
372
  ["doctor", bundle.paths.paths.doctorReport.relativePath],
@@ -408,7 +409,7 @@ async function emitEnvInfo(info, opts, cwd) {
408
409
  }
409
410
  const outFile = path.resolve(cwd, opts.out);
410
411
  await fs.outputFile(outFile, `${content}\n`, "utf8");
411
- logger.success(`wrote ${path.relative(cwd, outFile)}`);
412
+ logger.success(localize(`Wrote ${path.relative(cwd, outFile)}`, `已写入 ${path.relative(cwd, outFile)}`));
412
413
  }
413
414
  async function emitEnvPaths(paths, opts, cwd) {
414
415
  const content = createEnvPathsOutput(paths, opts);
@@ -418,7 +419,7 @@ async function emitEnvPaths(paths, opts, cwd) {
418
419
  }
419
420
  const outFile = path.resolve(cwd, opts.out);
420
421
  await fs.outputFile(outFile, `${content}\n`, "utf8");
421
- logger.success(`wrote ${path.relative(cwd, outFile)}`);
422
+ logger.success(localize(`Wrote ${path.relative(cwd, outFile)}`, `已写入 ${path.relative(cwd, outFile)}`));
422
423
  }
423
424
  async function emitEnvSnapshot(snapshot, opts, cwd) {
424
425
  const content = createEnvSnapshotOutput(snapshot, opts);
@@ -426,7 +427,7 @@ async function emitEnvSnapshot(snapshot, opts, cwd) {
426
427
  else {
427
428
  const outFile = path.resolve(cwd, opts.out);
428
429
  await fs.outputFile(outFile, `${content}\n`, "utf8");
429
- logger.success(`wrote ${path.relative(cwd, outFile)}`);
430
+ logger.success(localize(`Wrote ${path.relative(cwd, outFile)}`, `已写入 ${path.relative(cwd, outFile)}`));
430
431
  }
431
432
  if (opts.strict && hasStrictEnvSnapshotIssues(snapshot)) process.exitCode = 1;
432
433
  }
@@ -436,39 +437,39 @@ async function emitEnvSupportBundle(bundle, opts, cwd) {
436
437
  else {
437
438
  const outFile = path.resolve(cwd, opts.out);
438
439
  await fs.outputFile(outFile, `${content}\n`, "utf8");
439
- logger.success(`wrote ${path.relative(cwd, outFile)}`);
440
+ logger.success(localize(`Wrote ${path.relative(cwd, outFile)}`, `已写入 ${path.relative(cwd, outFile)}`));
440
441
  }
441
442
  if (opts.strict && hasStrictSupportBundleIssues(bundle)) process.exitCode = 1;
442
443
  }
443
444
  function registerEnvCommands(program, cwd) {
444
- const envCommand = program.command("env").alias("e").description("环境命令");
445
- envCommand.command("info").description("输出当前仓库环境信息").alias("i").option("--json", "输出 JSON,方便脚本消费").option("--markdown", "输出 Markdown,方便粘贴到 issue 或 PR").option("--out <file>", "把当前输出写入文件").option("--redact", "脱敏 workspace/cwd/home 绝对路径后再输出").action(async (opts) => {
446
- const { collectEnvInfo } = await import("./commands-BD9u8I6D.mjs").then((n) => n.t);
445
+ const envCommand = program.command("env").alias("e").description(localize("Environment and support commands", "环境命令"));
446
+ envCommand.command("info").description(localize("Show environment information for the current repository", "输出当前仓库环境信息")).alias("i").option("--json", localize("Output JSON for scripts", "输出 JSON,方便脚本消费")).option("--markdown", localize("Output Markdown", "输出 Markdown,方便粘贴到 issue 或 PR")).option("--out <file>", localize("Write output to a file", "把当前输出写入文件")).option("--redact", localize("Redact workspace, cwd, and home paths", "脱敏 workspace/cwd/home 绝对路径后再输出")).action(async (opts) => {
447
+ const { collectEnvInfo } = await import("./commands-BqUFCJA_.mjs").then((n) => n.t);
447
448
  await emitEnvInfo(await collectEnvInfo(cwd), opts, cwd);
448
449
  });
449
- envCommand.command("snapshot").description("输出排障快照,包含环境、doctor 和 check 计划").alias("s").option("--json", "输出 JSON,方便脚本消费").option("--markdown", "输出 Markdown,方便粘贴到 issue 或 PR").option("--out <file>", "把当前输出写入文件").option("--redact", "脱敏 workspace/cwd/home 绝对路径后再输出").option("--strict", "输出快照后,如果 doctor 有 fail 或 warn 则返回失败码").action(async (opts) => {
450
- const { collectEnvSnapshot } = await import("./commands-BD9u8I6D.mjs").then((n) => n.t);
450
+ envCommand.command("snapshot").description(localize("Create a support snapshot with environment, doctor, and check data", "输出排障快照,包含环境、doctor 和 check 计划")).alias("s").option("--json", localize("Output JSON for scripts", "输出 JSON,方便脚本消费")).option("--markdown", localize("Output Markdown", "输出 Markdown,方便粘贴到 issue 或 PR")).option("--out <file>", localize("Write output to a file", "把当前输出写入文件")).option("--redact", localize("Redact workspace, cwd, and home paths", "脱敏 workspace/cwd/home 绝对路径后再输出")).option("--strict", localize("Fail when doctor reports a failure or warning", "输出快照后,如果 doctor 有 fail 或 warn 则返回失败码")).action(async (opts) => {
451
+ const { collectEnvSnapshot } = await import("./commands-BqUFCJA_.mjs").then((n) => n.t);
451
452
  await emitEnvSnapshot(await collectEnvSnapshot(cwd), opts, cwd);
452
453
  });
453
- envCommand.command("paths").description("输出当前仓库关键路径和报告建议位置").alias("p").option("--json", "输出 JSON,方便脚本消费").option("--markdown", "输出 Markdown,方便粘贴到 issue 或 PR").option("--out <file>", "把当前输出写入文件").option("--redact", "脱敏 workspace/cwd/home 绝对路径后再输出").action(async (opts) => {
454
- const { collectEnvPaths } = await import("./commands-BD9u8I6D.mjs").then((n) => n.t);
454
+ envCommand.command("paths").description(localize("Show important repository and report paths", "输出当前仓库关键路径和报告建议位置")).alias("p").option("--json", localize("Output JSON for scripts", "输出 JSON,方便脚本消费")).option("--markdown", localize("Output Markdown", "输出 Markdown,方便粘贴到 issue 或 PR")).option("--out <file>", localize("Write output to a file", "把当前输出写入文件")).option("--redact", localize("Redact workspace, cwd, and home paths", "脱敏 workspace/cwd/home 绝对路径后再输出")).action(async (opts) => {
455
+ const { collectEnvPaths } = await import("./commands-BqUFCJA_.mjs").then((n) => n.t);
455
456
  await emitEnvPaths(await collectEnvPaths(cwd), opts, cwd);
456
457
  });
457
- envCommand.command("support").description("输出完整排障包,包含环境、路径、配置、doctor 和 check 计划").alias("b").option("--json", "输出 JSON,方便脚本消费").option("--markdown", "输出 Markdown,方便粘贴到 issue 或 PR").option("--out <file>", "把当前输出写入文件").option("--redact", "脱敏 workspace/cwd/home 绝对路径后再输出").option("--strict", "输出排障包后,如果 doctor 有 fail 或 warn 则返回失败码").action(async (opts) => {
458
- const { collectEnvSupportBundle } = await import("./commands-BD9u8I6D.mjs").then((n) => n.t);
458
+ envCommand.command("support").description(localize("Create a complete support bundle", "输出完整排障包,包含环境、路径、配置、doctor 和 check 计划")).alias("b").option("--json", localize("Output JSON for scripts", "输出 JSON,方便脚本消费")).option("--markdown", localize("Output Markdown", "输出 Markdown,方便粘贴到 issue 或 PR")).option("--out <file>", localize("Write output to a file", "把当前输出写入文件")).option("--redact", localize("Redact workspace, cwd, and home paths", "脱敏 workspace/cwd/home 绝对路径后再输出")).option("--strict", localize("Fail when doctor reports a failure or warning", "输出排障包后,如果 doctor 有 fail 或 warn 则返回失败码")).action(async (opts) => {
459
+ const { collectEnvSupportBundle } = await import("./commands-BqUFCJA_.mjs").then((n) => n.t);
459
460
  await emitEnvSupportBundle(await collectEnvSupportBundle(cwd), opts, cwd);
460
461
  });
461
- envCommand.command("mirror").description("设置 VS Code binary mirror").alias("m").action(async () => {
462
- const { setVscodeBinaryMirror } = await import("./commands-BD9u8I6D.mjs").then((n) => n.t);
462
+ envCommand.command("mirror").description(localize("Configure the VS Code binary mirror", "设置 VS Code binary mirror")).alias("m").action(async () => {
463
+ const { setVscodeBinaryMirror } = await import("./commands-BqUFCJA_.mjs").then((n) => n.t);
463
464
  await setVscodeBinaryMirror(cwd);
464
- logger.success("env mirror finished!");
465
+ logger.success(localize("Environment mirror finished.", "环境镜像完成。"));
465
466
  });
466
467
  }
467
468
  //#endregion
468
469
  //#region src/cli/commands/package.ts
469
470
  function registerPackageCommands(program, cwd) {
470
- program.command("package").alias("pkg").description("子包命令").command("create").description("创建一个新的子包").alias("new").argument("[name]").option("-t, --template <template>", "直接使用指定模板,跳过模板选择").option("--dry-run", "预览将要创建的目录与 package 信息,不写入文件").option("--json", "以 JSON 输出创建预览,隐含 --dry-run").option("--out <file>", "把创建预览写入文件,隐含 --dry-run").action(async (inputName, opts) => {
471
- const { runCreateFlow } = await import("./create-flow-D_SecUxo.mjs");
471
+ program.command("package").alias("pkg").description(localize("Package commands", "子包命令")).command("create").description(localize("Create a new workspace package", "创建一个新的子包")).alias("new").argument("[name]").option("-t, --template <template>", localize("Use a template key without prompting", "直接使用指定模板,跳过模板选择")).option("--dry-run", localize("Preview without writing files", "预览将要创建的目录与 package 信息,不写入文件")).option("--json", localize("Output JSON; implies --dry-run", "以 JSON 输出创建预览,隐含 --dry-run")).option("--out <file>", localize("Write the preview to a file; implies --dry-run", "把创建预览写入文件,隐含 --dry-run")).action(async (inputName, opts) => {
472
+ const { runCreateFlow } = await import("./create-flow-BE4Nd902.mjs");
472
473
  const result = await runCreateFlow(cwd, inputName, {
473
474
  ...opts.template !== void 0 ? { template: opts.template } : {},
474
475
  ...opts.dryRun || opts.json || opts.out ? { dryRun: true } : {},
@@ -476,7 +477,7 @@ function registerPackageCommands(program, cwd) {
476
477
  ...opts.out !== void 0 ? { out: opts.out } : {}
477
478
  });
478
479
  if (result.dryRun || result.failed) return;
479
- logger.success("package create finished!");
480
+ logger.success(localize("Package creation finished.", "包创建完成。"));
480
481
  });
481
482
  }
482
483
  //#endregion
@@ -490,60 +491,72 @@ async function runReleaseAction(action) {
490
491
  }
491
492
  }
492
493
  function registerReleaseCommands(program, cwd) {
493
- const releaseCommand = program.command("release").description("发布与 pnpm versioning 工具集");
494
- releaseCommand.command("ci").description("在 CI 中自动准备、发布和恢复版本").option("--mode <mode>", "auto / prepare / publish / publish-unpublished", "auto").option("--package <name>", "publish-unpublished 使用的 package").option("--version <version>", "publish-unpublished 使用的版本").action(async (opts) => {
494
+ const releaseCommand = program.command("release").description(localize("Release and pnpm versioning commands", "发布与 pnpm versioning 工具集"));
495
+ releaseCommand.command("ci").description(localize("Prepare, publish, or recover versions in CI", "在 CI 中自动准备、发布和恢复版本")).option("--mode <mode>", localize("auto / prepare / publish / publish-unpublished", "auto / prepare / publish / publish-unpublished"), "auto").option("--package <name>", localize("Package used by publish-unpublished mode", "publish-unpublished 使用的 package")).option("--version <version>", localize("Version used by publish-unpublished mode", "publish-unpublished 使用的版本")).action(async (opts) => {
495
496
  await runReleaseAction(async () => {
496
- const { releaseCi } = await import("./commands-BD9u8I6D.mjs").then((n) => n.t);
497
+ const { releaseCi } = await import("./commands-BqUFCJA_.mjs").then((n) => n.t);
497
498
  await releaseCi({
498
499
  cwd,
499
500
  ...opts.mode ? { mode: opts.mode } : {},
500
501
  ...opts.package ? { packageName: opts.package } : {},
501
502
  ...opts.version ? { packageVersion: opts.version } : {}
502
503
  });
503
- logger.success("release CI finished!");
504
+ logger.success(localize("Release CI finished.", "Release CI 完成。"));
504
505
  });
505
506
  });
506
- const stableCommand = releaseCommand.command("stable").description("在 main 分支执行正式发布").action(async () => {
507
+ releaseCommand.command("notes").description(localize("Manage GitHub Release notes", "维护 GitHub Release 正文")).command("repair").description(localize("Rebuild GitHub Release notes from the changelog for each release tag", "按每个发布 tag 对应的 changelog 重建 GitHub Release 正文")).option("--all", localize("Repair every recognized GitHub Release", "修复所有可识别的 GitHub Release")).option("--tag <package@version>", localize("Repair only the specified package@version", "只修复指定 package@version")).option("--dry-run", localize("Generate and summarize without updating GitHub Releases", "只生成并统计,不更新 GitHub Release")).action(async (opts) => {
507
508
  await runReleaseAction(async () => {
508
- const { releaseStable } = await import("./commands-BD9u8I6D.mjs").then((n) => n.t);
509
+ const { repairReleaseNotes } = await import("./commands-BqUFCJA_.mjs").then((n) => n.t);
510
+ const result = await repairReleaseNotes({
511
+ cwd,
512
+ ...opts.all ? { all: true } : {},
513
+ ...opts.tag ? { tag: opts.tag } : {},
514
+ ...opts.dryRun ? { dryRun: true } : {}
515
+ });
516
+ logger.success(localize(`Release notes repaired: ${result.repaired.length}; skipped: ${result.skipped.length}`, `Release 正文已修复:${result.repaired.length};已跳过:${result.skipped.length}`));
517
+ });
518
+ });
519
+ const stableCommand = releaseCommand.command("stable").description(localize("Run a stable release from main", "在 main 分支执行正式发布")).action(async () => {
520
+ await runReleaseAction(async () => {
521
+ const { releaseStable } = await import("./commands-BqUFCJA_.mjs").then((n) => n.t);
509
522
  await releaseStable({ cwd });
510
- logger.success("stable release finished!");
523
+ logger.success(localize("Stable release finished.", "稳定版发布完成。"));
511
524
  });
512
525
  });
513
- stableCommand.command("prepare").description("消费 pnpm change intents 并准备 Release PR").action(async () => {
526
+ stableCommand.command("prepare").description(localize("Consume pnpm change intents and prepare a Release PR", "消费 pnpm change intents 并准备 Release PR")).action(async () => {
514
527
  await runReleaseAction(async () => {
515
- const { prepareStable } = await import("./commands-BD9u8I6D.mjs").then((n) => n.t);
528
+ const { prepareStable } = await import("./commands-BqUFCJA_.mjs").then((n) => n.t);
516
529
  await prepareStable({ cwd });
517
- logger.success("stable release preparation finished!");
530
+ logger.success(localize("Stable release preparation finished.", "稳定版发布准备完成。"));
518
531
  });
519
532
  });
520
- stableCommand.command("publish").description("发布 main 分支上尚未发布的包").action(async () => {
533
+ stableCommand.command("publish").description(localize("Publish versions on main that are not yet on npm", "发布 main 分支上尚未发布的包")).action(async () => {
521
534
  await runReleaseAction(async () => {
522
- const { publishStable } = await import("./commands-BD9u8I6D.mjs").then((n) => n.t);
535
+ const { publishStable } = await import("./commands-BqUFCJA_.mjs").then((n) => n.t);
523
536
  await publishStable({ cwd });
524
- logger.success("stable package publish finished!");
537
+ logger.success(localize("Stable package publish finished.", "稳定版包发布完成。"));
525
538
  });
526
539
  });
527
- const preCommand = releaseCommand.command("pre").description("执行或管理 prerelease 发布");
528
- preCommand.command("publish").alias("run").description("在 alpha/beta/rc/next 分支发布 prerelease").action(async () => {
540
+ const preCommand = releaseCommand.command("pre").description(localize("Run or manage prereleases", "执行或管理 prerelease 发布"));
541
+ preCommand.command("publish").alias("run").description(localize("Publish a prerelease from an alpha, beta, rc, or next lane", "在 alpha/beta/rc/next 分支发布 prerelease")).action(async () => {
529
542
  await runReleaseAction(async () => {
530
- const { releasePrerelease } = await import("./commands-BD9u8I6D.mjs").then((n) => n.t);
543
+ const { releasePrerelease } = await import("./commands-BqUFCJA_.mjs").then((n) => n.t);
531
544
  await releasePrerelease({ cwd });
532
- logger.success("prerelease finished!");
545
+ logger.success(localize("Prerelease finished.", "预发布完成。"));
533
546
  });
534
547
  });
535
- preCommand.command("enter").description("进入 pnpm prerelease lane").argument("<tag>", "alpha / beta / rc / next").action(async (tag) => {
548
+ preCommand.command("enter").description(localize("Enter a pnpm prerelease lane", "进入 pnpm prerelease lane")).argument("<tag>", localize("alpha / beta / rc / next", "alpha / beta / rc / next")).action(async (tag) => {
536
549
  await runReleaseAction(async () => {
537
- const { enterPrerelease } = await import("./commands-BD9u8I6D.mjs").then((n) => n.t);
550
+ const { enterPrerelease } = await import("./commands-BqUFCJA_.mjs").then((n) => n.t);
538
551
  await enterPrerelease(tag, { cwd });
539
- logger.success(`entered ${tag} prerelease mode!`);
552
+ logger.success(localize(`Entered ${tag} prerelease mode.`, `已进入 ${tag} 预发布模式。`));
540
553
  });
541
554
  });
542
- preCommand.command("exit").description("退出 pnpm prerelease lane").action(async () => {
555
+ preCommand.command("exit").description(localize("Exit the pnpm prerelease lane", "退出 pnpm prerelease lane")).action(async () => {
543
556
  await runReleaseAction(async () => {
544
- const { exitPrerelease } = await import("./commands-BD9u8I6D.mjs").then((n) => n.t);
557
+ const { exitPrerelease } = await import("./commands-BqUFCJA_.mjs").then((n) => n.t);
545
558
  await exitPrerelease({ cwd });
546
- logger.success("exited prerelease mode!");
559
+ logger.success(localize("Exited prerelease mode.", "已退出预发布模式。"));
547
560
  });
548
561
  });
549
562
  }
@@ -551,8 +564,8 @@ function registerReleaseCommands(program, cwd) {
551
564
  //#region src/cli/commands/skills.ts
552
565
  const skillTargets = ["codex", "claude"];
553
566
  function registerSkillsCommands(program, cwd) {
554
- program.command("skills").alias("sk").description("技能工具集").command("sync").description("同步 resources/skills/icebreakers-monorepo-cli 到全局目录").alias("s").option("--codex", "同步到 ~/.codex/skills").option("--claude", "同步到 ~/.claude/skills").option("--all", "同步全部目标").action(async (opts) => {
555
- const { syncSkills } = await import("./commands-BD9u8I6D.mjs").then((n) => n.t);
567
+ program.command("skills").alias("sk").description(localize("AI skill commands", "技能工具集")).command("sync").description(localize("Synchronize the repoctl skill to global agent directories", "同步 resources/skills/icebreakers-monorepo-cli 到全局目录")).alias("s").option("--codex", localize("Synchronize to ~/.codex/skills", "同步到 ~/.codex/skills")).option("--claude", localize("Synchronize to ~/.claude/skills", "同步到 ~/.claude/skills")).option("--all", localize("Synchronize every target", "同步全部目标")).action(async (opts) => {
568
+ const { syncSkills } = await import("./commands-BqUFCJA_.mjs").then((n) => n.t);
556
569
  const selected = /* @__PURE__ */ new Set();
557
570
  if (opts.all) for (const target of skillTargets) selected.add(target);
558
571
  else {
@@ -564,11 +577,11 @@ function registerSkillsCommands(program, cwd) {
564
577
  targets: [...selected]
565
578
  } : { cwd });
566
579
  if (!results.length) {
567
- logger.info("未选择任何目标,已跳过同步。");
580
+ logger.info(localize("No target selected; synchronization skipped.", "未选择任何目标,已跳过同步。"));
568
581
  return;
569
582
  }
570
- logger.info(`[已同步的目标]:\n${results.map((item) => `- ${item.target}: ${item.dest}`).join("\n")}\n`);
571
- logger.success("skills sync finished!");
583
+ logger.info(`${localize("[synchronized targets]", "[已同步的目标]")}:\n${results.map((item) => `- ${item.target}: ${item.dest}`).join("\n")}\n`);
584
+ logger.success(localize("Skill synchronization finished.", "Skill 同步完成。"));
572
585
  });
573
586
  }
574
587
  //#endregion
@@ -582,9 +595,9 @@ function formatTemplateTable(choices) {
582
595
  }));
583
596
  const headers = {
584
597
  key: "key",
585
- category: "category",
586
- target: "target",
587
- description: "description"
598
+ category: localize("category", "分类"),
599
+ target: localize("target", "目标"),
600
+ description: localize("description", "说明")
588
601
  };
589
602
  const widths = {
590
603
  key: Math.max(headers.key.length, ...rows.map((row) => row.key.length)),
@@ -600,11 +613,11 @@ function formatTemplateTable(choices) {
600
613
  function formatTemplateDetail(choice) {
601
614
  return [
602
615
  `key: ${choice.key}`,
603
- `label: ${choice.label}`,
604
- `category: ${choice.category ?? "-"}`,
605
- `source: templates/${choice.source}`,
606
- `default target: ${choice.target}`,
607
- `description: ${choice.description ?? "-"}`
616
+ localize(`label: ${choice.label}`, `标签:${choice.label}`),
617
+ localize(`category: ${choice.category ?? "-"}`, `分类:${choice.category ?? "-"}`),
618
+ localize(`source: templates/${choice.source}`, `源目录:templates/${choice.source}`),
619
+ localize(`default target: ${choice.target}`, `默认目标:${choice.target}`),
620
+ localize(`description: ${choice.description ?? "-"}`, `说明:${choice.description ?? "-"}`)
608
621
  ].join("\n");
609
622
  }
610
623
  function escapeMarkdownTableCell(value) {
@@ -612,7 +625,7 @@ function escapeMarkdownTableCell(value) {
612
625
  }
613
626
  function formatTemplateMarkdownTable(choices) {
614
627
  return [
615
- "| Key | Category | Source | Default target | Description |",
628
+ localize("| Key | Category | Source | Default target | Description |", "| Key | 分类 | 源目录 | 默认目标 | 说明 |"),
616
629
  "| --- | --- | --- | --- | --- |",
617
630
  ...choices.map((choice) => [
618
631
  `\`${choice.key}\``,
@@ -629,12 +642,12 @@ function formatTemplateMarkdownDetail(choice) {
629
642
  "",
630
643
  choice.description ?? "",
631
644
  "",
632
- "| Field | Value |",
645
+ localize("| Field | Value |", "| 字段 | 值 |"),
633
646
  "| --- | --- |",
634
- `| Label | ${escapeMarkdownTableCell(choice.label)} |`,
635
- `| Category | ${escapeMarkdownTableCell(choice.category ?? "-")} |`,
636
- `| Source | \`templates/${escapeMarkdownTableCell(choice.source)}\` |`,
637
- `| Default target | \`${escapeMarkdownTableCell(choice.target)}\` |`
647
+ localize(`| Label | ${escapeMarkdownTableCell(choice.label)} |`, `| 标签 | ${escapeMarkdownTableCell(choice.label)} |`),
648
+ localize(`| Category | ${escapeMarkdownTableCell(choice.category ?? "-")} |`, `| 分类 | ${escapeMarkdownTableCell(choice.category ?? "-")} |`),
649
+ localize(`| Source | \`templates/${escapeMarkdownTableCell(choice.source)}\` |`, `| 源目录 | \`templates/${escapeMarkdownTableCell(choice.source)}\` |`),
650
+ localize(`| Default target | \`${escapeMarkdownTableCell(choice.target)}\` |`, `| 默认目标 | \`${escapeMarkdownTableCell(choice.target)}\` |`)
638
651
  ].join("\n");
639
652
  }
640
653
  function formatTemplateHealthStatus(status) {
@@ -645,18 +658,18 @@ function formatTemplateHealthStatus(status) {
645
658
  function formatTemplateHealthReport(report, color = false) {
646
659
  const status = color ? formatTemplateHealthStatus : (value) => value.toUpperCase();
647
660
  const lines = [
648
- `templates: ${report.templatesDir}`,
649
- `count: ${report.templateCount}`,
661
+ localize(`templates: ${report.templatesDir}`, `模板目录:${report.templatesDir}`),
662
+ localize(`count: ${report.templateCount}`, `数量:${report.templateCount}`),
650
663
  ""
651
664
  ];
652
665
  for (const check of report.checks) {
653
666
  const prefix = check.template ? `${check.template}: ` : "";
654
667
  lines.push(`[${status(check.status)}] ${prefix}${check.title}`);
655
668
  lines.push(` ${check.detail}`);
656
- if (check.fix) lines.push(` fix: ${check.fix}`);
669
+ if (check.fix) lines.push(localize(` fix: ${check.fix}`, ` 修复:${check.fix}`));
657
670
  }
658
671
  lines.push("");
659
- lines.push(color ? `summary: ${pc.green(String(report.summary.pass))} pass, ${pc.yellow(String(report.summary.warn))} warn, ${pc.red(String(report.summary.fail))} fail` : `summary: ${report.summary.pass} pass, ${report.summary.warn} warn, ${report.summary.fail} fail`);
672
+ lines.push(color ? localize(`summary: ${pc.green(String(report.summary.pass))} pass, ${pc.yellow(String(report.summary.warn))} warn, ${pc.red(String(report.summary.fail))} fail`, `摘要:${pc.green(String(report.summary.pass))} 通过,${pc.yellow(String(report.summary.warn))} 警告,${pc.red(String(report.summary.fail))} 失败`) : localize(`summary: ${report.summary.pass} pass, ${report.summary.warn} warn, ${report.summary.fail} fail`, `摘要:${report.summary.pass} 通过,${report.summary.warn} 警告,${report.summary.fail} 失败`));
660
673
  return lines.join("\n");
661
674
  }
662
675
  async function emitTemplateOutput(content, options) {
@@ -666,13 +679,13 @@ async function emitTemplateOutput(content, options) {
666
679
  }
667
680
  const outFile = path.resolve(process.cwd(), options.out);
668
681
  await fs.outputFile(outFile, `${content}\n`, "utf8");
669
- logger.success(`wrote ${path.relative(process.cwd(), outFile)}`);
682
+ logger.success(localize(`Wrote ${path.relative(process.cwd(), outFile)}`, `已写入 ${path.relative(process.cwd(), outFile)}`));
670
683
  }
671
684
  function registerTemplatesCommands(program) {
672
- program.command("templates").alias("tpl").description("列出可用的内置模板").argument("[key]", "查看指定模板详情").option("-c, --category <category>", "按模板分类过滤:library / app / service / docs / tool").option("--check", "检查内置模板元数据、目录和临时文件").option("--json", "输出 JSON,方便脚本消费").option("--markdown", "输出 Markdown,方便同步文档").option("--out <file>", "把当前输出写入文件").action(async (key, opts) => {
685
+ program.command("templates").alias("tpl").description(localize("List the built-in templates", "列出可用的内置模板")).argument("[key]", localize("Show details for a template key", "查看指定模板详情")).option("-c, --category <category>", localize("Filter by library, app, service, docs, or tool", "按模板分类过滤:library / app / service / docs / tool")).option("--check", localize("Check built-in template metadata and directories", "检查内置模板元数据、目录和临时文件")).option("--json", localize("Output JSON for scripts", "输出 JSON,方便脚本消费")).option("--markdown", localize("Output Markdown for documentation", "输出 Markdown,方便同步文档")).option("--out <file>", localize("Write output to a file", "把当前输出写入文件")).action(async (key, opts) => {
673
686
  const { getTemplateChoice, getTemplateChoices, isTemplateCategory, suggestTemplateKey, templateCategories } = await import("@icebreakers/monorepo-templates");
674
687
  if (opts.check) {
675
- const { checkTemplates } = await import("./commands-BD9u8I6D.mjs").then((n) => n.t);
688
+ const { checkTemplates } = await import("./commands-BqUFCJA_.mjs").then((n) => n.t);
676
689
  const report = await checkTemplates();
677
690
  if (opts.json) await emitTemplateOutput(JSON.stringify(report, null, 2), opts);
678
691
  else await emitTemplateOutput(formatTemplateHealthReport(report, !opts.out), opts);
@@ -682,10 +695,10 @@ function registerTemplatesCommands(program) {
682
695
  if (key) {
683
696
  const choice = getTemplateChoice(key);
684
697
  if (!choice) {
685
- logger.error(`unknown template: ${key}`);
698
+ logger.error(localize(`Unknown template: ${key}`, `未知模板:${key}`));
686
699
  const suggestion = suggestTemplateKey(key);
687
- if (suggestion) logger.info(`did you mean \`${suggestion}\`?`);
688
- logger.info("run `repo templates` to list available templates");
700
+ if (suggestion) logger.info(localize(`Did you mean \`${suggestion}\`?`, `你是否想使用 \`${suggestion}\`?`));
701
+ logger.info(localize("Run `repo templates` to list available templates.", "运行 `repo templates` 查看可用模板。"));
689
702
  process.exitCode = 1;
690
703
  return;
691
704
  }
@@ -697,15 +710,15 @@ function registerTemplatesCommands(program) {
697
710
  await emitTemplateOutput(formatTemplateMarkdownDetail(choice), opts);
698
711
  return;
699
712
  }
700
- await emitTemplateOutput(`Template detail:\n${formatTemplateDetail(choice)}`, opts);
701
- if (!opts.out) logger.info(`next: run \`repo new <name> --template ${choice.key}\``);
713
+ await emitTemplateOutput(localize(`Template detail:\n${formatTemplateDetail(choice)}`, `模板详情:\n${formatTemplateDetail(choice)}`), opts);
714
+ if (!opts.out) logger.info(localize(`Next: run \`repo new <name> --template ${choice.key}\`.`, `下一步:运行 \`repo new <name> --template ${choice.key}\`。`));
702
715
  return;
703
716
  }
704
717
  let category;
705
718
  if (opts.category) {
706
719
  if (!isTemplateCategory(opts.category)) {
707
- logger.error(`unknown template category: ${opts.category}`);
708
- logger.info(`available categories: ${templateCategories.join(", ")}`);
720
+ logger.error(localize(`Unknown template category: ${opts.category}`, `未知模板分类:${opts.category}`));
721
+ logger.info(localize(`Available categories: ${templateCategories.join(", ")}`, `可用分类:${templateCategories.join(", ")}`));
709
722
  process.exitCode = 1;
710
723
  return;
711
724
  }
@@ -720,8 +733,8 @@ function registerTemplatesCommands(program) {
720
733
  await emitTemplateOutput(formatTemplateMarkdownTable(choices), opts);
721
734
  return;
722
735
  }
723
- await emitTemplateOutput(`Available templates:\n${formatTemplateTable(choices)}`, opts);
724
- if (!opts.out) logger.info("next: run `repo new <name> --template <key>`");
736
+ await emitTemplateOutput(localize(`Available templates:\n${formatTemplateTable(choices)}`, `可用模板:\n${formatTemplateTable(choices)}`), opts);
737
+ if (!opts.out) logger.info(localize("Next: run `repo new <name> --template <key>`.", "下一步:运行 `repo new <name> --template <key>`。"));
725
738
  });
726
739
  }
727
740
  //#endregion
@@ -743,29 +756,29 @@ function normalizeCleanOptions(opts) {
743
756
  function normalizeToolingTargets(tooling) {
744
757
  if (!tooling.length) return;
745
758
  const unknown = tooling.filter((item) => !initToolingTargets.includes(item));
746
- if (unknown.length > 0) throw new Error(`未知的 init tooling 目标: ${unknown.join(", ")}`);
759
+ if (unknown.length > 0) throw new Error(localize(`Unknown init tooling target: ${unknown.join(", ")}`, `未知的 init tooling 目标: ${unknown.join(", ")}`));
747
760
  return tooling;
748
761
  }
749
762
  //#endregion
750
763
  //#region src/cli/commands/tooling.ts
751
764
  function registerToolingCommands(program, cwd) {
752
- program.command("tooling").alias("tg").description("工程化配置命令").command("init").description(`生成 tooling 配置(可选值:${initToolingTargets.join(", ")})`).alias("i").argument("[tooling...]").option("-a, --all", "生成全部 tooling 配置").option("-f, --force", "覆盖已存在的 tooling 配置文件").action(async (tooling = [], opts) => {
765
+ program.command("tooling").alias("tg").description(localize("Tooling configuration commands", "工程化配置命令")).command("init").description(localize(`Generate tooling configuration (${initToolingTargets.join(", ")})`, `生成 tooling 配置(可选值:${initToolingTargets.join(", ")})`)).alias("i").argument("[tooling...]").option("-a, --all", localize("Generate every tooling configuration", "生成全部 tooling 配置")).option("-f, --force", localize("Overwrite existing tooling configuration files", "覆盖已存在的 tooling 配置文件")).action(async (tooling = [], opts) => {
753
766
  const normalizedTooling = normalizeToolingTargets(tooling);
754
- const { initTooling } = await import("./commands-BD9u8I6D.mjs").then((n) => n.t);
767
+ const { initTooling } = await import("./commands-BqUFCJA_.mjs").then((n) => n.t);
755
768
  await initTooling(cwd, {
756
769
  ...normalizedTooling ? { targets: normalizedTooling } : {},
757
770
  ...opts.all !== void 0 ? { all: opts.all } : {},
758
771
  ...opts.force !== void 0 ? { force: opts.force } : {}
759
772
  });
760
- logger.success("tooling init finished!");
773
+ logger.success(localize("Tooling initialization finished.", "Tooling 初始化完成。"));
761
774
  });
762
775
  }
763
776
  //#endregion
764
777
  //#region src/cli/commands/check/output.ts
765
778
  function formatCheckPlan(plan) {
766
779
  const lines = [
767
- `cwd: ${plan.cwd}`,
768
- `mode: ${plan.mode}`,
780
+ localize(`cwd: ${plan.cwd}`, `当前目录:${plan.cwd}`),
781
+ localize(`mode: ${plan.mode}`, `模式:${plan.mode}`),
769
782
  ""
770
783
  ];
771
784
  for (const command of plan.commands) {
@@ -777,14 +790,14 @@ function formatCheckPlan(plan) {
777
790
  function formatMarkdownTable$2(rows) {
778
791
  const formatCell = (value) => String(value ?? "-").split("|").join("\\|").split("\n").join("<br>");
779
792
  return [
780
- "| Field | Value |",
793
+ localize("| Field | Value |", "| 字段 | 值 |"),
781
794
  "| --- | --- |",
782
795
  ...rows.map(([label, value]) => `| ${label} | ${formatCell(value)} |`)
783
796
  ].join("\n");
784
797
  }
785
798
  function formatCheckPlanMarkdown(plan) {
786
799
  return [
787
- "# Repo check plan",
800
+ localize("# Repo check plan", "# Repo 检查计划"),
788
801
  "",
789
802
  formatMarkdownTable$2([
790
803
  ["cwd", plan.cwd],
@@ -792,7 +805,7 @@ function formatCheckPlanMarkdown(plan) {
792
805
  ["commands", plan.commands.length]
793
806
  ]),
794
807
  "",
795
- "## Commands",
808
+ localize("## Commands", "## 命令"),
796
809
  "",
797
810
  ...plan.commands.map((command) => `- \`${command.command}\` - ${command.description}`)
798
811
  ].join("\n");
@@ -825,23 +838,23 @@ function formatDoctorStatus(status) {
825
838
  function formatDoctorReport(report, color = false) {
826
839
  const status = color ? formatDoctorStatus : (value) => value.toUpperCase();
827
840
  const lines = [
828
- `workspace: ${report.workspaceDir}`,
829
- `packages: ${report.packageCount}`,
841
+ localize(`workspace: ${report.workspaceDir}`, `工作区:${report.workspaceDir}`),
842
+ localize(`packages: ${report.packageCount}`, `包数量:${report.packageCount}`),
830
843
  ""
831
844
  ];
832
845
  for (const check of report.checks) {
833
846
  lines.push(`[${status(check.status)}] ${check.title}`);
834
847
  lines.push(` ${check.detail}`);
835
- if (check.fix) lines.push(` fix: ${check.fix}`);
848
+ if (check.fix) lines.push(localize(` fix: ${check.fix}`, ` 修复:${check.fix}`));
836
849
  }
837
850
  lines.push("");
838
- lines.push(color ? `summary: ${pc.green(String(report.summary.pass))} pass, ${pc.yellow(String(report.summary.warn))} warn, ${pc.red(String(report.summary.fail))} fail` : `summary: ${report.summary.pass} pass, ${report.summary.warn} warn, ${report.summary.fail} fail`);
851
+ lines.push(color ? localize(`summary: ${pc.green(String(report.summary.pass))} pass, ${pc.yellow(String(report.summary.warn))} warn, ${pc.red(String(report.summary.fail))} fail`, `摘要:${pc.green(String(report.summary.pass))} 通过,${pc.yellow(String(report.summary.warn))} 警告,${pc.red(String(report.summary.fail))} 失败`) : localize(`summary: ${report.summary.pass} pass, ${report.summary.warn} warn, ${report.summary.fail} fail`, `摘要:${report.summary.pass} 通过,${report.summary.warn} 警告,${report.summary.fail} 失败`));
839
852
  return lines.join("\n");
840
853
  }
841
854
  function formatMarkdownTable$1(rows) {
842
855
  const formatCell = (value) => String(value ?? "-").split("|").join("\\|").split("\n").join("<br>");
843
856
  return [
844
- "| Field | Value |",
857
+ localize("| Field | Value |", "| 字段 | 值 |"),
845
858
  "| --- | --- |",
846
859
  ...rows.map(([label, value]) => `| ${label} | ${formatCell(value)} |`)
847
860
  ].join("\n");
@@ -849,7 +862,7 @@ function formatMarkdownTable$1(rows) {
849
862
  function formatDoctorMarkdown(report) {
850
863
  const warningsAndFailures = report.checks.filter((check) => check.status !== "pass");
851
864
  return [
852
- "# Repo doctor report",
865
+ localize("# Repo doctor report", "# Repo doctor 诊断报告"),
853
866
  "",
854
867
  formatMarkdownTable$1([
855
868
  ["workspace", report.workspaceDir],
@@ -860,12 +873,12 @@ function formatDoctorMarkdown(report) {
860
873
  ]),
861
874
  "",
862
875
  ...warningsAndFailures.length > 0 ? [
863
- "## Findings",
876
+ localize("## Findings", "## 问题"),
864
877
  "",
865
- ...warningsAndFailures.map((check) => `- ${check.status}: ${check.title}${check.fix ? ` (fix: ${check.fix})` : ""}`),
878
+ ...warningsAndFailures.map((check) => localize(`- ${check.status}: ${check.title}${check.fix ? ` (fix: ${check.fix})` : ""}`, `- ${check.status}: ${check.title}${check.fix ? `(修复:${check.fix})` : ""}`)),
866
879
  ""
867
880
  ] : [],
868
- "## Checks",
881
+ localize("## Checks", "## 检查项"),
869
882
  "",
870
883
  ...report.checks.map((check) => `- ${check.status}: ${check.title}`)
871
884
  ].join("\n");
@@ -908,7 +921,7 @@ async function emitDoctorReport(report, opts, cwd) {
908
921
  }
909
922
  const outFile = path.resolve(cwd, opts.out);
910
923
  await fs.outputFile(outFile, `${content}\n`, "utf8");
911
- logger.success(`wrote ${path.relative(cwd, outFile)}`);
924
+ logger.success(localize(`Wrote ${path.relative(cwd, outFile)}`, `已写入 ${path.relative(cwd, outFile)}`));
912
925
  }
913
926
  async function emitCheckPlan(plan, opts, cwd) {
914
927
  const content = createCheckPlanOutput(plan, opts);
@@ -918,22 +931,22 @@ async function emitCheckPlan(plan, opts, cwd) {
918
931
  }
919
932
  const outFile = path.resolve(cwd, opts.out);
920
933
  await fs.outputFile(outFile, `${content}\n`, "utf8");
921
- logger.success(`wrote ${path.relative(cwd, outFile)}`);
934
+ logger.success(localize(`Wrote ${path.relative(cwd, outFile)}`, `已写入 ${path.relative(cwd, outFile)}`));
922
935
  }
923
936
  function registerTopLevelCommands(program, cwd) {
924
- program.command("init").description("初始化当前 workspace,并生成推荐配置").option("--preset <preset>", "初始化预设:minimal / standard", "standard").option("-f, --force", "覆盖已存在的 tooling 配置文件").option("--overwrite", "覆盖 setup 管理的已存在文件").option("-y, --yes", "使用默认值跳过所有交互,适合 CI").action(async (opts) => {
925
- const { init } = await import("./commands-BD9u8I6D.mjs").then((n) => n.t);
937
+ program.command("init").description(localize("Initialize the current workspace with recommended configuration", "初始化当前 workspace,并生成推荐配置")).option("--preset <preset>", localize("Initialization preset: minimal or standard", "初始化预设:minimal / standard"), "standard").option("-f, --force", localize("Overwrite existing tooling configuration files", "覆盖已存在的 tooling 配置文件")).option("--overwrite", localize("Overwrite existing managed files", "覆盖受管的已存在文件")).option("-y, --yes", localize("Use defaults without prompting; suitable for CI", "使用默认值跳过所有交互,适合 CI")).action(async (opts) => {
938
+ const { init } = await import("./commands-BqUFCJA_.mjs").then((n) => n.t);
926
939
  await init(cwd, {
927
940
  ...opts.preset !== void 0 ? { preset: opts.preset } : {},
928
941
  ...opts.force !== void 0 ? { force: opts.force } : {},
929
942
  ...opts.overwrite !== void 0 ? { overwrite: opts.overwrite } : {},
930
943
  ...opts.yes !== void 0 ? { yes: opts.yes } : {}
931
944
  });
932
- logger.success("init finished!");
933
- logger.info("next: run `pnpm install` and `pnpm build`");
945
+ logger.success(localize("Initialization finished.", "初始化完成。"));
946
+ logger.info(localize("Next: run `pnpm install` and `pnpm build`.", "下一步:运行 `pnpm install` 和 `pnpm build`。"));
934
947
  });
935
- program.command("new").description("创建新的 package / app").argument("[name]").option("-t, --template <template>", "直接使用指定模板,跳过模板选择").option("--dry-run", "预览将要创建的目录与 package 信息,不写入文件").option("--json", "以 JSON 输出创建预览,隐含 --dry-run").option("--out <file>", "把创建预览写入文件,隐含 --dry-run").action(async (inputName, opts) => {
936
- const { runCreateFlow } = await import("./create-flow-D_SecUxo.mjs");
948
+ program.command("new").description(localize("Create a new package or application", "创建新的 package / app")).argument("[name]").option("-t, --template <template>", localize("Use a template key without prompting", "直接使用指定模板,跳过模板选择")).option("--dry-run", localize("Preview directories and package metadata without writing", "预览将要创建的目录与 package 信息,不写入文件")).option("--json", localize("Output the creation preview as JSON; implies --dry-run", "以 JSON 输出创建预览,隐含 --dry-run")).option("--out <file>", localize("Write the creation preview to a file; implies --dry-run", "把创建预览写入文件,隐含 --dry-run")).action(async (inputName, opts) => {
949
+ const { runCreateFlow } = await import("./create-flow-BE4Nd902.mjs");
937
950
  const result = await runCreateFlow(cwd, inputName, {
938
951
  ...opts.template !== void 0 ? { template: opts.template } : {},
939
952
  ...opts.dryRun || opts.json || opts.out ? { dryRun: true } : {},
@@ -941,20 +954,20 @@ function registerTopLevelCommands(program, cwd) {
941
954
  ...opts.out !== void 0 ? { out: opts.out } : {}
942
955
  });
943
956
  if (result.dryRun || result.failed) return;
944
- logger.success("new finished!");
945
- logger.info("next: run `pnpm install` and start the new workspace package");
957
+ logger.success(localize("Package creation finished.", "包创建完成。"));
958
+ logger.info(localize("Next: run `pnpm install` and start the new workspace package.", "下一步:运行 `pnpm install`,然后启动新 workspace 包。"));
946
959
  });
947
- program.command("check").description("执行推荐的本地校验").option("--full", "执行完整校验").option("--staged", "仅执行 staged 相关校验").option("--edit-file <file>", "执行 commit message 校验").option("--dry-run", "预览将要执行的校验,不实际运行").option("--json", "以 JSON 输出校验计划,隐含 --dry-run").option("--markdown", "以 Markdown 输出校验计划,隐含 --dry-run").option("--out <file>", "把校验计划写入文件,隐含 --dry-run").option("--redact", "脱敏 cwd/home 绝对路径后再输出").action(async (opts) => {
960
+ program.command("check").description(localize("Run the recommended local verification", "执行推荐的本地校验")).option("--full", localize("Run full verification", "执行完整校验")).option("--staged", localize("Run staged-file verification", "仅执行 staged 相关校验")).option("--edit-file <file>", localize("Validate a commit message file", "执行 commit message 校验")).option("--dry-run", localize("Preview checks without running them", "预览将要执行的校验,不实际运行")).option("--json", localize("Output the check plan as JSON; implies --dry-run", "以 JSON 输出校验计划,隐含 --dry-run")).option("--markdown", localize("Output the check plan as Markdown; implies --dry-run", "以 Markdown 输出校验计划,隐含 --dry-run")).option("--out <file>", localize("Write the check plan to a file; implies --dry-run", "把校验计划写入文件,隐含 --dry-run")).option("--redact", localize("Redact cwd and home paths", "脱敏 cwd/home 绝对路径后再输出")).action(async (opts) => {
948
961
  const options = {
949
962
  cwd,
950
963
  ...opts.full !== void 0 ? { full: opts.full } : {},
951
964
  ...opts.staged !== void 0 ? { staged: opts.staged } : {},
952
965
  ...opts.editFile !== void 0 ? { editFile: opts.editFile } : {}
953
966
  };
954
- const { resolveRecommendedCheckPlan, runRecommendedCheck } = await import("./commands-BD9u8I6D.mjs").then((n) => n.t);
967
+ const { resolveRecommendedCheckPlan, runRecommendedCheck } = await import("./commands-BqUFCJA_.mjs").then((n) => n.t);
955
968
  if (opts.dryRun || opts.json || opts.markdown || opts.out) {
956
969
  if (opts.full) {
957
- const { resolveFullWorkspaceCheckPlan } = await import("./commands-BD9u8I6D.mjs").then((n) => n.t);
970
+ const { resolveFullWorkspaceCheckPlan } = await import("./commands-BqUFCJA_.mjs").then((n) => n.t);
958
971
  await emitCheckPlan(await resolveFullWorkspaceCheckPlan(cwd), opts, cwd);
959
972
  return;
960
973
  }
@@ -962,10 +975,10 @@ function registerTopLevelCommands(program, cwd) {
962
975
  return;
963
976
  }
964
977
  await runRecommendedCheck(options);
965
- logger.success("check finished!");
978
+ logger.success(localize("Checks finished.", "检查完成。"));
966
979
  });
967
- program.command("doctor").description("诊断当前仓库是否适合直接开始使用").option("--json", "输出 JSON 报告,方便 CI 或脚本消费").option("--markdown", "输出 Markdown 报告,方便粘贴到 issue 或 PR").option("--out <file>", "把诊断报告写入文件").option("--redact", "脱敏 workspace/cwd/home 绝对路径后再输出").option("--strict", "把 warning 也视为失败,适合 CI 门禁").action(async (opts) => {
968
- const { runDoctor } = await import("./commands-BD9u8I6D.mjs").then((n) => n.t);
980
+ program.command("doctor").description(localize("Diagnose whether the current repository is ready to use", "诊断当前仓库是否适合直接开始使用")).option("--json", localize("Output JSON for CI or scripts", "输出 JSON 报告,方便 CI 或脚本消费")).option("--markdown", localize("Output Markdown for an issue or pull request", "输出 Markdown 报告,方便粘贴到 issue 或 PR")).option("--out <file>", localize("Write the diagnostic report to a file", "把诊断报告写入文件")).option("--redact", localize("Redact workspace, cwd, and home paths", "脱敏 workspace/cwd/home 绝对路径后再输出")).option("--strict", localize("Treat warnings as failures", "把 warning 也视为失败,适合 CI 门禁")).action(async (opts) => {
981
+ const { runDoctor } = await import("./commands-BqUFCJA_.mjs").then((n) => n.t);
969
982
  const report = await runDoctor(cwd);
970
983
  await emitDoctorReport(report, opts, cwd);
971
984
  if (opts.out || opts.json || opts.markdown) {
@@ -973,47 +986,47 @@ function registerTopLevelCommands(program, cwd) {
973
986
  return;
974
987
  }
975
988
  if (report.summary.fail > 0) {
976
- logger.error(`doctor found ${report.summary.fail} blocking issue(s).`);
989
+ logger.error(localize(`Doctor found ${report.summary.fail} blocking issue(s).`, `Doctor 发现 ${report.summary.fail} 个阻断问题。`));
977
990
  process.exitCode = 1;
978
991
  return;
979
992
  }
980
993
  if (report.summary.warn > 0) {
981
994
  if (opts.strict) {
982
- logger.error(`doctor found ${report.summary.warn} warning(s) in strict mode.`);
995
+ logger.error(localize(`Doctor found ${report.summary.warn} warning(s) in strict mode.`, `严格模式下 doctor 发现 ${report.summary.warn} 个警告。`));
983
996
  process.exitCode = 1;
984
997
  return;
985
998
  }
986
- logger.warn(`doctor found ${report.summary.warn} suggestion(s).`);
999
+ logger.warn(localize(`Doctor found ${report.summary.warn} suggestion(s).`, `Doctor 提供了 ${report.summary.warn} 条建议。`));
987
1000
  }
988
- logger.success("doctor finished!");
1001
+ logger.success(localize("Doctor finished.", "Doctor 诊断完成。"));
989
1002
  });
990
- program.command("upgrade").description("同步仓库标准资产与脚本").option("-i,--interactive").option("-c,--core", "仅同步核心配置,跳过 GitHub 相关资产").option("--outDir <dir>", "Output directory").option("-s,--skip-overwrite", "skip overwrite").option("-y, --yes", "跳过交互并覆盖 drifted 标准资产").option("--overwrite", "覆盖 drifted 标准资产").option("--no-overwrite", "不覆盖 drifted 标准资产").option("--overwrite-release", "覆盖未标记的自定义 release workflow").action(async (opts) => {
991
- const { upgradeMonorepo } = await import("./commands-BD9u8I6D.mjs").then((n) => n.t);
1003
+ program.command("upgrade").description(localize("Synchronize standard repository assets and scripts", "同步仓库标准资产与脚本")).option("-i,--interactive", localize("Select managed files interactively", "交互式选择受管文件")).option("-c,--core", localize("Synchronize core configuration without GitHub assets", "仅同步核心配置,跳过 GitHub 相关资产")).option("--outDir <dir>", localize("Output directory", "输出目录")).option("-s,--skip-overwrite", localize("Preserve existing files", "保留已存在文件")).option("-y, --yes", localize("Skip prompts and overwrite drifted managed assets", "跳过交互并覆盖 drifted 标准资产")).option("--overwrite", localize("Overwrite drifted managed assets", "覆盖 drifted 标准资产")).option("--no-overwrite", localize("Preserve drifted managed assets", "不覆盖 drifted 标准资产")).option("--overwrite-release", localize("Overwrite an unmarked custom release workflow", "覆盖未标记的自定义 release workflow")).action(async (opts) => {
1004
+ const { upgradeMonorepo } = await import("./commands-BqUFCJA_.mjs").then((n) => n.t);
992
1005
  await upgradeMonorepo(normalizeCliOpts(cwd, opts));
993
- logger.success("upgrade finished!");
1006
+ logger.success(localize("Upgrade finished.", "升级完成。"));
994
1007
  });
995
1008
  }
996
1009
  //#endregion
997
1010
  //#region src/cli/commands/verify.ts
998
1011
  function registerVerifyCommands(program, cwd) {
999
- const verifyCommand = program.command("verify").alias("v").description("本地校验工具集");
1000
- verifyCommand.command("pre-push").description("按推送变更范围执行 build/test/tsd 校验").alias("push").action(async () => {
1001
- const { verifyPrePush } = await import("./commands-BD9u8I6D.mjs").then((n) => n.t);
1012
+ const verifyCommand = program.command("verify").alias("v").description(localize("Local verification commands", "本地校验工具集"));
1013
+ verifyCommand.command("pre-push").description(localize("Run build, test, and tsd checks for pushed changes", "按推送变更范围执行 build/test/tsd 校验")).alias("push").action(async () => {
1014
+ const { verifyPrePush } = await import("./commands-BqUFCJA_.mjs").then((n) => n.t);
1002
1015
  await verifyPrePush({ cwd });
1003
1016
  });
1004
- verifyCommand.command("pre-commit").description("执行 lint-staged 校验").alias("commit").action(async () => {
1005
- const { verifyPreCommit } = await import("./commands-BD9u8I6D.mjs").then((n) => n.t);
1017
+ verifyCommand.command("pre-commit").description(localize("Run lint-staged verification", "执行 lint-staged 校验")).alias("commit").action(async () => {
1018
+ const { verifyPreCommit } = await import("./commands-BqUFCJA_.mjs").then((n) => n.t);
1006
1019
  await verifyPreCommit({ cwd });
1007
1020
  });
1008
- verifyCommand.command("commit-msg").description("执行 commitlint 校验").alias("msg").argument("<edit-file>").action(async (editFile) => {
1009
- const { verifyCommitMsg } = await import("./commands-BD9u8I6D.mjs").then((n) => n.t);
1021
+ verifyCommand.command("commit-msg").description(localize("Run commitlint verification", "执行 commitlint 校验")).alias("msg").argument("<edit-file>").action(async (editFile) => {
1022
+ const { verifyCommitMsg } = await import("./commands-BqUFCJA_.mjs").then((n) => n.t);
1010
1023
  await verifyCommitMsg({
1011
1024
  cwd,
1012
1025
  editFile
1013
1026
  });
1014
1027
  });
1015
- verifyCommand.command("staged-typecheck").description("按暂存文件所在 workspace 执行 typecheck").alias("tc").argument("[files...]").action(async (files = []) => {
1016
- const { verifyStagedTypecheck } = await import("./commands-BD9u8I6D.mjs").then((n) => n.t);
1028
+ verifyCommand.command("staged-typecheck").description(localize("Run typecheck in workspaces containing staged files", "按暂存文件所在 workspace 执行 typecheck")).alias("tc").argument("[files...]").action(async (files = []) => {
1029
+ const { verifyStagedTypecheck } = await import("./commands-BqUFCJA_.mjs").then((n) => n.t);
1017
1030
  verifyStagedTypecheck(files, { cwd });
1018
1031
  });
1019
1032
  }
@@ -1023,10 +1036,10 @@ function collectValues(value, previous = []) {
1023
1036
  return [...previous, value];
1024
1037
  }
1025
1038
  function formatWorkspaceList(result) {
1026
- const lines = [`workspace: ${result.workspaceDir}`, `packages: ${result.packages.length}`];
1039
+ const lines = [localize(`workspace: ${result.workspaceDir}`, `工作区:${result.workspaceDir}`), localize(`packages: ${result.packages.length}`, `包数量:${result.packages.length}`)];
1027
1040
  for (const pkg of result.packages) {
1028
- const name = pkg.name ?? "(unnamed)";
1029
- const privateMark = pkg.private ? " private" : "";
1041
+ const name = pkg.name ?? localize("(unnamed)", "(未命名)");
1042
+ const privateMark = pkg.private ? localize(" private", " 私有") : "";
1030
1043
  lines.push(`- ${name} ${pkg.relativeDir}${privateMark}`);
1031
1044
  }
1032
1045
  return lines.join("\n");
@@ -1036,14 +1049,14 @@ function formatMarkdownCell(value) {
1036
1049
  }
1037
1050
  function formatMarkdownTable(rows) {
1038
1051
  return [
1039
- "| Field | Value |",
1052
+ localize("| Field | Value |", "| 字段 | 值 |"),
1040
1053
  "| --- | --- |",
1041
1054
  ...rows.map(([label, value]) => `| ${label} | ${formatMarkdownCell(value)} |`)
1042
1055
  ].join("\n");
1043
1056
  }
1044
1057
  function formatWorkspaceListMarkdown(result) {
1045
1058
  return [
1046
- "# Repo workspaces",
1059
+ localize("# Repo workspaces", "# Repo 工作区"),
1047
1060
  "",
1048
1061
  formatMarkdownTable([
1049
1062
  ["cwd", result.cwd],
@@ -1051,14 +1064,14 @@ function formatWorkspaceListMarkdown(result) {
1051
1064
  ["packages", result.packages.length]
1052
1065
  ]),
1053
1066
  "",
1054
- "## Packages",
1067
+ localize("## Packages", "## 包"),
1055
1068
  "",
1056
- "| Name | Path | Private | Description |",
1069
+ localize("| Name | Path | Private | Description |", "| 名称 | 路径 | 私有 | 说明 |"),
1057
1070
  "| --- | --- | --- | --- |",
1058
1071
  ...result.packages.map((pkg) => {
1059
- const name = pkg.name ?? "(unnamed)";
1072
+ const name = pkg.name ?? localize("(unnamed)", "(未命名)");
1060
1073
  const description = pkg.description ?? "-";
1061
- return `| ${formatMarkdownCell(name)} | ${formatMarkdownCell(pkg.relativeDir)} | ${pkg.private ? "yes" : "no"} | ${formatMarkdownCell(description)} |`;
1074
+ return `| ${formatMarkdownCell(name)} | ${formatMarkdownCell(pkg.relativeDir)} | ${pkg.private ? localize("yes", "是") : localize("no", "否")} | ${formatMarkdownCell(description)} |`;
1062
1075
  })
1063
1076
  ].join("\n");
1064
1077
  }
@@ -1087,21 +1100,21 @@ async function emitWorkspaceList(result, opts) {
1087
1100
  }
1088
1101
  const outFile = path.resolve(process.cwd(), opts.out);
1089
1102
  await fs.outputFile(outFile, `${content}\n`, "utf8");
1090
- logger.success(`wrote ${path.relative(process.cwd(), outFile)}`);
1103
+ logger.success(localize(`Wrote ${path.relative(process.cwd(), outFile)}`, `已写入 ${path.relative(process.cwd(), outFile)}`));
1091
1104
  }
1092
1105
  function registerWorkspaceCommands(program, cwd) {
1093
- const workspaceCommand = program.command("workspace").alias("ws").description("工作区命令");
1094
- workspaceCommand.command("upgrade").description("升级/同步 monorepo 相关包").alias("up").option("-i,--interactive").option("-c,--core", "仅同步核心配置,跳过 GitHub 相关资产").option("--outDir <dir>", "Output directory").option("-s,--skip-overwrite", "skip overwrite").option("-y, --yes", "跳过交互并覆盖 drifted 标准资产").option("--overwrite", "覆盖 drifted 标准资产").option("--no-overwrite", "不覆盖 drifted 标准资产").option("--overwrite-release", "覆盖未标记的自定义 release workflow").action(async (opts) => {
1095
- const { upgradeMonorepo } = await import("./commands-BD9u8I6D.mjs").then((n) => n.t);
1106
+ const workspaceCommand = program.command("workspace").alias("ws").description(localize("Workspace commands", "工作区命令"));
1107
+ workspaceCommand.command("upgrade").description(localize("Upgrade or synchronize monorepo packages", "升级/同步 monorepo 相关包")).alias("up").option("-i,--interactive", localize("Select managed files interactively", "交互式选择受管文件")).option("-c,--core", localize("Synchronize core configuration without GitHub assets", "仅同步核心配置,跳过 GitHub 相关资产")).option("--outDir <dir>", localize("Output directory", "输出目录")).option("-s,--skip-overwrite", localize("Preserve existing files", "保留已存在文件")).option("-y, --yes", localize("Skip prompts and overwrite drifted managed assets", "跳过交互并覆盖 drifted 标准资产")).option("--overwrite", localize("Overwrite drifted managed assets", "覆盖 drifted 标准资产")).option("--no-overwrite", localize("Preserve drifted managed assets", "不覆盖 drifted 标准资产")).option("--overwrite-release", localize("Overwrite an unmarked custom release workflow", "覆盖未标记的自定义 release workflow")).action(async (opts) => {
1108
+ const { upgradeMonorepo } = await import("./commands-BqUFCJA_.mjs").then((n) => n.t);
1096
1109
  await upgradeMonorepo(normalizeCliOpts(cwd, opts));
1097
- logger.success("workspace upgrade finished!");
1110
+ logger.success(localize("Workspace upgrade finished.", "Workspace 升级完成。"));
1098
1111
  });
1099
- workspaceCommand.command("init").description("初始化工作区元信息(README、package.json、pnpm intent、issue template)").alias("i").action(async () => {
1100
- const { initMetadata } = await import("./commands-BD9u8I6D.mjs").then((n) => n.t);
1112
+ workspaceCommand.command("init").description(localize("Initialize workspace metadata and repository files", "初始化工作区元信息(README、package.json、pnpm intent、issue template)")).alias("i").action(async () => {
1113
+ const { initMetadata } = await import("./commands-BqUFCJA_.mjs").then((n) => n.t);
1101
1114
  await initMetadata(cwd);
1102
- logger.success("workspace init finished!");
1115
+ logger.success(localize("Workspace initialization finished.", "Workspace 初始化完成。"));
1103
1116
  });
1104
- workspaceCommand.command("list").description("列出 workspace 包").alias("ls").option("--json", "输出 JSON").option("--markdown", "输出 Markdown,方便粘贴到 issue 或 PR").option("--redact", "脱敏 workspace/cwd/home 绝对路径后再输出").option("--include-private", "包含 private 包").option("--include-root", "包含 workspace 根包").option("-p, --pattern <glob>", "追加自定义 workspace glob,可重复", collectValues).option("--out <file>", "把当前列表输出写入文件").action(async (opts) => {
1117
+ workspaceCommand.command("list").description(localize("List workspace packages", "列出 workspace 包")).alias("ls").option("--json", localize("Output JSON", "输出 JSON")).option("--markdown", localize("Output Markdown", "输出 Markdown,方便粘贴到 issue 或 PR")).option("--redact", localize("Redact workspace, cwd, and home paths", "脱敏 workspace/cwd/home 绝对路径后再输出")).option("--include-private", localize("Include private packages", "包含 private 包")).option("--include-root", localize("Include the workspace root package", "包含 workspace 根包")).option("-p, --pattern <glob>", localize("Append a workspace glob; repeatable", "追加自定义 workspace glob,可重复"), collectValues).option("--out <file>", localize("Write the package list to a file", "把当前列表输出写入文件")).action(async (opts) => {
1105
1118
  const { getWorkspacePackageSummaries } = await import("./workspace-MCKewElu.mjs").then((n) => n.a);
1106
1119
  await emitWorkspaceList(await getWorkspacePackageSummaries(cwd, {
1107
1120
  ignorePrivatePackage: !opts.includePrivate,
@@ -1109,17 +1122,41 @@ function registerWorkspaceCommands(program, cwd) {
1109
1122
  ...opts.pattern?.length ? { patterns: opts.pattern } : {}
1110
1123
  }), opts);
1111
1124
  });
1112
- workspaceCommand.command("clean").description("清除选中的包").alias("rm").option("-y, --yes", "跳过交互直接清理(等价 autoConfirm)").option("--include-private", "包含 private 包").option("--pinned-version <version>", "覆盖写入的 repoctl 版本").action(async (opts) => {
1113
- const { cleanProjects } = await import("./commands-BD9u8I6D.mjs").then((n) => n.t);
1125
+ workspaceCommand.command("clean").description(localize("Remove selected workspace packages", "清除选中的包")).alias("rm").option("-y, --yes", localize("Skip prompts and clean immediately", "跳过交互直接清理(等价 autoConfirm)")).option("--include-private", localize("Include private packages", "包含 private 包")).option("--pinned-version <version>", localize("Override the repoctl version written to the root package", "覆盖写入的 repoctl 版本")).action(async (opts) => {
1126
+ const { cleanProjects } = await import("./commands-BqUFCJA_.mjs").then((n) => n.t);
1114
1127
  await cleanProjects(cwd, normalizeCleanOptions(opts));
1115
- logger.success("workspace clean finished!");
1128
+ logger.success(localize("Workspace cleanup finished.", "Workspace 清理完成。"));
1116
1129
  });
1117
1130
  }
1118
1131
  //#endregion
1119
1132
  //#region src/cli/program.ts
1120
1133
  const cwd = process.cwd();
1121
1134
  const program = new Command();
1122
- program.name(cliName).version(version).description("One-command repo initialization and maintenance for pnpm/turbo workspaces.");
1135
+ const activeCliName = path$1.basename(process.argv[1] ?? "", path$1.extname(process.argv[1] ?? "")) === "repoctl" ? "repoctl" : cliName;
1136
+ function localizeHelpMetadata(value) {
1137
+ return value.replaceAll("choices:", message("choicesLabel")).replaceAll("default:", message("defaultLabel")).replaceAll("preset:", message("presetLabel")).replaceAll("env:", message("envLabel"));
1138
+ }
1139
+ function localizeCommanderError(value) {
1140
+ return value.replaceAll("Did you mean one of", message("commanderDidYouMeanOneOf")).replaceAll("Did you mean", message("commanderDidYouMean")).replaceAll("Allowed choices are", message("commanderAllowedChoices")).replaceAll("missing required argument", message("commanderMissingRequiredArgument")).replaceAll("required option", message("commanderRequiredOption")).replaceAll("argument missing", message("commanderArgumentMissing")).replaceAll("not specified", message("commanderNotSpecified")).replaceAll("too many arguments", message("commanderTooManyArguments")).replaceAll("unknown command", message("commanderUnknownCommand")).replaceAll("unknown option", message("commanderUnknownOption")).replace(/^error:/, message("commanderErrorPrefix"));
1141
+ }
1142
+ function configureLocalizedHelp(command) {
1143
+ const defaultHelp = command.createHelp();
1144
+ const titles = {
1145
+ "Arguments:": message("argumentsTitle"),
1146
+ "Commands:": message("commandsTitle"),
1147
+ "Global Options:": message("globalOptionsTitle"),
1148
+ "Options:": message("optionsTitle"),
1149
+ "Usage:": message("usageTitle")
1150
+ };
1151
+ command.helpOption("-h, --help", message("helpOption")).configureOutput({ outputError: (value, write) => write(localizeCommanderError(value)) }).configureHelp({
1152
+ argumentDescription: (argument) => localizeHelpMetadata(defaultHelp.argumentDescription(argument)),
1153
+ optionDescription: (option) => localizeHelpMetadata(defaultHelp.optionDescription(option)),
1154
+ styleTitle: (title) => titles[title] ?? title
1155
+ });
1156
+ if (command.commands.length) command.addHelpCommand("help [command]", message("helpCommand"));
1157
+ command.commands.forEach(configureLocalizedHelp);
1158
+ }
1159
+ program.name(activeCliName).version(version, "-V, --version", message("versionOption")).description(message("cliDescription")).addOption(new Option("--lang <locale>", message("languageOption")).choices([...supportedLocales]));
1123
1160
  registerTopLevelCommands(program, cwd);
1124
1161
  registerTemplatesCommands(program);
1125
1162
  registerWorkspaceCommands(program, cwd);
@@ -1131,24 +1168,8 @@ registerSkillsCommands(program, cwd);
1131
1168
  registerVerifyCommands(program, cwd);
1132
1169
  registerAiCommands(program, cwd);
1133
1170
  registerPackageCommands(program, cwd);
1134
- program.addHelpText("after", `
1135
- Quick start:
1136
- Existing repo:
1137
- $ ${cliName} init
1138
- $ ${cliName} doctor
1139
- $ ${cliName} templates
1140
- $ ${cliName} new my-package
1141
- $ ${cliName} check
1142
-
1143
- Faster in generated repos:
1144
- $ pnpm run repo:init
1145
- $ pnpm run repo:doctor
1146
- $ pnpm run repo:new -- my-package
1147
- $ pnpm run repo:check
1148
-
1149
- Keep the repo current:
1150
- $ ${cliName} upgrade
1151
- `);
1171
+ configureLocalizedHelp(program);
1172
+ program.addHelpText("after", message("quickStart", { cliName: activeCliName }));
1152
1173
  //#endregion
1153
1174
  //#region src/cli.ts
1154
1175
  if (process.argv.length <= 2) program.outputHelp();