refactor(cli): rename bootstrap command to workspace init

- 将原有的 `bl bootstrap` 命令重命名为 `bl workspace init`
- 更新相关文档,包括中文和英文变更日志
- 修改命令导出和引用,调整文件与变量命名对应新命令
- 保持初始化 Bailian 工作空间及开通后付费服务功能不变
- 删除旧的 `bl bootstrap` 文档,新增 `bl workspace init` 命令帮助文档
- 更新 CLI 命令索引,替换旧命令为新命令
- 优化命令实现细节,增强代码规范和异常处理一致性
This commit is contained in:
lisheng.lisheng
2026-07-17 10:59:46 +08:00
parent 92719a1a21
commit 00b4d095ed
8 changed files with 36 additions and 50 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
### Added
- **CLI access-token automation** — added `bl auth generate-access-token`; OpenAPI login can obtain and persist a Console access token, and Console requests can refresh an expired token with stored AK/SK credentials.
- **`bl bootstrap`** — initializes a Bailian workspace, creates the Console user, and activates required postpaid services in one workflow.
- **`bl workspace init`** — initializes a Bailian workspace, creates the Console user, and activates required postpaid services in one workflow.
- **Named Config Profiles** — added isolated named profiles, persistent activation, and `bl config list`, `bl config use`, and `bl config ui` for profile management.
- **Token Plan model Profile** — `bl auth login --config token-plan --api-key ...` materializes the built-in Token Plan endpoint and default model settings for model calls.
- **STS credentials** — OpenAPI authentication now accepts and signs requests with an optional security token.
+1 -1
View File
@@ -11,7 +11,7 @@
### 新增
- **CLI Access Token 自动化** —— 新增 `bl auth generate-access-token`;OpenAPI 登录可获取并保存 Console Access Token,Console 请求可使用已保存的 AK/SK 自动刷新过期 Token。
- **`bl bootstrap`** —— 通过一条工作流初始化百炼工作空间、创建控制台用户并开通所需的后付费服务。
- **`bl workspace init`** —— 通过一条工作流初始化百炼工作空间、创建控制台用户并开通所需的后付费服务。
- **命名 Config Profile** —— 新增相互隔离的命名 Profile、持久化激活状态,以及用于管理 Profile 的 `bl config list`、`bl config use` 和 `bl config ui`。
- **Token Plan 模型 Profile** —— `bl auth login --config token-plan --api-key ...` 会物化 Token Plan 内置接入地址与默认模型配置,供模型命令直接使用。
- **STS 凭证** —— OpenAPI 鉴权现支持可选 Security Token,并在签名请求中自动携带。
+2 -2
View File
@@ -83,7 +83,7 @@ import {
tokenPlanCreateKey,
tokenPlanAssignSeats,
tokenPlanAddMember,
bootstrap,
workspaceInit,
pluginInstall,
pluginLink,
pluginList,
@@ -179,7 +179,7 @@ export const commands: Record<string, AnyCommand> = {
"token-plan create-key": tokenPlanCreateKey,
"token-plan assign-seats": tokenPlanAssignSeats,
"token-plan add-member": tokenPlanAddMember,
bootstrap: bootstrap,
"workspace init": workspaceInit,
"plugin install": pluginInstall,
"plugin link": pluginLink,
"plugin list": pluginList,
@@ -139,7 +139,7 @@ export default defineCommand({
const { accessKeyId, accessKeySecret } = flags;
if (!accessKeyId || !accessKeySecret) {
throw new BailianError(
"bootstrap requires --access-key-id and --access-key-secret.",
"workspace init requires --access-key-id and --access-key-secret.",
ExitCode.USAGE,
);
}
@@ -224,8 +224,8 @@ export default defineCommand({
},
});
} catch (err) {
// Re-running bootstrap is idempotent: an already-existing user is not
// fatal, so swallow it and continue with the remaining steps.
// Re-running workspace init is idempotent: an already-existing user is
// not fatal, so swallow it and continue with the remaining steps.
if (!(err instanceof BailianError) || !/already exists/i.test(err.message)) {
throw err;
}
+1 -1
View File
@@ -90,7 +90,7 @@ export { default as tokenPlanListSeats } from "./commands/token-plan/list-seats.
export { default as tokenPlanCreateKey } from "./commands/token-plan/create-key.ts";
export { default as tokenPlanAssignSeats } from "./commands/token-plan/assign-seats.ts";
export { default as tokenPlanAddMember } from "./commands/token-plan/add-member.ts";
export { default as bootstrap } from "./commands/bootstrap/index.ts";
export { default as workspaceInit } from "./commands/workspace/init.ts";
export { default as pluginInstall } from "./commands/plugin/install.ts";
export { default as pluginLink } from "./commands/plugin/link.ts";
export { default as pluginList } from "./commands/plugin/list.ts";
-36
View File
@@ -1,36 +0,0 @@
# `bl bootstrap` commands
> Auto-generated from `packages/cli/src/commands.ts`. Do not edit by hand.
> Regenerate: `pnpm --filter bailian-cli run generate:reference`.
Index: [index.md](index.md)
## Commands in this group
| Command | Description |
| -------------- | ----------------------------------------------------------- |
| `bl bootstrap` | Initialize Bailian workspace and activate postpaid services |
## Command details
### `bl bootstrap`
| Field | Value |
| --------------- | ------------------------------------------------------------------------------------------- |
| **Name** | `bootstrap` |
| **Description** | Initialize Bailian workspace and activate postpaid services |
| **Usage** | `bl bootstrap --access-key-id <id> --access-key-secret <secret> [--security-token <token>]` |
#### Flags
| Flag | Type | Required | Description |
| ------------------------------ | ------ | -------- | ------------------------------------------- |
| `--access-key-id <id>` | string | no | Alibaba Cloud Access Key ID |
| `--access-key-secret <secret>` | string | no | Alibaba Cloud Access Key Secret |
| `--security-token <token>` | string | no | Alibaba Cloud STS Security Token (optional) |
#### Examples
```bash
bl bootstrap --access-key-id LTAIxxxxx --access-key-secret xxxxx
```
+2 -3
View File
@@ -17,7 +17,6 @@ Use this index for the full quick index and global flags.
| `bl auth login` | Authenticate with API key, console browser login, or OpenAPI AK/SK (credentials can coexist) | [auth.md](auth.md) |
| `bl auth logout` | Clear stored credentials | [auth.md](auth.md) |
| `bl auth status` | Show current authentication state | [auth.md](auth.md) |
| `bl bootstrap` | Initialize Bailian workspace and activate postpaid services | [bootstrap.md](bootstrap.md) |
| `bl config list` | List config profiles and show the active profile | [config.md](config.md) |
| `bl config set` | Set a config value | [config.md](config.md) |
| `bl config show` | Display current configuration | [config.md](config.md) |
@@ -97,6 +96,7 @@ Use this index for the full quick index and global flags.
| `bl video ref` | Reference-to-video generation (happyhorse-1.1-r2v / wan2.6-r2v): multi-subject, multi-shot with voice | [video.md](video.md) |
| `bl video task get` | Query async task status | [video.md](video.md) |
| `bl vision describe` | Describe an image or video using Qwen-VL | [vision.md](vision.md) |
| `bl workspace init` | Initialize Bailian workspace and activate postpaid services | [workspace.md](workspace.md) |
| `bl workspace list` | List all workspaces | [workspace.md](workspace.md) |
## By group
@@ -106,7 +106,6 @@ Use this index for the full quick index and global flags.
| `advisor` | `recommend` | [advisor.md](advisor.md) |
| `app` | `call`, `list` | [app.md](app.md) |
| `auth` | `generate-access-token`, `login`, `logout`, `status` | [auth.md](auth.md) |
| `bootstrap` | `(root)` | [bootstrap.md](bootstrap.md) |
| `config` | `list`, `set`, `show`, `ui`, `use` | [config.md](config.md) |
| `console` | `call` | [console.md](console.md) |
| `dataset` | `delete`, `get`, `list`, `upload`, `validate` | [dataset.md](dataset.md) |
@@ -130,7 +129,7 @@ Use this index for the full quick index and global flags.
| `usage` | `free`, `freetier`, `stats`, `summary` | [usage.md](usage.md) |
| `video` | `download`, `edit`, `generate`, `ref`, `task get` | [video.md](video.md) |
| `vision` | `describe` | [vision.md](vision.md) |
| `workspace` | `list` | [workspace.md](workspace.md) |
| `workspace` | `init`, `list` | [workspace.md](workspace.md) |
## Global flags
+26 -3
View File
@@ -7,12 +7,35 @@ Index: [index.md](index.md)
## Commands in this group
| Command | Description |
| ------------------- | ------------------- |
| `bl workspace list` | List all workspaces |
| Command | Description |
| ------------------- | ----------------------------------------------------------- |
| `bl workspace init` | Initialize Bailian workspace and activate postpaid services |
| `bl workspace list` | List all workspaces |
## Command details
### `bl workspace init`
| Field | Value |
| --------------- | ------------------------------------------------------------------------------------------------ |
| **Name** | `workspace init` |
| **Description** | Initialize Bailian workspace and activate postpaid services |
| **Usage** | `bl workspace init --access-key-id <id> --access-key-secret <secret> [--security-token <token>]` |
#### Flags
| Flag | Type | Required | Description |
| ------------------------------ | ------ | -------- | ------------------------------------------- |
| `--access-key-id <id>` | string | no | Alibaba Cloud Access Key ID |
| `--access-key-secret <secret>` | string | no | Alibaba Cloud Access Key Secret |
| `--security-token <token>` | string | no | Alibaba Cloud STS Security Token (optional) |
#### Examples
```bash
bl workspace init --access-key-id LTAIxxxxx --access-key-secret xxxxx
```
### `bl workspace list`
| Field | Value |