feat(commands): localize command help examples

This commit is contained in:
若麒
2026-08-14 17:15:46 +08:00
parent 418dcffc53
commit 2fe50f59a4
33 changed files with 476 additions and 106 deletions
@@ -242,11 +242,26 @@ export default defineCommand({
},
},
exampleArgs: [
'--message "I need a visual-understanding chatbot"',
'--message "Build an Agent that auto-generates animations"',
'--message "Legal contract review, high precision required"',
'--message "Low-cost high-concurrency online customer service" --output text',
'--message "Long document summarization" --dry-run',
{
"en-US": '--message "I need a visual-understanding chatbot"',
"zh-CN": '--message "我需要一个能够理解图片的聊天机器人"',
},
{
"en-US": '--message "Build an Agent that auto-generates animations"',
"zh-CN": '--message "构建一个可以自动生成动画的智能体"',
},
{
"en-US": '--message "Legal contract review, high precision required"',
"zh-CN": '--message "审查法律合同,要求高准确率"',
},
{
"en-US": '--message "Low-cost high-concurrency online customer service" --output text',
"zh-CN": '--message "低成本、高并发的在线客服" --output text',
},
{
"en-US": '--message "Long document summarization" --dry-run',
"zh-CN": '--message "长文档摘要" --dry-run',
},
],
async run(ctx) {
const { settings, flags } = ctx;
+25 -6
View File
@@ -91,12 +91,31 @@ export default defineCommand({
},
},
exampleArgs: [
'--app-id abc123 --prompt "Hello"',
'--app-id abc123 --prompt "Describe this image" --image https://example.com/photo.jpg',
'--app-id abc123 --prompt "Analyze the image" --image img1.jpg --image img2.jpg',
'--app-id abc123 --prompt "Continue" --session-id sess_xxx --stream',
'--app-id abc123 --prompt "Search for materials" --pipeline-ids pipe1,pipe2',
'--app-id abc123 --prompt "Start" --biz-params \'{"key":"value"}\'',
{
"en-US": '--app-id abc123 --prompt "Hello"',
"zh-CN": '--app-id abc123 --prompt "你好"',
},
{
"en-US":
'--app-id abc123 --prompt "Describe this image" --image https://example.com/photo.jpg',
"zh-CN": '--app-id abc123 --prompt "描述这张图片" --image https://example.com/photo.jpg',
},
{
"en-US": '--app-id abc123 --prompt "Analyze the image" --image img1.jpg --image img2.jpg',
"zh-CN": '--app-id abc123 --prompt "分析这些图片" --image img1.jpg --image img2.jpg',
},
{
"en-US": '--app-id abc123 --prompt "Continue" --session-id sess_xxx --stream',
"zh-CN": '--app-id abc123 --prompt "继续" --session-id sess_xxx --stream',
},
{
"en-US": '--app-id abc123 --prompt "Search for materials" --pipeline-ids pipe1,pipe2',
"zh-CN": '--app-id abc123 --prompt "搜索资料" --pipeline-ids pipe1,pipe2',
},
{
"en-US": '--app-id abc123 --prompt "Start" --biz-params \'{"key":"value"}\'',
"zh-CN": '--app-id abc123 --prompt "开始" --biz-params \'{"key":"value"}\'',
},
],
async run(ctx) {
const { settings, flags } = ctx;
+9 -1
View File
@@ -27,7 +27,15 @@ export default defineCommand({
description: { "en-US": "Results per page (default: 30)", "zh-CN": "每页结果数默认30" },
},
},
exampleArgs: ["", "--name customer service", "--page 2 --page-size 10", "--output json"],
exampleArgs: [
"",
{
"en-US": "--name customer service",
"zh-CN": "--name 客户服务",
},
"--page 2 --page-size 10",
"--output json",
],
async run(ctx) {
const { settings, flags } = ctx;
const name = flags.name || "";
@@ -92,9 +92,18 @@ export default defineCommand({
usageArgs: "--job-id <id> [--follow] [--interval <sec>] [--poll-timeout <sec>]",
flags: WATCH_FLAGS,
exampleArgs: [
"--job-id ft-xxx # single probe, returns immediately",
"--job-id ft-xxx --output json # status probe for agents",
"--job-id ft-xxx --follow # block until terminal",
{
"en-US": "--job-id ft-xxx # single probe, returns immediately",
"zh-CN": "--job-id ft-xxx # 单次查询,立即返回",
},
{
"en-US": "--job-id ft-xxx --output json # status probe for agents",
"zh-CN": "--job-id ft-xxx --output json # 供智能体查询状态",
},
{
"en-US": "--job-id ft-xxx --follow # block until terminal",
"zh-CN": "--job-id ft-xxx --follow # 阻塞等待至终态",
},
"--job-id ft-xxx --follow --interval 5",
"--job-id ft-xxx --follow --poll-timeout 3600",
],
+38 -8
View File
@@ -142,14 +142,44 @@ export default defineCommand({
usageArgs: "--image <url> --prompt <text> [flags]",
flags: EDIT_FLAGS,
exampleArgs: [
'--image ./photo.png --prompt "Replace the background with a beach"',
'--image https://example.com/logo.png --prompt "Change color to blue" --n 3',
'--image ./a.png --image ./b.png --prompt "Merge two images into one collage"',
'--image https://example.com/photo.png --prompt "Remove the person" --model qwen-image-2.0-pro',
'--image ./photo.png --prompt "Change the style" --model wan2.7-image',
'--image ./photo.png --prompt "Place the subject on a table" --model wan2.5-i2i-preview',
'--image ./photo.png --prompt "转换成绘本风格" --model wanx2.1-imageedit --function stylization_all',
'--image ./photo.png --prompt "Replace the background with a beach" --watermark false',
{
"en-US": '--image ./photo.png --prompt "Replace the background with a beach"',
"zh-CN": '--image ./photo.png --prompt "将背景替换为海滩"',
},
{
"en-US": '--image https://example.com/logo.png --prompt "Change color to blue" --n 3',
"zh-CN": '--image https://example.com/logo.png --prompt "将颜色改为蓝色" --n 3',
},
{
"en-US": '--image ./a.png --image ./b.png --prompt "Merge two images into one collage"',
"zh-CN": '--image ./a.png --image ./b.png --prompt "将两张图片合并成一张拼贴图"',
},
{
"en-US":
'--image https://example.com/photo.png --prompt "Remove the person" --model qwen-image-2.0-pro',
"zh-CN":
'--image https://example.com/photo.png --prompt "移除人物" --model qwen-image-2.0-pro',
},
{
"en-US": '--image ./photo.png --prompt "Change the style" --model wan2.7-image',
"zh-CN": '--image ./photo.png --prompt "更改图片风格" --model wan2.7-image',
},
{
"en-US":
'--image ./photo.png --prompt "Place the subject on a table" --model wan2.5-i2i-preview',
"zh-CN": '--image ./photo.png --prompt "将主体放在桌面上" --model wan2.5-i2i-preview',
},
{
"en-US":
'--image ./photo.png --prompt "Convert to a picture-book style" --model wanx2.1-imageedit --function stylization_all',
"zh-CN":
'--image ./photo.png --prompt "转换成绘本风格" --model wanx2.1-imageedit --function stylization_all',
},
{
"en-US":
'--image ./photo.png --prompt "Replace the background with a beach" --watermark false',
"zh-CN": '--image ./photo.png --prompt "将背景替换为海滩" --watermark false',
},
],
async run(ctx) {
const { settings, flags } = ctx;
@@ -122,17 +122,50 @@ export default defineCommand({
usageArgs: "--prompt <text> [flags]",
flags: GENERATE_FLAGS,
exampleArgs: [
'--prompt "A cat in a spacesuit on Mars"',
'--prompt "Logo design" --n 3 --out-dir ./generated/',
'--prompt "Mountain landscape" --size 2688*1536',
'--prompt "A castle" --seed 42 --prompt-extend false',
'--prompt "Logo" --watermark false',
'--prompt "An alien in the space" --watermark false',
'--prompt "sunset" --model wan2.6-t2i --async --quiet',
'--prompt "plush doll" --model z-image-turbo --size 1024*1024',
'--prompt "sunset" --model wanx2.0-t2i-turbo --size 1024*1024',
'--prompt "Pro quality" --model qwen-image-2.0-pro',
'--prompt "Product shots" --n 2 --concurrent 3 # 6 images in parallel',
{
"en-US": '--prompt "A cat in a spacesuit on Mars"',
"zh-CN": '--prompt "一只穿着宇航服的猫站在火星上"',
},
{
"en-US": '--prompt "Logo design" --n 3 --out-dir ./generated/',
"zh-CN": '--prompt "Logo 设计" --n 3 --out-dir ./generated/',
},
{
"en-US": '--prompt "Mountain landscape" --size 2688*1536',
"zh-CN": '--prompt "山地景观" --size 2688*1536',
},
{
"en-US": '--prompt "A castle" --seed 42 --prompt-extend false',
"zh-CN": '--prompt "一座城堡" --seed 42 --prompt-extend false',
},
{
"en-US": '--prompt "Logo" --watermark false',
"zh-CN": '--prompt "Logo" --watermark false',
},
{
"en-US": '--prompt "An alien in the space" --watermark false',
"zh-CN": '--prompt "太空中的外星人" --watermark false',
},
{
"en-US": '--prompt "sunset" --model wan2.6-t2i --async --quiet',
"zh-CN": '--prompt "日落" --model wan2.6-t2i --async --quiet',
},
{
"en-US": '--prompt "plush doll" --model z-image-turbo --size 1024*1024',
"zh-CN": '--prompt "毛绒玩偶" --model z-image-turbo --size 1024*1024',
},
{
"en-US": '--prompt "sunset" --model wanx2.0-t2i-turbo --size 1024*1024',
"zh-CN": '--prompt "日落" --model wanx2.0-t2i-turbo --size 1024*1024',
},
{
"en-US": '--prompt "Pro quality" --model qwen-image-2.0-pro',
"zh-CN": '--prompt "专业品质" --model qwen-image-2.0-pro',
},
{
"en-US": '--prompt "Product shots" --n 2 --concurrent 3 # 6 images in parallel',
"zh-CN": '--prompt "产品摄影" --n 2 --concurrent 3 # 并行生成 6 张图片',
},
],
async run(ctx) {
const { settings, flags } = ctx;
@@ -182,9 +182,22 @@ export default defineCommand({
},
],
exampleArgs: [
'--message "What is RAG?" --agent-id aid-xxx --workspace-id ws-xxx',
'--message "user:What is RAG?" --message "assistant:RAG is..." --message "How does it work?" --agent-id aid-xxx --workspace-id ws-xxx',
'--message "Describe these images" --image https://example.com/a.png --image https://example.com/b.png --agent-id aid-xxx --workspace-id ws-xxx',
{
"en-US": '--message "What is RAG?" --agent-id aid-xxx --workspace-id ws-xxx',
"zh-CN": '--message "什么是 RAG" --agent-id aid-xxx --workspace-id ws-xxx',
},
{
"en-US":
'--message "user:What is RAG?" --message "assistant:RAG is..." --message "How does it work?" --agent-id aid-xxx --workspace-id ws-xxx',
"zh-CN":
'--message "user:什么是 RAG" --message "assistant:RAG 是……" --message "它是如何工作的?" --agent-id aid-xxx --workspace-id ws-xxx',
},
{
"en-US":
'--message "Describe these images" --image https://example.com/a.png --image https://example.com/b.png --agent-id aid-xxx --workspace-id ws-xxx',
"zh-CN":
'--message "描述这些图片" --image https://example.com/a.png --image https://example.com/b.png --agent-id aid-xxx --workspace-id ws-xxx',
},
],
validate: (f) =>
(f.message && f.message.length > 0) || (f.image && f.image.length > 0)
@@ -83,8 +83,15 @@ export default defineCommand({
usageArgs: "--index-id <id> --query <text> [flags]",
flags: RETRIEVE_FLAGS,
exampleArgs: [
'--index-id idx_xxx --query "How to use Alibaba Cloud Bailian"',
'--index-id idx_xxx --query "RAG retrieval" --rerank --rerank-model qwen3-rerank-hybrid',
{
"en-US": '--index-id idx_xxx --query "How to use Alibaba Cloud Bailian"',
"zh-CN": '--index-id idx_xxx --query "如何使用阿里云百炼"',
},
{
"en-US":
'--index-id idx_xxx --query "RAG retrieval" --rerank --rerank-model qwen3-rerank-hybrid',
"zh-CN": '--index-id idx_xxx --query "RAG 检索" --rerank --rerank-model qwen3-rerank-hybrid',
},
],
async run(ctx) {
const { settings, flags } = ctx;
@@ -91,9 +91,22 @@ export default defineCommand({
},
],
exampleArgs: [
'--query "What is RAG?" --agent-id aid-xxx --workspace-id ws-xxx',
'--api-key $DASHSCOPE_API_KEY --query "test search" --agent-id aid-xxx --workspace-id ws-xxx --image https://example.com/img.jpg',
'--query "How does it work" --agent-id aid-xxx --workspace-id ws-xxx --query-history \'[{"role":"user","content":"What is RAG"},{"role":"assistant","content":"RAG is retrieval-augmented generation"}]\'',
{
"en-US": '--query "What is RAG?" --agent-id aid-xxx --workspace-id ws-xxx',
"zh-CN": '--query "什么是 RAG" --agent-id aid-xxx --workspace-id ws-xxx',
},
{
"en-US":
'--api-key $DASHSCOPE_API_KEY --query "test search" --agent-id aid-xxx --workspace-id ws-xxx --image https://example.com/img.jpg',
"zh-CN":
'--api-key $DASHSCOPE_API_KEY --query "测试搜索" --agent-id aid-xxx --workspace-id ws-xxx --image https://example.com/img.jpg',
},
{
"en-US":
'--query "How does it work" --agent-id aid-xxx --workspace-id ws-xxx --query-history \'[{"role":"user","content":"What is RAG"},{"role":"assistant","content":"RAG is retrieval-augmented generation"}]\'',
"zh-CN":
'--query "它是如何工作的" --agent-id aid-xxx --workspace-id ws-xxx --query-history \'[{"role":"user","content":"什么是 RAG"},{"role":"assistant","content":"RAG 是检索增强生成"}]\'',
},
],
async run(ctx) {
const { settings, flags } = ctx;
@@ -64,7 +64,14 @@ export default defineCommand({
auth: "apiKey",
usageArgs: "[--agent <name>] [--environment <name>] [--title <title>] [--file <path>]",
flags: SESSION_CREATE_FLAGS,
exampleArgs: ["", "--agent assistant", "--agent assistant --title 'debug run'"],
exampleArgs: [
"",
"--agent assistant",
{
"en-US": "--agent assistant --title 'debug run'",
"zh-CN": "--agent assistant --title '调试运行'",
},
],
notes: CREDENTIALS_NOTE,
async run(ctx) {
const { settings, flags } = ctx;
@@ -81,7 +81,16 @@ export default defineCommand({
auth: "apiKey",
usageArgs: "--prompt <text> [--agent <name>] [--no-stream] [--file <path>]",
flags: SESSION_RUN_FLAGS,
exampleArgs: ['--prompt "hello"', '--agent assistant --prompt "summarize this repo"'],
exampleArgs: [
{
"en-US": '--prompt "hello"',
"zh-CN": '--prompt "你好"',
},
{
"en-US": '--agent assistant --prompt "summarize this repo"',
"zh-CN": '--agent assistant --prompt "总结这个代码仓库"',
},
],
notes: [
...CREDENTIALS_NOTE,
{
@@ -49,7 +49,12 @@ export default defineCommand({
auth: "apiKey",
usageArgs: "--session-id <id> --message <text> [--no-stream] [--file <path>]",
flags: SESSION_SEND_FLAGS,
exampleArgs: ['--session-id sess_abc123 --message "continue"'],
exampleArgs: [
{
"en-US": '--session-id sess_abc123 --message "continue"',
"zh-CN": '--session-id sess_abc123 --message "继续"',
},
],
notes: CREDENTIALS_NOTE,
async run(ctx) {
const { settings, flags } = ctx;
+10 -2
View File
@@ -122,8 +122,16 @@ export default defineCommand({
usageArgs: "--target <server.tool> [--arg k=v ...] [--json '{...}'] [--url <url>]",
flags: CALL_FLAGS,
exampleArgs: [
'--target market-cmapi00073529.SmartStockSelection --query "Screen consumer stocks with ROE > 15%"',
'--target market-cmapi00073529.FinQuery --json \'{"q":"Guizhou Maotai","limit":5}\'',
{
"en-US":
'--target market-cmapi00073529.SmartStockSelection --query "Screen consumer stocks with ROE > 15%"',
"zh-CN":
'--target market-cmapi00073529.SmartStockSelection --query "筛选 ROE 大于 15% 的消费股"',
},
{
"en-US": '--target market-cmapi00073529.FinQuery --json \'{"q":"Guizhou Maotai","limit":5}\'',
"zh-CN": '--target market-cmapi00073529.FinQuery --json \'{"q":"贵州茅台","limit":5}\'',
},
"--target market-cmapi00073529.SmartFundSelection --arg riskLevel=R3 --arg minScale=10",
],
validate: validateCallFlags,
+12 -3
View File
@@ -58,9 +58,18 @@ export default defineCommand({
usageArgs: "--user-id <id> [--messages <json>] [--content <text>] [flags]",
flags: ADD_FLAGS,
exampleArgs: [
'--user-id user1 --content "The user likes Python programming"',
'--user-id user1 --messages \'[{"role":"user","content":"I like traveling"}]\'',
'--user-id user1 --content "Lives in Beijing" --profile-schema schema_xxx',
{
"en-US": '--user-id user1 --content "The user likes Python programming"',
"zh-CN": '--user-id user1 --content "用户喜欢使用 Python 编程"',
},
{
"en-US": '--user-id user1 --messages \'[{"role":"user","content":"I like traveling"}]\'',
"zh-CN": '--user-id user1 --messages \'[{"role":"user","content":"我喜欢旅行"}]\'',
},
{
"en-US": '--user-id user1 --content "Lives in Beijing" --profile-schema schema_xxx',
"zh-CN": '--user-id user1 --content "居住在北京" --profile-schema schema_xxx',
},
],
validate: (f: AddFlags) =>
!f.messages && !f.content ? "Provide --messages or --content." : undefined,
@@ -38,7 +38,12 @@ export default defineCommand({
},
},
exampleArgs: [
'--name "user_basic" --attributes \'[{"name":"age","description":"age"},{"name":"hobby","description":"hobby"}]\'',
{
"en-US":
'--name "user_basic" --attributes \'[{"name":"age","description":"age"},{"name":"hobby","description":"hobby"}]\'',
"zh-CN":
'--name "user_basic" --attributes \'[{"name":"age","description":"年龄"},{"name":"hobby","description":"爱好"}]\'',
},
],
async run(ctx) {
const { settings, flags } = ctx;
@@ -55,8 +55,15 @@ export default defineCommand({
usageArgs: "--user-id <id> [--query <text>] [flags]",
flags: SEARCH_FLAGS,
exampleArgs: [
'--user-id user1 --query "programming preferences"',
'--user-id user1 --messages \'[{"role":"user","content":"recommend a book"}]\' --top-k 5',
{
"en-US": '--user-id user1 --query "programming preferences"',
"zh-CN": '--user-id user1 --query "编程偏好"',
},
{
"en-US":
'--user-id user1 --messages \'[{"role":"user","content":"recommend a book"}]\' --top-k 5',
"zh-CN": '--user-id user1 --messages \'[{"role":"user","content":"推荐一本书"}]\' --top-k 5',
},
],
validate: (f: SearchFlags) =>
!f.query && !f.messages ? "Provide --query or --messages." : undefined,
@@ -41,7 +41,12 @@ export default defineCommand({
},
},
},
exampleArgs: ['--node-id node_xxx --user-id user1 --content "updated memory content"'],
exampleArgs: [
{
"en-US": '--node-id node_xxx --user-id user1 --content "updated memory content"',
"zh-CN": '--node-id node_xxx --user-id user1 --content "更新后的记忆内容"',
},
],
async run(ctx) {
const { settings, flags } = ctx;
const nodeId = flags.nodeId;
+32 -8
View File
@@ -220,14 +220,38 @@ export default defineCommand({
},
exampleArgs: [
"--list-voices",
'--message "Hello, who are you?"',
'--message "Describe this image" --image ./photo.jpg',
'--message "What is this audio saying?" --audio https://example.com/audio.wav',
'--message "Summarize this video" --video https://example.com/video.mp4',
'--message "What is this video about?" --video ./local-video.mp4 --text-only',
'--message "Answer in Sichuan dialect: How\'s the weather today?" --voice Sunny',
'--message "Hello" --text-only --output json',
'--message "Read this passage aloud" --audio-out greeting.wav',
{
"en-US": '--message "Hello, who are you?"',
"zh-CN": '--message "你好,你是谁?"',
},
{
"en-US": '--message "Describe this image" --image ./photo.jpg',
"zh-CN": '--message "描述这张图片" --image ./photo.jpg',
},
{
"en-US": '--message "What is this audio saying?" --audio https://example.com/audio.wav',
"zh-CN": '--message "这段音频说了什么?" --audio https://example.com/audio.wav',
},
{
"en-US": '--message "Summarize this video" --video https://example.com/video.mp4',
"zh-CN": '--message "总结这段视频" --video https://example.com/video.mp4',
},
{
"en-US": '--message "What is this video about?" --video ./local-video.mp4 --text-only',
"zh-CN": '--message "这段视频讲了什么?" --video ./local-video.mp4 --text-only',
},
{
"en-US": '--message "Answer in Sichuan dialect: How\'s the weather today?" --voice Sunny',
"zh-CN": '--message "请用四川话回答:今天天气怎么样?" --voice Sunny',
},
{
"en-US": '--message "Hello" --text-only --output json',
"zh-CN": '--message "你好" --text-only --output json',
},
{
"en-US": '--message "Read this passage aloud" --audio-out greeting.wav',
"zh-CN": '--message "朗读这段文字" --audio-out greeting.wav',
},
],
validate: (f) => (f.listVoices || f.message ? undefined : "Missing required flag: --message"),
async run(ctx) {
@@ -64,7 +64,10 @@ export default defineCommand({
usageArgs: "--file <path> [flags]",
flags: RUN_FLAGS,
exampleArgs: [
'--file workflow.yaml --input \'{"brief":"hello"}\'',
{
"en-US": '--file workflow.yaml --input \'{"brief":"hello"}\'',
"zh-CN": '--file workflow.yaml --input \'{"brief":"你好"}\'',
},
"--file workflow.json --input-file inputs.json --concurrency 3",
"--file workflow.yaml --dry-run",
"--file workflow.json --events jsonl",
+12 -3
View File
@@ -40,9 +40,18 @@ export default defineCommand({
usageArgs: "--query <text> [flags]",
flags: WEB_SEARCH_FLAGS,
exampleArgs: [
'--query "Alibaba Cloud Bailian latest features"',
'--query "TypeScript 5.9 new features" --count 5',
'--query "Today\'s news"',
{
"en-US": '--query "Alibaba Cloud Bailian latest features"',
"zh-CN": '--query "阿里云百炼最新功能"',
},
{
"en-US": '--query "TypeScript 5.9 new features" --count 5',
"zh-CN": '--query "TypeScript 5.9 新功能" --count 5',
},
{
"en-US": '--query "Today\'s news"',
"zh-CN": '--query "今日新闻"',
},
"--list-tools",
],
validate: (f) => (!f.listTools && !f.query ? "Missing required flag: --query" : undefined),
@@ -290,15 +290,41 @@ export default defineCommand({
flags: SYNTHESIZE_FLAGS,
exampleArgs: [
"--list-voices --model cosyvoice-v3-flash",
'--text "Hello, I am Qwen" --voice <voice_id>',
'--text "Hello world" --voice <voice_id> --language en',
{
"en-US": '--text "Hello, I am Qwen" --voice <voice_id>',
"zh-CN": '--text "你好,我是通义千问" --voice <voice_id>',
},
{
"en-US": '--text "Hello world" --voice <voice_id> --language en',
"zh-CN": '--text "你好,世界" --voice <voice_id> --language zh',
},
"--text-file script.txt --out speech.wav --voice <voice_id>",
'--text "Today is a good day" --voice <voice_id> --instruction "Use a gentle tone"',
'--text "Hello" --voice <voice_id> --format wav --sample-rate 24000',
"# Stream to audio player (macOS)",
'--text "Hello" --voice <voice_id> --stream | afplay -',
"# Pipe to ffplay",
'--text "Hello" --voice <voice_id> --stream | ffplay -nodisp -autoexit -f s16le -ar 24000 -ac 1 -',
{
"en-US": '--text "Today is a good day" --voice <voice_id> --instruction "Use a gentle tone"',
"zh-CN": '--text "今天天气很好" --voice <voice_id> --instruction "使用温柔的语气"',
},
{
"en-US": '--text "Hello" --voice <voice_id> --format wav --sample-rate 24000',
"zh-CN": '--text "你好" --voice <voice_id> --format wav --sample-rate 24000',
},
{
"en-US": "# Stream to audio player (macOS)",
"zh-CN": "# 流式传输到音频播放器macOS",
},
{
"en-US": '--text "Hello" --voice <voice_id> --stream | afplay -',
"zh-CN": '--text "你好" --voice <voice_id> --stream | afplay -',
},
{
"en-US": "# Pipe to ffplay",
"zh-CN": "# 通过管道传输到 ffplay",
},
{
"en-US":
'--text "Hello" --voice <voice_id> --stream | ffplay -nodisp -autoexit -f s16le -ar 24000 -ac 1 -',
"zh-CN":
'--text "你好" --voice <voice_id> --stream | ffplay -nodisp -autoexit -f s16le -ar 24000 -ac 1 -',
},
],
validate: (f) => {
if (f.listVoices) return undefined;
+21 -5
View File
@@ -155,12 +155,28 @@ export default defineCommand({
usageArgs: "--message <text> [flags]",
flags: CHAT_FLAGS,
exampleArgs: [
'--message "What is Qwen?"',
'--model qwen-max --system "You are a coding assistant." --message "Write fizzbuzz in Python"',
'--message "Hello" --message "assistant:Hi!" --message "How are you?"',
{
"en-US": '--message "What is Qwen?"',
"zh-CN": '--message "通义千问是什么?"',
},
{
"en-US":
'--model qwen-max --system "You are a coding assistant." --message "Write fizzbuzz in Python"',
"zh-CN": '--model qwen-max --system "你是一名编程助手。" --message "用 Python 编写 FizzBuzz"',
},
{
"en-US": '--message "Hello" --message "assistant:Hi!" --message "How are you?"',
"zh-CN": '--message "你好" --message "assistant:你好!" --message "你好吗?"',
},
"--messages-file - --stream",
'--message "Hello" --output json',
'--model qwq-plus --message "Solve 1+1" --enable-thinking',
{
"en-US": '--message "Hello" --output json',
"zh-CN": '--message "你好" --output json',
},
{
"en-US": '--model qwq-plus --message "Solve 1+1" --enable-thinking',
"zh-CN": '--model qwq-plus --message "计算 1+1" --enable-thinking',
},
],
validate: (f) =>
!f.message && !f.messagesFile ? "Provide --message or --messages-file." : undefined,
@@ -46,7 +46,10 @@ export default defineCommand({
flags: CREATE_KEY_FLAGS,
exampleArgs: [
"--account-id acc_123 --workspace-id ws_456",
"--account-id acc_123 --workspace-id ws_456 --description 'Dev key'",
{
"en-US": "--account-id acc_123 --workspace-id ws_456 --description 'Dev key'",
"zh-CN": "--account-id acc_123 --workspace-id ws_456 --description '开发密钥'",
},
],
async run(ctx) {
const { identity, settings, flags } = ctx;
+23 -4
View File
@@ -141,10 +141,29 @@ export default defineCommand({
},
},
exampleArgs: [
'--video https://example.com/input.mp4 --prompt "Convert the entire scene to claymation style"',
'--video https://example.com/input.mp4 --prompt "Replace the outfit with the style shown in the image" --ref-image https://example.com/clothes.png',
'--video https://example.com/input.mp4 --prompt "Convert to anime style" --resolution 720P --download output.mp4',
'--video https://example.com/input.mp4 --prompt "Put clothes on the kitten in the video" --watermark false',
{
"en-US":
'--video https://example.com/input.mp4 --prompt "Convert the entire scene to claymation style"',
"zh-CN": '--video https://example.com/input.mp4 --prompt "将整个场景转换为黏土动画风格"',
},
{
"en-US":
'--video https://example.com/input.mp4 --prompt "Replace the outfit with the style shown in the image" --ref-image https://example.com/clothes.png',
"zh-CN":
'--video https://example.com/input.mp4 --prompt "将服装替换为参考图片中的款式" --ref-image https://example.com/clothes.png',
},
{
"en-US":
'--video https://example.com/input.mp4 --prompt "Convert to anime style" --resolution 720P --download output.mp4',
"zh-CN":
'--video https://example.com/input.mp4 --prompt "转换为动漫风格" --resolution 720P --download output.mp4',
},
{
"en-US":
'--video https://example.com/input.mp4 --prompt "Put clothes on the kitten in the video" --watermark false',
"zh-CN":
'--video https://example.com/input.mp4 --prompt "给视频中的小猫穿上衣服" --watermark false',
},
],
async run(ctx) {
const { settings, flags } = ctx;
@@ -122,11 +122,26 @@ export default defineCommand({
},
},
exampleArgs: [
'--prompt "A person reading a book, static shot"',
'--prompt "Ocean waves at sunset." --download sunset.mp4',
'--image https://example.com/cat.png --prompt "Make the cat in the scene move"',
'--prompt "Mountain landscape" --resolution 720P --duration 5',
'--prompt "A cat playing with a ball" --watermark false',
{
"en-US": '--prompt "A person reading a book, static shot"',
"zh-CN": '--prompt "一个人正在读书,固定镜头"',
},
{
"en-US": '--prompt "Ocean waves at sunset." --download sunset.mp4',
"zh-CN": '--prompt "日落时的海浪。" --download sunset.mp4',
},
{
"en-US": '--image https://example.com/cat.png --prompt "Make the cat in the scene move"',
"zh-CN": '--image https://example.com/cat.png --prompt "让画面中的猫动起来"',
},
{
"en-US": '--prompt "Mountain landscape" --resolution 720P --duration 5',
"zh-CN": '--prompt "山地景观" --resolution 720P --duration 5',
},
{
"en-US": '--prompt "A cat playing with a ball" --watermark false',
"zh-CN": '--prompt "一只正在玩球的猫" --watermark false',
},
],
async run(ctx) {
const { settings, flags } = ctx;
+26 -5
View File
@@ -141,11 +141,32 @@ export default defineCommand({
},
},
exampleArgs: [
'--prompt "Image1 running on the grass" --image person.jpg',
'--prompt "Video 1 plays guitar, Image 1 walks over" --ref-video scene.mp4 --image person.jpg',
'--prompt "Image 1 speaks" --image person.jpg --image-voice voice.mp3 --resolution 1080P',
'--prompt "Image 1 and Image 2 have a conversation" --image a.jpg --image b.jpg --image-voice va.mp3 --image-voice vb.mp3',
'--prompt "Image 1 drinks water" --image person.jpg --watermark false',
{
"en-US": '--prompt "Image1 running on the grass" --image person.jpg',
"zh-CN": '--prompt "图片 1 中的人物在草地上奔跑" --image person.jpg',
},
{
"en-US":
'--prompt "Video 1 plays guitar, Image 1 walks over" --ref-video scene.mp4 --image person.jpg',
"zh-CN":
'--prompt "视频 1 中的人物弹吉他,图片 1 中的人物走过来" --ref-video scene.mp4 --image person.jpg',
},
{
"en-US":
'--prompt "Image 1 speaks" --image person.jpg --image-voice voice.mp3 --resolution 1080P',
"zh-CN":
'--prompt "图片 1 中的人物说话" --image person.jpg --image-voice voice.mp3 --resolution 1080P',
},
{
"en-US":
'--prompt "Image 1 and Image 2 have a conversation" --image a.jpg --image b.jpg --image-voice va.mp3 --image-voice vb.mp3',
"zh-CN":
'--prompt "图片 1 和图片 2 中的人物进行对话" --image a.jpg --image b.jpg --image-voice va.mp3 --image-voice vb.mp3',
},
{
"en-US": '--prompt "Image 1 drinks water" --image person.jpg --watermark false',
"zh-CN": '--prompt "图片 1 中的人物喝水" --image person.jpg --watermark false',
},
],
validate: (f) =>
!(f.image as string[] | undefined)?.length && !(f.refVideo as string[] | undefined)?.length
@@ -73,10 +73,19 @@ export default defineCommand({
},
exampleArgs: [
"--image photo.jpg",
'--image https://example.com/photo.jpg --prompt "What breed is this dog?"',
'--video https://example.com/video.mp4 --prompt "Summarize the video content"',
{
"en-US": '--image https://example.com/photo.jpg --prompt "What breed is this dog?"',
"zh-CN": '--image https://example.com/photo.jpg --prompt "这只狗是什么品种?"',
},
{
"en-US": '--video https://example.com/video.mp4 --prompt "Summarize the video content"',
"zh-CN": '--video https://example.com/video.mp4 --prompt "总结视频内容"',
},
"--video ./local-video.mp4",
'--image photo.png --prompt "Extract the text" --model qwen3-vl-plus',
{
"en-US": '--image photo.png --prompt "Extract the text" --model qwen3-vl-plus',
"zh-CN": '--image photo.png --prompt "提取文字" --model qwen3-vl-plus',
},
],
validate: (f) =>
!f.image && !(f.video as string[] | undefined)?.length
+2 -2
View File
@@ -264,8 +264,8 @@ export interface Command<F extends FlagsDef = FlagsDef> {
auth: AuthRequirement;
/** Usage line arg portion, e.g. "--prompt <text> [flags]". Manually written. */
usageArgs?: string;
/** Example arg strings (without the `<bin> <path>` prefix). */
exampleArgs?: string[];
/** Example args (without the `<bin> <path>` prefix). */
exampleArgs?: LocalizedText[];
/** Additional help paragraphs rendered below flags. */
notes?: LocalizedText[];
flags?: F;
+8 -2
View File
@@ -418,8 +418,14 @@ ${authFlagSections ? `${authFlagSections}\n\n` : ""}${b(this.localize(HELP_TEXT.
}
if (cmd.exampleArgs && cmd.exampleArgs.length > 0) {
out.write(`\n${b(this.localize(HELP_TEXT.examples))}\n`);
for (const ex of cmd.exampleArgs) {
out.write(` ${d(ex ? `${prefix} ${ex}` : prefix)}\n`);
for (const example of cmd.exampleArgs) {
const localizedExample = this.localize(example);
const line = localizedExample.startsWith("#")
? localizedExample
: localizedExample
? `${prefix} ${localizedExample}`
: prefix;
out.write(` ${d(line)}\n`);
}
}
}
+13
View File
@@ -36,6 +36,16 @@ test("registry renders runtime help copy with the selected language", async () =
"zh-CN": "测试说明",
},
],
exampleArgs: [
{
"en-US": '--message "Hello"',
"zh-CN": '--message "你好"',
},
{
"en-US": "# Stream the response",
"zh-CN": "# 流式输出响应",
},
],
auth: "none",
run: async () => {},
});
@@ -60,4 +70,7 @@ test("registry renders runtime help copy with the selected language", async () =
output = "";
registry.printHelp(["test"], stream);
expect(output).toContain("测试说明");
expect(output).toContain('bl test --message "你好"');
expect(output).toContain(" # 流式输出响应");
expect(output).not.toContain("bl test # 流式输出响应");
});
+1 -1
View File
@@ -71,7 +71,7 @@ bl image edit --image ./photo.png --prompt "Place the subject on a table" --mode
```
```bash
bl image edit --image ./photo.png --prompt "转换成绘本风格" --model wanx2.1-imageedit --function stylization_all
bl image edit --image ./photo.png --prompt "Convert to a picture-book style" --model wanx2.1-imageedit --function stylization_all
```
```bash
+2 -2
View File
@@ -128,7 +128,7 @@ bl speech synthesize --text "Hello" --voice <voice_id> --format wav --sample-rat
```
```bash
bl speech synthesize # Stream to audio player (macOS)
# Stream to audio player (macOS)
```
```bash
@@ -136,7 +136,7 @@ bl speech synthesize --text "Hello" --voice <voice_id> --stream | afplay -
```
```bash
bl speech synthesize # Pipe to ffplay
# Pipe to ffplay
```
```bash
+6 -2
View File
@@ -104,12 +104,16 @@ function formatFlagsTable(flags: FlagsDef | undefined): string {
].join("\n");
}
function formatExamples(path: string, exampleArgs: string[] | undefined): string {
function formatExamples(path: string, exampleArgs: LocalizedText[] | undefined): string {
if (!exampleArgs?.length) return "_No examples._\n";
// Commands store argument-only examples; prepend `bl <path>` for the reference.
return (
exampleArgs
.map((ex) => ["```bash", `bl ${path}${ex ? ` ${ex}` : ""}`, "```"].join("\n"))
.map((example) => {
const text = referenceText(example);
const line = text.startsWith("#") ? text : `bl ${path}${text ? ` ${text}` : ""}`;
return ["```bash", line, "```"].join("\n");
})
.join("\n\n") + "\n"
);
}