bailian-cli 1.0.0-beta.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +128 -0
- package/dist/bailian.mjs +141 -174
- package/package.json +7 -7
- package/scripts/postinstall.js +36 -104
- package/skill/SKILL.md +111 -822
- package/skill/reference/app.md +99 -0
- package/skill/reference/auth.md +96 -0
- package/skill/reference/config.md +91 -0
- package/skill/reference/console.md +40 -0
- package/skill/reference/file.md +48 -0
- package/skill/reference/image.md +116 -0
- package/skill/reference/index.md +95 -0
- package/skill/reference/knowledge.md +45 -0
- package/skill/reference/memory.md +195 -0
- package/skill/reference/model.md +51 -0
- package/skill/reference/omni.md +74 -0
- package/skill/reference/search.md +48 -0
- package/skill/reference/speech.md +141 -0
- package/skill/reference/text.md +65 -0
- package/skill/reference/update.md +32 -0
- package/skill/reference/usage.md +43 -0
- package/skill/reference/video.md +207 -0
- package/skill/reference/vision.md +53 -0
- package/scripts/preuninstall.js +0 -69
- package/skill/BAILIAN_API_DOC_REFER.md +0 -1008
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bailian-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "CLI for Aliyun Model Studio (DashScope) AI Platform.",
|
|
5
5
|
"homepage": "https://bailian.console.aliyun.com/cli",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -12,8 +12,7 @@
|
|
|
12
12
|
"files": [
|
|
13
13
|
"dist",
|
|
14
14
|
"skill",
|
|
15
|
-
"scripts/postinstall.js"
|
|
16
|
-
"scripts/preuninstall.js"
|
|
15
|
+
"scripts/postinstall.js"
|
|
17
16
|
],
|
|
18
17
|
"type": "module",
|
|
19
18
|
"exports": {
|
|
@@ -24,9 +23,10 @@
|
|
|
24
23
|
"registry": "https://registry.npmjs.org/"
|
|
25
24
|
},
|
|
26
25
|
"dependencies": {
|
|
27
|
-
"bailian-cli-core": "1.0.
|
|
26
|
+
"bailian-cli-core": "1.0.1"
|
|
28
27
|
},
|
|
29
28
|
"devDependencies": {
|
|
29
|
+
"@clack/prompts": "^0.7.0",
|
|
30
30
|
"@types/node": "^24",
|
|
31
31
|
"@typescript/native-preview": "7.0.0-dev.20260328.1",
|
|
32
32
|
"typescript": "^6.0.2",
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
"sisteransi": "1.0.5"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
|
-
"
|
|
45
|
+
"generate:reference": "node --experimental-strip-types scripts/generate-reference.ts",
|
|
46
|
+
"build": "pnpm run generate:reference && vp pack",
|
|
46
47
|
"dev": "node src/main.ts",
|
|
47
48
|
"test": "vp test",
|
|
48
49
|
"check": "vp check",
|
|
49
|
-
"postinstall": "node scripts/postinstall.js"
|
|
50
|
-
"preuninstall": "node scripts/preuninstall.js"
|
|
50
|
+
"postinstall": "node scripts/postinstall.js"
|
|
51
51
|
}
|
|
52
52
|
}
|
package/scripts/postinstall.js
CHANGED
|
@@ -3,25 +3,15 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* Postinstall script: automatically install SKILL.md to all detected AI coding tools.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* - Claude Code → ~/.claude/skills/bailian-cli/SKILL.md
|
|
9
|
-
* - Cline → ~/.cline/skills/bailian-cli/SKILL.md
|
|
10
|
-
* - QwenCode → ~/.qwen/skills/bailian-cli/SKILL.md
|
|
11
|
-
* - Cursor → ~/.cursor/skills/bailian-cli/SKILL.md
|
|
12
|
-
* - Windsurf → ~/.windsurf/skills/bailian-cli/SKILL.md
|
|
13
|
-
* - Trae → ~/.trae/skills/bailian-cli/SKILL.md
|
|
14
|
-
* - QoderWork → ~/.qoderwork/skills/bailian-cli/SKILL.md
|
|
15
|
-
* - Kiro → ~/.kiro/skills/bailian-cli/SKILL.md
|
|
16
|
-
* - Wukong → ~/Library/Application Support/iDingTalk/wukong/skills/bailian-cli/SKILL.md
|
|
17
|
-
*
|
|
18
|
-
* Only installs when the tool's root directory already exists.
|
|
6
|
+
* For each tool whose root dir exists, writes SKILL.md to <root>/skills/bailian-cli/.
|
|
7
|
+
* See `targets` below for the full list.
|
|
19
8
|
*/
|
|
20
9
|
|
|
21
10
|
import {
|
|
22
11
|
existsSync,
|
|
23
12
|
mkdirSync,
|
|
24
13
|
copyFileSync,
|
|
14
|
+
cpSync,
|
|
25
15
|
openSync,
|
|
26
16
|
writeSync,
|
|
27
17
|
closeSync,
|
|
@@ -34,7 +24,7 @@ import { execSync } from "child_process";
|
|
|
34
24
|
|
|
35
25
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
36
26
|
const skillSource = join(__dirname, "..", "skill", "SKILL.md");
|
|
37
|
-
const
|
|
27
|
+
const referenceDirSource = join(__dirname, "..", "skill", "reference");
|
|
38
28
|
|
|
39
29
|
if (!existsSync(skillSource)) {
|
|
40
30
|
process.exit(0);
|
|
@@ -42,29 +32,21 @@ if (!existsSync(skillSource)) {
|
|
|
42
32
|
|
|
43
33
|
const home = homedir();
|
|
44
34
|
|
|
45
|
-
//
|
|
46
|
-
//
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
".claude",
|
|
50
|
-
".cline",
|
|
51
|
-
".qwen",
|
|
52
|
-
".cursor",
|
|
53
|
-
".windsurf",
|
|
54
|
-
".trae",
|
|
55
|
-
".qoderwork",
|
|
56
|
-
".kiro",
|
|
57
|
-
];
|
|
58
|
-
|
|
59
|
-
// Pattern 2: Non-standard paths
|
|
60
|
-
const customTargets = [
|
|
61
|
-
{ root: join(home, "Library", "Application Support", "iDingTalk", "wukong"), label: "Wukong" },
|
|
62
|
-
];
|
|
63
|
-
|
|
64
|
-
// Build unified target list
|
|
35
|
+
// Each entry: { root, label }
|
|
36
|
+
// - root: absolute path to the tool's root dir; existence triggers install,
|
|
37
|
+
// and SKILL.md is written to <root>/skills/bailian-cli/
|
|
38
|
+
// - label: display name in install summary
|
|
65
39
|
const targets = [
|
|
66
|
-
|
|
67
|
-
|
|
40
|
+
{ root: join(home, ".qoder"), label: "Qoder" },
|
|
41
|
+
{ root: join(home, ".claude"), label: "ClaudeCode" },
|
|
42
|
+
{ root: join(home, ".cline"), label: "Cline" },
|
|
43
|
+
{ root: join(home, ".qwen"), label: "QwenCode" },
|
|
44
|
+
{ root: join(home, ".cursor"), label: "Cursor" },
|
|
45
|
+
{ root: join(home, ".qoderwork"), label: "QoderWork" },
|
|
46
|
+
{ root: join(home, ".codex"), label: "Codex" },
|
|
47
|
+
{ root: join(home, ".kilo"), label: "Kilo Code" },
|
|
48
|
+
{ root: join(home, ".openclaw"), label: "OpenCLaw" },
|
|
49
|
+
{ root: join(home, ".config", "opencode"), label: "OpenCode" },
|
|
68
50
|
];
|
|
69
51
|
|
|
70
52
|
// Detect which tools are available
|
|
@@ -89,63 +71,30 @@ function ttyPrint(msg) {
|
|
|
89
71
|
}
|
|
90
72
|
}
|
|
91
73
|
|
|
92
|
-
|
|
93
|
-
const capabilities = [
|
|
94
|
-
["Text Chat", "Chat with Qwen LLMs", "qwen3.6-plus"],
|
|
95
|
-
["Omni Chat", "Multimodal chat (text+audio+image)", "qwen3.5-omni-plus"],
|
|
96
|
-
["Image Generate", "AI image generation", "qwen-image-2.0"],
|
|
97
|
-
["Image Edit", "AI image editing & multi-image merge", "qwen-image-2.0"],
|
|
98
|
-
["Video Generate", "AI video generation", "happyhorse-1.0-t2v"],
|
|
99
|
-
["Video Edit", "AI video editing", "happyhorse-1.0-video-edit"],
|
|
100
|
-
["Vision", "Image understanding & description", "qwen-vl-max"],
|
|
101
|
-
["Speech Synthesize", "Text-to-speech (TTS)", "cosyvoice-v3-flash"],
|
|
102
|
-
["Speech Recognize", "Speech-to-text (ASR)", "fun-asr"],
|
|
103
|
-
["File Upload", "Upload files to temp OSS storage", "—"],
|
|
104
|
-
["App Call", "Call Bailian agent / workflow apps", "—"],
|
|
105
|
-
["Memory", "Long-term memory management", "—"],
|
|
106
|
-
["Knowledge", "RAG knowledge base retrieval", "—"],
|
|
107
|
-
["Web Search", "Real-time web search powered by AI", "—"],
|
|
108
|
-
];
|
|
109
|
-
|
|
110
|
-
ttyPrint(`\n🚀 Bailian CLI provides ${capabilities.length} AI tools:\n`);
|
|
111
|
-
ttyPrint(` ${"Capability".padEnd(18)} ${"Description".padEnd(38)} Default Model`);
|
|
112
|
-
ttyPrint(` ${"─".repeat(18)} ${"─".repeat(38)} ${"─".repeat(20)}`);
|
|
113
|
-
for (const [name, desc, model] of capabilities) {
|
|
114
|
-
ttyPrint(` ${name.padEnd(18)} ${desc.padEnd(38)} ${model}`);
|
|
115
|
-
}
|
|
116
|
-
ttyPrint(`\nInstalling skill for ${available.length} AI coding tool(s)...`);
|
|
117
|
-
|
|
118
|
-
let installed = 0;
|
|
74
|
+
ttyPrint(`\n🚀 Installing Bailian CLI skill to ${available.length} AI coding tool(s):`);
|
|
119
75
|
|
|
120
76
|
for (const { root, label } of available) {
|
|
121
77
|
try {
|
|
122
78
|
const targetDir = join(root, "skills", "bailian-cli");
|
|
123
79
|
mkdirSync(targetDir, { recursive: true });
|
|
124
80
|
copyFileSync(skillSource, join(targetDir, "SKILL.md"));
|
|
125
|
-
if (existsSync(
|
|
126
|
-
|
|
81
|
+
if (existsSync(referenceDirSource)) {
|
|
82
|
+
cpSync(referenceDirSource, join(targetDir, "reference"), { recursive: true });
|
|
127
83
|
}
|
|
128
|
-
installed++;
|
|
129
84
|
ttyPrint(` ✓ ${label}`);
|
|
130
85
|
} catch {
|
|
131
86
|
// Silent fail — don't block npm install
|
|
132
87
|
}
|
|
133
88
|
}
|
|
134
89
|
|
|
135
|
-
if (installed > 0) {
|
|
136
|
-
ttyPrint(`\n\u2705 Bailian CLI skill installed for ${installed} AI coding tool(s).`);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
90
|
// ── API Key configuration guidance ──
|
|
140
91
|
const API_KEY_URL = "https://bailian.console.aliyun.com/cn-beijing/?tab=app#/api-key";
|
|
141
92
|
const configPath = join(home, ".bailian", "config.json");
|
|
142
93
|
let hasApiKey = false;
|
|
143
94
|
|
|
144
|
-
// Check environment variable
|
|
145
95
|
if (process.env.DASHSCOPE_API_KEY) {
|
|
146
96
|
hasApiKey = true;
|
|
147
97
|
}
|
|
148
|
-
// Check config file
|
|
149
98
|
if (!hasApiKey && existsSync(configPath)) {
|
|
150
99
|
try {
|
|
151
100
|
const cfg = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
@@ -155,47 +104,31 @@ if (!hasApiKey && existsSync(configPath)) {
|
|
|
155
104
|
}
|
|
156
105
|
}
|
|
157
106
|
|
|
107
|
+
const demoPrompts = [
|
|
108
|
+
"帮我生成一套鸭舌帽的亚马逊电商主图(白底 + 场景图 + 模特上身图)",
|
|
109
|
+
"帮我生成一段 3 分钟的幽默相声音频",
|
|
110
|
+
"帮我生成一套小红帽故事绘本 PDF(含插图)",
|
|
111
|
+
"帮我分析这个视频的内容并写一篇小红书文案",
|
|
112
|
+
];
|
|
113
|
+
|
|
158
114
|
if (hasApiKey) {
|
|
159
|
-
// Already configured — show usage examples
|
|
160
115
|
ttyPrint("");
|
|
161
|
-
ttyPrint("
|
|
116
|
+
ttyPrint("🎯 Try these with your AI coding assistant:");
|
|
162
117
|
ttyPrint("");
|
|
163
|
-
ttyPrint(
|
|
164
|
-
" 1 \u5e2e\u6211\u751f\u6210\u4e00\u5957\u9e2d\u820c\u5e3d\u7684\u4e9a\u9a6c\u900a\u7535\u5546\u4e3b\u56fe\uff08\u767d\u5e95 + \u573a\u666f\u56fe + \u6a21\u7279\u4e0a\u8eab\u56fe\uff09",
|
|
165
|
-
);
|
|
166
|
-
ttyPrint(
|
|
167
|
-
" 2 \u5e2e\u6211\u751f\u6210\u4e00\u6bb5 3 \u5206\u949f\u7684\u5e7d\u9ed8\u76f8\u58f0\u97f3\u9891",
|
|
168
|
-
);
|
|
169
|
-
ttyPrint(
|
|
170
|
-
" 3 \u5e2e\u6211\u751f\u6210\u4e00\u5957\u5c0f\u7ea2\u5e3d\u6545\u4e8b\u7ed8\u672c PDF\uff08\u542b\u63d2\u56fe\uff09",
|
|
171
|
-
);
|
|
172
|
-
ttyPrint(
|
|
173
|
-
" 4 \u5e2e\u6211\u5206\u6790\u8fd9\u4e2a\u89c6\u9891\u7684\u5185\u5bb9\u5e76\u5199\u4e00\u7bc7\u5c0f\u7ea2\u4e66\u6587\u6848",
|
|
174
|
-
);
|
|
118
|
+
demoPrompts.forEach((p, i) => ttyPrint(` ${i + 1} ${p}`));
|
|
175
119
|
ttyPrint("");
|
|
176
120
|
} else {
|
|
177
|
-
// Not configured — guide user to set up API Key
|
|
178
121
|
ttyPrint("");
|
|
179
|
-
ttyPrint(
|
|
180
|
-
" \u26a0\ufe0f \u5c1a\u672a\u914d\u7f6e API Key\uff0c\u8bf7\u5148\u5b8c\u6210\u914d\u7f6e\u624d\u80fd\u4f7f\u7528\u5168\u90e8\u80fd\u529b\u3002",
|
|
181
|
-
);
|
|
122
|
+
ttyPrint("💡 Set up your API Key to unlock all capabilities:");
|
|
182
123
|
ttyPrint("");
|
|
183
|
-
ttyPrint("
|
|
124
|
+
ttyPrint(" 1️⃣ Get an API Key (free):");
|
|
184
125
|
ttyPrint(` ${API_KEY_URL}`);
|
|
185
126
|
ttyPrint("");
|
|
186
|
-
ttyPrint("
|
|
187
|
-
ttyPrint("");
|
|
188
|
-
ttyPrint(" # \u65b9\u5f0f A: CLI \u767b\u5f55\uff08\u63a8\u8350\uff09");
|
|
127
|
+
ttyPrint(" 2️⃣ Sign in:");
|
|
189
128
|
ttyPrint(" bl auth login --api-key sk-xxxxx");
|
|
190
129
|
ttyPrint("");
|
|
191
|
-
ttyPrint("
|
|
192
|
-
ttyPrint(
|
|
193
|
-
ttyPrint("");
|
|
194
|
-
ttyPrint(" \u2462 \u914d\u7f6e\u6210\u529f\u540e\uff0c\u5728 Agent \u4e2d\u76f4\u63a5\u8bf4:");
|
|
195
|
-
ttyPrint(
|
|
196
|
-
" \u201c\u5e2e\u6211\u751f\u6210\u4e00\u5f20\u592a\u7a7a\u732b\u7684\u56fe\u7247\u201d",
|
|
197
|
-
);
|
|
198
|
-
ttyPrint(" \u201c\u5e2e\u6211\u628a\u8fd9\u6bb5\u6587\u5b57\u8f6c\u6210\u8bed\u97f3\u201d");
|
|
130
|
+
ttyPrint(" 3️⃣ Then try these with your AI coding assistant:");
|
|
131
|
+
demoPrompts.forEach((p, i) => ttyPrint(` ${i + 1} ${p}`));
|
|
199
132
|
ttyPrint("");
|
|
200
133
|
}
|
|
201
134
|
|
|
@@ -203,9 +136,8 @@ if (hasApiKey) {
|
|
|
203
136
|
try {
|
|
204
137
|
execSync("which bl", { stdio: "ignore" });
|
|
205
138
|
} catch {
|
|
206
|
-
// bin not in PATH — npm global prefix likely not on PATH
|
|
207
139
|
ttyPrint("");
|
|
208
|
-
ttyPrint('
|
|
140
|
+
ttyPrint('⚠️ Command "bl" not found in PATH.');
|
|
209
141
|
ttyPrint(" Your npm global bin directory may not be on PATH.");
|
|
210
142
|
ttyPrint(" Run `npm config get prefix` and add its `bin/` to your PATH,");
|
|
211
143
|
ttyPrint(" or reinstall with:");
|