Skip to content

Commit a4ff0a7

Browse files
committed
Merge remote-tracking branch 'origin/main' into feat/auto-generate-skills
2 parents d35da96 + 006ea23 commit a4ff0a7

74 files changed

Lines changed: 4227 additions & 582 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/ci.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
concurrency:
9+
group: ci-${{ github.ref }}
10+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
11+
12+
jobs:
13+
check:
14+
name: lint + typecheck + test
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v6
18+
19+
- uses: pnpm/action-setup@v6
20+
21+
- uses: actions/setup-node@v6
22+
with:
23+
node-version: "22"
24+
cache: pnpm
25+
26+
- run: pnpm install --frozen-lockfile
27+
28+
- run: pnpm -r --filter "./packages/*" build
29+
30+
- run: pnpm run check
31+
32+
- run: pnpm test

.github/workflows/publish.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Publish
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
mode:
7+
description: "Publish mode"
8+
required: true
9+
type: choice
10+
options:
11+
- channel
12+
- stable
13+
channel:
14+
description: "dist-tag (channel mode only, e.g. mcp/plugin/advisor)"
15+
required: false
16+
type: string
17+
18+
concurrency:
19+
group: publish-${{ inputs.mode }}-${{ inputs.channel }}
20+
cancel-in-progress: false
21+
22+
jobs:
23+
publish-stable:
24+
if: inputs.mode == 'stable'
25+
name: publish stable to npm + tag
26+
runs-on: ubuntu-latest
27+
environment: production # Required Reviewers gate
28+
permissions:
29+
contents: write # push lightweight tag to origin
30+
id-token: write # OIDC for npm Trusted Publishing + provenance
31+
steps:
32+
- uses: actions/checkout@v6
33+
34+
- uses: pnpm/action-setup@v6
35+
36+
- uses: actions/setup-node@v6
37+
with:
38+
node-version: "24"
39+
cache: pnpm
40+
registry-url: "https://registry.npmjs.org/"
41+
42+
- name: Install gitleaks
43+
run: |
44+
set -euo pipefail
45+
GITLEAKS_VERSION=8.21.2
46+
curl -sSfL \
47+
"https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz" \
48+
| sudo tar -xz -C /usr/local/bin gitleaks
49+
gitleaks version
50+
51+
- run: pnpm install --frozen-lockfile
52+
53+
- name: publish-stable
54+
run: node tools/release/publish-stable.mjs
55+
56+
publish-channel:
57+
if: inputs.mode == 'channel'
58+
name: publish beta to npm
59+
runs-on: ubuntu-latest
60+
permissions:
61+
contents: read # no tag, no Release; just publish
62+
id-token: write # OIDC for npm Trusted Publishing + provenance
63+
steps:
64+
- uses: actions/checkout@v6
65+
66+
- uses: pnpm/action-setup@v6
67+
68+
- uses: actions/setup-node@v6
69+
with:
70+
node-version: "24"
71+
cache: pnpm
72+
registry-url: "https://registry.npmjs.org/"
73+
74+
- name: Install gitleaks
75+
run: |
76+
set -euo pipefail
77+
GITLEAKS_VERSION=8.21.2
78+
curl -sSfL \
79+
"https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz" \
80+
| sudo tar -xz -C /usr/local/bin gitleaks
81+
gitleaks version
82+
83+
- run: pnpm install --frozen-lockfile
84+
85+
- name: publish-channel
86+
run: node tools/release/publish-channel.mjs --channel "${{ inputs.channel }}"

AGENTS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Skill / 命令手册不再随 npm 包发布,改由独立的 `npx add skills` 机
2929

3030
非代码资产:
3131

32-
- `tools/release.mjs` — 发版自动化
32+
- `tools/release/` — 发版自动化(CI 驱动,见 `.github/workflows/publish.yml`
3333
- `tools/generate-reference.ts` — 从 `catalog.ts` 生成命令手册(临时输出到 `tools/generated/reference/`)
3434
- `README.md` / `README_CN.md` — npm 和 GitHub 主页
3535

@@ -55,7 +55,7 @@ Skill / 命令手册不再随 npm 包发布,改由独立的 `npx add skills` 机
5555
| URL / 渠道变更 | 控制台域名 / 文档站 / 追踪参数 | [docs/agents/url-change.md](docs/agents/url-change.md) |
5656
| 鉴权扩展 | 加 OAuth / SSO / 换 token 来源 | [docs/agents/auth-change.md](docs/agents/auth-change.md) |
5757
| 配置项扩展 | 新 env var 或 `~/.bailian/config.json` 字段 | [docs/agents/config-add.md](docs/agents/config-add.md) |
58-
| 发版前自检 | beta / rc / 正式发布到 npm | [docs/agents/release.md](docs/agents/release.md) |
58+
| 发布 | channel / stable 发布到 npm(CI 驱动) | [docs/agents/publish.md](docs/agents/publish.md) |
5959
| 工具链调整 | lint 规则 / 构建配置 / 依赖升级 | [docs/agents/lint-toolchain.md](docs/agents/lint-toolchain.md) |
6060

6161
如果当前任务无法对应任何场景,先按经验完成,然后**回来评估这是不是一类新场景** —— 是就新增一份 `docs/agents/<scenario>.md`,把清单沉淀下来。

CHANGELOG.md

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

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

9+
## [1.2.0] - 2026-06-05
10+
11+
### Added
12+
13+
- `bl mcp` command group: `bl mcp list` to list MCP servers, `bl mcp tools <server>` to inspect available tools, and `bl mcp call <server>.<tool>` to invoke a tool with `--arg k=v` or `--json`.
14+
- `bl advisor recommend` — describe your task in natural language and get intelligent model recommendations ranked by fit, with context-window, pricing, and capability details.
15+
16+
### Fixed
17+
18+
- Image/video watermark was always on regardless of config; now respects `bl config set watermark false`.
19+
- Paired flags (e.g. `--watermark` / `--no-watermark`) are properly mutually exclusive.
20+
- Null-value flag validation no longer crashes on missing optional arguments.
21+
- **Security**: credentials no longer leak to on-disk logs; file permissions tightened.
22+
- **Security**: `base_url` / `console_gateway_url` validated as real HTTP(S) URLs.
23+
- **Security**: script/JS `code` fields require a string literal (blocks untrusted-code RCE).
24+
- **Security**: URL path segments are percent-encoded; SSE buffer is bounded.
25+
- **Security**: pipeline planning, pointer traversal, and concurrency hardened.
26+
- MCP commands now handle auth _after_ arg validation and dry-run checks.
27+
28+
### Changed
29+
30+
- Flag default-value text is now unified and de-duplicated across all commands.
31+
- Illegal/unknown flag names surface a clear error instead of silently ignoring.
32+
933
## [1.1.3] - 2026-06-02
1034

1135
### Added

CHANGELOG_CN.md

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

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

9+
## [1.2.0] - 2026-06-05
10+
11+
### 新增
12+
13+
- `bl mcp` 命令组:`bl mcp list` 列出 MCP 服务器,`bl mcp tools <server>` 查看可用工具,`bl mcp call <server>.<tool>` 通过 `--arg k=v``--json` 调用工具。
14+
- `bl advisor recommend` — 用自然语言描述任务需求,智能推荐最合适的模型,展示上下文窗口、定价及能力详情。
15+
16+
### 修复
17+
18+
- 图片/视频水印始终开启的问题,现在正确遵守 `bl config set watermark false` 配置。
19+
- 成对 flag(如 `--watermark` / `--no-watermark`)现已正确互斥。
20+
- 可选参数为空时 flag 校验不再崩溃。
21+
- **安全**:凭据不再泄漏到磁盘日志,文件权限已收紧。
22+
- **安全**:校验 `base_url` / `console_gateway_url` 为合法 HTTP(S) URL。
23+
- **安全**:script/JS `code` 字段强制为字符串字面量(阻止不可信代码 RCE)。
24+
- **安全**:URL 路径段已百分号编码,SSE 缓冲区设上限。
25+
- **安全**:流水线规划、指针遍历及并发安全加固。
26+
- MCP 命令现在在参数校验和 dry-run 检查之后才处理鉴权。
27+
28+
### 变更
29+
30+
- 所有命令的 flag 默认值文案统一并去重。
31+
- 非法/未知 flag 名称现在会报明确错误,而非静默忽略。
32+
933
## [1.1.3] - 2026-06-02
1034

1135
### 新增

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ bailian-cli/
1818
│ ├── cli/ # `bailian-cli` — CLI entry, commands, UI
1919
│ └── core/ # `bailian-cli-core` — auth, HTTP, types
2020
├── docs/agents/ # Scenario-based maintenance guides
21-
├── tools/ # Release & reference generation
21+
├── tools/ # Release automation & reference generation
2222
├── AGENTS.md # Contract for AI agents
2323
└── README.md
2424
```

CONTRIBUTING_CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ bailian-cli/
1818
│ ├── cli/ # `bailian-cli` —— CLI 入口、命令、UI
1919
│ └── core/ # `bailian-cli-core` —— 鉴权、HTTP、类型
2020
├── docs/agents/ # 场景化维护文档
21-
├── tools/ # 发版与命令手册生成
21+
├── tools/ # 发版自动化与命令手册生成
2222
├── AGENTS.md # AI agent 维护契约
2323
└── README.md
2424
```

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ Equip your AI Agent out-of-the-box with these capabilities, composable across co
3232
- **Image & video understanding** — Qwen-VL: long-form video analysis, chart/document parsing, visual reasoning, multilingual OCR
3333
- **Knowledge base & memory** — Multimodal RAG retrieval and cross-session memory for personalized, coherent dialogue
3434
- **App calls** — Invoke agents and workflows already published on Aliyun Model Studio
35+
- **MCP integration** — Orchestrate Bailian MCP servers: list services, inspect tools, and invoke any tool directly from the terminal
3536
- **Web search** — Real-time internet retrieval for up-to-date, accurate answers
37+
- **Model recommendation** — Describe your scenario and get best-fit model suggestions; supports scoped search, model comparison, and alternative discovery
3638
- **Console capabilities** — Browse Bailian apps (`app list`) and check free-tier quota (`usage free`)
3739
- **Local file auto-upload** — Every URL parameter accepts a local path; uploaded to free temp storage with 48-hour validity
3840

@@ -97,6 +99,12 @@ bl image generate --prompt "A cat in a spacesuit" --out-dir ./images/
9799
# Generate a video from local image
98100
bl video generate --image ./cat.png --prompt "Make the cat move" --download cat.mp4
99101

102+
# Model recommendation — find the best model for your use case
103+
bl advisor recommend --message "I need a visual-understanding chatbot"
104+
105+
# Compare specific models
106+
bl advisor recommend --message "qwen-max vs deepseek-v3 for code generation"
107+
100108
# Browser login (required for console capability commands)
101109
bl auth login --console
102110

README_CN.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ _专为 AI Agent 打造,每个命令均可作为结构化工具调用。_
3232
- **图像与视频理解** — Qwen-VL:长视频解析、复杂图表与文档识别、视觉推理、多语种 OCR
3333
- **知识库与记忆库** — 多模态 RAG 检索 + 跨会话记忆,提供个性化连贯对话体验
3434
- **应用调用** — 调用已发布在阿里云百炼平台上的智能体与工作流应用
35+
- **MCP 集成** — 统一调度百炼 MCP 服务:列出服务、查看工具、直接在终端调用任意工具
3536
- **联网搜索** — 实时互联网信息检索,提升回答准确性及时效性
37+
- **模型推荐** — 描述你的场景,智能推荐最适合的模型;支持限定范围搜索、模型对比和替代发现
3638
- **控制台能力** — 浏览百炼应用(`app list`),查询模型免费额度(`usage free`
3739
- **本地文件自动上传** — 所有 URL 参数同时支持本地路径,免费临时存储 48 小时
3840

@@ -92,6 +94,12 @@ bl image generate --prompt "一只穿太空服的猫在火星上" --out-dir ./im
9294
# 图生视频(本地文件自动上传)
9395
bl video generate --image ./cat.png --prompt "让画面中的猫动起来" --download cat.mp4
9496

97+
# 模型推荐 — 根据场景推荐最适合的模型
98+
bl advisor recommend --message "我要做一个能理解图片的客服机器人"
99+
100+
# 对比特定模型
101+
bl advisor recommend --message "qwen-max 和 deepseek-v3 哪个更适合做代码生成"
102+
95103
# 浏览器登录(控制台能力相关命令需要)
96104
bl auth login --console
97105

docs/agents/changelog-write.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,11 @@ git show <commit> --stat
176176
| 版本号 bump commit 自身的 README 改动算进上个版本 | 重复 / 错位 |
177177
| 中英两份不同步 | 文档可信度直接崩,等同于撒谎 |
178178

179-
## release.md 的边界
179+
## publish.md 的边界
180180

181-
| 文档 | 管什么 |
182-
| ------------------------ | ---------------------------------------------------- |
183-
| [release.md](release.md) | 发版前自检:版本号 / 包内容 / 安全扫描 / publish 流程 |
184-
| 本文档 | 发版后写说明:面向用户的 release notes |
181+
| 文档 | 管什么 |
182+
| ------------------------ | --------------------------------------------- |
183+
| [publish.md](publish.md) | 发布流程:自检 / 构建 / npm publish(CI 驱动) |
184+
| 本文档 | 发版后写说明:面向用户的 release notes |
185185

186-
两者顺序:`release.md` → npm publish → 本文档(更新 `CHANGELOG.md` + `CHANGELOG_CN.md`)→ 推到 GitHub。
186+
两者顺序:`publish.md` → npm publish → 本文档(更新 `CHANGELOG.md` + `CHANGELOG_CN.md`)→ 推到 GitHub。

0 commit comments

Comments
 (0)