Skip to content

Commit 70ccc6a

Browse files
author
wb-liuxuehuan
committed
feat(tokenplan): 修改Token Plan 命令名称及相关优化
新增 `token-plan` 相关命令,包括 `add-member`、`assign-seats`、`create-key` 和 `list-seats`,支持管理 Token Plan 组织成员和 API 密钥。更新了命令的参数处理逻辑,确保对输入参数的验证更加严格,提升了代码的可读性和健壮性。同时,更新了相关文档,提供使用示例和参数说明。
1 parent ba16613 commit 70ccc6a

11 files changed

Lines changed: 145 additions & 145 deletions

File tree

packages/cli/README.zh.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,10 @@ bl quota request --model qwen3.6-plus --tpm 6000000 # 申请临时 TPM 提额
124124
bl quota history # 查看提额历史记录
125125

126126
# Token Plan 团队版管理(需 AK/SK,见下方认证说明)
127-
bl tokenplan seats # 查看订阅席位明细
128-
bl tokenplan add-member --account-name dev --org-id org_xxx
129-
bl tokenplan assign-seats --workspace-id ws_xxx --seat-type standard --account-id acc_xxx
130-
bl tokenplan create-key --account-id acc_xxx --workspace-id ws_xxx
127+
bl token-plan list-seats # 查看订阅席位明细
128+
bl token-plan add-member --account-name dev --org-id org_xxx
129+
bl token-plan assign-seats --workspace-id ws_xxx --seat-type standard --account-id acc_xxx
130+
bl token-plan create-key --account-id acc_xxx --workspace-id ws_xxx
131131
```
132132

133133
> 更多案例与使用场景:[阿里云百炼 CLI 官方主页](https://bailian.console.aliyun.com/cli?source_channel=cli_github&)
@@ -159,7 +159,7 @@ bl auth login --console
159159

160160
### 阿里云 AK/SK(知识库检索与 Token Plan)
161161

162-
`knowledge retrieve``tokenplan` 命令组需要阿里云 AccessKey。前往 [RAM 控制台](https://ram.console.aliyun.com/manage/ak) 获取。
162+
`knowledge retrieve``token-plan` 命令组需要阿里云 AccessKey。前往 [RAM 控制台](https://ram.console.aliyun.com/manage/ak) 获取。
163163

164164
> 建议:创建 RAM 子账号并授予最小权限,避免使用主账号 AK/SK。
165165

packages/cli/src/commands/catalog.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ import quotaList from "./quota/list.ts";
4646
import quotaRequest from "./quota/request.ts";
4747
import quotaHistory from "./quota/history.ts";
4848
import quotaCheck from "./quota/check.ts";
49-
import tokenplanSeats from "./tokenplan/seats.ts";
50-
import tokenplanCreateKey from "./tokenplan/create-key.ts";
51-
import tokenplanAssignSeats from "./tokenplan/assign-seats.ts";
52-
import tokenplanAddMember from "./tokenplan/add-member.ts";
49+
import tokenPlanListSeats from "./token-plan/list-seats.ts";
50+
import tokenPlanCreateKey from "./token-plan/create-key.ts";
51+
import tokenPlanAssignSeats from "./token-plan/assign-seats.ts";
52+
import tokenPlanAddMember from "./token-plan/add-member.ts";
5353

5454
/** Command registry map (no dependency on registry.ts — safe for build-time import). */
5555
export const commands: Record<string, Command> = {
@@ -98,9 +98,9 @@ export const commands: Record<string, Command> = {
9898
"quota request": quotaRequest,
9999
"quota history": quotaHistory,
100100
"quota check": quotaCheck,
101-
"tokenplan seats": tokenplanSeats,
102-
"tokenplan create-key": tokenplanCreateKey,
103-
"tokenplan assign-seats": tokenplanAssignSeats,
104-
"tokenplan add-member": tokenplanAddMember,
101+
"token-plan list-seats": tokenPlanListSeats,
102+
"token-plan create-key": tokenPlanCreateKey,
103+
"token-plan assign-seats": tokenPlanAssignSeats,
104+
"token-plan add-member": tokenPlanAddMember,
105105
update: update,
106106
};

packages/cli/src/commands/tokenplan/add-member.ts renamed to packages/cli/src/commands/token-plan/add-member.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ const API_PATH = "/tokenplan/organization/member-additions";
2525
const DEFAULT_ORG_ROLE = "ORG_MEMBER";
2626

2727
export default defineCommand({
28-
name: "tokenplan add-member",
28+
name: "token-plan add-member",
2929
description: "Add a member to a Token Plan organization",
30-
usage: "bl tokenplan add-member --account-name <name> --org-id <id> [flags]",
30+
usage: "bl token-plan add-member --account-name <name> --org-id <id> [flags]",
3131
options: [
3232
{ flag: "--account-name <name>", description: "Member display name", required: true },
3333
{ flag: "--org-id <id>", description: "Organization ID", required: true },
@@ -43,9 +43,9 @@ export default defineCommand({
4343
...TOKEN_PLAN_AK_OPTIONS,
4444
],
4545
examples: [
46-
"bl tokenplan add-member --account-name dev_user --org-id org_123",
47-
"bl tokenplan add-member --account-name admin_user --org-id org_123 --org-role-code ORG_ADMIN",
48-
"bl tokenplan add-member --account-name member1 --org-id org_123 --spec-type standard",
46+
"bl token-plan add-member --account-name dev_user --org-id org_123",
47+
"bl token-plan add-member --account-name admin_user --org-id org_123 --org-role-code ORG_ADMIN",
48+
"bl token-plan add-member --account-name member1 --org-id org_123 --spec-type standard",
4949
],
5050
async run(config: Config, flags: GlobalFlags) {
5151
const format = detectOutputFormat(config.output);
File renamed without changes.

packages/cli/src/commands/tokenplan/assign-seats.ts renamed to packages/cli/src/commands/token-plan/assign-seats.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ const API_ACTION = "BatchAssignSeats";
2424
const API_PATH = "/tokenplan/subscription/seat-assignments";
2525

2626
export default defineCommand({
27-
name: "tokenplan assign-seats",
27+
name: "token-plan assign-seats",
2828
description: "Batch assign Token Plan seats to members",
2929
usage:
30-
"bl tokenplan assign-seats --workspace-id <id> --seat-type <type> --account-id <id> [flags]",
30+
"bl token-plan assign-seats --workspace-id <id> --seat-type <type> --account-id <id> [flags]",
3131
options: [
3232
TOKEN_PLAN_WORKSPACE_OPTION,
3333
{
@@ -48,8 +48,8 @@ export default defineCommand({
4848
...TOKEN_PLAN_AK_OPTIONS,
4949
],
5050
examples: [
51-
"bl tokenplan assign-seats --workspace-id ws_456 --seat-type standard --account-id acc_123",
52-
"bl tokenplan assign-seats --workspace-id ws_456 --seat-type pro --account-id acc_1 --account-id acc_2",
51+
"bl token-plan assign-seats --workspace-id ws_456 --seat-type standard --account-id acc_123",
52+
"bl token-plan assign-seats --workspace-id ws_456 --seat-type pro --account-id acc_1 --account-id acc_2",
5353
],
5454
async run(config: Config, flags: GlobalFlags) {
5555
const format = detectOutputFormat(config.output);

packages/cli/src/commands/tokenplan/create-key.ts renamed to packages/cli/src/commands/token-plan/create-key.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ const API_ACTION = "CreateTokenPlanKey";
2525
const API_PATH = "/tokenplan/api-keys";
2626

2727
export default defineCommand({
28-
name: "tokenplan create-key",
28+
name: "token-plan create-key",
2929
description: "Create a Token Plan API key for a seat",
30-
usage: "bl tokenplan create-key --account-id <id> --workspace-id <id> [flags]",
30+
usage: "bl token-plan create-key --account-id <id> --workspace-id <id> [flags]",
3131
options: [
3232
{ flag: "--account-id <id>", description: "Target member account ID", required: true },
3333
TOKEN_PLAN_WORKSPACE_OPTION,
@@ -36,8 +36,8 @@ export default defineCommand({
3636
...TOKEN_PLAN_AK_OPTIONS,
3737
],
3838
examples: [
39-
"bl tokenplan create-key --account-id acc_123 --workspace-id ws_456",
40-
"bl tokenplan create-key --account-id acc_123 --workspace-id ws_456 --description 'Dev key'",
39+
"bl token-plan create-key --account-id acc_123 --workspace-id ws_456",
40+
"bl token-plan create-key --account-id acc_123 --workspace-id ws_456 --description 'Dev key'",
4141
],
4242
async run(config: Config, flags: GlobalFlags) {
4343
const format = detectOutputFormat(config.output);

packages/cli/src/commands/tokenplan/seats.ts renamed to packages/cli/src/commands/token-plan/list-seats.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ const API_ACTION = "GetSubscriptionSeatDetails";
2323
const API_PATH = "/tokenplan/subscription/seat-detail";
2424

2525
export default defineCommand({
26-
name: "tokenplan seats",
26+
name: "token-plan list-seats",
2727
description: "List Token Plan subscription seat details",
28-
usage: "bl tokenplan seats [flags]",
28+
usage: "bl token-plan list-seats [flags]",
2929
options: [
3030
{ flag: "--page-no <n>", description: "Page number (default: 1)", type: "number" },
3131
{ flag: "--page-size <n>", description: "Page size (default: 10)", type: "number" },
@@ -52,9 +52,9 @@ export default defineCommand({
5252
...TOKEN_PLAN_AK_OPTIONS,
5353
],
5454
examples: [
55-
"bl tokenplan seats",
56-
"bl tokenplan seats --page-size 20 --status NORMAL",
57-
"bl tokenplan seats --query-assigned true --seat-type standard",
55+
"bl token-plan list-seats",
56+
"bl token-plan list-seats --page-size 20 --status NORMAL",
57+
"bl token-plan list-seats --query-assigned true --seat-type standard",
5858
],
5959
async run(config: Config, flags: GlobalFlags) {
6060
const format = detectOutputFormat(config.output);
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)