bpmax-cli 0.1.12 → 0.1.14
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 +66 -0
- package/dist/bin.js +542 -259
- package/dist/bin.js.map +1 -1
- package/package.json +1 -1
- package/scripts/install-skills.mjs +183 -47
- package/skills/bpmax-auth/SKILL.md +29 -4
- package/skills/bpmax-shared/SKILL.md +19 -1
package/package.json
CHANGED
|
@@ -7,6 +7,8 @@ import process from 'node:process';
|
|
|
7
7
|
const projectRoot = path.resolve(import.meta.dirname, '..');
|
|
8
8
|
const sourceSkillsDir = path.join(projectRoot, 'skills');
|
|
9
9
|
const jsonOutput = process.argv.includes('--json');
|
|
10
|
+
const agentArgIndex = process.argv.indexOf('--agent');
|
|
11
|
+
const targetAgent = agentArgIndex >= 0 ? process.argv[agentArgIndex + 1] : '';
|
|
10
12
|
const setupHint = [
|
|
11
13
|
'[bpmax-cli] Agent action: ask the user to directly input a BPMAX workspace page URL, for example http://127.0.0.1:10018/w:store_mgr',
|
|
12
14
|
'[bpmax-cli] Do not show a command template yet. After the user replies with the URL, run: bpmax-cli setup "<USER_URL>" --name local',
|
|
@@ -14,14 +16,18 @@ const setupHint = [
|
|
|
14
16
|
];
|
|
15
17
|
const stampPath = path.join(homedir(), '.bpmax', 'skills.stamp');
|
|
16
18
|
|
|
17
|
-
const
|
|
18
|
-
path.join(homedir(), '.codex', 'skills'),
|
|
19
|
-
path.join(homedir(), '.claude', 'skills'),
|
|
20
|
-
path.join(homedir(), '.cc-switch', 'skills'),
|
|
21
|
-
path.join(homedir(), '.agents', 'skills'),
|
|
22
|
-
path.join(homedir(), '.gemini', 'skills'),
|
|
19
|
+
const directoryTargets = [
|
|
20
|
+
{ agent: 'codex', root: path.join(homedir(), '.codex', 'skills') },
|
|
21
|
+
{ agent: 'claude', root: path.join(homedir(), '.claude', 'skills') },
|
|
22
|
+
{ agent: 'cc-switch', root: path.join(homedir(), '.cc-switch', 'skills') },
|
|
23
|
+
{ agent: 'agents', root: path.join(homedir(), '.agents', 'skills') },
|
|
24
|
+
{ agent: 'gemini', root: path.join(homedir(), '.gemini', 'skills') },
|
|
23
25
|
];
|
|
24
26
|
|
|
27
|
+
function shouldRunAdapter(adapter) {
|
|
28
|
+
return !targetAgent || targetAgent === adapter;
|
|
29
|
+
}
|
|
30
|
+
|
|
25
31
|
async function exists(targetPath) {
|
|
26
32
|
try {
|
|
27
33
|
await stat(targetPath);
|
|
@@ -31,24 +37,54 @@ async function exists(targetPath) {
|
|
|
31
37
|
}
|
|
32
38
|
}
|
|
33
39
|
|
|
34
|
-
async function installSkillDir(skillName, sourceDir) {
|
|
40
|
+
async function installSkillDir(skillName, sourceDir, root) {
|
|
41
|
+
await mkdir(root, { recursive: true });
|
|
42
|
+
const destination = path.join(root, skillName);
|
|
43
|
+
await rm(destination, { recursive: true, force: true });
|
|
44
|
+
await cp(sourceDir, destination, { recursive: true });
|
|
45
|
+
return destination;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async function installWithDirectoryTargets(skillNames) {
|
|
35
49
|
const installed = [];
|
|
50
|
+
const failed = [];
|
|
51
|
+
const fallbacks = [];
|
|
52
|
+
const targets = [];
|
|
36
53
|
|
|
37
|
-
for (const
|
|
54
|
+
for (const target of directoryTargets) {
|
|
55
|
+
if (targetAgent && targetAgent !== target.agent) {
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
const root = target.root;
|
|
38
59
|
const parentExists = await exists(path.dirname(root));
|
|
39
60
|
const rootExists = await exists(root);
|
|
40
|
-
|
|
61
|
+
const explicitlyRequested = targetAgent === target.agent;
|
|
62
|
+
if (!rootExists && !parentExists && !explicitlyRequested) {
|
|
41
63
|
continue;
|
|
42
64
|
}
|
|
65
|
+
targets.push(target);
|
|
66
|
+
}
|
|
43
67
|
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
68
|
+
for (const target of targets) {
|
|
69
|
+
for (const skillName of skillNames) {
|
|
70
|
+
const sourceDir = path.join(sourceSkillsDir, skillName);
|
|
71
|
+
try {
|
|
72
|
+
const destination = await installSkillDir(skillName, sourceDir, target.root);
|
|
73
|
+
installed.push({ skill: skillName, adapter: target.agent, path: destination });
|
|
74
|
+
} catch (error) {
|
|
75
|
+
failed.push({ skill: skillName, adapter: target.agent, error: error instanceof Error ? error.message : String(error) });
|
|
76
|
+
}
|
|
77
|
+
}
|
|
49
78
|
}
|
|
50
79
|
|
|
51
|
-
return
|
|
80
|
+
return {
|
|
81
|
+
adapter: 'directory',
|
|
82
|
+
action: failed.length > 0 ? 'partial' : installed.length > 0 ? 'installed' : 'skipped',
|
|
83
|
+
installed,
|
|
84
|
+
failed,
|
|
85
|
+
fallbacks,
|
|
86
|
+
next_action: installed.length > 0 ? '' : 'Install a supported local agent or pass --agent for a specific directory target.',
|
|
87
|
+
};
|
|
52
88
|
}
|
|
53
89
|
|
|
54
90
|
async function listSkillNames() {
|
|
@@ -75,10 +111,14 @@ async function packageVersion() {
|
|
|
75
111
|
return JSON.parse(raw).version;
|
|
76
112
|
}
|
|
77
113
|
|
|
114
|
+
function skillsStampValue(version) {
|
|
115
|
+
return targetAgent ? `${version}:${targetAgent}` : version;
|
|
116
|
+
}
|
|
117
|
+
|
|
78
118
|
async function writeSkillsStamp() {
|
|
79
119
|
const version = await packageVersion();
|
|
80
120
|
await mkdir(path.dirname(stampPath), { recursive: true });
|
|
81
|
-
await writeFile(stampPath, version, 'utf8');
|
|
121
|
+
await writeFile(stampPath, skillsStampValue(version), 'utf8');
|
|
82
122
|
}
|
|
83
123
|
|
|
84
124
|
function runCommand(command, args) {
|
|
@@ -113,10 +153,100 @@ async function findAilySkillhub() {
|
|
|
113
153
|
return result.stdout.split(/\r?\n/).find((line) => line.trim())?.trim() || 'aily-skillhub';
|
|
114
154
|
}
|
|
115
155
|
|
|
156
|
+
async function findOpenClawCli() {
|
|
157
|
+
const command = process.platform === 'win32' ? 'where' : 'which';
|
|
158
|
+
const result = await runCommand(command, ['openclaw']);
|
|
159
|
+
if (result.exitCode !== 0) {
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
return result.stdout.split(/\r?\n/).find((line) => line.trim())?.trim() || 'openclaw';
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
async function installOpenClawFallback(skillNames) {
|
|
166
|
+
const root = path.join(homedir(), '.openclaw', 'skills');
|
|
167
|
+
const openclawHomeExists = await exists(path.dirname(root));
|
|
168
|
+
if (!openclawHomeExists && targetAgent !== 'openclaw') {
|
|
169
|
+
return [];
|
|
170
|
+
}
|
|
171
|
+
const installed = [];
|
|
172
|
+
for (const skillName of skillNames) {
|
|
173
|
+
const destination = await installSkillDir(skillName, path.join(sourceSkillsDir, skillName), root);
|
|
174
|
+
installed.push({ skill: skillName, adapter: 'openclaw-directory', path: destination });
|
|
175
|
+
}
|
|
176
|
+
return installed;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
async function installWithOpenClawCli(skillNames) {
|
|
180
|
+
if (!shouldRunAdapter('openclaw')) {
|
|
181
|
+
return { adapter: 'openclaw', action: 'skipped', installed: [], failed: [], fallbacks: [], next_action: '' };
|
|
182
|
+
}
|
|
183
|
+
const executable = await findOpenClawCli();
|
|
184
|
+
const installed = [];
|
|
185
|
+
const failed = [];
|
|
186
|
+
const fallbacks = [];
|
|
187
|
+
|
|
188
|
+
if (executable) {
|
|
189
|
+
for (const skillName of skillNames) {
|
|
190
|
+
const sourceDir = path.join(sourceSkillsDir, skillName);
|
|
191
|
+
const result = await runCommand(executable, ['skills', 'install', '--file-path', sourceDir]);
|
|
192
|
+
const item = {
|
|
193
|
+
skill: skillName,
|
|
194
|
+
adapter: 'openclaw',
|
|
195
|
+
path: sourceDir,
|
|
196
|
+
stdout: result.stdout.trim(),
|
|
197
|
+
stderr: result.stderr.trim(),
|
|
198
|
+
exitCode: result.exitCode,
|
|
199
|
+
};
|
|
200
|
+
if (result.exitCode === 0) {
|
|
201
|
+
installed.push(item);
|
|
202
|
+
} else {
|
|
203
|
+
failed.push(item);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
if (!executable || failed.length > 0) {
|
|
209
|
+
try {
|
|
210
|
+
fallbacks.push(...(await installOpenClawFallback(skillNames)));
|
|
211
|
+
} catch (error) {
|
|
212
|
+
failed.push({
|
|
213
|
+
skill: '*',
|
|
214
|
+
adapter: 'openclaw-directory',
|
|
215
|
+
error: error instanceof Error ? error.message : String(error),
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
return {
|
|
221
|
+
adapter: 'openclaw',
|
|
222
|
+
action: failed.length > 0 && installed.length + fallbacks.length > 0
|
|
223
|
+
? 'partial'
|
|
224
|
+
: installed.length + fallbacks.length > 0
|
|
225
|
+
? 'installed'
|
|
226
|
+
: 'skipped',
|
|
227
|
+
executable,
|
|
228
|
+
installed,
|
|
229
|
+
failed,
|
|
230
|
+
fallbacks,
|
|
231
|
+
next_action: installed.length + fallbacks.length > 0 ? '' : 'Install OpenClaw CLI or create ~/.openclaw before retrying.',
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
|
|
116
235
|
async function installWithAilySkillhub(skillNames) {
|
|
236
|
+
if (!shouldRunAdapter('aily')) {
|
|
237
|
+
return { adapter: 'aily', action: 'skipped', executable: null, installed: [], failed: [], fallbacks: [], next_action: '' };
|
|
238
|
+
}
|
|
117
239
|
const executable = await findAilySkillhub();
|
|
118
240
|
if (!executable) {
|
|
119
|
-
return {
|
|
241
|
+
return {
|
|
242
|
+
adapter: 'aily',
|
|
243
|
+
action: 'skipped',
|
|
244
|
+
executable: null,
|
|
245
|
+
installed: [],
|
|
246
|
+
failed: [],
|
|
247
|
+
fallbacks: [],
|
|
248
|
+
next_action: 'Install aily-skillhub or use --agent openclaw/generic for a different adapter.',
|
|
249
|
+
};
|
|
120
250
|
}
|
|
121
251
|
|
|
122
252
|
const installed = [];
|
|
@@ -126,6 +256,7 @@ async function installWithAilySkillhub(skillNames) {
|
|
|
126
256
|
const result = await runCommand(executable, ['install', '--file-path', sourceDir]);
|
|
127
257
|
const item = {
|
|
128
258
|
skill: skillName,
|
|
259
|
+
adapter: 'aily',
|
|
129
260
|
path: sourceDir,
|
|
130
261
|
stdout: result.stdout.trim(),
|
|
131
262
|
stderr: result.stderr.trim(),
|
|
@@ -139,10 +270,13 @@ async function installWithAilySkillhub(skillNames) {
|
|
|
139
270
|
}
|
|
140
271
|
|
|
141
272
|
return {
|
|
273
|
+
adapter: 'aily',
|
|
142
274
|
action: failed.length > 0 ? 'partial' : 'installed',
|
|
143
275
|
executable,
|
|
144
276
|
installed,
|
|
145
277
|
failed,
|
|
278
|
+
fallbacks: [],
|
|
279
|
+
next_action: failed.length > 0 ? 'Review aily-skillhub install errors and retry.' : '',
|
|
146
280
|
};
|
|
147
281
|
}
|
|
148
282
|
|
|
@@ -167,7 +301,6 @@ async function main() {
|
|
|
167
301
|
}
|
|
168
302
|
return result;
|
|
169
303
|
}
|
|
170
|
-
const allInstalled = [];
|
|
171
304
|
const sourceSkillDirs = [];
|
|
172
305
|
|
|
173
306
|
for (const skillName of skillNames) {
|
|
@@ -176,60 +309,63 @@ async function main() {
|
|
|
176
309
|
continue;
|
|
177
310
|
}
|
|
178
311
|
sourceSkillDirs.push(sourceDir);
|
|
179
|
-
const installed = await installSkillDir(skillName, sourceDir);
|
|
180
|
-
installed.forEach((target) => allInstalled.push(target));
|
|
181
312
|
}
|
|
182
|
-
const
|
|
313
|
+
const adapters = [
|
|
314
|
+
await installWithDirectoryTargets(skillNames),
|
|
315
|
+
await installWithOpenClawCli(skillNames),
|
|
316
|
+
await installWithAilySkillhub(skillNames),
|
|
317
|
+
];
|
|
318
|
+
const installedCount = adapters.reduce((sum, item) => sum + item.installed.length + item.fallbacks.length, 0);
|
|
319
|
+
const failedCount = adapters.reduce((sum, item) => sum + item.failed.length, 0);
|
|
183
320
|
|
|
184
|
-
if (
|
|
321
|
+
if (installedCount === 0) {
|
|
185
322
|
const result = {
|
|
186
323
|
ok: true,
|
|
187
324
|
action: 'skipped',
|
|
188
325
|
installed: [],
|
|
189
326
|
source_skills: sourceSkillDirs,
|
|
190
|
-
|
|
327
|
+
adapters,
|
|
328
|
+
agent: targetAgent || 'auto',
|
|
191
329
|
message: 'No compatible local agent skill directories detected.',
|
|
330
|
+
next_action: adapters.map((item) => item.next_action).filter(Boolean).join(' '),
|
|
192
331
|
};
|
|
193
332
|
if (jsonOutput) {
|
|
194
333
|
console.log(JSON.stringify(result, null, 2));
|
|
195
334
|
} else {
|
|
196
335
|
console.log('[bpmax-cli] No compatible local agent skill directories detected. Nothing installed.');
|
|
197
|
-
|
|
198
|
-
console.log('
|
|
199
|
-
}
|
|
200
|
-
if (ailySkillhub.failed.length > 0) {
|
|
201
|
-
console.log('[bpmax-cli] aily-skillhub install warnings:');
|
|
202
|
-
ailySkillhub.failed.forEach((item) => {
|
|
203
|
-
console.log(`- ${item.skill}: ${item.stderr || item.stdout || `exit ${item.exitCode}`}`);
|
|
204
|
-
});
|
|
205
|
-
}
|
|
336
|
+
adapters.flatMap((adapter) => adapter.failed).forEach((item) => {
|
|
337
|
+
console.log(`- ${item.adapter || 'adapter'} ${item.skill}: ${item.stderr || item.stdout || item.error || `exit ${item.exitCode}`}`);
|
|
338
|
+
});
|
|
206
339
|
setupHint.forEach((line) => console.log(line));
|
|
207
340
|
}
|
|
208
341
|
return result;
|
|
209
342
|
}
|
|
210
343
|
|
|
211
|
-
const result = {
|
|
344
|
+
const result = {
|
|
345
|
+
ok: true,
|
|
346
|
+
action: failedCount > 0 ? 'partial' : 'installed',
|
|
347
|
+
installed: adapters.flatMap((adapter) => adapter.installed),
|
|
348
|
+
fallbacks: adapters.flatMap((adapter) => adapter.fallbacks),
|
|
349
|
+
failed: adapters.flatMap((adapter) => adapter.failed),
|
|
350
|
+
source_skills: sourceSkillDirs,
|
|
351
|
+
adapters,
|
|
352
|
+
agent: targetAgent || 'auto',
|
|
353
|
+
next_action: failedCount > 0 ? 'Review failed adapter items and retry.' : '',
|
|
354
|
+
};
|
|
212
355
|
await writeSkillsStamp();
|
|
213
356
|
if (jsonOutput) {
|
|
214
357
|
console.log(JSON.stringify(result, null, 2));
|
|
215
358
|
} else {
|
|
216
|
-
if (
|
|
359
|
+
if (result.installed.length > 0 || result.fallbacks.length > 0) {
|
|
217
360
|
console.log('[bpmax-cli] Installed skills to:');
|
|
218
|
-
|
|
219
|
-
console.log(`- ${target}`);
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
if (ailySkillhub.action === 'skipped') {
|
|
223
|
-
console.log('[bpmax-cli] aily-skillhub not found in PATH, skipping aily skill install.');
|
|
224
|
-
} else {
|
|
225
|
-
console.log(`[bpmax-cli] aily-skillhub ${ailySkillhub.action}:`);
|
|
226
|
-
ailySkillhub.installed.forEach((item) => {
|
|
227
|
-
console.log(`- ${item.skill}`);
|
|
228
|
-
});
|
|
229
|
-
ailySkillhub.failed.forEach((item) => {
|
|
230
|
-
console.log(`- ${item.skill}: failed (${item.stderr || item.stdout || `exit ${item.exitCode}`})`);
|
|
361
|
+
[...result.installed, ...result.fallbacks].forEach((target) => {
|
|
362
|
+
console.log(`- ${target.path || target.skill}`);
|
|
231
363
|
});
|
|
232
364
|
}
|
|
365
|
+
adapters.forEach((adapter) => console.log(`[bpmax-cli] ${adapter.adapter} ${adapter.action}`));
|
|
366
|
+
result.failed.forEach((item) => {
|
|
367
|
+
console.log(`- ${item.adapter || 'adapter'} ${item.skill}: failed (${item.stderr || item.stdout || item.error || `exit ${item.exitCode}`})`);
|
|
368
|
+
});
|
|
233
369
|
setupHint.forEach((line) => console.log(line));
|
|
234
370
|
}
|
|
235
371
|
return result;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: bpmax-auth
|
|
3
3
|
version: 1.0.0
|
|
4
|
-
description: Use when the user needs BPMAX browser login, API key setup, auth status checks, logout, or diagnosis of
|
|
4
|
+
description: Use when the user needs BPMAX device authorization, browser login, API key setup, auth status checks, logout, or diagnosis of browserless agent and localhost callback issues around bpmax-cli authentication.
|
|
5
5
|
metadata:
|
|
6
6
|
requires:
|
|
7
7
|
bins: ["bpmax-cli"]
|
|
@@ -11,10 +11,11 @@ metadata:
|
|
|
11
11
|
# auth
|
|
12
12
|
|
|
13
13
|
> **前置条件:** 先阅读 `../bpmax-shared/SKILL.md`。
|
|
14
|
-
> **登录约束:**
|
|
14
|
+
> **登录约束:** Agent/飞书/OpenClaw 类无浏览器环境优先使用 device flow;本地终端才使用浏览器 callback flow。
|
|
15
15
|
|
|
16
16
|
## 何时使用
|
|
17
17
|
|
|
18
|
+
- 用户要在 OpenClaw、Aily、飞书或其它无浏览器 Agent 中登录 BPMAX
|
|
18
19
|
- 用户要登录 BPMAX
|
|
19
20
|
- 用户要检查当前 API Key 是否有效
|
|
20
21
|
- 用户要清空当前环境的登录状态
|
|
@@ -23,6 +24,9 @@ metadata:
|
|
|
23
24
|
## 命令
|
|
24
25
|
|
|
25
26
|
```bash
|
|
27
|
+
bpmax-cli auth device start --profile local --agent openclaw --channel feishu --format json
|
|
28
|
+
bpmax-cli auth device complete --profile local --session <device_code> --format json
|
|
29
|
+
bpmax-cli auth login --mode device --profile local
|
|
26
30
|
bpmax-cli auth login
|
|
27
31
|
bpmax-cli auth status
|
|
28
32
|
bpmax-cli auth logout
|
|
@@ -30,11 +34,32 @@ bpmax-cli auth logout
|
|
|
30
34
|
|
|
31
35
|
## 路由规则
|
|
32
36
|
|
|
33
|
-
-
|
|
37
|
+
- 首次接入某个环境且在 Agent/飞书中交互:优先用 `bpmax-cli init --agent openclaw|aily|generic --channel feishu --url <BPMAX_URL> --format json`
|
|
38
|
+
- 只需要发起无浏览器授权:用 `auth device start`,把返回的 `message_card.authorization_url` 和 `message_card.user_code` 发给用户
|
|
39
|
+
- 用户确认短码后:优先执行返回的 `message_card.next_command`;不要从 `next_action` 自然语言里猜命令
|
|
40
|
+
- 本地终端可继续用 `auth login`
|
|
34
41
|
- 只想确认当前身份和连通性:`auth status`
|
|
35
42
|
- 只清空当前 profile 的本地 API Key:`auth logout`
|
|
36
43
|
|
|
37
|
-
## 登录流程理解
|
|
44
|
+
## Device Flow 登录流程理解
|
|
45
|
+
|
|
46
|
+
`auth device start` 的固定链路:
|
|
47
|
+
|
|
48
|
+
1. CLI 读取目标 profile 的 `origin` 和 `workspace`
|
|
49
|
+
2. CLI 调用 BPMAX `POST /api/cli/device_authorizations`
|
|
50
|
+
3. 服务端返回 `device_code`、`user_code`、`verification_uri_complete`、过期时间和轮询间隔
|
|
51
|
+
4. Agent 将 `message_card` 渲染给用户,用户在 BPMAX 页面确认短码
|
|
52
|
+
5. Agent 执行 `message_card.next_command`,等价于 `auth device complete --session <device_code>`
|
|
53
|
+
6. CLI 调用 BPMAX `POST /api/cli/device_token`,拿到 API Key 后落盘
|
|
54
|
+
|
|
55
|
+
规则:
|
|
56
|
+
|
|
57
|
+
- 不要要求飞书内用户打开本机浏览器或等待 localhost callback
|
|
58
|
+
- 不要把 API Key 贴到聊天里
|
|
59
|
+
- `authorization_pending` 代表用户还没确认,可稍后重试 `complete`
|
|
60
|
+
- `expired_token` 代表短码过期,应重新 `start`
|
|
61
|
+
|
|
62
|
+
## 浏览器 Callback 登录流程理解
|
|
38
63
|
|
|
39
64
|
`auth login` 的固定链路:
|
|
40
65
|
|
|
@@ -51,9 +51,27 @@ bpmax-cli auth status
|
|
|
51
51
|
判定规则:
|
|
52
52
|
|
|
53
53
|
- 如果 profile 未配置,先走 `config profile add` 或 `config profile use`
|
|
54
|
-
- 如果当前 profile 没有可用 API Key
|
|
54
|
+
- 如果当前 profile 没有可用 API Key:
|
|
55
|
+
- OpenClaw/Aily/飞书等无浏览器 Agent 场景,优先走 `bpmax-cli init --agent <agent> --channel feishu --url <BPMAX_URL> --format json` 或 `auth device start/complete`
|
|
56
|
+
- 本地终端场景才走 `auth login`
|
|
55
57
|
- 如果用户明确指定环境,始终显式加 `--profile <name>`
|
|
56
58
|
|
|
59
|
+
## Agent 初始化
|
|
60
|
+
|
|
61
|
+
无浏览器 Agent 推荐统一入口:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
bpmax-cli init --agent openclaw --channel feishu --url "https://example.com/w:store_mgr" --name retail --format json
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
规则:
|
|
68
|
+
|
|
69
|
+
- `--agent` 决定 skills adapter:`openclaw`、`aily`、`codex`、`claude`、`gemini`、`generic`
|
|
70
|
+
- `--channel` 只影响输出给 Agent/UI 的消息结构,飞书使用 `feishu`
|
|
71
|
+
- 返回中的 `message_card` 是通用抽象,不是飞书专属协议
|
|
72
|
+
- Agent 应把 `message_card.authorization_url` 和 `message_card.user_code` 展示给用户
|
|
73
|
+
- 用户确认短码后,优先执行 `message_card.next_command`;不要从 `message_card.next_action` 自然语言里猜命令
|
|
74
|
+
|
|
57
75
|
## Profile Recipes
|
|
58
76
|
|
|
59
77
|
对环境强绑定、流程/表单强绑定的操作,不要直接沉淀到通用 `bpmax-*` skill。先检查当前 profile/workspace 是否已有本地 recipe:
|