diff --git a/AGENTS.md b/AGENTS.md index 51afe94..0c52651 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -93,6 +93,18 @@ CLI 只为「自己能权威解释的错误」发出语义化信号,服务端的 不要扮演服务端错误的翻译官——我们没有最新的错误码体系认知,二次包装只会撒谎(详见 `docs/agents/error-hint-change.md` 中的反面 case)。 +### 4. Console Gateway 命令必须声明 console 全局 flags + +如果新命令使用了 `callConsoleGateway`,必须在 `options` 中添加以下三个全局 flag 的说明,以便 `--help` 中展示: + +```ts +{ flag: "--console-region ", description: "Console region (global flag)" }, +{ flag: "--console-site ", description: "Console site: domestic, international (global flag)" }, +{ flag: "--console-switch-agent ", description: "Switch agent UID (global flag)", type: "number" }, +``` + +这些 flag 已在 `GLOBAL_OPTIONS`(`packages/core/src/types/command.ts`)中注册,由 `loadConfig` 写入 `config.consoleRegion` / `config.consoleSite` / `config.consoleSwitchAgent`,`callConsoleGateway` 自动读取——命令无需手动提取或传递。 + ## 完成改动后的快速验证 ```sh diff --git a/packages/cli/src/commands/app/list.ts b/packages/cli/src/commands/app/list.ts index 28e55b2..185ed24 100644 --- a/packages/cli/src/commands/app/list.ts +++ b/packages/cli/src/commands/app/list.ts @@ -29,6 +29,16 @@ export default defineCommand({ description: "Results per page (default: 30)", type: "number", }, + { flag: "--console-region ", description: "Console region (global flag)" }, + { + flag: "--console-site ", + description: "Console site: domestic, international (global flag)", + }, + { + flag: "--console-switch-agent ", + description: "Switch agent UID (global flag)", + type: "number", + }, ], examples: [ "bl app list", diff --git a/packages/cli/src/commands/auth/status.ts b/packages/cli/src/commands/auth/status.ts index 7ea9b85..5276638 100644 --- a/packages/cli/src/commands/auth/status.ts +++ b/packages/cli/src/commands/auth/status.ts @@ -142,6 +142,18 @@ export default defineCommand({ name: "auth status", description: "Show current authentication state", usage: "bl auth status", + options: [ + { flag: "--console-region ", description: "Console region (global flag)" }, + { + flag: "--console-site ", + description: "Console site: domestic, international (global flag)", + }, + { + flag: "--console-switch-agent ", + description: "Switch agent UID (global flag)", + type: "number", + }, + ], examples: ["bl auth status", "bl auth status --output json"], async run(config: Config, _flags: GlobalFlags) { const format = detectOutputFormat(config.output); diff --git a/packages/cli/src/commands/console/call.ts b/packages/cli/src/commands/console/call.ts index d953a4f..b278fa5 100644 --- a/packages/cli/src/commands/console/call.ts +++ b/packages/cli/src/commands/console/call.ts @@ -27,6 +27,16 @@ export default defineCommand({ description: "Request data as JSON string", required: true, }, + { flag: "--console-region ", description: "Console region (global flag)" }, + { + flag: "--console-site ", + description: "Console site: domestic, international (global flag)", + }, + { + flag: "--console-switch-agent ", + description: "Switch agent UID (global flag)", + type: "number", + }, ], examples: [ `bl console call --api zeldaEasy.broadscope-bailian.freeTrial.queryFreeTierQuota --data '{"queryFreeTierQuotaRequest":{"models":["qwen3-max"]}}'`, diff --git a/packages/cli/src/commands/mcp/list.ts b/packages/cli/src/commands/mcp/list.ts index 6d39c71..48b7c42 100644 --- a/packages/cli/src/commands/mcp/list.ts +++ b/packages/cli/src/commands/mcp/list.ts @@ -36,6 +36,16 @@ export default defineCommand({ }, { flag: "--page ", description: "Page number (default: 1)", type: "number" }, { flag: "--page-size ", description: "Results per page (default: 30)", type: "number" }, + { flag: "--console-region ", description: "Console region (global flag)" }, + { + flag: "--console-site ", + description: "Console site: domestic, international (global flag)", + }, + { + flag: "--console-switch-agent ", + description: "Switch agent UID (global flag)", + type: "number", + }, ], examples: ["bl mcp list", "bl mcp list --name 金融", "bl mcp list --output json"], async run(config: Config, flags: GlobalFlags) { diff --git a/packages/cli/src/commands/quota/check.ts b/packages/cli/src/commands/quota/check.ts index c6b6179..09065cc 100644 --- a/packages/cli/src/commands/quota/check.ts +++ b/packages/cli/src/commands/quota/check.ts @@ -254,6 +254,16 @@ export default defineCommand({ flag: "--period ", description: "Query usage for the last N minutes (default: 2)", }, + { flag: "--console-region ", description: "Console region (global flag)" }, + { + flag: "--console-site ", + description: "Console site: domestic, international (global flag)", + }, + { + flag: "--console-switch-agent ", + description: "Switch agent UID (global flag)", + type: "number", + }, ], examples: [ "bl quota check", diff --git a/packages/cli/src/commands/quota/history.ts b/packages/cli/src/commands/quota/history.ts index 284cea4..3d6593c 100644 --- a/packages/cli/src/commands/quota/history.ts +++ b/packages/cli/src/commands/quota/history.ts @@ -114,6 +114,16 @@ export default defineCommand({ flag: "--model ", description: "Filter by model name", }, + { flag: "--console-region ", description: "Console region (global flag)" }, + { + flag: "--console-site ", + description: "Console site: domestic, international (global flag)", + }, + { + flag: "--console-switch-agent ", + description: "Switch agent UID (global flag)", + type: "number", + }, ], examples: [ "bl quota history", diff --git a/packages/cli/src/commands/quota/list.ts b/packages/cli/src/commands/quota/list.ts index 40e9a80..06e2b2a 100644 --- a/packages/cli/src/commands/quota/list.ts +++ b/packages/cli/src/commands/quota/list.ts @@ -169,6 +169,16 @@ export default defineCommand({ flag: "--all", description: "Show all models, not just self-service ones", }, + { flag: "--console-region ", description: "Console region (global flag)" }, + { + flag: "--console-site ", + description: "Console site: domestic, international (global flag)", + }, + { + flag: "--console-switch-agent ", + description: "Switch agent UID (global flag)", + type: "number", + }, ], examples: [ "bl quota list", diff --git a/packages/cli/src/commands/quota/request.ts b/packages/cli/src/commands/quota/request.ts index c554c42..89c7660 100644 --- a/packages/cli/src/commands/quota/request.ts +++ b/packages/cli/src/commands/quota/request.ts @@ -96,6 +96,16 @@ export default defineCommand({ flag: "--yes", description: "Skip downgrade confirmation", }, + { flag: "--console-region ", description: "Console region (global flag)" }, + { + flag: "--console-site ", + description: "Console site: domestic, international (global flag)", + }, + { + flag: "--console-switch-agent ", + description: "Switch agent UID (global flag)", + type: "number", + }, ], examples: [ "bl quota request --model qwen-turbo --tpm 100000", diff --git a/packages/cli/src/commands/usage/free.ts b/packages/cli/src/commands/usage/free.ts index 433085e..d6ef941 100644 --- a/packages/cli/src/commands/usage/free.ts +++ b/packages/cli/src/commands/usage/free.ts @@ -207,6 +207,16 @@ export default defineCommand({ flag: "--sort ", description: "Sort by: remaining (ascending), expires (ascending)", }, + { flag: "--console-region ", description: "Console region (global flag)" }, + { + flag: "--console-site ", + description: "Console site: domestic, international (global flag)", + }, + { + flag: "--console-switch-agent ", + description: "Switch agent UID (global flag)", + type: "number", + }, ], examples: [ "bl usage free", diff --git a/packages/cli/src/commands/usage/freetier.ts b/packages/cli/src/commands/usage/freetier.ts index 5b1d191..ec820ec 100644 --- a/packages/cli/src/commands/usage/freetier.ts +++ b/packages/cli/src/commands/usage/freetier.ts @@ -121,6 +121,16 @@ export default defineCommand({ flag: "--off", description: "Disable auto-stop", }, + { flag: "--console-region ", description: "Console region (global flag)" }, + { + flag: "--console-site ", + description: "Console site: domestic, international (global flag)", + }, + { + flag: "--console-switch-agent ", + description: "Switch agent UID (global flag)", + type: "number", + }, ], examples: [ "bl usage freetier --model qwen3-max", diff --git a/packages/cli/src/commands/usage/stats.ts b/packages/cli/src/commands/usage/stats.ts index 9587bfc..46d0f49 100644 --- a/packages/cli/src/commands/usage/stats.ts +++ b/packages/cli/src/commands/usage/stats.ts @@ -323,6 +323,16 @@ export default defineCommand({ flag: "--workspace-id ", description: "Workspace ID (env: BAILIAN_WORKSPACE_ID)", }, + { flag: "--console-region ", description: "Console region (global flag)" }, + { + flag: "--console-site ", + description: "Console site: domestic, international (global flag)", + }, + { + flag: "--console-switch-agent ", + description: "Switch agent UID (global flag)", + type: "number", + }, ], examples: [ "bl usage stats", diff --git a/packages/cli/src/commands/workspace/list.ts b/packages/cli/src/commands/workspace/list.ts index 4e869e6..3a95362 100644 --- a/packages/cli/src/commands/workspace/list.ts +++ b/packages/cli/src/commands/workspace/list.ts @@ -93,6 +93,16 @@ export default defineCommand({ flag: "--list ", description: "Limit number of results", }, + { flag: "--console-region ", description: "Console region (global flag)" }, + { + flag: "--console-site ", + description: "Console site: domestic, international (global flag)", + }, + { + flag: "--console-switch-agent ", + description: "Switch agent UID (global flag)", + type: "number", + }, ], examples: ["bl workspace list", "bl workspace list --list 5", "bl workspace list --output json"], async run(config: Config, flags: GlobalFlags) { diff --git a/skills/bailian-cli/reference/app.md b/skills/bailian-cli/reference/app.md index edbd154..7a1bc95 100644 --- a/skills/bailian-cli/reference/app.md +++ b/skills/bailian-cli/reference/app.md @@ -73,11 +73,14 @@ bl app call --app-id abc123 --prompt "开始" --biz-params '{"key":"value"}' #### Options -| Flag | Type | Required | Description | -| ----------------- | ------ | -------- | ----------------------------------- | -| `--name ` | string | no | Filter by app name (keyword search) | -| `--page ` | number | no | Page number (default: 1) | -| `--page-size ` | number | no | Results per page (default: 30) | +| Flag | Type | Required | Description | +| ------------------------------ | ------ | -------- | --------------------------------------------------- | +| `--name ` | string | no | Filter by app name (keyword search) | +| `--page ` | number | no | Page number (default: 1) | +| `--page-size ` | number | no | Results per page (default: 30) | +| `--console-region ` | string | no | Console region (global flag) | +| `--console-site ` | string | no | Console site: domestic, international (global flag) | +| `--console-switch-agent ` | number | no | Switch agent UID (global flag) | #### Examples diff --git a/skills/bailian-cli/reference/auth.md b/skills/bailian-cli/reference/auth.md index d12269e..f0e5f4f 100644 --- a/skills/bailian-cli/reference/auth.md +++ b/skills/bailian-cli/reference/auth.md @@ -84,7 +84,11 @@ bl auth logout --yes #### Options -_No command-specific options._ +| Flag | Type | Required | Description | +| ------------------------------ | ------ | -------- | --------------------------------------------------- | +| `--console-region ` | string | no | Console region (global flag) | +| `--console-site ` | string | no | Console site: domestic, international (global flag) | +| `--console-switch-agent ` | number | no | Switch agent UID (global flag) | #### Examples diff --git a/skills/bailian-cli/reference/console.md b/skills/bailian-cli/reference/console.md index bb3a0c8..e6b6b57 100644 --- a/skills/bailian-cli/reference/console.md +++ b/skills/bailian-cli/reference/console.md @@ -23,10 +23,13 @@ Index: [index.md](index.md) #### Options -| Flag | Type | Required | Description | -| --------------- | ------ | -------- | ------------------------------------------------------------------------ | -| `--api ` | string | yes | API name (e.g. zeldaEasy.broadscope-bailian.memory-library.getLibraries) | -| `--data ` | string | yes | Request data as JSON string | +| Flag | Type | Required | Description | +| ------------------------------ | ------ | -------- | ------------------------------------------------------------------------ | +| `--api ` | string | yes | API name (e.g. zeldaEasy.broadscope-bailian.memory-library.getLibraries) | +| `--data ` | string | yes | Request data as JSON string | +| `--console-region ` | string | no | Console region (global flag) | +| `--console-site ` | string | no | Console site: domestic, international (global flag) | +| `--console-switch-agent ` | number | no | Switch agent UID (global flag) | #### Examples diff --git a/skills/bailian-cli/reference/mcp.md b/skills/bailian-cli/reference/mcp.md index b84b94e..bd22232 100644 --- a/skills/bailian-cli/reference/mcp.md +++ b/skills/bailian-cli/reference/mcp.md @@ -57,12 +57,15 @@ bl mcp call market-cmapi00073529.SmartFundSelection --arg riskLevel=R3 --arg min #### Options -| Flag | Type | Required | Description | -| ----------------- | ------ | -------- | ---------------------------------------------------- | -| `--name ` | string | no | Filter by server name (substring match) | -| `--type ` | string | no | Server type: OFFICIAL \| PRIVATE (default: OFFICIAL) | -| `--page ` | number | no | Page number (default: 1) | -| `--page-size ` | number | no | Results per page (default: 30) | +| Flag | Type | Required | Description | +| ------------------------------ | ------ | -------- | ---------------------------------------------------- | +| `--name ` | string | no | Filter by server name (substring match) | +| `--type ` | string | no | Server type: OFFICIAL \| PRIVATE (default: OFFICIAL) | +| `--page ` | number | no | Page number (default: 1) | +| `--page-size ` | number | no | Results per page (default: 30) | +| `--console-region ` | string | no | Console region (global flag) | +| `--console-site ` | string | no | Console site: domestic, international (global flag) | +| `--console-switch-agent ` | number | no | Switch agent UID (global flag) | #### Examples diff --git a/skills/bailian-cli/reference/quota.md b/skills/bailian-cli/reference/quota.md index 9b4ad06..9f7a68c 100644 --- a/skills/bailian-cli/reference/quota.md +++ b/skills/bailian-cli/reference/quota.md @@ -26,10 +26,13 @@ Index: [index.md](index.md) #### Options -| Flag | Type | Required | Description | -| -------------------- | ------ | -------- | ----------------------------------------------- | -| `--model ` | string | no | Model name(s), comma-separated | -| `--period ` | string | no | Query usage for the last N minutes (default: 2) | +| Flag | Type | Required | Description | +| ------------------------------ | ------ | -------- | --------------------------------------------------- | +| `--model ` | string | no | Model name(s), comma-separated | +| `--period ` | string | no | Query usage for the last N minutes (default: 2) | +| `--console-region ` | string | no | Console region (global flag) | +| `--console-site ` | string | no | Console site: domestic, international (global flag) | +| `--console-switch-agent ` | number | no | Switch agent UID (global flag) | #### Examples @@ -63,11 +66,14 @@ bl quota check --output json #### Options -| Flag | Type | Required | Description | -| ----------------- | ------ | -------- | ------------------------ | -| `--page ` | string | no | Page number (default: 1) | -| `--page-size ` | string | no | Page size (default: 10) | -| `--model ` | string | no | Filter by model name | +| Flag | Type | Required | Description | +| ------------------------------ | ------ | -------- | --------------------------------------------------- | +| `--page ` | string | no | Page number (default: 1) | +| `--page-size ` | string | no | Page size (default: 10) | +| `--model ` | string | no | Filter by model name | +| `--console-region ` | string | no | Console region (global flag) | +| `--console-site ` | string | no | Console site: domestic, international (global flag) | +| `--console-switch-agent ` | number | no | Switch agent UID (global flag) | #### Examples @@ -101,10 +107,13 @@ bl quota history --output json #### Options -| Flag | Type | Required | Description | -| ----------------- | ------- | -------- | ------------------------------------------- | -| `--model ` | string | no | Model name(s), comma-separated | -| `--all` | boolean | no | Show all models, not just self-service ones | +| Flag | Type | Required | Description | +| ------------------------------ | ------- | -------- | --------------------------------------------------- | +| `--model ` | string | no | Model name(s), comma-separated | +| `--all` | boolean | no | Show all models, not just self-service ones | +| `--console-region ` | string | no | Console region (global flag) | +| `--console-site ` | string | no | Console site: domestic, international (global flag) | +| `--console-switch-agent ` | number | no | Switch agent UID (global flag) | #### Examples @@ -138,11 +147,14 @@ bl quota list --output json #### Options -| Flag | Type | Required | Description | -| ----------------- | ------- | -------- | --------------------------- | -| `--model ` | string | yes | Model name (required) | -| `--tpm ` | string | yes | Target TPM value (required) | -| `--yes` | boolean | no | Skip downgrade confirmation | +| Flag | Type | Required | Description | +| ------------------------------ | ------- | -------- | --------------------------------------------------- | +| `--model ` | string | yes | Model name (required) | +| `--tpm ` | string | yes | Target TPM value (required) | +| `--yes` | boolean | no | Skip downgrade confirmation | +| `--console-region ` | string | no | Console region (global flag) | +| `--console-site ` | string | no | Console site: domestic, international (global flag) | +| `--console-switch-agent ` | number | no | Switch agent UID (global flag) | #### Examples diff --git a/skills/bailian-cli/reference/usage.md b/skills/bailian-cli/reference/usage.md index 9b9449c..66f6256 100644 --- a/skills/bailian-cli/reference/usage.md +++ b/skills/bailian-cli/reference/usage.md @@ -25,11 +25,14 @@ Index: [index.md](index.md) #### Options -| Flag | Type | Required | Description | -| ------------------- | ------ | -------- | ------------------------------------------------------------------------- | -| `--model ` | string | no | Model name(s) to query, comma-separated for multiple; omit for all models | -| `--expiring ` | string | no | Only show quotas expiring within N days | -| `--sort ` | string | no | Sort by: remaining (ascending), expires (ascending) | +| Flag | Type | Required | Description | +| ------------------------------ | ------ | -------- | ------------------------------------------------------------------------- | +| `--model ` | string | no | Model name(s) to query, comma-separated for multiple; omit for all models | +| `--expiring ` | string | no | Only show quotas expiring within N days | +| `--sort ` | string | no | Sort by: remaining (ascending), expires (ascending) | +| `--console-region ` | string | no | Console region (global flag) | +| `--console-site ` | string | no | Console site: domestic, international (global flag) | +| `--console-switch-agent ` | number | no | Switch agent UID (global flag) | #### Examples @@ -71,12 +74,15 @@ bl usage free --model qwen3-max --console-region cn-beijing #### Options -| Flag | Type | Required | Description | -| ----------------- | ------- | -------- | ------------------------------------------- | -| `--model ` | string | no | Model name(s), comma-separated for multiple | -| `--all` | boolean | no | Apply to all free-tier models | -| `--on` | boolean | no | Enable auto-stop (default behavior) | -| `--off` | boolean | no | Disable auto-stop | +| Flag | Type | Required | Description | +| ------------------------------ | ------- | -------- | --------------------------------------------------- | +| `--model ` | string | no | Model name(s), comma-separated for multiple | +| `--all` | boolean | no | Apply to all free-tier models | +| `--on` | boolean | no | Enable auto-stop (default behavior) | +| `--off` | boolean | no | Disable auto-stop | +| `--console-region ` | string | no | Console region (global flag) | +| `--console-site ` | string | no | Console site: domestic, international (global flag) | +| `--console-switch-agent ` | number | no | Switch agent UID (global flag) | #### Examples @@ -114,12 +120,15 @@ bl usage freetier --off --all #### Options -| Flag | Type | Required | Description | -| --------------------- | ------ | -------- | ------------------------------------------------------ | -| `--model ` | string | no | Model name(s), comma-separated; omit for overview | -| `--days ` | string | no | Number of days (default: 7) | -| `--type ` | string | no | Model type: Text, Vision, Multimodal, Audio, Embedding | -| `--workspace-id ` | string | no | Workspace ID (env: BAILIAN_WORKSPACE_ID) | +| Flag | Type | Required | Description | +| ------------------------------ | ------ | -------- | ------------------------------------------------------ | +| `--model ` | string | no | Model name(s), comma-separated; omit for overview | +| `--days ` | string | no | Number of days (default: 7) | +| `--type ` | string | no | Model type: Text, Vision, Multimodal, Audio, Embedding | +| `--workspace-id ` | string | no | Workspace ID (env: BAILIAN_WORKSPACE_ID) | +| `--console-region ` | string | no | Console region (global flag) | +| `--console-site ` | string | no | Console site: domestic, international (global flag) | +| `--console-switch-agent ` | number | no | Switch agent UID (global flag) | #### Examples diff --git a/skills/bailian-cli/reference/workspace.md b/skills/bailian-cli/reference/workspace.md index 3606bb0..82404a0 100644 --- a/skills/bailian-cli/reference/workspace.md +++ b/skills/bailian-cli/reference/workspace.md @@ -23,9 +23,12 @@ Index: [index.md](index.md) #### Options -| Flag | Type | Required | Description | -| ------------ | ------ | -------- | ----------------------- | -| `--list ` | string | no | Limit number of results | +| Flag | Type | Required | Description | +| ------------------------------ | ------ | -------- | --------------------------------------------------- | +| `--list ` | string | no | Limit number of results | +| `--console-region ` | string | no | Console region (global flag) | +| `--console-site ` | string | no | Console site: domestic, international (global flag) | +| `--console-switch-agent ` | number | no | Switch agent UID (global flag) | #### Examples