Skip to content

Commit 6388fd1

Browse files
committed
docs: sync command context capability usage
1 parent 63edde3 commit 6388fd1

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

docs/agents/auth-change.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ defineCommand({ auth }) → runtime/authStage → ctx.client → command.run(ctx
4848
- `resolveOpenApi()``auth: "openapi"` 命令;优先级 `--access-key-id/--access-key-secret` > `ALIBABA_CLOUD_ACCESS_KEY_ID/ALIBABA_CLOUD_ACCESS_KEY_SECRET` > config `access_key_*`。兼容读取旧字段 `openapi_access_key_*`,新写入只写短字段
4949
- `describeAuthState()``auth status` / banner / telemetry 使用的只读快照
5050

51-
命令不要直接解析 token、env 或 config。业务请求统一走 `ctx.client`;登录/配置命令通过 `ctx.authStore()` / `ctx.configStore()` 的窄接口操作落盘。
51+
命令不要直接解析 token、env 或 config。业务请求统一走 `ctx.client`;登录/配置命令通过 `ctx.authStore` / `ctx.configStore` 的窄接口操作落盘。
5252

5353
## 必查清单
5454

@@ -87,7 +87,7 @@ defineCommand({ auth }) → runtime/authStage → ctx.client → command.run(ctx
8787

8888
- [ ] `packages/commands/src/commands/auth/login.ts`:
8989
- 新增/调整登录 flag 与流程
90-
- 持久化只走 `ctx.authStore().login(...)`
90+
- 持久化只走 `ctx.authStore.login(...)`
9191
- [ ] `packages/commands/src/commands/auth/status.ts`:
9292
- 分别显示 model / console / openapi 鉴权状态,并 mask token
9393
- [ ] `packages/commands/src/commands/auth/logout.ts`:

docs/agents/command-add-remove.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ packages/commands/src/index.ts
7272
- `exampleArgs`(不含 bin/path 前缀)
7373
- `validate`(跨 flag 校验)
7474
- 普通业务命令的 `run(ctx)` 只读 `ctx.flags` / `ctx.settings` / `ctx.client`
75-
- `commands/auth/**` 可用 `ctx.authStore()`,`commands/config/**` 可用 `ctx.configStore()`;不要把这些 store accessor 扩散到普通业务命令
76-
- `commands/plugin/**` 可用 `ctx.commandPacks()`;产品 policy 由 runtime 绑定,命令不要自行 import 产品入口
75+
- `commands/auth/**` 可用 `ctx.authStore`,`commands/config/**` 可用 `ctx.configStore`;不要把这些持久化能力扩散到普通业务命令
76+
- `commands/plugin/**` 可用 `ctx.commandPacks`;产品 policy 由 runtime 绑定,命令不要自行 import 产品入口
7777
- [ ] `packages/commands/src/index.ts`:新增或移除对应 export
7878
- [ ] 如果命令调用 Console Gateway,设置 `auth: "console"`;不要重复声明 console 凭证域 flags
7979
- [ ] 如果命令不需要网络或自己管理配置/登录,设置 `auth: "none"`;不要绕过 runtime auth stage

docs/agents/command-pack.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
- `packages/core/src/types/command-pack.ts`:稳定的协议元数据和导出类型,不知道具体产品或白名单。
1313
- `packages/runtime/src/command-packs/`:所有 CLI 共用的加载、校验、API 适配、产品隔离安装目录和 manager 实现。
14-
- `packages/runtime/src/create-cli.ts`:始终接收静态 command map,按 `CliOptions.commandPacks` 统一合并 pack,并把已绑定产品 identity/policy 的 manager 注入 `ctx.commandPacks()`
15-
- `packages/commands/src/commands/plugin/`:普通共享管理命令,只依赖 `ctx.commandPacks()`,不 import 任何产品 policy。
14+
- `packages/runtime/src/create-cli.ts`:始终接收静态 command map,按 `CliOptions.commandPacks` 统一合并 pack,并把已绑定产品 identity/policy 的 manager 注入 `ctx.commandPacks`
15+
- `packages/commands/src/commands/plugin/`:普通共享管理命令,只依赖 `ctx.commandPacks`,不 import 任何产品 policy。
1616
- `packages/cli/src/command-pack-policy.ts``bl` 支持的包、命令前缀和凭据授权。
1717
- `kscli` 当前不传 `commandPacks`,使用 runtime 的默认空 policy。
1818
- 当前只有 `bl``bailian-cli-commands` 导入并登记 `plugin *`;使用默认空 policy 的产品不提前暴露管理命令。
@@ -33,7 +33,7 @@
3333
- [ ] 普通网络请求走 `ctx.client`;基础 Context 提供 `identity/settings/flags/client/output/errors`,不提供原始凭据。
3434
- [ ] `ctx.credentials.apiKey()` 仅限 policy 显式声明 `credentialAccess: ["apiKey"]`,且命令自身为 `auth: "apiKey"`
3535
- [ ] 不向 Command Pack 暴露原始 Console Token、OpenAPI AK/SK、`authStore``configStore`
36-
- [ ] 不向 Command Pack 暴露宿主的 `commandPacks()` manager,避免 pack 安装或删除其他 pack。
36+
- [ ] 不向 Command Pack 暴露宿主的 `commandPacks` manager,避免 pack 安装或删除其他 pack。
3737
- [ ] 单包失败必须 fail-open:保留内置命令和其他合法 pack。
3838
- [ ] 破坏协议前优先在适配层兼容;确实无法兼容时才提升 `apiVersion`
3939

0 commit comments

Comments
 (0)