bpmax-cli 0.2.1-beta.30 → 0.2.1-beta.32
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 +2 -0
- package/dist/bin.js +1883 -282
- package/dist/bin.js.map +1 -1
- package/package.json +4 -3
- package/scripts/run-source-cli.mjs +121 -0
- package/skills/bpmax-approval-matrix/SKILL.md +32 -1
- package/skills/bpmax-cli/SKILL.md +5 -0
- package/skills/bpmax-e2e-flow-config-orchestrator/SKILL.md +1 -1
- package/skills/bpmax-flow-template-editor/SKILL.md +1 -0
- package/skills/bpmax-flow-template-editor/references/flow-template-api-workflow.md +1 -0
- package/skills/bpmax-group-model-editor/SKILL.md +24 -0
- package/skills/bpmax-memory-protocol/SKILL.md +7 -6
- package/skills/bpmax-shared/SKILL.md +19 -9
- package/skills/bpmax-team-editor/SKILL.md +27 -0
- package/skills/bpmax-user/SKILL.md +26 -1
- package/skills/bpmax-user-model-editor/SKILL.md +24 -0
package/package.json
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bpmax-cli",
|
|
3
|
-
"version": "0.2.1-beta.
|
|
3
|
+
"version": "0.2.1-beta.32",
|
|
4
4
|
"description": "CLI for BPMAX environments with multi-profile config and local login callback flow",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
-
"bpmax-cli": "
|
|
7
|
+
"bpmax-cli": "scripts/run-source-cli.mjs"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
10
|
"dist",
|
|
11
11
|
"scripts/install-skills.mjs",
|
|
12
|
+
"scripts/run-source-cli.mjs",
|
|
12
13
|
"skills",
|
|
13
14
|
"!skills/**/__pycache__/**",
|
|
14
15
|
"!skills/**/*.py[cod]",
|
|
@@ -26,7 +27,7 @@
|
|
|
26
27
|
"node": ">=18"
|
|
27
28
|
},
|
|
28
29
|
"dependencies": {
|
|
29
|
-
"@clack/prompts": "
|
|
30
|
+
"@clack/prompts": "1.0.1",
|
|
30
31
|
"axios": "^1.9.0",
|
|
31
32
|
"commander": "^14.0.0",
|
|
32
33
|
"jszip": "^3.10.1",
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { spawn } from 'node:child_process';
|
|
4
|
+
import { readdir, readFile, stat } from 'node:fs/promises';
|
|
5
|
+
import { homedir } from 'node:os';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
import process from 'node:process';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
|
|
10
|
+
const projectRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
11
|
+
const distEntrypoint = path.join(projectRoot, 'dist', 'bin.js');
|
|
12
|
+
const skillsStamp = path.join(homedir(), '.bpmax', 'skills.stamp');
|
|
13
|
+
|
|
14
|
+
async function mtimeMs(targetPath) {
|
|
15
|
+
try {
|
|
16
|
+
return (await stat(targetPath)).mtimeMs;
|
|
17
|
+
} catch {
|
|
18
|
+
return 0;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async function newestMtime(targetPath) {
|
|
23
|
+
let targetStat;
|
|
24
|
+
try {
|
|
25
|
+
targetStat = await stat(targetPath);
|
|
26
|
+
} catch {
|
|
27
|
+
return 0;
|
|
28
|
+
}
|
|
29
|
+
if (!targetStat.isDirectory()) {
|
|
30
|
+
return targetStat.mtimeMs;
|
|
31
|
+
}
|
|
32
|
+
const entries = await readdir(targetPath, { withFileTypes: true });
|
|
33
|
+
const mtimes = await Promise.all(entries.map((entry) => newestMtime(path.join(targetPath, entry.name))));
|
|
34
|
+
return Math.max(targetStat.mtimeMs, ...mtimes);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function run(command, args, options = {}) {
|
|
38
|
+
return new Promise((resolve, reject) => {
|
|
39
|
+
const child = spawn(command, args, {
|
|
40
|
+
cwd: options.cwd,
|
|
41
|
+
env: options.env || process.env,
|
|
42
|
+
stdio: options.stdio || 'inherit',
|
|
43
|
+
});
|
|
44
|
+
child.on('error', reject);
|
|
45
|
+
child.on('close', (code, signal) => resolve({ code: code ?? 1, signal }));
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async function ensureBuild() {
|
|
50
|
+
const sourceTreeMtime = await newestMtime(path.join(projectRoot, 'src'));
|
|
51
|
+
if (!sourceTreeMtime) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const distMtime = await mtimeMs(distEntrypoint);
|
|
55
|
+
const sourceMtime = Math.max(
|
|
56
|
+
sourceTreeMtime,
|
|
57
|
+
await mtimeMs(path.join(projectRoot, 'package.json')),
|
|
58
|
+
await mtimeMs(path.join(projectRoot, 'tsup.config.ts')),
|
|
59
|
+
await mtimeMs(path.join(projectRoot, 'tsconfig.json')),
|
|
60
|
+
);
|
|
61
|
+
if (distMtime >= sourceMtime) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const result = await run('npm', ['run', 'build', '--silent'], { cwd: projectRoot });
|
|
65
|
+
if (result.code !== 0) {
|
|
66
|
+
throw new Error(`failed to build source bpmax-cli (exit ${result.code})`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
async function ensureSkills() {
|
|
71
|
+
if (process.env.BPMAX_CLI_SOURCE_SKIP_SKILLS_SYNC) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const packageJson = JSON.parse(await readFile(path.join(projectRoot, 'package.json'), 'utf8'));
|
|
75
|
+
const currentStamp = await readFile(skillsStamp, 'utf8').then((value) => value.trim()).catch(() => '');
|
|
76
|
+
const stampMtime = await mtimeMs(skillsStamp);
|
|
77
|
+
const sourceSkillsMtime = await newestMtime(path.join(projectRoot, 'skills'));
|
|
78
|
+
if (currentStamp === packageJson.version && stampMtime >= sourceSkillsMtime) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const result = await run(process.execPath, [path.join(projectRoot, 'scripts', 'install-skills.mjs')], {
|
|
82
|
+
cwd: projectRoot,
|
|
83
|
+
stdio: ['ignore', 'ignore', 'inherit'],
|
|
84
|
+
});
|
|
85
|
+
if (result.code !== 0) {
|
|
86
|
+
throw new Error(`failed to sync source bpmax-cli skills (exit ${result.code})`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
async function main() {
|
|
91
|
+
await ensureBuild();
|
|
92
|
+
await ensureSkills();
|
|
93
|
+
const child = spawn(process.execPath, [distEntrypoint, ...process.argv.slice(2)], {
|
|
94
|
+
cwd: process.cwd(),
|
|
95
|
+
env: {
|
|
96
|
+
...process.env,
|
|
97
|
+
BPMAX_CLI_HOME: projectRoot,
|
|
98
|
+
BPMAX_CLI_SOURCE_ACTIVE: '1',
|
|
99
|
+
},
|
|
100
|
+
stdio: 'inherit',
|
|
101
|
+
});
|
|
102
|
+
for (const signal of ['SIGINT', 'SIGTERM']) {
|
|
103
|
+
process.on(signal, () => child.kill(signal));
|
|
104
|
+
}
|
|
105
|
+
child.on('error', (error) => {
|
|
106
|
+
console.error(`[bpmax-cli] failed to start source CLI: ${error.message}`);
|
|
107
|
+
process.exitCode = 1;
|
|
108
|
+
});
|
|
109
|
+
child.on('close', (code, signal) => {
|
|
110
|
+
if (signal) {
|
|
111
|
+
process.kill(process.pid, signal);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
process.exitCode = code ?? 1;
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
main().catch((error) => {
|
|
119
|
+
console.error(`[bpmax-cli] ${error instanceof Error ? error.message : String(error)}`);
|
|
120
|
+
process.exitCode = 1;
|
|
121
|
+
});
|
|
@@ -44,13 +44,44 @@ bpmax-cli taskbook lint --source .codex/tmp/TASKBOOK.md
|
|
|
44
44
|
|
|
45
45
|
2. Matrix app:
|
|
46
46
|
|
|
47
|
+
完整矩阵定义优先使用聚合生命周期命令。矩阵定义必须同时包含表单、`category=matrix` 流程、数据集、带 `ProjectDetailEdit` 修改操作的列表、筛选器和工作区绑定;流程至少保留一个名为“生效中/进行中”或 `status=1` 的维护环节:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
bpmax-cli matrix app create --workspace <workspace> --name "<matrix name>" \
|
|
51
|
+
--form-work <form-work.json> --flow-work <flow-work.json> \
|
|
52
|
+
--dataset-work <dataset-work.json> --list-work <list-work.json> \
|
|
53
|
+
--filter-work <filter-work.json> --format json
|
|
54
|
+
bpmax-cli matrix app create --workspace <workspace> --name "<matrix name>" \
|
|
55
|
+
--form-work <form-work.json> --flow-work <flow-work.json> \
|
|
56
|
+
--dataset-work <dataset-work.json> --list-work <list-work.json> \
|
|
57
|
+
--filter-work <filter-work.json> \
|
|
58
|
+
--confirm "create matrix app <matrix name> in <workspace>" --format json
|
|
59
|
+
bpmax-cli matrix app readback --workspace <workspace> --flow-type <matrix_flow_type> --format json
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
编辑矩阵定义时,用 typed config build 产物组成 batch manifest,再执行聚合更新;更新成功后命令会对完整矩阵对象图做 exact readback:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
bpmax-cli matrix app update --workspace <workspace> --flow-type <matrix_flow_type> --manifest <manifest.json> --format json
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
删除默认先 dry-run,确认对象图和删除顺序后才执行:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
bpmax-cli matrix app delete --workspace <workspace> --flow-type <matrix_flow_type> --format json
|
|
72
|
+
bpmax-cli matrix app delete --workspace <workspace> --flow-type <matrix_flow_type> \
|
|
73
|
+
--confirm "delete matrix app <matrix_flow_type> from <workspace>" --format json
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
`matrix app create/update/delete/readback` 是完整维护入口。下面的 `config flow-app create` 只保留为通用流程应用底层能力,单独使用时不会创建矩阵数据集、列表或筛选器:
|
|
77
|
+
|
|
47
78
|
```bash
|
|
48
79
|
bpmax-cli config flow-app create --workspace <workspace> --form-work <matrix-form-work> --flow-work <matrix-flow-work> --name "<matrix name>"
|
|
49
80
|
bpmax-cli config flow-app create --workspace <workspace> --form-work <matrix-form-work> --flow-work <matrix-flow-work> --name "<matrix name>" --confirm "create flow-app <matrix name> in <workspace>" --evidence-out .codex/tmp/matrix-target-context.csv --response-out .codex/tmp/matrix-flow-app-create.response.json
|
|
50
81
|
bpmax-cli config flow-app context --workspace <workspace> --flow <matrix_flow_type> --evidence-out .codex/tmp/matrix-target-context.csv --format json
|
|
51
82
|
```
|
|
52
83
|
|
|
53
|
-
`flow-app create
|
|
84
|
+
若使用底层 `flow-app create`,确认执行必须同时保留 `--response-out` 和 `--evidence-out`。`config flow-app context` 的 `target_context.evidence_status` 必须是 `verified`,且 `missing_context` 必须为空,才允许进入规则记录 seed、主流程 `matrix_owner` 接入或导航配置。该 evidence 是矩阵应用的 apply-ready 上下文,必须记录 `flow_type`、`flow_template_id`、`form_template_id`、`form_template_draft_id`、`workspace_key` 和 `workspace_readback_hash`。
|
|
54
85
|
|
|
55
86
|
3. Matrix rule records:
|
|
56
87
|
|
|
@@ -15,6 +15,8 @@ metadata:
|
|
|
15
15
|
## Agent 基础行为
|
|
16
16
|
|
|
17
17
|
- 先应用 `../bpmax-shared/SKILL.md` 的命令发现、profile/auth 检查、全局参数、JSON 输出、URL 生成和原始 API 降级规则。
|
|
18
|
+
- 每次读取 CLI JSON 对象时都必须检查 `_notice`。出现 `_notice.update` 或 `_notice.skills` 时,先向用户简要说明当前版本、目标版本和更新渠道,再逐字执行其中的 `next_command`;更新失败则停止后续 BPMAX 配置或正式 E2E,不得继续混用旧 CLI 与旧 Skills。JSON 数组、NDJSON、table 和错误输出中的通知会写到 stderr,也必须读取。
|
|
19
|
+
- beta 版本只跟踪 npm `beta` 渠道,稳定版本只跟踪 `latest` 渠道。不要把 beta 与 stable 的比较结果混在一起,也不要自行改写通知返回的更新命令。
|
|
18
20
|
- 未初始化时,不要直接编造 profile、config-dir 或 API Key;先要求用户提供 BPMAX workspace 页面 URL。Agent 多用户环境必须从可信 runtime metadata 读取稳定用户/会话 scope,优先使用 channel + peer/user,至少使用 user id,再运行:
|
|
19
21
|
|
|
20
22
|
```bash
|
|
@@ -72,6 +74,9 @@ bpmax-cli issue create --title "<标题>" --description-file <file.md> --label b
|
|
|
72
74
|
- 环境配置、全局参数、命令发现、原始 API 降级:先读 `../bpmax-shared/SKILL.md`
|
|
73
75
|
- 浏览器登录、API Key、认证状态:读 `../bpmax-auth/SKILL.md`
|
|
74
76
|
- 当前用户:读 `../bpmax-user/SKILL.md`
|
|
77
|
+
- 团队、部门层级和团队管理员配置:读 `../bpmax-team-editor/SKILL.md`
|
|
78
|
+
- 用户模型配置:读 `../bpmax-user-model-editor/SKILL.md`
|
|
79
|
+
- 团队模型配置:读 `../bpmax-group-model-editor/SKILL.md`
|
|
75
80
|
- 刷新配置库、同步最新配置、latest pull:读 `../bpmax-config-latest/SKILL.md`
|
|
76
81
|
- 流程列表、流程选项、流程详情:读 `../bpmax-flow/SKILL.md`
|
|
77
82
|
- 项目列表、项目详情、我的待办、最小创建:读 `../bpmax-project/SKILL.md`
|
|
@@ -42,7 +42,7 @@ bpmax-cli config flow-app create --workspace <workspace> --form-work <form-work-
|
|
|
42
42
|
bpmax-cli config flow-app create --workspace <workspace> --form-work <form-work-file> --flow-work <flow-work-file> --name <name> --confirm "create flow-app <name> in <workspace>" --evidence-out .codex/tmp/target-context.csv --response-out .codex/tmp/flow-app-create.response.json
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
- `flow-app lint`
|
|
45
|
+
- `flow-app lint` 是新建应用的聚合前置 gate;需要单独校验 pre-create flow work 时,使用 `config flow-template lint --mode create`,此时 `flow_type` 仍由平台分配,不得伪造。
|
|
46
46
|
- `flow-app create` 的 dry-run 必须展示完整 operation plan:创建表单、发布表单、创建流程壳、绑定 `data.meta.form_template=<published_id>`、保存/发布流程、绑定工作区、回读验证。缺任何关键步骤都不得确认执行。
|
|
47
47
|
- dry-run 中 `operation_plan.save_flow_draft.payload_summary.data.meta.form_template` 必须显示 `<published-form-id>`,否则不能确认执行。
|
|
48
48
|
- 确认文本不得猜:dry-run JSON 必须包含 `required_confirm`,真实执行时直接复制该值;若确认文本不匹配,必须视为失败,不得把 dry-run JSON 当成功结果。
|
|
@@ -16,6 +16,7 @@ description: "用于通过 bpmax-cli typed config 能力创建和编辑 BPMAX
|
|
|
16
16
|
- 执行前必须运行 `bpmax-cli config adapters --format json` 核对 `flow-template`;只有 `build_status` 和 `submit_status` 都是 `supported` 时才允许 build/submit。
|
|
17
17
|
- 远端写操作只能走 typed CLI:编辑已有流程走 `bpmax-cli config flow-template submit`,新建主流程走 `bpmax-cli config flow-template create`。
|
|
18
18
|
- 新建主流程必须确认 capability `config.flow_template.create`,且 adapter 写端点包含 `POST /api/flow/flow_type`。确认文本为 `create flow-template <name>`。
|
|
19
|
+
- 新建主流程在平台分配 `flow_type` 前,必须使用 `config flow-template lint --mode create --work <work-file>`;编辑已有流程使用 `--mode edit` 或 work 中的真实 `flow_type`。不要为了通过 lint 伪造 `flow_type`。
|
|
19
20
|
- 不得改用 raw API、页面 fetch 或旧 submit 脚本;不得使用 `bpmax-cli api POST/PUT/DELETE /flow*` 绕过 typed config。
|
|
20
21
|
- 不得直接编辑 `think_*/` 目录中的配置文件来完成流程配置修改;`think_*` 只允许作为只读镜像、定位线索和 diff 依据。所有写入必须落到 `.codex/tmp/flow-template-editor/work`,再由 typed CLI build/submit/create。
|
|
21
22
|
- 若要发布主流程到 live,必须通过 typed CLI 的 `--publish-live` 路径执行;不要手动调用 `PUT /api/flow`。
|
|
@@ -81,6 +81,7 @@ typed CLI 执行口径:
|
|
|
81
81
|
|
|
82
82
|
```bash
|
|
83
83
|
bpmax-cli config flow-template create --work .codex/tmp/flow-template-editor/work/<create-file>.json
|
|
84
|
+
bpmax-cli config flow-template lint --mode create --work .codex/tmp/flow-template-editor/work/<create-file>.json
|
|
84
85
|
bpmax-cli config flow-template create --work .codex/tmp/flow-template-editor/work/<create-file>.json --confirm "create flow-template <name>"
|
|
85
86
|
```
|
|
86
87
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: bpmax-group-model-editor
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
description: "Use when creating or editing BPMAX team models through the bpmax-cli typed group-model adapter."
|
|
5
|
+
metadata:
|
|
6
|
+
requires:
|
|
7
|
+
bins: ["bpmax-cli"]
|
|
8
|
+
cliHelp: "bpmax-cli config group-model --help"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# BPMAX Group Model Editor
|
|
12
|
+
|
|
13
|
+
先阅读 `../bpmax-shared/SKILL.md`。使用 `config group-model export/lint/build/submit/verify` 完成配置。
|
|
14
|
+
|
|
15
|
+
标准命令必须显式使用 `--id`:`export --id <id>`、`submit --id <id>`、`verify --id <id>`、`delete --id <id>`。不得把 ID 当作位置参数。
|
|
16
|
+
|
|
17
|
+
## 规则
|
|
18
|
+
|
|
19
|
+
- `key` 必须稳定;`name` 最长 20 个字符。
|
|
20
|
+
- `permission`、`auto_trigger_flows` 必须是对象,`object_event`、`sub_ids` 必须是数组。
|
|
21
|
+
- `sub_ids` 不得包含自身或重复 ID;引用的子模型必须先通过 typed readback 验证。
|
|
22
|
+
- 数字 ID 和 `sub_ids` 引用必须属于当前 profile 对应组织;不得通过其他组织的数字 ID 复用模型。
|
|
23
|
+
- 修改模型表单不会自动为既有团队创建默认表单;需要时单独执行初始化并回读。
|
|
24
|
+
- 模型被团队使用时平台会拒绝删除,不得通过 raw API 绕过。
|
|
@@ -13,7 +13,9 @@ Memory is isolated by the API Key's bound agent. The CLI only chooses scope:
|
|
|
13
13
|
|
|
14
14
|
- `user`: current BPMAX user + current agent
|
|
15
15
|
- `organization`: current organization + current agent
|
|
16
|
-
- `all`: search
|
|
16
|
+
- `all`: search both user and organization scopes
|
|
17
|
+
|
|
18
|
+
当前 memory 后端只支持 `status`、`search`、`add`。`list/get/update/delete` 会在 capability 中标记为 `adapter_not_implemented`,不得绕过 capability 直接调用旧 Mem0 路径。当前后端也不支持 metadata filters 或独立 metadata 持久化;需要保留的类型、domain 和对象身份应简洁写入 memory 文本本身。
|
|
17
19
|
|
|
18
20
|
## Start Of Work
|
|
19
21
|
|
|
@@ -30,7 +32,7 @@ Good queries include the business name, workspace, `flow_type`, template/data-se
|
|
|
30
32
|
|
|
31
33
|
## Write Back
|
|
32
34
|
|
|
33
|
-
Only write reusable conclusions.
|
|
35
|
+
Only write reusable conclusions. Prefix the text with one of these stable types:
|
|
34
36
|
|
|
35
37
|
- `decision`: durable design or implementation decision
|
|
36
38
|
- `task_learning`: verified method that should be reused
|
|
@@ -41,8 +43,7 @@ Only write reusable conclusions. Prefer these metadata types:
|
|
|
41
43
|
|
|
42
44
|
```bash
|
|
43
45
|
bpmax-cli memory add --profile <profile> --scope user \
|
|
44
|
-
--text "<short reusable learning>" \
|
|
45
|
-
--metadata '{"type":"task_learning","domain":"flow-template","workspace":"store_mgr","flow_type":"flow_xxx","project_id":"bpmax"}' \
|
|
46
|
+
--text "type=task_learning; domain=flow-template; flow_type=flow_xxx; <short reusable learning>" \
|
|
46
47
|
--format json
|
|
47
48
|
```
|
|
48
49
|
|
|
@@ -54,8 +55,7 @@ When pausing, switching threads, or approaching context limits, write a short `s
|
|
|
54
55
|
|
|
55
56
|
```bash
|
|
56
57
|
bpmax-cli memory add --profile <profile> --scope user \
|
|
57
|
-
--text "goal=<goal>; done=<done>; files=<key files>; next=<next step>" \
|
|
58
|
-
--metadata '{"type":"session_state","project_id":"bpmax","tags":["handoff"]}' \
|
|
58
|
+
--text "type=session_state; goal=<goal>; done=<done>; files=<key files>; next=<next step>" \
|
|
59
59
|
--format json
|
|
60
60
|
```
|
|
61
61
|
|
|
@@ -66,6 +66,7 @@ bpmax-cli memory add --profile <profile> --scope user \
|
|
|
66
66
|
- If memory is unavailable, continue the task and note that memory lookup/writeback failed.
|
|
67
67
|
- Do not use raw Mem0 URLs, curl, Python helper scripts, or environment variables from old per-environment skills.
|
|
68
68
|
- Do not pass `--agent`; `bpmax-cli memory` intentionally has no agent option.
|
|
69
|
+
- Do not pass `--filters` or rely on `--metadata` for retrieval until the platform capability explicitly reports metadata support.
|
|
69
70
|
|
|
70
71
|
## Output
|
|
71
72
|
|
|
@@ -14,31 +14,41 @@ metadata:
|
|
|
14
14
|
|
|
15
15
|
## 命令发现
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
若提供了 `BPMAX_CLI_HOME`,必须优先使用该源码 checkout,不能因为 PATH 中存在旧版全局命令而回退。源码入口会在需要时自动构建,并在执行命令前把 bundled Skills 同步到当前源码版本:
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
|
-
|
|
20
|
+
node "$BPMAX_CLI_HOME/scripts/run-source-cli.mjs" --help
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
在 `bpmax-cli` 源码仓库内开发或联调时,先执行一次 `npm link`。之后 bare `bpmax-cli` 会链接到同一个源码入口,迁移脚本中的子进程也会自动使用当前源码:
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
|
-
|
|
26
|
+
npm link
|
|
27
|
+
bpmax-cli --version
|
|
27
28
|
```
|
|
28
29
|
|
|
29
|
-
|
|
30
|
+
若没有 `BPMAX_CLI_HOME`,才允许使用 PATH 中的已安装命令:
|
|
30
31
|
|
|
31
32
|
```bash
|
|
32
|
-
|
|
33
|
-
npm --prefix "$BPMAX_CLI_HOME" run build
|
|
33
|
+
bpmax-cli --help
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
后文默认直接写 `bpmax-cli
|
|
36
|
+
后文默认直接写 `bpmax-cli`。设置了 `BPMAX_CLI_HOME` 但没有执行 `npm link` 时,把所有命令前缀替换成:
|
|
37
37
|
|
|
38
38
|
```bash
|
|
39
|
-
node "$BPMAX_CLI_HOME/
|
|
39
|
+
node "$BPMAX_CLI_HOME/scripts/run-source-cli.mjs" ...
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
+
禁止在同一次迁移中混用源码 CLI、旧全局 CLI 和不同版本 Skills。开始迁移前必须确认 `--version` 与 `$BPMAX_CLI_HOME/package.json` 一致,且命令输出不再出现 Skills out-of-sync notice。
|
|
43
|
+
|
|
44
|
+
## Agent 更新通知
|
|
45
|
+
|
|
46
|
+
- 所有 Agent、OpenClaw、Aily、Codex 和自动化调用都必须读取 CLI 返回的 `_notice`,不能只读取业务字段。
|
|
47
|
+
- `_notice.update` 表示当前安装渠道存在更高版本;beta 安装跟踪 `beta`,稳定安装跟踪 `latest`。先展示 `current/latest/channel`,再执行返回的 `next_command`。
|
|
48
|
+
- `_notice.skills` 表示 bundled Skills 未安装或与 CLI 不匹配;必须先执行返回的 `next_command` 完成同步。
|
|
49
|
+
- JSON 对象中的通知位于 `_notice`;JSON 数组、NDJSON、table、pretty 和命令错误中的通知通过 stderr 输出。Agent 必须同时读取 stdout 和 stderr。
|
|
50
|
+
- 更新失败时停止后续配置提交和正式 E2E,并向用户展示结构化错误;不得静默忽略更新提示或继续使用旧 lint/Skill。
|
|
51
|
+
|
|
42
52
|
## 开始前检查
|
|
43
53
|
|
|
44
54
|
任何 BPMAX CLI 场景都先做两步。本地终端可直接运行;Agent/飞书/OpenClaw/Aily 等多用户运行时必须使用 `init` 返回的 `next_commands.profile_list` 和 `next_commands.auth_status`,不要裸跑共享配置命令:
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: bpmax-team-editor
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
description: "Use when creating or editing BPMAX teams and organization hierarchy through the bpmax-cli typed team adapter."
|
|
5
|
+
metadata:
|
|
6
|
+
requires:
|
|
7
|
+
bins: ["bpmax-cli"]
|
|
8
|
+
cliHelp: "bpmax-cli config team --help"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# BPMAX Team Editor
|
|
12
|
+
|
|
13
|
+
先阅读 `../bpmax-shared/SKILL.md`。团队配置必须在已初始化的 BPMAX 配置目录中,通过 typed CLI 完成。
|
|
14
|
+
|
|
15
|
+
## 标准链路
|
|
16
|
+
|
|
17
|
+
1. `bpmax-cli config team export --id <id> --out <dir> --profile <profile> --format json`
|
|
18
|
+
2. 只修改 work 文件中的 `name`、`intro`、`parent_id`、`model_id`、`permission`、`admin_users` 或 `meta_form`;导出的 `platform_id` 必须原样保留。
|
|
19
|
+
3. 运行 `lint`、`build`,审阅 dry-run 后再 `submit --id <id> --confirm "submit team <id>"`。
|
|
20
|
+
4. 运行 `verify --id <id>`,确认父级、模型、权限和管理员回读一致。
|
|
21
|
+
|
|
22
|
+
## 硬门禁
|
|
23
|
+
|
|
24
|
+
- `parent_id` 不得指向自身;调整层级前必须确认目标父团队存在且不会形成环。
|
|
25
|
+
- 不得修改 `path`、`organization_id`、`platform_*`、`is_del`、时间戳等服务端或外部同步字段。已有 `platform_id` 是只读身份字段,删除或改变都会被 build/submit 硬阻断;create 也不得手工指定。
|
|
26
|
+
- 不得直接修改 `think_group` 文件代替 typed submit。
|
|
27
|
+
- 删除前必须确认没有子团队、成员或业务对象仍依赖该团队;平台拒绝时不得绕过。
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: bpmax-user
|
|
3
3
|
version: 1.0.0
|
|
4
|
-
description: Use when the user needs to
|
|
4
|
+
description: Use when the user needs to query, resolve, create, or safely edit BPMAX organization users and identity relations through typed bpmax-cli commands.
|
|
5
5
|
metadata:
|
|
6
6
|
requires:
|
|
7
7
|
bins: ["bpmax-cli"]
|
|
@@ -19,6 +19,21 @@ bpmax-cli user current --format json
|
|
|
19
19
|
bpmax-cli user search --query "<姓名或工号>" --active-only --profile <profile> --format json
|
|
20
20
|
bpmax-cli user resolve --name "<姓名>" --employee-no "<工号>" --profile <profile> --format json
|
|
21
21
|
bpmax-cli user readback --id <user_id> --profile <profile> --format json
|
|
22
|
+
bpmax-cli organization department search --query "<部门名称>" --profile <profile> --format json
|
|
23
|
+
bpmax-cli organization department readback --id <group_id> --profile <profile> --format json
|
|
24
|
+
bpmax-cli organization department memberships --user-id <user_id> --profile <profile> --format json
|
|
25
|
+
bpmax-cli organization main-department --user-id <user_id> --profile <profile> --format json
|
|
26
|
+
bpmax-cli organization branch --user-id <user_id> --profile <profile> --format json
|
|
27
|
+
bpmax-cli organization position --user-id <user_id> --profile <profile> --format json
|
|
28
|
+
bpmax-cli organization direct-superior --user-id <user_id> --profile <profile> --format json
|
|
29
|
+
bpmax-cli organization superior-chain --user-id <user_id> --levels 20 --profile <profile> --format json
|
|
30
|
+
bpmax-cli organization readback --user-id <user_id> --profile <profile> --format json
|
|
31
|
+
bpmax-cli config user export --id <user_id> --out <dir> --profile <profile> --format json
|
|
32
|
+
bpmax-cli config user lint --work <work.json> --profile <profile> --format json
|
|
33
|
+
bpmax-cli config user build --work <work.json> --meta <meta.json> --out <submit.json> --profile <profile> --format json
|
|
34
|
+
bpmax-cli config user submit --id <user_id> --payload <submit.json> --profile <profile> --format json
|
|
35
|
+
bpmax-cli config user verify --id <user_id> --expect <work.json> --profile <profile> --format json
|
|
36
|
+
bpmax-cli config user delete --id <user_id> --profile <profile> --format json
|
|
22
37
|
```
|
|
23
38
|
|
|
24
39
|
## 何时使用
|
|
@@ -28,6 +43,8 @@ bpmax-cli user readback --id <user_id> --profile <profile> --format json
|
|
|
28
43
|
- 要检查某个 profile 实际连到哪个环境、哪个用户
|
|
29
44
|
- WEWF 迁移、固定审批人或矩阵规则需要将姓名/工号精确绑定到 BPMAX 用户 ID
|
|
30
45
|
- 需要确认用户未删除且处于有效在职状态
|
|
46
|
+
- 需要将申请人映射到所属部门、岗位、直属上级或连续上级
|
|
47
|
+
- 需要检查主部门、分部是否具备平台权威字段,而不是依赖数组顺序或名称猜测
|
|
31
48
|
|
|
32
49
|
## 规则
|
|
33
50
|
|
|
@@ -36,3 +53,11 @@ bpmax-cli user readback --id <user_id> --profile <profile> --format json
|
|
|
36
53
|
- 若用户明确指定环境,显式加 `--profile <name>`
|
|
37
54
|
- 固定人绑定优先同时提供姓名和工号。`user resolve` 匹配多人、未匹配或用户失效时必须停止,不得凭姓名选第一个。
|
|
38
55
|
- typed 输出只保留 ID、姓名、工号、组织、状态和角色摘要,不应默认输出手机号或头像 URL。
|
|
56
|
+
- `organization department memberships` 以平台 `user_group` 关系为权威;`position` 以 `user.title` 为权威;直属与连续直属上级以 `user.leader_id` 为权威。
|
|
57
|
+
- `main-department` 不得把第一个部门当主部门;平台未返回主部门字段时必须输出 `platform_authority_required`。
|
|
58
|
+
- `branch` 不得按部门名称或固定层级猜测分部;平台未提供分部类型/标识时只返回候选祖先并明确要求平台改造。
|
|
59
|
+
- 用户配置必须在已初始化的 BPMAX 配置目录中走 `config user` typed 链路;不得直接修改 `think_user`,也不得使用 raw API 写用户。
|
|
60
|
+
- 导出和普通输出不得包含手机号、头像、密码、Cookie、会话、IP 或登录时间。手机号只允许在 `mode=create` work 中显式提供,且 dry-run 输出必须脱敏。
|
|
61
|
+
- 创建用户至少需要姓名、手机号和一个角色 ID;编辑关系时 `group_ids`、`role_ids`、`modelList` 必须使用精确 typed readback 得到的 ID。
|
|
62
|
+
- `hide_in_contact` 当前平台接口未实现,不得写入 work 或 submit payload;CLI lint/build 会硬阻断。
|
|
63
|
+
- `leader_id` 不得指向用户自身;状态只允许 0、1、2。删除前必须确认没有进行中项目或待办依赖该用户。
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: bpmax-user-model-editor
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
description: "Use when creating or editing BPMAX user models through the bpmax-cli typed user-model adapter."
|
|
5
|
+
metadata:
|
|
6
|
+
requires:
|
|
7
|
+
bins: ["bpmax-cli"]
|
|
8
|
+
cliHelp: "bpmax-cli config user-model --help"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# BPMAX User Model Editor
|
|
12
|
+
|
|
13
|
+
先阅读 `../bpmax-shared/SKILL.md`。使用 `config user-model export/lint/build/submit/verify` 完成配置。
|
|
14
|
+
|
|
15
|
+
标准命令必须显式使用 `--id`:`export --id <id>`、`submit --id <id>`、`verify --id <id>`、`delete --id <id>`。不得把 ID 当作位置参数。
|
|
16
|
+
|
|
17
|
+
## 规则
|
|
18
|
+
|
|
19
|
+
- `key` 必须稳定且可跨环境识别;不要用线上数字 ID 代替 key 或 UUID。
|
|
20
|
+
- `object_event` 必须是数组;`auto_trigger_flows`、`permission` 必须是对象。
|
|
21
|
+
- `form_template_id`、`role_id` 必须通过 typed readback 证明目标存在。
|
|
22
|
+
- 数字 ID 必须属于当前 profile 对应组织;平台返回不存在时不得切换 profile 或尝试跨组织 ID。
|
|
23
|
+
- 修改 `form_template_id` 不会自动补齐既有用户的模型表单;需要该行为时单独执行平台支持的初始化动作并保留证据。
|
|
24
|
+
- 删除前确认没有用户绑定该模型;平台阻断时不得清理关系绕过。
|