bpmax-cli 0.1.29 → 0.1.30

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpmax-cli",
3
- "version": "0.1.29",
3
+ "version": "0.1.30",
4
4
  "description": "CLI for BPMAX environments with multi-profile config and local login callback flow",
5
5
  "type": "module",
6
6
  "bin": {
@@ -9,11 +9,25 @@ const sourceSkillsDir = path.join(projectRoot, 'skills');
9
9
  const jsonOutput = process.argv.includes('--json');
10
10
  const agentArgIndex = process.argv.indexOf('--agent');
11
11
  const targetAgent = agentArgIndex >= 0 ? process.argv[agentArgIndex + 1] : '';
12
- const setupHint = [
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',
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',
15
- '[bpmax-cli] To save the profile without browser authorization, add: --skip-login',
16
- ];
12
+ const effectiveAgent = targetAgent || '<agent>';
13
+ const agentGuidance = {
14
+ initialization: [
15
+ 'Agent action: ask the user to directly input a BPMAX workspace page URL, for example http://127.0.0.1:10018/w:store_mgr.',
16
+ `After the user replies with the URL, run: bpmax-cli init --agent ${effectiveAgent} --channel feishu --url "<USER_URL>" --name local --format json`,
17
+ 'For a local terminal/browser setup path, run instead: bpmax-cli setup "<USER_URL>" --name local',
18
+ ],
19
+ core_usage: [
20
+ 'Read JSON output first. Show message_card.authorization_url and message_card.user_code to the user.',
21
+ 'After the user confirms the short code in BPMAX, run message_card.next_command exactly; do not guess commands from natural-language next_action text.',
22
+ 'For later bpmax-cli decisions, prefer --format json and pass --profile <profile> when the target environment matters.',
23
+ ],
24
+ bbs_policy: [
25
+ 'For business requests, first look for BPMAX Business Skills (BBS): bpmax-cli bbs list --profile <profile> --format json',
26
+ `If no local/catalog match is available, sync BBS first and then decide again: bpmax-cli bbs sync --agent ${effectiveAgent} --profile <profile> --format json`,
27
+ `Before using a business skill, install or update it lazily: bpmax-cli bbs ensure <skill-key> --agent ${effectiveAgent} --profile <profile> --format json`,
28
+ ],
29
+ };
30
+ const agentGuidanceLines = Object.values(agentGuidance).flat().map((line) => `[bpmax-cli] ${line}`);
17
31
  const stampPath = path.join(homedir(), '.bpmax', 'skills.stamp');
18
32
  const openClawReminder = 'OpenClaw install already tries `openclaw skills install` and falls back to copying into ~/.openclaw/skills when needed. Do not manually copy skills unless this result reports a failure.';
19
33
 
@@ -327,6 +341,7 @@ async function main() {
327
341
  source_skills: sourceSkillDirs,
328
342
  adapters,
329
343
  agent: targetAgent || 'auto',
344
+ agent_guidance: agentGuidance,
330
345
  message: 'No compatible local agent skill directories detected.',
331
346
  next_action: adapters.map((item) => item.next_action).filter(Boolean).join(' '),
332
347
  };
@@ -337,7 +352,7 @@ async function main() {
337
352
  adapters.flatMap((adapter) => adapter.failed).forEach((item) => {
338
353
  console.log(`- ${item.adapter || 'adapter'} ${item.skill}: ${item.stderr || item.stdout || item.error || `exit ${item.exitCode}`}`);
339
354
  });
340
- setupHint.forEach((line) => console.log(line));
355
+ agentGuidanceLines.forEach((line) => console.log(line));
341
356
  }
342
357
  return result;
343
358
  }
@@ -351,6 +366,7 @@ async function main() {
351
366
  source_skills: sourceSkillDirs,
352
367
  adapters,
353
368
  agent: targetAgent || 'auto',
369
+ agent_guidance: agentGuidance,
354
370
  next_action: failedCount > 0 ? 'Review failed adapter items and retry.' : '',
355
371
  ...(targetAgent === 'openclaw' ? { reminder: openClawReminder } : {}),
356
372
  };
@@ -371,7 +387,7 @@ async function main() {
371
387
  result.failed.forEach((item) => {
372
388
  console.log(`- ${item.adapter || 'adapter'} ${item.skill}: failed (${item.stderr || item.stdout || item.error || `exit ${item.exitCode}`})`);
373
389
  });
374
- setupHint.forEach((line) => console.log(line));
390
+ agentGuidanceLines.forEach((line) => console.log(line));
375
391
  }
376
392
  return result;
377
393
  }
@@ -25,6 +25,8 @@ bpmax-cli bbs uninstall <skill-key> --agent openclaw --profile <profile> --forma
25
25
 
26
26
  ## 规则
27
27
 
28
+ - 每次新会话、切换 profile/workspace,或用户需求看起来是业务流程、审批、门店、库存、项目处理时,先检查是否已有匹配 BBS。
29
+ - 若本地 catalog 或 `bbs list` 没有匹配业务 skill,先运行 `bpmax-cli bbs sync --agent <agent> --profile <profile> --format json`,再重新判断是否有匹配 BBS。
28
30
  - `bbs sync` 只安装 `bpmax-business-skill-catalog`,不安装所有业务 skill。
29
31
  - 使用业务 skill 前先运行 `bbs ensure <skill-key>`。
30
32
  - `bbs ensure` 会自动检测远端最新版本;本地缺失或版本落后时直接安装/更新。
@@ -10,7 +10,26 @@ metadata:
10
10
 
11
11
  # bpmax-cli
12
12
 
13
- 这是总入口 skill,只负责分流,不承载具体业务规则。
13
+ 这是总入口 skill,负责建立 Agent 使用 bpmax-cli 的基础行为,再按场景分流到更具体的 `bpmax-*` skill。
14
+
15
+ ## Agent 基础行为
16
+
17
+ - 先应用 `../bpmax-shared/SKILL.md` 的命令发现、profile/auth 检查、全局参数、JSON 输出、URL 生成和原始 API 降级规则。
18
+ - 未初始化时,不要直接编造 profile 或 API Key;先要求用户提供 BPMAX workspace 页面 URL,再优先运行:
19
+
20
+ ```bash
21
+ bpmax-cli init --agent <agent> --channel feishu --url "<BPMAX_URL>" --name local --format json
22
+ ```
23
+
24
+ - `init` 返回后,Agent 必须展示 `message_card.authorization_url` 和 `message_card.user_code` 给用户;用户确认短码后,逐字执行 `message_card.next_command`,不要从 `message_card.next_action` 自然语言里猜命令。
25
+ - 后续需要 Agent 判断或串联操作时,优先使用 `--format json`;用户明确环境时显式加 `--profile <name>`。
26
+
27
+ ## 业务需求优先 BBS
28
+
29
+ - 用户需求看起来是业务流程、审批、门店、库存、项目处理或环境强绑定操作时,先进入 `../bpmax-business-skill/SKILL.md`,不要直接从通用 flow/project/api 开始。
30
+ - 先查本地/远端 BBS 列表;没有匹配业务 skill 时先同步 BBS catalog,再重新判断。
31
+ - 找到匹配业务 skill 后,先 `bpmax-cli bbs ensure <skill-key> --agent <agent> --profile <profile> --format json`,再按该业务 skill 的规则执行。
32
+ - 只有没有匹配 BBS,或 BBS 不覆盖当前需求时,才回落到通用 `bpmax-flow`、`bpmax-project` 或 `bpmax-api` 路径。
14
33
 
15
34
  ## 路由规则
16
35
 
@@ -21,6 +40,7 @@ metadata:
21
40
  - 项目列表、项目详情、我的待办、最小创建:读 `../bpmax-project/SKILL.md`
22
41
  - 系统内页面 URL 生成:先读 `../bpmax-shared/SKILL.md` 的“系统内 URL 生成”
23
42
  - 本地 schema manifest:读 `../bpmax-schema/SKILL.md`
43
+ - BPMAX Business Skills 查询、同步、安装、更新、卸载:读 `../bpmax-business-skill/SKILL.md`
24
44
 
25
45
  ## 规则
26
46