From 0e33c70e65c3e6bafae949f20449d28d15c6b76e Mon Sep 17 00:00:00 2001 From: clh02467605 Date: Fri, 7 Aug 2026 14:09:23 +0800 Subject: [PATCH 1/7] docs: update skill installation instructions to use bl skill add - Replace all instances of `npx skills add modelstudioai/cli --all -g` with `bl skill add --name all` - Update installation documentation in INSTALL.md, README.md, and related files - Modify code references in config/inventory.ts, generate-reference.ts, and other files - Update HTML UI messages to reflect new installation command - Correct setup.md to include binary installation option and update subset install instructions - Adjust versioning documentation to use new skill installation command - Update all SKILL.md files with consistent installation instructions --- AGENTS.md | 2 +- INSTALL.md | 11 +++++----- README.md | 2 +- README.zh.md | 2 +- docs/agents/skill-change.md | 22 +++++++++---------- packages/cli/README.md | 2 +- packages/cli/README.zh.md | 2 +- .../commands/src/commands/config/inventory.ts | 6 ++--- .../commands/src/commands/config/ui-html.ts | 4 ++-- packages/commands/src/commands/update.ts | 3 +-- packages/runtime/src/utils/update-checker.ts | 6 ++--- skills/bailian-cli/README.md | 4 ++-- skills/bailian-cli/README.zh.md | 4 ++-- skills/bailian-cli/SKILL.md | 12 +++++----- skills/bailian-finetune/SKILL.md | 8 +++---- skills/bailian-gen/SKILL.md | 8 +++---- skills/bailian-managed-agent/SKILL.md | 8 +++---- skills/bailian-protocol/README.md | 4 ++-- skills/bailian-protocol/README.zh.md | 4 ++-- skills/bailian-protocol/SKILL.md | 10 ++++----- .../assets/issue-reporting.md | 2 +- skills/bailian-protocol/assets/setup.md | 19 ++++++++-------- skills/bailian-protocol/assets/versioning.md | 12 +++++----- tools/generate-reference.ts | 2 +- 24 files changed, 79 insertions(+), 80 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index ce3b7bbd..222db1ca 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -35,7 +35,7 @@ packages/core/src/auth/ # apiKey / console credential 解析与落盘 packages/core/src/client/ # HTTP client / endpoints / console gateway ``` -Skill / 命令手册随 `skills/bailian-*/` 经 `npx skills add modelstudioai/cli --all -g` 安装(整包装齐,含共享协议 `bailian-protocol`)。业务 skill(`bailian-cli` / `bailian-gen` / `bailian-finetune` / `bailian-managed-agent`)执行前读 `skills/bailian-protocol/`;不要依赖 frontmatter `companions`(安装器不强制)。`tools/generate-reference.ts` 从 **`packages/cli/src/commands.ts`** 按一级命令归属表分流写入各 `skills//reference/`(纳入 git);`tools/sync-skill-metadata.ts` 从 `packages/cli/package.json` 同步各 `skills/*/SKILL.md` 的 `metadata.version`。两者由根脚本 `pnpm run sync:skill-assets` 和 `.vite-hooks/pre-commit` 执行。hub `bailian-cli` 的路由表不复述领域命令明细;SKILL 文案 / 安装约定 / hand-off 见 [docs/agents/skill-change.md](docs/agents/skill-change.md)。 +Skill / 命令手册随 `skills/bailian-*/` 经 `bl skill add --name all` 安装(整包装齐,含共享协议 `bailian-protocol`)。业务 skill(`bailian-cli` / `bailian-gen` / `bailian-finetune` / `bailian-managed-agent`)执行前读 `skills/bailian-protocol/`;不要依赖 frontmatter `companions`(安装器不强制)。`tools/generate-reference.ts` 从 **`packages/cli/src/commands.ts`** 按一级命令归属表分流写入各 `skills//reference/`(纳入 git);`tools/sync-skill-metadata.ts` 从 `packages/cli/package.json` 同步各 `skills/*/SKILL.md` 的 `metadata.version`。两者由根脚本 `pnpm run sync:skill-assets` 和 `.vite-hooks/pre-commit` 执行。hub `bailian-cli` 的路由表不复述领域命令明细;SKILL 文案 / 安装约定 / hand-off 见 [docs/agents/skill-change.md](docs/agents/skill-change.md)。 约定: diff --git a/INSTALL.md b/INSTALL.md index ba44e0f8..148c2127 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -51,19 +51,18 @@ npm install -g bailian-cli 4. 校验:`bl --version`。 -可选 skills(与 CLI 本体无关,按需): +安装 skills(CLI 内置,无需 Git / npx skills): ```bash -npx skills add modelstudioai/cli --all -g +bl skill add --name all ``` -**Supported:** 始终使用 `--all -g`,一次装齐整套 `bailian-*`(含共享协议 `bailian-protocol`)。Agent Skills / `npx skills` **不会**按 metadata 自动拉依赖。 +**Supported:** `--name all` 一次装齐整套 `bailian-*`(含共享协议 `bailian-protocol`)。 -**Advanced / 不推荐:** 子集 `-s` 时 skills CLI 不会自动带上 `bailian-protocol`;若坚持子集,必须手动同时指定,例如: +**Advanced / 按需子集:** ```bash -# Advanced: you MUST include bailian-protocol yourself — installer does not pull it -npx skills add modelstudioai/cli -g -s bailian-protocol -s bailian-gen +bl skill add --name bailian-protocol,bailian-gen ``` 安装成功后,用中文简要说明已安装的 skills 及用户可做什么。 diff --git a/README.md b/README.md index bced4e78..24cfca81 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ irm https://bailian.aliyun.com/cli/install.ps1 | iex npm install -g bailian-cli # Agent skills -npx skills add modelstudioai/cli --all -g +bl skill add --name all ``` > Binary install does not require Node.js. `npm install -g` remains fully supported. diff --git a/README.zh.md b/README.zh.md index d09397c3..8d472550 100644 --- a/README.zh.md +++ b/README.zh.md @@ -85,7 +85,7 @@ irm https://bailian.aliyun.com/cli/install.ps1 | iex npm install -g bailian-cli # Agent skills -npx skills add modelstudioai/cli --all -g +bl skill add --name all ``` > 二进制安装不依赖 Node.js。`npm install -g` 长期保留。 diff --git a/docs/agents/skill-change.md b/docs/agents/skill-change.md index b4abc497..38d75215 100644 --- a/docs/agents/skill-change.md +++ b/docs/agents/skill-change.md @@ -11,16 +11,16 @@ ## 统一口径(安装) -1. **Supported install:** `npx skills add modelstudioai/cli --all -g`(整包装齐,含 `bailian-protocol`) -2. **`bailian-protocol` 是共享协议 skill**,业务 skill 执行前应 Read 它;Agent Skills / `npx skills` **不会**按 frontmatter 自动拉依赖 +1. **Supported install:** `bl skill add --name all`(整包装齐,含 `bailian-protocol`) +2. **`bailian-protocol` 是共享协议 skill**,业务 skill 执行前应 Read 它 3. **不要**在 frontmatter 写 `companions`,也不要对外说「companions = 安装器硬依赖」 -4. 子集安装(`-s`)为 **advanced / 不推荐**:skills CLI 不会自动带上 protocol;漏装会导致相对路径 Read 失败 +4. 子集安装:`bl skill add --name bailian-protocol,`;漏装 protocol 会导致相对路径 Read 失败 ## 概念图 ```text bailian-protocol ← 共享协议(consent / 鉴权 / 版本 / 错误上报) - ▲ 靠 --all -g 与业务 skill 同装;非安装器强制 companions + ▲ 靠 `bl skill add --name all` 与业务 skill 同装;非安装器强制 companions │ ┌───────┴────────┬────────────────┬──────────────────┐ bailian-gen bailian-finetune bailian-managed-agent @@ -37,8 +37,8 @@ bailian-gen bailian-finetune bailian-managed-agent ### A. 分层边界 -- [ ] **整包装齐**:安装/升级文案主推 `--all -g`;业务 skill **不**声明 `companions` -- [ ] **协议读取**:CRITICAL / references 可链 `../bailian-protocol/…`;若读不到 → 停止执行 `bl`,提示 `npx skills add modelstudioai/cli --all -g` +- [ ] **整包装齐**:安装/升级文案主推 `bl skill add --name all`;业务 skill **不**声明 `companions` +- [ ] **协议读取**:CRITICAL / references 可链 `../bailian-protocol/…`;若读不到 → 停止执行 `bl`,提示 `bl skill add --name all` - [ ] **软 hand-off**:兄弟业务 skill **只写 skill 名**;已安装则 Read,未安装则 `bl … --help` 或提示整包安装;**不要**把 `../bailian-gen/…` 等写成执行前提 - [ ] **Hub vs 领域**:`bailian-cli` 的「When to use which command」只列 hub 拥有的意图;媒体 / 精调 / managed-agent 各留 hand-off 行,**不抄**领域默认模型与子命令明细 - [ ] **渐进披露**:SKILL 写意图路由与领域硬规则;flags / usage / examples 以 `reference/` 或 `bl --help` 为准,表后保留「勿猜 flag」指向句 @@ -46,9 +46,9 @@ bailian-gen bailian-finetune bailian-managed-agent ### B. 文案与落款一致性 - [ ] 领域 skill(gen / finetune / managed-agent)路由或命令表后有指向 `reference/` 的句;文末 `## references`(protocol + reference)与家族对齐 -- [ ] description 含 WHAT + WHEN + 反触发;安装说明指向 `--all -g`,不写 companions 必装 +- [ ] description 含 WHAT + WHEN + 反触发;安装说明指向 `bl skill add --name all`,不写 companions 必装 - [ ] Quick examples 只演示本 skill 职责(hub 不示范 `bl image` / `bl video` 等) -- [ ] 若改了安装方式:同步 `README.md` / `README.zh.md` / `INSTALL.md` / `skills/*/README*` / `skills/bailian-protocol/assets/setup.md` 中的 `npx skills add …` 示例(改 `INSTALL.md` 时按 [install-doc-change.md](install-doc-change.md) 同步静态页) +- [ ] 若改了安装方式:同步 `README.md` / `README.zh.md` / `INSTALL.md` / `skills/*/README*` / `skills/bailian-protocol/assets/setup.md` 中的 `bl skill add …` 示例(改 `INSTALL.md` 时按 [install-doc-change.md](install-doc-change.md) 同步静态页) ### C. 归属与生成 @@ -60,8 +60,8 @@ bailian-gen bailian-finetune bailian-managed-agent ```sh pnpm run sync:skill-assets -# 本地试装(测本仓库改动,勿只拉远端) -npx skills add "$(pwd)" --all -g -y +# 已发布版本试装 +bl skill add --name all ``` 抽查:打开 `skills/bailian-cli/SKILL.md` 确认无领域子命令明细表、无 `companions`;打开对应领域 skill 确认有「勿猜 flag」与 hand-off。 @@ -69,7 +69,7 @@ npx skills add "$(pwd)" --all -g -y ## 常见漏点 - ✗ hub 路由表再次抄回 image / video / finetune / managed-agent 明细 → token 膨胀且与领域 skill 双份漂移 -- ✗ 重新加回 `companions` 并宣称安装器硬依赖 → 与 Agent Skills / `npx skills` 合同不符 +- ✗ 重新加回 `companions` 并宣称安装器硬依赖 → 与 `bl skill add` 合同不符 - ✗ 软 hand-off 写成硬路径 `../bailian-*/SKILL.md` 当执行前提 → 子集安装断链 - ✗ 只改 SKILL、忘改 `GROUP_OWNER_SKILL` → reference 落错 skill - ✗ 手改 `skills/*/reference/*.md` → 下次 generate 被覆盖 diff --git a/packages/cli/README.md b/packages/cli/README.md index bced4e78..24cfca81 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -87,7 +87,7 @@ irm https://bailian.aliyun.com/cli/install.ps1 | iex npm install -g bailian-cli # Agent skills -npx skills add modelstudioai/cli --all -g +bl skill add --name all ``` > Binary install does not require Node.js. `npm install -g` remains fully supported. diff --git a/packages/cli/README.zh.md b/packages/cli/README.zh.md index d09397c3..8d472550 100644 --- a/packages/cli/README.zh.md +++ b/packages/cli/README.zh.md @@ -85,7 +85,7 @@ irm https://bailian.aliyun.com/cli/install.ps1 | iex npm install -g bailian-cli # Agent skills -npx skills add modelstudioai/cli --all -g +bl skill add --name all ``` > 二进制安装不依赖 Node.js。`npm install -g` 长期保留。 diff --git a/packages/commands/src/commands/config/inventory.ts b/packages/commands/src/commands/config/inventory.ts index 5ec9c498..bd45fa23 100644 --- a/packages/commands/src/commands/config/inventory.ts +++ b/packages/commands/src/commands/config/inventory.ts @@ -1,5 +1,5 @@ // Read-only discovery of locally installed AI tooling, surfaced by `config ui`: -// - Agent skills installed under ~/.agents/skills (via `npx skills add`). +// - Agent skills installed under ~/.agents/skills (via `bl skill add`). // - MCP servers declared in each coding agent's local config file. // - Coding agent frameworks and whether the bailian-cli provider is wired in. // @@ -128,8 +128,8 @@ function countFiles(dir: string, budget = 500): number { } /** - * Skill directories to scan, keyed by the module that owns them. `npx skills - * add --all` fans skills out into each installed agent, so the same skill can + * Skill directories to scan, keyed by the module that owns them. `bl skill + * add --name all` fans skills out into each installed agent, so the same skill can * live in several of these roots at once. */ function skillRoots(home: string): Array<{ source: string; dir: string }> { diff --git a/packages/commands/src/commands/config/ui-html.ts b/packages/commands/src/commands/config/ui-html.ts index 6f9a04a2..4f31ab53 100644 --- a/packages/commands/src/commands/config/ui-html.ts +++ b/packages/commands/src/commands/config/ui-html.ts @@ -548,7 +548,7 @@ export const PAGE_HTML = `

Installed Skills

-

Agent skills discovered across every local agent module (~/.agents/skills plus each agent's skills folder). Installed via npx skills add.

+

Agent skills discovered across every local agent module (~/.agents/skills plus each agent's skills folder). Installed via bl skill add.

Loading…
@@ -1444,7 +1444,7 @@ export const PAGE_HTML = ` function renderSkills() { var body = document.getElementById('skillsBody'); var pager = document.getElementById('skillsPager'); - if (!SKILLS.length) { pager.innerHTML = ''; renderEmpty(body, 'No skills installed.', 'Install with npx skills add modelstudioai/cli --all -g'); return; } + if (!SKILLS.length) { pager.innerHTML = ''; renderEmpty(body, 'No skills installed.', 'Install with bl skill add --name all'); return; } var list = SKILLS.filter(function (s) { return skillMatches(s, SKILL_Q); }); if (!list.length) { pager.innerHTML = ''; renderEmpty(body, 'No skills match "' + SKILL_Q + '".', ''); return; } var info = pageSlice(list, SKILL_PAGE, getPageSize('skills')); SKILL_PAGE = info.page; diff --git a/packages/commands/src/commands/update.ts b/packages/commands/src/commands/update.ts index cb67263d..e9692d90 100644 --- a/packages/commands/src/commands/update.ts +++ b/packages/commands/src/commands/update.ts @@ -20,8 +20,7 @@ import { type AnsiStyles, } from "bailian-cli-runtime"; -const SKILL_SOURCE = "modelstudioai/cli"; -const SKILL_INSTALL_CMD = `npx skills add ${SKILL_SOURCE} --all -g -y`; +const SKILL_INSTALL_CMD = "bl skill add --name all"; function updateAgentSkill(color: AnsiStyles): void { process.stderr.write("\nUpdating agent skill...\n"); diff --git a/packages/runtime/src/utils/update-checker.ts b/packages/runtime/src/utils/update-checker.ts index 44dcabc4..1ae51104 100644 --- a/packages/runtime/src/utils/update-checker.ts +++ b/packages/runtime/src/utils/update-checker.ts @@ -299,13 +299,11 @@ export async function performAutoUpdate( try { process.stderr.write(` ${dim}Syncing agent skill...${reset}\n`); - execSync(`npx skills add modelstudioai/cli --all -g -y`, { stdio: "inherit" }); + execSync(`bl skill add --name all`, { stdio: "inherit" }); process.stderr.write(` ${green}✓ Agent skill updated.${reset}\n\n`); } catch (err) { process.stderr.write(` ${yellow}⚠ Agent skill sync failed: ${errorMessage(err)}${reset}\n`); - process.stderr.write( - ` ${yellow} Run manually: npx skills add modelstudioai/cli --all -g -y${reset}\n\n`, - ); + process.stderr.write(` ${yellow} Run manually: bl skill add --name all${reset}\n\n`); } pendingNotification = null; diff --git a/skills/bailian-cli/README.md b/skills/bailian-cli/README.md index d95e5aea..df45eaf6 100644 --- a/skills/bailian-cli/README.md +++ b/skills/bailian-cli/README.md @@ -4,11 +4,11 @@ Agent skill for **Alibaba Cloud Model Studio CLI** (`bl`) resource hub — apps, memory, RAG, usage/quota, MCP, and hub `reference/`. -- Shared protocol: `bailian-protocol` (install via `--all -g`) +- Shared protocol: `bailian-protocol` (install via `bl skill add --name all`) - Soft hand-offs (optional skills): `bailian-gen` · `bailian-finetune` · `bailian-managed-agent` ```bash -npx skills add modelstudioai/cli --all -g +bl skill add --name all ``` For CLI installation, authentication, and examples, see the [main README](../../README.md). diff --git a/skills/bailian-cli/README.zh.md b/skills/bailian-cli/README.zh.md index 360ef221..13c09ffb 100644 --- a/skills/bailian-cli/README.zh.md +++ b/skills/bailian-cli/README.zh.md @@ -4,11 +4,11 @@ **阿里云百炼 CLI**(`bl`)的资源管理 Agent 技能 — 应用、记忆、RAG、用量/额度、MCP,以及 hub `reference/`。 -- 共享协议:`bailian-protocol`(通过 `--all -g` 与整家族同装) +- 共享协议:`bailian-protocol`(通过 `bl skill add --name all` 与整家族同装) - 软 hand-off(可选):`bailian-gen` · `bailian-finetune` · `bailian-managed-agent` ```bash -npx skills add modelstudioai/cli --all -g +bl skill add --name all ``` CLI 的安装、认证和使用示例请查看[主 README](../../README.zh.md)。 diff --git a/skills/bailian-cli/SKILL.md b/skills/bailian-cli/SKILL.md index e6196352..2158b162 100644 --- a/skills/bailian-cli/SKILL.md +++ b/skills/bailian-cli/SKILL.md @@ -10,7 +10,7 @@ description: >- 工作空间、MCP 市场、pipeline、文件上传、console API、登录鉴权与配置、 Agent skill 安装/列表/更新/卸载(bl skill add|list|update|remove,百炼 skill registry)。 用户点名百炼 / DashScope / `bl`,或继续既有 `bl` 工作流时直接使用。 - 共享协议(consent / 版本预检 / 鉴权 / 错误上报)在 bailian-protocol;官方安装 `npx skills add modelstudioai/cli --all -g`。 + 共享协议(consent / 版本预检 / 鉴权 / 错误上报)在 bailian-protocol;官方安装 `bl skill add --name all`。 家族路由:生图/生视频/配音/语音合成/转写 → bailian-gen;精调/微调/训练/数据集 → bailian-finetune; agents.yaml 托管 Agent → bailian-managed-agent。 不要用于普通问答、编程、写作、翻译、摘要、泛搜索,或图片理解等宿主自己能做的任务(普通问答、编程、写作、翻译、摘要、泛搜索不触发)。 @@ -19,14 +19,14 @@ description: >- # Aliyun Model Studio CLI (`bl`) -**CRITICAL — Before executing, MUST read the shared protocol in [`../bailian-protocol/SKILL.md`](../bailian-protocol/SKILL.md): Provider selection and consent, Version & updates (pre-flight checklist), Setup & auth, and CLI errors: report an issue. If that protocol file is missing, stop and run `npx skills add modelstudioai/cli --all -g`; do not guess auth/consent.** +**CRITICAL — Before executing, MUST read the shared protocol in [`../bailian-protocol/SKILL.md`](../bailian-protocol/SKILL.md): Provider selection and consent, Version & updates (pre-flight checklist), Setup & auth, and CLI errors: report an issue. If that protocol file is missing, stop and run `bl skill add --name all`; do not guess auth/consent.** > **Family hub** — This skill owns Bailian resource commands and the hub `reference/` (apps, knowledge, usage, auth, config, …). -> Shared protocol → [`../bailian-protocol/SKILL.md`](../bailian-protocol/SKILL.md) (install the full family with `--all -g`). -> Soft hand-offs by skill name (Read if installed; else `bl … --help` / prompt `npx skills add modelstudioai/cli --all -g`): `bailian-gen` (media) · `bailian-finetune` (training) · `bailian-managed-agent` (agents.yaml IaC). +> Shared protocol → [`../bailian-protocol/SKILL.md`](../bailian-protocol/SKILL.md) (install the full family with `bl skill add --name all`). +> Soft hand-offs by skill name (Read if installed; else `bl … --help` / prompt `bl skill add --name all`): `bailian-gen` (media) · `bailian-finetune` (training) · `bailian-managed-agent` (agents.yaml IaC). > Do not invoke it for ordinary reasoning, coding, writing, translation, summarization, generic research, or image understanding the host agent can complete directly. > -> **Install (supported):** `npx skills add modelstudioai/cli --all -g` +> **Install (supported):** `bl skill add --name all` ## Command reference (authoritative) @@ -113,7 +113,7 @@ schema-export commands. ## Routing reminders -- Image/video/audio generation or editing → skill `bailian-gen` (class 3 consent from `bailian-protocol`). Fine-tuning / datasets / deployments → `bailian-finetune`. agents.yaml IaC → `bailian-managed-agent`. Soft hand-off: Read sibling skill if installed; else `bl … --help` or prompt `npx skills add modelstudioai/cli --all -g`. Image understanding the host agent can do → host-first; use `bl vision` / `bl omni` only when the user names a Bailian model or the media (video/audio files) exceeds host capability. +- Image/video/audio generation or editing → skill `bailian-gen` (class 3 consent from `bailian-protocol`). Fine-tuning / datasets / deployments → `bailian-finetune`. agents.yaml IaC → `bailian-managed-agent`. Soft hand-off: Read sibling skill if installed; else `bl … --help` or prompt `bl skill add --name all`. Image understanding the host agent can do → host-first; use `bl vision` / `bl omni` only when the user names a Bailian model or the media (video/audio files) exceeds host capability. - Answer ordinary reasoning, coding, writing, translation, summarization, and generic research with the host agent's native capabilities; do not bounce them through `bl text chat` or `bl search web`. - Usage / quota / credits questions that do not name a product → ask which product (Bailian or another AI service) first; run `bl usage` / `bl quota` only after the user picks Bailian or Bailian context is already established. - "Remember this" and memory requests default to the host agent's own memory; `bl memory *` is only for Bailian app memory resources. diff --git a/skills/bailian-finetune/SKILL.md b/skills/bailian-finetune/SKILL.md index bfb090b1..f2efd1b3 100644 --- a/skills/bailian-finetune/SKILL.md +++ b/skills/bailian-finetune/SKILL.md @@ -11,12 +11,12 @@ description: >- upload 拿 file-id → finetune create 建任务 → watch 看进度 → export 导出 → deploy 上线,需要 API key; 写操作先用 `--dry-run` 预览。反触发:用户点名火山方舟/ark 的精调不走本 skill;只是要选哪个模型走 bailian-model-recommend;用现成模型生图生视频走 bailian-gen;百炼其他资源管理走 bailian-cli。 - 官方安装:`npx skills add modelstudioai/cli --all -g`(与共享协议 bailian-protocol 同装)。 + 官方安装:`bl skill add --name all`(与共享协议 bailian-protocol 同装)。 --- # Bailian fine-tuning pipeline (`bl dataset` / `bl finetune` / `bl deploy`) -**CRITICAL — Before executing, MUST read the shared protocol in [`../bailian-protocol/SKILL.md`](../bailian-protocol/SKILL.md): Version & updates (pre-flight checklist), Setup & auth, and CLI errors: report an issue. Command details are authoritative in [`reference/`](reference/index.md) (dataset / finetune / deploy) and `bl --help` — do not guess flags. The whole pipeline requires an API key. If that protocol file is missing, stop and run `npx skills add modelstudioai/cli --all -g`; do not guess auth/consent.** +**CRITICAL — Before executing, MUST read the shared protocol in [`../bailian-protocol/SKILL.md`](../bailian-protocol/SKILL.md): Version & updates (pre-flight checklist), Setup & auth, and CLI errors: report an issue. Command details are authoritative in [`reference/`](reference/index.md) (dataset / finetune / deploy) and `bl --help` — do not guess flags. The whole pipeline requires an API key. If that protocol file is missing, stop and run `bl skill add --name all`; do not guess auth/consent.** ## End-to-end workflow (follow in order) @@ -63,7 +63,7 @@ bl deploy text create --model my-qwen-sft --name my-svc ## Common hand-offs -软 hand-off(按 skill **名**;已安装则 Read,否则 `--help` / 提示 `npx skills add modelstudioai/cli --all -g`): +软 hand-off(按 skill **名**;已安装则 Read,否则 `--help` / 提示 `bl skill add --name all`): - After deployment, try the model or generate content → skill `bailian-gen` (media) or `bl text chat` (fallback: `bl image\|video\|text --help`). - Unsure which base model to pick → `bailian-model-recommend` / `bl advisor recommend`. @@ -71,5 +71,5 @@ bl deploy text create --model my-qwen-sft --name my-svc ## references -- [bailian-protocol](../bailian-protocol/SKILL.md) — shared protocol (install via `--all -g`) +- [bailian-protocol](../bailian-protocol/SKILL.md) — shared protocol (install via `bl skill add --name all`) - [reference/](reference/index.md) — command details diff --git a/skills/bailian-gen/SKILL.md b/skills/bailian-gen/SKILL.md index 9a6c3e88..12d9bcfb 100644 --- a/skills/bailian-gen/SKILL.md +++ b/skills/bailian-gen/SKILL.md @@ -13,12 +13,12 @@ description: >- 图片和语音同步返回并落地本地文件,视频是异步任务、用 `--download` 或轮询取回;本地文件直接传路径,CLI 自动上传。 反触发:宿主自己能做的图片理解、普通问答、编程、写作、翻译不走本技能;百炼应用/知识库/用量/额度走 bailian-cli; 精调训练走 bailian-finetune。 - 官方安装:`npx skills add modelstudioai/cli --all -g`(与共享协议 bailian-protocol 同装)。 + 官方安装:`bl skill add --name all`(与共享协议 bailian-protocol 同装)。 --- # Bailian media generation (`bl image` / `bl video` / `bl speech` / `bl omni`) -**CRITICAL — Before executing, MUST read the shared protocol in [`../bailian-protocol/SKILL.md`](../bailian-protocol/SKILL.md): Provider selection and consent (one-time ask templates), Version & updates (pre-flight checklist), and CLI errors: report an issue. Command details are authoritative in [`reference/`](reference/index.md) and `bl --help` — do not guess flags. If that protocol file is missing, stop and run `npx skills add modelstudioai/cli --all -g`; do not guess auth/consent.** +**CRITICAL — Before executing, MUST read the shared protocol in [`../bailian-protocol/SKILL.md`](../bailian-protocol/SKILL.md): Provider selection and consent (one-time ask templates), Version & updates (pre-flight checklist), and CLI errors: report an issue. Command details are authoritative in [`reference/`](reference/index.md) and `bl --help` — do not guess flags. If that protocol file is missing, stop and run `bl skill add --name all`; do not guess auth/consent.** ## Consent (short version; full rules in bailian-protocol) @@ -76,7 +76,7 @@ If one or more `bl` commands actually ran, proactively add a one-line summary in ## Common hand-offs -软 hand-off(按 skill **名**;已安装则 Read,否则 `--help` / 提示 `npx skills add modelstudioai/cli --all -g`): +软 hand-off(按 skill **名**;已安装则 Read,否则 `--help` / 提示 `bl skill add --name all`): - Generation failed and it is not a usage/auth/content-filter issue → follow the issue-reporting flow in `bailian-protocol` ([`../bailian-protocol/SKILL.md`](../bailian-protocol/SKILL.md#cli-errors-report-an-issue)) and ask once whether to report. - Managing Bailian apps / knowledge bases / usage → skill `bailian-cli` (fallback: `bl app\|knowledge\|usage --help`). @@ -84,5 +84,5 @@ If one or more `bl` commands actually ran, proactively add a one-line summary in ## references -- [bailian-protocol](../bailian-protocol/SKILL.md) — shared protocol (install via `--all -g`) +- [bailian-protocol](../bailian-protocol/SKILL.md) — shared protocol (install via `bl skill add --name all`) - [reference/](reference/index.md) — command details diff --git a/skills/bailian-managed-agent/SKILL.md b/skills/bailian-managed-agent/SKILL.md index 256028bb..31f82b09 100644 --- a/skills/bailian-managed-agent/SKILL.md +++ b/skills/bailian-managed-agent/SKILL.md @@ -11,12 +11,12 @@ description: >- apply / destroy 变更远端资源且必须带 `--yes`,务必先 plan 给用户看 diff 再让其确认。 反触发:调用已上线的百炼应用/智能体走 bailian-app-call 或 `bl app`;宿主 agent 自身的记忆、技能、 子代理不走本 skill;生图生视频走 bailian-gen。 - 官方安装:`npx skills add modelstudioai/cli --all -g`(与共享协议 bailian-protocol 同装)。 + 官方安装:`bl skill add --name all`(与共享协议 bailian-protocol 同装)。 --- # Bailian managed agent IaC (`bl managed-agent`) -**CRITICAL — Before executing, MUST read the shared protocol in [`../bailian-protocol/SKILL.md`](../bailian-protocol/SKILL.md): Version & updates (pre-flight checklist) and CLI errors: report an issue. Command details are authoritative in [`reference/managed-agent.md`](reference/managed-agent.md) and `bl managed-agent --help` — do not guess flags. If that protocol file is missing, stop and run `npx skills add modelstudioai/cli --all -g`; do not guess auth/consent.** +**CRITICAL — Before executing, MUST read the shared protocol in [`../bailian-protocol/SKILL.md`](../bailian-protocol/SKILL.md): Version & updates (pre-flight checklist) and CLI errors: report an issue. Command details are authoritative in [`reference/managed-agent.md`](reference/managed-agent.md) and `bl managed-agent --help` — do not guess flags. If that protocol file is missing, stop and run `bl skill add --name all`; do not guess auth/consent.** ## Safety guardrail (the most important rule) @@ -60,7 +60,7 @@ Flags, usage, and examples: see [`reference/`](reference/index.md) or `bl - 阿里云百炼 `bl` 家族共享执行协议(consent 确认、版本预检、鉴权/安装、错误上报、本地文件与输出约定)。 不是面向用户意图的业务入口;当任一 bailian-* 业务 skill(bailian-cli / bailian-gen / bailian-finetune / bailian-managed-agent)执行前需要公共上下文,或用户首次安装/鉴权/`bl` 报错需上报时读取本 skill。 - 官方安装为整包:`npx skills add modelstudioai/cli --all -g`(与业务 skill 同装);Agent Skills / `npx skills` 不会按 metadata 自动拉依赖。 + 官方安装为整包:`bl skill add --name all`(与业务 skill 同装)。 --- # Bailian shared protocol (`bailian-protocol`) @@ -18,10 +18,10 @@ description: >- > **Install(supported):** 整包装齐,含本 skill 与全部业务 skill: > > ```bash -> npx skills add modelstudioai/cli --all -g +> bl skill add --name all > ``` > -> Agent Skills / `npx skills` **不会**解析 frontmatter 依赖字段。子集 `-s` 为 advanced / 不推荐;若坚持子集,必须**手动**同时带上 `bailian-protocol`,否则业务 skill 的相对路径 Read 会失败。 +> 子集安装请显式带上 `bailian-protocol`(例如 `bl skill add --name bailian-protocol,bailian-gen`),否则业务 skill 的相对路径 Read 会失败。 ## Provider selection and consent @@ -44,7 +44,7 @@ After approval, treat Bailian as selected for the current task. Do not ask again ## Family routing & hand-offs 业务路由(**软 hand-off**:按 skill **名**路由;已安装则 Read 其 `SKILL.md`,未安装则用 `bl --help`,或提示整包安装 -`npx skills add modelstudioai/cli --all -g`): +`bl skill add --name all`): | Intent | Skill | Fallback | | ------------------------------------- | ----------------------- | ----------------------------------------------- | @@ -55,7 +55,7 @@ After approval, treat Bailian as selected for the current task. Do not ask again **共享协议** vs **软 hand-off**: -- `bailian-protocol`:靠 `--all -g` 与业务 skill 同装;CRITICAL 可用相对路径 `../bailian-protocol/…`。读不到则停止跑 `bl`,提示整包安装。 +- `bailian-protocol`:靠 `bl skill add --name all` 与业务 skill 同装;CRITICAL 可用相对路径 `../bailian-protocol/…`。读不到则停止跑 `bl`,提示整包安装。 - 其它 bailian-\* 业务 skill:只按名字提及,**不要**写死 `../bailian-*/SKILL.md` 当执行前提。 ## Version & updates (after provider selection, before the first `bl` command) diff --git a/skills/bailian-protocol/assets/issue-reporting.md b/skills/bailian-protocol/assets/issue-reporting.md index 6ea6e831..c75e2719 100644 --- a/skills/bailian-protocol/assets/issue-reporting.md +++ b/skills/bailian-protocol/assets/issue-reporting.md @@ -114,7 +114,7 @@ Offer reporting when **none** of EXCLUDE applies **and** any of the following ho ### Before offering to report -1. Align versions: [SKILL.md → Version & updates](../SKILL.md#version--updates-after-provider-selection-before-the-first-bl-command) — run `bl update` and `npx skills add modelstudioai/cli --all -g -y` if mismatched. +1. Align versions: [SKILL.md → Version & updates](../SKILL.md#version--updates-after-provider-selection-before-the-first-bl-command) — run `bl update` and `bl skill add --name all` if mismatched. 2. Confirm `bl auth status` is healthy (for commands that need auth). 3. Retry once with `--verbose` if stderr was thin. diff --git a/skills/bailian-protocol/assets/setup.md b/skills/bailian-protocol/assets/setup.md index 272c7bd2..2bae59dd 100644 --- a/skills/bailian-protocol/assets/setup.md +++ b/skills/bailian-protocol/assets/setup.md @@ -12,15 +12,16 @@ inspect config keys. Day-to-day command routing lives in the business skills ## Install ```bash -npm install -g bailian-cli -# Recommended: install the full bailian-* skill family (includes bailian-protocol) -npx skills add modelstudioai/cli --all -g - -# Advanced / not recommended: skills CLI does not auto-pull bailian-protocol -# npx skills add modelstudioai/cli -g -s bailian-protocol -s bailian-gen -# npx skills add modelstudioai/cli -g -s bailian-protocol -s bailian-finetune -# npx skills add modelstudioai/cli -g -s bailian-protocol -s bailian-managed-agent -# npx skills add modelstudioai/cli -g -s bailian-protocol -s bailian-cli +# Recommended binary install (no Node), or: npm install -g bailian-cli +curl -fsSL https://bailian.aliyun.com/cli/install.sh | bash +# Install the full bailian-* skill family (includes bailian-protocol) +bl skill add --name all + +# Advanced / subset (comma-separated names; include bailian-protocol when needed) +# bl skill add --name bailian-protocol,bailian-gen +# bl skill add --name bailian-protocol,bailian-finetune +# bl skill add --name bailian-protocol,bailian-managed-agent +# bl skill add --name bailian-protocol,bailian-cli ``` Verify: `bl --version` (prints `bl X.Y.Z`). diff --git a/skills/bailian-protocol/assets/versioning.md b/skills/bailian-protocol/assets/versioning.md index 6976432e..804349dc 100644 --- a/skills/bailian-protocol/assets/versioning.md +++ b/skills/bailian-protocol/assets/versioning.md @@ -16,7 +16,7 @@ 3. Compare the two versions (ignore the `bl` prefix; compare only `X.Y.Z`): - If `metadata.version` ≠ `bl --version`, refresh skills before doing anything else: ```bash - npx skills add modelstudioai/cli --all -g -y + bl skill add --name all ``` - Do not trust a stale `reference/` when versions mismatch — flags may be wrong. 4. Check the latest published CLI version: @@ -26,7 +26,7 @@ 5. If the installed `bl` is **older** than the latest npm version, **STOP** the current task and **ask the user** (report skill version, installed CLI version, and npm latest): > A newer version of bl is available (current: X.Y.Z, latest: A.B.C). Upgrade before continuing? - **Do NOT auto-upgrade silently** — the user decides. - - If the user agrees: run `bl update`, then continue. (`bl update` upgrades `bailian-cli` via npm and, on success, also runs `npx skills add modelstudioai/cli --all -g -y` to keep skills in lockstep across all agent apps.) + - If the user agrees: run `bl update`, then continue. (`bl update` upgrades `bailian-cli` via npm and, on success, also runs `bl skill add --name all` to keep skills in lockstep across all agent apps.) - If the user declines: continue with the current version and note it in the summary. - If `npm view` / `bl update` fails (offline, registry blocked, permission): continue with the current `bl` and tell the user it could not be updated. 6. Only proceed with the user's actual task after the above is resolved. @@ -38,11 +38,13 @@ If `bl --version` fails, install the CLI and skills: ```bash -npm install -g bailian-cli -npx skills add modelstudioai/cli --all -g +# Recommended — no Node required +curl -fsSL https://bailian.aliyun.com/cli/install.sh | bash +# Or: npm install -g bailian-cli +bl skill add --name all ``` -Do not install a single business skill alone — use `--all -g` so `bailian-protocol` is present. +Do not install a single business skill alone — use `--name all` so `bailian-protocol` is present. ## Mention it in the task summary diff --git a/tools/generate-reference.ts b/tools/generate-reference.ts index 976d80a7..fee3ef12 100644 --- a/tools/generate-reference.ts +++ b/tools/generate-reference.ts @@ -7,7 +7,7 @@ * Ownership of each top-level command group is declared in `GROUP_OWNER_SKILL` below. * Unmapped groups fall back to `bailian-cli` (hub) so new commands never block generation. * - * Committed to git; consumed by bailian-* Agent Skills (`npx skills add modelstudioai/cli`). + * Committed to git; consumed by bailian-* Agent Skills (`bl skill add --name all`). * * Run: pnpm --filter bailian-cli run generate:reference * Also run via `pnpm run sync:skill-assets` or the repo pre-commit hook. From 9ae5dc924d7c40f84ee26cbf70830985ab383ce6 Mon Sep 17 00:00:00 2001 From: clh02467605 Date: Fri, 7 Aug 2026 17:56:30 +0800 Subject: [PATCH 2/7] docs(cli): update skill installation command from add --name all to init - Replace `bl skill add --name all` with `bl skill init` across documentation - Update installation instructions in README, INSTALL, and agent skill guides - Modify code references in update checker and UI components - Adjust documentation links and cross-references accordingly - Revise command examples in protocol and asset files - Update versioning and setup instructions to reflect new command - Modify HTML UI rendering for skill installation guidance - Change internal command constants and execution calls --- AGENTS.md | 2 +- INSTALL.md | 4 ++-- README.md | 2 +- README.zh.md | 2 +- docs/agents/skill-change.md | 15 ++++++++------- packages/cli/README.md | 2 +- packages/cli/README.zh.md | 2 +- .../commands/src/commands/config/inventory.ts | 4 ++-- packages/commands/src/commands/config/ui-html.ts | 2 +- packages/commands/src/commands/update.ts | 2 +- packages/runtime/src/utils/update-checker.ts | 4 ++-- skills/bailian-cli/README.md | 4 ++-- skills/bailian-cli/README.zh.md | 4 ++-- skills/bailian-cli/SKILL.md | 12 ++++++------ skills/bailian-finetune/SKILL.md | 8 ++++---- skills/bailian-gen/SKILL.md | 8 ++++---- skills/bailian-managed-agent/SKILL.md | 8 ++++---- skills/bailian-protocol/README.md | 4 ++-- skills/bailian-protocol/README.zh.md | 4 ++-- skills/bailian-protocol/SKILL.md | 8 ++++---- skills/bailian-protocol/assets/issue-reporting.md | 2 +- skills/bailian-protocol/assets/setup.md | 2 +- skills/bailian-protocol/assets/versioning.md | 8 ++++---- tools/generate-reference.ts | 2 +- 24 files changed, 58 insertions(+), 57 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 222db1ca..dd006dc5 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -35,7 +35,7 @@ packages/core/src/auth/ # apiKey / console credential 解析与落盘 packages/core/src/client/ # HTTP client / endpoints / console gateway ``` -Skill / 命令手册随 `skills/bailian-*/` 经 `bl skill add --name all` 安装(整包装齐,含共享协议 `bailian-protocol`)。业务 skill(`bailian-cli` / `bailian-gen` / `bailian-finetune` / `bailian-managed-agent`)执行前读 `skills/bailian-protocol/`;不要依赖 frontmatter `companions`(安装器不强制)。`tools/generate-reference.ts` 从 **`packages/cli/src/commands.ts`** 按一级命令归属表分流写入各 `skills//reference/`(纳入 git);`tools/sync-skill-metadata.ts` 从 `packages/cli/package.json` 同步各 `skills/*/SKILL.md` 的 `metadata.version`。两者由根脚本 `pnpm run sync:skill-assets` 和 `.vite-hooks/pre-commit` 执行。hub `bailian-cli` 的路由表不复述领域命令明细;SKILL 文案 / 安装约定 / hand-off 见 [docs/agents/skill-change.md](docs/agents/skill-change.md)。 +Skill / 命令手册随 `skills/bailian-*/` 经 `bl skill init` 安装(装齐 registry 中全部 `bailian-*`,含共享协议 `bailian-protocol`)。业务 skill(`bailian-cli` / `bailian-gen` / `bailian-finetune` / `bailian-managed-agent`)执行前读 `skills/bailian-protocol/`;不要依赖 frontmatter `companions`(安装器不强制)。`tools/generate-reference.ts` 从 **`packages/cli/src/commands.ts`** 按一级命令归属表分流写入各 `skills//reference/`(纳入 git);`tools/sync-skill-metadata.ts` 从 `packages/cli/package.json` 同步各 `skills/*/SKILL.md` 的 `metadata.version`。两者由根脚本 `pnpm run sync:skill-assets` 和 `.vite-hooks/pre-commit` 执行。hub `bailian-cli` 的路由表不复述领域命令明细;SKILL 文案 / 安装约定 / hand-off 见 [docs/agents/skill-change.md](docs/agents/skill-change.md)。 约定: diff --git a/INSTALL.md b/INSTALL.md index 148c2127..3982f3d8 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -54,10 +54,10 @@ npm install -g bailian-cli 安装 skills(CLI 内置,无需 Git / npx skills): ```bash -bl skill add --name all +bl skill init ``` -**Supported:** `--name all` 一次装齐整套 `bailian-*`(含共享协议 `bailian-protocol`)。 +**Supported:** `bl skill init` 一次装齐 registry 中全部 `bailian-*`(含共享协议 `bailian-protocol`)。 **Advanced / 按需子集:** diff --git a/README.md b/README.md index dc019efb..891699e3 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,7 @@ Please read https://bailian.aliyun.com/cli/install.md and install the Aliyun Mod ```bash npm install -g bailian-cli -npx skills add modelstudioai/cli --all -g +bl skill init ``` > Requires Node.js >= 18.17. diff --git a/README.zh.md b/README.zh.md index aa00be96..2b852433 100644 --- a/README.zh.md +++ b/README.zh.md @@ -85,7 +85,7 @@ _专为 AI Agent 打造,每个命令均可作为结构化工具调用。_ ```bash npm install -g bailian-cli -npx skills add modelstudioai/cli --all -g +bl skill init ``` > 需要预先安装 Node.js >= 18.17。 diff --git a/docs/agents/skill-change.md b/docs/agents/skill-change.md index 38d75215..cddbaa32 100644 --- a/docs/agents/skill-change.md +++ b/docs/agents/skill-change.md @@ -11,16 +11,17 @@ ## 统一口径(安装) -1. **Supported install:** `bl skill add --name all`(整包装齐,含 `bailian-protocol`) +1. **Supported install:** `bl skill init`(装齐 registry 中全部 `bailian-*`,含 `bailian-protocol`) 2. **`bailian-protocol` 是共享协议 skill**,业务 skill 执行前应 Read 它 3. **不要**在 frontmatter 写 `companions`,也不要对外说「companions = 安装器硬依赖」 4. 子集安装:`bl skill add --name bailian-protocol,`;漏装 protocol 会导致相对路径 Read 失败 +5. **`bl skill add --all`:** 安装 registry 全量(含 `spark-video` 等非 bailian 技能);一键安装 / `bl update` 用 `skill init`,不要用 `--all` ## 概念图 ```text bailian-protocol ← 共享协议(consent / 鉴权 / 版本 / 错误上报) - ▲ 靠 `bl skill add --name all` 与业务 skill 同装;非安装器强制 companions + ▲ 靠 `bl skill init` 与业务 skill 同装;非安装器强制 companions │ ┌───────┴────────┬────────────────┬──────────────────┐ bailian-gen bailian-finetune bailian-managed-agent @@ -37,8 +38,8 @@ bailian-gen bailian-finetune bailian-managed-agent ### A. 分层边界 -- [ ] **整包装齐**:安装/升级文案主推 `bl skill add --name all`;业务 skill **不**声明 `companions` -- [ ] **协议读取**:CRITICAL / references 可链 `../bailian-protocol/…`;若读不到 → 停止执行 `bl`,提示 `bl skill add --name all` +- [ ] **整包装齐**:安装/升级文案主推 `bl skill init`;业务 skill **不**声明 `companions` +- [ ] **协议读取**:CRITICAL / references 可链 `../bailian-protocol/…`;若读不到 → 停止执行 `bl`,提示 `bl skill init` - [ ] **软 hand-off**:兄弟业务 skill **只写 skill 名**;已安装则 Read,未安装则 `bl … --help` 或提示整包安装;**不要**把 `../bailian-gen/…` 等写成执行前提 - [ ] **Hub vs 领域**:`bailian-cli` 的「When to use which command」只列 hub 拥有的意图;媒体 / 精调 / managed-agent 各留 hand-off 行,**不抄**领域默认模型与子命令明细 - [ ] **渐进披露**:SKILL 写意图路由与领域硬规则;flags / usage / examples 以 `reference/` 或 `bl --help` 为准,表后保留「勿猜 flag」指向句 @@ -46,9 +47,9 @@ bailian-gen bailian-finetune bailian-managed-agent ### B. 文案与落款一致性 - [ ] 领域 skill(gen / finetune / managed-agent)路由或命令表后有指向 `reference/` 的句;文末 `## references`(protocol + reference)与家族对齐 -- [ ] description 含 WHAT + WHEN + 反触发;安装说明指向 `bl skill add --name all`,不写 companions 必装 +- [ ] description 含 WHAT + WHEN + 反触发;安装说明指向 `bl skill init`,不写 companions 必装 - [ ] Quick examples 只演示本 skill 职责(hub 不示范 `bl image` / `bl video` 等) -- [ ] 若改了安装方式:同步 `README.md` / `README.zh.md` / `INSTALL.md` / `skills/*/README*` / `skills/bailian-protocol/assets/setup.md` 中的 `bl skill add …` 示例(改 `INSTALL.md` 时按 [install-doc-change.md](install-doc-change.md) 同步静态页) +- [ ] 若改了安装方式:同步 `README.md` / `README.zh.md` / `INSTALL.md` / `skills/*/README*` / `skills/bailian-protocol/assets/setup.md` 中的 `bl skill init` / `bl skill add …` 示例(改 `INSTALL.md` 时按 [install-doc-change.md](install-doc-change.md) 同步静态页) ### C. 归属与生成 @@ -61,7 +62,7 @@ bailian-gen bailian-finetune bailian-managed-agent ```sh pnpm run sync:skill-assets # 已发布版本试装 -bl skill add --name all +bl skill init ``` 抽查:打开 `skills/bailian-cli/SKILL.md` 确认无领域子命令明细表、无 `companions`;打开对应领域 skill 确认有「勿猜 flag」与 hand-off。 diff --git a/packages/cli/README.md b/packages/cli/README.md index dc019efb..891699e3 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -86,7 +86,7 @@ Please read https://bailian.aliyun.com/cli/install.md and install the Aliyun Mod ```bash npm install -g bailian-cli -npx skills add modelstudioai/cli --all -g +bl skill init ``` > Requires Node.js >= 18.17. diff --git a/packages/cli/README.zh.md b/packages/cli/README.zh.md index aa00be96..2b852433 100644 --- a/packages/cli/README.zh.md +++ b/packages/cli/README.zh.md @@ -85,7 +85,7 @@ _专为 AI Agent 打造,每个命令均可作为结构化工具调用。_ ```bash npm install -g bailian-cli -npx skills add modelstudioai/cli --all -g +bl skill init ``` > 需要预先安装 Node.js >= 18.17。 diff --git a/packages/commands/src/commands/config/inventory.ts b/packages/commands/src/commands/config/inventory.ts index bd45fa23..b5a17757 100644 --- a/packages/commands/src/commands/config/inventory.ts +++ b/packages/commands/src/commands/config/inventory.ts @@ -128,8 +128,8 @@ function countFiles(dir: string, budget = 500): number { } /** - * Skill directories to scan, keyed by the module that owns them. `bl skill - * add --name all` fans skills out into each installed agent, so the same skill can + * Skill directories to scan, keyed by the module that owns them. `bl skill init` / + * `bl skill add` fans skills out into each installed agent, so the same skill can * live in several of these roots at once. */ function skillRoots(home: string): Array<{ source: string; dir: string }> { diff --git a/packages/commands/src/commands/config/ui-html.ts b/packages/commands/src/commands/config/ui-html.ts index 4f31ab53..0c7ebbaf 100644 --- a/packages/commands/src/commands/config/ui-html.ts +++ b/packages/commands/src/commands/config/ui-html.ts @@ -1444,7 +1444,7 @@ export const PAGE_HTML = ` function renderSkills() { var body = document.getElementById('skillsBody'); var pager = document.getElementById('skillsPager'); - if (!SKILLS.length) { pager.innerHTML = ''; renderEmpty(body, 'No skills installed.', 'Install with bl skill add --name all'); return; } + if (!SKILLS.length) { pager.innerHTML = ''; renderEmpty(body, 'No skills installed.', 'Install with bl skill init'); return; } var list = SKILLS.filter(function (s) { return skillMatches(s, SKILL_Q); }); if (!list.length) { pager.innerHTML = ''; renderEmpty(body, 'No skills match "' + SKILL_Q + '".', ''); return; } var info = pageSlice(list, SKILL_PAGE, getPageSize('skills')); SKILL_PAGE = info.page; diff --git a/packages/commands/src/commands/update.ts b/packages/commands/src/commands/update.ts index e9692d90..ee6e3e56 100644 --- a/packages/commands/src/commands/update.ts +++ b/packages/commands/src/commands/update.ts @@ -20,7 +20,7 @@ import { type AnsiStyles, } from "bailian-cli-runtime"; -const SKILL_INSTALL_CMD = "bl skill add --name all"; +const SKILL_INSTALL_CMD = "bl skill init"; function updateAgentSkill(color: AnsiStyles): void { process.stderr.write("\nUpdating agent skill...\n"); diff --git a/packages/runtime/src/utils/update-checker.ts b/packages/runtime/src/utils/update-checker.ts index 1ae51104..1a79a0ab 100644 --- a/packages/runtime/src/utils/update-checker.ts +++ b/packages/runtime/src/utils/update-checker.ts @@ -299,11 +299,11 @@ export async function performAutoUpdate( try { process.stderr.write(` ${dim}Syncing agent skill...${reset}\n`); - execSync(`bl skill add --name all`, { stdio: "inherit" }); + execSync(`bl skill init`, { stdio: "inherit" }); process.stderr.write(` ${green}✓ Agent skill updated.${reset}\n\n`); } catch (err) { process.stderr.write(` ${yellow}⚠ Agent skill sync failed: ${errorMessage(err)}${reset}\n`); - process.stderr.write(` ${yellow} Run manually: bl skill add --name all${reset}\n\n`); + process.stderr.write(` ${yellow} Run manually: bl skill init${reset}\n\n`); } pendingNotification = null; diff --git a/skills/bailian-cli/README.md b/skills/bailian-cli/README.md index df45eaf6..3888131e 100644 --- a/skills/bailian-cli/README.md +++ b/skills/bailian-cli/README.md @@ -4,11 +4,11 @@ Agent skill for **Alibaba Cloud Model Studio CLI** (`bl`) resource hub — apps, memory, RAG, usage/quota, MCP, and hub `reference/`. -- Shared protocol: `bailian-protocol` (install via `bl skill add --name all`) +- Shared protocol: `bailian-protocol` (install via `bl skill init`) - Soft hand-offs (optional skills): `bailian-gen` · `bailian-finetune` · `bailian-managed-agent` ```bash -bl skill add --name all +bl skill init ``` For CLI installation, authentication, and examples, see the [main README](../../README.md). diff --git a/skills/bailian-cli/README.zh.md b/skills/bailian-cli/README.zh.md index 13c09ffb..cd0d015f 100644 --- a/skills/bailian-cli/README.zh.md +++ b/skills/bailian-cli/README.zh.md @@ -4,11 +4,11 @@ **阿里云百炼 CLI**(`bl`)的资源管理 Agent 技能 — 应用、记忆、RAG、用量/额度、MCP,以及 hub `reference/`。 -- 共享协议:`bailian-protocol`(通过 `bl skill add --name all` 与整家族同装) +- 共享协议:`bailian-protocol`(通过 `bl skill init` 与整家族同装) - 软 hand-off(可选):`bailian-gen` · `bailian-finetune` · `bailian-managed-agent` ```bash -bl skill add --name all +bl skill init ``` CLI 的安装、认证和使用示例请查看[主 README](../../README.zh.md)。 diff --git a/skills/bailian-cli/SKILL.md b/skills/bailian-cli/SKILL.md index 2158b162..bcf6d2f6 100644 --- a/skills/bailian-cli/SKILL.md +++ b/skills/bailian-cli/SKILL.md @@ -10,7 +10,7 @@ description: >- 工作空间、MCP 市场、pipeline、文件上传、console API、登录鉴权与配置、 Agent skill 安装/列表/更新/卸载(bl skill add|list|update|remove,百炼 skill registry)。 用户点名百炼 / DashScope / `bl`,或继续既有 `bl` 工作流时直接使用。 - 共享协议(consent / 版本预检 / 鉴权 / 错误上报)在 bailian-protocol;官方安装 `bl skill add --name all`。 + 共享协议(consent / 版本预检 / 鉴权 / 错误上报)在 bailian-protocol;官方安装 `bl skill init`。 家族路由:生图/生视频/配音/语音合成/转写 → bailian-gen;精调/微调/训练/数据集 → bailian-finetune; agents.yaml 托管 Agent → bailian-managed-agent。 不要用于普通问答、编程、写作、翻译、摘要、泛搜索,或图片理解等宿主自己能做的任务(普通问答、编程、写作、翻译、摘要、泛搜索不触发)。 @@ -19,14 +19,14 @@ description: >- # Aliyun Model Studio CLI (`bl`) -**CRITICAL — Before executing, MUST read the shared protocol in [`../bailian-protocol/SKILL.md`](../bailian-protocol/SKILL.md): Provider selection and consent, Version & updates (pre-flight checklist), Setup & auth, and CLI errors: report an issue. If that protocol file is missing, stop and run `bl skill add --name all`; do not guess auth/consent.** +**CRITICAL — Before executing, MUST read the shared protocol in [`../bailian-protocol/SKILL.md`](../bailian-protocol/SKILL.md): Provider selection and consent, Version & updates (pre-flight checklist), Setup & auth, and CLI errors: report an issue. If that protocol file is missing, stop and run `bl skill init`; do not guess auth/consent.** > **Family hub** — This skill owns Bailian resource commands and the hub `reference/` (apps, knowledge, usage, auth, config, …). -> Shared protocol → [`../bailian-protocol/SKILL.md`](../bailian-protocol/SKILL.md) (install the full family with `bl skill add --name all`). -> Soft hand-offs by skill name (Read if installed; else `bl … --help` / prompt `bl skill add --name all`): `bailian-gen` (media) · `bailian-finetune` (training) · `bailian-managed-agent` (agents.yaml IaC). +> Shared protocol → [`../bailian-protocol/SKILL.md`](../bailian-protocol/SKILL.md) (install the full family with `bl skill init`). +> Soft hand-offs by skill name (Read if installed; else `bl … --help` / prompt `bl skill init`): `bailian-gen` (media) · `bailian-finetune` (training) · `bailian-managed-agent` (agents.yaml IaC). > Do not invoke it for ordinary reasoning, coding, writing, translation, summarization, generic research, or image understanding the host agent can complete directly. > -> **Install (supported):** `bl skill add --name all` +> **Install (supported):** `bl skill init` ## Command reference (authoritative) @@ -113,7 +113,7 @@ schema-export commands. ## Routing reminders -- Image/video/audio generation or editing → skill `bailian-gen` (class 3 consent from `bailian-protocol`). Fine-tuning / datasets / deployments → `bailian-finetune`. agents.yaml IaC → `bailian-managed-agent`. Soft hand-off: Read sibling skill if installed; else `bl … --help` or prompt `bl skill add --name all`. Image understanding the host agent can do → host-first; use `bl vision` / `bl omni` only when the user names a Bailian model or the media (video/audio files) exceeds host capability. +- Image/video/audio generation or editing → skill `bailian-gen` (class 3 consent from `bailian-protocol`). Fine-tuning / datasets / deployments → `bailian-finetune`. agents.yaml IaC → `bailian-managed-agent`. Soft hand-off: Read sibling skill if installed; else `bl … --help` or prompt `bl skill init`. Image understanding the host agent can do → host-first; use `bl vision` / `bl omni` only when the user names a Bailian model or the media (video/audio files) exceeds host capability. - Answer ordinary reasoning, coding, writing, translation, summarization, and generic research with the host agent's native capabilities; do not bounce them through `bl text chat` or `bl search web`. - Usage / quota / credits questions that do not name a product → ask which product (Bailian or another AI service) first; run `bl usage` / `bl quota` only after the user picks Bailian or Bailian context is already established. - "Remember this" and memory requests default to the host agent's own memory; `bl memory *` is only for Bailian app memory resources. diff --git a/skills/bailian-finetune/SKILL.md b/skills/bailian-finetune/SKILL.md index f2efd1b3..c3f10eff 100644 --- a/skills/bailian-finetune/SKILL.md +++ b/skills/bailian-finetune/SKILL.md @@ -11,12 +11,12 @@ description: >- upload 拿 file-id → finetune create 建任务 → watch 看进度 → export 导出 → deploy 上线,需要 API key; 写操作先用 `--dry-run` 预览。反触发:用户点名火山方舟/ark 的精调不走本 skill;只是要选哪个模型走 bailian-model-recommend;用现成模型生图生视频走 bailian-gen;百炼其他资源管理走 bailian-cli。 - 官方安装:`bl skill add --name all`(与共享协议 bailian-protocol 同装)。 + 官方安装:`bl skill init`(与共享协议 bailian-protocol 同装)。 --- # Bailian fine-tuning pipeline (`bl dataset` / `bl finetune` / `bl deploy`) -**CRITICAL — Before executing, MUST read the shared protocol in [`../bailian-protocol/SKILL.md`](../bailian-protocol/SKILL.md): Version & updates (pre-flight checklist), Setup & auth, and CLI errors: report an issue. Command details are authoritative in [`reference/`](reference/index.md) (dataset / finetune / deploy) and `bl --help` — do not guess flags. The whole pipeline requires an API key. If that protocol file is missing, stop and run `bl skill add --name all`; do not guess auth/consent.** +**CRITICAL — Before executing, MUST read the shared protocol in [`../bailian-protocol/SKILL.md`](../bailian-protocol/SKILL.md): Version & updates (pre-flight checklist), Setup & auth, and CLI errors: report an issue. Command details are authoritative in [`reference/`](reference/index.md) (dataset / finetune / deploy) and `bl --help` — do not guess flags. The whole pipeline requires an API key. If that protocol file is missing, stop and run `bl skill init`; do not guess auth/consent.** ## End-to-end workflow (follow in order) @@ -63,7 +63,7 @@ bl deploy text create --model my-qwen-sft --name my-svc ## Common hand-offs -软 hand-off(按 skill **名**;已安装则 Read,否则 `--help` / 提示 `bl skill add --name all`): +软 hand-off(按 skill **名**;已安装则 Read,否则 `--help` / 提示 `bl skill init`): - After deployment, try the model or generate content → skill `bailian-gen` (media) or `bl text chat` (fallback: `bl image\|video\|text --help`). - Unsure which base model to pick → `bailian-model-recommend` / `bl advisor recommend`. @@ -71,5 +71,5 @@ bl deploy text create --model my-qwen-sft --name my-svc ## references -- [bailian-protocol](../bailian-protocol/SKILL.md) — shared protocol (install via `bl skill add --name all`) +- [bailian-protocol](../bailian-protocol/SKILL.md) — shared protocol (install via `bl skill init`) - [reference/](reference/index.md) — command details diff --git a/skills/bailian-gen/SKILL.md b/skills/bailian-gen/SKILL.md index 12d9bcfb..f9b9da08 100644 --- a/skills/bailian-gen/SKILL.md +++ b/skills/bailian-gen/SKILL.md @@ -13,12 +13,12 @@ description: >- 图片和语音同步返回并落地本地文件,视频是异步任务、用 `--download` 或轮询取回;本地文件直接传路径,CLI 自动上传。 反触发:宿主自己能做的图片理解、普通问答、编程、写作、翻译不走本技能;百炼应用/知识库/用量/额度走 bailian-cli; 精调训练走 bailian-finetune。 - 官方安装:`bl skill add --name all`(与共享协议 bailian-protocol 同装)。 + 官方安装:`bl skill init`(与共享协议 bailian-protocol 同装)。 --- # Bailian media generation (`bl image` / `bl video` / `bl speech` / `bl omni`) -**CRITICAL — Before executing, MUST read the shared protocol in [`../bailian-protocol/SKILL.md`](../bailian-protocol/SKILL.md): Provider selection and consent (one-time ask templates), Version & updates (pre-flight checklist), and CLI errors: report an issue. Command details are authoritative in [`reference/`](reference/index.md) and `bl --help` — do not guess flags. If that protocol file is missing, stop and run `bl skill add --name all`; do not guess auth/consent.** +**CRITICAL — Before executing, MUST read the shared protocol in [`../bailian-protocol/SKILL.md`](../bailian-protocol/SKILL.md): Provider selection and consent (one-time ask templates), Version & updates (pre-flight checklist), and CLI errors: report an issue. Command details are authoritative in [`reference/`](reference/index.md) and `bl --help` — do not guess flags. If that protocol file is missing, stop and run `bl skill init`; do not guess auth/consent.** ## Consent (short version; full rules in bailian-protocol) @@ -76,7 +76,7 @@ If one or more `bl` commands actually ran, proactively add a one-line summary in ## Common hand-offs -软 hand-off(按 skill **名**;已安装则 Read,否则 `--help` / 提示 `bl skill add --name all`): +软 hand-off(按 skill **名**;已安装则 Read,否则 `--help` / 提示 `bl skill init`): - Generation failed and it is not a usage/auth/content-filter issue → follow the issue-reporting flow in `bailian-protocol` ([`../bailian-protocol/SKILL.md`](../bailian-protocol/SKILL.md#cli-errors-report-an-issue)) and ask once whether to report. - Managing Bailian apps / knowledge bases / usage → skill `bailian-cli` (fallback: `bl app\|knowledge\|usage --help`). @@ -84,5 +84,5 @@ If one or more `bl` commands actually ran, proactively add a one-line summary in ## references -- [bailian-protocol](../bailian-protocol/SKILL.md) — shared protocol (install via `bl skill add --name all`) +- [bailian-protocol](../bailian-protocol/SKILL.md) — shared protocol (install via `bl skill init`) - [reference/](reference/index.md) — command details diff --git a/skills/bailian-managed-agent/SKILL.md b/skills/bailian-managed-agent/SKILL.md index 31f82b09..929dfee8 100644 --- a/skills/bailian-managed-agent/SKILL.md +++ b/skills/bailian-managed-agent/SKILL.md @@ -11,12 +11,12 @@ description: >- apply / destroy 变更远端资源且必须带 `--yes`,务必先 plan 给用户看 diff 再让其确认。 反触发:调用已上线的百炼应用/智能体走 bailian-app-call 或 `bl app`;宿主 agent 自身的记忆、技能、 子代理不走本 skill;生图生视频走 bailian-gen。 - 官方安装:`bl skill add --name all`(与共享协议 bailian-protocol 同装)。 + 官方安装:`bl skill init`(与共享协议 bailian-protocol 同装)。 --- # Bailian managed agent IaC (`bl managed-agent`) -**CRITICAL — Before executing, MUST read the shared protocol in [`../bailian-protocol/SKILL.md`](../bailian-protocol/SKILL.md): Version & updates (pre-flight checklist) and CLI errors: report an issue. Command details are authoritative in [`reference/managed-agent.md`](reference/managed-agent.md) and `bl managed-agent --help` — do not guess flags. If that protocol file is missing, stop and run `bl skill add --name all`; do not guess auth/consent.** +**CRITICAL — Before executing, MUST read the shared protocol in [`../bailian-protocol/SKILL.md`](../bailian-protocol/SKILL.md): Version & updates (pre-flight checklist) and CLI errors: report an issue. Command details are authoritative in [`reference/managed-agent.md`](reference/managed-agent.md) and `bl managed-agent --help` — do not guess flags. If that protocol file is missing, stop and run `bl skill init`; do not guess auth/consent.** ## Safety guardrail (the most important rule) @@ -60,7 +60,7 @@ Flags, usage, and examples: see [`reference/`](reference/index.md) or `bl - 阿里云百炼 `bl` 家族共享执行协议(consent 确认、版本预检、鉴权/安装、错误上报、本地文件与输出约定)。 不是面向用户意图的业务入口;当任一 bailian-* 业务 skill(bailian-cli / bailian-gen / bailian-finetune / bailian-managed-agent)执行前需要公共上下文,或用户首次安装/鉴权/`bl` 报错需上报时读取本 skill。 - 官方安装为整包:`bl skill add --name all`(与业务 skill 同装)。 + 官方安装为整包:`bl skill init`(与业务 skill 同装)。 --- # Bailian shared protocol (`bailian-protocol`) @@ -18,7 +18,7 @@ description: >- > **Install(supported):** 整包装齐,含本 skill 与全部业务 skill: > > ```bash -> bl skill add --name all +> bl skill init > ``` > > 子集安装请显式带上 `bailian-protocol`(例如 `bl skill add --name bailian-protocol,bailian-gen`),否则业务 skill 的相对路径 Read 会失败。 @@ -44,7 +44,7 @@ After approval, treat Bailian as selected for the current task. Do not ask again ## Family routing & hand-offs 业务路由(**软 hand-off**:按 skill **名**路由;已安装则 Read 其 `SKILL.md`,未安装则用 `bl --help`,或提示整包安装 -`bl skill add --name all`): +`bl skill init`): | Intent | Skill | Fallback | | ------------------------------------- | ----------------------- | ----------------------------------------------- | @@ -55,7 +55,7 @@ After approval, treat Bailian as selected for the current task. Do not ask again **共享协议** vs **软 hand-off**: -- `bailian-protocol`:靠 `bl skill add --name all` 与业务 skill 同装;CRITICAL 可用相对路径 `../bailian-protocol/…`。读不到则停止跑 `bl`,提示整包安装。 +- `bailian-protocol`:靠 `bl skill init` 与业务 skill 同装;CRITICAL 可用相对路径 `../bailian-protocol/…`。读不到则停止跑 `bl`,提示整包安装。 - 其它 bailian-\* 业务 skill:只按名字提及,**不要**写死 `../bailian-*/SKILL.md` 当执行前提。 ## Version & updates (after provider selection, before the first `bl` command) diff --git a/skills/bailian-protocol/assets/issue-reporting.md b/skills/bailian-protocol/assets/issue-reporting.md index c75e2719..b1df4d53 100644 --- a/skills/bailian-protocol/assets/issue-reporting.md +++ b/skills/bailian-protocol/assets/issue-reporting.md @@ -114,7 +114,7 @@ Offer reporting when **none** of EXCLUDE applies **and** any of the following ho ### Before offering to report -1. Align versions: [SKILL.md → Version & updates](../SKILL.md#version--updates-after-provider-selection-before-the-first-bl-command) — run `bl update` and `bl skill add --name all` if mismatched. +1. Align versions: [SKILL.md → Version & updates](../SKILL.md#version--updates-after-provider-selection-before-the-first-bl-command) — run `bl update` and `bl skill init` if mismatched. 2. Confirm `bl auth status` is healthy (for commands that need auth). 3. Retry once with `--verbose` if stderr was thin. diff --git a/skills/bailian-protocol/assets/setup.md b/skills/bailian-protocol/assets/setup.md index 2bae59dd..3c0d8407 100644 --- a/skills/bailian-protocol/assets/setup.md +++ b/skills/bailian-protocol/assets/setup.md @@ -15,7 +15,7 @@ inspect config keys. Day-to-day command routing lives in the business skills # Recommended binary install (no Node), or: npm install -g bailian-cli curl -fsSL https://bailian.aliyun.com/cli/install.sh | bash # Install the full bailian-* skill family (includes bailian-protocol) -bl skill add --name all +bl skill init # Advanced / subset (comma-separated names; include bailian-protocol when needed) # bl skill add --name bailian-protocol,bailian-gen diff --git a/skills/bailian-protocol/assets/versioning.md b/skills/bailian-protocol/assets/versioning.md index 804349dc..fea70175 100644 --- a/skills/bailian-protocol/assets/versioning.md +++ b/skills/bailian-protocol/assets/versioning.md @@ -16,7 +16,7 @@ 3. Compare the two versions (ignore the `bl` prefix; compare only `X.Y.Z`): - If `metadata.version` ≠ `bl --version`, refresh skills before doing anything else: ```bash - bl skill add --name all + bl skill init ``` - Do not trust a stale `reference/` when versions mismatch — flags may be wrong. 4. Check the latest published CLI version: @@ -26,7 +26,7 @@ 5. If the installed `bl` is **older** than the latest npm version, **STOP** the current task and **ask the user** (report skill version, installed CLI version, and npm latest): > A newer version of bl is available (current: X.Y.Z, latest: A.B.C). Upgrade before continuing? - **Do NOT auto-upgrade silently** — the user decides. - - If the user agrees: run `bl update`, then continue. (`bl update` upgrades `bailian-cli` via npm and, on success, also runs `bl skill add --name all` to keep skills in lockstep across all agent apps.) + - If the user agrees: run `bl update`, then continue. (`bl update` upgrades `bailian-cli` via npm and, on success, also runs `bl skill init` to keep skills in lockstep across all agent apps.) - If the user declines: continue with the current version and note it in the summary. - If `npm view` / `bl update` fails (offline, registry blocked, permission): continue with the current `bl` and tell the user it could not be updated. 6. Only proceed with the user's actual task after the above is resolved. @@ -41,10 +41,10 @@ If `bl --version` fails, install the CLI and skills: # Recommended — no Node required curl -fsSL https://bailian.aliyun.com/cli/install.sh | bash # Or: npm install -g bailian-cli -bl skill add --name all +bl skill init ``` -Do not install a single business skill alone — use `--name all` so `bailian-protocol` is present. +Do not install a single business skill alone — use `bl skill init` so `bailian-protocol` is present. ## Mention it in the task summary diff --git a/tools/generate-reference.ts b/tools/generate-reference.ts index fee3ef12..089a63bb 100644 --- a/tools/generate-reference.ts +++ b/tools/generate-reference.ts @@ -7,7 +7,7 @@ * Ownership of each top-level command group is declared in `GROUP_OWNER_SKILL` below. * Unmapped groups fall back to `bailian-cli` (hub) so new commands never block generation. * - * Committed to git; consumed by bailian-* Agent Skills (`bl skill add --name all`). + * Committed to git; consumed by bailian-* Agent Skills (`bl skill init`). * * Run: pnpm --filter bailian-cli run generate:reference * Also run via `pnpm run sync:skill-assets` or the repo pre-commit hook. From 4ec0f6828bfcff69042478c6cb0bb442647f4c08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=A5=E9=BA=92?= Date: Thu, 13 Aug 2026 19:14:49 +0800 Subject: [PATCH 3/7] fix(update): sync skills after binary upgrades --- packages/commands/src/commands/update.ts | 1 + .../tests/update-binary-skill-sync.test.ts | 62 +++++++++++++++++++ packages/runtime/src/utils/update-checker.ts | 29 ++++++--- packages/runtime/tests/update-checker.test.ts | 55 +++++++++++++++- 4 files changed, 138 insertions(+), 9 deletions(-) create mode 100644 packages/commands/tests/update-binary-skill-sync.test.ts diff --git a/packages/commands/src/commands/update.ts b/packages/commands/src/commands/update.ts index ee6e3e56..fbca9809 100644 --- a/packages/commands/src/commands/update.ts +++ b/packages/commands/src/commands/update.ts @@ -142,6 +142,7 @@ export default defineCommand({ `\n${color.green(`\u2713 Update complete: ${currentVersion} \u2192 ${newVer}`)}\n`, ); writeUpdateState(newVer); + updateAgentSkill(color); } catch (error) { const message = error instanceof Error ? error.message : String(error); const reinstall = diff --git a/packages/commands/tests/update-binary-skill-sync.test.ts b/packages/commands/tests/update-binary-skill-sync.test.ts new file mode 100644 index 00000000..6a55a8ba --- /dev/null +++ b/packages/commands/tests/update-binary-skill-sync.test.ts @@ -0,0 +1,62 @@ +import { mkdtempSync, rmSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { afterEach, beforeEach, expect, test, vi } from "vite-plus/test"; + +const runtimeMocks = vi.hoisted(() => ({ + performBinaryUpdate: vi.fn(), +})); + +const childProcessMocks = vi.hoisted(() => ({ + execSync: vi.fn(), +})); + +vi.mock("bailian-cli-runtime", async (importOriginal) => { + const actual = await importOriginal(); + return { ...actual, performBinaryUpdate: runtimeMocks.performBinaryUpdate }; +}); + +vi.mock("child_process", async (importOriginal) => { + const actual = await importOriginal(); + return { ...actual, execSync: childProcessMocks.execSync }; +}); + +import updateCommand from "../src/commands/update.ts"; + +let configDir: string; +let previousConfigDir: string | undefined; +let previousInstallMethod: string | undefined; + +beforeEach(() => { + configDir = mkdtempSync(join(tmpdir(), "bl-update-binary-")); + previousConfigDir = process.env.BAILIAN_CONFIG_DIR; + previousInstallMethod = process.env.BAILIAN_INSTALL_METHOD; + process.env.BAILIAN_CONFIG_DIR = configDir; + process.env.BAILIAN_INSTALL_METHOD = "binary"; + runtimeMocks.performBinaryUpdate.mockResolvedValue("1.15.0"); +}); + +afterEach(() => { + if (previousConfigDir === undefined) delete process.env.BAILIAN_CONFIG_DIR; + else process.env.BAILIAN_CONFIG_DIR = previousConfigDir; + if (previousInstallMethod === undefined) delete process.env.BAILIAN_INSTALL_METHOD; + else process.env.BAILIAN_INSTALL_METHOD = previousInstallMethod; + rmSync(configDir, { recursive: true, force: true }); + vi.clearAllMocks(); +}); + +test("binary bl update syncs bailian skills after the CLI update succeeds", async () => { + await updateCommand.run({ + identity: { + binName: "bl", + clientName: "bailian-cli", + npmPackage: "bailian-cli", + version: "1.14.3", + }, + flags: { to: "1.15.0" }, + settings: {}, + } as never); + + expect(runtimeMocks.performBinaryUpdate).toHaveBeenCalledWith("1.15.0"); + expect(childProcessMocks.execSync).toHaveBeenCalledWith("bl skill init", { stdio: "inherit" }); +}); diff --git a/packages/runtime/src/utils/update-checker.ts b/packages/runtime/src/utils/update-checker.ts index 1a79a0ab..65999c0b 100644 --- a/packages/runtime/src/utils/update-checker.ts +++ b/packages/runtime/src/utils/update-checker.ts @@ -209,6 +209,25 @@ function errorMessage(err: unknown): string { return String(err); } +async function syncAgentSkillsAfterUpdate( + dim: string, + green: string, + yellow: string, + reset: string, +): Promise { + try { + process.stderr.write(` ${dim}Syncing agent skill...${reset}\n`); + const { execSync } = await import("child_process"); + execSync("bl skill init", { stdio: "inherit" }); + process.stderr.write(` ${green}\u2713 Agent skill updated.${reset}\n\n`); + } catch (error) { + process.stderr.write( + ` ${yellow}\u26a0 Agent skill sync failed: ${errorMessage(error)}${reset}\n`, + ); + process.stderr.write(` ${yellow} Run manually: bl skill init${reset}\n\n`); + } +} + /** * Perform auto-update for npm or binary installs. * Returns true if update succeeded, false otherwise. @@ -256,6 +275,7 @@ export async function performAutoUpdate( writeState({ lastChecked: Date.now(), latestVersion: newVer }); process.stderr.write(` ${green}✓ Update complete: ${currentVersion} → ${newVer}${reset}\n`); process.stderr.write(` ${dim}Run ${cyan}bl --version${reset}${dim} to verify.${reset}\n\n`); + await syncAgentSkillsAfterUpdate(dim, green, yellow, reset); pendingNotification = null; return true; } catch (err) { @@ -297,14 +317,7 @@ export async function performAutoUpdate( ); process.stderr.write(` ${dim}Run ${cyan}bl --version${reset}${dim} to verify.${reset}\n\n`); - try { - process.stderr.write(` ${dim}Syncing agent skill...${reset}\n`); - execSync(`bl skill init`, { stdio: "inherit" }); - process.stderr.write(` ${green}✓ Agent skill updated.${reset}\n\n`); - } catch (err) { - process.stderr.write(` ${yellow}⚠ Agent skill sync failed: ${errorMessage(err)}${reset}\n`); - process.stderr.write(` ${yellow} Run manually: bl skill init${reset}\n\n`); - } + await syncAgentSkillsAfterUpdate(dim, green, yellow, reset); pendingNotification = null; return true; diff --git a/packages/runtime/tests/update-checker.test.ts b/packages/runtime/tests/update-checker.test.ts index 94886ea5..7c1dc0b8 100644 --- a/packages/runtime/tests/update-checker.test.ts +++ b/packages/runtime/tests/update-checker.test.ts @@ -1,13 +1,58 @@ -import { expect, test } from "vite-plus/test"; +import { mkdtempSync, rmSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { afterEach, beforeEach, expect, test, vi } from "vite-plus/test"; + +const binaryUpdateMocks = vi.hoisted(() => ({ + performBinaryUpdate: vi.fn(), +})); + +const childProcessMocks = vi.hoisted(() => ({ + execSync: vi.fn(), +})); + +vi.mock("../src/utils/binary-update.ts", async (importOriginal) => { + const actual = await importOriginal(); + return { ...actual, performBinaryUpdate: binaryUpdateMocks.performBinaryUpdate }; +}); + +vi.mock("child_process", async (importOriginal) => { + const actual = await importOriginal(); + return { ...actual, execSync: childProcessMocks.execSync }; +}); + import { compareVersion, isMajorUpgrade, isNewerVersion, isPrerelease, parseVersion, + performAutoUpdate, shouldAutoUpdate, } from "../src/utils/update-checker.ts"; +let configDir: string; +let previousConfigDir: string | undefined; +let previousInstallMethod: string | undefined; + +beforeEach(() => { + configDir = mkdtempSync(join(tmpdir(), "bl-auto-update-binary-")); + previousConfigDir = process.env.BAILIAN_CONFIG_DIR; + previousInstallMethod = process.env.BAILIAN_INSTALL_METHOD; + process.env.BAILIAN_CONFIG_DIR = configDir; + process.env.BAILIAN_INSTALL_METHOD = "binary"; + binaryUpdateMocks.performBinaryUpdate.mockResolvedValue("2.0.0"); +}); + +afterEach(() => { + if (previousConfigDir === undefined) delete process.env.BAILIAN_CONFIG_DIR; + else process.env.BAILIAN_CONFIG_DIR = previousConfigDir; + if (previousInstallMethod === undefined) delete process.env.BAILIAN_INSTALL_METHOD; + else process.env.BAILIAN_INSTALL_METHOD = previousInstallMethod; + rmSync(configDir, { recursive: true, force: true }); + vi.clearAllMocks(); +}); + test("parseVersion strips pre-release and build metadata", () => { expect(parseVersion("1.4.2")).toEqual([1, 4, 2]); expect(parseVersion("2.0.0-beta.1")).toEqual([2, 0, 0]); @@ -124,3 +169,11 @@ test("shouldAutoUpdate only targets stable releases with a significant gap", () // Same core, release over its pre-release: notify only (no major gap). expect(shouldAutoUpdate("1.4.2", "1.4.2-beta.1")).toBe(false); }); + +test("binary auto-update syncs bailian skills after the CLI update succeeds", async () => { + const updated = await performAutoUpdate("1.14.3", "2.0.0"); + + expect(updated).toBe(true); + expect(binaryUpdateMocks.performBinaryUpdate).toHaveBeenCalledWith("2.0.0"); + expect(childProcessMocks.execSync).toHaveBeenCalledWith("bl skill init", { stdio: "inherit" }); +}); From eb196cb4a6c82156bf0a8da77563a964bde26e86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=A5=E9=BA=92?= Date: Fri, 14 Aug 2026 16:26:47 +0800 Subject: [PATCH 4/7] docs(readme): add standalone installation options --- README.md | 18 +++++++++++++++++- README.zh.md | 18 +++++++++++++++++- packages/cli/README.md | 18 +++++++++++++++++- packages/cli/README.zh.md | 18 +++++++++++++++++- 4 files changed, 68 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 891699e3..c25ee43e 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ Send the following to your Agent — it will detect your environment, then insta Please read https://bailian.aliyun.com/cli/install.md and install the Aliyun Model Studio CLI for me ``` -**Manual install (npm)** +**Install with npm** ```bash npm install -g bailian-cli @@ -91,6 +91,22 @@ bl skill init > Requires Node.js >= 18.17. +**Install on macOS/Linux** + +```bash +curl -fsSL https://bailian.aliyun.com/cli/install.sh | bash +``` + +> No Node.js required. The installer automatically installs Bailian Skills. + +**Install on Windows** + +```powershell +irm https://bailian.aliyun.com/cli/install.ps1 | iex +``` + +> No Node.js required. The installer automatically installs Bailian Skills. + ## Quick Start Once installed, just describe your task to your AI Agent — no need to assemble commands by hand. diff --git a/README.zh.md b/README.zh.md index 2b852433..f0761669 100644 --- a/README.zh.md +++ b/README.zh.md @@ -81,7 +81,7 @@ _专为 AI Agent 打造,每个命令均可作为结构化工具调用。_ 请阅读:https://bailian.aliyun.com/cli/install.md 并按照说明为我安装阿里云百炼 CLI ``` -**手动安装(npm)** +**npm 安装** ```bash npm install -g bailian-cli @@ -90,6 +90,22 @@ bl skill init > 需要预先安装 Node.js >= 18.17。 +**macOS/Linux 安装** + +```bash +curl -fsSL https://bailian.aliyun.com/cli/install.sh | bash +``` + +> 无需预先安装 Node.js,安装脚本会自动安装 Bailian Skills。 + +**Windows 安装** + +```powershell +irm https://bailian.aliyun.com/cli/install.ps1 | iex +``` + +> 无需预先安装 Node.js,安装脚本会自动安装 Bailian Skills。 + ## 快速开始 安装完成后,直接在 AI Agent 中描述你的任务,无需手动拼接命令。 diff --git a/packages/cli/README.md b/packages/cli/README.md index 891699e3..c25ee43e 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -82,7 +82,7 @@ Send the following to your Agent — it will detect your environment, then insta Please read https://bailian.aliyun.com/cli/install.md and install the Aliyun Model Studio CLI for me ``` -**Manual install (npm)** +**Install with npm** ```bash npm install -g bailian-cli @@ -91,6 +91,22 @@ bl skill init > Requires Node.js >= 18.17. +**Install on macOS/Linux** + +```bash +curl -fsSL https://bailian.aliyun.com/cli/install.sh | bash +``` + +> No Node.js required. The installer automatically installs Bailian Skills. + +**Install on Windows** + +```powershell +irm https://bailian.aliyun.com/cli/install.ps1 | iex +``` + +> No Node.js required. The installer automatically installs Bailian Skills. + ## Quick Start Once installed, just describe your task to your AI Agent — no need to assemble commands by hand. diff --git a/packages/cli/README.zh.md b/packages/cli/README.zh.md index 2b852433..f0761669 100644 --- a/packages/cli/README.zh.md +++ b/packages/cli/README.zh.md @@ -81,7 +81,7 @@ _专为 AI Agent 打造,每个命令均可作为结构化工具调用。_ 请阅读:https://bailian.aliyun.com/cli/install.md 并按照说明为我安装阿里云百炼 CLI ``` -**手动安装(npm)** +**npm 安装** ```bash npm install -g bailian-cli @@ -90,6 +90,22 @@ bl skill init > 需要预先安装 Node.js >= 18.17。 +**macOS/Linux 安装** + +```bash +curl -fsSL https://bailian.aliyun.com/cli/install.sh | bash +``` + +> 无需预先安装 Node.js,安装脚本会自动安装 Bailian Skills。 + +**Windows 安装** + +```powershell +irm https://bailian.aliyun.com/cli/install.ps1 | iex +``` + +> 无需预先安装 Node.js,安装脚本会自动安装 Bailian Skills。 + ## 快速开始 安装完成后,直接在 AI Agent 中描述你的任务,无需手动拼接命令。 From f3c7b6fb10a8d380518edc98da2880e903a3cdc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=A5=E9=BA=92?= Date: Fri, 14 Aug 2026 16:28:51 +0800 Subject: [PATCH 5/7] docs(readme): add standalone installation options --- README.md | 2 +- README.zh.md | 2 +- packages/cli/README.md | 2 +- packages/cli/README.zh.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c25ee43e..21f15f2d 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ Send the following to your Agent — it will detect your environment, then insta Please read https://bailian.aliyun.com/cli/install.md and install the Aliyun Model Studio CLI for me ``` -**Install with npm** +**Install with NPM** ```bash npm install -g bailian-cli diff --git a/README.zh.md b/README.zh.md index f0761669..d029e227 100644 --- a/README.zh.md +++ b/README.zh.md @@ -81,7 +81,7 @@ _专为 AI Agent 打造,每个命令均可作为结构化工具调用。_ 请阅读:https://bailian.aliyun.com/cli/install.md 并按照说明为我安装阿里云百炼 CLI ``` -**npm 安装** +**NPM 安装** ```bash npm install -g bailian-cli diff --git a/packages/cli/README.md b/packages/cli/README.md index c25ee43e..21f15f2d 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -82,7 +82,7 @@ Send the following to your Agent — it will detect your environment, then insta Please read https://bailian.aliyun.com/cli/install.md and install the Aliyun Model Studio CLI for me ``` -**Install with npm** +**Install with NPM** ```bash npm install -g bailian-cli diff --git a/packages/cli/README.zh.md b/packages/cli/README.zh.md index f0761669..d029e227 100644 --- a/packages/cli/README.zh.md +++ b/packages/cli/README.zh.md @@ -81,7 +81,7 @@ _专为 AI Agent 打造,每个命令均可作为结构化工具调用。_ 请阅读:https://bailian.aliyun.com/cli/install.md 并按照说明为我安装阿里云百炼 CLI ``` -**npm 安装** +**NPM 安装** ```bash npm install -g bailian-cli From 7eedc05b99b7b56bc6096ce455422f46dc542444 Mon Sep 17 00:00:00 2001 From: clh02467605 Date: Fri, 14 Aug 2026 16:47:30 +0800 Subject: [PATCH 6/7] docs: Modify the preferred installation method --- INSTALL.md | 64 +++++++++++--------- skills/bailian-protocol/assets/setup.md | 28 +++++++-- skills/bailian-protocol/assets/versioning.md | 10 +-- 3 files changed, 64 insertions(+), 38 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 3982f3d8..83662aad 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,8 +1,38 @@ # 阿里云百炼CLI 安装说明(供 AI Agent 阅读) -本文档面向 **AI Agent**:按下列步骤为用户安装并校验 **阿里云百炼CLI**(命令 `bl` / `bailian`)。**优先**使用二进制一键安装(无需 Node);若环境已有 Node / 需要 Command Pack,再用 npm。不要臆造版本号或路径;以用户环境为准。 +本文档面向 **AI Agent**:按下列步骤为用户安装并校验 **阿里云百炼CLI**(命令 `bl` / `bailian`)。**优先**在已有 Node.js(**≥ 18.17.0**)的环境用 npm 安装;若没有可用 Node / npm,再走二进制一键安装。不要臆造版本号或路径;以用户环境为准。 -## 1. 推荐:二进制安装(无需 Node) +## 1. 推荐:npm 安装(要求 **≥ 18.17.0**) + +1. `node -v` 确认版本 ≥ 18.17.0。 +2. `npm -v` 确认可用(**仅允许 npm** 全局安装,不要用 pnpm/yarn)。 +3. 执行: + +```bash +npm install -g bailian-cli +``` + +4. 校验:`bl --version`。 + +安装 skills(CLI 内置,无需 Git / npx skills): + +```bash +bl skill init +``` + +**Supported:** `bl skill init` 一次装齐 registry 中全部 `bailian-*`(含共享协议 `bailian-protocol`)。 + +**Advanced / 按需子集:** + +```bash +bl skill add --name bailian-protocol,bailian-gen +``` + +安装成功后,用中文简要说明已安装的 skills 及用户可做什么。 + +## 2. 备选:二进制安装(无需 Node) + +当环境没有 Node / npm,或 Node 版本过低无法走 npm 时,使用二进制安装脚本。脚本安装 CLI 成功后会自动执行 `bl skill init`。 ```bash curl -fsSL https://bailian.aliyun.com/cli/install.sh | bash @@ -37,35 +67,9 @@ bl --version which bl # Windows: where.exe bl ``` -> CDN / GitHub Release 未就绪或下载失败时,回退到下方 npm 安装。 - -## 2. 备选:npm 安装(要求 **≥ 18.17.0**) - -1. `node -v` 确认版本。 -2. `npm -v` 确认可用(**仅允许 npm** 全局安装,不要用 pnpm/yarn)。 -3. 执行: - -```bash -npm install -g bailian-cli -``` - -4. 校验:`bl --version`。 - -安装 skills(CLI 内置,无需 Git / npx skills): - -```bash -bl skill init -``` - -**Supported:** `bl skill init` 一次装齐 registry 中全部 `bailian-*`(含共享协议 `bailian-protocol`)。 +若自动 skill 安装失败,再手动执行:`bl skill init`。 -**Advanced / 按需子集:** - -```bash -bl skill add --name bailian-protocol,bailian-gen -``` - -安装成功后,用中文简要说明已安装的 skills 及用户可做什么。 +> CDN / GitHub Release 未就绪或下载失败时,若本机已有合格 Node,回退到上方 npm 安装。 --- diff --git a/skills/bailian-protocol/assets/setup.md b/skills/bailian-protocol/assets/setup.md index 3c0d8407..9d93bb44 100644 --- a/skills/bailian-protocol/assets/setup.md +++ b/skills/bailian-protocol/assets/setup.md @@ -11,13 +11,33 @@ inspect config keys. Day-to-day command routing lives in the business skills ## Install +**prefer npm** (Node.js **≥ 18.17.0**); use the binary installer only when Node/npm is unavailable. + +### 1. Recommended: npm + ```bash -# Recommended binary install (no Node), or: npm install -g bailian-cli -curl -fsSL https://bailian.aliyun.com/cli/install.sh | bash -# Install the full bailian-* skill family (includes bailian-protocol) +# node -v ≥ 18.17.0; global install via npm only (do not use pnpm/yarn) +npm install -g bailian-cli bl skill init +``` + +### 2. Fallback: binary (no Node) + +When there is no usable Node/npm, or Node is too old for the npm path: + +```bash +curl -fsSL https://bailian.aliyun.com/cli/install.sh | bash +# The script runs bl skill init after installing the CLI; if that fails, run it manually +``` + +Windows PowerShell: `irm https://bailian.aliyun.com/cli/install.ps1 | iex` -# Advanced / subset (comma-separated names; include bailian-protocol when needed) +### Skills + +- **Supported:** `bl skill init` (installs every `bailian-*`, including `bailian-protocol`) +- **Advanced / subset** (include protocol when needed): + +```bash # bl skill add --name bailian-protocol,bailian-gen # bl skill add --name bailian-protocol,bailian-finetune # bl skill add --name bailian-protocol,bailian-managed-agent diff --git a/skills/bailian-protocol/assets/versioning.md b/skills/bailian-protocol/assets/versioning.md index fea70175..450dd545 100644 --- a/skills/bailian-protocol/assets/versioning.md +++ b/skills/bailian-protocol/assets/versioning.md @@ -35,13 +35,15 @@ ## Missing `bl` -If `bl --version` fails, install the CLI and skills: +If `bl --version` fails, install the CLI and skills (same order as [setup.md → Install](setup.md#install) / root `INSTALL.md`: **npm first**): ```bash -# Recommended — no Node required -curl -fsSL https://bailian.aliyun.com/cli/install.sh | bash -# Or: npm install -g bailian-cli +# Recommended — Node.js ≥ 18.17.0; npm only (do not use pnpm/yarn) +npm install -g bailian-cli bl skill init + +# Fallback — no usable Node/npm: +# curl -fsSL https://bailian.aliyun.com/cli/install.sh | bash ``` Do not install a single business skill alone — use `bl skill init` so `bailian-protocol` is present. From 77979406266e34552eeb8258537ff94ed287270c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=A5=E9=BA=92?= Date: Fri, 14 Aug 2026 17:14:23 +0800 Subject: [PATCH 7/7] docs(skills): clarify update install channel --- skills/bailian-protocol/assets/versioning.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skills/bailian-protocol/assets/versioning.md b/skills/bailian-protocol/assets/versioning.md index 450dd545..7b368289 100644 --- a/skills/bailian-protocol/assets/versioning.md +++ b/skills/bailian-protocol/assets/versioning.md @@ -26,7 +26,7 @@ 5. If the installed `bl` is **older** than the latest npm version, **STOP** the current task and **ask the user** (report skill version, installed CLI version, and npm latest): > A newer version of bl is available (current: X.Y.Z, latest: A.B.C). Upgrade before continuing? - **Do NOT auto-upgrade silently** — the user decides. - - If the user agrees: run `bl update`, then continue. (`bl update` upgrades `bailian-cli` via npm and, on success, also runs `bl skill init` to keep skills in lockstep across all agent apps.) + - If the user agrees: run `bl update`, then continue. (`bl update` uses the detected install channel and, on success, also runs `bl skill init` to keep skills in lockstep across all agent apps.) - If the user declines: continue with the current version and note it in the summary. - If `npm view` / `bl update` fails (offline, registry blocked, permission): continue with the current `bl` and tell the user it could not be updated. 6. Only proceed with the user's actual task after the above is resolved.