Skip to content

Commit d320d36

Browse files
lishengzxcclaude
andcommitted
docs: add console gateway flags convention to AGENTS.md and command help
Add console global flags (--console-region, --console-site, --console-switch-agent) to the options of all 12 commands that depend on callConsoleGateway, so they appear in --help output. Document this as convention #4 in AGENTS.md for future commands. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent a5d055f commit d320d36

20 files changed

Lines changed: 225 additions & 54 deletions

File tree

AGENTS.md

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

9494
不要扮演服务端错误的翻译官——我们没有最新的错误码体系认知,二次包装只会撒谎(详见 `docs/agents/error-hint-change.md` 中的反面 case)。
9595

96+
### 4. Console Gateway 命令必须声明 console 全局 flags
97+
98+
如果新命令使用了 `callConsoleGateway`,必须在 `options` 中添加以下三个全局 flag 的说明,以便 `--help` 中展示:
99+
100+
```ts
101+
{ flag: "--console-region <region>", description: "Console region (global flag)" },
102+
{ flag: "--console-site <site>", description: "Console site: domestic, international (global flag)" },
103+
{ flag: "--console-switch-agent <uid>", description: "Switch agent UID (global flag)", type: "number" },
104+
```
105+
106+
这些 flag 已在 `GLOBAL_OPTIONS``packages/core/src/types/command.ts`)中注册,由 `loadConfig` 写入 `config.consoleRegion` / `config.consoleSite` / `config.consoleSwitchAgent``callConsoleGateway` 自动读取——命令无需手动提取或传递。
107+
96108
## 完成改动后的快速验证
97109

98110
```sh

packages/cli/src/commands/app/list.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ export default defineCommand({
2929
description: "Results per page (default: 30)",
3030
type: "number",
3131
},
32+
{ flag: "--console-region <region>", description: "Console region (global flag)" },
33+
{
34+
flag: "--console-site <site>",
35+
description: "Console site: domestic, international (global flag)",
36+
},
37+
{
38+
flag: "--console-switch-agent <uid>",
39+
description: "Switch agent UID (global flag)",
40+
type: "number",
41+
},
3242
],
3343
examples: [
3444
"bl app list",

packages/cli/src/commands/auth/status.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,18 @@ export default defineCommand({
142142
name: "auth status",
143143
description: "Show current authentication state",
144144
usage: "bl auth status",
145+
options: [
146+
{ flag: "--console-region <region>", description: "Console region (global flag)" },
147+
{
148+
flag: "--console-site <site>",
149+
description: "Console site: domestic, international (global flag)",
150+
},
151+
{
152+
flag: "--console-switch-agent <uid>",
153+
description: "Switch agent UID (global flag)",
154+
type: "number",
155+
},
156+
],
145157
examples: ["bl auth status", "bl auth status --output json"],
146158
async run(config: Config, _flags: GlobalFlags) {
147159
const format = detectOutputFormat(config.output);

packages/cli/src/commands/console/call.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@ export default defineCommand({
2727
description: "Request data as JSON string",
2828
required: true,
2929
},
30+
{ flag: "--console-region <region>", description: "Console region (global flag)" },
31+
{
32+
flag: "--console-site <site>",
33+
description: "Console site: domestic, international (global flag)",
34+
},
35+
{
36+
flag: "--console-switch-agent <uid>",
37+
description: "Switch agent UID (global flag)",
38+
type: "number",
39+
},
3040
],
3141
examples: [
3242
`bl console call --api zeldaEasy.broadscope-bailian.freeTrial.queryFreeTierQuota --data '{"queryFreeTierQuotaRequest":{"models":["qwen3-max"]}}'`,

packages/cli/src/commands/mcp/list.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ export default defineCommand({
3636
},
3737
{ flag: "--page <n>", description: "Page number (default: 1)", type: "number" },
3838
{ flag: "--page-size <n>", description: "Results per page (default: 30)", type: "number" },
39+
{ flag: "--console-region <region>", description: "Console region (global flag)" },
40+
{
41+
flag: "--console-site <site>",
42+
description: "Console site: domestic, international (global flag)",
43+
},
44+
{
45+
flag: "--console-switch-agent <uid>",
46+
description: "Switch agent UID (global flag)",
47+
type: "number",
48+
},
3949
],
4050
examples: ["bl mcp list", "bl mcp list --name 金融", "bl mcp list --output json"],
4151
async run(config: Config, flags: GlobalFlags) {

packages/cli/src/commands/quota/check.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,16 @@ export default defineCommand({
254254
flag: "--period <minutes>",
255255
description: "Query usage for the last N minutes (default: 2)",
256256
},
257+
{ flag: "--console-region <region>", description: "Console region (global flag)" },
258+
{
259+
flag: "--console-site <site>",
260+
description: "Console site: domestic, international (global flag)",
261+
},
262+
{
263+
flag: "--console-switch-agent <uid>",
264+
description: "Switch agent UID (global flag)",
265+
type: "number",
266+
},
257267
],
258268
examples: [
259269
"bl quota check",

packages/cli/src/commands/quota/history.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,16 @@ export default defineCommand({
114114
flag: "--model <model>",
115115
description: "Filter by model name",
116116
},
117+
{ flag: "--console-region <region>", description: "Console region (global flag)" },
118+
{
119+
flag: "--console-site <site>",
120+
description: "Console site: domestic, international (global flag)",
121+
},
122+
{
123+
flag: "--console-switch-agent <uid>",
124+
description: "Switch agent UID (global flag)",
125+
type: "number",
126+
},
117127
],
118128
examples: [
119129
"bl quota history",

packages/cli/src/commands/quota/list.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,16 @@ export default defineCommand({
169169
flag: "--all",
170170
description: "Show all models, not just self-service ones",
171171
},
172+
{ flag: "--console-region <region>", description: "Console region (global flag)" },
173+
{
174+
flag: "--console-site <site>",
175+
description: "Console site: domestic, international (global flag)",
176+
},
177+
{
178+
flag: "--console-switch-agent <uid>",
179+
description: "Switch agent UID (global flag)",
180+
type: "number",
181+
},
172182
],
173183
examples: [
174184
"bl quota list",

packages/cli/src/commands/quota/request.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,16 @@ export default defineCommand({
9696
flag: "--yes",
9797
description: "Skip downgrade confirmation",
9898
},
99+
{ flag: "--console-region <region>", description: "Console region (global flag)" },
100+
{
101+
flag: "--console-site <site>",
102+
description: "Console site: domestic, international (global flag)",
103+
},
104+
{
105+
flag: "--console-switch-agent <uid>",
106+
description: "Switch agent UID (global flag)",
107+
type: "number",
108+
},
99109
],
100110
examples: [
101111
"bl quota request --model qwen-turbo --tpm 100000",

packages/cli/src/commands/usage/free.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,16 @@ export default defineCommand({
207207
flag: "--sort <field>",
208208
description: "Sort by: remaining (ascending), expires (ascending)",
209209
},
210+
{ flag: "--console-region <region>", description: "Console region (global flag)" },
211+
{
212+
flag: "--console-site <site>",
213+
description: "Console site: domestic, international (global flag)",
214+
},
215+
{
216+
flag: "--console-switch-agent <uid>",
217+
description: "Switch agent UID (global flag)",
218+
type: "number",
219+
},
210220
],
211221
examples: [
212222
"bl usage free",

0 commit comments

Comments
 (0)