feat(asset-center): remove oss transfer commands

This commit is contained in:
rendianmeng
2026-08-07 14:50:56 +08:00
parent 78ca730100
commit 882bc6becb
20 changed files with 186 additions and 1579 deletions
+1 -1
View File
@@ -41,7 +41,7 @@ Equip your AI Agent out-of-the-box with these capabilities, composable across co
- **Model recommendation** — Describe your scenario and get best-fit model suggestions; supports scoped search, model comparison, and alternative discovery
- **Fine-tuning & deployment** — Upload datasets, create text/audio/image fine-tune jobs (`finetune text|audio|image create`; text covers SFT/LoRA/DPO/CPT), probe job status non-blockingly (`finetune watch`), query per-model training capability (`finetune capability`), and deploy trained models as endpoints (`deploy text|audio|image create`)
- **Console capabilities** — Browse the model marketplace (`model list`) and Bailian apps (`app list`), review a unified usage view (`usage summary`), check free-tier quota (`usage free`), view model usage statistics (`usage stats`), manage workspaces (`workspace list`), and manage rate limits (`quota list/request/check/history`)
- **Asset center** — Browse and manage model-generated assets (`asset-center list/get/download`), favorites and recycle bin (`favorite`/`delete`), storage quota (`stats`/`storage`), OSS transfer (`oss slr/bind/show/update/unbind`), and transfer logs (`transfer list`)
- **Asset center** — Browse and manage model-generated assets (`asset-center list/get/download`), favorites and recycle bin (`favorite`/`delete`), and storage quota (`stats`/`storage`)
- **Local file auto-upload** — Every URL parameter accepts a local path; uploaded to free temp storage with 48-hour validity
## Showcase: One-Sentence Cinematic Video
+1 -1
View File
@@ -41,7 +41,7 @@ _专为 AI Agent 打造,每个命令均可作为结构化工具调用。_
- **模型推荐** — 描述你的场景,智能推荐最适合的模型;支持限定范围搜索、模型对比和替代发现
- **微调与部署** — 上传数据集、创建文本/音频/图像调优任务(`finetune text|audio|image create`;文本涵盖 SFT/LoRA/DPO/CPT)、非阻塞探测任务状态(`finetune watch`)、按模型查训练能力(`finetune capability`),并把训练好的模型部署为推理服务(`deploy text|audio|image create`)
- **控制台能力** — 浏览模型市场(`model list`)和百炼应用(`app list`),查看统一用量视图(`usage summary`),查询模型免费额度(`usage free`),查看模型用量统计(`usage stats`),管理业务空间(`workspace list`),管理限流与提额(`quota list/request/check/history`)
- **资产中心** — 管理模型生成资产(`asset-center list/get/download`)、收藏与回收站(`favorite`/`delete`)、容量统计(`stats`/`storage`)、OSS 转存(`oss slr/bind/show/update/unbind`)与转存日志(`transfer list`)
- **资产中心** — 管理模型生成资产(`asset-center list/get/download`)、收藏与回收站(`favorite`/`delete`)、容量统计(`stats`/`storage`)
- **本地文件自动上传** — 所有 URL 参数同时支持本地路径,免费临时存储 48 小时
## 示例:一句话生成一部电影短片
+29 -29
View File
@@ -429,34 +429,34 @@ describe.skipIf(!isConsoleE2EReady())("e2e: asset-center(Console …)", () =
当前 `packages/cli/src/commands.ts` 注册的命令组:
| 命令组 | 子命令示例 | auth 域 |
| -------------- | ---------------------------------------------------------------------------------------- | ---------------- |
| `auth` | login, status, logout | none / console |
| `text` | chat | apiKey |
| `omni` | (全模态对话) | apiKey |
| `image` | generate, edit | apiKey |
| `video` | generate, edit, ref, task get, download | apiKey |
| `vision` | describe | apiKey |
| `speech` | synthesize, recognize | apiKey |
| `knowledge` | retrieve, search, chat | apiKey |
| `memory` | add, search, list, update, delete, profile create/get | apiKey |
| `app` | call, list | apiKey / console |
| `mcp` | call, list, tools | apiKey |
| `search` | web | apiKey |
| `file` | upload | apiKey |
| `config` | show, set | none |
| `console` | call | console |
| `usage` | free, freetier, stats | console |
| `workspace` | list | console |
| `quota` | list, request, history, check | console |
| `dataset` | upload, list, get, delete, validate | console |
| `finetune` | create, list, get, cancel, delete, logs, checkpoints, export, watch, capability | console |
| `deploy` | create, list, get, models, scale, update, delete | console |
| `token-plan` | list-seats, create-key, assign-seats, add-member | console |
| `asset-center` | list, get, favorite, unfavorite, delete, download, stats, storage, transfer list, oss \* | console |
| `pipeline` | run, validate | apiKey |
| `advisor` | recommend | apiKey |
| `update` | (自更新) | none |
| 命令组 | 子命令示例 | auth 域 |
| -------------- | ------------------------------------------------------------------------------- | ---------------- |
| `auth` | login, status, logout | none / console |
| `text` | chat | apiKey |
| `omni` | (全模态对话) | apiKey |
| `image` | generate, edit | apiKey |
| `video` | generate, edit, ref, task get, download | apiKey |
| `vision` | describe | apiKey |
| `speech` | synthesize, recognize | apiKey |
| `knowledge` | retrieve, search, chat | apiKey |
| `memory` | add, search, list, update, delete, profile create/get | apiKey |
| `app` | call, list | apiKey / console |
| `mcp` | call, list, tools | apiKey |
| `search` | web | apiKey |
| `file` | upload | apiKey |
| `config` | show, set | none |
| `console` | call | console |
| `usage` | free, freetier, stats | console |
| `workspace` | list | console |
| `quota` | list, request, history, check | console |
| `dataset` | upload, list, get, delete, validate | console |
| `finetune` | create, list, get, cancel, delete, logs, checkpoints, export, watch, capability | console |
| `deploy` | create, list, get, models, scale, update, delete | console |
| `token-plan` | list-seats, create-key, assign-seats, add-member | console |
| `asset-center` | list, get, favorite, unfavorite, delete, download, stats, storage | console |
| `pipeline` | run, validate | apiKey |
| `advisor` | recommend | apiKey |
| `update` | (自更新) | none |
---
@@ -530,7 +530,7 @@ pnpm run release:check # 发版前校验
1. **命令实现 ≠ 产品路径** — 同一 `knowledgeRetrieve` 可以是 `bl knowledge retrieve` 或 `kscli retrieve`。
2. **defineCommand 是契约** — `auth` + `flags` + `run(ctx)` 是命令的全部接口;凭证和网络细节下沉到 core/runtime。
3. **registry 从 map 建树** — `"asset-center oss bind"` 自动变成三级命令组,help 动态生成。
3. **registry 从 map 建树** — `"asset-center list"` 等 path 自动变成命令组,help 动态生成。
4. **flags 用 camelCase 定义** — runtime 渲染为 `--kebab-case`;`ParsedFlags<typeof FLAGS>` 提供类型安全。
5. **dry-run 是全局 flag** — `--dry-run` 在 auth stage 有例外处理,命令在 `run` 开头判断 `ctx.settings.dryRun`。
6. **本地路径即 URL** — 所有接受 URL 的参数同时支持本地文件路径,core `files/upload` 自动上传。
-12
View File
@@ -92,12 +92,6 @@ import {
assetDownload,
assetStats,
assetStorage,
assetTransferList,
assetOssSlrAuthorize,
assetOssBind,
assetOssShow,
assetOssUpdate,
assetOssUnbind,
workspaceInit,
pluginInstall,
pluginLink,
@@ -224,12 +218,6 @@ export const commands: Record<string, AnyCommand> = {
"asset-center download": assetDownload,
"asset-center stats": assetStats,
"asset-center storage": assetStorage,
"asset-center transfer list": assetTransferList,
"asset-center oss slr authorize": assetOssSlrAuthorize,
"asset-center oss bind": assetOssBind,
"asset-center oss show": assetOssShow,
"asset-center oss update": assetOssUpdate,
"asset-center oss unbind": assetOssUnbind,
"workspace init": workspaceInit,
"plugin install": pluginInstall,
"plugin link": pluginLink,
@@ -8,7 +8,7 @@ describe("e2e: asset-center", () => {
const output = `${stdout}\n${stderr}`;
expect(output).toContain("list");
expect(output).toContain("storage");
expect(output).toContain("oss");
expect(output).not.toContain("oss");
});
test("asset-center list --help 正常退出", async () => {
@@ -41,7 +41,7 @@ describe("e2e: asset-center", () => {
const { stderr, exitCode } = await runCli(["asset-center", "download", "--help"]);
expect(exitCode, stderr).toBe(0);
expect(stderr).toContain("--id");
expect(stderr).not.toContain("--out");
expect(stderr).not.toMatch(/(^|\s)--out(\s|$)/);
});
test("asset-center stats --help 正常退出", async () => {
@@ -55,19 +55,6 @@ describe("e2e: asset-center", () => {
expect(exitCode, stderr).toBe(0);
expect(stderr).toContain("bl asset-center storage");
});
test("asset-center oss bind --help 正常退出", async () => {
const { stderr, exitCode } = await runCli(["asset-center", "oss", "bind", "--help"]);
expect(exitCode, stderr).toBe(0);
expect(stderr).toContain("--bucket");
expect(stderr).toContain("--policy");
});
test("asset-center transfer list --help 正常退出", async () => {
const { stderr, exitCode } = await runCli(["asset-center", "transfer", "list", "--help"]);
expect(exitCode, stderr).toBe(0);
expect(stderr).toContain("--status");
});
});
describe.skipIf(!isConsoleE2EReady())("e2e: asset-center(Console)", () => {
@@ -89,24 +76,6 @@ describe.skipIf(!isConsoleE2EReady())("e2e: asset-center(Console)", () => {
expect(stderr).toMatch(/--id|Missing required argument/i);
});
test("asset-center oss bind policy=BEFORE_DAYS 缺 --before-days 报错", async () => {
const { stderr, exitCode } = await runCli([
"asset-center",
"oss",
"bind",
"--bucket",
"b",
"--region",
"cn-hangzhou",
"--path-prefix",
"p/",
"--policy",
"BEFORE_DAYS",
]);
expect(exitCode).toBe(2);
expect(stderr).toContain("--before-days");
});
test("asset-center list --dry-run 输出请求参数", async () => {
const { stdout, stderr, exitCode } = await runCli([
"asset-center",
@@ -150,21 +119,6 @@ describe.skipIf(!isConsoleE2EReady())("e2e: asset-center(Console)", () => {
expect(data.api).toContain("getStorageQuota");
});
test("asset-center oss slr authorize --dry-run 输出请求参数", async () => {
const { stdout, stderr, exitCode } = await runCli([
"asset-center",
"oss",
"slr",
"authorize",
"--dry-run",
"--output",
"json",
]);
expect(exitCode, stderr).toBe(0);
const data = parseStdoutJson<{ api?: string }>(stdout);
expect(data.api).toContain("createOssSLR");
});
test("【console】asset-center list 真实调用或鉴权失败优雅退出", async () => {
const workspaceId = process.env.BAILIAN_WORKSPACE_ID;
const args = ["asset-center", "list", "--output", "json", "--page-size", "1"];
@@ -38,22 +38,6 @@ bl asset
│ ├── enable # [P2]
│ └── disable # [P2]
│
├── transfer # [待定] 转存日志(等后端 API)
│ └── list
│
└── oss # OSS 转存子组
├── slr
│ └── authorize # 一键 SLR 授权
├── bind # 创建转存策略(绑定 OSS)
├── show # 查看当前转存策略
├── update # 更新转存策略
├── unbind # 删除转存策略(解绑)
├── regions
│ └── list # 列出可用 OSS 地域
├── buckets
│ └── list # 列出用户 bucket
└── folders
└── list # 列出 bucket 下文件夹
```
---
@@ -62,30 +46,21 @@ bl asset
`packages/cli/src/commands.ts` 中预期注册(camelCase export → kebab path):
| Map Key | Export 名(建议) | Phase |
| --------------------------- | ---------------------- | ----- |
| `"asset list"` | `assetList` | 1 |
| `"asset get"` | `assetGet` | 1 |
| `"asset favorite"` | `assetFavorite` | 1 |
| `"asset unfavorite"` | `assetUnfavorite` | 1 |
| `"asset delete"` | `assetDelete` | 1 |
| `"asset restore"` | `assetRestore` | 1 |
| `"asset download"` | `assetDownload` | 1 |
| `"asset stats"` | `assetStats` | 1 |
| `"asset storage"` | `assetStorage` | 1 |
| `"asset models list"` | `assetModelsList` | 2 |
| `"asset service status"` | `assetServiceStatus` | 2 |
| `"asset service enable"` | `assetServiceEnable` | 3 |
| `"asset service disable"` | `assetServiceDisable` | 3 |
| `"asset transfer list"` | `assetTransferList` | 3 |
| `"asset oss slr authorize"` | `assetOssSlrAuthorize` | 2 |
| `"asset oss bind"` | `assetOssBind` | 2 |
| `"asset oss show"` | `assetOssShow` | 2 |
| `"asset oss update"` | `assetOssUpdate` | 2 |
| `"asset oss unbind"` | `assetOssUnbind` | 2 |
| `"asset oss regions list"` | `assetOssRegionsList` | 2 |
| `"asset oss buckets list"` | `assetOssBucketsList` | 2 |
| `"asset oss folders list"` | `assetOssFoldersList` | 2 |
| Map Key | Export 名(建议) | Phase |
| ------------------------- | --------------------- | ----- |
| `"asset list"` | `assetList` | 1 |
| `"asset get"` | `assetGet` | 1 |
| `"asset favorite"` | `assetFavorite` | 1 |
| `"asset unfavorite"` | `assetUnfavorite` | 1 |
| `"asset delete"` | `assetDelete` | 1 |
| `"asset restore"` | `assetRestore` | 1 |
| `"asset download"` | `assetDownload` | 1 |
| `"asset stats"` | `assetStats` | 1 |
| `"asset storage"` | `assetStorage` | 1 |
| `"asset models list"` | `assetModelsList` | 2 |
| `"asset service status"` | `assetServiceStatus` | 2 |
| `"asset service enable"` | `assetServiceEnable` | 3 |
| `"asset service disable"` | `assetServiceDisable` | 3 |
---
@@ -109,31 +84,10 @@ Commands:
storage View storage quota and usage
models Model configuration helpers
service Asset center service subscription
transfer Asset transfer logs
oss OSS transfer policy management
Run `bl asset <command> --help` for details.
```
### 4.2 OSS 子分组
```
$ bl asset oss
OSS transfer policy commands.
Commands:
slr Service-linked role authorization
bind Create OSS transfer policy
show View current transfer policy
update Update transfer policy
unbind Delete transfer policy
regions List supported OSS regions
buckets List user OSS buckets
folders List folders in a bucket
Run `bl asset oss <command> --help` for details.
```
---
## 5. 各命令规格
@@ -366,159 +320,6 @@ Overage: ¥0.12/GB/month
---
### 5.2 Phase 2 命令 — OSS 子组
#### `bl asset oss slr authorize`
```
Description: Authorize OSS service-linked role (one-click)
Usage: bl asset oss slr authorize
Examples:
bl asset oss slr authorize
bl asset oss slr authorize --output json
```
**PRD 映射:** #8 SLR 一键授权
---
#### `bl asset oss bind`
```
Description: Create OSS transfer policy (bind bucket for asset transfer)
Usage: bl asset oss bind --bucket <name> --region <region> --path-prefix <prefix> --policy <policy> [flags]
Flags:
--bucket <name> OSS bucket name (required)
--region <region> OSS bucket region, e.g. cn-hangzhou (required)
--path-prefix <prefix> OSS path prefix, must not start with / (required)
--policy <policy> Transfer policy: ALL or BEFORE_DAYS (required)
--before-days <n> Transfer assets older than N days (required when policy=BEFORE_DAYS)
--delete-after-transfer Delete from platform after transfer completes
Examples:
bl asset oss bind --bucket my-bucket --region cn-hangzhou --path-prefix bailian-assets/ --policy ALL
bl asset oss bind --bucket my-bucket --region cn-hangzhou --path-prefix bailian/ --policy BEFORE_DAYS --before-days 30
```
**PRD 映射:** #9 绑定 OSS
---
#### `bl asset oss show`
```
Description: View current OSS transfer policy
Usage: bl asset oss show [--policy-id <id>]
Flags:
--policy-id <id> Policy ID (optional; omit to query by workspace)
Examples:
bl asset oss show
bl asset oss show --policy-id policy-abc123 --output json
```
**PRD 映射:** #10 查看 OSS 配置
---
#### `bl asset oss update`
```
Description: Update an existing OSS transfer policy
Usage: bl asset oss update --policy-id <id> [flags]
Flags:
--policy-id <id> Policy ID (required)
--bucket <name> OSS bucket name
--region <region> OSS bucket region
--path-prefix <prefix> OSS path prefix
--policy <policy> Transfer policy: ALL or BEFORE_DAYS
--before-days <n> Transfer days threshold
--delete-after-transfer Delete from platform after transfer
Examples:
bl asset oss update --policy-id policy-abc123 --policy ALL
bl asset oss update --policy-id policy-abc123 --delete-after-transfer
```
**PRD 映射:** #11 修改 OSS 配置
---
#### `bl asset oss unbind`
```
Description: Delete OSS transfer policy (unbind)
Usage: bl asset oss unbind --policy-id <id>
Flags:
--policy-id <id> Policy ID (required)
Examples:
bl asset oss unbind --policy-id policy-abc123
```
**PRD 映射:** #12 解绑 OSS
---
#### `bl asset oss regions list`
```
Description: List supported OSS regions
Usage: bl asset oss regions list
Examples:
bl asset oss regions list
bl asset oss regions list --output json
```
---
#### `bl asset oss buckets list`
```
Description: List user OSS buckets in a region
Usage: bl asset oss buckets list --region <region>
Flags:
--region <region> Bucket region (required)
Examples:
bl asset oss buckets list --region cn-hangzhou
```
---
#### `bl asset oss folders list`
```
Description: List folders under a prefix in an OSS bucket
Usage: bl asset oss folders list --bucket <name> --region <region> [--prefix <prefix>]
Flags:
--bucket <name> Bucket name (required)
--region <region> Bucket region (required)
--prefix <prefix> Folder prefix, e.g. documents/
Examples:
bl asset oss folders list --bucket my-bucket --region cn-hangzhou
bl asset oss folders list --bucket my-bucket --region cn-hangzhou --prefix documents/
```
---
### 5.3 Phase 2/3 可选命令
#### `bl asset models list`
@@ -549,28 +350,6 @@ Examples:
---
#### `bl asset transfer list`(待定)
```
Description: List asset transfer logs with pagination
Status: BLOCKED — API not in api-doc.md yet
Expected flags (draft):
--page-size <n>
--next-token <token>
--status <status> Transfer status filter
```
**PRD 映射:** #13 查看转存日志
**临时替代:**
```bash
bl asset list --sync-status SYNC_FAILED
bl asset stats --sync-failed
```
---
## 6. PRD 覆盖矩阵
@@ -584,12 +363,6 @@ bl asset stats --sync-failed
| 5 | 批量删除 | `asset delete`(多 `--id`) | 1 | ✅ 可开发 |
| 6 | 下载资产 | `asset download` | 1 | ✅ 可开发 |
| 7 | 查看资产统计 | `asset stats` | 1 | ✅ 可开发(转存失败用 workaround) |
| 8 | SLR 授权 | `asset oss slr authorize` | 2 | ✅ 可开发 |
| 9 | 绑定 OSS | `asset oss bind` | 2 | ✅ 可开发 |
| 10 | 查看 OSS 配置 | `asset oss show` | 2 | ✅ 可开发 |
| 11 | 修改 OSS 配置 | `asset oss update` | 2 | ✅ 可开发 |
| 12 | 解绑 OSS | `asset oss unbind` | 2 | ✅ 可开发 |
| 13 | 查看转存日志 | `asset transfer list` | 3 | ⛔ API 缺失 |
| 14 | 查看容量信息 | `asset storage` | 1 | ✅ 可开发 |
---
@@ -628,24 +401,6 @@ bl asset restore --id asset-001
bl asset download --id asset-001 --out ./image.png
```
### 7.4 OSS 转存配置
```bash
bl asset oss slr authorize
bl asset oss regions list
bl asset oss buckets list --region cn-hangzhou
bl asset oss folders list --bucket my-bucket --region cn-hangzhou --prefix bailian/
bl asset oss bind \
--bucket my-bucket \
--region cn-hangzhou \
--path-prefix bailian-assets/ \
--policy BEFORE_DAYS \
--before-days 30
bl asset oss show
bl asset oss update --policy-id policy-abc123 --policy ALL
bl asset oss unbind --policy-id policy-abc123
```
### 7.5 脚本翻页(JSON)
```bash
@@ -664,7 +419,7 @@ bl asset list --page-size 50 --next-token 1000 --output json
| `bl app list` | console gateway 调用、dry-run 输出 `{ api, data }` |
| `bl dataset list` | text 表格 + json items 结构 |
| `bl deploy list/get/create` | 产品域子命令命名、多级 path |
| `bl memory profile get/create` | 三级 path 子组(`asset oss slr status` 同级模式) |
| `bl memory profile get/create` | 三级 path 子组 |
| `bl quota list` | `zeldaHttp.*` API 名、响应 extract |
| `bl video download` | `--out` 落盘 |
| `bl usage stats` | `requireWorkspaceId`、console E2E 模式 |
@@ -673,6 +428,7 @@ bl asset list --page-size 50 --next-token 1000 --output json
## 9. 变更记录
| 日期 | 版本 | 说明 |
| ---------- | ---- | ------------------------------------- |
| 2026-07-09 | 0.1 | 初稿:命令树、PRD 映射、分 Phase 规格 |
| 日期 | 版本 | 说明 |
| ---------- | ---- | ---------------------------------------------- |
| 2026-07-09 | 0.1 | 初稿:命令树、PRD 映射、分 Phase 规格 |
| 2026-08-07 | 0.2 | 取消 OSS 转存命令(`oss *` / `transfer list`) |
@@ -7,13 +7,12 @@
### 1.1 背景
百炼资产中心(Asset Center)提供模型生成资产的存储、检索、收藏、删除、OSS 转存与容量管理能力。产品 PRD 要求 CLI 覆盖以下四大模块:
百炼资产中心(Asset Center)提供模型生成资产的存储、检索、收藏、删除与容量管理能力。产品 PRD 要求 CLI 覆盖以下模块:
| 模块 | PRD 能力 |
| -------- | ----------------------------------------------- |
| 资产管理 | 列表、详情、收藏/取消收藏、删除、批量删除、下载 |
| 资产统计 | 总量、按类型统计、转存失败数 |
| OSS 转存 | SLR 授权、绑定/查看/修改/解绑 OSS、转存日志 |
| 资产统计 | 总量、按类型统计 |
| 容量 | 已用容量、免费额度、超额单价 |
后端接口通过 **Zelda HTTP 网关** 暴露,Base Path 为 `/zelda/api/v1/bailian/asset`,详见 [api-doc.md](./api-doc.md)。
@@ -29,7 +28,6 @@
- 不在 `rag` 入口暴露(首期与 `deploy` / `finetune` 一致,仅 `bl`)
- 不暴露 `sendMqMessage` 等内部 MQ 接口
- 不实现交互式 OSS 绑定向导(Phase 3 可选增强)
- 不在 `core` / `runtime` 层硬编码 `bl` 命令名或控制台 URL
---
@@ -65,25 +63,6 @@
- **Phase 1 方案**:`bl asset stats --sync-failed` 额外发起一次 count 查询,输出 `sync_failed_count`
- **Phase 3 备选**:等后端在 stats 响应中增加专用字段后收敛
### 2.3 OSS 转存
| PRD # | 能力 | CLI 命令 | API Action | 备注 |
| ----- | ------------- | -------------------------------- | --------------------------- | ----------------------------- |
| 8 | SLR 授权 | `bl asset oss slr authorize` | `createOssSLR` | 一键授权,直接调用 create |
| 9 | 绑定 OSS | `bl asset oss bind` | `createAssetTransferPolicy` | 配置 bucket / path / 转存策略 |
| 10 | 查看 OSS 配置 | `bl asset oss show` | `getAssetTransferPolicy` | |
| 11 | 修改 OSS 配置 | `bl asset oss update` | `updateAssetTransferPolicy` | 需 `--policy-id` |
| 12 | 解绑 OSS | `bl asset oss unbind` | `deleteAssetTransferPolicy` | |
| 13 | 查看转存日志 | `bl asset transfer list`(待定) | **文档缺失** | 见 §6 风险项 |
**辅助命令(绑定 UX,API 已有):**
| CLI 命令 | API Action |
| --------------------------- | ------------------- |
| `bl asset oss regions list` | `listOssRegion` |
| `bl asset oss buckets list` | `listUserBuckets` |
| `bl asset oss folders list` | `listBucketFolders` |
### 2.4 容量
| PRD # | 能力 | CLI 命令 | API Action |
@@ -116,7 +95,7 @@ packages/runtime (createCli / authStage / registry)
约定:
- 实现文件按能力组织在本目录及 `oss/` 子目录
- 实现文件按能力组织在本目录
- `usageArgs` / `exampleArgs` 不含 `bl` 前缀
- 所有 asset 命令 `auth: "console"`;不重复声明 `CONSOLE_AUTH_FLAGS`(runtime 自动注入)
@@ -134,21 +113,9 @@ asset-center/
├── favorite.ts
├── unfavorite.ts
├── delete.ts
├── restore.ts
├── download.ts
├── stats.ts
├── storage.ts
├── models-list.ts # 可选 P1
├── service-status.ts # 可选 P1
└── oss/
├── slr-authorize.ts
├── bind.ts
├── show.ts
├── update.ts
├── unbind.ts
├── regions-list.ts
├── buckets-list.ts
└── folders-list.ts
└── storage.ts
```
### 3.3 共享层 `utils.ts`
@@ -279,12 +246,10 @@ CLI 用法:`--id asset-001 --id asset-002` 或多次重复。实现时在 `val
### 4.5 条件校验(`validate`)
| 命令 | 规则 |
| ------------ | --------------------------------------------------------------------------------------- |
| `oss bind` | `policy=BEFORE_DAYS` 时 `--before-days` 必填;`ossPathPrefix` 不能为空且不能以 `/` 开头 |
| `oss update` | 至少提供一个可更新字段 |
| `delete` | `--permanent` 映射 `PERMANENT_DELETE`;默认 `SOFT_DELETE` |
| 所有 batch | `assetIdList.length <= 100` |
| 命令 | 规则 |
| ---------- | --------------------------------------------------------- |
| `delete` | `--permanent` 映射 `PERMANENT_DELETE`;默认 `SOFT_DELETE` |
| 所有 batch | `assetIdList.length <= 100` |
---
@@ -343,39 +308,16 @@ CLI 用法:`--id asset-001 --id asset-002` 或多次重复。实现时在 `val
| `--sync-failed` | 额外查询 `syncOssDataStatus: SYNC_FAILED` 计数 |
| `--type` / `--model` / `--keyword` 等 | 与 list 相同筛选维度(可选) |
### 5.6 `bl asset oss bind`
| Flag | API 字段 | 必填 |
| ------------------------- | --------------------- | ------------------------- |
| `--bucket` | `ossBucket` | ✅ |
| `--region` | `ossBucketRegion` | ✅ |
| `--path-prefix` | `ossPathPrefix` | ✅ |
| `--policy` | `transferPolicy` | ✅,`ALL` / `BEFORE_DAYS` |
| `--before-days` | `transferBeforeDays` | policy=BEFORE_DAYS 时 ✅ |
| `--delete-after-transfer` | `deleteAfterTransfer` | 否 |
### 5.7 `bl asset oss update`
| Flag | 说明 |
| ------------------------------------ | -------- |
| `--policy-id` | required |
| 其余与 bind 相同,均可选(部分更新) |
### 5.8 `bl asset oss slr authorize`
直接调用 `createOssSLR`,一键完成 SLR 授权。
---
## 6. 风险与待确认项
### 6.1 P0 — 编码前必须对齐
| # | 问题 | 影响 | 建议动作 |
| --- | ------------------------------------------------------------------------- | -------------- | --------------------------------------------------------------- |
| 1 | Console API 注册名(`zeldaHttp.{service}./zelda/api/v1/bailian/asset/*`) | 无法调用 | `bl console call` spike;与后端确认 service 名 |
| 2 | `tenantId` / `mainAccountUid` 由谁填充 | 所有接口必填 | 确认网关是否从 session 自动注入;否则扩展 config 或新增解析 API |
| 3 | 转存日志 API 缺失(PRD #13) | 无法交付该子项 | 向后端索要接口;临时用 `asset list --sync-status SYNC_FAILED` |
| # | 问题 | 影响 | 建议动作 |
| --- | ------------------------------------------------------------------------- | ------------ | --------------------------------------------------------------- |
| 1 | Console API 注册名(`zeldaHttp.{service}./zelda/api/v1/bailian/asset/*`) | 无法调用 | `bl console call` spike;与后端确认 service 名 |
| 2 | `tenantId` / `mainAccountUid` 由谁填充 | 所有接口必填 | 确认网关是否从 session 自动注入;否则扩展 config 或新增解析 API |
### 6.2 P1 — 产品设计
@@ -448,23 +390,13 @@ asset list | get | favorite | unfavorite | delete | restore | download | stats |
**前置:** §6.1 #1 #2 确认。
### Phase 2 — OSS 转存(P1)
### Phase 2+ — 可选扩展
```
asset oss slr authorize
asset oss bind | show | update | unbind
asset oss regions | buckets | folders list
asset models list | service status
asset models list | service status | service enable/disable
```
### Phase 3 — 补齐(P2)
- 转存日志(等 API)
- `asset service enable/disable`
- OSS 交互式绑定向导
- README + 完整真实 E2E
---
> OSS 转存相关命令(`asset-center oss *` / `transfer list`)已取消,不再排期。
## 11. 参考
@@ -3,37 +3,29 @@
- **测试时间**: 2026-07-10 08:41:06 (UTC)
- **Workspace**: `llm-0xvms4kqhbqjlg8s`
- **样本 Asset ID**: `asset_df026105d2274ff9b8c824058fa23d60`
- **策略**: 只读命令真实调用;写操作/下载/OSS 变更一律 `--dry-run`
- **策略**: 只读命令真实调用;写操作/下载一律 `--dry-run`
- **汇总**: 24 通过 / 0 失败 / 24 总计
## 测试结果
| # | 分类 | 命令 | 模式 | 状态 | Exit | 耗时 | 结果摘要 |
| --- | ---- | ---------------------------------------------------- | -------- | ------- | ---- | ------- | --------------------------------------------------------------- |
| 1 | 查询 | `asset-center list` | 真实调用 | ✅ PASS | 0 | 18962ms | 3 item(s), next=94 |
| 2 | 查询 | `asset-center list --type IMAGE` | 真实调用 | ✅ PASS | 0 | 16411ms | 2 item(s), next=90 |
| 3 | 查询 | `asset-center get` | 真实调用 | ✅ PASS | 0 | 16541ms | {gmtModified, aliyunUid, generateTime, aliyunMainId} |
| 4 | 统计 | `asset-center stats` | 真实调用 | ✅ PASS | 0 | 14226ms | total=27 |
| 5 | 统计 | `asset-center storage` | 真实调用 | ✅ PASS | 0 | 18622ms | {used_storage_size, free_storage_quota, extra_storage_price} |
| 6 | 转存 | `asset-center transfer list` | 真实调用 | ✅ PASS | 0 | 19662ms | 0 item(s) |
| 7 | OSS | `asset-center oss slr status` | 真实调用 | ✅ PASS | 0 | 19745ms | authorized=true |
| 8 | OSS | `asset-center oss show` | 真实调用 | ✅ PASS | 0 | 21994ms | {success, failed, messageUnmodified} |
| 9 | 查询 | `asset-center list --dry-run` | dry-run | ✅ PASS | 0 | 23855ms | dry-run → /zelda/api/v1/bailian/asset/listModelGeneratedAsset |
| 10 | 查询 | `asset-center get --dry-run` | dry-run | ✅ PASS | 0 | 17398ms | dry-run → /zelda/api/v1/bailian/asset/getModelGeneratedAsset |
| 11 | 收藏 | `asset-center favorite` | dry-run | ✅ PASS | 0 | 16471ms | dry-run → /zelda/api/v1/bailian/asset/batchFavoriteAsset |
| 12 | 收藏 | `asset-center unfavorite` | dry-run | ✅ PASS | 0 | 19724ms | dry-run → /zelda/api/v1/bailian/asset/batchUnfavoriteAsset |
| 13 | 删除 | `asset-center delete` | dry-run | ✅ PASS | 0 | 20612ms | dry-run → /zelda/api/v1/bailian/asset/batchDeleteAsset |
| 14 | 下载 | `asset-center download` | dry-run | ✅ PASS | 0 | 20348ms | dry-run → /zelda/api/v1/bailian/asset/batchGetAssetDownloadUrl |
| 15 | 统计 | `asset-center stats --dry-run` | dry-run | ✅ PASS | 0 | 14898ms | dry-run → /zelda/api/v1/bailian/asset/countModelGeneratedAsset |
| 16 | 统计 | `asset-center storage --dry-run` | dry-run | ✅ PASS | 0 | 14305ms | dry-run → /zelda/api/v1/bailian/asset/getStorageQuota |
| 17 | OSS | `asset-center oss slr authorize` | dry-run | ✅ PASS | 0 | 14005ms | dry-run → /zelda/api/v1/bailian/asset/createOssSLR |
| 18 | OSS | `asset-center oss bind` | dry-run | ✅ PASS | 0 | 16737ms | dry-run → /zelda/api/v1/bailian/asset/createAssetTransferPolicy |
| 19 | OSS | `asset-center oss update` | dry-run | ✅ PASS | 0 | 18024ms | dry-run → /zelda/api/v1/bailian/asset/updateAssetTransferPolicy |
| 20 | OSS | `asset-center oss unbind` | dry-run | ✅ PASS | 0 | 15174ms | dry-run → /zelda/api/v1/bailian/asset/deleteAssetTransferPolicy |
| 21 | 校验 | `asset-center get (缺 asset-id)` | 参数校验 | ✅ PASS | 2 | 15202ms | Error: Missing required flag: --asset-id |
| 22 | 校验 | `asset-center favorite (缺 --id)` | 参数校验 | ✅ PASS | 2 | 16697ms | Error: Missing required flag: --id |
| 23 | 校验 | `asset-center download (缺 --out)` | 参数校验 | ✅ PASS | 2 | 18803ms | Error: Missing required flag: --out |
| 24 | 校验 | `asset-center oss bind (BEFORE_DAYS 缺 before-days)` | 参数校验 | ✅ PASS | 2 | 14996ms | Error: --before-days is required when --policy is BEFORE_DAYS. |
| # | 分类 | 命令 | 模式 | 状态 | Exit | 耗时 | 结果摘要 |
| --- | ---- | ---------------------------------- | -------- | ------- | ---- | ------- | -------------------------------------------------------------- |
| 1 | 查询 | `asset-center list` | 真实调用 | ✅ PASS | 0 | 18962ms | 3 item(s), next=94 |
| 2 | 查询 | `asset-center list --type IMAGE` | 真实调用 | ✅ PASS | 0 | 16411ms | 2 item(s), next=90 |
| 3 | 查询 | `asset-center get` | 真实调用 | ✅ PASS | 0 | 16541ms | {gmtModified, aliyunUid, generateTime, aliyunMainId} |
| 4 | 统计 | `asset-center stats` | 真实调用 | ✅ PASS | 0 | 14226ms | total=27 |
| 5 | 统计 | `asset-center storage` | 真实调用 | ✅ PASS | 0 | 18622ms | {used_storage_size, free_storage_quota, extra_storage_price} |
| 9 | 查询 | `asset-center list --dry-run` | dry-run | ✅ PASS | 0 | 23855ms | dry-run → /zelda/api/v1/bailian/asset/listModelGeneratedAsset |
| 10 | 查询 | `asset-center get --dry-run` | dry-run | ✅ PASS | 0 | 17398ms | dry-run → /zelda/api/v1/bailian/asset/getModelGeneratedAsset |
| 11 | 收藏 | `asset-center favorite` | dry-run | ✅ PASS | 0 | 16471ms | dry-run → /zelda/api/v1/bailian/asset/batchFavoriteAsset |
| 12 | 收藏 | `asset-center unfavorite` | dry-run | ✅ PASS | 0 | 19724ms | dry-run → /zelda/api/v1/bailian/asset/batchUnfavoriteAsset |
| 13 | 删除 | `asset-center delete` | dry-run | ✅ PASS | 0 | 20612ms | dry-run → /zelda/api/v1/bailian/asset/batchDeleteAsset |
| 14 | 下载 | `asset-center download` | dry-run | ✅ PASS | 0 | 20348ms | dry-run → /zelda/api/v1/bailian/asset/batchGetAssetDownloadUrl |
| 15 | 统计 | `asset-center stats --dry-run` | dry-run | ✅ PASS | 0 | 14898ms | dry-run → /zelda/api/v1/bailian/asset/countModelGeneratedAsset |
| 16 | 统计 | `asset-center storage --dry-run` | dry-run | ✅ PASS | 0 | 14305ms | dry-run → /zelda/api/v1/bailian/asset/getStorageQuota |
| 21 | 校验 | `asset-center get (缺 asset-id)` | 参数校验 | ✅ PASS | 2 | 15202ms | Error: Missing required flag: --asset-id |
| 22 | 校验 | `asset-center favorite (缺 --id)` | 参数校验 | ✅ PASS | 2 | 16697ms | Error: Missing required flag: --id |
| 23 | 校验 | `asset-center download (缺 --out)` | 参数校验 | ✅ PASS | 2 | 18803ms | Error: Missing required flag: --out |
## 模式说明
@@ -79,198 +79,6 @@
---
## 2. 检查 OSS SLR 授权状态
**POST** `/zelda/api/v1/bailian/asset/checkOssSLR`
### 请求参数
仅需公共参数(`mainAccountUid` 必填)。
### 响应 data
| 字段 | 类型 | 说明 |
| ---------- | ------- | ------------------ |
| authorized | Boolean | 是否已授权 OSS SLR |
### 请求示例
```json
{
"workspace": "ws-xxxxx",
"tenantId": "123456",
"mainAccountUid": "1234567890"
}
```
---
## 3. 创建 OSS SLR 授权
**POST** `/zelda/api/v1/bailian/asset/createOssSLR`
### 请求参数
仅需公共参数(`mainAccountUid` 必填)。
### 响应 data
| 字段 | 类型 | 说明 |
| ------- | ------- | ------------ |
| success | Boolean | 是否创建成功 |
### 请求示例
```json
{
"workspace": "ws-xxxxx",
"tenantId": "123456",
"mainAccountUid": "1234567890"
}
```
---
## 4. 创建 OSS 资产转存策略
**POST** `/zelda/api/v1/bailian/asset/createAssetTransferPolicy`
### 请求参数
| 字段 | 类型 | 必填 | 说明 |
| ------------------- | ------------ | -------- | -------------------------------------------------------------- |
| transferPolicy | String(Enum) | 是 | 转存策略:`ALL`-全部转存,`BEFORE_DAYS`-转存指定天数之前的数据 |
| transferBeforeDays | Integer | 条件必填 | 转存天数阈值,transferPolicy 为 BEFORE_DAYS 时必填 |
| ossBucket | String | 是 | 用户 OSS 的 bucket 名称 |
| ossBucketRegion | String | 是 | 用户 OSS bucket 的地域 |
| ossPathPrefix | String | 是 | 用户 OSS 的存储路径前缀(不能为空,不能以 `/` 开头) |
| deleteAfterTransfer | Boolean | 否 | 转存完成后是否从平台删除:true-删除,false-保留 |
### 响应 data
| 字段 | 类型 | 说明 |
| -------- | ------ | ------------------ |
| policyId | String | 新创建的转存策略ID |
### 请求示例
```json
{
"workspace": "ws-xxxxx",
"tenantId": "123456",
"mainAccountUid": "1234567890",
"transferPolicy": "BEFORE_DAYS",
"transferBeforeDays": 30,
"ossBucket": "my-bucket",
"ossBucketRegion": "cn-hangzhou",
"ossPathPrefix": "bailian-assets/",
"deleteAfterTransfer": false
}
```
---
## 5. 更新 OSS 资产转存策略
**POST** `/zelda/api/v1/bailian/asset/updateAssetTransferPolicy`
### 请求参数
| 字段 | 类型 | 必填 | 说明 |
| ------------------- | ------------ | ---- | ------------------------------- |
| policyId | String | 是 | 转存策略ID |
| transferPolicy | String(Enum) | 否 | 转存策略:`ALL` / `BEFORE_DAYS` |
| transferBeforeDays | Integer | 否 | 转存天数阈值 |
| ossBucket | String | 否 | 用户 OSS 的 bucket 名称 |
| ossBucketRegion | String | 否 | 用户 OSS bucket 的地域 |
| ossPathPrefix | String | 否 | 用户 OSS 的存储路径前缀 |
| deleteAfterTransfer | Boolean | 否 | 转存完成后是否从平台删除 |
### 响应 data
| 字段 | 类型 | 说明 |
| ------- | ------- | ------------ |
| success | Boolean | 是否更新成功 |
### 请求示例
```json
{
"workspace": "ws-xxxxx",
"tenantId": "123456",
"mainAccountUid": "1234567890",
"policyId": "policy-abc123",
"transferPolicy": "ALL",
"deleteAfterTransfer": true
}
```
---
## 6. 删除 OSS 资产转存策略
**POST** `/zelda/api/v1/bailian/asset/deleteAssetTransferPolicy`
### 请求参数
| 字段 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ---------- |
| policyId | String | 是 | 转存策略ID |
### 响应 data
| 字段 | 类型 | 说明 |
| ------- | ------- | ------------ |
| success | Boolean | 是否删除成功 |
### 请求示例
```json
{
"workspace": "ws-xxxxx",
"tenantId": "123456",
"mainAccountUid": "1234567890",
"policyId": "policy-abc123"
}
```
---
## 7. 查询 OSS 资产转存策略
**POST** `/zelda/api/v1/bailian/asset/getAssetTransferPolicy`
### 请求参数
| 字段 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------------------------------- |
| policyId | String | 否 | 转存策略ID。指定时按 policyId 查询,否则按工作空间+主账号查询 |
### 响应 data
| 字段 | 类型 | 说明 |
| ------------------- | ------- | --------------------------- |
| policyId | String | 转存策略ID |
| transferPolicy | String | 转存策略:ALL / BEFORE_DAYS |
| transferBeforeDays | Integer | 转存天数阈值 |
| ossBucket | String | 用户 OSS 的 bucket 名称 |
| ossBucketRegion | String | 用户 OSS bucket 的地域 |
| ossPathPrefix | String | 用户 OSS 的存储路径前缀 |
| deleteAfterTransfer | Boolean | 转存完成后是否从平台删除 |
### 请求示例
```json
{
"workspace": "ws-xxxxx",
"tenantId": "123456",
"mainAccountUid": "1234567890",
"policyId": "policy-abc123"
}
```
---
## 8. 批量收藏资产
**POST** `/zelda/api/v1/bailian/asset/batchFavoriteAsset`
@@ -676,90 +484,6 @@
---
## 17. 查询用户 OSS Bucket 列表
**POST** `/zelda/api/v1/bailian/asset/listUserBuckets`
查询当前用户在指定地域下的 OSS bucket 列表,包含是否打标信息。
### 请求参数
| 字段 | 类型 | 必填 | 说明 |
| ------------ | ------ | ---- | --------------------------------- |
| bucketRegion | String | 是 | bucket 所在地域,如 `cn-hangzhou` |
### 响应 data
| 字段 | 类型 | 说明 |
| ------- | -------------------- | ------------------------ |
| buckets | List<UserBucketInfo> | 指定地域下的 bucket 列表 |
**UserBucketInfo 结构:**
| 字段 | 类型 | 说明 |
| ---------- | ------- | ------------------------------------------- |
| bucketName | String | bucket 名称 |
| tagged | Boolean | 该 bucket 是否已按配置的 tag key/value 打标 |
### 请求示例
```json
{
"workspace": "ws-xxxxx",
"tenantId": "123456",
"mainAccountUid": "1234567890",
"bucketRegion": "cn-hangzhou"
}
```
---
## 18. 查询 Bucket 文件夹列表
**POST** `/zelda/api/v1/bailian/asset/listBucketFolders`
查询指定 bucket 下某个前缀下的文件夹列表(使用 delimiter="/" 实现文件夹层级发现)。
### 请求参数
| 字段 | 类型 | 必填 | 说明 |
| ------------ | ------ | ---- | ------------------------------------------------------- |
| bucketName | String | 是 | OSS bucket 名称 |
| prefix | String | 否 | 文件夹前缀,如 `documents/`;为空时列出根目录下的文件夹 |
| bucketRegion | String | 是 | bucket 所在地域,如 `cn-hangzhou` |
### 响应 data
| 字段 | 类型 | 说明 |
| ------- | ------------ | ---------------------------------------------------------------- |
| folders | List<String> | 文件夹列表(每项为完整的 common prefix,如 `documents/photos/`) |
### 请求示例
```json
{
"workspace": "ws-xxxxx",
"tenantId": "123456",
"mainAccountUid": "1234567890",
"bucketName": "my-bucket",
"prefix": "documents/",
"bucketRegion": "cn-hangzhou"
}
```
### 响应示例
```json
{
"success": true,
"data": {
"folders": ["documents/photos/", "documents/videos/", "documents/reports/"]
}
}
```
---
## 19. 通用 MQ 消息发送
**POST** `/zelda/api/v1/bailian/asset/sendMqMessage`
@@ -794,56 +518,6 @@
---
## 20. 查询 OSS 地域列表
**POST** `/zelda/api/v1/bailian/asset/listOssRegion`
返回系统支持的 OSS 地域列表,包含每个地域的 regionId 和 regionLabel(中文名称)。
### 请求参数
仅需公共参数。
### 响应 data
| 字段 | 类型 | 说明 |
| ------- | ------------------- | -------- |
| regions | List<OssRegionItem> | 地域列表 |
**OssRegionItem 结构:**
| 字段 | 类型 | 说明 |
| ----------- | ------ | ---------------------------------- |
| regionId | String | 地域ID(如 `cn-hangzhou`) |
| regionLabel | String | 地域中文名称(如 `华东1(杭州)`) |
### 请求示例
```json
{
"workspace": "ws-xxxxx",
"tenantId": "123456",
"mainAccountUid": "1234567890"
}
```
### 响应示例
```json
{
"success": true,
"data": {
"regions": [
{ "regionId": "cn-hangzhou", "regionLabel": "华东1(杭州)" },
{ "regionId": "cn-shanghai", "regionLabel": "华东2(上海)" },
{ "regionId": "cn-beijing", "regionLabel": "华北2(北京)" }
]
}
}
```
---
## 21. 查询模型列表
**POST** `/zelda/api/v1/bailian/asset/listModels`
@@ -1,105 +0,0 @@
import { defineCommand, detectOutputFormat, type FlagsDef } from "bailian-cli-core";
import { emitResult, emitBare } from "bailian-cli-runtime";
import type { AssetTransferPolicyCreateResponse } from "../types.ts";
import { ASSET_API, callAssetApi, dryRunPayload } from "../utils.ts";
const BIND_FLAGS = {
bucket: {
type: "string",
valueHint: "<name>",
description: "OSS bucket name",
required: true,
},
region: {
type: "string",
valueHint: "<region>",
description: "OSS bucket region (e.g. cn-hangzhou)",
required: true,
},
pathPrefix: {
type: "string",
valueHint: "<prefix>",
description: "OSS path prefix (must not start with /)",
required: true,
},
policy: {
type: "string",
valueHint: "<policy>",
description: "Transfer policy: ALL or BEFORE_DAYS",
choices: ["ALL", "BEFORE_DAYS"] as const,
required: true,
},
beforeDays: {
type: "number",
valueHint: "<n>",
description: "Transfer assets older than N days (required when policy=BEFORE_DAYS)",
},
deleteAfterTransfer: {
type: "switch",
description: "Delete from platform after transfer completes",
},
} satisfies FlagsDef;
/**
* `bl asset-center oss bind` — 创建 OSS 转存策略(绑定 bucket)。
*
* --policy ALL 转存全部资产;BEFORE_DAYS 需配合 --before-days。
* 可选 --delete-after-transfer 在转存完成后从平台删除。
*/
export default defineCommand({
description: "Create OSS transfer policy (bind bucket for asset transfer)",
auth: "console",
usageArgs: "--bucket <name> --region <region> --path-prefix <prefix> --policy <policy> [flags]",
flags: BIND_FLAGS,
exampleArgs: [
"--bucket my-bucket --region cn-hangzhou --path-prefix bailian-assets/ --policy ALL",
"--bucket my-bucket --region cn-hangzhou --path-prefix bailian/ --policy BEFORE_DAYS --before-days 30",
],
validate(flags) {
if (flags.policy === "BEFORE_DAYS" && flags.beforeDays === undefined) {
return "--before-days is required when --policy is BEFORE_DAYS.";
}
if (flags.pathPrefix.startsWith("/")) {
return "--path-prefix must not start with /.";
}
if (!flags.pathPrefix.trim()) {
return "--path-prefix must not be empty.";
}
return undefined;
},
async run(ctx) {
const { settings, identity, flags } = ctx;
const format = detectOutputFormat(settings.output);
const body: Record<string, unknown> = {
transferPolicy: flags.policy,
ossBucket: flags.bucket,
ossBucketRegion: flags.region,
ossPathPrefix: flags.pathPrefix,
};
if (flags.beforeDays !== undefined) body.transferBeforeDays = flags.beforeDays;
if (flags.deleteAfterTransfer) body.deleteAfterTransfer = true;
if (settings.dryRun) {
emitResult(
dryRunPayload(settings, identity.binName, ASSET_API.createAssetTransferPolicy, body),
format,
);
return;
}
const data = await callAssetApi<AssetTransferPolicyCreateResponse>(
ctx.client,
settings,
identity.binName,
ASSET_API.createAssetTransferPolicy,
body,
);
if (settings.quiet || format === "text") {
emitBare(`Transfer policy created: ${data.policyId ?? "-"}`);
} else {
emitResult({ policy_id: data.policyId }, format);
}
},
});
@@ -1,60 +0,0 @@
import { defineCommand, detectOutputFormat, type FlagsDef } from "bailian-cli-core";
import { emitResult, emitBare, padEnd } from "bailian-cli-runtime";
import type { AssetTransferPolicy } from "../types.ts";
import { ASSET_API, callAssetApi, dryRunPayload } from "../utils.ts";
const SHOW_FLAGS = {
policyId: {
type: "string",
valueHint: "<id>",
description: "Policy ID (optional; omit to query by workspace)",
},
} satisfies FlagsDef;
/**
* `bl asset-center oss show` — 查看当前 OSS 转存策略。
*
* 可省略 --policy-id,按 workspace 查询默认策略。
*/
export default defineCommand({
description: "View current OSS transfer policy",
auth: "console",
usageArgs: "[--policy-id <id>] [flags]",
flags: SHOW_FLAGS,
exampleArgs: ["", "--policy-id policy-abc123 --output json"],
async run(ctx) {
const { settings, identity, flags } = ctx;
const format = detectOutputFormat(settings.output);
const body: Record<string, unknown> = {};
if (flags.policyId) body.policyId = flags.policyId;
if (settings.dryRun) {
emitResult(
dryRunPayload(settings, identity.binName, ASSET_API.getAssetTransferPolicy, body),
format,
);
return;
}
const data = await callAssetApi<AssetTransferPolicy>(
ctx.client,
settings,
identity.binName,
ASSET_API.getAssetTransferPolicy,
body,
);
if (format === "json") {
emitResult(data, format);
return;
}
emitBare(`${padEnd("PolicyId", 18)} ${data.policyId ?? "-"}`);
emitBare(`${padEnd("Policy", 18)} ${data.transferPolicy ?? "-"}`);
emitBare(`${padEnd("BeforeDays", 18)} ${data.transferBeforeDays ?? "-"}`);
emitBare(`${padEnd("Bucket", 18)} ${data.ossBucket ?? "-"}`);
emitBare(`${padEnd("Region", 18)} ${data.ossBucketRegion ?? "-"}`);
emitBare(`${padEnd("PathPrefix", 18)} ${data.ossPathPrefix ?? "-"}`);
emitBare(`${padEnd("DeleteAfter", 18)} ${data.deleteAfterTransfer ? "yes" : "no"}`);
},
});
@@ -1,37 +0,0 @@
import { defineCommand, detectOutputFormat } from "bailian-cli-core";
import { emitResult, emitBare } from "bailian-cli-runtime";
import type { AssetOssSlrResponse } from "../types.ts";
import { ASSET_API, callAssetApi, dryRunPayload } from "../utils.ts";
/**
* `bl asset-center oss slr authorize` — 一键授权 OSS 服务关联角色(SLR)。
*/
export default defineCommand({
description: "Authorize OSS service-linked role (one-click)",
auth: "console",
usageArgs: "[flags]",
exampleArgs: ["", "--output json"],
async run(ctx) {
const { settings, identity } = ctx;
const format = detectOutputFormat(settings.output);
if (settings.dryRun) {
emitResult(dryRunPayload(settings, identity.binName, ASSET_API.createOssSLR, {}), format);
return;
}
const data = await callAssetApi<AssetOssSlrResponse>(
ctx.client,
settings,
identity.binName,
ASSET_API.createOssSLR,
{},
);
if (settings.quiet || format === "text") {
emitBare(data.success ? "OSS SLR authorized." : "OSS SLR authorization failed.");
} else {
emitResult({ success: data.success ?? false }, format);
}
},
});
@@ -1,51 +0,0 @@
import { defineCommand, detectOutputFormat, type FlagsDef } from "bailian-cli-core";
import { emitResult, emitBare } from "bailian-cli-runtime";
import type { AssetTransferPolicyMutationResponse } from "../types.ts";
import { ASSET_API, callAssetApi, dryRunPayload } from "../utils.ts";
const UNBIND_FLAGS = {
policyId: {
type: "string",
valueHint: "<id>",
description: "Transfer policy ID",
required: true,
},
} satisfies FlagsDef;
/**
* `bl asset-center oss unbind` — 删除 OSS 转存策略(解绑)。
*/
export default defineCommand({
description: "Delete OSS transfer policy (unbind)",
auth: "console",
usageArgs: "--policy-id <id>",
flags: UNBIND_FLAGS,
exampleArgs: ["--policy-id policy-abc123"],
async run(ctx) {
const { settings, identity, flags } = ctx;
const format = detectOutputFormat(settings.output);
const body = { policyId: flags.policyId };
if (settings.dryRun) {
emitResult(
dryRunPayload(settings, identity.binName, ASSET_API.deleteAssetTransferPolicy, body),
format,
);
return;
}
const data = await callAssetApi<AssetTransferPolicyMutationResponse>(
ctx.client,
settings,
identity.binName,
ASSET_API.deleteAssetTransferPolicy,
body,
);
if (settings.quiet || format === "text") {
emitBare(data.success ? "Transfer policy deleted." : "Transfer policy delete failed.");
} else {
emitResult({ success: data.success ?? false }, format);
}
},
});
@@ -1,104 +0,0 @@
import { defineCommand, detectOutputFormat, type FlagsDef } from "bailian-cli-core";
import { emitResult, emitBare } from "bailian-cli-runtime";
import type { AssetTransferPolicyMutationResponse } from "../types.ts";
import { ASSET_API, callAssetApi, dryRunPayload } from "../utils.ts";
const UPDATE_FLAGS = {
policyId: {
type: "string",
valueHint: "<id>",
description: "Transfer policy ID",
required: true,
},
bucket: { type: "string", valueHint: "<name>", description: "OSS bucket name" },
region: { type: "string", valueHint: "<region>", description: "OSS bucket region" },
pathPrefix: {
type: "string",
valueHint: "<prefix>",
description: "OSS path prefix (must not start with /)",
},
policy: {
type: "string",
valueHint: "<policy>",
description: "Transfer policy: ALL or BEFORE_DAYS",
choices: ["ALL", "BEFORE_DAYS"] as const,
},
beforeDays: {
type: "number",
valueHint: "<n>",
description: "Transfer days threshold",
},
deleteAfterTransfer: {
type: "switch",
description: "Delete from platform after transfer completes",
},
} satisfies FlagsDef;
/**
* `bl asset-center oss update` — 更新已有 OSS 转存策略。
*
* 至少需传入一个待更新字段;policy=BEFORE_DAYS 时须带 --before-days。
*/
export default defineCommand({
description: "Update an existing OSS transfer policy",
auth: "console",
usageArgs: "--policy-id <id> [flags]",
flags: UPDATE_FLAGS,
exampleArgs: [
"--policy-id policy-abc123 --policy ALL",
"--policy-id policy-abc123 --delete-after-transfer",
],
validate(flags) {
if (flags.pathPrefix?.startsWith("/")) {
return "--path-prefix must not start with /.";
}
if (flags.policy === "BEFORE_DAYS" && flags.beforeDays === undefined) {
return "--before-days is required when --policy is BEFORE_DAYS.";
}
const hasUpdate =
flags.bucket ||
flags.region ||
flags.pathPrefix ||
flags.policy ||
flags.beforeDays !== undefined ||
flags.deleteAfterTransfer;
if (!hasUpdate) {
return "Provide at least one field to update.";
}
return undefined;
},
async run(ctx) {
const { settings, identity, flags } = ctx;
const format = detectOutputFormat(settings.output);
const body: Record<string, unknown> = { policyId: flags.policyId };
if (flags.bucket) body.ossBucket = flags.bucket;
if (flags.region) body.ossBucketRegion = flags.region;
if (flags.pathPrefix) body.ossPathPrefix = flags.pathPrefix;
if (flags.policy) body.transferPolicy = flags.policy;
if (flags.beforeDays !== undefined) body.transferBeforeDays = flags.beforeDays;
if (flags.deleteAfterTransfer) body.deleteAfterTransfer = true;
if (settings.dryRun) {
emitResult(
dryRunPayload(settings, identity.binName, ASSET_API.updateAssetTransferPolicy, body),
format,
);
return;
}
const data = await callAssetApi<AssetTransferPolicyMutationResponse>(
ctx.client,
settings,
identity.binName,
ASSET_API.updateAssetTransferPolicy,
body,
);
if (settings.quiet || format === "text") {
emitBare(data.success ? "Transfer policy updated." : "Transfer policy update failed.");
} else {
emitResult({ success: data.success ?? false }, format);
}
},
});
@@ -1,106 +0,0 @@
import { defineCommand, detectOutputFormat, type FlagsDef } from "bailian-cli-core";
import { emitResult, emitBare, formatTable } from "bailian-cli-runtime";
import type { AssetListResponse, ModelGeneratedAssetItem } from "./types.ts";
import { ASSET_API, callAssetApi, dryRunPayload, formatGenerateTime } from "./utils.ts";
const TRANSFER_LIST_FLAGS = {
status: {
type: "string",
valueHint: "<status>",
description: "OSS sync status filter",
choices: ["NOT_SYNCED", "IN_SYNCING", "SYNC_SUCCESS", "SYNC_FAILED"] as const,
},
pageSize: {
type: "number",
valueHint: "<n>",
description: "Results per page (default: 10, max: 100)",
},
nextToken: {
type: "number",
valueHint: "<token>",
description: "Cursor for the next page",
},
} satisfies FlagsDef;
function normalizeItem(item: ModelGeneratedAssetItem) {
return {
asset_id: item.assetId ?? "",
asset_type: item.assetType ?? "",
asset_name: item.assetName ?? "",
sync_status: item.syncOssDataStatus ?? "",
generate_time: item.generateTime,
};
}
/**
* `bl asset-center transfer list` — 按 OSS 同步状态查看转存记录。
*
* 后端尚无独立转存日志 API,复用 listModelGeneratedAsset 并按 syncOssDataStatus
* 过滤(默认 SYNC_FAILED)。
*/
export default defineCommand({
description: "List asset OSS transfer records (filtered by sync status)",
auth: "console",
usageArgs: "[--status <status>] [flags]",
flags: TRANSFER_LIST_FLAGS,
exampleArgs: ["", "--status SYNC_FAILED", "--status IN_SYNCING --page-size 20 --output json"],
async run(ctx) {
const { settings, identity, flags } = ctx;
const format = detectOutputFormat(settings.output);
const syncStatus = flags.status ?? "SYNC_FAILED";
const body: Record<string, unknown> = {
deleteStatus: "NORMAL",
syncOssDataStatus: syncStatus,
pageSize: flags.pageSize ?? 10,
};
if (flags.nextToken !== undefined) body.nextToken = flags.nextToken;
if (settings.dryRun) {
emitResult(
dryRunPayload(settings, identity.binName, ASSET_API.listModelGeneratedAsset, body),
format,
);
return;
}
const data = await callAssetApi<AssetListResponse>(
ctx.client,
settings,
identity.binName,
ASSET_API.listModelGeneratedAsset,
body,
);
const items = (data.dataList ?? []).map(normalizeItem);
if (format === "json") {
emitResult(
{
items,
sync_status: syncStatus,
next_token: data.nextToken,
has_next: data.hasNext,
},
format,
);
return;
}
if (items.length === 0) {
emitBare(`No transfer records with status ${syncStatus}.`);
return;
}
const headers = ["ASSET_ID", "TYPE", "NAME", "SYNC_STATUS", "GENERATED"];
const rows = items.map((item) => [
item.asset_id,
item.asset_type,
item.asset_name,
item.sync_status,
formatGenerateTime(item.generate_time),
]);
for (const line of formatTable(headers, rows)) emitBare(line);
if (data.hasNext) emitBare(`\nnext token: ${data.nextToken}`);
},
});
@@ -70,26 +70,3 @@ export interface AssetStorageQuotaResponse {
usedStorageSize?: number;
extraStoragePrice?: string;
}
export interface AssetOssSlrResponse {
authorized?: boolean;
success?: boolean;
}
export interface AssetTransferPolicy {
policyId?: string;
transferPolicy?: string;
transferBeforeDays?: number;
ossBucket?: string;
ossBucketRegion?: string;
ossPathPrefix?: string;
deleteAfterTransfer?: boolean;
}
export interface AssetTransferPolicyCreateResponse {
policyId?: string;
}
export interface AssetTransferPolicyMutationResponse {
success?: boolean;
}
@@ -22,11 +22,6 @@ export const ASSET_API = {
batchGetAssetDownloadUrl: assetApi("batchGetAssetDownloadUrl"),
countModelGeneratedAsset: assetApi("countModelGeneratedAsset"),
getStorageQuota: assetApi("getStorageQuota"),
createOssSLR: assetApi("createOssSLR"),
createAssetTransferPolicy: assetApi("createAssetTransferPolicy"),
getAssetTransferPolicy: assetApi("getAssetTransferPolicy"),
updateAssetTransferPolicy: assetApi("updateAssetTransferPolicy"),
deleteAssetTransferPolicy: assetApi("deleteAssetTransferPolicy"),
} as const;
export const ASSET_ID_FLAG = {
-6
View File
@@ -99,12 +99,6 @@ export { default as assetDelete } from "./commands/asset-center/delete.ts";
export { default as assetDownload } from "./commands/asset-center/download.ts";
export { default as assetStats } from "./commands/asset-center/stats.ts";
export { default as assetStorage } from "./commands/asset-center/storage.ts";
export { default as assetTransferList } from "./commands/asset-center/transfer-list.ts";
export { default as assetOssSlrAuthorize } from "./commands/asset-center/oss/slr-authorize.ts";
export { default as assetOssBind } from "./commands/asset-center/oss/bind.ts";
export { default as assetOssShow } from "./commands/asset-center/oss/show.ts";
export { default as assetOssUpdate } from "./commands/asset-center/oss/update.ts";
export { default as assetOssUnbind } from "./commands/asset-center/oss/unbind.ts";
export { default as managedAgentInit } from "./commands/managed-agent/init.ts";
export { default as managedAgentValidate } from "./commands/managed-agent/validate.ts";
export { default as managedAgentPlan } from "./commands/managed-agent/plan.ts";
+10 -196
View File
@@ -7,22 +7,16 @@ Index: [index.md](index.md)
## Commands in this group
| Command | Description |
| ----------------------------------- | -------------------------------------------------------------- |
| `bl asset-center delete` | Delete assets (soft delete to recycle bin by default) |
| `bl asset-center download` | Get a signed download URL for an asset by ID |
| `bl asset-center favorite` | Add assets to favorites |
| `bl asset-center get` | Get full details of a model-generated asset |
| `bl asset-center list` | List model-generated assets with filters and cursor pagination |
| `bl asset-center oss bind` | Create OSS transfer policy (bind bucket for asset transfer) |
| `bl asset-center oss show` | View current OSS transfer policy |
| `bl asset-center oss slr authorize` | Authorize OSS service-linked role (one-click) |
| `bl asset-center oss unbind` | Delete OSS transfer policy (unbind) |
| `bl asset-center oss update` | Update an existing OSS transfer policy |
| `bl asset-center stats` | Count model-generated assets by type |
| `bl asset-center storage` | View storage quota, usage, and overage pricing |
| `bl asset-center transfer list` | List asset OSS transfer records (filtered by sync status) |
| `bl asset-center unfavorite` | Remove assets from favorites |
| Command | Description |
| ---------------------------- | -------------------------------------------------------------- |
| `bl asset-center delete` | Delete assets (soft delete to recycle bin by default) |
| `bl asset-center download` | Get a signed download URL for an asset by ID |
| `bl asset-center favorite` | Add assets to favorites |
| `bl asset-center get` | Get full details of a model-generated asset |
| `bl asset-center list` | List model-generated assets with filters and cursor pagination |
| `bl asset-center stats` | Count model-generated assets by type |
| `bl asset-center storage` | View storage quota, usage, and overage pricing |
| `bl asset-center unfavorite` | Remove assets from favorites |
## Command details
@@ -205,152 +199,6 @@ bl asset-center list --recycle-bin
bl asset-center list --keyword landscape --output json
```
### `bl asset-center oss bind`
| Field | Value |
| --------------- | ------------------------------------------------------------------------------------------------------------- |
| **Name** | `asset-center oss bind` |
| **Description** | Create OSS transfer policy (bind bucket for asset transfer) |
| **Usage** | `bl asset-center oss bind --bucket <name> --region <region> --path-prefix <prefix> --policy <policy> [flags]` |
#### Flags
| Flag | Type | Required | Description |
| ------------------------------ | ------ | -------- | -------------------------------------------------------------------- |
| `--bucket <name>` | string | yes | OSS bucket name |
| `--region <region>` | string | yes | OSS bucket region (e.g. cn-hangzhou) |
| `--path-prefix <prefix>` | string | yes | OSS path prefix (must not start with /) |
| `--policy <ALL\|BEFORE_DAYS>` | string | yes | Transfer policy: ALL or BEFORE_DAYS |
| `--before-days <n>` | number | no | Transfer assets older than N days (required when policy=BEFORE_DAYS) |
| `--delete-after-transfer` | switch | no | Delete from platform after transfer completes |
| `--console-region <region>` | string | no | Console gateway region (e.g. cn-beijing, ap-southeast-1) |
| `--console-site <site>` | string | no | Console site: domestic, international |
| `--console-switch-agent <uid>` | number | no | Switch agent UID for delegated access |
| `--workspace-id <id>` | string | no | Workspace ID (env: BAILIAN_WORKSPACE_ID) |
#### Examples
```bash
bl asset-center oss bind --bucket my-bucket --region cn-hangzhou --path-prefix bailian-assets/ --policy ALL
```
```bash
bl asset-center oss bind --bucket my-bucket --region cn-hangzhou --path-prefix bailian/ --policy BEFORE_DAYS --before-days 30
```
### `bl asset-center oss show`
| Field | Value |
| --------------- | ----------------------------------------------------- |
| **Name** | `asset-center oss show` |
| **Description** | View current OSS transfer policy |
| **Usage** | `bl asset-center oss show [--policy-id <id>] [flags]` |
#### Flags
| Flag | Type | Required | Description |
| ------------------------------ | ------ | -------- | -------------------------------------------------------- |
| `--policy-id <id>` | string | no | Policy ID (optional; omit to query by workspace) |
| `--console-region <region>` | string | no | Console gateway region (e.g. cn-beijing, ap-southeast-1) |
| `--console-site <site>` | string | no | Console site: domestic, international |
| `--console-switch-agent <uid>` | number | no | Switch agent UID for delegated access |
| `--workspace-id <id>` | string | no | Workspace ID (env: BAILIAN_WORKSPACE_ID) |
#### Examples
```bash
bl asset-center oss show
```
```bash
bl asset-center oss show --policy-id policy-abc123 --output json
```
### `bl asset-center oss slr authorize`
| Field | Value |
| --------------- | --------------------------------------------- |
| **Name** | `asset-center oss slr authorize` |
| **Description** | Authorize OSS service-linked role (one-click) |
| **Usage** | `bl asset-center oss slr authorize [flags]` |
#### Flags
| Flag | Type | Required | Description |
| ------------------------------ | ------ | -------- | -------------------------------------------------------- |
| `--console-region <region>` | string | no | Console gateway region (e.g. cn-beijing, ap-southeast-1) |
| `--console-site <site>` | string | no | Console site: domestic, international |
| `--console-switch-agent <uid>` | number | no | Switch agent UID for delegated access |
| `--workspace-id <id>` | string | no | Workspace ID (env: BAILIAN_WORKSPACE_ID) |
#### Examples
```bash
bl asset-center oss slr authorize
```
```bash
bl asset-center oss slr authorize --output json
```
### `bl asset-center oss unbind`
| Field | Value |
| --------------- | --------------------------------------------- |
| **Name** | `asset-center oss unbind` |
| **Description** | Delete OSS transfer policy (unbind) |
| **Usage** | `bl asset-center oss unbind --policy-id <id>` |
#### Flags
| Flag | Type | Required | Description |
| ------------------------------ | ------ | -------- | -------------------------------------------------------- |
| `--policy-id <id>` | string | yes | Transfer policy ID |
| `--console-region <region>` | string | no | Console gateway region (e.g. cn-beijing, ap-southeast-1) |
| `--console-site <site>` | string | no | Console site: domestic, international |
| `--console-switch-agent <uid>` | number | no | Switch agent UID for delegated access |
| `--workspace-id <id>` | string | no | Workspace ID (env: BAILIAN_WORKSPACE_ID) |
#### Examples
```bash
bl asset-center oss unbind --policy-id policy-abc123
```
### `bl asset-center oss update`
| Field | Value |
| --------------- | ----------------------------------------------------- |
| **Name** | `asset-center oss update` |
| **Description** | Update an existing OSS transfer policy |
| **Usage** | `bl asset-center oss update --policy-id <id> [flags]` |
#### Flags
| Flag | Type | Required | Description |
| ------------------------------ | ------ | -------- | -------------------------------------------------------- |
| `--policy-id <id>` | string | yes | Transfer policy ID |
| `--bucket <name>` | string | no | OSS bucket name |
| `--region <region>` | string | no | OSS bucket region |
| `--path-prefix <prefix>` | string | no | OSS path prefix (must not start with /) |
| `--policy <ALL\|BEFORE_DAYS>` | string | no | Transfer policy: ALL or BEFORE_DAYS |
| `--before-days <n>` | number | no | Transfer days threshold |
| `--delete-after-transfer` | switch | no | Delete from platform after transfer completes |
| `--console-region <region>` | string | no | Console gateway region (e.g. cn-beijing, ap-southeast-1) |
| `--console-site <site>` | string | no | Console site: domestic, international |
| `--console-switch-agent <uid>` | number | no | Switch agent UID for delegated access |
| `--workspace-id <id>` | string | no | Workspace ID (env: BAILIAN_WORKSPACE_ID) |
#### Examples
```bash
bl asset-center oss update --policy-id policy-abc123 --policy ALL
```
```bash
bl asset-center oss update --policy-id policy-abc123 --delete-after-transfer
```
### `bl asset-center stats`
| Field | Value |
@@ -418,40 +266,6 @@ bl asset-center storage
bl asset-center storage --output json
```
### `bl asset-center transfer list`
| Field | Value |
| --------------- | ----------------------------------------------------------- |
| **Name** | `asset-center transfer list` |
| **Description** | List asset OSS transfer records (filtered by sync status) |
| **Usage** | `bl asset-center transfer list [--status <status>] [flags]` |
#### Flags
| Flag | Type | Required | Description |
| -------------------------------------------------------------- | ------ | -------- | -------------------------------------------------------- |
| `--status <NOT_SYNCED\|IN_SYNCING\|SYNC_SUCCESS\|SYNC_FAILED>` | string | no | OSS sync status filter |
| `--page-size <n>` | number | no | Results per page (default: 10, max: 100) |
| `--next-token <token>` | number | no | Cursor for the next page |
| `--console-region <region>` | string | no | Console gateway region (e.g. cn-beijing, ap-southeast-1) |
| `--console-site <site>` | string | no | Console site: domestic, international |
| `--console-switch-agent <uid>` | number | no | Switch agent UID for delegated access |
| `--workspace-id <id>` | string | no | Workspace ID (env: BAILIAN_WORKSPACE_ID) |
#### Examples
```bash
bl asset-center transfer list
```
```bash
bl asset-center transfer list --status SYNC_FAILED
```
```bash
bl asset-center transfer list --status IN_SYNCING --page-size 20 --output json
```
### `bl asset-center unfavorite`
| Field | Value |
+89 -95
View File
@@ -9,104 +9,98 @@ Use this index for the skill-scoped quick index and global flags.
## Quick index
| Command | Description | Detail |
| ----------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------- |
| `bl advisor recommend` | Recommend the best models for your use case (intent analysis → candidate recall → LLM ranking) | [advisor.md](advisor.md) |
| `bl app call` | Call a Bailian application (agent or workflow) | [app.md](app.md) |
| `bl app list` | List Bailian applications | [app.md](app.md) |
| `bl asset-center delete` | Delete assets (soft delete to recycle bin by default) | [asset-center.md](asset-center.md) |
| `bl asset-center download` | Get a signed download URL for an asset by ID | [asset-center.md](asset-center.md) |
| `bl asset-center favorite` | Add assets to favorites | [asset-center.md](asset-center.md) |
| `bl asset-center get` | Get full details of a model-generated asset | [asset-center.md](asset-center.md) |
| `bl asset-center list` | List model-generated assets with filters and cursor pagination | [asset-center.md](asset-center.md) |
| `bl asset-center oss bind` | Create OSS transfer policy (bind bucket for asset transfer) | [asset-center.md](asset-center.md) |
| `bl asset-center oss show` | View current OSS transfer policy | [asset-center.md](asset-center.md) |
| `bl asset-center oss slr authorize` | Authorize OSS service-linked role (one-click) | [asset-center.md](asset-center.md) |
| `bl asset-center oss unbind` | Delete OSS transfer policy (unbind) | [asset-center.md](asset-center.md) |
| `bl asset-center oss update` | Update an existing OSS transfer policy | [asset-center.md](asset-center.md) |
| `bl asset-center stats` | Count model-generated assets by type | [asset-center.md](asset-center.md) |
| `bl asset-center storage` | View storage quota, usage, and overage pricing | [asset-center.md](asset-center.md) |
| `bl asset-center transfer list` | List asset OSS transfer records (filtered by sync status) | [asset-center.md](asset-center.md) |
| `bl asset-center unfavorite` | Remove assets from favorites | [asset-center.md](asset-center.md) |
| `bl auth generate-access-token` | Generate a CLI access token using OpenAPI AK/SK | [auth.md](auth.md) |
| `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; full logout also clears the model Base URL | [auth.md](auth.md) |
| `bl auth status` | Show current authentication state | [auth.md](auth.md) |
| `bl config agent` | Configure a coding agent to use DashScope API | [config.md](config.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) |
| `bl config ui` | Open a local web UI to manage config profiles | [config.md](config.md) |
| `bl config use` | Set the active config profile | [config.md](config.md) |
| `bl console call` | Call a Bailian console API via the CLI gateway | [console.md](console.md) |
| `bl file upload` | Upload a local file to DashScope temporary storage (48h) | [file.md](file.md) |
| `bl knowledge chat` | Chat with a Bailian knowledge base (RAG Q&A with streaming) | [knowledge.md](knowledge.md) |
| `bl knowledge retrieve` | Retrieve from a Bailian knowledge base (deprecated, use `search` instead) | [knowledge.md](knowledge.md) |
| `bl knowledge search` | Search a Bailian knowledge base (RAG semantic retrieval) | [knowledge.md](knowledge.md) |
| `bl mcp call` | Call a tool on an MCP server (tools/call) | [mcp.md](mcp.md) |
| `bl mcp list` | List MCP servers activated under your Bailian account | [mcp.md](mcp.md) |
| `bl mcp tools` | List tools exposed by an MCP server (tools/list) | [mcp.md](mcp.md) |
| `bl memory add` | Add memory from messages or custom content | [memory.md](memory.md) |
| `bl memory delete` | Delete a memory node | [memory.md](memory.md) |
| `bl memory list` | List memory nodes for a user | [memory.md](memory.md) |
| `bl memory profile create` | Create a user profile schema for memory profiling | [memory.md](memory.md) |
| `bl memory profile get` | Get user profile by schema ID and user ID | [memory.md](memory.md) |
| `bl memory search` | Search memory nodes by query or messages | [memory.md](memory.md) |
| `bl memory update` | Update a memory node content | [memory.md](memory.md) |
| `bl model list` | Browse model families or show detailed model info in the Bailian model marketplace | [model.md](model.md) |
| `bl pipeline run` | Run a pipeline workflow definition | [pipeline.md](pipeline.md) |
| `bl pipeline validate` | Validate a pipeline definition without executing | [pipeline.md](pipeline.md) |
| `bl plugin install` | Install or upgrade an allowlisted Command Pack | [plugin.md](plugin.md) |
| `bl plugin link` | Link an allowlisted local Command Pack for development | [plugin.md](plugin.md) |
| `bl plugin list` | List installed Command Packs and their load status | [plugin.md](plugin.md) |
| `bl plugin remove` | Remove an installed Command Pack | [plugin.md](plugin.md) |
| `bl quota check` | Check current usage against rate limits | [quota.md](quota.md) |
| `bl quota history` | View quota change history | [quota.md](quota.md) |
| `bl quota list` | View model RPM/TPM rate limits | [quota.md](quota.md) |
| `bl quota request` | Request a temporary quota increase | [quota.md](quota.md) |
| `bl search web` | Search the web using DashScope MCP WebSearch service | [search.md](search.md) |
| `bl skill add` | Install skills from the Bailian skill registry into local agents | [skill.md](skill.md) |
| `bl skill list` | List registry skills and diff against local installs | [skill.md](skill.md) |
| `bl skill remove` | Remove locally installed skills (registry is untouched) | [skill.md](skill.md) |
| `bl skill update` | Update installed skills to the latest registry versions | [skill.md](skill.md) |
| `bl text chat` | Send a chat completion (OpenAI compatible, DashScope) | [text.md](text.md) |
| `bl token-plan add-member` | Add a member to a Token Plan organization | [token-plan.md](token-plan.md) |
| `bl token-plan assign-seats` | Batch assign Token Plan seats to members | [token-plan.md](token-plan.md) |
| `bl token-plan create-key` | Create a Token Plan API key for a seat | [token-plan.md](token-plan.md) |
| `bl token-plan list-seats` | List Token Plan subscription seat details | [token-plan.md](token-plan.md) |
| `bl update` | Update the CLI to the latest or a specified version | [update.md](update.md) |
| `bl usage free` | Query free-tier quota for models (all models if --model is omitted) | [usage.md](usage.md) |
| `bl usage freetier` | Enable or disable auto-stop for free-tier models. Enables by default; use --off to disable | [usage.md](usage.md) |
| `bl usage stats` | Query model usage statistics | [usage.md](usage.md) |
| `bl usage summary` | Show a unified usage summary: free-tier quota and recent usage overview | [usage.md](usage.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) |
| Command | Description | Detail |
| ------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------- |
| `bl advisor recommend` | Recommend the best models for your use case (intent analysis → candidate recall → LLM ranking) | [advisor.md](advisor.md) |
| `bl app call` | Call a Bailian application (agent or workflow) | [app.md](app.md) |
| `bl app list` | List Bailian applications | [app.md](app.md) |
| `bl asset-center delete` | Delete assets (soft delete to recycle bin by default) | [asset-center.md](asset-center.md) |
| `bl asset-center download` | Get a signed download URL for an asset by ID | [asset-center.md](asset-center.md) |
| `bl asset-center favorite` | Add assets to favorites | [asset-center.md](asset-center.md) |
| `bl asset-center get` | Get full details of a model-generated asset | [asset-center.md](asset-center.md) |
| `bl asset-center list` | List model-generated assets with filters and cursor pagination | [asset-center.md](asset-center.md) |
| `bl asset-center stats` | Count model-generated assets by type | [asset-center.md](asset-center.md) |
| `bl asset-center storage` | View storage quota, usage, and overage pricing | [asset-center.md](asset-center.md) |
| `bl asset-center unfavorite` | Remove assets from favorites | [asset-center.md](asset-center.md) |
| `bl auth generate-access-token` | Generate a CLI access token using OpenAPI AK/SK | [auth.md](auth.md) |
| `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; full logout also clears the model Base URL | [auth.md](auth.md) |
| `bl auth status` | Show current authentication state | [auth.md](auth.md) |
| `bl config agent` | Configure a coding agent to use DashScope API | [config.md](config.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) |
| `bl config ui` | Open a local web UI to manage config profiles | [config.md](config.md) |
| `bl config use` | Set the active config profile | [config.md](config.md) |
| `bl console call` | Call a Bailian console API via the CLI gateway | [console.md](console.md) |
| `bl file upload` | Upload a local file to DashScope temporary storage (48h) | [file.md](file.md) |
| `bl knowledge chat` | Chat with a Bailian knowledge base (RAG Q&A with streaming) | [knowledge.md](knowledge.md) |
| `bl knowledge retrieve` | Retrieve from a Bailian knowledge base (deprecated, use `search` instead) | [knowledge.md](knowledge.md) |
| `bl knowledge search` | Search a Bailian knowledge base (RAG semantic retrieval) | [knowledge.md](knowledge.md) |
| `bl mcp call` | Call a tool on an MCP server (tools/call) | [mcp.md](mcp.md) |
| `bl mcp list` | List MCP servers activated under your Bailian account | [mcp.md](mcp.md) |
| `bl mcp tools` | List tools exposed by an MCP server (tools/list) | [mcp.md](mcp.md) |
| `bl memory add` | Add memory from messages or custom content | [memory.md](memory.md) |
| `bl memory delete` | Delete a memory node | [memory.md](memory.md) |
| `bl memory list` | List memory nodes for a user | [memory.md](memory.md) |
| `bl memory profile create` | Create a user profile schema for memory profiling | [memory.md](memory.md) |
| `bl memory profile get` | Get user profile by schema ID and user ID | [memory.md](memory.md) |
| `bl memory search` | Search memory nodes by query or messages | [memory.md](memory.md) |
| `bl memory update` | Update a memory node content | [memory.md](memory.md) |
| `bl model list` | Browse model families or show detailed model info in the Bailian model marketplace | [model.md](model.md) |
| `bl pipeline run` | Run a pipeline workflow definition | [pipeline.md](pipeline.md) |
| `bl pipeline validate` | Validate a pipeline definition without executing | [pipeline.md](pipeline.md) |
| `bl plugin install` | Install or upgrade an allowlisted Command Pack | [plugin.md](plugin.md) |
| `bl plugin link` | Link an allowlisted local Command Pack for development | [plugin.md](plugin.md) |
| `bl plugin list` | List installed Command Packs and their load status | [plugin.md](plugin.md) |
| `bl plugin remove` | Remove an installed Command Pack | [plugin.md](plugin.md) |
| `bl quota check` | Check current usage against rate limits | [quota.md](quota.md) |
| `bl quota history` | View quota change history | [quota.md](quota.md) |
| `bl quota list` | View model RPM/TPM rate limits | [quota.md](quota.md) |
| `bl quota request` | Request a temporary quota increase | [quota.md](quota.md) |
| `bl search web` | Search the web using DashScope MCP WebSearch service | [search.md](search.md) |
| `bl skill add` | Install skills from the Bailian skill registry into local agents | [skill.md](skill.md) |
| `bl skill list` | List registry skills and diff against local installs | [skill.md](skill.md) |
| `bl skill remove` | Remove locally installed skills (registry is untouched) | [skill.md](skill.md) |
| `bl skill update` | Update installed skills to the latest registry versions | [skill.md](skill.md) |
| `bl text chat` | Send a chat completion (OpenAI compatible, DashScope) | [text.md](text.md) |
| `bl token-plan add-member` | Add a member to a Token Plan organization | [token-plan.md](token-plan.md) |
| `bl token-plan assign-seats` | Batch assign Token Plan seats to members | [token-plan.md](token-plan.md) |
| `bl token-plan create-key` | Create a Token Plan API key for a seat | [token-plan.md](token-plan.md) |
| `bl token-plan list-seats` | List Token Plan subscription seat details | [token-plan.md](token-plan.md) |
| `bl update` | Update the CLI to the latest or a specified version | [update.md](update.md) |
| `bl usage free` | Query free-tier quota for models (all models if --model is omitted) | [usage.md](usage.md) |
| `bl usage freetier` | Enable or disable auto-stop for free-tier models. Enables by default; use --off to disable | [usage.md](usage.md) |
| `bl usage stats` | Query model usage statistics | [usage.md](usage.md) |
| `bl usage summary` | Show a unified usage summary: free-tier quota and recent usage overview | [usage.md](usage.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
| Group | Commands | Reference |
| -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
| `advisor` | `recommend` | [advisor.md](advisor.md) |
| `app` | `call`, `list` | [app.md](app.md) |
| `asset-center` | `delete`, `download`, `favorite`, `get`, `list`, `oss bind`, `oss show`, `oss slr authorize`, `oss unbind`, `oss update`, `stats`, `storage`, `transfer list`, `unfavorite` | [asset-center.md](asset-center.md) |
| `auth` | `generate-access-token`, `login`, `logout`, `status` | [auth.md](auth.md) |
| `config` | `agent`, `list`, `set`, `show`, `ui`, `use` | [config.md](config.md) |
| `console` | `call` | [console.md](console.md) |
| `file` | `upload` | [file.md](file.md) |
| `knowledge` | `chat`, `retrieve`, `search` | [knowledge.md](knowledge.md) |
| `mcp` | `call`, `list`, `tools` | [mcp.md](mcp.md) |
| `memory` | `add`, `delete`, `list`, `profile create`, `profile get`, `search`, `update` | [memory.md](memory.md) |
| `model` | `list` | [model.md](model.md) |
| `pipeline` | `run`, `validate` | [pipeline.md](pipeline.md) |
| `plugin` | `install`, `link`, `list`, `remove` | [plugin.md](plugin.md) |
| `quota` | `check`, `history`, `list`, `request` | [quota.md](quota.md) |
| `search` | `web` | [search.md](search.md) |
| `skill` | `add`, `list`, `remove`, `update` | [skill.md](skill.md) |
| `text` | `chat` | [text.md](text.md) |
| `token-plan` | `add-member`, `assign-seats`, `create-key`, `list-seats` | [token-plan.md](token-plan.md) |
| `update` | `(root)` | [update.md](update.md) |
| `usage` | `free`, `freetier`, `stats`, `summary` | [usage.md](usage.md) |
| `workspace` | `init`, `list` | [workspace.md](workspace.md) |
| Group | Commands | Reference |
| -------------- | --------------------------------------------------------------------------------- | ---------------------------------- |
| `advisor` | `recommend` | [advisor.md](advisor.md) |
| `app` | `call`, `list` | [app.md](app.md) |
| `asset-center` | `delete`, `download`, `favorite`, `get`, `list`, `stats`, `storage`, `unfavorite` | [asset-center.md](asset-center.md) |
| `auth` | `generate-access-token`, `login`, `logout`, `status` | [auth.md](auth.md) |
| `config` | `agent`, `list`, `set`, `show`, `ui`, `use` | [config.md](config.md) |
| `console` | `call` | [console.md](console.md) |
| `file` | `upload` | [file.md](file.md) |
| `knowledge` | `chat`, `retrieve`, `search` | [knowledge.md](knowledge.md) |
| `mcp` | `call`, `list`, `tools` | [mcp.md](mcp.md) |
| `memory` | `add`, `delete`, `list`, `profile create`, `profile get`, `search`, `update` | [memory.md](memory.md) |
| `model` | `list` | [model.md](model.md) |
| `pipeline` | `run`, `validate` | [pipeline.md](pipeline.md) |
| `plugin` | `install`, `link`, `list`, `remove` | [plugin.md](plugin.md) |
| `quota` | `check`, `history`, `list`, `request` | [quota.md](quota.md) |
| `search` | `web` | [search.md](search.md) |
| `skill` | `add`, `list`, `remove`, `update` | [skill.md](skill.md) |
| `text` | `chat` | [text.md](text.md) |
| `token-plan` | `add-member`, `assign-seats`, `create-key`, `list-seats` | [token-plan.md](token-plan.md) |
| `update` | `(root)` | [update.md](update.md) |
| `usage` | `free`, `freetier`, `stats`, `summary` | [usage.md](usage.md) |
| `workspace` | `init`, `list` | [workspace.md](workspace.md) |
## Global flags