Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/agents/branch-merge-review.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -57,7 +57,7 @@ git diff --name-only <base>...<head>
- [ ] **新命令 / 新 flag** 已同步到用户面文档:
- [README.md](README.md) + [README.zh.md](README.zh.md)(中英文都要,常漏 `_CN`)
- (SKILL.md 已迁出本仓库,由 `npx add skills` 机制独立维护,不在本仓库 review 范围)
- [ ] **`bl <cmd> --help`** 文案完整:`description` / `examples` / `apiDocs` 都填了
- [ ] **`bl <cmd> --help`** 文案完整:`description` / `examples` 都填了
- [ ] **demo / quickstart**:用户可调用的新命令至少有一个示例
- [ ] **行为变化的老命令**:在 commit message / CHANGELOG 注明用户感知的差异
- [ ] **错误信息 / 提示文案**:面向用户的字符串通顺、双语(项目主体是中文场景)
Expand Down
3 changes: 1 addition & 2 deletions docs/agents/command-add-remove.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,7 +27,7 @@
命令元数据以 **`catalog.ts` 为单一登记处**;`registry.ts` 只负责解析与打印 help,不再内嵌命令表或手写 Resources 列表。

```
commands/<...>.ts defineCommand({ name, description, usage, options, examples, apiDocs?, run })
commands/<...>.ts defineCommand({ name, description, usage, options, examples, run })
commands/catalog.ts export const commands: Record<string, Command>
Expand All@@ -53,7 +53,6 @@ registry.ts main.ts tools/generate-reference.ts export-schema.ts
- 增删 `import xxx from "./.../xxx.ts"`
- 在 `export const commands` 里增删 `"<group> <action>": xxx`(key 与 `defineCommand({ name })` 一致)
- [ ] **不要**在 `registry.ts` 里重复登记命令(已从 catalog 读取)
- [ ] 命令需在 `bl help` / `reference/` 展示 API 文档链接时,在 `defineCommand` 里设 `apiDocs`(相对路径);help 与 reference 均从此字段生成
- [ ] 如果命令需要鉴权之外的特殊路径,看 `packages/cli/src/main.ts` 的 `NO_AUTH_SETUP`
- [ ] **`config/export-schema.ts`**: 若新命令不适合作为 agent tool,评估是否加入 `SKIP_PREFIXES`;该文件在 `run()` 内 `import("../catalog.ts")`,勿顶层 import catalog 以免循环依赖

Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/file/upload.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,6 @@ import { emitResult, emitBare } from "../../output/output.ts";
export default defineCommand({
name: "file upload",
description: "Upload a local file to DashScope temporary storage (48h)",
apiDocs: "/developer-reference/get-temporary-file-url",
usage: "bl file upload --file <path> --model <model>",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/image/edit.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -32,7 +32,6 @@ import {
export default defineCommand({
name: "image edit",
description: "Edit an existing image with text instructions (Qwen-Image)",
apiDocs: "/developer-reference/qwen-image-edit-api",
usage: "bl image edit --image <url> --prompt <text> [flags]",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/image/generate.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -43,7 +43,6 @@ function isSyncModel(model: string): boolean {
export default defineCommand({
name: "image generate",
description: "Generate images (Qwen-Image / wan2.x)",
apiDocs: "/best-practice/wanx/text-to-image",
usage: "bl image generate --prompt <text> [flags]",
options: [
{ flag: "--prompt <text>", description: "Image description", required: true },
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/omni/chat.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -44,7 +44,6 @@ function buildWavHeader(dataLength: number): Buffer {
export default defineCommand({
name: "omni",
description: "Multimodal chat with text + audio output (Qwen-Omni)",
apiDocs: "/model-studio/qwen-omni",
usage: "bl omni --message <text> [flags]",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/speech/recognize.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,6 @@ import { emitResult, emitBare } from "../../output/output.ts";
export default defineCommand({
name: "speech recognize",
description: "Recognize speech from audio files (FunAudio-ASR)",
apiDocs: "/developer-reference/recording-file-recognition",
usage: "bl speech recognize --url <audio-url> [flags]",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/speech/synthesize.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -144,7 +144,6 @@ function printVoiceList(model: string): void {
export default defineCommand({
name: "speech synthesize",
description: "Synthesize speech from text (CosyVoice TTS)",
apiDocs: "/developer-reference/cosyvoice",
usage: "bl speech synthesize --text <text> [flags]",
options: [
{ flag: "--text <text>", description: "Text to synthesize into speech", required: true },
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/text/chat.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -70,7 +70,6 @@ function parseMessages(flags: GlobalFlags): ParsedMessages {
export default defineCommand({
name: "text chat",
description: "Send a chat completion (OpenAI compatible, DashScope)",
apiDocs: "/compatibility-of-openai-with-dashscope",
usage: "bl text chat --message <text> [flags]",
options: [
{ flag: "--model <model>", description: "Model ID (default: qwen3.7-max)" },
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/video/edit.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,7 +31,6 @@ export default defineCommand({
name: "video edit",
description:
"Edit a video with happyhorse-1.0-video-edit (style transfer, object replacement, etc.)",
apiDocs: "/best-practice/wanx/video-edit",
usage: "bl video edit --video <url> --prompt <text> [flags]",
options: [
{ flag: "--model <model>", description: "Model ID (default: happyhorse-1.0-video-edit)" },
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/video/generate.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -44,7 +44,6 @@ export default defineCommand({
name: "video generate",
description:
"Generate a video from text or image (happyhorse-1.0-t2v / happyhorse-1.0-i2v / wan2.6-t2v)",
apiDocs: "/best-practice/wanx/text-to-video",
usage: "bl video generate --prompt <text> [--image <url>] [flags]",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/video/ref.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,7 +31,6 @@ export default defineCommand({
name: "video ref",
description:
"Reference-to-video generation (happyhorse-1.0-r2v / wan2.6-r2v): multi-subject, multi-shot with voice",
apiDocs: "/best-practice/wanx/video-reference",
usage: "bl video ref --prompt <text> --image <url>... [--ref-video <url>...] [flags]",
options: [
{ flag: "--model <model>", description: "Model ID (default: happyhorse-1.0-r2v)" },
Expand Down
24 changes: 3 additions & 21 deletions packages/cli/src/main.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,11 +3,9 @@ import { registry } from "./registry.ts";
import {
GLOBAL_OPTIONS,
loadConfig,
readConfigFile,
resolveCredential,
trackCommandExecution,
flushTelemetry,
type Region,
} from "bailian-cli-core";
import { ensureApiKey } from "./utils/ensure-key.ts";
import { handleError } from "./error-handler.ts";
Expand All@@ -22,13 +20,7 @@ import {
} from "./utils/command-help.ts";

registerCommandHelpPrinter((commandPath, out) => {
const a = process.argv.slice(2);
const ri = a.indexOf("--region");
const region = ((ri >= 0 && a[ri + 1]) ||
process.env.DASHSCOPE_REGION ||
readConfigFile().region ||
"cn") as Region;
registry.printHelp(commandPath, out, region);
registry.printHelp(commandPath, out);
});

// 优雅处理 Ctrl+C
Expand DownExpand Up@@ -84,12 +76,7 @@ async function main() {
const commandPath = scanCommandPath(argv, GLOBAL_OPTIONS);

if (argv.includes("--help") || argv.includes("-h")) {
const ri = argv.indexOf("--region");
const region = ((ri >= 0 && argv[ri + 1]) ||
process.env.DASHSCOPE_REGION ||
readConfigFile().region ||
"cn") as Region;
registry.printHelp(commandPath, process.stderr, region);
registry.printHelp(commandPath, process.stderr);
process.exit(0);
}

Expand All@@ -115,12 +102,7 @@ async function main() {

// 组路径(例如 `bl speech` 未接子命令):展示帮助后干净退出
if (registry.isGroupPath(commandPath)) {
const ri = argv.indexOf("--region");
const region = ((ri >= 0 && argv[ri + 1]) ||
process.env.DASHSCOPE_REGION ||
readConfigFile().region ||
"cn") as Region;
registry.printHelp(commandPath, process.stderr, region);
registry.printHelp(commandPath, process.stderr);
process.exit(0);
}

Expand Down
15 changes: 4 additions & 11 deletions packages/cli/src/registry.ts
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
import type { Command } from "bailian-cli-core";
import { BailianError } from "bailian-cli-core";
import { ExitCode } from "bailian-cli-core";
import { DOCS_HOSTS, GLOBAL_OPTIONS, type Region } from "bailian-cli-core";
import { GLOBAL_OPTIONS } from "bailian-cli-core";
import { commands } from "./commands/catalog.ts";

export type { Command, OptionDef } from "bailian-cli-core";
Expand DownExpand Up@@ -133,11 +133,7 @@ class CommandRegistry {
out.isTTY ? `\x1b[38;2;59;130;246m${s}\x1b[0m` : s;
private dim = (s: string, out: NodeJS.WriteStream) => (out.isTTY ? `\x1b[2m${s}\x1b[0m` : s);

printHelp(
commandPath: string[],
out: NodeJS.WriteStream = process.stdout,
region: Region = "cn",
): void {
printHelp(commandPath: string[], out: NodeJS.WriteStream = process.stdout): void {
if (commandPath.length === 0) {
this.printRootHelp(out);
return;
Expand All@@ -154,7 +150,7 @@ class CommandRegistry {
}

if (node.command) {
this.printCommandHelp(node.command, out, region);
this.printCommandHelp(node.command, out);
return;
}

Expand DownExpand Up@@ -233,7 +229,7 @@ ${b("Getting Help:")}
`);
}

private printCommandHelp(cmd: Command, out: NodeJS.WriteStream, region: Region = "cn"): void {
private printCommandHelp(cmd: Command, out: NodeJS.WriteStream): void {
const b = (s: string) => this.bold(s, out);
const a = (s: string) => this.accent(s, out);
const d = (s: string) => this.dim(s, out);
Expand All@@ -253,9 +249,6 @@ ${b("Getting Help:")}
out.write(` ${d(ex)}\n`);
}
}
if (cmd.apiDocs) {
out.write(`\n${b("API Reference:")} ${d(DOCS_HOSTS[region] + cmd.apiDocs)}\n`);
}
out.write(
`\n${d("Global flags (--api-key, --output, --quiet, etc.) are always available.")}\n`,
);
Expand Down
3 changes: 0 additions & 3 deletions packages/core/src/types/command.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,7 +14,6 @@ export interface Command {
usage?: string;
options?: OptionDef[];
examples?: string[];
apiDocs?: string;
execute: (config: Config, flags: GlobalFlags) => Promise<void>;
}

Expand All@@ -24,7 +23,6 @@ export interface CommandSpec {
usage?: string;
options?: OptionDef[];
examples?: string[];
apiDocs?: string;
run: (config: Config, flags: GlobalFlags) => Promise<void>;
}

Expand All@@ -35,7 +33,6 @@ export function defineCommand(spec: CommandSpec): Command {
usage: spec.usage,
options: spec.options,
examples: spec.examples,
apiDocs: spec.apiDocs,
execute: (config, flags) => spec.run(config, flags),
};
}
Expand Down
11 changes: 5 additions & 6 deletions skills/bailian-cli/reference/file.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,12 +15,11 @@ Index: [index.md](index.md)

### `bl file upload`

| Field | Value |
| --------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| **Name** | `file upload` |
| **Description** | Upload a local file to DashScope temporary storage (48h) |
| **Usage** | `bl file upload --file <path> --model <model>` |
| **API docs** | [/developer-reference/get-temporary-file-url](https://help.aliyun.com/zh/model-studio/developer-reference/get-temporary-file-url) |
| Field | Value |
| --------------- | -------------------------------------------------------- |
| **Name** | `file upload` |
| **Description** | Upload a local file to DashScope temporary storage (48h) |
| **Usage** | `bl file upload --file <path> --model <model>` |

#### Options

Expand Down
22 changes: 10 additions & 12 deletions skills/bailian-cli/reference/image.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,12 +16,11 @@ Index: [index.md](index.md)

### `bl image edit`

| Field | Value |
| --------------- | --------------------------------------------------------------------------------------------------------------------------- |
| **Name** | `image edit` |
| **Description** | Edit an existing image with text instructions (Qwen-Image) |
| **Usage** | `bl image edit --image <url> --prompt <text> [flags]` |
| **API docs** | [/developer-reference/qwen-image-edit-api](https://help.aliyun.com/zh/model-studio/developer-reference/qwen-image-edit-api) |
| Field | Value |
| --------------- | ---------------------------------------------------------- |
| **Name** | `image edit` |
| **Description** | Edit an existing image with text instructions (Qwen-Image) |
| **Usage** | `bl image edit --image <url> --prompt <text> [flags]` |

#### Options

Expand DownExpand Up@@ -63,12 +62,11 @@ bl image edit --image ./photo.png --prompt "把背景换成海滩" --watermark f

### `bl image generate`

| Field | Value |
| --------------- | ------------------------------------------------------------------------------------------------------------- |
| **Name** | `image generate` |
| **Description** | Generate images (Qwen-Image / wan2.x) |
| **Usage** | `bl image generate --prompt <text> [flags]` |
| **API docs** | [/best-practice/wanx/text-to-image](https://help.aliyun.com/zh/model-studio/best-practice/wanx/text-to-image) |
| Field | Value |
| --------------- | ------------------------------------------- |
| **Name** | `image generate` |
| **Description** | Generate images (Qwen-Image / wan2.x) |
| **Usage** | `bl image generate --prompt <text> [flags]` |

#### Options

Expand Down
11 changes: 5 additions & 6 deletions skills/bailian-cli/reference/omni.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,12 +15,11 @@ Index: [index.md](index.md)

### `bl omni`

| Field | Value |
| --------------- | ----------------------------------------------------------------------------------------- |
| **Name** | `omni` |
| **Description** | Multimodal chat with text + audio output (Qwen-Omni) |
| **Usage** | `bl omni --message <text> [flags]` |
| **API docs** | [/model-studio/qwen-omni](https://help.aliyun.com/zh/model-studio/model-studio/qwen-omni) |
| Field | Value |
| --------------- | ---------------------------------------------------- |
| **Name** | `omni` |
| **Description** | Multimodal chat with text + audio output (Qwen-Omni) |
| **Usage** | `bl omni --message <text> [flags]` |

#### Options

Expand Down
22 changes: 10 additions & 12 deletions skills/bailian-cli/reference/speech.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,12 +16,11 @@ Index: [index.md](index.md)

### `bl speech recognize`

| Field | Value |
| --------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| **Name** | `speech recognize` |
| **Description** | Recognize speech from audio files (FunAudio-ASR) |
| **Usage** | `bl speech recognize --url <audio-url> [flags]` |
| **API docs** | [/developer-reference/recording-file-recognition](https://help.aliyun.com/zh/model-studio/developer-reference/recording-file-recognition) |
| Field | Value |
| --------------- | ------------------------------------------------ |
| **Name** | `speech recognize` |
| **Description** | Recognize speech from audio files (FunAudio-ASR) |
| **Usage** | `bl speech recognize --url <audio-url> [flags]` |

#### Options

Expand DownExpand Up@@ -70,12 +69,11 @@ bl speech recognize --url https://example.com/audio.mp3 --no-wait --quiet

### `bl speech synthesize`

| Field | Value |
| --------------- | ------------------------------------------------------------------------------------------------------- |
| **Name** | `speech synthesize` |
| **Description** | Synthesize speech from text (CosyVoice TTS) |
| **Usage** | `bl speech synthesize --text <text> [flags]` |
| **API docs** | [/developer-reference/cosyvoice](https://help.aliyun.com/zh/model-studio/developer-reference/cosyvoice) |
| Field | Value |
| --------------- | -------------------------------------------- |
| **Name** | `speech synthesize` |
| **Description** | Synthesize speech from text (CosyVoice TTS) |
| **Usage** | `bl speech synthesize --text <text> [flags]` |

#### Options

Expand Down
11 changes: 5 additions & 6 deletions skills/bailian-cli/reference/text.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,12 +15,11 @@ Index: [index.md](index.md)

### `bl text chat`

| Field | Value |
| --------------- | ------------------------------------------------------------------------------------------------------------------------- |
| **Name** | `text chat` |
| **Description** | Send a chat completion (OpenAI compatible, DashScope) |
| **Usage** | `bl text chat --message <text> [flags]` |
| **API docs** | [/compatibility-of-openai-with-dashscope](https://help.aliyun.com/zh/model-studio/compatibility-of-openai-with-dashscope) |
| Field | Value |
| --------------- | ----------------------------------------------------- |
| **Name** | `text chat` |
| **Description** | Send a chat completion (OpenAI compatible, DashScope) |
| **Usage** | `bl text chat --message <text> [flags]` |

#### Options

Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/agents/branch-merge-review.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -57,7 +57,7 @@ git diff --name-only <base>...<head>
- [ ] **新命令 / 新 flag** 已同步到用户面文档:
- [README.md](README.md) + [README.zh.md](README.zh.md)(中英文都要,常漏 `_CN`)
- (SKILL.md 已迁出本仓库,由 `npx add skills` 机制独立维护,不在本仓库 review 范围)
- [ ] **`bl <cmd> --help`** 文案完整:`description` / `examples` / `apiDocs` 都填了
- [ ] **`bl <cmd> --help`** 文案完整:`description` / `examples` 都填了
- [ ] **demo / quickstart**:用户可调用的新命令至少有一个示例
- [ ] **行为变化的老命令**:在 commit message / CHANGELOG 注明用户感知的差异
- [ ] **错误信息 / 提示文案**:面向用户的字符串通顺、双语(项目主体是中文场景)
Expand Down
3 changes: 1 addition & 2 deletions docs/agents/command-add-remove.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,7 +27,7 @@
命令元数据以 **`catalog.ts` 为单一登记处**;`registry.ts` 只负责解析与打印 help,不再内嵌命令表或手写 Resources 列表。

```
commands/<...>.ts defineCommand({ name, description, usage, options, examples, apiDocs?, run })
commands/<...>.ts defineCommand({ name, description, usage, options, examples, run })
commands/catalog.ts export const commands: Record<string, Command>
Expand All@@ -53,7 +53,6 @@ registry.ts main.ts tools/generate-reference.ts export-schema.ts
- 增删 `import xxx from "./.../xxx.ts"`
- 在 `export const commands` 里增删 `"<group> <action>": xxx`(key 与 `defineCommand({ name })` 一致)
- [ ] **不要**在 `registry.ts` 里重复登记命令(已从 catalog 读取)
- [ ] 命令需在 `bl help` / `reference/` 展示 API 文档链接时,在 `defineCommand` 里设 `apiDocs`(相对路径);help 与 reference 均从此字段生成
- [ ] 如果命令需要鉴权之外的特殊路径,看 `packages/cli/src/main.ts` 的 `NO_AUTH_SETUP`
- [ ] **`config/export-schema.ts`**: 若新命令不适合作为 agent tool,评估是否加入 `SKIP_PREFIXES`;该文件在 `run()` 内 `import("../catalog.ts")`,勿顶层 import catalog 以免循环依赖

Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/file/upload.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,6 @@ import { emitResult, emitBare } from "../../output/output.ts";
export default defineCommand({
name: "file upload",
description: "Upload a local file to DashScope temporary storage (48h)",
apiDocs: "/developer-reference/get-temporary-file-url",
usage: "bl file upload --file <path> --model <model>",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/image/edit.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -32,7 +32,6 @@ import {
export default defineCommand({
name: "image edit",
description: "Edit an existing image with text instructions (Qwen-Image)",
apiDocs: "/developer-reference/qwen-image-edit-api",
usage: "bl image edit --image <url> --prompt <text> [flags]",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/image/generate.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -43,7 +43,6 @@ function isSyncModel(model: string): boolean {
export default defineCommand({
name: "image generate",
description: "Generate images (Qwen-Image / wan2.x)",
apiDocs: "/best-practice/wanx/text-to-image",
usage: "bl image generate --prompt <text> [flags]",
options: [
{ flag: "--prompt <text>", description: "Image description", required: true },
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/omni/chat.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -44,7 +44,6 @@ function buildWavHeader(dataLength: number): Buffer {
export default defineCommand({
name: "omni",
description: "Multimodal chat with text + audio output (Qwen-Omni)",
apiDocs: "/model-studio/qwen-omni",
usage: "bl omni --message <text> [flags]",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/speech/recognize.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,6 @@ import { emitResult, emitBare } from "../../output/output.ts";
export default defineCommand({
name: "speech recognize",
description: "Recognize speech from audio files (FunAudio-ASR)",
apiDocs: "/developer-reference/recording-file-recognition",
usage: "bl speech recognize --url <audio-url> [flags]",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/speech/synthesize.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -144,7 +144,6 @@ function printVoiceList(model: string): void {
export default defineCommand({
name: "speech synthesize",
description: "Synthesize speech from text (CosyVoice TTS)",
apiDocs: "/developer-reference/cosyvoice",
usage: "bl speech synthesize --text <text> [flags]",
options: [
{ flag: "--text <text>", description: "Text to synthesize into speech", required: true },
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/text/chat.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -70,7 +70,6 @@ function parseMessages(flags: GlobalFlags): ParsedMessages {
export default defineCommand({
name: "text chat",
description: "Send a chat completion (OpenAI compatible, DashScope)",
apiDocs: "/compatibility-of-openai-with-dashscope",
usage: "bl text chat --message <text> [flags]",
options: [
{ flag: "--model <model>", description: "Model ID (default: qwen3.7-max)" },
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/video/edit.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,7 +31,6 @@ export default defineCommand({
name: "video edit",
description:
"Edit a video with happyhorse-1.0-video-edit (style transfer, object replacement, etc.)",
apiDocs: "/best-practice/wanx/video-edit",
usage: "bl video edit --video <url> --prompt <text> [flags]",
options: [
{ flag: "--model <model>", description: "Model ID (default: happyhorse-1.0-video-edit)" },
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/video/generate.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -44,7 +44,6 @@ export default defineCommand({
name: "video generate",
description:
"Generate a video from text or image (happyhorse-1.0-t2v / happyhorse-1.0-i2v / wan2.6-t2v)",
apiDocs: "/best-practice/wanx/text-to-video",
usage: "bl video generate --prompt <text> [--image <url>] [flags]",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/video/ref.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,7 +31,6 @@ export default defineCommand({
name: "video ref",
description:
"Reference-to-video generation (happyhorse-1.0-r2v / wan2.6-r2v): multi-subject, multi-shot with voice",
apiDocs: "/best-practice/wanx/video-reference",
usage: "bl video ref --prompt <text> --image <url>... [--ref-video <url>...] [flags]",
options: [
{ flag: "--model <model>", description: "Model ID (default: happyhorse-1.0-r2v)" },
Expand Down
24 changes: 3 additions & 21 deletions packages/cli/src/main.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,11 +3,9 @@ import { registry } from "./registry.ts";
import {
GLOBAL_OPTIONS,
loadConfig,
readConfigFile,
resolveCredential,
trackCommandExecution,
flushTelemetry,
type Region,
} from "bailian-cli-core";
import { ensureApiKey } from "./utils/ensure-key.ts";
import { handleError } from "./error-handler.ts";
Expand All@@ -22,13 +20,7 @@ import {
} from "./utils/command-help.ts";

registerCommandHelpPrinter((commandPath, out) => {
const a = process.argv.slice(2);
const ri = a.indexOf("--region");
const region = ((ri >= 0 && a[ri + 1]) ||
process.env.DASHSCOPE_REGION ||
readConfigFile().region ||
"cn") as Region;
registry.printHelp(commandPath, out, region);
registry.printHelp(commandPath, out);
});

// 优雅处理 Ctrl+C
Expand DownExpand Up@@ -84,12 +76,7 @@ async function main() {
const commandPath = scanCommandPath(argv, GLOBAL_OPTIONS);

if (argv.includes("--help") || argv.includes("-h")) {
const ri = argv.indexOf("--region");
const region = ((ri >= 0 && argv[ri + 1]) ||
process.env.DASHSCOPE_REGION ||
readConfigFile().region ||
"cn") as Region;
registry.printHelp(commandPath, process.stderr, region);
registry.printHelp(commandPath, process.stderr);
process.exit(0);
}

Expand All@@ -115,12 +102,7 @@ async function main() {

// 组路径(例如 `bl speech` 未接子命令):展示帮助后干净退出
if (registry.isGroupPath(commandPath)) {
const ri = argv.indexOf("--region");
const region = ((ri >= 0 && argv[ri + 1]) ||
process.env.DASHSCOPE_REGION ||
readConfigFile().region ||
"cn") as Region;
registry.printHelp(commandPath, process.stderr, region);
registry.printHelp(commandPath, process.stderr);
process.exit(0);
}

Expand Down
15 changes: 4 additions & 11 deletions packages/cli/src/registry.ts
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
import type { Command } from "bailian-cli-core";
import { BailianError } from "bailian-cli-core";
import { ExitCode } from "bailian-cli-core";
import { DOCS_HOSTS, GLOBAL_OPTIONS, type Region } from "bailian-cli-core";
import { GLOBAL_OPTIONS } from "bailian-cli-core";
import { commands } from "./commands/catalog.ts";

export type { Command, OptionDef } from "bailian-cli-core";
Expand DownExpand Up@@ -133,11 +133,7 @@ class CommandRegistry {
out.isTTY ? `\x1b[38;2;59;130;246m${s}\x1b[0m` : s;
private dim = (s: string, out: NodeJS.WriteStream) => (out.isTTY ? `\x1b[2m${s}\x1b[0m` : s);

printHelp(
commandPath: string[],
out: NodeJS.WriteStream = process.stdout,
region: Region = "cn",
): void {
printHelp(commandPath: string[], out: NodeJS.WriteStream = process.stdout): void {
if (commandPath.length === 0) {
this.printRootHelp(out);
return;
Expand All@@ -154,7 +150,7 @@ class CommandRegistry {
}

if (node.command) {
this.printCommandHelp(node.command, out, region);
this.printCommandHelp(node.command, out);
return;
}

Expand DownExpand Up@@ -233,7 +229,7 @@ ${b("Getting Help:")}
`);
}

private printCommandHelp(cmd: Command, out: NodeJS.WriteStream, region: Region = "cn"): void {
private printCommandHelp(cmd: Command, out: NodeJS.WriteStream): void {
const b = (s: string) => this.bold(s, out);
const a = (s: string) => this.accent(s, out);
const d = (s: string) => this.dim(s, out);
Expand All@@ -253,9 +249,6 @@ ${b("Getting Help:")}
out.write(` ${d(ex)}\n`);
}
}
if (cmd.apiDocs) {
out.write(`\n${b("API Reference:")} ${d(DOCS_HOSTS[region] + cmd.apiDocs)}\n`);
}
out.write(
`\n${d("Global flags (--api-key, --output, --quiet, etc.) are always available.")}\n`,
);
Expand Down
3 changes: 0 additions & 3 deletions packages/core/src/types/command.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,7 +14,6 @@ export interface Command {
usage?: string;
options?: OptionDef[];
examples?: string[];
apiDocs?: string;
execute: (config: Config, flags: GlobalFlags) => Promise<void>;
}

Expand All@@ -24,7 +23,6 @@ export interface CommandSpec {
usage?: string;
options?: OptionDef[];
examples?: string[];
apiDocs?: string;
run: (config: Config, flags: GlobalFlags) => Promise<void>;
}

Expand All@@ -35,7 +33,6 @@ export function defineCommand(spec: CommandSpec): Command {
usage: spec.usage,
options: spec.options,
examples: spec.examples,
apiDocs: spec.apiDocs,
execute: (config, flags) => spec.run(config, flags),
};
}
Expand Down
11 changes: 5 additions & 6 deletions skills/bailian-cli/reference/file.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,12 +15,11 @@ Index: [index.md](index.md)

### `bl file upload`

| Field | Value |
| --------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| **Name** | `file upload` |
| **Description** | Upload a local file to DashScope temporary storage (48h) |
| **Usage** | `bl file upload --file <path> --model <model>` |
| **API docs** | [/developer-reference/get-temporary-file-url](https://help.aliyun.com/zh/model-studio/developer-reference/get-temporary-file-url) |
| Field | Value |
| --------------- | -------------------------------------------------------- |
| **Name** | `file upload` |
| **Description** | Upload a local file to DashScope temporary storage (48h) |
| **Usage** | `bl file upload --file <path> --model <model>` |

#### Options

Expand Down
22 changes: 10 additions & 12 deletions skills/bailian-cli/reference/image.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,12 +16,11 @@ Index: [index.md](index.md)

### `bl image edit`

| Field | Value |
| --------------- | --------------------------------------------------------------------------------------------------------------------------- |
| **Name** | `image edit` |
| **Description** | Edit an existing image with text instructions (Qwen-Image) |
| **Usage** | `bl image edit --image <url> --prompt <text> [flags]` |
| **API docs** | [/developer-reference/qwen-image-edit-api](https://help.aliyun.com/zh/model-studio/developer-reference/qwen-image-edit-api) |
| Field | Value |
| --------------- | ---------------------------------------------------------- |
| **Name** | `image edit` |
| **Description** | Edit an existing image with text instructions (Qwen-Image) |
| **Usage** | `bl image edit --image <url> --prompt <text> [flags]` |

#### Options

Expand DownExpand Up@@ -63,12 +62,11 @@ bl image edit --image ./photo.png --prompt "把背景换成海滩" --watermark f

### `bl image generate`

| Field | Value |
| --------------- | ------------------------------------------------------------------------------------------------------------- |
| **Name** | `image generate` |
| **Description** | Generate images (Qwen-Image / wan2.x) |
| **Usage** | `bl image generate --prompt <text> [flags]` |
| **API docs** | [/best-practice/wanx/text-to-image](https://help.aliyun.com/zh/model-studio/best-practice/wanx/text-to-image) |
| Field | Value |
| --------------- | ------------------------------------------- |
| **Name** | `image generate` |
| **Description** | Generate images (Qwen-Image / wan2.x) |
| **Usage** | `bl image generate --prompt <text> [flags]` |

#### Options

Expand Down
11 changes: 5 additions & 6 deletions skills/bailian-cli/reference/omni.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,12 +15,11 @@ Index: [index.md](index.md)

### `bl omni`

| Field | Value |
| --------------- | ----------------------------------------------------------------------------------------- |
| **Name** | `omni` |
| **Description** | Multimodal chat with text + audio output (Qwen-Omni) |
| **Usage** | `bl omni --message <text> [flags]` |
| **API docs** | [/model-studio/qwen-omni](https://help.aliyun.com/zh/model-studio/model-studio/qwen-omni) |
| Field | Value |
| --------------- | ---------------------------------------------------- |
| **Name** | `omni` |
| **Description** | Multimodal chat with text + audio output (Qwen-Omni) |
| **Usage** | `bl omni --message <text> [flags]` |

#### Options

Expand Down
22 changes: 10 additions & 12 deletions skills/bailian-cli/reference/speech.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,12 +16,11 @@ Index: [index.md](index.md)

### `bl speech recognize`

| Field | Value |
| --------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| **Name** | `speech recognize` |
| **Description** | Recognize speech from audio files (FunAudio-ASR) |
| **Usage** | `bl speech recognize --url <audio-url> [flags]` |
| **API docs** | [/developer-reference/recording-file-recognition](https://help.aliyun.com/zh/model-studio/developer-reference/recording-file-recognition) |
| Field | Value |
| --------------- | ------------------------------------------------ |
| **Name** | `speech recognize` |
| **Description** | Recognize speech from audio files (FunAudio-ASR) |
| **Usage** | `bl speech recognize --url <audio-url> [flags]` |

#### Options

Expand DownExpand Up@@ -70,12 +69,11 @@ bl speech recognize --url https://example.com/audio.mp3 --no-wait --quiet

### `bl speech synthesize`

| Field | Value |
| --------------- | ------------------------------------------------------------------------------------------------------- |
| **Name** | `speech synthesize` |
| **Description** | Synthesize speech from text (CosyVoice TTS) |
| **Usage** | `bl speech synthesize --text <text> [flags]` |
| **API docs** | [/developer-reference/cosyvoice](https://help.aliyun.com/zh/model-studio/developer-reference/cosyvoice) |
| Field | Value |
| --------------- | -------------------------------------------- |
| **Name** | `speech synthesize` |
| **Description** | Synthesize speech from text (CosyVoice TTS) |
| **Usage** | `bl speech synthesize --text <text> [flags]` |

#### Options

Expand Down
11 changes: 5 additions & 6 deletions skills/bailian-cli/reference/text.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,12 +15,11 @@ Index: [index.md](index.md)

### `bl text chat`

| Field | Value |
| --------------- | ------------------------------------------------------------------------------------------------------------------------- |
| **Name** | `text chat` |
| **Description** | Send a chat completion (OpenAI compatible, DashScope) |
| **Usage** | `bl text chat --message <text> [flags]` |
| **API docs** | [/compatibility-of-openai-with-dashscope](https://help.aliyun.com/zh/model-studio/compatibility-of-openai-with-dashscope) |
| Field | Value |
| --------------- | ----------------------------------------------------- |
| **Name** | `text chat` |
| **Description** | Send a chat completion (OpenAI compatible, DashScope) |
| **Usage** | `bl text chat --message <text> [flags]` |

#### Options

Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/agents/branch-merge-review.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -57,7 +57,7 @@ git diff --name-only <base>...<head>
- [ ] **新命令 / 新 flag** 已同步到用户面文档:
- [README.md](README.md) + [README.zh.md](README.zh.md)(中英文都要,常漏 `_CN`)
- (SKILL.md 已迁出本仓库,由 `npx add skills` 机制独立维护,不在本仓库 review 范围)
- [ ] **`bl <cmd> --help`** 文案完整:`description` / `examples` / `apiDocs` 都填了
- [ ] **`bl <cmd> --help`** 文案完整:`description` / `examples` 都填了
- [ ] **demo / quickstart**:用户可调用的新命令至少有一个示例
- [ ] **行为变化的老命令**:在 commit message / CHANGELOG 注明用户感知的差异
- [ ] **错误信息 / 提示文案**:面向用户的字符串通顺、双语(项目主体是中文场景)
Expand Down
3 changes: 1 addition & 2 deletions docs/agents/command-add-remove.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,7 +27,7 @@
命令元数据以 **`catalog.ts` 为单一登记处**;`registry.ts` 只负责解析与打印 help,不再内嵌命令表或手写 Resources 列表。

```
commands/<...>.ts defineCommand({ name, description, usage, options, examples, apiDocs?, run })
commands/<...>.ts defineCommand({ name, description, usage, options, examples, run })
commands/catalog.ts export const commands: Record<string, Command>
Expand All@@ -53,7 +53,6 @@ registry.ts main.ts tools/generate-reference.ts export-schema.ts
- 增删 `import xxx from "./.../xxx.ts"`
- 在 `export const commands` 里增删 `"<group> <action>": xxx`(key 与 `defineCommand({ name })` 一致)
- [ ] **不要**在 `registry.ts` 里重复登记命令(已从 catalog 读取)
- [ ] 命令需在 `bl help` / `reference/` 展示 API 文档链接时,在 `defineCommand` 里设 `apiDocs`(相对路径);help 与 reference 均从此字段生成
- [ ] 如果命令需要鉴权之外的特殊路径,看 `packages/cli/src/main.ts` 的 `NO_AUTH_SETUP`
- [ ] **`config/export-schema.ts`**: 若新命令不适合作为 agent tool,评估是否加入 `SKIP_PREFIXES`;该文件在 `run()` 内 `import("../catalog.ts")`,勿顶层 import catalog 以免循环依赖

Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/file/upload.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,6 @@ import { emitResult, emitBare } from "../../output/output.ts";
export default defineCommand({
name: "file upload",
description: "Upload a local file to DashScope temporary storage (48h)",
apiDocs: "/developer-reference/get-temporary-file-url",
usage: "bl file upload --file <path> --model <model>",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/image/edit.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -32,7 +32,6 @@ import {
export default defineCommand({
name: "image edit",
description: "Edit an existing image with text instructions (Qwen-Image)",
apiDocs: "/developer-reference/qwen-image-edit-api",
usage: "bl image edit --image <url> --prompt <text> [flags]",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/image/generate.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -43,7 +43,6 @@ function isSyncModel(model: string): boolean {
export default defineCommand({
name: "image generate",
description: "Generate images (Qwen-Image / wan2.x)",
apiDocs: "/best-practice/wanx/text-to-image",
usage: "bl image generate --prompt <text> [flags]",
options: [
{ flag: "--prompt <text>", description: "Image description", required: true },
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/omni/chat.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -44,7 +44,6 @@ function buildWavHeader(dataLength: number): Buffer {
export default defineCommand({
name: "omni",
description: "Multimodal chat with text + audio output (Qwen-Omni)",
apiDocs: "/model-studio/qwen-omni",
usage: "bl omni --message <text> [flags]",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/speech/recognize.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,6 @@ import { emitResult, emitBare } from "../../output/output.ts";
export default defineCommand({
name: "speech recognize",
description: "Recognize speech from audio files (FunAudio-ASR)",
apiDocs: "/developer-reference/recording-file-recognition",
usage: "bl speech recognize --url <audio-url> [flags]",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/speech/synthesize.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -144,7 +144,6 @@ function printVoiceList(model: string): void {
export default defineCommand({
name: "speech synthesize",
description: "Synthesize speech from text (CosyVoice TTS)",
apiDocs: "/developer-reference/cosyvoice",
usage: "bl speech synthesize --text <text> [flags]",
options: [
{ flag: "--text <text>", description: "Text to synthesize into speech", required: true },
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/text/chat.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -70,7 +70,6 @@ function parseMessages(flags: GlobalFlags): ParsedMessages {
export default defineCommand({
name: "text chat",
description: "Send a chat completion (OpenAI compatible, DashScope)",
apiDocs: "/compatibility-of-openai-with-dashscope",
usage: "bl text chat --message <text> [flags]",
options: [
{ flag: "--model <model>", description: "Model ID (default: qwen3.7-max)" },
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/video/edit.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,7 +31,6 @@ export default defineCommand({
name: "video edit",
description:
"Edit a video with happyhorse-1.0-video-edit (style transfer, object replacement, etc.)",
apiDocs: "/best-practice/wanx/video-edit",
usage: "bl video edit --video <url> --prompt <text> [flags]",
options: [
{ flag: "--model <model>", description: "Model ID (default: happyhorse-1.0-video-edit)" },
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/video/generate.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -44,7 +44,6 @@ export default defineCommand({
name: "video generate",
description:
"Generate a video from text or image (happyhorse-1.0-t2v / happyhorse-1.0-i2v / wan2.6-t2v)",
apiDocs: "/best-practice/wanx/text-to-video",
usage: "bl video generate --prompt <text> [--image <url>] [flags]",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/video/ref.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,7 +31,6 @@ export default defineCommand({
name: "video ref",
description:
"Reference-to-video generation (happyhorse-1.0-r2v / wan2.6-r2v): multi-subject, multi-shot with voice",
apiDocs: "/best-practice/wanx/video-reference",
usage: "bl video ref --prompt <text> --image <url>... [--ref-video <url>...] [flags]",
options: [
{ flag: "--model <model>", description: "Model ID (default: happyhorse-1.0-r2v)" },
Expand Down
24 changes: 3 additions & 21 deletions packages/cli/src/main.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,11 +3,9 @@ import { registry } from "./registry.ts";
import {
GLOBAL_OPTIONS,
loadConfig,
readConfigFile,
resolveCredential,
trackCommandExecution,
flushTelemetry,
type Region,
} from "bailian-cli-core";
import { ensureApiKey } from "./utils/ensure-key.ts";
import { handleError } from "./error-handler.ts";
Expand All@@ -22,13 +20,7 @@ import {
} from "./utils/command-help.ts";

registerCommandHelpPrinter((commandPath, out) => {
const a = process.argv.slice(2);
const ri = a.indexOf("--region");
const region = ((ri >= 0 && a[ri + 1]) ||
process.env.DASHSCOPE_REGION ||
readConfigFile().region ||
"cn") as Region;
registry.printHelp(commandPath, out, region);
registry.printHelp(commandPath, out);
});

// 优雅处理 Ctrl+C
Expand DownExpand Up@@ -84,12 +76,7 @@ async function main() {
const commandPath = scanCommandPath(argv, GLOBAL_OPTIONS);

if (argv.includes("--help") || argv.includes("-h")) {
const ri = argv.indexOf("--region");
const region = ((ri >= 0 && argv[ri + 1]) ||
process.env.DASHSCOPE_REGION ||
readConfigFile().region ||
"cn") as Region;
registry.printHelp(commandPath, process.stderr, region);
registry.printHelp(commandPath, process.stderr);
process.exit(0);
}

Expand All@@ -115,12 +102,7 @@ async function main() {

// 组路径(例如 `bl speech` 未接子命令):展示帮助后干净退出
if (registry.isGroupPath(commandPath)) {
const ri = argv.indexOf("--region");
const region = ((ri >= 0 && argv[ri + 1]) ||
process.env.DASHSCOPE_REGION ||
readConfigFile().region ||
"cn") as Region;
registry.printHelp(commandPath, process.stderr, region);
registry.printHelp(commandPath, process.stderr);
process.exit(0);
}

Expand Down
15 changes: 4 additions & 11 deletions packages/cli/src/registry.ts
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
import type { Command } from "bailian-cli-core";
import { BailianError } from "bailian-cli-core";
import { ExitCode } from "bailian-cli-core";
import { DOCS_HOSTS, GLOBAL_OPTIONS, type Region } from "bailian-cli-core";
import { GLOBAL_OPTIONS } from "bailian-cli-core";
import { commands } from "./commands/catalog.ts";

export type { Command, OptionDef } from "bailian-cli-core";
Expand DownExpand Up@@ -133,11 +133,7 @@ class CommandRegistry {
out.isTTY ? `\x1b[38;2;59;130;246m${s}\x1b[0m` : s;
private dim = (s: string, out: NodeJS.WriteStream) => (out.isTTY ? `\x1b[2m${s}\x1b[0m` : s);

printHelp(
commandPath: string[],
out: NodeJS.WriteStream = process.stdout,
region: Region = "cn",
): void {
printHelp(commandPath: string[], out: NodeJS.WriteStream = process.stdout): void {
if (commandPath.length === 0) {
this.printRootHelp(out);
return;
Expand All@@ -154,7 +150,7 @@ class CommandRegistry {
}

if (node.command) {
this.printCommandHelp(node.command, out, region);
this.printCommandHelp(node.command, out);
return;
}

Expand DownExpand Up@@ -233,7 +229,7 @@ ${b("Getting Help:")}
`);
}

private printCommandHelp(cmd: Command, out: NodeJS.WriteStream, region: Region = "cn"): void {
private printCommandHelp(cmd: Command, out: NodeJS.WriteStream): void {
const b = (s: string) => this.bold(s, out);
const a = (s: string) => this.accent(s, out);
const d = (s: string) => this.dim(s, out);
Expand All@@ -253,9 +249,6 @@ ${b("Getting Help:")}
out.write(` ${d(ex)}\n`);
}
}
if (cmd.apiDocs) {
out.write(`\n${b("API Reference:")} ${d(DOCS_HOSTS[region] + cmd.apiDocs)}\n`);
}
out.write(
`\n${d("Global flags (--api-key, --output, --quiet, etc.) are always available.")}\n`,
);
Expand Down
3 changes: 0 additions & 3 deletions packages/core/src/types/command.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,7 +14,6 @@ export interface Command {
usage?: string;
options?: OptionDef[];
examples?: string[];
apiDocs?: string;
execute: (config: Config, flags: GlobalFlags) => Promise<void>;
}

Expand All@@ -24,7 +23,6 @@ export interface CommandSpec {
usage?: string;
options?: OptionDef[];
examples?: string[];
apiDocs?: string;
run: (config: Config, flags: GlobalFlags) => Promise<void>;
}

Expand All@@ -35,7 +33,6 @@ export function defineCommand(spec: CommandSpec): Command {
usage: spec.usage,
options: spec.options,
examples: spec.examples,
apiDocs: spec.apiDocs,
execute: (config, flags) => spec.run(config, flags),
};
}
Expand Down
11 changes: 5 additions & 6 deletions skills/bailian-cli/reference/file.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,12 +15,11 @@ Index: [index.md](index.md)

### `bl file upload`

| Field | Value |
| --------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| **Name** | `file upload` |
| **Description** | Upload a local file to DashScope temporary storage (48h) |
| **Usage** | `bl file upload --file <path> --model <model>` |
| **API docs** | [/developer-reference/get-temporary-file-url](https://help.aliyun.com/zh/model-studio/developer-reference/get-temporary-file-url) |
| Field | Value |
| --------------- | -------------------------------------------------------- |
| **Name** | `file upload` |
| **Description** | Upload a local file to DashScope temporary storage (48h) |
| **Usage** | `bl file upload --file <path> --model <model>` |

#### Options

Expand Down
22 changes: 10 additions & 12 deletions skills/bailian-cli/reference/image.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,12 +16,11 @@ Index: [index.md](index.md)

### `bl image edit`

| Field | Value |
| --------------- | --------------------------------------------------------------------------------------------------------------------------- |
| **Name** | `image edit` |
| **Description** | Edit an existing image with text instructions (Qwen-Image) |
| **Usage** | `bl image edit --image <url> --prompt <text> [flags]` |
| **API docs** | [/developer-reference/qwen-image-edit-api](https://help.aliyun.com/zh/model-studio/developer-reference/qwen-image-edit-api) |
| Field | Value |
| --------------- | ---------------------------------------------------------- |
| **Name** | `image edit` |
| **Description** | Edit an existing image with text instructions (Qwen-Image) |
| **Usage** | `bl image edit --image <url> --prompt <text> [flags]` |

#### Options

Expand DownExpand Up@@ -63,12 +62,11 @@ bl image edit --image ./photo.png --prompt "把背景换成海滩" --watermark f

### `bl image generate`

| Field | Value |
| --------------- | ------------------------------------------------------------------------------------------------------------- |
| **Name** | `image generate` |
| **Description** | Generate images (Qwen-Image / wan2.x) |
| **Usage** | `bl image generate --prompt <text> [flags]` |
| **API docs** | [/best-practice/wanx/text-to-image](https://help.aliyun.com/zh/model-studio/best-practice/wanx/text-to-image) |
| Field | Value |
| --------------- | ------------------------------------------- |
| **Name** | `image generate` |
| **Description** | Generate images (Qwen-Image / wan2.x) |
| **Usage** | `bl image generate --prompt <text> [flags]` |

#### Options

Expand Down
11 changes: 5 additions & 6 deletions skills/bailian-cli/reference/omni.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,12 +15,11 @@ Index: [index.md](index.md)

### `bl omni`

| Field | Value |
| --------------- | ----------------------------------------------------------------------------------------- |
| **Name** | `omni` |
| **Description** | Multimodal chat with text + audio output (Qwen-Omni) |
| **Usage** | `bl omni --message <text> [flags]` |
| **API docs** | [/model-studio/qwen-omni](https://help.aliyun.com/zh/model-studio/model-studio/qwen-omni) |
| Field | Value |
| --------------- | ---------------------------------------------------- |
| **Name** | `omni` |
| **Description** | Multimodal chat with text + audio output (Qwen-Omni) |
| **Usage** | `bl omni --message <text> [flags]` |

#### Options

Expand Down
22 changes: 10 additions & 12 deletions skills/bailian-cli/reference/speech.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,12 +16,11 @@ Index: [index.md](index.md)

### `bl speech recognize`

| Field | Value |
| --------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| **Name** | `speech recognize` |
| **Description** | Recognize speech from audio files (FunAudio-ASR) |
| **Usage** | `bl speech recognize --url <audio-url> [flags]` |
| **API docs** | [/developer-reference/recording-file-recognition](https://help.aliyun.com/zh/model-studio/developer-reference/recording-file-recognition) |
| Field | Value |
| --------------- | ------------------------------------------------ |
| **Name** | `speech recognize` |
| **Description** | Recognize speech from audio files (FunAudio-ASR) |
| **Usage** | `bl speech recognize --url <audio-url> [flags]` |

#### Options

Expand DownExpand Up@@ -70,12 +69,11 @@ bl speech recognize --url https://example.com/audio.mp3 --no-wait --quiet

### `bl speech synthesize`

| Field | Value |
| --------------- | ------------------------------------------------------------------------------------------------------- |
| **Name** | `speech synthesize` |
| **Description** | Synthesize speech from text (CosyVoice TTS) |
| **Usage** | `bl speech synthesize --text <text> [flags]` |
| **API docs** | [/developer-reference/cosyvoice](https://help.aliyun.com/zh/model-studio/developer-reference/cosyvoice) |
| Field | Value |
| --------------- | -------------------------------------------- |
| **Name** | `speech synthesize` |
| **Description** | Synthesize speech from text (CosyVoice TTS) |
| **Usage** | `bl speech synthesize --text <text> [flags]` |

#### Options

Expand Down
11 changes: 5 additions & 6 deletions skills/bailian-cli/reference/text.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,12 +15,11 @@ Index: [index.md](index.md)

### `bl text chat`

| Field | Value |
| --------------- | ------------------------------------------------------------------------------------------------------------------------- |
| **Name** | `text chat` |
| **Description** | Send a chat completion (OpenAI compatible, DashScope) |
| **Usage** | `bl text chat --message <text> [flags]` |
| **API docs** | [/compatibility-of-openai-with-dashscope](https://help.aliyun.com/zh/model-studio/compatibility-of-openai-with-dashscope) |
| Field | Value |
| --------------- | ----------------------------------------------------- |
| **Name** | `text chat` |
| **Description** | Send a chat completion (OpenAI compatible, DashScope) |
| **Usage** | `bl text chat --message <text> [flags]` |

#### Options

Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/agents/branch-merge-review.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -57,7 +57,7 @@ git diff --name-only <base>...<head>
- [ ] **新命令 / 新 flag** 已同步到用户面文档:
- [README.md](README.md) + [README.zh.md](README.zh.md)(中英文都要,常漏 `_CN`)
- (SKILL.md 已迁出本仓库,由 `npx add skills` 机制独立维护,不在本仓库 review 范围)
- [ ] **`bl <cmd> --help`** 文案完整:`description` / `examples` / `apiDocs` 都填了
- [ ] **`bl <cmd> --help`** 文案完整:`description` / `examples` 都填了
- [ ] **demo / quickstart**:用户可调用的新命令至少有一个示例
- [ ] **行为变化的老命令**:在 commit message / CHANGELOG 注明用户感知的差异
- [ ] **错误信息 / 提示文案**:面向用户的字符串通顺、双语(项目主体是中文场景)
Expand Down
3 changes: 1 addition & 2 deletions docs/agents/command-add-remove.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,7 +27,7 @@
命令元数据以 **`catalog.ts` 为单一登记处**;`registry.ts` 只负责解析与打印 help,不再内嵌命令表或手写 Resources 列表。

```
commands/<...>.ts defineCommand({ name, description, usage, options, examples, apiDocs?, run })
commands/<...>.ts defineCommand({ name, description, usage, options, examples, run })
commands/catalog.ts export const commands: Record<string, Command>
Expand All@@ -53,7 +53,6 @@ registry.ts main.ts tools/generate-reference.ts export-schema.ts
- 增删 `import xxx from "./.../xxx.ts"`
- 在 `export const commands` 里增删 `"<group> <action>": xxx`(key 与 `defineCommand({ name })` 一致)
- [ ] **不要**在 `registry.ts` 里重复登记命令(已从 catalog 读取)
- [ ] 命令需在 `bl help` / `reference/` 展示 API 文档链接时,在 `defineCommand` 里设 `apiDocs`(相对路径);help 与 reference 均从此字段生成
- [ ] 如果命令需要鉴权之外的特殊路径,看 `packages/cli/src/main.ts` 的 `NO_AUTH_SETUP`
- [ ] **`config/export-schema.ts`**: 若新命令不适合作为 agent tool,评估是否加入 `SKIP_PREFIXES`;该文件在 `run()` 内 `import("../catalog.ts")`,勿顶层 import catalog 以免循环依赖

Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/file/upload.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,6 @@ import { emitResult, emitBare } from "../../output/output.ts";
export default defineCommand({
name: "file upload",
description: "Upload a local file to DashScope temporary storage (48h)",
apiDocs: "/developer-reference/get-temporary-file-url",
usage: "bl file upload --file <path> --model <model>",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/image/edit.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -32,7 +32,6 @@ import {
export default defineCommand({
name: "image edit",
description: "Edit an existing image with text instructions (Qwen-Image)",
apiDocs: "/developer-reference/qwen-image-edit-api",
usage: "bl image edit --image <url> --prompt <text> [flags]",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/image/generate.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -43,7 +43,6 @@ function isSyncModel(model: string): boolean {
export default defineCommand({
name: "image generate",
description: "Generate images (Qwen-Image / wan2.x)",
apiDocs: "/best-practice/wanx/text-to-image",
usage: "bl image generate --prompt <text> [flags]",
options: [
{ flag: "--prompt <text>", description: "Image description", required: true },
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/omni/chat.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -44,7 +44,6 @@ function buildWavHeader(dataLength: number): Buffer {
export default defineCommand({
name: "omni",
description: "Multimodal chat with text + audio output (Qwen-Omni)",
apiDocs: "/model-studio/qwen-omni",
usage: "bl omni --message <text> [flags]",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/speech/recognize.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,6 @@ import { emitResult, emitBare } from "../../output/output.ts";
export default defineCommand({
name: "speech recognize",
description: "Recognize speech from audio files (FunAudio-ASR)",
apiDocs: "/developer-reference/recording-file-recognition",
usage: "bl speech recognize --url <audio-url> [flags]",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/speech/synthesize.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -144,7 +144,6 @@ function printVoiceList(model: string): void {
export default defineCommand({
name: "speech synthesize",
description: "Synthesize speech from text (CosyVoice TTS)",
apiDocs: "/developer-reference/cosyvoice",
usage: "bl speech synthesize --text <text> [flags]",
options: [
{ flag: "--text <text>", description: "Text to synthesize into speech", required: true },
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/text/chat.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -70,7 +70,6 @@ function parseMessages(flags: GlobalFlags): ParsedMessages {
export default defineCommand({
name: "text chat",
description: "Send a chat completion (OpenAI compatible, DashScope)",
apiDocs: "/compatibility-of-openai-with-dashscope",
usage: "bl text chat --message <text> [flags]",
options: [
{ flag: "--model <model>", description: "Model ID (default: qwen3.7-max)" },
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/video/edit.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,7 +31,6 @@ export default defineCommand({
name: "video edit",
description:
"Edit a video with happyhorse-1.0-video-edit (style transfer, object replacement, etc.)",
apiDocs: "/best-practice/wanx/video-edit",
usage: "bl video edit --video <url> --prompt <text> [flags]",
options: [
{ flag: "--model <model>", description: "Model ID (default: happyhorse-1.0-video-edit)" },
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/video/generate.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -44,7 +44,6 @@ export default defineCommand({
name: "video generate",
description:
"Generate a video from text or image (happyhorse-1.0-t2v / happyhorse-1.0-i2v / wan2.6-t2v)",
apiDocs: "/best-practice/wanx/text-to-video",
usage: "bl video generate --prompt <text> [--image <url>] [flags]",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/video/ref.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,7 +31,6 @@ export default defineCommand({
name: "video ref",
description:
"Reference-to-video generation (happyhorse-1.0-r2v / wan2.6-r2v): multi-subject, multi-shot with voice",
apiDocs: "/best-practice/wanx/video-reference",
usage: "bl video ref --prompt <text> --image <url>... [--ref-video <url>...] [flags]",
options: [
{ flag: "--model <model>", description: "Model ID (default: happyhorse-1.0-r2v)" },
Expand Down
24 changes: 3 additions & 21 deletions packages/cli/src/main.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,11 +3,9 @@ import { registry } from "./registry.ts";
import {
GLOBAL_OPTIONS,
loadConfig,
readConfigFile,
resolveCredential,
trackCommandExecution,
flushTelemetry,
type Region,
} from "bailian-cli-core";
import { ensureApiKey } from "./utils/ensure-key.ts";
import { handleError } from "./error-handler.ts";
Expand All@@ -22,13 +20,7 @@ import {
} from "./utils/command-help.ts";

registerCommandHelpPrinter((commandPath, out) => {
const a = process.argv.slice(2);
const ri = a.indexOf("--region");
const region = ((ri >= 0 && a[ri + 1]) ||
process.env.DASHSCOPE_REGION ||
readConfigFile().region ||
"cn") as Region;
registry.printHelp(commandPath, out, region);
registry.printHelp(commandPath, out);
});

// 优雅处理 Ctrl+C
Expand DownExpand Up@@ -84,12 +76,7 @@ async function main() {
const commandPath = scanCommandPath(argv, GLOBAL_OPTIONS);

if (argv.includes("--help") || argv.includes("-h")) {
const ri = argv.indexOf("--region");
const region = ((ri >= 0 && argv[ri + 1]) ||
process.env.DASHSCOPE_REGION ||
readConfigFile().region ||
"cn") as Region;
registry.printHelp(commandPath, process.stderr, region);
registry.printHelp(commandPath, process.stderr);
process.exit(0);
}

Expand All@@ -115,12 +102,7 @@ async function main() {

// 组路径(例如 `bl speech` 未接子命令):展示帮助后干净退出
if (registry.isGroupPath(commandPath)) {
const ri = argv.indexOf("--region");
const region = ((ri >= 0 && argv[ri + 1]) ||
process.env.DASHSCOPE_REGION ||
readConfigFile().region ||
"cn") as Region;
registry.printHelp(commandPath, process.stderr, region);
registry.printHelp(commandPath, process.stderr);
process.exit(0);
}

Expand Down
15 changes: 4 additions & 11 deletions packages/cli/src/registry.ts
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
import type { Command } from "bailian-cli-core";
import { BailianError } from "bailian-cli-core";
import { ExitCode } from "bailian-cli-core";
import { DOCS_HOSTS, GLOBAL_OPTIONS, type Region } from "bailian-cli-core";
import { GLOBAL_OPTIONS } from "bailian-cli-core";
import { commands } from "./commands/catalog.ts";

export type { Command, OptionDef } from "bailian-cli-core";
Expand DownExpand Up@@ -133,11 +133,7 @@ class CommandRegistry {
out.isTTY ? `\x1b[38;2;59;130;246m${s}\x1b[0m` : s;
private dim = (s: string, out: NodeJS.WriteStream) => (out.isTTY ? `\x1b[2m${s}\x1b[0m` : s);

printHelp(
commandPath: string[],
out: NodeJS.WriteStream = process.stdout,
region: Region = "cn",
): void {
printHelp(commandPath: string[], out: NodeJS.WriteStream = process.stdout): void {
if (commandPath.length === 0) {
this.printRootHelp(out);
return;
Expand All@@ -154,7 +150,7 @@ class CommandRegistry {
}

if (node.command) {
this.printCommandHelp(node.command, out, region);
this.printCommandHelp(node.command, out);
return;
}

Expand DownExpand Up@@ -233,7 +229,7 @@ ${b("Getting Help:")}
`);
}

private printCommandHelp(cmd: Command, out: NodeJS.WriteStream, region: Region = "cn"): void {
private printCommandHelp(cmd: Command, out: NodeJS.WriteStream): void {
const b = (s: string) => this.bold(s, out);
const a = (s: string) => this.accent(s, out);
const d = (s: string) => this.dim(s, out);
Expand All@@ -253,9 +249,6 @@ ${b("Getting Help:")}
out.write(` ${d(ex)}\n`);
}
}
if (cmd.apiDocs) {
out.write(`\n${b("API Reference:")} ${d(DOCS_HOSTS[region] + cmd.apiDocs)}\n`);
}
out.write(
`\n${d("Global flags (--api-key, --output, --quiet, etc.) are always available.")}\n`,
);
Expand Down
3 changes: 0 additions & 3 deletions packages/core/src/types/command.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,7 +14,6 @@ export interface Command {
usage?: string;
options?: OptionDef[];
examples?: string[];
apiDocs?: string;
execute: (config: Config, flags: GlobalFlags) => Promise<void>;
}

Expand All@@ -24,7 +23,6 @@ export interface CommandSpec {
usage?: string;
options?: OptionDef[];
examples?: string[];
apiDocs?: string;
run: (config: Config, flags: GlobalFlags) => Promise<void>;
}

Expand All@@ -35,7 +33,6 @@ export function defineCommand(spec: CommandSpec): Command {
usage: spec.usage,
options: spec.options,
examples: spec.examples,
apiDocs: spec.apiDocs,
execute: (config, flags) => spec.run(config, flags),
};
}
Expand Down
11 changes: 5 additions & 6 deletions skills/bailian-cli/reference/file.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,12 +15,11 @@ Index: [index.md](index.md)

### `bl file upload`

| Field | Value |
| --------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| **Name** | `file upload` |
| **Description** | Upload a local file to DashScope temporary storage (48h) |
| **Usage** | `bl file upload --file <path> --model <model>` |
| **API docs** | [/developer-reference/get-temporary-file-url](https://help.aliyun.com/zh/model-studio/developer-reference/get-temporary-file-url) |
| Field | Value |
| --------------- | -------------------------------------------------------- |
| **Name** | `file upload` |
| **Description** | Upload a local file to DashScope temporary storage (48h) |
| **Usage** | `bl file upload --file <path> --model <model>` |

#### Options

Expand Down
22 changes: 10 additions & 12 deletions skills/bailian-cli/reference/image.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,12 +16,11 @@ Index: [index.md](index.md)

### `bl image edit`

| Field | Value |
| --------------- | --------------------------------------------------------------------------------------------------------------------------- |
| **Name** | `image edit` |
| **Description** | Edit an existing image with text instructions (Qwen-Image) |
| **Usage** | `bl image edit --image <url> --prompt <text> [flags]` |
| **API docs** | [/developer-reference/qwen-image-edit-api](https://help.aliyun.com/zh/model-studio/developer-reference/qwen-image-edit-api) |
| Field | Value |
| --------------- | ---------------------------------------------------------- |
| **Name** | `image edit` |
| **Description** | Edit an existing image with text instructions (Qwen-Image) |
| **Usage** | `bl image edit --image <url> --prompt <text> [flags]` |

#### Options

Expand DownExpand Up@@ -63,12 +62,11 @@ bl image edit --image ./photo.png --prompt "把背景换成海滩" --watermark f

### `bl image generate`

| Field | Value |
| --------------- | ------------------------------------------------------------------------------------------------------------- |
| **Name** | `image generate` |
| **Description** | Generate images (Qwen-Image / wan2.x) |
| **Usage** | `bl image generate --prompt <text> [flags]` |
| **API docs** | [/best-practice/wanx/text-to-image](https://help.aliyun.com/zh/model-studio/best-practice/wanx/text-to-image) |
| Field | Value |
| --------------- | ------------------------------------------- |
| **Name** | `image generate` |
| **Description** | Generate images (Qwen-Image / wan2.x) |
| **Usage** | `bl image generate --prompt <text> [flags]` |

#### Options

Expand Down
11 changes: 5 additions & 6 deletions skills/bailian-cli/reference/omni.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,12 +15,11 @@ Index: [index.md](index.md)

### `bl omni`

| Field | Value |
| --------------- | ----------------------------------------------------------------------------------------- |
| **Name** | `omni` |
| **Description** | Multimodal chat with text + audio output (Qwen-Omni) |
| **Usage** | `bl omni --message <text> [flags]` |
| **API docs** | [/model-studio/qwen-omni](https://help.aliyun.com/zh/model-studio/model-studio/qwen-omni) |
| Field | Value |
| --------------- | ---------------------------------------------------- |
| **Name** | `omni` |
| **Description** | Multimodal chat with text + audio output (Qwen-Omni) |
| **Usage** | `bl omni --message <text> [flags]` |

#### Options

Expand Down
22 changes: 10 additions & 12 deletions skills/bailian-cli/reference/speech.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,12 +16,11 @@ Index: [index.md](index.md)

### `bl speech recognize`

| Field | Value |
| --------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| **Name** | `speech recognize` |
| **Description** | Recognize speech from audio files (FunAudio-ASR) |
| **Usage** | `bl speech recognize --url <audio-url> [flags]` |
| **API docs** | [/developer-reference/recording-file-recognition](https://help.aliyun.com/zh/model-studio/developer-reference/recording-file-recognition) |
| Field | Value |
| --------------- | ------------------------------------------------ |
| **Name** | `speech recognize` |
| **Description** | Recognize speech from audio files (FunAudio-ASR) |
| **Usage** | `bl speech recognize --url <audio-url> [flags]` |

#### Options

Expand DownExpand Up@@ -70,12 +69,11 @@ bl speech recognize --url https://example.com/audio.mp3 --no-wait --quiet

### `bl speech synthesize`

| Field | Value |
| --------------- | ------------------------------------------------------------------------------------------------------- |
| **Name** | `speech synthesize` |
| **Description** | Synthesize speech from text (CosyVoice TTS) |
| **Usage** | `bl speech synthesize --text <text> [flags]` |
| **API docs** | [/developer-reference/cosyvoice](https://help.aliyun.com/zh/model-studio/developer-reference/cosyvoice) |
| Field | Value |
| --------------- | -------------------------------------------- |
| **Name** | `speech synthesize` |
| **Description** | Synthesize speech from text (CosyVoice TTS) |
| **Usage** | `bl speech synthesize --text <text> [flags]` |

#### Options

Expand Down
11 changes: 5 additions & 6 deletions skills/bailian-cli/reference/text.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,12 +15,11 @@ Index: [index.md](index.md)

### `bl text chat`

| Field | Value |
| --------------- | ------------------------------------------------------------------------------------------------------------------------- |
| **Name** | `text chat` |
| **Description** | Send a chat completion (OpenAI compatible, DashScope) |
| **Usage** | `bl text chat --message <text> [flags]` |
| **API docs** | [/compatibility-of-openai-with-dashscope](https://help.aliyun.com/zh/model-studio/compatibility-of-openai-with-dashscope) |
| Field | Value |
| --------------- | ----------------------------------------------------- |
| **Name** | `text chat` |
| **Description** | Send a chat completion (OpenAI compatible, DashScope) |
| **Usage** | `bl text chat --message <text> [flags]` |

#### Options

Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/agents/branch-merge-review.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -57,7 +57,7 @@ git diff --name-only <base>...<head>
- [ ] **新命令 / 新 flag** 已同步到用户面文档:
- [README.md](README.md) + [README.zh.md](README.zh.md)(中英文都要,常漏 `_CN`)
- (SKILL.md 已迁出本仓库,由 `npx add skills` 机制独立维护,不在本仓库 review 范围)
- [ ] **`bl <cmd> --help`** 文案完整:`description` / `examples` / `apiDocs` 都填了
- [ ] **`bl <cmd> --help`** 文案完整:`description` / `examples` 都填了
- [ ] **demo / quickstart**:用户可调用的新命令至少有一个示例
- [ ] **行为变化的老命令**:在 commit message / CHANGELOG 注明用户感知的差异
- [ ] **错误信息 / 提示文案**:面向用户的字符串通顺、双语(项目主体是中文场景)
Expand Down
3 changes: 1 addition & 2 deletions docs/agents/command-add-remove.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,7 +27,7 @@
命令元数据以 **`catalog.ts` 为单一登记处**;`registry.ts` 只负责解析与打印 help,不再内嵌命令表或手写 Resources 列表。

```
commands/<...>.ts defineCommand({ name, description, usage, options, examples, apiDocs?, run })
commands/<...>.ts defineCommand({ name, description, usage, options, examples, run })
commands/catalog.ts export const commands: Record<string, Command>
Expand All@@ -53,7 +53,6 @@ registry.ts main.ts tools/generate-reference.ts export-schema.ts
- 增删 `import xxx from "./.../xxx.ts"`
- 在 `export const commands` 里增删 `"<group> <action>": xxx`(key 与 `defineCommand({ name })` 一致)
- [ ] **不要**在 `registry.ts` 里重复登记命令(已从 catalog 读取)
- [ ] 命令需在 `bl help` / `reference/` 展示 API 文档链接时,在 `defineCommand` 里设 `apiDocs`(相对路径);help 与 reference 均从此字段生成
- [ ] 如果命令需要鉴权之外的特殊路径,看 `packages/cli/src/main.ts` 的 `NO_AUTH_SETUP`
- [ ] **`config/export-schema.ts`**: 若新命令不适合作为 agent tool,评估是否加入 `SKIP_PREFIXES`;该文件在 `run()` 内 `import("../catalog.ts")`,勿顶层 import catalog 以免循环依赖

Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/file/upload.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,6 @@ import { emitResult, emitBare } from "../../output/output.ts";
export default defineCommand({
name: "file upload",
description: "Upload a local file to DashScope temporary storage (48h)",
apiDocs: "/developer-reference/get-temporary-file-url",
usage: "bl file upload --file <path> --model <model>",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/image/edit.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -32,7 +32,6 @@ import {
export default defineCommand({
name: "image edit",
description: "Edit an existing image with text instructions (Qwen-Image)",
apiDocs: "/developer-reference/qwen-image-edit-api",
usage: "bl image edit --image <url> --prompt <text> [flags]",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/image/generate.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -43,7 +43,6 @@ function isSyncModel(model: string): boolean {
export default defineCommand({
name: "image generate",
description: "Generate images (Qwen-Image / wan2.x)",
apiDocs: "/best-practice/wanx/text-to-image",
usage: "bl image generate --prompt <text> [flags]",
options: [
{ flag: "--prompt <text>", description: "Image description", required: true },
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/omni/chat.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -44,7 +44,6 @@ function buildWavHeader(dataLength: number): Buffer {
export default defineCommand({
name: "omni",
description: "Multimodal chat with text + audio output (Qwen-Omni)",
apiDocs: "/model-studio/qwen-omni",
usage: "bl omni --message <text> [flags]",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/speech/recognize.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,6 @@ import { emitResult, emitBare } from "../../output/output.ts";
export default defineCommand({
name: "speech recognize",
description: "Recognize speech from audio files (FunAudio-ASR)",
apiDocs: "/developer-reference/recording-file-recognition",
usage: "bl speech recognize --url <audio-url> [flags]",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/speech/synthesize.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -144,7 +144,6 @@ function printVoiceList(model: string): void {
export default defineCommand({
name: "speech synthesize",
description: "Synthesize speech from text (CosyVoice TTS)",
apiDocs: "/developer-reference/cosyvoice",
usage: "bl speech synthesize --text <text> [flags]",
options: [
{ flag: "--text <text>", description: "Text to synthesize into speech", required: true },
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/text/chat.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -70,7 +70,6 @@ function parseMessages(flags: GlobalFlags): ParsedMessages {
export default defineCommand({
name: "text chat",
description: "Send a chat completion (OpenAI compatible, DashScope)",
apiDocs: "/compatibility-of-openai-with-dashscope",
usage: "bl text chat --message <text> [flags]",
options: [
{ flag: "--model <model>", description: "Model ID (default: qwen3.7-max)" },
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/video/edit.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,7 +31,6 @@ export default defineCommand({
name: "video edit",
description:
"Edit a video with happyhorse-1.0-video-edit (style transfer, object replacement, etc.)",
apiDocs: "/best-practice/wanx/video-edit",
usage: "bl video edit --video <url> --prompt <text> [flags]",
options: [
{ flag: "--model <model>", description: "Model ID (default: happyhorse-1.0-video-edit)" },
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/video/generate.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -44,7 +44,6 @@ export default defineCommand({
name: "video generate",
description:
"Generate a video from text or image (happyhorse-1.0-t2v / happyhorse-1.0-i2v / wan2.6-t2v)",
apiDocs: "/best-practice/wanx/text-to-video",
usage: "bl video generate --prompt <text> [--image <url>] [flags]",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/video/ref.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,7 +31,6 @@ export default defineCommand({
name: "video ref",
description:
"Reference-to-video generation (happyhorse-1.0-r2v / wan2.6-r2v): multi-subject, multi-shot with voice",
apiDocs: "/best-practice/wanx/video-reference",
usage: "bl video ref --prompt <text> --image <url>... [--ref-video <url>...] [flags]",
options: [
{ flag: "--model <model>", description: "Model ID (default: happyhorse-1.0-r2v)" },
Expand Down
24 changes: 3 additions & 21 deletions packages/cli/src/main.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,11 +3,9 @@ import { registry } from "./registry.ts";
import {
GLOBAL_OPTIONS,
loadConfig,
readConfigFile,
resolveCredential,
trackCommandExecution,
flushTelemetry,
type Region,
} from "bailian-cli-core";
import { ensureApiKey } from "./utils/ensure-key.ts";
import { handleError } from "./error-handler.ts";
Expand All@@ -22,13 +20,7 @@ import {
} from "./utils/command-help.ts";

registerCommandHelpPrinter((commandPath, out) => {
const a = process.argv.slice(2);
const ri = a.indexOf("--region");
const region = ((ri >= 0 && a[ri + 1]) ||
process.env.DASHSCOPE_REGION ||
readConfigFile().region ||
"cn") as Region;
registry.printHelp(commandPath, out, region);
registry.printHelp(commandPath, out);
});

// 优雅处理 Ctrl+C
Expand DownExpand Up@@ -84,12 +76,7 @@ async function main() {
const commandPath = scanCommandPath(argv, GLOBAL_OPTIONS);

if (argv.includes("--help") || argv.includes("-h")) {
const ri = argv.indexOf("--region");
const region = ((ri >= 0 && argv[ri + 1]) ||
process.env.DASHSCOPE_REGION ||
readConfigFile().region ||
"cn") as Region;
registry.printHelp(commandPath, process.stderr, region);
registry.printHelp(commandPath, process.stderr);
process.exit(0);
}

Expand All@@ -115,12 +102,7 @@ async function main() {

// 组路径(例如 `bl speech` 未接子命令):展示帮助后干净退出
if (registry.isGroupPath(commandPath)) {
const ri = argv.indexOf("--region");
const region = ((ri >= 0 && argv[ri + 1]) ||
process.env.DASHSCOPE_REGION ||
readConfigFile().region ||
"cn") as Region;
registry.printHelp(commandPath, process.stderr, region);
registry.printHelp(commandPath, process.stderr);
process.exit(0);
}

Expand Down
15 changes: 4 additions & 11 deletions packages/cli/src/registry.ts
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
import type { Command } from "bailian-cli-core";
import { BailianError } from "bailian-cli-core";
import { ExitCode } from "bailian-cli-core";
import { DOCS_HOSTS, GLOBAL_OPTIONS, type Region } from "bailian-cli-core";
import { GLOBAL_OPTIONS } from "bailian-cli-core";
import { commands } from "./commands/catalog.ts";

export type { Command, OptionDef } from "bailian-cli-core";
Expand DownExpand Up@@ -133,11 +133,7 @@ class CommandRegistry {
out.isTTY ? `\x1b[38;2;59;130;246m${s}\x1b[0m` : s;
private dim = (s: string, out: NodeJS.WriteStream) => (out.isTTY ? `\x1b[2m${s}\x1b[0m` : s);

printHelp(
commandPath: string[],
out: NodeJS.WriteStream = process.stdout,
region: Region = "cn",
): void {
printHelp(commandPath: string[], out: NodeJS.WriteStream = process.stdout): void {
if (commandPath.length === 0) {
this.printRootHelp(out);
return;
Expand All@@ -154,7 +150,7 @@ class CommandRegistry {
}

if (node.command) {
this.printCommandHelp(node.command, out, region);
this.printCommandHelp(node.command, out);
return;
}

Expand DownExpand Up@@ -233,7 +229,7 @@ ${b("Getting Help:")}
`);
}

private printCommandHelp(cmd: Command, out: NodeJS.WriteStream, region: Region = "cn"): void {
private printCommandHelp(cmd: Command, out: NodeJS.WriteStream): void {
const b = (s: string) => this.bold(s, out);
const a = (s: string) => this.accent(s, out);
const d = (s: string) => this.dim(s, out);
Expand All@@ -253,9 +249,6 @@ ${b("Getting Help:")}
out.write(` ${d(ex)}\n`);
}
}
if (cmd.apiDocs) {
out.write(`\n${b("API Reference:")} ${d(DOCS_HOSTS[region] + cmd.apiDocs)}\n`);
}
out.write(
`\n${d("Global flags (--api-key, --output, --quiet, etc.) are always available.")}\n`,
);
Expand Down
3 changes: 0 additions & 3 deletions packages/core/src/types/command.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,7 +14,6 @@ export interface Command {
usage?: string;
options?: OptionDef[];
examples?: string[];
apiDocs?: string;
execute: (config: Config, flags: GlobalFlags) => Promise<void>;
}

Expand All@@ -24,7 +23,6 @@ export interface CommandSpec {
usage?: string;
options?: OptionDef[];
examples?: string[];
apiDocs?: string;
run: (config: Config, flags: GlobalFlags) => Promise<void>;
}

Expand All@@ -35,7 +33,6 @@ export function defineCommand(spec: CommandSpec): Command {
usage: spec.usage,
options: spec.options,
examples: spec.examples,
apiDocs: spec.apiDocs,
execute: (config, flags) => spec.run(config, flags),
};
}
Expand Down
11 changes: 5 additions & 6 deletions skills/bailian-cli/reference/file.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,12 +15,11 @@ Index: [index.md](index.md)

### `bl file upload`

| Field | Value |
| --------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| **Name** | `file upload` |
| **Description** | Upload a local file to DashScope temporary storage (48h) |
| **Usage** | `bl file upload --file <path> --model <model>` |
| **API docs** | [/developer-reference/get-temporary-file-url](https://help.aliyun.com/zh/model-studio/developer-reference/get-temporary-file-url) |
| Field | Value |
| --------------- | -------------------------------------------------------- |
| **Name** | `file upload` |
| **Description** | Upload a local file to DashScope temporary storage (48h) |
| **Usage** | `bl file upload --file <path> --model <model>` |

#### Options

Expand Down
22 changes: 10 additions & 12 deletions skills/bailian-cli/reference/image.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,12 +16,11 @@ Index: [index.md](index.md)

### `bl image edit`

| Field | Value |
| --------------- | --------------------------------------------------------------------------------------------------------------------------- |
| **Name** | `image edit` |
| **Description** | Edit an existing image with text instructions (Qwen-Image) |
| **Usage** | `bl image edit --image <url> --prompt <text> [flags]` |
| **API docs** | [/developer-reference/qwen-image-edit-api](https://help.aliyun.com/zh/model-studio/developer-reference/qwen-image-edit-api) |
| Field | Value |
| --------------- | ---------------------------------------------------------- |
| **Name** | `image edit` |
| **Description** | Edit an existing image with text instructions (Qwen-Image) |
| **Usage** | `bl image edit --image <url> --prompt <text> [flags]` |

#### Options

Expand DownExpand Up@@ -63,12 +62,11 @@ bl image edit --image ./photo.png --prompt "把背景换成海滩" --watermark f

### `bl image generate`

| Field | Value |
| --------------- | ------------------------------------------------------------------------------------------------------------- |
| **Name** | `image generate` |
| **Description** | Generate images (Qwen-Image / wan2.x) |
| **Usage** | `bl image generate --prompt <text> [flags]` |
| **API docs** | [/best-practice/wanx/text-to-image](https://help.aliyun.com/zh/model-studio/best-practice/wanx/text-to-image) |
| Field | Value |
| --------------- | ------------------------------------------- |
| **Name** | `image generate` |
| **Description** | Generate images (Qwen-Image / wan2.x) |
| **Usage** | `bl image generate --prompt <text> [flags]` |

#### Options

Expand Down
11 changes: 5 additions & 6 deletions skills/bailian-cli/reference/omni.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,12 +15,11 @@ Index: [index.md](index.md)

### `bl omni`

| Field | Value |
| --------------- | ----------------------------------------------------------------------------------------- |
| **Name** | `omni` |
| **Description** | Multimodal chat with text + audio output (Qwen-Omni) |
| **Usage** | `bl omni --message <text> [flags]` |
| **API docs** | [/model-studio/qwen-omni](https://help.aliyun.com/zh/model-studio/model-studio/qwen-omni) |
| Field | Value |
| --------------- | ---------------------------------------------------- |
| **Name** | `omni` |
| **Description** | Multimodal chat with text + audio output (Qwen-Omni) |
| **Usage** | `bl omni --message <text> [flags]` |

#### Options

Expand Down
22 changes: 10 additions & 12 deletions skills/bailian-cli/reference/speech.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,12 +16,11 @@ Index: [index.md](index.md)

### `bl speech recognize`

| Field | Value |
| --------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| **Name** | `speech recognize` |
| **Description** | Recognize speech from audio files (FunAudio-ASR) |
| **Usage** | `bl speech recognize --url <audio-url> [flags]` |
| **API docs** | [/developer-reference/recording-file-recognition](https://help.aliyun.com/zh/model-studio/developer-reference/recording-file-recognition) |
| Field | Value |
| --------------- | ------------------------------------------------ |
| **Name** | `speech recognize` |
| **Description** | Recognize speech from audio files (FunAudio-ASR) |
| **Usage** | `bl speech recognize --url <audio-url> [flags]` |

#### Options

Expand DownExpand Up@@ -70,12 +69,11 @@ bl speech recognize --url https://example.com/audio.mp3 --no-wait --quiet

### `bl speech synthesize`

| Field | Value |
| --------------- | ------------------------------------------------------------------------------------------------------- |
| **Name** | `speech synthesize` |
| **Description** | Synthesize speech from text (CosyVoice TTS) |
| **Usage** | `bl speech synthesize --text <text> [flags]` |
| **API docs** | [/developer-reference/cosyvoice](https://help.aliyun.com/zh/model-studio/developer-reference/cosyvoice) |
| Field | Value |
| --------------- | -------------------------------------------- |
| **Name** | `speech synthesize` |
| **Description** | Synthesize speech from text (CosyVoice TTS) |
| **Usage** | `bl speech synthesize --text <text> [flags]` |

#### Options

Expand Down
11 changes: 5 additions & 6 deletions skills/bailian-cli/reference/text.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,12 +15,11 @@ Index: [index.md](index.md)

### `bl text chat`

| Field | Value |
| --------------- | ------------------------------------------------------------------------------------------------------------------------- |
| **Name** | `text chat` |
| **Description** | Send a chat completion (OpenAI compatible, DashScope) |
| **Usage** | `bl text chat --message <text> [flags]` |
| **API docs** | [/compatibility-of-openai-with-dashscope](https://help.aliyun.com/zh/model-studio/compatibility-of-openai-with-dashscope) |
| Field | Value |
| --------------- | ----------------------------------------------------- |
| **Name** | `text chat` |
| **Description** | Send a chat completion (OpenAI compatible, DashScope) |
| **Usage** | `bl text chat --message <text> [flags]` |

#### Options

Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/agents/branch-merge-review.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -57,7 +57,7 @@ git diff --name-only <base>...<head>
- [ ] **新命令 / 新 flag** 已同步到用户面文档:
- [README.md](README.md) + [README.zh.md](README.zh.md)(中英文都要,常漏 `_CN`)
- (SKILL.md 已迁出本仓库,由 `npx add skills` 机制独立维护,不在本仓库 review 范围)
- [ ] **`bl <cmd> --help`** 文案完整:`description` / `examples` / `apiDocs` 都填了
- [ ] **`bl <cmd> --help`** 文案完整:`description` / `examples` 都填了
- [ ] **demo / quickstart**:用户可调用的新命令至少有一个示例
- [ ] **行为变化的老命令**:在 commit message / CHANGELOG 注明用户感知的差异
- [ ] **错误信息 / 提示文案**:面向用户的字符串通顺、双语(项目主体是中文场景)
Expand Down
3 changes: 1 addition & 2 deletions docs/agents/command-add-remove.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,7 +27,7 @@
命令元数据以 **`catalog.ts` 为单一登记处**;`registry.ts` 只负责解析与打印 help,不再内嵌命令表或手写 Resources 列表。

```
commands/<...>.ts defineCommand({ name, description, usage, options, examples, apiDocs?, run })
commands/<...>.ts defineCommand({ name, description, usage, options, examples, run })
commands/catalog.ts export const commands: Record<string, Command>
Expand All@@ -53,7 +53,6 @@ registry.ts main.ts tools/generate-reference.ts export-schema.ts
- 增删 `import xxx from "./.../xxx.ts"`
- 在 `export const commands` 里增删 `"<group> <action>": xxx`(key 与 `defineCommand({ name })` 一致)
- [ ] **不要**在 `registry.ts` 里重复登记命令(已从 catalog 读取)
- [ ] 命令需在 `bl help` / `reference/` 展示 API 文档链接时,在 `defineCommand` 里设 `apiDocs`(相对路径);help 与 reference 均从此字段生成
- [ ] 如果命令需要鉴权之外的特殊路径,看 `packages/cli/src/main.ts` 的 `NO_AUTH_SETUP`
- [ ] **`config/export-schema.ts`**: 若新命令不适合作为 agent tool,评估是否加入 `SKIP_PREFIXES`;该文件在 `run()` 内 `import("../catalog.ts")`,勿顶层 import catalog 以免循环依赖

Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/file/upload.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,6 @@ import { emitResult, emitBare } from "../../output/output.ts";
export default defineCommand({
name: "file upload",
description: "Upload a local file to DashScope temporary storage (48h)",
apiDocs: "/developer-reference/get-temporary-file-url",
usage: "bl file upload --file <path> --model <model>",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/image/edit.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -32,7 +32,6 @@ import {
export default defineCommand({
name: "image edit",
description: "Edit an existing image with text instructions (Qwen-Image)",
apiDocs: "/developer-reference/qwen-image-edit-api",
usage: "bl image edit --image <url> --prompt <text> [flags]",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/image/generate.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -43,7 +43,6 @@ function isSyncModel(model: string): boolean {
export default defineCommand({
name: "image generate",
description: "Generate images (Qwen-Image / wan2.x)",
apiDocs: "/best-practice/wanx/text-to-image",
usage: "bl image generate --prompt <text> [flags]",
options: [
{ flag: "--prompt <text>", description: "Image description", required: true },
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/omni/chat.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -44,7 +44,6 @@ function buildWavHeader(dataLength: number): Buffer {
export default defineCommand({
name: "omni",
description: "Multimodal chat with text + audio output (Qwen-Omni)",
apiDocs: "/model-studio/qwen-omni",
usage: "bl omni --message <text> [flags]",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/speech/recognize.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,6 @@ import { emitResult, emitBare } from "../../output/output.ts";
export default defineCommand({
name: "speech recognize",
description: "Recognize speech from audio files (FunAudio-ASR)",
apiDocs: "/developer-reference/recording-file-recognition",
usage: "bl speech recognize --url <audio-url> [flags]",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/speech/synthesize.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -144,7 +144,6 @@ function printVoiceList(model: string): void {
export default defineCommand({
name: "speech synthesize",
description: "Synthesize speech from text (CosyVoice TTS)",
apiDocs: "/developer-reference/cosyvoice",
usage: "bl speech synthesize --text <text> [flags]",
options: [
{ flag: "--text <text>", description: "Text to synthesize into speech", required: true },
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/text/chat.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -70,7 +70,6 @@ function parseMessages(flags: GlobalFlags): ParsedMessages {
export default defineCommand({
name: "text chat",
description: "Send a chat completion (OpenAI compatible, DashScope)",
apiDocs: "/compatibility-of-openai-with-dashscope",
usage: "bl text chat --message <text> [flags]",
options: [
{ flag: "--model <model>", description: "Model ID (default: qwen3.7-max)" },
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/video/edit.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,7 +31,6 @@ export default defineCommand({
name: "video edit",
description:
"Edit a video with happyhorse-1.0-video-edit (style transfer, object replacement, etc.)",
apiDocs: "/best-practice/wanx/video-edit",
usage: "bl video edit --video <url> --prompt <text> [flags]",
options: [
{ flag: "--model <model>", description: "Model ID (default: happyhorse-1.0-video-edit)" },
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/video/generate.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -44,7 +44,6 @@ export default defineCommand({
name: "video generate",
description:
"Generate a video from text or image (happyhorse-1.0-t2v / happyhorse-1.0-i2v / wan2.6-t2v)",
apiDocs: "/best-practice/wanx/text-to-video",
usage: "bl video generate --prompt <text> [--image <url>] [flags]",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/video/ref.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,7 +31,6 @@ export default defineCommand({
name: "video ref",
description:
"Reference-to-video generation (happyhorse-1.0-r2v / wan2.6-r2v): multi-subject, multi-shot with voice",
apiDocs: "/best-practice/wanx/video-reference",
usage: "bl video ref --prompt <text> --image <url>... [--ref-video <url>...] [flags]",
options: [
{ flag: "--model <model>", description: "Model ID (default: happyhorse-1.0-r2v)" },
Expand Down
24 changes: 3 additions & 21 deletions packages/cli/src/main.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,11 +3,9 @@ import { registry } from "./registry.ts";
import {
GLOBAL_OPTIONS,
loadConfig,
readConfigFile,
resolveCredential,
trackCommandExecution,
flushTelemetry,
type Region,
} from "bailian-cli-core";
import { ensureApiKey } from "./utils/ensure-key.ts";
import { handleError } from "./error-handler.ts";
Expand All@@ -22,13 +20,7 @@ import {
} from "./utils/command-help.ts";

registerCommandHelpPrinter((commandPath, out) => {
const a = process.argv.slice(2);
const ri = a.indexOf("--region");
const region = ((ri >= 0 && a[ri + 1]) ||
process.env.DASHSCOPE_REGION ||
readConfigFile().region ||
"cn") as Region;
registry.printHelp(commandPath, out, region);
registry.printHelp(commandPath, out);
});

// 优雅处理 Ctrl+C
Expand DownExpand Up@@ -84,12 +76,7 @@ async function main() {
const commandPath = scanCommandPath(argv, GLOBAL_OPTIONS);

if (argv.includes("--help") || argv.includes("-h")) {
const ri = argv.indexOf("--region");
const region = ((ri >= 0 && argv[ri + 1]) ||
process.env.DASHSCOPE_REGION ||
readConfigFile().region ||
"cn") as Region;
registry.printHelp(commandPath, process.stderr, region);
registry.printHelp(commandPath, process.stderr);
process.exit(0);
}

Expand All@@ -115,12 +102,7 @@ async function main() {

// 组路径(例如 `bl speech` 未接子命令):展示帮助后干净退出
if (registry.isGroupPath(commandPath)) {
const ri = argv.indexOf("--region");
const region = ((ri >= 0 && argv[ri + 1]) ||
process.env.DASHSCOPE_REGION ||
readConfigFile().region ||
"cn") as Region;
registry.printHelp(commandPath, process.stderr, region);
registry.printHelp(commandPath, process.stderr);
process.exit(0);
}

Expand Down
15 changes: 4 additions & 11 deletions packages/cli/src/registry.ts
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
import type { Command } from "bailian-cli-core";
import { BailianError } from "bailian-cli-core";
import { ExitCode } from "bailian-cli-core";
import { DOCS_HOSTS, GLOBAL_OPTIONS, type Region } from "bailian-cli-core";
import { GLOBAL_OPTIONS } from "bailian-cli-core";
import { commands } from "./commands/catalog.ts";

export type { Command, OptionDef } from "bailian-cli-core";
Expand DownExpand Up@@ -133,11 +133,7 @@ class CommandRegistry {
out.isTTY ? `\x1b[38;2;59;130;246m${s}\x1b[0m` : s;
private dim = (s: string, out: NodeJS.WriteStream) => (out.isTTY ? `\x1b[2m${s}\x1b[0m` : s);

printHelp(
commandPath: string[],
out: NodeJS.WriteStream = process.stdout,
region: Region = "cn",
): void {
printHelp(commandPath: string[], out: NodeJS.WriteStream = process.stdout): void {
if (commandPath.length === 0) {
this.printRootHelp(out);
return;
Expand All@@ -154,7 +150,7 @@ class CommandRegistry {
}

if (node.command) {
this.printCommandHelp(node.command, out, region);
this.printCommandHelp(node.command, out);
return;
}

Expand DownExpand Up@@ -233,7 +229,7 @@ ${b("Getting Help:")}
`);
}

private printCommandHelp(cmd: Command, out: NodeJS.WriteStream, region: Region = "cn"): void {
private printCommandHelp(cmd: Command, out: NodeJS.WriteStream): void {
const b = (s: string) => this.bold(s, out);
const a = (s: string) => this.accent(s, out);
const d = (s: string) => this.dim(s, out);
Expand All@@ -253,9 +249,6 @@ ${b("Getting Help:")}
out.write(` ${d(ex)}\n`);
}
}
if (cmd.apiDocs) {
out.write(`\n${b("API Reference:")} ${d(DOCS_HOSTS[region] + cmd.apiDocs)}\n`);
}
out.write(
`\n${d("Global flags (--api-key, --output, --quiet, etc.) are always available.")}\n`,
);
Expand Down
3 changes: 0 additions & 3 deletions packages/core/src/types/command.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,7 +14,6 @@ export interface Command {
usage?: string;
options?: OptionDef[];
examples?: string[];
apiDocs?: string;
execute: (config: Config, flags: GlobalFlags) => Promise<void>;
}

Expand All@@ -24,7 +23,6 @@ export interface CommandSpec {
usage?: string;
options?: OptionDef[];
examples?: string[];
apiDocs?: string;
run: (config: Config, flags: GlobalFlags) => Promise<void>;
}

Expand All@@ -35,7 +33,6 @@ export function defineCommand(spec: CommandSpec): Command {
usage: spec.usage,
options: spec.options,
examples: spec.examples,
apiDocs: spec.apiDocs,
execute: (config, flags) => spec.run(config, flags),
};
}
Expand Down
11 changes: 5 additions & 6 deletions skills/bailian-cli/reference/file.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,12 +15,11 @@ Index: [index.md](index.md)

### `bl file upload`

| Field | Value |
| --------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| **Name** | `file upload` |
| **Description** | Upload a local file to DashScope temporary storage (48h) |
| **Usage** | `bl file upload --file <path> --model <model>` |
| **API docs** | [/developer-reference/get-temporary-file-url](https://help.aliyun.com/zh/model-studio/developer-reference/get-temporary-file-url) |
| Field | Value |
| --------------- | -------------------------------------------------------- |
| **Name** | `file upload` |
| **Description** | Upload a local file to DashScope temporary storage (48h) |
| **Usage** | `bl file upload --file <path> --model <model>` |

#### Options

Expand Down
22 changes: 10 additions & 12 deletions skills/bailian-cli/reference/image.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,12 +16,11 @@ Index: [index.md](index.md)

### `bl image edit`

| Field | Value |
| --------------- | --------------------------------------------------------------------------------------------------------------------------- |
| **Name** | `image edit` |
| **Description** | Edit an existing image with text instructions (Qwen-Image) |
| **Usage** | `bl image edit --image <url> --prompt <text> [flags]` |
| **API docs** | [/developer-reference/qwen-image-edit-api](https://help.aliyun.com/zh/model-studio/developer-reference/qwen-image-edit-api) |
| Field | Value |
| --------------- | ---------------------------------------------------------- |
| **Name** | `image edit` |
| **Description** | Edit an existing image with text instructions (Qwen-Image) |
| **Usage** | `bl image edit --image <url> --prompt <text> [flags]` |

#### Options

Expand DownExpand Up@@ -63,12 +62,11 @@ bl image edit --image ./photo.png --prompt "把背景换成海滩" --watermark f

### `bl image generate`

| Field | Value |
| --------------- | ------------------------------------------------------------------------------------------------------------- |
| **Name** | `image generate` |
| **Description** | Generate images (Qwen-Image / wan2.x) |
| **Usage** | `bl image generate --prompt <text> [flags]` |
| **API docs** | [/best-practice/wanx/text-to-image](https://help.aliyun.com/zh/model-studio/best-practice/wanx/text-to-image) |
| Field | Value |
| --------------- | ------------------------------------------- |
| **Name** | `image generate` |
| **Description** | Generate images (Qwen-Image / wan2.x) |
| **Usage** | `bl image generate --prompt <text> [flags]` |

#### Options

Expand Down
11 changes: 5 additions & 6 deletions skills/bailian-cli/reference/omni.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,12 +15,11 @@ Index: [index.md](index.md)

### `bl omni`

| Field | Value |
| --------------- | ----------------------------------------------------------------------------------------- |
| **Name** | `omni` |
| **Description** | Multimodal chat with text + audio output (Qwen-Omni) |
| **Usage** | `bl omni --message <text> [flags]` |
| **API docs** | [/model-studio/qwen-omni](https://help.aliyun.com/zh/model-studio/model-studio/qwen-omni) |
| Field | Value |
| --------------- | ---------------------------------------------------- |
| **Name** | `omni` |
| **Description** | Multimodal chat with text + audio output (Qwen-Omni) |
| **Usage** | `bl omni --message <text> [flags]` |

#### Options

Expand Down
22 changes: 10 additions & 12 deletions skills/bailian-cli/reference/speech.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,12 +16,11 @@ Index: [index.md](index.md)

### `bl speech recognize`

| Field | Value |
| --------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| **Name** | `speech recognize` |
| **Description** | Recognize speech from audio files (FunAudio-ASR) |
| **Usage** | `bl speech recognize --url <audio-url> [flags]` |
| **API docs** | [/developer-reference/recording-file-recognition](https://help.aliyun.com/zh/model-studio/developer-reference/recording-file-recognition) |
| Field | Value |
| --------------- | ------------------------------------------------ |
| **Name** | `speech recognize` |
| **Description** | Recognize speech from audio files (FunAudio-ASR) |
| **Usage** | `bl speech recognize --url <audio-url> [flags]` |

#### Options

Expand DownExpand Up@@ -70,12 +69,11 @@ bl speech recognize --url https://example.com/audio.mp3 --no-wait --quiet

### `bl speech synthesize`

| Field | Value |
| --------------- | ------------------------------------------------------------------------------------------------------- |
| **Name** | `speech synthesize` |
| **Description** | Synthesize speech from text (CosyVoice TTS) |
| **Usage** | `bl speech synthesize --text <text> [flags]` |
| **API docs** | [/developer-reference/cosyvoice](https://help.aliyun.com/zh/model-studio/developer-reference/cosyvoice) |
| Field | Value |
| --------------- | -------------------------------------------- |
| **Name** | `speech synthesize` |
| **Description** | Synthesize speech from text (CosyVoice TTS) |
| **Usage** | `bl speech synthesize --text <text> [flags]` |

#### Options

Expand Down
11 changes: 5 additions & 6 deletions skills/bailian-cli/reference/text.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,12 +15,11 @@ Index: [index.md](index.md)

### `bl text chat`

| Field | Value |
| --------------- | ------------------------------------------------------------------------------------------------------------------------- |
| **Name** | `text chat` |
| **Description** | Send a chat completion (OpenAI compatible, DashScope) |
| **Usage** | `bl text chat --message <text> [flags]` |
| **API docs** | [/compatibility-of-openai-with-dashscope](https://help.aliyun.com/zh/model-studio/compatibility-of-openai-with-dashscope) |
| Field | Value |
| --------------- | ----------------------------------------------------- |
| **Name** | `text chat` |
| **Description** | Send a chat completion (OpenAI compatible, DashScope) |
| **Usage** | `bl text chat --message <text> [flags]` |

#### Options

Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/agents/branch-merge-review.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -57,7 +57,7 @@ git diff --name-only <base>...<head>
- [ ] **新命令 / 新 flag** 已同步到用户面文档:
- [README.md](README.md) + [README.zh.md](README.zh.md)(中英文都要,常漏 `_CN`)
- (SKILL.md 已迁出本仓库,由 `npx add skills` 机制独立维护,不在本仓库 review 范围)
- [ ] **`bl <cmd> --help`** 文案完整:`description` / `examples` / `apiDocs` 都填了
- [ ] **`bl <cmd> --help`** 文案完整:`description` / `examples` 都填了
- [ ] **demo / quickstart**:用户可调用的新命令至少有一个示例
- [ ] **行为变化的老命令**:在 commit message / CHANGELOG 注明用户感知的差异
- [ ] **错误信息 / 提示文案**:面向用户的字符串通顺、双语(项目主体是中文场景)
Expand Down
3 changes: 1 addition & 2 deletions docs/agents/command-add-remove.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,7 +27,7 @@
命令元数据以 **`catalog.ts` 为单一登记处**;`registry.ts` 只负责解析与打印 help,不再内嵌命令表或手写 Resources 列表。

```
commands/<...>.ts defineCommand({ name, description, usage, options, examples, apiDocs?, run })
commands/<...>.ts defineCommand({ name, description, usage, options, examples, run })
commands/catalog.ts export const commands: Record<string, Command>
Expand All@@ -53,7 +53,6 @@ registry.ts main.ts tools/generate-reference.ts export-schema.ts
- 增删 `import xxx from "./.../xxx.ts"`
- 在 `export const commands` 里增删 `"<group> <action>": xxx`(key 与 `defineCommand({ name })` 一致)
- [ ] **不要**在 `registry.ts` 里重复登记命令(已从 catalog 读取)
- [ ] 命令需在 `bl help` / `reference/` 展示 API 文档链接时,在 `defineCommand` 里设 `apiDocs`(相对路径);help 与 reference 均从此字段生成
- [ ] 如果命令需要鉴权之外的特殊路径,看 `packages/cli/src/main.ts` 的 `NO_AUTH_SETUP`
- [ ] **`config/export-schema.ts`**: 若新命令不适合作为 agent tool,评估是否加入 `SKIP_PREFIXES`;该文件在 `run()` 内 `import("../catalog.ts")`,勿顶层 import catalog 以免循环依赖

Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/file/upload.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,6 @@ import { emitResult, emitBare } from "../../output/output.ts";
export default defineCommand({
name: "file upload",
description: "Upload a local file to DashScope temporary storage (48h)",
apiDocs: "/developer-reference/get-temporary-file-url",
usage: "bl file upload --file <path> --model <model>",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/image/edit.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -32,7 +32,6 @@ import {
export default defineCommand({
name: "image edit",
description: "Edit an existing image with text instructions (Qwen-Image)",
apiDocs: "/developer-reference/qwen-image-edit-api",
usage: "bl image edit --image <url> --prompt <text> [flags]",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/image/generate.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -43,7 +43,6 @@ function isSyncModel(model: string): boolean {
export default defineCommand({
name: "image generate",
description: "Generate images (Qwen-Image / wan2.x)",
apiDocs: "/best-practice/wanx/text-to-image",
usage: "bl image generate --prompt <text> [flags]",
options: [
{ flag: "--prompt <text>", description: "Image description", required: true },
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/omni/chat.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -44,7 +44,6 @@ function buildWavHeader(dataLength: number): Buffer {
export default defineCommand({
name: "omni",
description: "Multimodal chat with text + audio output (Qwen-Omni)",
apiDocs: "/model-studio/qwen-omni",
usage: "bl omni --message <text> [flags]",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/speech/recognize.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,6 @@ import { emitResult, emitBare } from "../../output/output.ts";
export default defineCommand({
name: "speech recognize",
description: "Recognize speech from audio files (FunAudio-ASR)",
apiDocs: "/developer-reference/recording-file-recognition",
usage: "bl speech recognize --url <audio-url> [flags]",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/speech/synthesize.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -144,7 +144,6 @@ function printVoiceList(model: string): void {
export default defineCommand({
name: "speech synthesize",
description: "Synthesize speech from text (CosyVoice TTS)",
apiDocs: "/developer-reference/cosyvoice",
usage: "bl speech synthesize --text <text> [flags]",
options: [
{ flag: "--text <text>", description: "Text to synthesize into speech", required: true },
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/text/chat.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -70,7 +70,6 @@ function parseMessages(flags: GlobalFlags): ParsedMessages {
export default defineCommand({
name: "text chat",
description: "Send a chat completion (OpenAI compatible, DashScope)",
apiDocs: "/compatibility-of-openai-with-dashscope",
usage: "bl text chat --message <text> [flags]",
options: [
{ flag: "--model <model>", description: "Model ID (default: qwen3.7-max)" },
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/video/edit.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,7 +31,6 @@ export default defineCommand({
name: "video edit",
description:
"Edit a video with happyhorse-1.0-video-edit (style transfer, object replacement, etc.)",
apiDocs: "/best-practice/wanx/video-edit",
usage: "bl video edit --video <url> --prompt <text> [flags]",
options: [
{ flag: "--model <model>", description: "Model ID (default: happyhorse-1.0-video-edit)" },
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/video/generate.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -44,7 +44,6 @@ export default defineCommand({
name: "video generate",
description:
"Generate a video from text or image (happyhorse-1.0-t2v / happyhorse-1.0-i2v / wan2.6-t2v)",
apiDocs: "/best-practice/wanx/text-to-video",
usage: "bl video generate --prompt <text> [--image <url>] [flags]",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/video/ref.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,7 +31,6 @@ export default defineCommand({
name: "video ref",
description:
"Reference-to-video generation (happyhorse-1.0-r2v / wan2.6-r2v): multi-subject, multi-shot with voice",
apiDocs: "/best-practice/wanx/video-reference",
usage: "bl video ref --prompt <text> --image <url>... [--ref-video <url>...] [flags]",
options: [
{ flag: "--model <model>", description: "Model ID (default: happyhorse-1.0-r2v)" },
Expand Down
24 changes: 3 additions & 21 deletions packages/cli/src/main.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,11 +3,9 @@ import { registry } from "./registry.ts";
import {
GLOBAL_OPTIONS,
loadConfig,
readConfigFile,
resolveCredential,
trackCommandExecution,
flushTelemetry,
type Region,
} from "bailian-cli-core";
import { ensureApiKey } from "./utils/ensure-key.ts";
import { handleError } from "./error-handler.ts";
Expand All@@ -22,13 +20,7 @@ import {
} from "./utils/command-help.ts";

registerCommandHelpPrinter((commandPath, out) => {
const a = process.argv.slice(2);
const ri = a.indexOf("--region");
const region = ((ri >= 0 && a[ri + 1]) ||
process.env.DASHSCOPE_REGION ||
readConfigFile().region ||
"cn") as Region;
registry.printHelp(commandPath, out, region);
registry.printHelp(commandPath, out);
});

// 优雅处理 Ctrl+C
Expand DownExpand Up@@ -84,12 +76,7 @@ async function main() {
const commandPath = scanCommandPath(argv, GLOBAL_OPTIONS);

if (argv.includes("--help") || argv.includes("-h")) {
const ri = argv.indexOf("--region");
const region = ((ri >= 0 && argv[ri + 1]) ||
process.env.DASHSCOPE_REGION ||
readConfigFile().region ||
"cn") as Region;
registry.printHelp(commandPath, process.stderr, region);
registry.printHelp(commandPath, process.stderr);
process.exit(0);
}

Expand All@@ -115,12 +102,7 @@ async function main() {

// 组路径(例如 `bl speech` 未接子命令):展示帮助后干净退出
if (registry.isGroupPath(commandPath)) {
const ri = argv.indexOf("--region");
const region = ((ri >= 0 && argv[ri + 1]) ||
process.env.DASHSCOPE_REGION ||
readConfigFile().region ||
"cn") as Region;
registry.printHelp(commandPath, process.stderr, region);
registry.printHelp(commandPath, process.stderr);
process.exit(0);
}

Expand Down
15 changes: 4 additions & 11 deletions packages/cli/src/registry.ts
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
import type { Command } from "bailian-cli-core";
import { BailianError } from "bailian-cli-core";
import { ExitCode } from "bailian-cli-core";
import { DOCS_HOSTS, GLOBAL_OPTIONS, type Region } from "bailian-cli-core";
import { GLOBAL_OPTIONS } from "bailian-cli-core";
import { commands } from "./commands/catalog.ts";

export type { Command, OptionDef } from "bailian-cli-core";
Expand DownExpand Up@@ -133,11 +133,7 @@ class CommandRegistry {
out.isTTY ? `\x1b[38;2;59;130;246m${s}\x1b[0m` : s;
private dim = (s: string, out: NodeJS.WriteStream) => (out.isTTY ? `\x1b[2m${s}\x1b[0m` : s);

printHelp(
commandPath: string[],
out: NodeJS.WriteStream = process.stdout,
region: Region = "cn",
): void {
printHelp(commandPath: string[], out: NodeJS.WriteStream = process.stdout): void {
if (commandPath.length === 0) {
this.printRootHelp(out);
return;
Expand All@@ -154,7 +150,7 @@ class CommandRegistry {
}

if (node.command) {
this.printCommandHelp(node.command, out, region);
this.printCommandHelp(node.command, out);
return;
}

Expand DownExpand Up@@ -233,7 +229,7 @@ ${b("Getting Help:")}
`);
}

private printCommandHelp(cmd: Command, out: NodeJS.WriteStream, region: Region = "cn"): void {
private printCommandHelp(cmd: Command, out: NodeJS.WriteStream): void {
const b = (s: string) => this.bold(s, out);
const a = (s: string) => this.accent(s, out);
const d = (s: string) => this.dim(s, out);
Expand All@@ -253,9 +249,6 @@ ${b("Getting Help:")}
out.write(` ${d(ex)}\n`);
}
}
if (cmd.apiDocs) {
out.write(`\n${b("API Reference:")} ${d(DOCS_HOSTS[region] + cmd.apiDocs)}\n`);
}
out.write(
`\n${d("Global flags (--api-key, --output, --quiet, etc.) are always available.")}\n`,
);
Expand Down
3 changes: 0 additions & 3 deletions packages/core/src/types/command.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,7 +14,6 @@ export interface Command {
usage?: string;
options?: OptionDef[];
examples?: string[];
apiDocs?: string;
execute: (config: Config, flags: GlobalFlags) => Promise<void>;
}

Expand All@@ -24,7 +23,6 @@ export interface CommandSpec {
usage?: string;
options?: OptionDef[];
examples?: string[];
apiDocs?: string;
run: (config: Config, flags: GlobalFlags) => Promise<void>;
}

Expand All@@ -35,7 +33,6 @@ export function defineCommand(spec: CommandSpec): Command {
usage: spec.usage,
options: spec.options,
examples: spec.examples,
apiDocs: spec.apiDocs,
execute: (config, flags) => spec.run(config, flags),
};
}
Expand Down
11 changes: 5 additions & 6 deletions skills/bailian-cli/reference/file.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,12 +15,11 @@ Index: [index.md](index.md)

### `bl file upload`

| Field | Value |
| --------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| **Name** | `file upload` |
| **Description** | Upload a local file to DashScope temporary storage (48h) |
| **Usage** | `bl file upload --file <path> --model <model>` |
| **API docs** | [/developer-reference/get-temporary-file-url](https://help.aliyun.com/zh/model-studio/developer-reference/get-temporary-file-url) |
| Field | Value |
| --------------- | -------------------------------------------------------- |
| **Name** | `file upload` |
| **Description** | Upload a local file to DashScope temporary storage (48h) |
| **Usage** | `bl file upload --file <path> --model <model>` |

#### Options

Expand Down
22 changes: 10 additions & 12 deletions skills/bailian-cli/reference/image.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,12 +16,11 @@ Index: [index.md](index.md)

### `bl image edit`

| Field | Value |
| --------------- | --------------------------------------------------------------------------------------------------------------------------- |
| **Name** | `image edit` |
| **Description** | Edit an existing image with text instructions (Qwen-Image) |
| **Usage** | `bl image edit --image <url> --prompt <text> [flags]` |
| **API docs** | [/developer-reference/qwen-image-edit-api](https://help.aliyun.com/zh/model-studio/developer-reference/qwen-image-edit-api) |
| Field | Value |
| --------------- | ---------------------------------------------------------- |
| **Name** | `image edit` |
| **Description** | Edit an existing image with text instructions (Qwen-Image) |
| **Usage** | `bl image edit --image <url> --prompt <text> [flags]` |

#### Options

Expand DownExpand Up@@ -63,12 +62,11 @@ bl image edit --image ./photo.png --prompt "把背景换成海滩" --watermark f

### `bl image generate`

| Field | Value |
| --------------- | ------------------------------------------------------------------------------------------------------------- |
| **Name** | `image generate` |
| **Description** | Generate images (Qwen-Image / wan2.x) |
| **Usage** | `bl image generate --prompt <text> [flags]` |
| **API docs** | [/best-practice/wanx/text-to-image](https://help.aliyun.com/zh/model-studio/best-practice/wanx/text-to-image) |
| Field | Value |
| --------------- | ------------------------------------------- |
| **Name** | `image generate` |
| **Description** | Generate images (Qwen-Image / wan2.x) |
| **Usage** | `bl image generate --prompt <text> [flags]` |

#### Options

Expand Down
11 changes: 5 additions & 6 deletions skills/bailian-cli/reference/omni.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,12 +15,11 @@ Index: [index.md](index.md)

### `bl omni`

| Field | Value |
| --------------- | ----------------------------------------------------------------------------------------- |
| **Name** | `omni` |
| **Description** | Multimodal chat with text + audio output (Qwen-Omni) |
| **Usage** | `bl omni --message <text> [flags]` |
| **API docs** | [/model-studio/qwen-omni](https://help.aliyun.com/zh/model-studio/model-studio/qwen-omni) |
| Field | Value |
| --------------- | ---------------------------------------------------- |
| **Name** | `omni` |
| **Description** | Multimodal chat with text + audio output (Qwen-Omni) |
| **Usage** | `bl omni --message <text> [flags]` |

#### Options

Expand Down
22 changes: 10 additions & 12 deletions skills/bailian-cli/reference/speech.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,12 +16,11 @@ Index: [index.md](index.md)

### `bl speech recognize`

| Field | Value |
| --------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| **Name** | `speech recognize` |
| **Description** | Recognize speech from audio files (FunAudio-ASR) |
| **Usage** | `bl speech recognize --url <audio-url> [flags]` |
| **API docs** | [/developer-reference/recording-file-recognition](https://help.aliyun.com/zh/model-studio/developer-reference/recording-file-recognition) |
| Field | Value |
| --------------- | ------------------------------------------------ |
| **Name** | `speech recognize` |
| **Description** | Recognize speech from audio files (FunAudio-ASR) |
| **Usage** | `bl speech recognize --url <audio-url> [flags]` |

#### Options

Expand DownExpand Up@@ -70,12 +69,11 @@ bl speech recognize --url https://example.com/audio.mp3 --no-wait --quiet

### `bl speech synthesize`

| Field | Value |
| --------------- | ------------------------------------------------------------------------------------------------------- |
| **Name** | `speech synthesize` |
| **Description** | Synthesize speech from text (CosyVoice TTS) |
| **Usage** | `bl speech synthesize --text <text> [flags]` |
| **API docs** | [/developer-reference/cosyvoice](https://help.aliyun.com/zh/model-studio/developer-reference/cosyvoice) |
| Field | Value |
| --------------- | -------------------------------------------- |
| **Name** | `speech synthesize` |
| **Description** | Synthesize speech from text (CosyVoice TTS) |
| **Usage** | `bl speech synthesize --text <text> [flags]` |

#### Options

Expand Down
11 changes: 5 additions & 6 deletions skills/bailian-cli/reference/text.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,12 +15,11 @@ Index: [index.md](index.md)

### `bl text chat`

| Field | Value |
| --------------- | ------------------------------------------------------------------------------------------------------------------------- |
| **Name** | `text chat` |
| **Description** | Send a chat completion (OpenAI compatible, DashScope) |
| **Usage** | `bl text chat --message <text> [flags]` |
| **API docs** | [/compatibility-of-openai-with-dashscope](https://help.aliyun.com/zh/model-studio/compatibility-of-openai-with-dashscope) |
| Field | Value |
| --------------- | ----------------------------------------------------- |
| **Name** | `text chat` |
| **Description** | Send a chat completion (OpenAI compatible, DashScope) |
| **Usage** | `bl text chat --message <text> [flags]` |

#### Options

Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/agents/branch-merge-review.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -57,7 +57,7 @@ git diff --name-only <base>...<head>
- [ ] **新命令 / 新 flag** 已同步到用户面文档:
- [README.md](README.md) + [README.zh.md](README.zh.md)(中英文都要,常漏 `_CN`)
- (SKILL.md 已迁出本仓库,由 `npx add skills` 机制独立维护,不在本仓库 review 范围)
- [ ] **`bl <cmd> --help`** 文案完整:`description` / `examples` / `apiDocs` 都填了
- [ ] **`bl <cmd> --help`** 文案完整:`description` / `examples` 都填了
- [ ] **demo / quickstart**:用户可调用的新命令至少有一个示例
- [ ] **行为变化的老命令**:在 commit message / CHANGELOG 注明用户感知的差异
- [ ] **错误信息 / 提示文案**:面向用户的字符串通顺、双语(项目主体是中文场景)
Expand Down
3 changes: 1 addition & 2 deletions docs/agents/command-add-remove.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,7 +27,7 @@
命令元数据以 **`catalog.ts` 为单一登记处**;`registry.ts` 只负责解析与打印 help,不再内嵌命令表或手写 Resources 列表。

```
commands/<...>.ts defineCommand({ name, description, usage, options, examples, apiDocs?, run })
commands/<...>.ts defineCommand({ name, description, usage, options, examples, run })
commands/catalog.ts export const commands: Record<string, Command>
Expand All@@ -53,7 +53,6 @@ registry.ts main.ts tools/generate-reference.ts export-schema.ts
- 增删 `import xxx from "./.../xxx.ts"`
- 在 `export const commands` 里增删 `"<group> <action>": xxx`(key 与 `defineCommand({ name })` 一致)
- [ ] **不要**在 `registry.ts` 里重复登记命令(已从 catalog 读取)
- [ ] 命令需在 `bl help` / `reference/` 展示 API 文档链接时,在 `defineCommand` 里设 `apiDocs`(相对路径);help 与 reference 均从此字段生成
- [ ] 如果命令需要鉴权之外的特殊路径,看 `packages/cli/src/main.ts` 的 `NO_AUTH_SETUP`
- [ ] **`config/export-schema.ts`**: 若新命令不适合作为 agent tool,评估是否加入 `SKIP_PREFIXES`;该文件在 `run()` 内 `import("../catalog.ts")`,勿顶层 import catalog 以免循环依赖

Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/file/upload.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,6 @@ import { emitResult, emitBare } from "../../output/output.ts";
export default defineCommand({
name: "file upload",
description: "Upload a local file to DashScope temporary storage (48h)",
apiDocs: "/developer-reference/get-temporary-file-url",
usage: "bl file upload --file <path> --model <model>",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/image/edit.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -32,7 +32,6 @@ import {
export default defineCommand({
name: "image edit",
description: "Edit an existing image with text instructions (Qwen-Image)",
apiDocs: "/developer-reference/qwen-image-edit-api",
usage: "bl image edit --image <url> --prompt <text> [flags]",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/image/generate.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -43,7 +43,6 @@ function isSyncModel(model: string): boolean {
export default defineCommand({
name: "image generate",
description: "Generate images (Qwen-Image / wan2.x)",
apiDocs: "/best-practice/wanx/text-to-image",
usage: "bl image generate --prompt <text> [flags]",
options: [
{ flag: "--prompt <text>", description: "Image description", required: true },
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/omni/chat.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -44,7 +44,6 @@ function buildWavHeader(dataLength: number): Buffer {
export default defineCommand({
name: "omni",
description: "Multimodal chat with text + audio output (Qwen-Omni)",
apiDocs: "/model-studio/qwen-omni",
usage: "bl omni --message <text> [flags]",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/speech/recognize.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,6 @@ import { emitResult, emitBare } from "../../output/output.ts";
export default defineCommand({
name: "speech recognize",
description: "Recognize speech from audio files (FunAudio-ASR)",
apiDocs: "/developer-reference/recording-file-recognition",
usage: "bl speech recognize --url <audio-url> [flags]",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/speech/synthesize.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -144,7 +144,6 @@ function printVoiceList(model: string): void {
export default defineCommand({
name: "speech synthesize",
description: "Synthesize speech from text (CosyVoice TTS)",
apiDocs: "/developer-reference/cosyvoice",
usage: "bl speech synthesize --text <text> [flags]",
options: [
{ flag: "--text <text>", description: "Text to synthesize into speech", required: true },
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/text/chat.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -70,7 +70,6 @@ function parseMessages(flags: GlobalFlags): ParsedMessages {
export default defineCommand({
name: "text chat",
description: "Send a chat completion (OpenAI compatible, DashScope)",
apiDocs: "/compatibility-of-openai-with-dashscope",
usage: "bl text chat --message <text> [flags]",
options: [
{ flag: "--model <model>", description: "Model ID (default: qwen3.7-max)" },
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/video/edit.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,7 +31,6 @@ export default defineCommand({
name: "video edit",
description:
"Edit a video with happyhorse-1.0-video-edit (style transfer, object replacement, etc.)",
apiDocs: "/best-practice/wanx/video-edit",
usage: "bl video edit --video <url> --prompt <text> [flags]",
options: [
{ flag: "--model <model>", description: "Model ID (default: happyhorse-1.0-video-edit)" },
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/video/generate.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -44,7 +44,6 @@ export default defineCommand({
name: "video generate",
description:
"Generate a video from text or image (happyhorse-1.0-t2v / happyhorse-1.0-i2v / wan2.6-t2v)",
apiDocs: "/best-practice/wanx/text-to-video",
usage: "bl video generate --prompt <text> [--image <url>] [flags]",
options: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/video/ref.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,7 +31,6 @@ export default defineCommand({
name: "video ref",
description:
"Reference-to-video generation (happyhorse-1.0-r2v / wan2.6-r2v): multi-subject, multi-shot with voice",
apiDocs: "/best-practice/wanx/video-reference",
usage: "bl video ref --prompt <text> --image <url>... [--ref-video <url>...] [flags]",
options: [
{ flag: "--model <model>", description: "Model ID (default: happyhorse-1.0-r2v)" },
Expand Down
24 changes: 3 additions & 21 deletions packages/cli/src/main.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,11 +3,9 @@ import { registry } from "./registry.ts";
import {
GLOBAL_OPTIONS,
loadConfig,
readConfigFile,
resolveCredential,
trackCommandExecution,
flushTelemetry,
type Region,
} from "bailian-cli-core";
import { ensureApiKey } from "./utils/ensure-key.ts";
import { handleError } from "./error-handler.ts";
Expand All@@ -22,13 +20,7 @@ import {
} from "./utils/command-help.ts";

registerCommandHelpPrinter((commandPath, out) => {
const a = process.argv.slice(2);
const ri = a.indexOf("--region");
const region = ((ri >= 0 && a[ri + 1]) ||
process.env.DASHSCOPE_REGION ||
readConfigFile().region ||
"cn") as Region;
registry.printHelp(commandPath, out, region);
registry.printHelp(commandPath, out);
});

// 优雅处理 Ctrl+C
Expand DownExpand Up@@ -84,12 +76,7 @@ async function main() {
const commandPath = scanCommandPath(argv, GLOBAL_OPTIONS);

if (argv.includes("--help") || argv.includes("-h")) {
const ri = argv.indexOf("--region");
const region = ((ri >= 0 && argv[ri + 1]) ||
process.env.DASHSCOPE_REGION ||
readConfigFile().region ||
"cn") as Region;
registry.printHelp(commandPath, process.stderr, region);
registry.printHelp(commandPath, process.stderr);
process.exit(0);
}

Expand All@@ -115,12 +102,7 @@ async function main() {

// 组路径(例如 `bl speech` 未接子命令):展示帮助后干净退出
if (registry.isGroupPath(commandPath)) {
const ri = argv.indexOf("--region");
const region = ((ri >= 0 && argv[ri + 1]) ||
process.env.DASHSCOPE_REGION ||
readConfigFile().region ||
"cn") as Region;
registry.printHelp(commandPath, process.stderr, region);
registry.printHelp(commandPath, process.stderr);
process.exit(0);
}

Expand Down
15 changes: 4 additions & 11 deletions packages/cli/src/registry.ts
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
import type { Command } from "bailian-cli-core";
import { BailianError } from "bailian-cli-core";
import { ExitCode } from "bailian-cli-core";
import { DOCS_HOSTS, GLOBAL_OPTIONS, type Region } from "bailian-cli-core";
import { GLOBAL_OPTIONS } from "bailian-cli-core";
import { commands } from "./commands/catalog.ts";

export type { Command, OptionDef } from "bailian-cli-core";
Expand DownExpand Up@@ -133,11 +133,7 @@ class CommandRegistry {
out.isTTY ? `\x1b[38;2;59;130;246m${s}\x1b[0m` : s;
private dim = (s: string, out: NodeJS.WriteStream) => (out.isTTY ? `\x1b[2m${s}\x1b[0m` : s);

printHelp(
commandPath: string[],
out: NodeJS.WriteStream = process.stdout,
region: Region = "cn",
): void {
printHelp(commandPath: string[], out: NodeJS.WriteStream = process.stdout): void {
if (commandPath.length === 0) {
this.printRootHelp(out);
return;
Expand All@@ -154,7 +150,7 @@ class CommandRegistry {
}

if (node.command) {
this.printCommandHelp(node.command, out, region);
this.printCommandHelp(node.command, out);
return;
}

Expand DownExpand Up@@ -233,7 +229,7 @@ ${b("Getting Help:")}
`);
}

private printCommandHelp(cmd: Command, out: NodeJS.WriteStream, region: Region = "cn"): void {
private printCommandHelp(cmd: Command, out: NodeJS.WriteStream): void {
const b = (s: string) => this.bold(s, out);
const a = (s: string) => this.accent(s, out);
const d = (s: string) => this.dim(s, out);
Expand All@@ -253,9 +249,6 @@ ${b("Getting Help:")}
out.write(` ${d(ex)}\n`);
}
}
if (cmd.apiDocs) {
out.write(`\n${b("API Reference:")} ${d(DOCS_HOSTS[region] + cmd.apiDocs)}\n`);
}
out.write(
`\n${d("Global flags (--api-key, --output, --quiet, etc.) are always available.")}\n`,
);
Expand Down
3 changes: 0 additions & 3 deletions packages/core/src/types/command.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,7 +14,6 @@ export interface Command {
usage?: string;
options?: OptionDef[];
examples?: string[];
apiDocs?: string;
execute: (config: Config, flags: GlobalFlags) => Promise<void>;
}

Expand All@@ -24,7 +23,6 @@ export interface CommandSpec {
usage?: string;
options?: OptionDef[];
examples?: string[];
apiDocs?: string;
run: (config: Config, flags: GlobalFlags) => Promise<void>;
}

Expand All@@ -35,7 +33,6 @@ export function defineCommand(spec: CommandSpec): Command {
usage: spec.usage,
options: spec.options,
examples: spec.examples,
apiDocs: spec.apiDocs,
execute: (config, flags) => spec.run(config, flags),
};
}
Expand Down
11 changes: 5 additions & 6 deletions skills/bailian-cli/reference/file.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,12 +15,11 @@ Index: [index.md](index.md)

### `bl file upload`

| Field | Value |
| --------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| **Name** | `file upload` |
| **Description** | Upload a local file to DashScope temporary storage (48h) |
| **Usage** | `bl file upload --file <path> --model <model>` |
| **API docs** | [/developer-reference/get-temporary-file-url](https://help.aliyun.com/zh/model-studio/developer-reference/get-temporary-file-url) |
| Field | Value |
| --------------- | -------------------------------------------------------- |
| **Name** | `file upload` |
| **Description** | Upload a local file to DashScope temporary storage (48h) |
| **Usage** | `bl file upload --file <path> --model <model>` |

#### Options

Expand Down
22 changes: 10 additions & 12 deletions skills/bailian-cli/reference/image.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,12 +16,11 @@ Index: [index.md](index.md)

### `bl image edit`

| Field | Value |
| --------------- | --------------------------------------------------------------------------------------------------------------------------- |
| **Name** | `image edit` |
| **Description** | Edit an existing image with text instructions (Qwen-Image) |
| **Usage** | `bl image edit --image <url> --prompt <text> [flags]` |
| **API docs** | [/developer-reference/qwen-image-edit-api](https://help.aliyun.com/zh/model-studio/developer-reference/qwen-image-edit-api) |
| Field | Value |
| --------------- | ---------------------------------------------------------- |
| **Name** | `image edit` |
| **Description** | Edit an existing image with text instructions (Qwen-Image) |
| **Usage** | `bl image edit --image <url> --prompt <text> [flags]` |

#### Options

Expand DownExpand Up@@ -63,12 +62,11 @@ bl image edit --image ./photo.png --prompt "把背景换成海滩" --watermark f

### `bl image generate`

| Field | Value |
| --------------- | ------------------------------------------------------------------------------------------------------------- |
| **Name** | `image generate` |
| **Description** | Generate images (Qwen-Image / wan2.x) |
| **Usage** | `bl image generate --prompt <text> [flags]` |
| **API docs** | [/best-practice/wanx/text-to-image](https://help.aliyun.com/zh/model-studio/best-practice/wanx/text-to-image) |
| Field | Value |
| --------------- | ------------------------------------------- |
| **Name** | `image generate` |
| **Description** | Generate images (Qwen-Image / wan2.x) |
| **Usage** | `bl image generate --prompt <text> [flags]` |

#### Options

Expand Down
11 changes: 5 additions & 6 deletions skills/bailian-cli/reference/omni.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,12 +15,11 @@ Index: [index.md](index.md)

### `bl omni`

| Field | Value |
| --------------- | ----------------------------------------------------------------------------------------- |
| **Name** | `omni` |
| **Description** | Multimodal chat with text + audio output (Qwen-Omni) |
| **Usage** | `bl omni --message <text> [flags]` |
| **API docs** | [/model-studio/qwen-omni](https://help.aliyun.com/zh/model-studio/model-studio/qwen-omni) |
| Field | Value |
| --------------- | ---------------------------------------------------- |
| **Name** | `omni` |
| **Description** | Multimodal chat with text + audio output (Qwen-Omni) |
| **Usage** | `bl omni --message <text> [flags]` |

#### Options

Expand Down
22 changes: 10 additions & 12 deletions skills/bailian-cli/reference/speech.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,12 +16,11 @@ Index: [index.md](index.md)

### `bl speech recognize`

| Field | Value |
| --------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| **Name** | `speech recognize` |
| **Description** | Recognize speech from audio files (FunAudio-ASR) |
| **Usage** | `bl speech recognize --url <audio-url> [flags]` |
| **API docs** | [/developer-reference/recording-file-recognition](https://help.aliyun.com/zh/model-studio/developer-reference/recording-file-recognition) |
| Field | Value |
| --------------- | ------------------------------------------------ |
| **Name** | `speech recognize` |
| **Description** | Recognize speech from audio files (FunAudio-ASR) |
| **Usage** | `bl speech recognize --url <audio-url> [flags]` |

#### Options

Expand DownExpand Up@@ -70,12 +69,11 @@ bl speech recognize --url https://example.com/audio.mp3 --no-wait --quiet

### `bl speech synthesize`

| Field | Value |
| --------------- | ------------------------------------------------------------------------------------------------------- |
| **Name** | `speech synthesize` |
| **Description** | Synthesize speech from text (CosyVoice TTS) |
| **Usage** | `bl speech synthesize --text <text> [flags]` |
| **API docs** | [/developer-reference/cosyvoice](https://help.aliyun.com/zh/model-studio/developer-reference/cosyvoice) |
| Field | Value |
| --------------- | -------------------------------------------- |
| **Name** | `speech synthesize` |
| **Description** | Synthesize speech from text (CosyVoice TTS) |
| **Usage** | `bl speech synthesize --text <text> [flags]` |

#### Options

Expand Down
11 changes: 5 additions & 6 deletions skills/bailian-cli/reference/text.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,12 +15,11 @@ Index: [index.md](index.md)

### `bl text chat`

| Field | Value |
| --------------- | ------------------------------------------------------------------------------------------------------------------------- |
| **Name** | `text chat` |
| **Description** | Send a chat completion (OpenAI compatible, DashScope) |
| **Usage** | `bl text chat --message <text> [flags]` |
| **API docs** | [/compatibility-of-openai-with-dashscope](https://help.aliyun.com/zh/model-studio/compatibility-of-openai-with-dashscope) |
| Field | Value |
| --------------- | ----------------------------------------------------- |
| **Name** | `text chat` |
| **Description** | Send a chat completion (OpenAI compatible, DashScope) |
| **Usage** | `bl text chat --message <text> [flags]` |

#### Options

Expand Down
Loading