@icebreakers/monorepo 5.1.1 → 5.3.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,16 @@
1
- import { d as logger, g as fs, r as cliName, t as initToolingTargets, u as version } from "./types-CLzhRYdV.mjs";
1
+ import { b as fs, d as localize, f as message, h as logger, m as supportedLocales, r as cliName, t as initToolingTargets, u as version } from "./types-CGwtAKfx.mjs";
2
+ import { s as resolveCommandConfig } from "./config-p842Knhq.mjs";
2
3
  import path from "pathe";
3
4
  import process from "node:process";
5
+ import path$1 from "node:path";
4
6
  import os from "node:os";
5
7
  import pc from "picocolors";
6
- import { Command } from "commander";
8
+ import { Command, Option } from "commander";
7
9
  //#region src/cli/commands/ai.ts
8
10
  async function handleAiPromptCreate(cwd, opts) {
9
11
  const [{ input }, { createTimestampFolderName, defaultAgenticBaseDir, generateAgenticTemplate, generateAgenticTemplates, loadAgenticTasks }, { resolveCommandConfig }] = await Promise.all([
10
12
  import("@icebreakers/monorepo-templates"),
11
- import("./commands-DwvtvWjz.mjs").then((n) => n.t),
13
+ import("./commands-D7bVEzen.mjs").then((n) => n.t),
12
14
  import("./config-p842Knhq.mjs").then((n) => n.n)
13
15
  ]);
14
16
  const aiConfig = await resolveCommandConfig("ai", cwd);
@@ -19,7 +21,7 @@ async function handleAiPromptCreate(cwd, opts) {
19
21
  const tasksFile = opts.tasks ?? aiConfig?.tasksFile;
20
22
  const templateName = opts.name;
21
23
  if (Boolean(tasksFile && !opts.output && !opts.name)) {
22
- if (!tasksFile) throw new Error("tasks file path is required when using tasks mode");
24
+ if (!tasksFile) throw new Error(localize("A tasks file path is required when using tasks mode.", "使用 tasks 模式时必须提供任务文件路径。"));
23
25
  await generateAgenticTemplates(await loadAgenticTasks(tasksFile, cwd), {
24
26
  cwd,
25
27
  baseDir,
@@ -32,7 +34,7 @@ async function handleAiPromptCreate(cwd, opts) {
32
34
  if (!output && !templateName) {
33
35
  const generated = createTimestampFolderName();
34
36
  folderName = ((await input({
35
- message: "提示词将写入哪个文件夹?(可回车确认或自定义)",
37
+ message: localize("Which folder should contain the prompt?", "提示词将写入哪个文件夹?(可回车确认或自定义)"),
36
38
  default: generated
37
39
  }))?.trim?.() ?? generated) || generated;
38
40
  }
@@ -48,7 +50,7 @@ async function handleAiPromptCreate(cwd, opts) {
48
50
  await generateAgenticTemplate(templateOptions);
49
51
  }
50
52
  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) => {
53
+ 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
54
  await handleAiPromptCreate(cwd, opts);
53
55
  });
54
56
  }
@@ -58,16 +60,16 @@ function formatConfigInspection(inspection) {
58
60
  const commandKeys = Object.keys(inspection.config.commands ?? {});
59
61
  const toolingKeys = Object.keys(inspection.config.tooling ?? {});
60
62
  return [
61
- `cwd: ${inspection.cwd}`,
62
- `file: ${inspection.file ?? "-"}`,
63
- `commands: ${commandKeys.length > 0 ? commandKeys.join(", ") : "-"}`,
64
- `tooling: ${toolingKeys.length > 0 ? toolingKeys.join(", ") : "-"}`
63
+ localize(`cwd: ${inspection.cwd}`, `当前目录:${inspection.cwd}`),
64
+ localize(`file: ${inspection.file ?? "-"}`, `文件:${inspection.file ?? "-"}`),
65
+ localize(`commands: ${commandKeys.length > 0 ? commandKeys.join(", ") : "-"}`, `命令:${commandKeys.length > 0 ? commandKeys.join(", ") : "-"}`),
66
+ localize(`tooling: ${toolingKeys.length > 0 ? toolingKeys.join(", ") : "-"}`, `Tooling:${toolingKeys.length > 0 ? toolingKeys.join(", ") : "-"}`)
65
67
  ].join("\n");
66
68
  }
67
69
  function formatMarkdownTable$5(rows) {
68
70
  const formatCell = (value) => String(value ?? "-").split("|").join("\\|").split("\n").join("<br>");
69
71
  return [
70
- "| Field | Value |",
72
+ localize("| Field | Value |", "| 字段 | 值 |"),
71
73
  "| --- | --- |",
72
74
  ...rows.map(([label, value]) => `| ${label} | ${formatCell(value)} |`)
73
75
  ].join("\n");
@@ -76,7 +78,7 @@ function formatConfigInspectionMarkdown(inspection) {
76
78
  const commandKeys = Object.keys(inspection.config.commands ?? {});
77
79
  const toolingKeys = Object.keys(inspection.config.tooling ?? {});
78
80
  return [
79
- "# Repo config inspection",
81
+ localize("# Repo config inspection", "# Repo 配置检查"),
80
82
  "",
81
83
  formatMarkdownTable$5([
82
84
  ["cwd", inspection.cwd],
@@ -85,11 +87,11 @@ function formatConfigInspectionMarkdown(inspection) {
85
87
  ["tooling", toolingKeys.length]
86
88
  ]),
87
89
  "",
88
- "## Commands",
90
+ localize("## Commands", "## 命令"),
89
91
  "",
90
92
  ...commandKeys.length > 0 ? commandKeys.map((key) => `- ${key}`) : ["- -"],
91
93
  "",
92
- "## Tooling",
94
+ localize("## Tooling", "## Tooling 配置"),
93
95
  "",
94
96
  ...toolingKeys.length > 0 ? toolingKeys.map((key) => `- ${key}`) : ["- -"]
95
97
  ].join("\n");
@@ -119,11 +121,11 @@ async function emitConfigInspection(inspection, opts, cwd) {
119
121
  }
120
122
  const outFile = path.resolve(cwd, opts.out);
121
123
  await fs.outputFile(outFile, `${content}\n`, "utf8");
122
- logger.success(`wrote ${path.relative(cwd, outFile)}`);
124
+ logger.success(localize(`Wrote ${path.relative(cwd, outFile)}`, `已写入 ${path.relative(cwd, outFile)}`));
123
125
  }
124
126
  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-DwvtvWjz.mjs").then((n) => n.t);
127
+ 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) => {
128
+ const { inspectMonorepoConfig } = await import("./commands-D7bVEzen.mjs").then((n) => n.t);
127
129
  await emitConfigInspection(await inspectMonorepoConfig(cwd), opts, cwd);
128
130
  });
129
131
  }
@@ -132,7 +134,7 @@ function registerConfigCommands(program, cwd) {
132
134
  function formatMarkdownTable$4(rows) {
133
135
  const formatCell = (value) => String(value ?? "-").split("|").join("\\|").split("\n").join("<br>");
134
136
  return [
135
- "| Field | Value |",
137
+ localize("| Field | Value |", "| 字段 | 值 |"),
136
138
  "| --- | --- |",
137
139
  ...rows.map(([label, value]) => `| ${label} | ${formatCell(value)} |`)
138
140
  ].join("\n");
@@ -150,7 +152,7 @@ function formatEnvInfo$1(info) {
150
152
  }
151
153
  function formatEnvInfoMarkdown(info) {
152
154
  return [
153
- "# Repo environment",
155
+ localize("# Repo environment", "# Repo 环境"),
154
156
  "",
155
157
  formatMarkdownTable$4([
156
158
  ["cwd", info.cwd],
@@ -164,7 +166,7 @@ function formatEnvInfoMarkdown(info) {
164
166
  ].join("\n");
165
167
  }
166
168
  function formatEnvPathEntry(label, entry) {
167
- return `${label}: ${entry.relativePath} (${entry.exists ? "exists" : "missing"})`;
169
+ return localize(`${label}: ${entry.relativePath} (${entry.exists ? "exists" : "missing"})`, `${label}:${entry.relativePath}(${entry.exists ? "存在" : "缺失"})`);
168
170
  }
169
171
  function formatEnvPaths(paths) {
170
172
  return [
@@ -185,15 +187,15 @@ function formatEnvPaths(paths) {
185
187
  }
186
188
  function formatEnvPathsMarkdown(paths) {
187
189
  return [
188
- "# Repo paths",
190
+ localize("# Repo paths", "# Repo 路径"),
189
191
  "",
190
192
  formatMarkdownTable$4([["cwd", paths.cwd], ["workspace", paths.workspaceDir]]),
191
193
  "",
192
- "## Files",
194
+ localize("## Files", "## 文件"),
193
195
  "",
194
- "| Path | Relative path | Status |",
196
+ localize("| Path | Relative path | Status |", "| 路径 | 相对路径 | 状态 |"),
195
197
  "| --- | --- | --- |",
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"} |`)
198
+ ...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
199
  ].join("\n");
198
200
  }
199
201
  function formatEnvSnapshot(snapshot) {
@@ -210,11 +212,11 @@ function formatEnvSnapshot(snapshot) {
210
212
  function formatEnvSnapshotMarkdown(snapshot) {
211
213
  const warningsAndFailures = snapshot.doctor.checks.filter((check) => check.status !== "pass");
212
214
  return [
213
- "# Repo environment snapshot",
215
+ localize("# Repo environment snapshot", "# Repo 环境快照"),
214
216
  "",
215
- `Generated at: ${snapshot.generatedAt}`,
217
+ localize(`Generated at: ${snapshot.generatedAt}`, `生成时间:${snapshot.generatedAt}`),
216
218
  "",
217
- "## Environment",
219
+ localize("## Environment", "## 环境"),
218
220
  "",
219
221
  formatMarkdownTable$4([
220
222
  ["cwd", snapshot.env.cwd],
@@ -226,7 +228,7 @@ function formatEnvSnapshotMarkdown(snapshot) {
226
228
  ["platform", `${snapshot.env.platform}/${snapshot.env.arch}`]
227
229
  ]),
228
230
  "",
229
- "## Diagnostics",
231
+ localize("## Diagnostics", "## 诊断"),
230
232
  "",
231
233
  formatMarkdownTable$4([
232
234
  ["doctor pass", snapshot.doctor.summary.pass],
@@ -236,12 +238,12 @@ function formatEnvSnapshotMarkdown(snapshot) {
236
238
  ]),
237
239
  "",
238
240
  ...warningsAndFailures.length > 0 ? [
239
- "## Doctor findings",
241
+ localize("## Doctor findings", "## Doctor 问题"),
240
242
  "",
241
- ...warningsAndFailures.map((check) => `- ${check.status}: ${check.title}${check.fix ? ` (fix: ${check.fix})` : ""}`),
243
+ ...warningsAndFailures.map((check) => localize(`- ${check.status}: ${check.title}${check.fix ? ` (fix: ${check.fix})` : ""}`, `- ${check.status}: ${check.title}${check.fix ? `(修复:${check.fix})` : ""}`)),
242
244
  ""
243
245
  ] : [],
244
- "## Check plan",
246
+ localize("## Check plan", "## 检查计划"),
245
247
  "",
246
248
  ...snapshot.checkPlan.commands.map((command) => `- \`${command.command}\` - ${command.description}`)
247
249
  ].join("\n");
@@ -321,7 +323,7 @@ function formatEnvSupportBundle(bundle) {
321
323
  function formatMarkdownTable$3(rows) {
322
324
  const formatCell = (value) => String(value ?? "-").split("|").join("\\|").split("\n").join("<br>");
323
325
  return [
324
- "| Field | Value |",
326
+ localize("| Field | Value |", "| 字段 | 值 |"),
325
327
  "| --- | --- |",
326
328
  ...rows.map(([label, value]) => `| ${label} | ${formatCell(value)} |`)
327
329
  ].join("\n");
@@ -329,11 +331,11 @@ function formatMarkdownTable$3(rows) {
329
331
  function formatSupportBundleMarkdown(bundle) {
330
332
  const warningsAndFailures = bundle.doctor.checks.filter((check) => check.status !== "pass");
331
333
  return [
332
- "# Repo support bundle",
334
+ localize("# Repo support bundle", "# Repo 支持信息包"),
333
335
  "",
334
- `Generated at: ${bundle.generatedAt}`,
336
+ localize(`Generated at: ${bundle.generatedAt}`, `生成时间:${bundle.generatedAt}`),
335
337
  "",
336
- "## Environment",
338
+ localize("## Environment", "## 环境"),
337
339
  "",
338
340
  formatMarkdownTable$3([
339
341
  ["cwd", bundle.env.cwd],
@@ -345,7 +347,7 @@ function formatSupportBundleMarkdown(bundle) {
345
347
  ["platform", `${bundle.env.platform}/${bundle.env.arch}`]
346
348
  ]),
347
349
  "",
348
- "## Diagnostics",
350
+ localize("## Diagnostics", "## 诊断"),
349
351
  "",
350
352
  formatMarkdownTable$3([
351
353
  ["doctor pass", bundle.doctor.summary.pass],
@@ -356,16 +358,16 @@ function formatSupportBundleMarkdown(bundle) {
356
358
  ]),
357
359
  "",
358
360
  ...warningsAndFailures.length > 0 ? [
359
- "## Doctor findings",
361
+ localize("## Doctor findings", "## Doctor 问题"),
360
362
  "",
361
- ...warningsAndFailures.map((check) => `- ${check.status}: ${check.title}${check.fix ? ` (fix: ${check.fix})` : ""}`),
363
+ ...warningsAndFailures.map((check) => localize(`- ${check.status}: ${check.title}${check.fix ? ` (fix: ${check.fix})` : ""}`, `- ${check.status}: ${check.title}${check.fix ? `(修复:${check.fix})` : ""}`)),
362
364
  ""
363
365
  ] : [],
364
- "## Check plan",
366
+ localize("## Check plan", "## 检查计划"),
365
367
  "",
366
368
  ...bundle.checkPlan.commands.map((command) => `- \`${command.command}\` - ${command.description}`),
367
369
  "",
368
- "## Report paths",
370
+ localize("## Report paths", "## 报告路径"),
369
371
  "",
370
372
  formatMarkdownTable$3([
371
373
  ["doctor", bundle.paths.paths.doctorReport.relativePath],
@@ -408,7 +410,7 @@ async function emitEnvInfo(info, opts, cwd) {
408
410
  }
409
411
  const outFile = path.resolve(cwd, opts.out);
410
412
  await fs.outputFile(outFile, `${content}\n`, "utf8");
411
- logger.success(`wrote ${path.relative(cwd, outFile)}`);
413
+ logger.success(localize(`Wrote ${path.relative(cwd, outFile)}`, `已写入 ${path.relative(cwd, outFile)}`));
412
414
  }
413
415
  async function emitEnvPaths(paths, opts, cwd) {
414
416
  const content = createEnvPathsOutput(paths, opts);
@@ -418,7 +420,7 @@ async function emitEnvPaths(paths, opts, cwd) {
418
420
  }
419
421
  const outFile = path.resolve(cwd, opts.out);
420
422
  await fs.outputFile(outFile, `${content}\n`, "utf8");
421
- logger.success(`wrote ${path.relative(cwd, outFile)}`);
423
+ logger.success(localize(`Wrote ${path.relative(cwd, outFile)}`, `已写入 ${path.relative(cwd, outFile)}`));
422
424
  }
423
425
  async function emitEnvSnapshot(snapshot, opts, cwd) {
424
426
  const content = createEnvSnapshotOutput(snapshot, opts);
@@ -426,7 +428,7 @@ async function emitEnvSnapshot(snapshot, opts, cwd) {
426
428
  else {
427
429
  const outFile = path.resolve(cwd, opts.out);
428
430
  await fs.outputFile(outFile, `${content}\n`, "utf8");
429
- logger.success(`wrote ${path.relative(cwd, outFile)}`);
431
+ logger.success(localize(`Wrote ${path.relative(cwd, outFile)}`, `已写入 ${path.relative(cwd, outFile)}`));
430
432
  }
431
433
  if (opts.strict && hasStrictEnvSnapshotIssues(snapshot)) process.exitCode = 1;
432
434
  }
@@ -436,39 +438,39 @@ async function emitEnvSupportBundle(bundle, opts, cwd) {
436
438
  else {
437
439
  const outFile = path.resolve(cwd, opts.out);
438
440
  await fs.outputFile(outFile, `${content}\n`, "utf8");
439
- logger.success(`wrote ${path.relative(cwd, outFile)}`);
441
+ logger.success(localize(`Wrote ${path.relative(cwd, outFile)}`, `已写入 ${path.relative(cwd, outFile)}`));
440
442
  }
441
443
  if (opts.strict && hasStrictSupportBundleIssues(bundle)) process.exitCode = 1;
442
444
  }
443
445
  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-DwvtvWjz.mjs").then((n) => n.t);
446
+ const envCommand = program.command("env").alias("e").description(localize("Environment and support commands", "环境命令"));
447
+ 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) => {
448
+ const { collectEnvInfo } = await import("./commands-D7bVEzen.mjs").then((n) => n.t);
447
449
  await emitEnvInfo(await collectEnvInfo(cwd), opts, cwd);
448
450
  });
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-DwvtvWjz.mjs").then((n) => n.t);
451
+ 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) => {
452
+ const { collectEnvSnapshot } = await import("./commands-D7bVEzen.mjs").then((n) => n.t);
451
453
  await emitEnvSnapshot(await collectEnvSnapshot(cwd), opts, cwd);
452
454
  });
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-DwvtvWjz.mjs").then((n) => n.t);
455
+ 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) => {
456
+ const { collectEnvPaths } = await import("./commands-D7bVEzen.mjs").then((n) => n.t);
455
457
  await emitEnvPaths(await collectEnvPaths(cwd), opts, cwd);
456
458
  });
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-DwvtvWjz.mjs").then((n) => n.t);
459
+ 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) => {
460
+ const { collectEnvSupportBundle } = await import("./commands-D7bVEzen.mjs").then((n) => n.t);
459
461
  await emitEnvSupportBundle(await collectEnvSupportBundle(cwd), opts, cwd);
460
462
  });
461
- envCommand.command("mirror").description("设置 VS Code binary mirror").alias("m").action(async () => {
462
- const { setVscodeBinaryMirror } = await import("./commands-DwvtvWjz.mjs").then((n) => n.t);
463
+ envCommand.command("mirror").description(localize("Configure the VS Code binary mirror", "设置 VS Code binary mirror")).alias("m").action(async () => {
464
+ const { setVscodeBinaryMirror } = await import("./commands-D7bVEzen.mjs").then((n) => n.t);
463
465
  await setVscodeBinaryMirror(cwd);
464
- logger.success("env mirror finished!");
466
+ logger.success(localize("Environment mirror finished.", "环境镜像完成。"));
465
467
  });
466
468
  }
467
469
  //#endregion
468
470
  //#region src/cli/commands/package.ts
469
471
  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-_VjRtz.mjs");
472
+ 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) => {
473
+ const { runCreateFlow } = await import("./create-flow-DbgrqNec.mjs");
472
474
  const result = await runCreateFlow(cwd, inputName, {
473
475
  ...opts.template !== void 0 ? { template: opts.template } : {},
474
476
  ...opts.dryRun || opts.json || opts.out ? { dryRun: true } : {},
@@ -476,7 +478,7 @@ function registerPackageCommands(program, cwd) {
476
478
  ...opts.out !== void 0 ? { out: opts.out } : {}
477
479
  });
478
480
  if (result.dryRun || result.failed) return;
479
- logger.success("package create finished!");
481
+ logger.success(localize("Package creation finished.", "包创建完成。"));
480
482
  });
481
483
  }
482
484
  //#endregion
@@ -489,72 +491,89 @@ async function runReleaseAction(action) {
489
491
  process.exitCode = 1;
490
492
  }
491
493
  }
494
+ async function resolveReleaseOptions(cwd) {
495
+ const config = await resolveCommandConfig("release", cwd);
496
+ return {
497
+ cwd,
498
+ ...config ? { config } : {}
499
+ };
500
+ }
492
501
  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) => {
502
+ const releaseCommand = program.command("release").description(localize("Release and pnpm versioning commands", "发布与 pnpm versioning 工具集"));
503
+ 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
504
  await runReleaseAction(async () => {
496
- const { releaseCi } = await import("./commands-DwvtvWjz.mjs").then((n) => n.t);
505
+ const { releaseCi } = await import("./commands-D7bVEzen.mjs").then((n) => n.t);
497
506
  await releaseCi({
498
- cwd,
507
+ ...await resolveReleaseOptions(cwd),
499
508
  ...opts.mode ? { mode: opts.mode } : {},
500
509
  ...opts.package ? { packageName: opts.package } : {},
501
510
  ...opts.version ? { packageVersion: opts.version } : {}
502
511
  });
512
+ logger.success(localize("Release CI finished.", "Release CI 完成。"));
503
513
  });
504
514
  });
505
- releaseCommand.command("notes").description("维护 GitHub Release 正文").command("repair").description("按每个发布 tag 对应的 changelog 重建 GitHub Release 正文").option("--all", "修复所有可识别的 GitHub Release").option("--tag <package@version>", "只修复指定 package@version").option("--dry-run", "只生成并统计,不更新 GitHub Release").action(async (opts) => {
515
+ 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) => {
506
516
  await runReleaseAction(async () => {
507
- const { repairReleaseNotes } = await import("./commands-DwvtvWjz.mjs").then((n) => n.t);
517
+ const { repairReleaseNotes } = await import("./commands-D7bVEzen.mjs").then((n) => n.t);
508
518
  const result = await repairReleaseNotes({
509
519
  cwd,
510
520
  ...opts.all ? { all: true } : {},
511
521
  ...opts.tag ? { tag: opts.tag } : {},
512
522
  ...opts.dryRun ? { dryRun: true } : {}
513
523
  });
514
- logger.success(`release notes repaired: ${result.repaired.length}; skipped: ${result.skipped.length}`);
524
+ logger.success(localize(`Release notes repaired: ${result.repaired.length}; skipped: ${result.skipped.length}`, `Release 正文已修复:${result.repaired.length};已跳过:${result.skipped.length}`));
515
525
  });
516
526
  });
517
- const stableCommand = releaseCommand.command("stable").description("在 main 分支执行正式发布").action(async () => {
527
+ const stableCommand = releaseCommand.command("stable").description(localize("Run a stable release from main", "在 main 分支执行正式发布")).action(async () => {
518
528
  await runReleaseAction(async () => {
519
- const { releaseStable } = await import("./commands-DwvtvWjz.mjs").then((n) => n.t);
520
- await releaseStable({ cwd });
521
- logger.success("stable release finished!");
529
+ const { releaseCi } = await import("./commands-D7bVEzen.mjs").then((n) => n.t);
530
+ await releaseCi({
531
+ ...await resolveReleaseOptions(cwd),
532
+ mode: "publish"
533
+ });
534
+ logger.success(localize("Stable release finished.", "稳定版发布完成。"));
522
535
  });
523
536
  });
524
- stableCommand.command("prepare").description("消费 pnpm change intents 并准备 Release PR").action(async () => {
537
+ stableCommand.command("prepare").description(localize("Consume pnpm change intents and prepare a Release PR", "消费 pnpm change intents 并准备 Release PR")).action(async () => {
525
538
  await runReleaseAction(async () => {
526
- const { prepareStable } = await import("./commands-DwvtvWjz.mjs").then((n) => n.t);
527
- await prepareStable({ cwd });
528
- logger.success("stable release preparation finished!");
539
+ const { releaseCi } = await import("./commands-D7bVEzen.mjs").then((n) => n.t);
540
+ await releaseCi({
541
+ ...await resolveReleaseOptions(cwd),
542
+ mode: "prepare"
543
+ });
544
+ logger.success(localize("Stable release preparation finished.", "稳定版发布准备完成。"));
529
545
  });
530
546
  });
531
- stableCommand.command("publish").description("发布 main 分支上尚未发布的包").action(async () => {
547
+ stableCommand.command("publish").description(localize("Publish versions on main that are not yet on npm", "发布 main 分支上尚未发布的包")).action(async () => {
532
548
  await runReleaseAction(async () => {
533
- const { publishStable } = await import("./commands-DwvtvWjz.mjs").then((n) => n.t);
534
- await publishStable({ cwd });
535
- logger.success("stable package publish finished!");
549
+ const { releaseCi } = await import("./commands-D7bVEzen.mjs").then((n) => n.t);
550
+ await releaseCi({
551
+ ...await resolveReleaseOptions(cwd),
552
+ mode: "publish"
553
+ });
554
+ logger.success(localize("Stable package publish finished.", "稳定版包发布完成。"));
536
555
  });
537
556
  });
538
- const preCommand = releaseCommand.command("pre").description("执行或管理 prerelease 发布");
539
- preCommand.command("publish").alias("run").description("在 alpha/beta/rc/next 分支发布 prerelease").action(async () => {
557
+ const preCommand = releaseCommand.command("pre").description(localize("Run or manage prereleases", "执行或管理 prerelease 发布"));
558
+ 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 () => {
540
559
  await runReleaseAction(async () => {
541
- const { releasePrerelease } = await import("./commands-DwvtvWjz.mjs").then((n) => n.t);
542
- await releasePrerelease({ cwd });
543
- logger.success("prerelease finished!");
560
+ const { releaseCi } = await import("./commands-D7bVEzen.mjs").then((n) => n.t);
561
+ await releaseCi(await resolveReleaseOptions(cwd));
562
+ logger.success(localize("Prerelease finished.", "预发布完成。"));
544
563
  });
545
564
  });
546
- preCommand.command("enter").description("进入 pnpm prerelease lane").argument("<tag>", "alpha / beta / rc / next").action(async (tag) => {
565
+ 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) => {
547
566
  await runReleaseAction(async () => {
548
- const { enterPrerelease } = await import("./commands-DwvtvWjz.mjs").then((n) => n.t);
567
+ const { enterPrerelease } = await import("./commands-D7bVEzen.mjs").then((n) => n.t);
549
568
  await enterPrerelease(tag, { cwd });
550
- logger.success(`entered ${tag} prerelease mode!`);
569
+ logger.success(localize(`Entered ${tag} prerelease mode.`, `已进入 ${tag} 预发布模式。`));
551
570
  });
552
571
  });
553
- preCommand.command("exit").description("退出 pnpm prerelease lane").action(async () => {
572
+ preCommand.command("exit").description(localize("Exit the pnpm prerelease lane", "退出 pnpm prerelease lane")).action(async () => {
554
573
  await runReleaseAction(async () => {
555
- const { exitPrerelease } = await import("./commands-DwvtvWjz.mjs").then((n) => n.t);
574
+ const { exitPrerelease } = await import("./commands-D7bVEzen.mjs").then((n) => n.t);
556
575
  await exitPrerelease({ cwd });
557
- logger.success("exited prerelease mode!");
576
+ logger.success(localize("Exited prerelease mode.", "已退出预发布模式。"));
558
577
  });
559
578
  });
560
579
  }
@@ -562,8 +581,8 @@ function registerReleaseCommands(program, cwd) {
562
581
  //#region src/cli/commands/skills.ts
563
582
  const skillTargets = ["codex", "claude"];
564
583
  function registerSkillsCommands(program, cwd) {
565
- 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) => {
566
- const { syncSkills } = await import("./commands-DwvtvWjz.mjs").then((n) => n.t);
584
+ 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) => {
585
+ const { syncSkills } = await import("./commands-D7bVEzen.mjs").then((n) => n.t);
567
586
  const selected = /* @__PURE__ */ new Set();
568
587
  if (opts.all) for (const target of skillTargets) selected.add(target);
569
588
  else {
@@ -575,11 +594,11 @@ function registerSkillsCommands(program, cwd) {
575
594
  targets: [...selected]
576
595
  } : { cwd });
577
596
  if (!results.length) {
578
- logger.info("未选择任何目标,已跳过同步。");
597
+ logger.info(localize("No target selected; synchronization skipped.", "未选择任何目标,已跳过同步。"));
579
598
  return;
580
599
  }
581
- logger.info(`[已同步的目标]:\n${results.map((item) => `- ${item.target}: ${item.dest}`).join("\n")}\n`);
582
- logger.success("skills sync finished!");
600
+ logger.info(`${localize("[synchronized targets]", "[已同步的目标]")}:\n${results.map((item) => `- ${item.target}: ${item.dest}`).join("\n")}\n`);
601
+ logger.success(localize("Skill synchronization finished.", "Skill 同步完成。"));
583
602
  });
584
603
  }
585
604
  //#endregion
@@ -593,9 +612,9 @@ function formatTemplateTable(choices) {
593
612
  }));
594
613
  const headers = {
595
614
  key: "key",
596
- category: "category",
597
- target: "target",
598
- description: "description"
615
+ category: localize("category", "分类"),
616
+ target: localize("target", "目标"),
617
+ description: localize("description", "说明")
599
618
  };
600
619
  const widths = {
601
620
  key: Math.max(headers.key.length, ...rows.map((row) => row.key.length)),
@@ -611,11 +630,11 @@ function formatTemplateTable(choices) {
611
630
  function formatTemplateDetail(choice) {
612
631
  return [
613
632
  `key: ${choice.key}`,
614
- `label: ${choice.label}`,
615
- `category: ${choice.category ?? "-"}`,
616
- `source: templates/${choice.source}`,
617
- `default target: ${choice.target}`,
618
- `description: ${choice.description ?? "-"}`
633
+ localize(`label: ${choice.label}`, `标签:${choice.label}`),
634
+ localize(`category: ${choice.category ?? "-"}`, `分类:${choice.category ?? "-"}`),
635
+ localize(`source: templates/${choice.source}`, `源目录:templates/${choice.source}`),
636
+ localize(`default target: ${choice.target}`, `默认目标:${choice.target}`),
637
+ localize(`description: ${choice.description ?? "-"}`, `说明:${choice.description ?? "-"}`)
619
638
  ].join("\n");
620
639
  }
621
640
  function escapeMarkdownTableCell(value) {
@@ -623,7 +642,7 @@ function escapeMarkdownTableCell(value) {
623
642
  }
624
643
  function formatTemplateMarkdownTable(choices) {
625
644
  return [
626
- "| Key | Category | Source | Default target | Description |",
645
+ localize("| Key | Category | Source | Default target | Description |", "| Key | 分类 | 源目录 | 默认目标 | 说明 |"),
627
646
  "| --- | --- | --- | --- | --- |",
628
647
  ...choices.map((choice) => [
629
648
  `\`${choice.key}\``,
@@ -640,12 +659,12 @@ function formatTemplateMarkdownDetail(choice) {
640
659
  "",
641
660
  choice.description ?? "",
642
661
  "",
643
- "| Field | Value |",
662
+ localize("| Field | Value |", "| 字段 | 值 |"),
644
663
  "| --- | --- |",
645
- `| Label | ${escapeMarkdownTableCell(choice.label)} |`,
646
- `| Category | ${escapeMarkdownTableCell(choice.category ?? "-")} |`,
647
- `| Source | \`templates/${escapeMarkdownTableCell(choice.source)}\` |`,
648
- `| Default target | \`${escapeMarkdownTableCell(choice.target)}\` |`
664
+ localize(`| Label | ${escapeMarkdownTableCell(choice.label)} |`, `| 标签 | ${escapeMarkdownTableCell(choice.label)} |`),
665
+ localize(`| Category | ${escapeMarkdownTableCell(choice.category ?? "-")} |`, `| 分类 | ${escapeMarkdownTableCell(choice.category ?? "-")} |`),
666
+ localize(`| Source | \`templates/${escapeMarkdownTableCell(choice.source)}\` |`, `| 源目录 | \`templates/${escapeMarkdownTableCell(choice.source)}\` |`),
667
+ localize(`| Default target | \`${escapeMarkdownTableCell(choice.target)}\` |`, `| 默认目标 | \`${escapeMarkdownTableCell(choice.target)}\` |`)
649
668
  ].join("\n");
650
669
  }
651
670
  function formatTemplateHealthStatus(status) {
@@ -656,18 +675,18 @@ function formatTemplateHealthStatus(status) {
656
675
  function formatTemplateHealthReport(report, color = false) {
657
676
  const status = color ? formatTemplateHealthStatus : (value) => value.toUpperCase();
658
677
  const lines = [
659
- `templates: ${report.templatesDir}`,
660
- `count: ${report.templateCount}`,
678
+ localize(`templates: ${report.templatesDir}`, `模板目录:${report.templatesDir}`),
679
+ localize(`count: ${report.templateCount}`, `数量:${report.templateCount}`),
661
680
  ""
662
681
  ];
663
682
  for (const check of report.checks) {
664
683
  const prefix = check.template ? `${check.template}: ` : "";
665
684
  lines.push(`[${status(check.status)}] ${prefix}${check.title}`);
666
685
  lines.push(` ${check.detail}`);
667
- if (check.fix) lines.push(` fix: ${check.fix}`);
686
+ if (check.fix) lines.push(localize(` fix: ${check.fix}`, ` 修复:${check.fix}`));
668
687
  }
669
688
  lines.push("");
670
- 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`);
689
+ 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} 失败`));
671
690
  return lines.join("\n");
672
691
  }
673
692
  async function emitTemplateOutput(content, options) {
@@ -677,13 +696,13 @@ async function emitTemplateOutput(content, options) {
677
696
  }
678
697
  const outFile = path.resolve(process.cwd(), options.out);
679
698
  await fs.outputFile(outFile, `${content}\n`, "utf8");
680
- logger.success(`wrote ${path.relative(process.cwd(), outFile)}`);
699
+ logger.success(localize(`Wrote ${path.relative(process.cwd(), outFile)}`, `已写入 ${path.relative(process.cwd(), outFile)}`));
681
700
  }
682
701
  function registerTemplatesCommands(program) {
683
- 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) => {
702
+ 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) => {
684
703
  const { getTemplateChoice, getTemplateChoices, isTemplateCategory, suggestTemplateKey, templateCategories } = await import("@icebreakers/monorepo-templates");
685
704
  if (opts.check) {
686
- const { checkTemplates } = await import("./commands-DwvtvWjz.mjs").then((n) => n.t);
705
+ const { checkTemplates } = await import("./commands-D7bVEzen.mjs").then((n) => n.t);
687
706
  const report = await checkTemplates();
688
707
  if (opts.json) await emitTemplateOutput(JSON.stringify(report, null, 2), opts);
689
708
  else await emitTemplateOutput(formatTemplateHealthReport(report, !opts.out), opts);
@@ -693,10 +712,10 @@ function registerTemplatesCommands(program) {
693
712
  if (key) {
694
713
  const choice = getTemplateChoice(key);
695
714
  if (!choice) {
696
- logger.error(`unknown template: ${key}`);
715
+ logger.error(localize(`Unknown template: ${key}`, `未知模板:${key}`));
697
716
  const suggestion = suggestTemplateKey(key);
698
- if (suggestion) logger.info(`did you mean \`${suggestion}\`?`);
699
- logger.info("run `repo templates` to list available templates");
717
+ if (suggestion) logger.info(localize(`Did you mean \`${suggestion}\`?`, `你是否想使用 \`${suggestion}\`?`));
718
+ logger.info(localize("Run `repo templates` to list available templates.", "运行 `repo templates` 查看可用模板。"));
700
719
  process.exitCode = 1;
701
720
  return;
702
721
  }
@@ -708,15 +727,15 @@ function registerTemplatesCommands(program) {
708
727
  await emitTemplateOutput(formatTemplateMarkdownDetail(choice), opts);
709
728
  return;
710
729
  }
711
- await emitTemplateOutput(`Template detail:\n${formatTemplateDetail(choice)}`, opts);
712
- if (!opts.out) logger.info(`next: run \`repo new <name> --template ${choice.key}\``);
730
+ await emitTemplateOutput(localize(`Template detail:\n${formatTemplateDetail(choice)}`, `模板详情:\n${formatTemplateDetail(choice)}`), opts);
731
+ if (!opts.out) logger.info(localize(`Next: run \`repo new <name> --template ${choice.key}\`.`, `下一步:运行 \`repo new <name> --template ${choice.key}\`。`));
713
732
  return;
714
733
  }
715
734
  let category;
716
735
  if (opts.category) {
717
736
  if (!isTemplateCategory(opts.category)) {
718
- logger.error(`unknown template category: ${opts.category}`);
719
- logger.info(`available categories: ${templateCategories.join(", ")}`);
737
+ logger.error(localize(`Unknown template category: ${opts.category}`, `未知模板分类:${opts.category}`));
738
+ logger.info(localize(`Available categories: ${templateCategories.join(", ")}`, `可用分类:${templateCategories.join(", ")}`));
720
739
  process.exitCode = 1;
721
740
  return;
722
741
  }
@@ -731,8 +750,8 @@ function registerTemplatesCommands(program) {
731
750
  await emitTemplateOutput(formatTemplateMarkdownTable(choices), opts);
732
751
  return;
733
752
  }
734
- await emitTemplateOutput(`Available templates:\n${formatTemplateTable(choices)}`, opts);
735
- if (!opts.out) logger.info("next: run `repo new <name> --template <key>`");
753
+ await emitTemplateOutput(localize(`Available templates:\n${formatTemplateTable(choices)}`, `可用模板:\n${formatTemplateTable(choices)}`), opts);
754
+ if (!opts.out) logger.info(localize("Next: run `repo new <name> --template <key>`.", "下一步:运行 `repo new <name> --template <key>`。"));
736
755
  });
737
756
  }
738
757
  //#endregion
@@ -754,29 +773,29 @@ function normalizeCleanOptions(opts) {
754
773
  function normalizeToolingTargets(tooling) {
755
774
  if (!tooling.length) return;
756
775
  const unknown = tooling.filter((item) => !initToolingTargets.includes(item));
757
- if (unknown.length > 0) throw new Error(`未知的 init tooling 目标: ${unknown.join(", ")}`);
776
+ if (unknown.length > 0) throw new Error(localize(`Unknown init tooling target: ${unknown.join(", ")}`, `未知的 init tooling 目标: ${unknown.join(", ")}`));
758
777
  return tooling;
759
778
  }
760
779
  //#endregion
761
780
  //#region src/cli/commands/tooling.ts
762
781
  function registerToolingCommands(program, cwd) {
763
- 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) => {
782
+ 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) => {
764
783
  const normalizedTooling = normalizeToolingTargets(tooling);
765
- const { initTooling } = await import("./commands-DwvtvWjz.mjs").then((n) => n.t);
784
+ const { initTooling } = await import("./commands-D7bVEzen.mjs").then((n) => n.t);
766
785
  await initTooling(cwd, {
767
786
  ...normalizedTooling ? { targets: normalizedTooling } : {},
768
787
  ...opts.all !== void 0 ? { all: opts.all } : {},
769
788
  ...opts.force !== void 0 ? { force: opts.force } : {}
770
789
  });
771
- logger.success("tooling init finished!");
790
+ logger.success(localize("Tooling initialization finished.", "Tooling 初始化完成。"));
772
791
  });
773
792
  }
774
793
  //#endregion
775
794
  //#region src/cli/commands/check/output.ts
776
795
  function formatCheckPlan(plan) {
777
796
  const lines = [
778
- `cwd: ${plan.cwd}`,
779
- `mode: ${plan.mode}`,
797
+ localize(`cwd: ${plan.cwd}`, `当前目录:${plan.cwd}`),
798
+ localize(`mode: ${plan.mode}`, `模式:${plan.mode}`),
780
799
  ""
781
800
  ];
782
801
  for (const command of plan.commands) {
@@ -788,14 +807,14 @@ function formatCheckPlan(plan) {
788
807
  function formatMarkdownTable$2(rows) {
789
808
  const formatCell = (value) => String(value ?? "-").split("|").join("\\|").split("\n").join("<br>");
790
809
  return [
791
- "| Field | Value |",
810
+ localize("| Field | Value |", "| 字段 | 值 |"),
792
811
  "| --- | --- |",
793
812
  ...rows.map(([label, value]) => `| ${label} | ${formatCell(value)} |`)
794
813
  ].join("\n");
795
814
  }
796
815
  function formatCheckPlanMarkdown(plan) {
797
816
  return [
798
- "# Repo check plan",
817
+ localize("# Repo check plan", "# Repo 检查计划"),
799
818
  "",
800
819
  formatMarkdownTable$2([
801
820
  ["cwd", plan.cwd],
@@ -803,7 +822,7 @@ function formatCheckPlanMarkdown(plan) {
803
822
  ["commands", plan.commands.length]
804
823
  ]),
805
824
  "",
806
- "## Commands",
825
+ localize("## Commands", "## 命令"),
807
826
  "",
808
827
  ...plan.commands.map((command) => `- \`${command.command}\` - ${command.description}`)
809
828
  ].join("\n");
@@ -836,23 +855,23 @@ function formatDoctorStatus(status) {
836
855
  function formatDoctorReport(report, color = false) {
837
856
  const status = color ? formatDoctorStatus : (value) => value.toUpperCase();
838
857
  const lines = [
839
- `workspace: ${report.workspaceDir}`,
840
- `packages: ${report.packageCount}`,
858
+ localize(`workspace: ${report.workspaceDir}`, `工作区:${report.workspaceDir}`),
859
+ localize(`packages: ${report.packageCount}`, `包数量:${report.packageCount}`),
841
860
  ""
842
861
  ];
843
862
  for (const check of report.checks) {
844
863
  lines.push(`[${status(check.status)}] ${check.title}`);
845
864
  lines.push(` ${check.detail}`);
846
- if (check.fix) lines.push(` fix: ${check.fix}`);
865
+ if (check.fix) lines.push(localize(` fix: ${check.fix}`, ` 修复:${check.fix}`));
847
866
  }
848
867
  lines.push("");
849
- 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`);
868
+ 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} 失败`));
850
869
  return lines.join("\n");
851
870
  }
852
871
  function formatMarkdownTable$1(rows) {
853
872
  const formatCell = (value) => String(value ?? "-").split("|").join("\\|").split("\n").join("<br>");
854
873
  return [
855
- "| Field | Value |",
874
+ localize("| Field | Value |", "| 字段 | 值 |"),
856
875
  "| --- | --- |",
857
876
  ...rows.map(([label, value]) => `| ${label} | ${formatCell(value)} |`)
858
877
  ].join("\n");
@@ -860,7 +879,7 @@ function formatMarkdownTable$1(rows) {
860
879
  function formatDoctorMarkdown(report) {
861
880
  const warningsAndFailures = report.checks.filter((check) => check.status !== "pass");
862
881
  return [
863
- "# Repo doctor report",
882
+ localize("# Repo doctor report", "# Repo doctor 诊断报告"),
864
883
  "",
865
884
  formatMarkdownTable$1([
866
885
  ["workspace", report.workspaceDir],
@@ -871,12 +890,12 @@ function formatDoctorMarkdown(report) {
871
890
  ]),
872
891
  "",
873
892
  ...warningsAndFailures.length > 0 ? [
874
- "## Findings",
893
+ localize("## Findings", "## 问题"),
875
894
  "",
876
- ...warningsAndFailures.map((check) => `- ${check.status}: ${check.title}${check.fix ? ` (fix: ${check.fix})` : ""}`),
895
+ ...warningsAndFailures.map((check) => localize(`- ${check.status}: ${check.title}${check.fix ? ` (fix: ${check.fix})` : ""}`, `- ${check.status}: ${check.title}${check.fix ? `(修复:${check.fix})` : ""}`)),
877
896
  ""
878
897
  ] : [],
879
- "## Checks",
898
+ localize("## Checks", "## 检查项"),
880
899
  "",
881
900
  ...report.checks.map((check) => `- ${check.status}: ${check.title}`)
882
901
  ].join("\n");
@@ -919,7 +938,7 @@ async function emitDoctorReport(report, opts, cwd) {
919
938
  }
920
939
  const outFile = path.resolve(cwd, opts.out);
921
940
  await fs.outputFile(outFile, `${content}\n`, "utf8");
922
- logger.success(`wrote ${path.relative(cwd, outFile)}`);
941
+ logger.success(localize(`Wrote ${path.relative(cwd, outFile)}`, `已写入 ${path.relative(cwd, outFile)}`));
923
942
  }
924
943
  async function emitCheckPlan(plan, opts, cwd) {
925
944
  const content = createCheckPlanOutput(plan, opts);
@@ -929,22 +948,22 @@ async function emitCheckPlan(plan, opts, cwd) {
929
948
  }
930
949
  const outFile = path.resolve(cwd, opts.out);
931
950
  await fs.outputFile(outFile, `${content}\n`, "utf8");
932
- logger.success(`wrote ${path.relative(cwd, outFile)}`);
951
+ logger.success(localize(`Wrote ${path.relative(cwd, outFile)}`, `已写入 ${path.relative(cwd, outFile)}`));
933
952
  }
934
953
  function registerTopLevelCommands(program, cwd) {
935
- 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) => {
936
- const { init } = await import("./commands-DwvtvWjz.mjs").then((n) => n.t);
954
+ 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) => {
955
+ const { init } = await import("./commands-D7bVEzen.mjs").then((n) => n.t);
937
956
  await init(cwd, {
938
957
  ...opts.preset !== void 0 ? { preset: opts.preset } : {},
939
958
  ...opts.force !== void 0 ? { force: opts.force } : {},
940
959
  ...opts.overwrite !== void 0 ? { overwrite: opts.overwrite } : {},
941
960
  ...opts.yes !== void 0 ? { yes: opts.yes } : {}
942
961
  });
943
- logger.success("init finished!");
944
- logger.info("next: run `pnpm install` and `pnpm build`");
962
+ logger.success(localize("Initialization finished.", "初始化完成。"));
963
+ logger.info(localize("Next: run `pnpm install` and `pnpm build`.", "下一步:运行 `pnpm install` 和 `pnpm build`。"));
945
964
  });
946
- 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) => {
947
- const { runCreateFlow } = await import("./create-flow-D-_VjRtz.mjs");
965
+ 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) => {
966
+ const { runCreateFlow } = await import("./create-flow-DbgrqNec.mjs");
948
967
  const result = await runCreateFlow(cwd, inputName, {
949
968
  ...opts.template !== void 0 ? { template: opts.template } : {},
950
969
  ...opts.dryRun || opts.json || opts.out ? { dryRun: true } : {},
@@ -952,20 +971,20 @@ function registerTopLevelCommands(program, cwd) {
952
971
  ...opts.out !== void 0 ? { out: opts.out } : {}
953
972
  });
954
973
  if (result.dryRun || result.failed) return;
955
- logger.success("new finished!");
956
- logger.info("next: run `pnpm install` and start the new workspace package");
974
+ logger.success(localize("Package creation finished.", "包创建完成。"));
975
+ logger.info(localize("Next: run `pnpm install` and start the new workspace package.", "下一步:运行 `pnpm install`,然后启动新 workspace 包。"));
957
976
  });
958
- 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) => {
977
+ 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) => {
959
978
  const options = {
960
979
  cwd,
961
980
  ...opts.full !== void 0 ? { full: opts.full } : {},
962
981
  ...opts.staged !== void 0 ? { staged: opts.staged } : {},
963
982
  ...opts.editFile !== void 0 ? { editFile: opts.editFile } : {}
964
983
  };
965
- const { resolveRecommendedCheckPlan, runRecommendedCheck } = await import("./commands-DwvtvWjz.mjs").then((n) => n.t);
984
+ const { resolveRecommendedCheckPlan, runRecommendedCheck } = await import("./commands-D7bVEzen.mjs").then((n) => n.t);
966
985
  if (opts.dryRun || opts.json || opts.markdown || opts.out) {
967
986
  if (opts.full) {
968
- const { resolveFullWorkspaceCheckPlan } = await import("./commands-DwvtvWjz.mjs").then((n) => n.t);
987
+ const { resolveFullWorkspaceCheckPlan } = await import("./commands-D7bVEzen.mjs").then((n) => n.t);
969
988
  await emitCheckPlan(await resolveFullWorkspaceCheckPlan(cwd), opts, cwd);
970
989
  return;
971
990
  }
@@ -973,10 +992,10 @@ function registerTopLevelCommands(program, cwd) {
973
992
  return;
974
993
  }
975
994
  await runRecommendedCheck(options);
976
- logger.success("check finished!");
995
+ logger.success(localize("Checks finished.", "检查完成。"));
977
996
  });
978
- 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) => {
979
- const { runDoctor } = await import("./commands-DwvtvWjz.mjs").then((n) => n.t);
997
+ 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) => {
998
+ const { runDoctor } = await import("./commands-D7bVEzen.mjs").then((n) => n.t);
980
999
  const report = await runDoctor(cwd);
981
1000
  await emitDoctorReport(report, opts, cwd);
982
1001
  if (opts.out || opts.json || opts.markdown) {
@@ -984,47 +1003,47 @@ function registerTopLevelCommands(program, cwd) {
984
1003
  return;
985
1004
  }
986
1005
  if (report.summary.fail > 0) {
987
- logger.error(`doctor found ${report.summary.fail} blocking issue(s).`);
1006
+ logger.error(localize(`Doctor found ${report.summary.fail} blocking issue(s).`, `Doctor 发现 ${report.summary.fail} 个阻断问题。`));
988
1007
  process.exitCode = 1;
989
1008
  return;
990
1009
  }
991
1010
  if (report.summary.warn > 0) {
992
1011
  if (opts.strict) {
993
- logger.error(`doctor found ${report.summary.warn} warning(s) in strict mode.`);
1012
+ logger.error(localize(`Doctor found ${report.summary.warn} warning(s) in strict mode.`, `严格模式下 doctor 发现 ${report.summary.warn} 个警告。`));
994
1013
  process.exitCode = 1;
995
1014
  return;
996
1015
  }
997
- logger.warn(`doctor found ${report.summary.warn} suggestion(s).`);
1016
+ logger.warn(localize(`Doctor found ${report.summary.warn} suggestion(s).`, `Doctor 提供了 ${report.summary.warn} 条建议。`));
998
1017
  }
999
- logger.success("doctor finished!");
1018
+ logger.success(localize("Doctor finished.", "Doctor 诊断完成。"));
1000
1019
  });
1001
- 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) => {
1002
- const { upgradeMonorepo } = await import("./commands-DwvtvWjz.mjs").then((n) => n.t);
1020
+ 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) => {
1021
+ const { upgradeMonorepo } = await import("./commands-D7bVEzen.mjs").then((n) => n.t);
1003
1022
  await upgradeMonorepo(normalizeCliOpts(cwd, opts));
1004
- logger.success("upgrade finished!");
1023
+ logger.success(localize("Upgrade finished.", "升级完成。"));
1005
1024
  });
1006
1025
  }
1007
1026
  //#endregion
1008
1027
  //#region src/cli/commands/verify.ts
1009
1028
  function registerVerifyCommands(program, cwd) {
1010
- const verifyCommand = program.command("verify").alias("v").description("本地校验工具集");
1011
- verifyCommand.command("pre-push").description("按推送变更范围执行 build/test/tsd 校验").alias("push").action(async () => {
1012
- const { verifyPrePush } = await import("./commands-DwvtvWjz.mjs").then((n) => n.t);
1029
+ const verifyCommand = program.command("verify").alias("v").description(localize("Local verification commands", "本地校验工具集"));
1030
+ verifyCommand.command("pre-push").description(localize("Run build, test, and tsd checks for pushed changes", "按推送变更范围执行 build/test/tsd 校验")).alias("push").action(async () => {
1031
+ const { verifyPrePush } = await import("./commands-D7bVEzen.mjs").then((n) => n.t);
1013
1032
  await verifyPrePush({ cwd });
1014
1033
  });
1015
- verifyCommand.command("pre-commit").description("执行 lint-staged 校验").alias("commit").action(async () => {
1016
- const { verifyPreCommit } = await import("./commands-DwvtvWjz.mjs").then((n) => n.t);
1034
+ verifyCommand.command("pre-commit").description(localize("Run lint-staged verification", "执行 lint-staged 校验")).alias("commit").action(async () => {
1035
+ const { verifyPreCommit } = await import("./commands-D7bVEzen.mjs").then((n) => n.t);
1017
1036
  await verifyPreCommit({ cwd });
1018
1037
  });
1019
- verifyCommand.command("commit-msg").description("执行 commitlint 校验").alias("msg").argument("<edit-file>").action(async (editFile) => {
1020
- const { verifyCommitMsg } = await import("./commands-DwvtvWjz.mjs").then((n) => n.t);
1038
+ verifyCommand.command("commit-msg").description(localize("Run commitlint verification", "执行 commitlint 校验")).alias("msg").argument("<edit-file>").action(async (editFile) => {
1039
+ const { verifyCommitMsg } = await import("./commands-D7bVEzen.mjs").then((n) => n.t);
1021
1040
  await verifyCommitMsg({
1022
1041
  cwd,
1023
1042
  editFile
1024
1043
  });
1025
1044
  });
1026
- verifyCommand.command("staged-typecheck").description("按暂存文件所在 workspace 执行 typecheck").alias("tc").argument("[files...]").action(async (files = []) => {
1027
- const { verifyStagedTypecheck } = await import("./commands-DwvtvWjz.mjs").then((n) => n.t);
1045
+ verifyCommand.command("staged-typecheck").description(localize("Run typecheck in workspaces containing staged files", "按暂存文件所在 workspace 执行 typecheck")).alias("tc").argument("[files...]").action(async (files = []) => {
1046
+ const { verifyStagedTypecheck } = await import("./commands-D7bVEzen.mjs").then((n) => n.t);
1028
1047
  verifyStagedTypecheck(files, { cwd });
1029
1048
  });
1030
1049
  }
@@ -1034,10 +1053,10 @@ function collectValues(value, previous = []) {
1034
1053
  return [...previous, value];
1035
1054
  }
1036
1055
  function formatWorkspaceList(result) {
1037
- const lines = [`workspace: ${result.workspaceDir}`, `packages: ${result.packages.length}`];
1056
+ const lines = [localize(`workspace: ${result.workspaceDir}`, `工作区:${result.workspaceDir}`), localize(`packages: ${result.packages.length}`, `包数量:${result.packages.length}`)];
1038
1057
  for (const pkg of result.packages) {
1039
- const name = pkg.name ?? "(unnamed)";
1040
- const privateMark = pkg.private ? " private" : "";
1058
+ const name = pkg.name ?? localize("(unnamed)", "(未命名)");
1059
+ const privateMark = pkg.private ? localize(" private", " 私有") : "";
1041
1060
  lines.push(`- ${name} ${pkg.relativeDir}${privateMark}`);
1042
1061
  }
1043
1062
  return lines.join("\n");
@@ -1047,14 +1066,14 @@ function formatMarkdownCell(value) {
1047
1066
  }
1048
1067
  function formatMarkdownTable(rows) {
1049
1068
  return [
1050
- "| Field | Value |",
1069
+ localize("| Field | Value |", "| 字段 | 值 |"),
1051
1070
  "| --- | --- |",
1052
1071
  ...rows.map(([label, value]) => `| ${label} | ${formatMarkdownCell(value)} |`)
1053
1072
  ].join("\n");
1054
1073
  }
1055
1074
  function formatWorkspaceListMarkdown(result) {
1056
1075
  return [
1057
- "# Repo workspaces",
1076
+ localize("# Repo workspaces", "# Repo 工作区"),
1058
1077
  "",
1059
1078
  formatMarkdownTable([
1060
1079
  ["cwd", result.cwd],
@@ -1062,14 +1081,14 @@ function formatWorkspaceListMarkdown(result) {
1062
1081
  ["packages", result.packages.length]
1063
1082
  ]),
1064
1083
  "",
1065
- "## Packages",
1084
+ localize("## Packages", "## 包"),
1066
1085
  "",
1067
- "| Name | Path | Private | Description |",
1086
+ localize("| Name | Path | Private | Description |", "| 名称 | 路径 | 私有 | 说明 |"),
1068
1087
  "| --- | --- | --- | --- |",
1069
1088
  ...result.packages.map((pkg) => {
1070
- const name = pkg.name ?? "(unnamed)";
1089
+ const name = pkg.name ?? localize("(unnamed)", "(未命名)");
1071
1090
  const description = pkg.description ?? "-";
1072
- return `| ${formatMarkdownCell(name)} | ${formatMarkdownCell(pkg.relativeDir)} | ${pkg.private ? "yes" : "no"} | ${formatMarkdownCell(description)} |`;
1091
+ return `| ${formatMarkdownCell(name)} | ${formatMarkdownCell(pkg.relativeDir)} | ${pkg.private ? localize("yes", "是") : localize("no", "否")} | ${formatMarkdownCell(description)} |`;
1073
1092
  })
1074
1093
  ].join("\n");
1075
1094
  }
@@ -1098,21 +1117,21 @@ async function emitWorkspaceList(result, opts) {
1098
1117
  }
1099
1118
  const outFile = path.resolve(process.cwd(), opts.out);
1100
1119
  await fs.outputFile(outFile, `${content}\n`, "utf8");
1101
- logger.success(`wrote ${path.relative(process.cwd(), outFile)}`);
1120
+ logger.success(localize(`Wrote ${path.relative(process.cwd(), outFile)}`, `已写入 ${path.relative(process.cwd(), outFile)}`));
1102
1121
  }
1103
1122
  function registerWorkspaceCommands(program, cwd) {
1104
- const workspaceCommand = program.command("workspace").alias("ws").description("工作区命令");
1105
- 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) => {
1106
- const { upgradeMonorepo } = await import("./commands-DwvtvWjz.mjs").then((n) => n.t);
1123
+ const workspaceCommand = program.command("workspace").alias("ws").description(localize("Workspace commands", "工作区命令"));
1124
+ 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) => {
1125
+ const { upgradeMonorepo } = await import("./commands-D7bVEzen.mjs").then((n) => n.t);
1107
1126
  await upgradeMonorepo(normalizeCliOpts(cwd, opts));
1108
- logger.success("workspace upgrade finished!");
1127
+ logger.success(localize("Workspace upgrade finished.", "Workspace 升级完成。"));
1109
1128
  });
1110
- workspaceCommand.command("init").description("初始化工作区元信息(README、package.json、pnpm intent、issue template)").alias("i").action(async () => {
1111
- const { initMetadata } = await import("./commands-DwvtvWjz.mjs").then((n) => n.t);
1129
+ workspaceCommand.command("init").description(localize("Initialize workspace metadata and repository files", "初始化工作区元信息(README、package.json、pnpm intent、issue template)")).alias("i").action(async () => {
1130
+ const { initMetadata } = await import("./commands-D7bVEzen.mjs").then((n) => n.t);
1112
1131
  await initMetadata(cwd);
1113
- logger.success("workspace init finished!");
1132
+ logger.success(localize("Workspace initialization finished.", "Workspace 初始化完成。"));
1114
1133
  });
1115
- 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) => {
1134
+ 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) => {
1116
1135
  const { getWorkspacePackageSummaries } = await import("./workspace-MCKewElu.mjs").then((n) => n.a);
1117
1136
  await emitWorkspaceList(await getWorkspacePackageSummaries(cwd, {
1118
1137
  ignorePrivatePackage: !opts.includePrivate,
@@ -1120,17 +1139,41 @@ function registerWorkspaceCommands(program, cwd) {
1120
1139
  ...opts.pattern?.length ? { patterns: opts.pattern } : {}
1121
1140
  }), opts);
1122
1141
  });
1123
- workspaceCommand.command("clean").description("清除选中的包").alias("rm").option("-y, --yes", "跳过交互直接清理(等价 autoConfirm)").option("--include-private", "包含 private 包").option("--pinned-version <version>", "覆盖写入的 repoctl 版本").action(async (opts) => {
1124
- const { cleanProjects } = await import("./commands-DwvtvWjz.mjs").then((n) => n.t);
1142
+ 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) => {
1143
+ const { cleanProjects } = await import("./commands-D7bVEzen.mjs").then((n) => n.t);
1125
1144
  await cleanProjects(cwd, normalizeCleanOptions(opts));
1126
- logger.success("workspace clean finished!");
1145
+ logger.success(localize("Workspace cleanup finished.", "Workspace 清理完成。"));
1127
1146
  });
1128
1147
  }
1129
1148
  //#endregion
1130
1149
  //#region src/cli/program.ts
1131
1150
  const cwd = process.cwd();
1132
1151
  const program = new Command();
1133
- program.name(cliName).version(version).description("One-command repo initialization and maintenance for pnpm/turbo workspaces.");
1152
+ const activeCliName = path$1.basename(process.argv[1] ?? "", path$1.extname(process.argv[1] ?? "")) === "repoctl" ? "repoctl" : cliName;
1153
+ function localizeHelpMetadata(value) {
1154
+ return value.replaceAll("choices:", message("choicesLabel")).replaceAll("default:", message("defaultLabel")).replaceAll("preset:", message("presetLabel")).replaceAll("env:", message("envLabel"));
1155
+ }
1156
+ function localizeCommanderError(value) {
1157
+ 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"));
1158
+ }
1159
+ function configureLocalizedHelp(command) {
1160
+ const defaultHelp = command.createHelp();
1161
+ const titles = {
1162
+ "Arguments:": message("argumentsTitle"),
1163
+ "Commands:": message("commandsTitle"),
1164
+ "Global Options:": message("globalOptionsTitle"),
1165
+ "Options:": message("optionsTitle"),
1166
+ "Usage:": message("usageTitle")
1167
+ };
1168
+ command.helpOption("-h, --help", message("helpOption")).configureOutput({ outputError: (value, write) => write(localizeCommanderError(value)) }).configureHelp({
1169
+ argumentDescription: (argument) => localizeHelpMetadata(defaultHelp.argumentDescription(argument)),
1170
+ optionDescription: (option) => localizeHelpMetadata(defaultHelp.optionDescription(option)),
1171
+ styleTitle: (title) => titles[title] ?? title
1172
+ });
1173
+ if (command.commands.length) command.addHelpCommand("help [command]", message("helpCommand"));
1174
+ command.commands.forEach(configureLocalizedHelp);
1175
+ }
1176
+ program.name(activeCliName).version(version, "-V, --version", message("versionOption")).description(message("cliDescription")).addOption(new Option("--lang <locale>", message("languageOption")).choices([...supportedLocales]));
1134
1177
  registerTopLevelCommands(program, cwd);
1135
1178
  registerTemplatesCommands(program);
1136
1179
  registerWorkspaceCommands(program, cwd);
@@ -1142,24 +1185,8 @@ registerSkillsCommands(program, cwd);
1142
1185
  registerVerifyCommands(program, cwd);
1143
1186
  registerAiCommands(program, cwd);
1144
1187
  registerPackageCommands(program, cwd);
1145
- program.addHelpText("after", `
1146
- Quick start:
1147
- Existing repo:
1148
- $ ${cliName} init
1149
- $ ${cliName} doctor
1150
- $ ${cliName} templates
1151
- $ ${cliName} new my-package
1152
- $ ${cliName} check
1153
-
1154
- Faster in generated repos:
1155
- $ pnpm run repo:init
1156
- $ pnpm run repo:doctor
1157
- $ pnpm run repo:new -- my-package
1158
- $ pnpm run repo:check
1159
-
1160
- Keep the repo current:
1161
- $ ${cliName} upgrade
1162
- `);
1188
+ configureLocalizedHelp(program);
1189
+ program.addHelpText("after", message("quickStart", { cliName: activeCliName }));
1163
1190
  //#endregion
1164
1191
  //#region src/cli.ts
1165
1192
  if (process.argv.length <= 2) program.outputHelp();