bpmax-cli 0.1.44-beta.23 → 0.1.44-beta.25

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.44-beta.23",
3
+ "version": "0.1.44-beta.25",
4
4
  "description": "CLI for BPMAX environments with multi-profile config and local login callback flow",
5
5
  "type": "module",
6
6
  "bin": {
@@ -73,6 +73,21 @@ description: "用于在 BPMAX 中做全链路流程测试、场景回归、前
73
73
  - 哪怕本轮只跑一次,也要把 handoff、step-run、浏览器截图、DOM/URL、console/network、submit/readback 证据落到稳定目录,便于下一次直接复用或从失败点恢复。
74
74
  - `bpmax-cli test-suite lint` 会强制检查每条非 deprecated E2E 用例是否已有首次运行沉淀方式;缺少 `bpmax-cli e2e create-page-submit`、`bpmax-cli e2e step-run`、`bpmax-cli e2e record-from-evidence`、`data profile`、`scenario plan` 或 reusable step template 时,不要直接判业务失败,而是读取输出中的 `e2e_acceleration.bootstrap_required=true` 和 `missing_cases`。
75
75
  - 发现 `bootstrap_required=true` 时,执行编排必须先跑一次真实页面或安全 step-run,把截图、DOM/URL、console/network、submit/readback 证据保存到稳定目录,然后运行 `bpmax-cli e2e record-from-evidence` 生成 reusable step template;完成沉淀后再进入批量复跑或结论判断。
76
+ - 缓存执行不是无条件信任旧模板。每个 reusable step template 必须包含 `expected_checks`,复用时 `bpmax-cli e2e step-run --data-profile @...` 会先检查当前运行态模式是否仍符合预期,例如处理人可处理、step 未结束、必填字段集合、缺失字段范围、动作仍存在。
77
+ - 如果 `expected_checks` 缺失、失败,或没有拿到预期范围内的结果,必须把该 step 判为 `cache_stale`,停止继续提交后续步骤;不要把缓存失效误判为业务失败,也不要继续用旧 payload 硬推。
78
+ - 缓存失效时优先自动重建当前步骤缓存:
79
+
80
+ ```bash
81
+ bpmax-cli e2e step-run \
82
+ --project-id <project_id> \
83
+ --data-profile @.codex/e2e-templates/<scenario-step>.json \
84
+ --auto-refresh-cache \
85
+ --cache-out .codex/e2e-templates/<scenario-step>.json \
86
+ --evidence-dir .codex/tmp/e2e/<run> \
87
+ --format json
88
+ ```
89
+
90
+ - 自动刷新后的模板只能说明“当前运行态模式已重新采样”。如果新模板显示新增必填字段、处理人不可处理、动作消失或 step 已结束,必须先补数据/换样本/修配置,再复跑;不得把刷新后的缓存当作通过结论。
76
91
  - 成功通过一次的复杂 step,必须沉淀模板:
77
92
 
78
93
  ```bash
@@ -177,11 +177,13 @@ export BPMAX_BASE_URL='https://<your-bpmax-host>'
177
177
  - 对挂了脚本的节点,发布后必须直接回读 live `/api/flow`,确认脚本文本和启用开关都还在;不要只看编辑器画布
178
178
  - `meta.project_create_validator` 通过 `parseEvalFunction()` 执行,脚本文本会被包进函数体;如果脚本本身写成裸 `async () => { ... }()` 且没有显式 `return`,最终返回值会被吞掉,等价于校验未生效。创建期脚本默认优先写成:
179
179
  - `return (async () => { ... })();`
180
- - `message_config_mode = code` / `cc_message_config_mode = code` 的消息模板同样由 `parseEvalFunction()` 执行,不能填写普通中文文案或 `${step...}` 字面量 URL:
181
- - `message_template` / `cc_message_template` 必须是 JS 函数体脚本,例如 `return "请处理...";`
182
- - 空 `message_template` 会触发后端默认消息外发;主流程编排节点、系统等待节点或其它不应外发消息的节点,必须在 code 模式下显式写 `return "";`,不能留空。
183
- - `message_template_simple.actions[].url` / `m_url` 如需拼接 `step.project_id`、`step.id`,必须写成 `return '/projectContinue?id=' + step.project_id + '&step_id=' + step.id;`
184
- - typed CLI lint 已将该规则设为 hard error,不得用 `--allow-preexisting-lint-errors` 豁免。
180
+ - 消息模板分两种配置模式,由 `message_config_mode`(节点)/ `cc_message_config_mode`(抄送)决定执行分支,两种模式返回值形态完全不同,不可混用:
181
+ - `code` 模式(`message_template` / `cc_message_template` 是整段 JS 函数体脚本):脚本必须 `return` 一个完整消息对象,结构为 `{ title, content, actions: [{ type: "link", btnType, text, url, m_url }], messageType: "step", currentStep, project }`;后端 `parseScriptMessageTemplate` 直接把返回值当 `messageContent` 投递。返回裸字符串(如 `return "请处理【环节】。";`)是错的:非空字符串会被当 truthy 继续进入 `sendMessage`,却无法渲染成卡片、也发不出有效平台消息。
182
+ - `standard` 模式(`message_template_simple` / `*_message_template_simple` 是对象):后端 `parseSimpleMessageTemplate` 对 title / 每个 content[].body / 每个 actions[].url 逐字段执行 `parseTemplateString`,每个字段各自 `return` 一个字符串;例如 `title` 写 `return \`待处理:环节名\`;`,`actions[].url` 写 `return '/projectContinue?id=' + step.project_id + '&step_id=' + step.id;`。
183
+ - 只有需要禁止该环节外发消息时,才在 `code` 模式下写 `return "";`:返回空串会让 `buildStepMessage` 判空后直接 return 停止发送。绝不能把 `message_template` 留空,空值会触发后端默认消息。
184
+ - code 模式返回对象可选附加飞书卡片字段:`elements`(数组,支持 `div/lark_md`、`markdown`、`column_set/column`、`img`、`note`、`person_list`)、`unshiftElements`(插到正文最前)、`color`(卡片标题色,默认 `wathet`),让消息以结构化卡片呈现。
185
+ - semantic lint 已将“code 模式返回非对象、standard 模式字段返回非脚本串、空模板、字面量 URL”设为 hard error,不得用 `--allow-preexisting-lint-errors` 豁免。
186
+ - 源码依据:`getMessageContent` 在 `message_config_mode==='standard' && message_template_simple` 时走 `parseSimpleMessageTemplate`,否则走 `parseScriptMessageTemplate`;两者返回值形态不可互换。飞书卡片由 `feishu.messageAdaptor` 消费 `data.title/content/elements/unshiftElements/actions/color`。
185
187
  - 创建链路中 `meta.project_create_validator` 在单号/流水号生成之后执行。它可以拒绝缺失或不一致的数据,不能在不消耗流水号的前提下修复已经生成的单号;涉及 `sn_number.field_reference` 的问题,应优先在表单侧通过 `ctx.$setValueByKeyToValue(...)` 触发前端订阅刷新,流程级创建校验只做后端兜底拒绝。
186
188
  - 后端单号生成使用提交 payload 中字段规则里的 `result` / `options[].result`,不会重新按当前表单值计算 `field_reference`。校验脚本如需判断“单号是否包含门店编码”,应同时检查提交值、`projectForm.value` / `key_to_value` 和单号字符串本身,避免只看隐藏字段存在就放行。
187
189
  - 对“新增节点后立刻验证流转”的场景,回归样本优先用新建项目,不要优先复用已经跑过旧配置的历史项目;历史 `step` 记录不会自动套用新节点骨架,容易把旧 step 状态、旧 target_step 和缓存误判成新配置问题。
@@ -38,8 +38,8 @@
38
38
  - 新流程名称已经改了,但项目名称模板或校验脚本仍沿用旧业务语义
39
39
  - 已把“填写订单信息”下沉到开始节点 `meta.form_template`,脚本却还在按旧节点 id 或旧节点表单取值
40
40
  - 表单字段前端查重把“查询”写成未确认后端已实现的 `POST /api/.../search`,结果命中 `BaseRest.postAction` 直接新增资源
41
- - `message_config_mode = code` / `cc_message_config_mode = code` 时,把普通中文文案写进 `message_template` / `cc_message_template`
42
- - code-mode `message_template` 留空以为能阻止外发;实际会触发后端默认消息,必须显式写 `return "";`
41
+ - `message_config_mode = code` / `cc_message_config_mode = code` 时,把普通中文文案或裸字符串写进 `message_template` / `cc_message_template`;code 模式必须 `return` 一个完整消息对象 `{ title, content, actions, messageType }`,裸字符串(如 `return "请处理";`)会被当 truthy 进入 `sendMessage` 但无法渲染成卡片
42
+ - code-mode `message_template` 留空以为能阻止外发;实际会触发后端默认消息,必须显式写 `return "";`(空串是唯一合法的裸字符串返回值)
43
43
  - code-mode 消息卡片按钮 URL 写成 `/projectContinue?id=${step?.project_id}&step_id=${step?.id}`,而不是 `return '/projectContinue?id=' + step.project_id + '&step_id=' + step.id;`
44
44
 
45
45
  ## 前端失焦查重专项核查