bpmax-cli 0.2.1-beta.57 → 0.2.1-beta.59
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/dist/bin.js +1683 -470
- package/dist/bin.js.map +1 -1
- package/package.json +1 -1
- package/scripts/install-skills.mjs +2 -1
- package/scripts/run-source-cli.mjs +24 -0
- package/skills/bpmax-cli/SKILL.md +1 -1
- package/skills/bpmax-console-template-editor/SKILL.md +1 -0
- package/skills/bpmax-dataset-template-editor/SKILL.md +1 -0
- package/skills/bpmax-e2e-flow-test-operator/SKILL.md +1 -1
- package/skills/bpmax-e2e-flow-test-operator/references/ai-test-suite.md +19 -0
- package/skills/bpmax-e2e-flow-test-operator/references/browser-action-dsl.md +19 -2
- package/skills/bpmax-icon-catalog/SKILL.md +18 -0
- package/skills/bpmax-icon-catalog/agents/openai.yaml +4 -0
- package/skills/bpmax-icon-catalog/assets/ri-icons.json +3140 -0
- package/skills/bpmax-icon-catalog/references/source-contract.md +3 -0
- package/skills/bpmax-list-template-editor/SKILL.md +2 -1
- package/skills/bpmax-nav-config-editor/SKILL.md +1 -0
- package/skills/bpmax-plugin-config/SKILL.md +36 -2
- package/skills/bpmax-user-mock-operator/SKILL.md +1 -1
- package/skills/bpmax-user-mock-operator/scripts/chrome_identity_bridge.mjs +170 -45
- package/skills/bpmax-workspace-editor/SKILL.md +1 -0
package/package.json
CHANGED
|
@@ -3,8 +3,9 @@ import { spawn } from 'node:child_process';
|
|
|
3
3
|
import { homedir } from 'node:os';
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import process from 'node:process';
|
|
6
|
+
import { fileURLToPath } from 'node:url';
|
|
6
7
|
|
|
7
|
-
const projectRoot = path.resolve(import.meta.
|
|
8
|
+
const projectRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
8
9
|
const sourceSkillsDir = path.join(projectRoot, 'skills');
|
|
9
10
|
const jsonOutput = process.argv.includes('--json');
|
|
10
11
|
const agentArgIndex = process.argv.indexOf('--agent');
|
|
@@ -10,6 +10,27 @@ import { fileURLToPath } from 'node:url';
|
|
|
10
10
|
const projectRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
11
11
|
const distEntrypoint = path.join(projectRoot, 'dist', 'bin.js');
|
|
12
12
|
const skillsStamp = path.join(homedir(), '.bpmax', 'skills.stamp');
|
|
13
|
+
const minimumNodeMajor = 18;
|
|
14
|
+
|
|
15
|
+
function assertSupportedNodeRuntime() {
|
|
16
|
+
const nodeMajor = Number.parseInt(process.versions.node.split('.')[0] || '0', 10);
|
|
17
|
+
if (nodeMajor >= minimumNodeMajor) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const diagnostic = {
|
|
21
|
+
ok: false,
|
|
22
|
+
error: {
|
|
23
|
+
code: 'unsupported_node_runtime',
|
|
24
|
+
message: `bpmax-cli requires Node.js >=${minimumNodeMajor}; current runtime is ${process.versions.node}`,
|
|
25
|
+
current: process.versions.node,
|
|
26
|
+
required: `>=${minimumNodeMajor}`,
|
|
27
|
+
next_action: 'Run bpmax-cli with a Node.js 18 or newer runtime. A legacy project PATH must not supply the CLI runtime.',
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
console.error(JSON.stringify(diagnostic));
|
|
31
|
+
process.exitCode = 1;
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
13
34
|
|
|
14
35
|
async function mtimeMs(targetPath) {
|
|
15
36
|
try {
|
|
@@ -88,6 +109,9 @@ async function ensureSkills() {
|
|
|
88
109
|
}
|
|
89
110
|
|
|
90
111
|
async function main() {
|
|
112
|
+
if (assertSupportedNodeRuntime() === false) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
91
115
|
await ensureBuild();
|
|
92
116
|
await ensureSkills();
|
|
93
117
|
const child = spawn(process.execPath, [distEntrypoint, ...process.argv.slice(2)], {
|
|
@@ -88,7 +88,7 @@ bpmax-cli issue create --title "<标题>" --description-file <file.md> --label b
|
|
|
88
88
|
- 系统内页面 URL 生成:先读 `../bpmax-shared/SKILL.md` 的“系统内 URL 生成”
|
|
89
89
|
- 本地 schema manifest:读 `../bpmax-schema/SKILL.md`
|
|
90
90
|
- 服务端能力白名单:先用 `capabilities status/refresh` 查看当前 profile 已授权 capability,不要绕过白名单手写 raw API
|
|
91
|
-
-
|
|
91
|
+
- 插件安装、组织/工作区激活、插件提供的配置 Skill:先进入 `../bpmax-plugin-config/SKILL.md`。先用 typed activation overview 证明插件在目标工作区生效,再按远端 sha256 发现或更新 Skill;依赖过期或冲突 Skill 的配置 lint/build/submit 不得继续。
|
|
92
92
|
- BPMAX Business Skills 查询、同步、安装、更新、卸载:读 `../bpmax-business-skill/SKILL.md`
|
|
93
93
|
- AI 任务方案、任务书、任务拆解、subagent 分工、实施任务表、进度 CSV:读 `../bpmax-ai-taskbook/SKILL.md`
|
|
94
94
|
- 审批矩阵、角色矩阵、矩阵规则记录、`matrix_owner`、`cc_matrix`、规则 seed、审批人映射:读 `../bpmax-approval-matrix/SKILL.md`
|
|
@@ -45,6 +45,7 @@ description: "用于通过 bpmax-cli typed config 创建、编辑、发布、暂
|
|
|
45
45
|
11. relationFields 专项也可走显式子命令:
|
|
46
46
|
- `bpmax-cli config dataset relation-fields submit --id <id> --payload <submit-file> --profile <profile> --confirm "submit dataset <id>" --response-out <response.json> --format json`
|
|
47
47
|
- `bpmax-cli config dataset relation-fields readback --id <id> --profile <profile> --format json`
|
|
48
|
+
- 仅当线上回读的历史 `custom_key` 为空时,才允许一次性初始化:先跑 `impact`,再用 `--initialize-custom-key`;精确确认必须为 `initialize dataset custom_key <id> <custom_key>`。非空 `custom_key` 永远不可改,不能用此开关绕过。
|
|
48
49
|
12. 新建数据集时,`work.mode` 与 `meta.mode` 都必须是 `create`;提交后读取标准响应顶层 `id`、`key`、`readback_hint`,再执行 verify/readback。
|
|
49
50
|
- `bpmax-cli config dataset submit --id create --payload <submit-file> --profile <profile> --format json`
|
|
50
51
|
- `bpmax-cli config dataset submit --id create --payload <submit-file> --profile <profile> --confirm "submit dataset create" --response-out .codex/tmp/dataset-editor/result/<file>.response.json --format json`
|
|
@@ -30,7 +30,7 @@ description: "用于在 BPMAX 中做全链路流程测试、场景回归、前
|
|
|
30
30
|
- 页面报错、白屏、字段不渲染或按钮不可用时,第一步检查浏览器 Console 和 Network;优先定位 `form_template`、控件渲染、`lambda`、`customeValidate`、`sub_form`,再查流程、权限、数据或缓存。
|
|
31
31
|
- 首次脚本编译前的只读探索、`cache_stale`、未支持控件或执行异常时,必须优先读取并使用 `chrome:control-chrome`,复用用户当前 Chrome 的标签页、登录态和扩展能力完成页面结构探索与诊断;正式 run 创建前不得提交、审批、驳回或执行其他业务 mutation,不得默认先切到 Chrome DevTools、独立 Playwright 或接口脚本。
|
|
32
32
|
- `chrome:control-chrome` 不可用,或按其浏览器连接/Chrome 扩展排障流程处理后仍失败时,才允许降级到 Chrome DevTools;Chrome DevTools 再出现 `Network.enable timed out`、快照不可用或页面通道挂住时,才允许切换到 AppleScript。AppleScript 只能做 DOM 读取、按钮点击、输入、截图和页面提交,不得改用接口直调替代页面动作。
|
|
33
|
-
- H5 测试必须打开 `/m
|
|
33
|
+
- H5 测试必须打开 `/m/#/...`,并在对应 `browser_action` 步骤声明 `surface: "h5"` 与 `viewport: { "width": 412, "height": 844 }`;runner 在认证 probe 前及每个步骤执行前设置并回读页面 viewport,只调 viewport,不调浏览器外层窗口尺寸。
|
|
34
34
|
- 多角色页面测试使用 [$bpmax-user-mock-operator](../bpmax-user-mock-operator/SKILL.md),通过 Chrome Control 身份桥复用当前浏览器登录态,只用于浏览器页面测试,不用于 API Key impersonation 或 CLI 业务命令身份切换;结束前必须 unmock、验证恢复并关闭 identity lease。
|
|
35
35
|
- 多角色用例的身份步骤必须声明 `runner=identity`,使用 `bpmax-cli e2e identity browser status|mock|unmock|complete` 并与当前 execution manifest/case step 绑定;mock 步骤必须在 `input_data` 写明 `user_id=<精确 BPMAX 用户 ID>`,mock 前必须有本轮 status,每个 mock 必须有后续 unmock。不得猜测用户,不得写成 `e2e_step_run`,不得把 Cookie transport 或旧 Python Cookie 脚本作为正式主路。
|
|
36
36
|
|
|
@@ -183,6 +183,25 @@ evidence 必须声明 `kind=bpmax_e2e_precondition_evidence`、当前 `run_id/ev
|
|
|
183
183
|
|
|
184
184
|
`evidence_nonce` 是当前 run 的内部隔离标识,应由 CLI/runner 在证据生成时写入,不要求人类手工填写,也不得在登记旧文件时补写。缺少当前 run/case/step 绑定的证据不能进入 formal pass。
|
|
185
185
|
|
|
186
|
+
`runner=observe` 使用专用的原始 evidence;这里的 `status=observed` 描述只读观察结果,随后由 `test-suite run record --result pass` 把 manifest 步骤登记为 PASS,二者不能混用。最小结构如下:
|
|
187
|
+
|
|
188
|
+
```json
|
|
189
|
+
{
|
|
190
|
+
"kind": "bpmax_e2e_observe_evidence",
|
|
191
|
+
"run_id": "<manifest.run_id>",
|
|
192
|
+
"evidence_nonce": "<manifest.evidence_nonce>",
|
|
193
|
+
"case_id": "C001",
|
|
194
|
+
"case_step_id": "S002",
|
|
195
|
+
"status": "observed",
|
|
196
|
+
"observed": true,
|
|
197
|
+
"source_case_step_id": "C001/S001",
|
|
198
|
+
"source_evidence": "source.json",
|
|
199
|
+
"assertions": [{ "name": "项目状态与预期一致", "passed": true }]
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
`source_case_step_id` 必须与 `case_steps.csv` 当前 observe 步骤 `input_data` 中的声明一致;`source_evidence` 必须指向同一 run 内、已由该前序 PASS 步骤登记的 evidence 文件。缺少 kind、错误 status、缺少 observed、断言失败、来源绑定不一致、来源缺失或未登记会分别返回稳定 rule id。
|
|
204
|
+
|
|
186
205
|
证据必须位于本轮 report 目录。仅写 `browser_verified: true`、引用历史截图、复用前一步相同截图、断言为空/失败,或在要求 DOM 时缺少 `dom_snapshot`,都不能记录为 pass。
|
|
187
206
|
|
|
188
207
|
`runtime_scope` 规则:`page` 证明首页、列表、搜索等页面,不要求项目 ID;`project` 必须提供数字 `project_id`;`step` 必须同时提供数字 `project_id` 和业务 `step_id`。禁止用 `case_steps.csv.step_no` 填业务 `step_id`。
|
|
@@ -21,6 +21,7 @@ Browser Action Runner V2 把稳定、重复的真实页面步骤变成可审计
|
|
|
21
21
|
"steps": {
|
|
22
22
|
"C001/S001": {
|
|
23
23
|
"runner": "browser_action",
|
|
24
|
+
"surface": "pc",
|
|
24
25
|
"page_fingerprint": {
|
|
25
26
|
"route": "/project/create",
|
|
26
27
|
"fields": ["subject", "amount"],
|
|
@@ -61,10 +62,26 @@ Browser Action Runner V2 把稳定、重复的真实页面步骤变成可审计
|
|
|
61
62
|
}
|
|
62
63
|
```
|
|
63
64
|
|
|
65
|
+
H5 步骤必须显式声明运行面与经过审查的 viewport:
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"runner": "browser_action",
|
|
70
|
+
"surface": "h5",
|
|
71
|
+
"viewport": { "width": 412, "height": 844 }
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
正式 runner 会在认证 probe 之前设置 viewport,并在每个步骤执行前再次设置和回读实际尺寸;尺寸不一致时以 `e2e.browser.viewport_mismatch` hard fail。实际 viewport 会进入步骤 evidence,DOM 快照记录页面 `innerWidth/innerHeight`,动作 trace 记录声明值,因此都受 evidence file hash 链保护。PC 步骤可声明其他经过审查的 viewport;一轮连续执行在 PC/H5 步骤间切换时会按步骤重新应用。
|
|
76
|
+
|
|
77
|
+
认证 probe 的动态 `page_fingerprint` 使用当前 run 的 data profile 解析 `{{data.*}}`。缺少变量时返回独立的 `e2e.browser.auth_fingerprint_variables_invalid`,不得吞掉并误报为登录无效。
|
|
78
|
+
|
|
64
79
|
## 支持动作
|
|
65
80
|
|
|
66
81
|
- 页面与等待:`navigation.open`、`wait.visible`、`wait.network`、`wait.route`。
|
|
67
|
-
- 主表单:`form.set_value`、`form.set_date_range`、`form.select_option`、`form.assert_value`。
|
|
82
|
+
- 主表单:`form.set_value`、`form.set_date_range`、`form.select_option`、`cascader.search_select`、`form.assert_value`。
|
|
83
|
+
|
|
84
|
+
`cascader.search_select` 专用于 Element UI Cascader。target 只能是外层控件的语义定位(`field`、`label` 等),不能提供组件内部 CSS。value 固定为 `{"search":"叶子名称","path":["完整","层级","叶子名称"]}`:runner 打开唯一外层控件,并要求其 `aria-controls`/`aria-owns` 精确绑定唯一可见 Cascader 弹层;在该弹层内填充内部搜索框,只接受其 `title` 或 `aria-label` 与完整有序 path 精确一致的唯一候选,hover 后点击,并读取外层已选值/标签确认叶子。候选或路径不唯一、弹层绑定/搜索框缺失、完整路径无法验证,均 hard fail;不能降级为宽泛文本点击。
|
|
68
85
|
- 明细表:`detail.add_row`、`detail.set_value`、`detail.assert_rows`。
|
|
69
86
|
- 命令动作:`button.click`、`dialog.confirm`。
|
|
70
87
|
- 上下文与断言:`context.extract`、`page.assert_step`、`list.assert_record`、`evidence.capture`。
|
|
@@ -80,7 +97,7 @@ Browser Action Runner V2 把稳定、重复的真实页面步骤变成可审计
|
|
|
80
97
|
|
|
81
98
|
日期区间控件使用 `form.set_date_range`,通过一个语义 target 定位同一表单项中的两个可见输入框,`value` 固定为 `[start,end]` 两个非空字符串。例如:`{"type":"form.set_date_range","target":{"label":"申请日期"},"value":["2026-08-02","2026-08-02"]}`。不要用两个带 `nth` 的 `form.set_value` 猜测日期区间内部 DOM 顺序。
|
|
82
99
|
|
|
83
|
-
`list.assert_record` 默认断言至少有一条可见匹配记录;可选 `count` 用于精确计数。`count: 1`
|
|
100
|
+
`list.assert_record` 默认断言至少有一条可见匹配记录;可选 `count` 用于精确计数。`count: 1` 证明唯一匹配。`count: 0` 证明同一业务键不存在时,必须用 `target.css` 或 `target.test_id` 锚定恰好一个可见列表容器;无锚点的 absence 断言会被 lint 拒绝,避免页面中的无关表或隐藏旧表形成假阳性。正向断言按候选类型寻找首组可见且命中业务键的主表 body、ARIA row 或已知列表/卡片 record;固定列镜像表不会重复计数。禁止退化为整页文本匹配,筛选输入、空状态、toast、分页文案都不能充当记录。evidence 会保存命中记录的截断 DOM 文本摘要。使用前必须先在同一步按唯一业务键执行查询,避免分页或未筛选结果削弱证据。
|
|
84
101
|
|
|
85
102
|
`resolution_checks` 可以包含自包含的只读探针序列:`navigation.open`、`form.set_value` / `form.set_date_range` / `form.select_option`、明确 `mutation: false` 的筛选查询按钮,以及等待和强断言。两条分支会在独立页面中分别执行;禁止 `mutation: true`、`dialog.confirm`、上传、明细写入、身份切换或任意脚本。典型模式是两边都重新打开列表、按同一唯一业务键查询,再分别用 `list.assert_record count: 1` 和 `count: 0` 证明已提交与未提交互斥。只有 `not_committed` 分支可以增加 `{ "type": "mutation.assert_no_request", "url_pattern": "/project" }`,用于核对本轮 manifest 绑定的 attempt evidence 确实没有观察到目标写请求;它必须与实时 `wait.route`、`page.assert_step` 或 `list.assert_record` 同时使用,不能单独形成未提交结论。
|
|
86
103
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: bpmax-icon-catalog
|
|
3
|
+
description: "查询、搜索和校验 BPMAX 前端真实可用的 Remix icon。任何列表模板、导航、工作区、平台或其他配置涉及 icon 时,必须先使用此 Skill/`bpmax-cli icon`,不得凭名称猜测。"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# BPMAX Icon Catalog
|
|
7
|
+
|
|
8
|
+
`assets/ri-icons.json` 是从前端 `ri_icon.ts` 生成并随 CLI 分发的快照,用户不需要访问前端仓库。运行时提交值必须是完整 class:`ri ri_<name-with-hyphens>`。
|
|
9
|
+
|
|
10
|
+
任何 icon 配置开始前先执行:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
bpmax-cli icon search --query bank --format json
|
|
14
|
+
bpmax-cli icon get ri_bank-line --format json
|
|
15
|
+
bpmax-cli icon validate "ri ri_bank-line" --format json
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
只使用命令返回的 class。`search` 按子串查找,`get` 接受源码 name 或完整 class,`validate` 同时检查格式和集合存在性。前端源更新由 CLI 维护者在发布时重新生成 JSON;高风险变更仍须用当前页面 IconPicker 做最终运行态核对。
|