Skip to content

Commit 06210a4

Browse files
committed
feat(i18n): localize newly added CLI help content
1 parent e31addf commit 06210a4

46 files changed

Lines changed: 1169 additions & 302 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

AGENTS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ CLI 只为「自己能权威解释的错误」发出语义化信号,服务端的
122122

123123
例外: 仅当作用域极小(≤3 行)且语义从上下文完全明确时,可使用 `k`/`v`(Object.entries 的 key/value)。
124124

125+
### 6. 用户可见 CLI 文案必须支持中英文
126+
127+
新增或修改用户可见的 CLI 文案时必须同时提供 `en-US` / `zh-CN`;runtime 公共文案遵循同一规则,服务端错误仍按第 3 节原样透传。命令文案的具体检查项见 [command-add-remove.md](docs/agents/command-add-remove.md)
128+
125129
## 完成改动后的快速验证
126130

127131
```sh

docs/agents/command-add-remove.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ packages/commands/src/index.ts
7474
- 普通业务命令的 `run(ctx)` 只读 `ctx.flags` / `ctx.settings` / `ctx.client`
7575
- `commands/auth/**` 可用 `ctx.authStore`,`commands/config/**` 可用 `ctx.configStore`;不要把这些持久化能力扩散到普通业务命令
7676
- `commands/plugin/**` 可用 `ctx.commandPacks`;产品 policy 由 runtime 绑定,命令不要自行 import 产品入口
77+
- [ ] 用户可见 Help 文案在命令文件中就近提供 `en-US` / `zh-CN`:命令 `description`、flag `description``notes` 和包含自然语言的 `exampleArgs`;纯命令语法示例可保留为字符串,服务端错误不翻译
7778
- [ ] `packages/commands/src/index.ts`:新增或移除对应 export
7879
- [ ] 如果命令调用 Console Gateway,设置 `auth: "console"`;不要重复声明 console 凭证域 flags
7980
- [ ] 如果命令不需要网络或自己管理配置/登录,设置 `auth: "none"`;不要绕过 runtime auth stage

packages/commands/src/commands/deploy/pause.ts

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,18 @@ const PAUSE_FLAGS = {
1313
deployedModel: {
1414
type: "string",
1515
valueHint: "<id>",
16-
description: "Deployed model identifier (required)",
16+
description: {
17+
"en-US": "Deployed model identifier (required)",
18+
"zh-CN": "已部署模型标识(必填)",
19+
},
1720
required: true,
1821
},
1922
skipPrecheck: {
2023
type: "switch",
21-
description: "Skip the local RUNNING/PENDING status precheck",
24+
description: {
25+
"en-US": "Skip the local RUNNING/PENDING status precheck",
26+
"zh-CN": "跳过本地 RUNNING/PENDING 状态预检查",
27+
},
2228
},
2329
} satisfies FlagsDef;
2430

@@ -30,7 +36,10 @@ const PAUSE_FLAGS = {
3036
* Precheck: status must be RUNNING or PENDING.
3137
*/
3238
export default defineCommand({
33-
description: "Pause a running model deployment (stops billing for mu/ptu)",
39+
description: {
40+
"en-US": "Pause a running model deployment (stops billing for mu/ptu)",
41+
"zh-CN": "暂停运行中的模型部署(mu/ptu 方案将停止计费)",
42+
},
3443
auth: "console",
3544
usageArgs: "--deployed-model <id> [--skip-precheck]",
3645
flags: PAUSE_FLAGS,
@@ -40,8 +49,18 @@ export default defineCommand({
4049
"--deployed-model dep-... --dry-run",
4150
],
4251
notes: [
43-
"While paused, billing ceases for mu/ptu plans. Use `deploy resume` to bring it back online or `deploy delete` to remove.",
44-
"Precheck verifies status is RUNNING/PENDING before issuing the pause; pass --skip-precheck to bypass.",
52+
{
53+
"en-US":
54+
"While paused, billing ceases for mu/ptu plans. Use `deploy resume` to bring it back online or `deploy delete` to remove.",
55+
"zh-CN":
56+
"暂停期间,mu/ptu 方案将停止计费。使用 `deploy resume` 恢复服务,或使用 `deploy delete` 删除部署。",
57+
},
58+
{
59+
"en-US":
60+
"Precheck verifies status is RUNNING/PENDING before issuing the pause; pass --skip-precheck to bypass.",
61+
"zh-CN":
62+
"发起暂停前会预检查部署状态是否为 RUNNING/PENDING;可传入 --skip-precheck 跳过检查。",
63+
},
4564
],
4665
async run(ctx) {
4766
const { settings, flags } = ctx;

packages/commands/src/commands/deploy/resume.ts

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,18 @@ const RESUME_FLAGS = {
1313
deployedModel: {
1414
type: "string",
1515
valueHint: "<id>",
16-
description: "Deployed model identifier (required)",
16+
description: {
17+
"en-US": "Deployed model identifier (required)",
18+
"zh-CN": "已部署模型标识(必填)",
19+
},
1720
required: true,
1821
},
1922
skipPrecheck: {
2023
type: "switch",
21-
description: "Skip the local STOPPED status precheck",
24+
description: {
25+
"en-US": "Skip the local STOPPED status precheck",
26+
"zh-CN": "跳过本地 STOPPED 状态预检查",
27+
},
2228
},
2329
} satisfies FlagsDef;
2430

@@ -29,7 +35,10 @@ const RESUME_FLAGS = {
2935
* Precheck: status must be STOPPED.
3036
*/
3137
export default defineCommand({
32-
description: "Resume a paused model deployment (brings service back online)",
38+
description: {
39+
"en-US": "Resume a paused model deployment (brings service back online)",
40+
"zh-CN": "恢复已暂停的模型部署(使服务重新上线)",
41+
},
3342
auth: "console",
3443
usageArgs: "--deployed-model <id> [--skip-precheck]",
3544
flags: RESUME_FLAGS,
@@ -39,8 +48,15 @@ export default defineCommand({
3948
"--deployed-model dep-... --dry-run",
4049
],
4150
notes: [
42-
"Precheck verifies status is STOPPED before issuing the resume; pass --skip-precheck to bypass.",
43-
"For mu/ptu plans, billing resumes once the service is back online.",
51+
{
52+
"en-US":
53+
"Precheck verifies status is STOPPED before issuing the resume; pass --skip-precheck to bypass.",
54+
"zh-CN": "发起恢复前会预检查部署状态是否为 STOPPED;可传入 --skip-precheck 跳过检查。",
55+
},
56+
{
57+
"en-US": "For mu/ptu plans, billing resumes once the service is back online.",
58+
"zh-CN": "对于 mu/ptu 方案,服务重新上线后将恢复计费。",
59+
},
4460
],
4561
async run(ctx) {
4662
const { settings, flags } = ctx;

packages/commands/src/commands/finetune/list.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ const LIST_FLAGS = {
2626
baseModel: {
2727
type: "string",
2828
valueHint: "<model>",
29-
description: "Filter by base model ID (server-side)",
29+
description: {
30+
"en-US": "Filter by base model ID (server-side)",
31+
"zh-CN": "按基础模型 ID 筛选(服务端筛选)",
32+
},
3033
},
3134
} satisfies FlagsDef;
3235

packages/commands/src/commands/finetune/price.ts

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,36 @@ const PRICE_FLAGS = {
1313
baseModel: {
1414
type: "string",
1515
valueHint: "<model>",
16-
description: "Base model to fine-tune (e.g. qwen3-8b; not the output model name)",
16+
description: {
17+
"en-US": "Base model to fine-tune (e.g. qwen3-8b; not the output model name)",
18+
"zh-CN": "待微调的基座模型(例如 qwen3-8b;不是输出模型名称)",
19+
},
1720
required: true,
1821
},
1922
datasets: {
2023
type: "string",
2124
valueHint: "<ids>",
22-
description: "Training dataset file IDs, comma-separated (required)",
25+
description: {
26+
"en-US": "Training dataset file IDs, comma-separated (required)",
27+
"zh-CN": "训练数据集文件 ID,多个以逗号分隔(必填)",
28+
},
2329
required: true,
2430
},
2531
trainingType: {
2632
type: "string",
2733
valueHint: "<type>",
28-
description: "Training type: sft | dpo | cpt (default: sft)",
34+
description: {
35+
"en-US": "Training type: sft | dpo | cpt (default: sft)",
36+
"zh-CN": "训练类型:sft | dpo | cpt(默认:sft)",
37+
},
2938
},
3039
nEpochs: {
3140
type: "number",
3241
valueHint: "<n>",
33-
description: "Number of training epochs (default: 3)",
42+
description: {
43+
"en-US": "Number of training epochs (default: 3)",
44+
"zh-CN": "训练轮数(默认:3)",
45+
},
3446
},
3547
} satisfies FlagsDef;
3648

@@ -44,7 +56,10 @@ const ESTIMATE_MAX_LENGTH = 8192;
4456
const DEFAULT_N_EPOCHS = 3;
4557

4658
export default defineCommand({
47-
description: "Estimate the training cost for a fine-tune job (token billing)",
59+
description: {
60+
"en-US": "Estimate the training cost for a fine-tune job (token billing)",
61+
"zh-CN": "估算微调任务的训练费用(按 Token 计费)",
62+
},
4863
auth: "console",
4964
usageArgs: "--base-model <model> --datasets <ids> [--training-type <type>] [--n-epochs <n>]",
5065
flags: PRICE_FLAGS,
@@ -54,9 +69,21 @@ export default defineCommand({
5469
"--base-model qwen3-8b --datasets file-ft-xxx --training-type cpt",
5570
],
5671
notes: [
57-
"Estimate only — the server computes token usage from the datasets; final cost is subject to the bill.",
58-
"Covers token billing for sft / dpo / cpt. Training-unit (MTU) billing is not supported by this command.",
59-
"Hyper-parameters other than --n-epochs are fixed at representative defaults for estimation.",
72+
{
73+
"en-US":
74+
"Estimate only — the server computes token usage from the datasets; final cost is subject to the bill.",
75+
"zh-CN": "该结果仅为估算值——服务端根据数据集计算 Token 用量,最终费用以账单为准。",
76+
},
77+
{
78+
"en-US":
79+
"Covers token billing for sft / dpo / cpt. Training-unit (MTU) billing is not supported by this command.",
80+
"zh-CN": "支持估算 sft / dpo / cpt 的 Token 计费;此命令不支持训练单元(MTU)计费估算。",
81+
},
82+
{
83+
"en-US":
84+
"Hyper-parameters other than --n-epochs are fixed at representative defaults for estimation.",
85+
"zh-CN": "除 --n-epochs 外,其他超参数会使用具有代表性的固定默认值进行估算。",
86+
},
6087
],
6188
async run(ctx) {
6289
const { settings, flags } = ctx;

packages/commands/src/commands/knowledge/category-add.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,39 @@ const CATEGORY_ADD_FLAGS = {
1313
name: {
1414
type: "string",
1515
valueHint: "<text>",
16-
description: "Category name (1-20 chars)",
16+
description: { "en-US": "Category name (1-20 chars)", "zh-CN": "类目名称(1–20 个字符)" },
1717
required: true,
1818
},
1919
parentId: {
2020
type: "string",
2121
valueHint: "<id>",
22-
description: "Create as a sub-category of this category",
22+
description: {
23+
"en-US": "Create as a sub-category of this category",
24+
"zh-CN": "创建为该类目的子类目",
25+
},
2326
},
2427
collectionId: {
2528
type: "string",
2629
valueHint: "<id>",
27-
description: "Create under this collection (defaults to the platform collection)",
30+
description: {
31+
"en-US": "Create under this collection (defaults to the platform collection)",
32+
"zh-CN": "在该数据集合下创建(默认为平台数据集合)",
33+
},
2834
},
2935
...WORKSPACE_FLAG,
3036
} satisfies FlagsDef;
3137

3238
export default defineCommand({
33-
description: "Create a data-center category",
39+
description: { "en-US": "Create a data-center category", "zh-CN": "创建数据中心类目" },
3440
auth: "apiKey",
3541
usageArgs: "--name <text> [flags]",
3642
flags: CATEGORY_ADD_FLAGS,
37-
notes: ["Use categories to organize data-center files by business domain."],
43+
notes: [
44+
{
45+
"en-US": "Use categories to organize data-center files by business domain.",
46+
"zh-CN": "使用类目按业务领域组织数据中心文件。",
47+
},
48+
],
3849
exampleArgs: ["--name product-docs --workspace-id ws-xxx", "--name sub --parent-id cate-xxx"],
3950
validate(flags) {
4051
if (flags.name.length < 1 || flags.name.length > 20) return "--name must be 1-20 characters";

packages/commands/src/commands/knowledge/category-delete.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,27 @@ const CATEGORY_DELETE_FLAGS = {
1313
categoryId: {
1414
type: "string",
1515
valueHint: "<id>",
16-
description: "Category ID to delete",
16+
description: { "en-US": "Category ID to delete", "zh-CN": "要删除的类目 ID" },
1717
required: true,
1818
},
19-
yes: { type: "switch", description: "Skip the confirmation prompt" },
19+
yes: {
20+
type: "switch",
21+
description: { "en-US": "Skip the confirmation prompt", "zh-CN": "跳过确认提示" },
22+
},
2023
...WORKSPACE_FLAG,
2124
} satisfies FlagsDef;
2225

2326
export default defineCommand({
24-
description: "Delete a data-center category",
27+
description: { "en-US": "Delete a data-center category", "zh-CN": "删除数据中心类目" },
2528
auth: "apiKey",
2629
usageArgs: "--category-id <id> [flags]",
2730
flags: CATEGORY_DELETE_FLAGS,
2831
notes: [
29-
"Behavior for categories containing files or sub-categories is server-defined — the server error is passed through as-is.",
32+
{
33+
"en-US":
34+
"Behavior for categories containing files or sub-categories is server-defined — the server error is passed through as-is.",
35+
"zh-CN": "包含文件或子类目时的处理行为由服务端定义——服务端返回的错误将原样透传。",
36+
},
3037
],
3138
exampleArgs: ["--category-id cate-xxx --workspace-id ws-xxx", "--category-id cate-xxx --yes"],
3239
async run(ctx) {

packages/commands/src/commands/knowledge/category-list.ts

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,54 @@ const CATEGORY_LIST_FLAGS = {
1313
collectionId: {
1414
type: "string",
1515
valueHint: "<id>",
16-
description: "Filter by exact collection ID",
16+
description: { "en-US": "Filter by exact collection ID", "zh-CN": "按数据集合 ID 精确筛选" },
1717
},
1818
parentId: {
1919
type: "string",
2020
valueHint: "<id>",
21-
description: "List sub-categories of this exact parent category",
21+
description: {
22+
"en-US": "List sub-categories of this exact parent category",
23+
"zh-CN": "列出该父类目下的子类目",
24+
},
2225
},
2326
name: {
2427
type: "string",
2528
valueHint: "<text>",
26-
description: "Filter by category name (exact match, unlike the knowledge base list)",
29+
description: {
30+
"en-US": "Filter by category name (exact match, unlike the knowledge base list)",
31+
"zh-CN": "按类目名称筛选(精确匹配,与知识库列表不同)",
32+
},
2733
},
2834
nextToken: {
2935
type: "string",
3036
valueHint: "<token>",
31-
description: "Cursor for the next page (from previous output)",
37+
description: {
38+
"en-US": "Cursor for the next page (from previous output)",
39+
"zh-CN": "下一页游标(来自上一次输出)",
40+
},
3241
},
3342
maxResult: {
3443
type: "number",
3544
valueHint: "<n>",
36-
description: "Items per page (default: 20)",
45+
description: { "en-US": "Items per page (default: 20)", "zh-CN": "每页条目数(默认:20)" },
3746
},
3847
...WORKSPACE_FLAG,
3948
} satisfies FlagsDef;
4049

4150
export default defineCommand({
42-
description: "List data-center categories",
51+
description: { "en-US": "List data-center categories", "zh-CN": "列出数据中心类目" },
4352
auth: "apiKey",
4453
usageArgs: "[flags]",
4554
flags: CATEGORY_LIST_FLAGS,
4655
notes: [
47-
"Categories marked [default] are where files land when no category is specified.",
48-
"Pagination is cursor-based: reuse the printed next token to continue.",
56+
{
57+
"en-US": "Categories marked [default] are where files land when no category is specified.",
58+
"zh-CN": "未指定类目时,文件会进入标记为 [default] 的类目。",
59+
},
60+
{
61+
"en-US": "Pagination is cursor-based: reuse the printed next token to continue.",
62+
"zh-CN": "分页使用游标:复用输出中的 next token 继续查询。",
63+
},
4964
],
5065
exampleArgs: ["--workspace-id ws-xxx", "--name my-category", "--next-token <token>"],
5166
async run(ctx) {

0 commit comments

Comments
 (0)