Skip to content

Commit d64ba09

Browse files
committed
merge: merged main to current branch
2 parents 8cdd54c + 564e21d commit d64ba09

52 files changed

Lines changed: 3079 additions & 206 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/publish.yml

Lines changed: 52 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ on:
1818
- channel
1919
- stable
2020
channel:
21-
description: "dist-tag (channel mode only, e.g. mcp/plugin/advisor)"
21+
description: "Required when mode=channel. npm dist-tag only (lowercase, digits, dashes), e.g. mcp / plugin / sync-release. bailian-cli binary CDN always overwrites sync-release.json; knowledge-studio-cli is npm-only."
2222
required: false
2323
type: string
2424

@@ -29,11 +29,11 @@ concurrency:
2929
jobs:
3030
publish-stable:
3131
if: inputs.mode == 'stable'
32-
name: publish stable (${{ inputs.package }}) to npm + tag
32+
name: publish stable (${{ inputs.package }}) to npm + binary + tag
3333
runs-on: ubuntu-latest
3434
environment: production # Required Reviewers gate
3535
permissions:
36-
contents: write # push lightweight tag to origin
36+
contents: write # push tag + create GitHub Release with binary assets
3737
id-token: write # OIDC for npm Trusted Publishing + provenance
3838
steps:
3939
- uses: actions/checkout@v6
@@ -55,19 +55,47 @@ jobs:
5555
| sudo tar -xz -C /usr/local/bin gitleaks
5656
gitleaks version
5757
58+
- name: Ensure zip (per-platform binary archives)
59+
run: sudo apt-get update && sudo apt-get install -y zip
60+
5861
- run: pnpm install --frozen-lockfile
5962

63+
# Binary compile uses `bun build --compile` CLI (not Bun.build API).
64+
# Keep this pin in sync with any local smoke tests of binary-compile.mjs.
65+
- uses: oven-sh/setup-bun@v2
66+
with:
67+
bun-version: "1.2.19"
68+
6069
- name: publish-stable
70+
env:
71+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72+
# OSS release channel runs fully in CI: upload + reconcile + manifest.json.
73+
# All values come from repo Settings → Secrets — no OSS defaults live in
74+
# code. Leave AK/SK unset to skip the OSS channel; once enabled,
75+
# bucket/region/prefix are required.
76+
BAILIAN_OSS_AK: ${{ secrets.BAILIAN_OSS_AK }}
77+
BAILIAN_OSS_SK: ${{ secrets.BAILIAN_OSS_SK }}
78+
BAILIAN_OSS_BUCKET: ${{ secrets.BAILIAN_OSS_BUCKET }}
79+
BAILIAN_OSS_REGION: ${{ secrets.BAILIAN_OSS_REGION }}
80+
BAILIAN_OSS_ENDPOINT: ${{ secrets.BAILIAN_OSS_ENDPOINT }}
81+
BAILIAN_RELEASE_PREFIX: ${{ secrets.BAILIAN_RELEASE_PREFIX }}
82+
BAILIAN_STATIC_PREFIX: ${{ secrets.BAILIAN_STATIC_PREFIX }}
6183
run: node tools/release/publish-stable.mjs ${{ inputs.package == 'knowledge-studio-cli' && '--knowledge' || '' }}
6284

6385
publish-channel:
6486
if: inputs.mode == 'channel'
65-
name: publish channel (${{ inputs.package }}) to npm
87+
name: publish channel (${{ inputs.package }}) to npm + binary
6688
runs-on: ubuntu-latest
6789
permissions:
68-
contents: read # no tag, no Release; just publish
90+
contents: write # create prerelease GitHub Release with binary assets
6991
id-token: write # OIDC for npm Trusted Publishing + provenance
7092
steps:
93+
- name: Require channel input
94+
if: ${{ inputs.channel == '' }}
95+
run: |
96+
echo "::error::mode=channel requires the workflow input \"channel\" (npm dist-tag, e.g. mcp / plugin / sync-release). Leave mode=stable if you do not need a dist-tag."
97+
exit 1
98+
7199
- uses: actions/checkout@v6
72100

73101
- uses: pnpm/action-setup@v6
@@ -87,7 +115,26 @@ jobs:
87115
| sudo tar -xz -C /usr/local/bin gitleaks
88116
gitleaks version
89117
118+
- name: Ensure zip (per-platform binary archives)
119+
run: sudo apt-get update && sudo apt-get install -y zip
120+
90121
- run: pnpm install --frozen-lockfile
91122

123+
# Binary compile uses `bun build --compile` CLI (not Bun.build API).
124+
# Keep this pin in sync with any local smoke tests of binary-compile.mjs.
125+
- uses: oven-sh/setup-bun@v2
126+
with:
127+
bun-version: "1.2.19"
128+
92129
- name: publish-channel
130+
env:
131+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
132+
# OSS release channel — same Settings-injected values as stable.
133+
BAILIAN_OSS_AK: ${{ secrets.BAILIAN_OSS_AK }}
134+
BAILIAN_OSS_SK: ${{ secrets.BAILIAN_OSS_SK }}
135+
BAILIAN_OSS_BUCKET: ${{ secrets.BAILIAN_OSS_BUCKET }}
136+
BAILIAN_OSS_REGION: ${{ secrets.BAILIAN_OSS_REGION }}
137+
BAILIAN_OSS_ENDPOINT: ${{ secrets.BAILIAN_OSS_ENDPOINT }}
138+
BAILIAN_RELEASE_PREFIX: ${{ secrets.BAILIAN_RELEASE_PREFIX }}
139+
BAILIAN_STATIC_PREFIX: ${{ secrets.BAILIAN_STATIC_PREFIX }}
93140
run: node tools/release/publish-channel.mjs ${{ inputs.package == 'knowledge-studio-cli' && '--knowledge' || '' }} --channel "${{ inputs.channel }}"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ lerna-debug.log*
1010
# Dependencies & build output
1111
node_modules
1212
dist
13+
dist-bin
1314
dist-ssr
1415
tools/generated
1516
.node-version

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
66

77
[中文版](CHANGELOG.zh.md) · [README](README.md) · [Contributing](CONTRIBUTING.md)
88

9+
## [1.14.0] - 2026-08-04
10+
11+
### Added
12+
13+
- **Standalone installation without Node.js** — binary packages are available for macOS on Apple Silicon and Intel, Linux x64, and Windows x64; npm installation remains supported.
14+
- **Exact-version updates** — binary and npm installations can use `bl update --to <version>` to update or switch to a specified version.
15+
16+
### Changed
17+
18+
- **Binary self-updates** — binary installations now check and download updates through a dedicated release channel. `bl update` no longer replaces the running executable, and the next invocation automatically uses the new version.
19+
920
## [1.13.1] - 2026-08-03
1021

1122
### Changed

CHANGELOG.zh.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@
66

77
[English](CHANGELOG.md) · [README](README.zh.md) · [参与贡献](CONTRIBUTING.zh.md)
88

9+
## [1.14.0] - 2026-08-04
10+
11+
### 新增
12+
13+
- **免 Node.js 的二进制安装** — 支持 macOS Apple Silicon / Intel、Linux x64 和 Windows x64;npm 安装方式继续保留。
14+
- **指定版本更新** — 二进制和 npm 安装均可通过 `bl update --to <version>` 更新或切换到指定版本。
15+
16+
### 变更
17+
18+
- **二进制自更新** — 二进制安装现在通过独立的发布通道检查和下载更新;执行 `bl update` 时不会覆盖正在运行的程序,下次运行自动使用新版本。
19+
920
## [1.13.1] - 2026-08-03
1021

1122
### 变更

INSTALL.md

Lines changed: 44 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,57 @@
11
# 阿里云百炼CLI 安装说明(供 AI Agent 阅读)
22

3-
本文档面向 **AI Agent**:按下列步骤为用户安装并校验 **阿里云百炼CLI**npm 包名 `bailian-cli`命令 `bl` / `bailian`)。用户通常通过 **npm 全局安装** 使用,**无需**访问本仓库源码。不要臆造版本号或路径;以用户环境为准。
3+
本文档面向 **AI Agent**:按下列步骤为用户安装并校验 **阿里云百炼CLI**(命令 `bl` / `bailian`)。**优先**使用二进制一键安装(无需 Node);若环境已有 Node / 需要 Command Pack,再用 npm。不要臆造版本号或路径;以用户环境为准。
44

5-
## 1. 安装前检查
5+
## 1. 推荐:二进制安装(无需 Node)
66

7-
**原则**:先执行检查;若 **Node / 包管理器 / 网络** 任一不满足下文要求,Agent 应 **在本机终端内主动完成安装或配置**(例如升级 Node、切换镜像、配置 `npm` 代理等),再继续 `bailian-cli` 安装。仅在无权限或环境无法自动化时,再向用户说明原因并请其配合。
7+
```bash
8+
curl -fsSL https://bailian.aliyun.com/cli/install.sh | bash
9+
```
810

9-
1. **Node.js**
10-
- 要求 **≥ 18.17.0**,执行 `node -v` 确认。
11-
- 未安装或版本不足:由 Agent 自行安装或升级 Node。
11+
可选:正式安装读 CDN 上的 `manifest.json`。预发 / channel 验证一律读 `sync-release.json`(bailian-cli 的 channel 发版都会覆盖它):
1212

13-
2. **npm****唯一**允许的包管理器)
14-
- 执行 `npm -v` 确认可用。
15-
- 未安装或不可用:由 Agent **安装或修复 npm**(不要改用 pnpm/yarn 装 `bailian-cli`),再执行 `npm install -g bailian-cli`
16-
- 即使本机已安装 `pnpm``yarn` 等,**也仅用于其它项目**;装 `bailian-cli` 时仍必须用 `npm`
13+
```bash
14+
curl -fsSL https://bailian.aliyun.com/cli/install.sh | bash -s -- --channel sync-release
15+
```
1716

18-
3. **网络**
19-
- 需能访问 npm registry(默认 **registry.npmjs.org**)。
20-
- 不可达:由 Agent 自行配置镜像或代理后重试。
17+
也可用 `--version` / `--cdn`(或环境变量 `BAILIAN_CLI_CDN`)覆盖资源根。安装脚本本身不在本仓库维护。
2118

22-
---
19+
Windows PowerShell:
20+
21+
```powershell
22+
# 正式(manifest.json)
23+
irm https://bailian.aliyun.com/cli/install.ps1 | iex
24+
25+
# channel / 预发验证(sync-release.json)
26+
$env:BAILIAN_CHANNEL = 'sync-release'; irm 'https://bailian.aliyun.com/cli/install.ps1' | iex
27+
```
2328

24-
## 2. 安装 CLI 与 Skills
29+
带其它参时先落盘再执行(`irm | iex` 不便传参),或使用仓外静态资源文档中的预发入口。
2530

26-
**仅允许以下命令**(不要用 `pnpm add -g``yarn global add` 等)。按顺序执行,上一步通过后再进行下一步
31+
二进制安装布局为 `versions/<ver>/` + `current` 指针;`bl update` 只切换指针并清理旧版本(保留当前与上一版)。更新进程退出后,下次执行 `bl` 即使用新版本(无需「重启应用」)
2732

28-
**2.1 安装 CLI**
33+
校验:
2934

3035
```bash
31-
npm install -g bailian-cli
36+
bl --version
37+
which bl # Windows: where.exe bl
3238
```
3339

34-
安装成功后,应能在 PATH 中找到:
40+
> CDN / GitHub Release 未就绪或下载失败时,回退到下方 npm 安装。
3541
36-
- `bl`(短别名)
37-
- `bailian`(全名)
42+
## 2. 备选:npm 安装(要求 **≥ 18.17.0**
3843

39-
**校验**(Agent 应执行并检查退出码与输出):
44+
1. `node -v` 确认版本。
45+
2. `npm -v` 确认可用(**仅允许 npm** 全局安装,不要用 pnpm/yarn)。
46+
3. 执行:
4047

4148
```bash
42-
bl --version
43-
which bl # Windows 可用 where bl
49+
npm install -g bailian-cli
4450
```
4551

46-
`command not found`:检查全局 bin 是否在 PATH(`npm config get prefix`,其下 `bin` 目录应加入 PATH)。
47-
48-
**2.2 安装 Skills**
52+
4. 校验:`bl --version`
4953

50-
CLI 校验通过后,在本机终端执行
54+
可选 skills(与 CLI 本体无关,按需)
5155

5256
```bash
5357
npx skills add modelstudioai/cli --all -g
@@ -70,39 +74,14 @@ npx skills add modelstudioai/cli -g -s bailian-protocol -s bailian-gen
7074

7175
### 推荐:浏览器登录(控制台会话)
7276

73-
适用于本机交互式安装,无需用户手动复制 API Key:
74-
7577
1. 执行 `bl auth status --output json`,判断是否已配置。
76-
2. 若未配置,在**用户本机终端**执行 `bl auth login --console`;命令会拉起浏览器完成阿里云控制台登录授权
78+
2. 若未配置,在**用户本机终端**执行 `bl auth login --console`
7779
3. 登录成功后执行 `bl auth status --output json` 确认;汇报时只使用 masked 字段,**禁止**回显完整凭据。
7880

79-
> 此方式同时打通 `app list``usage free` 等控制台能力,并自动配置 API Key 调用所需的鉴权信息。
81+
### 备选:API Key / Token Plan
8082

81-
### 备选一:由 Agent 引导用户输入普通 API Key 后登录
82-
83-
适用于无法拉起浏览器的对话式安装(远程 SSH、CI 调试、纯终端环境等):
84-
85-
- 获取入口:[百炼控制台 API Key](https://bailian.console.aliyun.com/cn-beijing/?tab=app#/api-key)
86-
87-
1. 执行 `bl auth status --output json`,判断是否已配置。
88-
2. 若未配置或后续 API 校验失败,**请用户粘贴 API Key**(可说明从上述控制台复制;勿要求用户发到公开渠道)。
89-
3. 用户提供了 Key 之后,在**用户本机终端**执行(Agent 用终端工具跑,勿把 Key 写进回复正文):`bl auth login --api-key <用户提供的_Key>`
90-
4. 登录成功后执行 `bl auth status --output json` 确认;汇报时只使用 masked 字段,**禁止**回显完整 Key。
91-
92-
### 备选二:使用 Token Plan API Key
93-
94-
- 获取入口:[Token Plan 订阅详情](https://bailian.console.aliyun.com/cn-beijing?tab=plan#/efm/subscription/overview)
95-
96-
1. 请用户从订阅详情页获取或复制 Token Plan API Key,勿要求用户发到公开渠道。
97-
2. 在用户本机终端执行:`bl auth login --config token-plan --api-key <用户提供的_Key>`
98-
3. `token-plan` Profile 已内置默认 Base URL;登录命令会先测试 Key,通过后才保存并激活该 Profile,无需另行配置或重复测试。
99-
4. 执行 `bl auth status --config token-plan --output json` 确认;汇报时只使用 masked 字段。
100-
101-
### 其他方式
102-
103-
- **环境变量**(不落盘到配置文件):在 shell 中配置 API Key 环境变量;变量名见 `bl auth status --help`,勿在对话中向用户解释底层命名。
104-
- **写入配置文件**(持久化,与 `auth login` 落盘相同):`bl config set --key api_key --value <key>``--key api-key` 亦可)。**不会**`bl auth login --api-key` 那样先校验 Key 是否可用;Agent 引导安装时仍**优先**`auth login`
105-
- **命令行临时传入**:需要 API Key 的 `bl` 子命令可在**当次**执行附加全局 `--api-key <key>`,仅本次生效、不落盘(例:`bl text chat --api-key sk-xxx --message "你好"`)。与上文持久化方式不是同一用途。
83+
- 普通 Key:`bl auth login --api-key <Key>`
84+
- Token Plan:`bl auth login --config token-plan --api-key <Key>`
10685

10786
### Agent 安全约束
10887

@@ -113,22 +92,16 @@ npx skills add modelstudioai/cli -g -s bailian-protocol -s bailian-gen
11392

11493
## 4. 配置验证
11594

116-
API Key 登录命令本身已经完成可用性测试,通过后只需确认配置状态:
117-
11895
```bash
11996
bl auth status --output json
12097
```
12198

122-
无需再执行重复的模型调用测试。若登录失败,根据 stderr / JSON 中的 `hint``message` 排查(网络、Key 无效、`base_url` 等)。DashScope 端点:使用 `--base-url` / `bl config set --key base_url` / `DASHSCOPE_BASE_URL`,默认中国大陆 `https://dashscope.aliyuncs.com`
123-
124-
---
125-
126-
## 5. 常见问题(Agent 排障清单)
99+
## 5. 常见问题
127100

128-
| 现象 | 可能原因 | 建议动作 |
129-
| ----------------------- | -------------------- | --------------------------------------------------------------- |
130-
| `bl: command not found` | 全局 bin 不在 PATH | 检查 `npm prefix -g` 与 PATH |
131-
| 安装报错 engines | Node 版本过低 | 升级到 ≥ 18.17 |
132-
| 401 / 鉴权失败 | 未 login 或 Key 无效 | 按 Key 类型重新执行普通或 Token Plan 登录命令 |
133-
| 企业网络无法访问 npm | 代理 / 镜像 | 配置 registry 或代理后再装 |
134-
| 本机只有 pnpm、没有 npm | Agent 误用 pnpm 安装 | 先装/修好 **npm**,再用 `npm install -g bailian-cli`;勿用 pnpm |
101+
| 现象 | 可能原因 | 建议动作 |
102+
| ------------------------ | ---------------------------- | ------------------------------------------------ |
103+
| `bl: command not found` | bin 不在 PATH | 检查 `~/.local/bin``npm prefix -g` |
104+
| curl 安装 404 | GitHub Release 资产未上传 | 改用 `npm install -g bailian-cli` |
105+
| Windows `bl update` 失败 | 旧布局 / 文件锁 / 网络 | 重跑 `irm .../install.ps1 \| iex` 迁移布局后重试 |
106+
| `plugin` 需要 npm | 二进制安装无本机 npm | 安装 Node,或改用 npm 版 CLI |
107+
| 安装报错 engines | Node 版本过低(仅 npm 路径) | 升级到 ≥ 18.17.0 |

README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,20 @@ No timeline scrubbing. No frame-by-frame editing. Just one sentence → one vide
7777
## Installation
7878

7979
```bash
80+
# Recommended — no Node required
81+
curl -fsSL https://bailian.aliyun.com/cli/install.sh | bash
82+
83+
# Windows (PowerShell)
84+
irm https://bailian.aliyun.com/cli/install.ps1 | iex
85+
86+
# Node users / developers (Node.js >= 18.17)
8087
npm install -g bailian-cli
81-
# Recommended: full bailian-* skill family (includes bailian-protocol)
88+
89+
# Agent skills
8290
npx skills add modelstudioai/cli --all -g
8391
```
8492

85-
> Supported install is `--all -g`. The skills CLI does **not** auto-install skill dependencies. Subset `-s` installs are advanced / not recommended; if you use them, you must include `bailian-protocol` yourself (e.g. `-s bailian-protocol -s bailian-gen`).
86-
87-
> Requires Node.js >= 18.17.
93+
> Binary install does not require Node.js. `npm install -g` remains fully supported.
8894
8995
## Quick Start
9096

@@ -213,8 +219,9 @@ bl config set --key base_url --value https://dashscope-us.aliyuncs.com
213219
bl config set --key default_text_model --value qwen-turbo
214220
bl config set --key timeout --value 600
215221

216-
# Self-update to latest version
222+
# Self-update to latest or a specific version
217223
bl update
224+
bl update --to 0.1.14
218225
```
219226

220227
Config file location: `~/.bailian/config.json`

README.zh.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,20 @@ _专为 AI Agent 打造,每个命令均可作为结构化工具调用。_
7575
## 安装
7676

7777
```bash
78+
# 推荐 — 无需本机 Node.js
79+
curl -fsSL https://bailian.aliyun.com/cli/install.sh | bash
80+
81+
# Windows(PowerShell)
82+
irm https://bailian.aliyun.com/cli/install.ps1 | iex
83+
84+
# Node 用户 / 开发者(需要 Node.js >= 18.17)
7885
npm install -g bailian-cli
79-
# 推荐:安装完整 bailian-* skill 家族(含 bailian-protocol)
86+
87+
# Agent skills
8088
npx skills add modelstudioai/cli --all -g
8189
```
8290

83-
> 官方支持路径为 `--all -g``npx skills` **不会**按 metadata 自动安装依赖。子集 `-s` 为高级用法 / 不推荐;若坚持子集,须自行带上 `bailian-protocol`(例如 `-s bailian-protocol -s bailian-gen`)。
84-
85-
> 需要预先安装 Node.js >= 18.17。
91+
> 二进制安装不依赖 Node.js。`npm install -g` 长期保留。
8692
8793
## 快速开始
8894

@@ -213,6 +219,9 @@ bl config set --key timeout --value 600
213219

214220
# 自更新到最新版本
215221
bl update
222+
223+
# 安装指定版本
224+
bl update --to 0.1.14
216225
```
217226

218227
配置文件位置:`~/.bailian/config.json`

0 commit comments

Comments
 (0)