bpmax-cli 0.2.1-beta.9 → 0.2.1-beta.90

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.
Files changed (197) hide show
  1. package/README.md +30 -7
  2. package/dist/bin.js +45185 -12834
  3. package/dist/bin.js.map +1 -1
  4. package/package.json +12 -5
  5. package/scripts/install-skills.mjs +27 -60
  6. package/scripts/run-source-cli.mjs +145 -0
  7. package/skills/bpmax-ai-taskbook/SKILL.md +17 -1
  8. package/skills/bpmax-ai-taskbook/references/blueprint-taskbook-gates.md +141 -0
  9. package/skills/bpmax-ai-taskbook/references/taskbook-template.md +43 -3
  10. package/skills/bpmax-api-platform-editor/SKILL.md +24 -31
  11. package/skills/bpmax-api-platform-editor/agents/openai.yaml +2 -2
  12. package/skills/bpmax-api-platform-editor/references/platform-api-map.md +2 -2
  13. package/skills/bpmax-api-platform-editor/references/runtime-workflow.md +3 -3
  14. package/skills/bpmax-approval-matrix/SKILL.md +54 -2
  15. package/skills/bpmax-blueprint-doc-workflow/SKILL.md +38 -5
  16. package/skills/bpmax-blueprint-doc-workflow/references/blueprint-structure.md +24 -8
  17. package/skills/bpmax-blueprint-doc-workflow/references/business-language.md +74 -0
  18. package/skills/bpmax-blueprint-doc-workflow/references/per-flow-required-structure.md +13 -0
  19. package/skills/bpmax-blueprint-doc-workflow/references/review-and-confirmation-dialogue.md +70 -0
  20. package/skills/bpmax-blueprint-doc-workflow/references/sample-missing-modeling-review.xml +23 -0
  21. package/skills/bpmax-blueprint-doc-workflow/references/sample-missing-review-record.xml +72 -0
  22. package/skills/bpmax-blueprint-doc-workflow/references/sample-paragraph-flow-details.xml +27 -0
  23. package/skills/bpmax-blueprint-doc-workflow/references/sample-pass.xml +59 -35
  24. package/skills/bpmax-blueprint-doc-workflow/references/sample-system-identifier.xml +79 -0
  25. package/skills/bpmax-blueprint-doc-workflow/references/source-traceability-and-flow-modeling.md +115 -0
  26. package/skills/bpmax-blueprint-doc-workflow/scripts/lint_blueprint_doc.py +586 -5
  27. package/skills/bpmax-bug-reporting/SKILL.md +72 -0
  28. package/skills/bpmax-builder-shared/SKILL.md +1 -0
  29. package/skills/bpmax-builder-shared/configuration-impact-review.md +76 -0
  30. package/skills/bpmax-builder-shared/template_script_hard_rules.py +3 -1
  31. package/skills/bpmax-builder-shared/tests/test_template_script_hard_rules.py +16 -0
  32. package/skills/bpmax-business-skill/SKILL.md +3 -1
  33. package/skills/bpmax-cli/SKILL.md +46 -0
  34. package/skills/bpmax-config-latest/SKILL.md +4 -0
  35. package/skills/bpmax-console-template-editor/SKILL.md +113 -523
  36. package/skills/bpmax-console-template-editor/agents/openai.yaml +2 -2
  37. package/skills/bpmax-console-template-editor/references/full-detail-guide.md +45 -0
  38. package/skills/bpmax-console-template-editor/references/local-temp-workflow.md +13 -12
  39. package/skills/bpmax-console-template-editor/scripts/console_template_editor_common.py +299 -78
  40. package/skills/bpmax-console-template-editor/tests/test_console_template_editor.py +344 -30
  41. package/skills/bpmax-dataset-field-template-editor/SKILL.md +131 -594
  42. package/skills/bpmax-dataset-field-template-editor/references/full-detail-guide.md +570 -0
  43. package/skills/bpmax-dataset-field-template-editor/references/nested-field-patterns.md +8 -8
  44. package/skills/bpmax-dataset-field-template-editor/references/runtime-verified-field-page-shape.md +1 -1
  45. package/skills/bpmax-dataset-field-template-editor/scripts/dataset_field_editor_common.py +11 -77
  46. package/skills/bpmax-dataset-field-template-editor/scripts/export_dataset_field.py +4 -57
  47. package/skills/bpmax-dataset-field-template-editor/scripts/init_create_dataset_field.py +2 -0
  48. package/skills/bpmax-dataset-field-template-editor/scripts/inspect_dataset_field_runtime.py +4 -78
  49. package/skills/bpmax-dataset-field-template-editor/scripts/submit_dataset_field.py +3 -89
  50. package/skills/bpmax-dataset-field-template-editor/tests/test_dataset_field_editor.py +14 -0
  51. package/skills/bpmax-dataset-field-template-editor/tests/test_init_create_dataset_field.py +2 -0
  52. package/skills/bpmax-dataset-template-editor/SKILL.md +123 -778
  53. package/skills/bpmax-dataset-template-editor/references/dataset-script-runtime-matrix.md +11 -0
  54. package/skills/bpmax-dataset-template-editor/references/full-detail-guide.md +753 -0
  55. package/skills/bpmax-dataset-template-editor/references/runtime-gotchas.md +12 -0
  56. package/skills/bpmax-dataset-template-editor/references/ui-to-backend-field-map.md +1 -0
  57. package/skills/bpmax-dataset-template-editor/references/work-file-to-submit-mapping.md +2 -2
  58. package/skills/bpmax-dataset-template-editor/scripts/basic_table_audit.py +8 -1
  59. package/skills/bpmax-dataset-template-editor/scripts/dataset_editor_common.py +9 -90
  60. package/skills/bpmax-dataset-template-editor/scripts/export_dataset.py +8 -1
  61. package/skills/bpmax-dataset-template-editor/scripts/resolve_dataset.py +8 -1
  62. package/skills/bpmax-dataset-template-editor/scripts/submit_dataset.py +1 -2
  63. package/skills/bpmax-dataset-template-editor/scripts/verify_dataset_list.py +8 -1
  64. package/skills/bpmax-dataset-template-editor/scripts/verify_publish_health.py +8 -1
  65. package/skills/bpmax-dataset-template-editor/tests/test_dataset_editor.py +6 -40
  66. package/skills/bpmax-e2e-flow-config-orchestrator/SKILL.md +18 -4
  67. package/skills/bpmax-e2e-flow-config-orchestrator/agents/openai.yaml +2 -2
  68. package/skills/bpmax-e2e-flow-config-orchestrator/references/orchestration-matrix.md +13 -9
  69. package/skills/bpmax-e2e-flow-test-operator/SKILL.md +174 -546
  70. package/skills/bpmax-e2e-flow-test-operator/agents/openai.yaml +2 -3
  71. package/skills/bpmax-e2e-flow-test-operator/references/ai-test-suite.md +181 -15
  72. package/skills/bpmax-e2e-flow-test-operator/references/browser-action-dsl.md +169 -0
  73. package/skills/bpmax-e2e-flow-test-operator/references/browser-only-checkpoints.md +15 -7
  74. package/skills/bpmax-e2e-flow-test-operator/references/full-detail-guide.md +589 -0
  75. package/skills/bpmax-e2e-flow-test-operator/references/minimal-test-loop.md +12 -8
  76. package/skills/bpmax-e2e-flow-test-operator/references/negative-sale-api-matrix.md +4 -4
  77. package/skills/bpmax-e2e-flow-test-operator/references/profile-schema.md +1 -1
  78. package/skills/bpmax-e2e-flow-test-operator/references/state-schema.md +3 -1
  79. package/skills/bpmax-e2e-flow-test-operator/scripts/e2e_doc.py +7 -5
  80. package/skills/bpmax-e2e-flow-test-operator/scripts/e2e_state.py +2 -2
  81. package/skills/bpmax-e2e-flow-test-operator/scripts/flow_runner.py +5 -1
  82. package/skills/bpmax-e2e-flow-test-operator/tests/test_negative_sale_api_tools.py +71 -0
  83. package/skills/bpmax-e2e-flow-test-operator-v2/SKILL.md +64 -0
  84. package/skills/bpmax-e2e-flow-test-operator-v2/agents/openai.yaml +7 -0
  85. package/skills/bpmax-e2e-flow-test-operator-v2/references/automation-generation-pipeline.md +33 -0
  86. package/skills/bpmax-e2e-flow-test-operator-v2/references/autonomous-execution.md +40 -0
  87. package/skills/bpmax-e2e-flow-test-operator-v2/references/batch-generation-and-execution.md +17 -0
  88. package/skills/bpmax-e2e-flow-test-operator-v2/references/browser-action-runner.md +19 -0
  89. package/skills/bpmax-e2e-flow-test-operator-v2/references/browser-recording-and-replay.md +95 -0
  90. package/skills/bpmax-e2e-flow-test-operator-v2/references/form-script-generation.md +41 -0
  91. package/skills/bpmax-e2e-flow-test-operator-v2/references/identity-and-failure-routing.md +92 -0
  92. package/skills/bpmax-e2e-flow-test-operator-v2/references/multi-request-mutation.md +9 -0
  93. package/skills/bpmax-e2e-flow-test-operator-v2/references/scenario-coverage-generation.md +17 -0
  94. package/skills/bpmax-e2e-flow-test-operator-v2/references/scoped-execution.md +13 -0
  95. package/skills/bpmax-e2e-flow-test-operator-v2/references/step-restartability-and-state.md +23 -0
  96. package/skills/bpmax-e2e-flow-test-operator-v2/references/test-assets-and-evidence.md +9 -0
  97. package/skills/bpmax-e2e-flow-test-operator-v2/references/test-data-and-selector-contract.md +51 -0
  98. package/skills/bpmax-e2e-flow-test-operator-v2/references/test-preflight-and-confirmation.md +32 -0
  99. package/skills/bpmax-filter-template-editor/SKILL.md +114 -551
  100. package/skills/bpmax-filter-template-editor/references/experience-coverage-matrix.md +18 -18
  101. package/skills/bpmax-filter-template-editor/references/filter-content-schema.md +21 -0
  102. package/skills/bpmax-filter-template-editor/references/filter-request-shape.md +29 -26
  103. package/skills/bpmax-filter-template-editor/references/filter-runtime-patterns.md +19 -2
  104. package/skills/bpmax-filter-template-editor/references/full-detail-guide.md +56 -0
  105. package/skills/bpmax-filter-template-editor/references/runtime-verified-filter-page-shape.md +10 -9
  106. package/skills/bpmax-filter-template-editor/scripts/filter_template_editor_common.py +7 -57
  107. package/skills/bpmax-filter-template-editor/tests/test_filter_template_editor.py +4 -48
  108. package/skills/bpmax-flow/SKILL.md +2 -0
  109. package/skills/bpmax-flow-detail-template-editor/SKILL.md +53 -0
  110. package/skills/bpmax-flow-template-editor/SKILL.md +132 -1137
  111. package/skills/bpmax-flow-template-editor/agents/openai.yaml +2 -2
  112. package/skills/bpmax-flow-template-editor/references/diff-strategy.md +3 -3
  113. package/skills/bpmax-flow-template-editor/references/editor-runtime-vs-draft.md +9 -9
  114. package/skills/bpmax-flow-template-editor/references/flow-template-api-workflow.md +2 -1
  115. package/skills/bpmax-flow-template-editor/references/full-detail-guide.md +1162 -0
  116. package/skills/bpmax-flow-template-editor/references/local-temp-workflow.md +1 -1
  117. package/skills/bpmax-flow-template-editor/references/message-card-professional-standard.md +234 -0
  118. package/skills/bpmax-flow-template-editor/references/payload-checklist.md +2 -0
  119. package/skills/bpmax-flow-template-editor/references/project-create-runtime-gotchas.md +17 -0
  120. package/skills/bpmax-flow-template-editor/references/requirement-to-node-mapping.md +8 -3
  121. package/skills/bpmax-flow-template-editor/references/runtime-verified-flow-detail-shape.md +7 -7
  122. package/skills/bpmax-flow-template-editor/references/runtime-verified-meta-fields.md +2 -2
  123. package/skills/bpmax-flow-template-editor/references/runtime-verified-node-fields.md +12 -2
  124. package/skills/bpmax-flow-template-editor/references/save-draft-request-shape.md +7 -23
  125. package/skills/bpmax-flow-template-editor/references/script-review-hard-rules.md +17 -0
  126. package/skills/bpmax-flow-template-editor/references/work-file-to-submit-mapping.md +1 -1
  127. package/skills/bpmax-flow-template-editor/tests/test_flow_template_editor.py +19 -75
  128. package/skills/bpmax-form-template-editor/SKILL.md +138 -1151
  129. package/skills/bpmax-form-template-editor/agents/openai.yaml +2 -2
  130. package/skills/bpmax-form-template-editor/references/dynamic-field-state.md +167 -0
  131. package/skills/bpmax-form-template-editor/references/form-template-api-workflow.md +51 -51
  132. package/skills/bpmax-form-template-editor/references/full-detail-guide.md +1115 -0
  133. package/skills/bpmax-form-template-editor/references/local-temp-workflow.md +4 -4
  134. package/skills/bpmax-form-template-editor/references/payload-checklist.md +3 -1
  135. package/skills/bpmax-form-template-editor/references/sub-form-patterns.md +6 -0
  136. package/skills/bpmax-form-template-editor/scripts/form_template_editor_common.py +8 -0
  137. package/skills/bpmax-form-template-editor/tests/test_form_template_editor.py +42 -19
  138. package/skills/bpmax-functional-test-design/LICENSE.upstream +24 -0
  139. package/skills/bpmax-functional-test-design/SKILL.md +80 -0
  140. package/skills/bpmax-functional-test-design/agents/openai.yaml +4 -0
  141. package/skills/bpmax-functional-test-design/references/bpmax-test-suite-output.md +95 -0
  142. package/skills/bpmax-functional-test-design/references/decision-table-testing.md +50 -0
  143. package/skills/bpmax-functional-test-design/references/domain-testing.md +43 -0
  144. package/skills/bpmax-functional-test-design/references/state-transition-testing.md +47 -0
  145. package/skills/bpmax-functional-test-design/references/technique-selection.md +38 -0
  146. package/skills/bpmax-functional-test-design/references/use-case-testing.md +55 -0
  147. package/skills/bpmax-group-model-editor/SKILL.md +24 -0
  148. package/skills/bpmax-home-portal-editor/SKILL.md +81 -0
  149. package/skills/bpmax-icon-catalog/SKILL.md +18 -0
  150. package/skills/bpmax-icon-catalog/agents/openai.yaml +4 -0
  151. package/skills/bpmax-icon-catalog/assets/ri-icons.json +3140 -0
  152. package/skills/bpmax-icon-catalog/references/source-contract.md +3 -0
  153. package/skills/bpmax-list-template-editor/SKILL.md +133 -466
  154. package/skills/bpmax-list-template-editor/agents/openai.yaml +2 -2
  155. package/skills/bpmax-list-template-editor/references/content-config-shape.md +16 -4
  156. package/skills/bpmax-list-template-editor/references/full-detail-guide.md +461 -0
  157. package/skills/bpmax-list-template-editor/references/list-template-api-workflow.md +6 -9
  158. package/skills/bpmax-list-template-editor/references/local-temp-workflow.md +1 -1
  159. package/skills/bpmax-list-template-editor/references/runtime-verified-workflow.md +50 -2
  160. package/skills/bpmax-list-template-editor/references/special-formats.md +5 -2
  161. package/skills/bpmax-list-template-editor/scripts/list_template_editor_common.py +9 -78
  162. package/skills/bpmax-memory-protocol/SKILL.md +7 -6
  163. package/skills/bpmax-nav-config-editor/SKILL.md +14 -17
  164. package/skills/bpmax-nav-config-editor/agents/openai.yaml +2 -2
  165. package/skills/bpmax-nav-config-editor/references/api-workflow.md +2 -2
  166. package/skills/bpmax-nav-config-editor/references/runtime-probing.md +11 -12
  167. package/skills/bpmax-page-composition-template-editor/SKILL.md +398 -0
  168. package/skills/bpmax-page-composition-template-editor/examples/presets/catalog.json +41 -0
  169. package/skills/bpmax-page-composition-template-editor/examples/presets/full-capability-workbench.json +294 -0
  170. package/skills/bpmax-page-composition-template-editor/examples/presets/project-detail-step-panel.json +184 -0
  171. package/skills/bpmax-page-composition-template-editor/examples/presets/project-list-quick-process.json +177 -0
  172. package/skills/bpmax-page-composition-template-editor/examples/presets/project-operations-dashboard.json +400 -0
  173. package/skills/bpmax-page-composition-template-editor/examples/presets/project-operations-visual-light.json +214 -0
  174. package/skills/bpmax-page-composition-template-editor/examples/presets/step-related-projects.json +184 -0
  175. package/skills/bpmax-page-composition-template-editor/references/resource-api.md +9 -0
  176. package/skills/bpmax-plugin-config/SKILL.md +55 -5
  177. package/skills/bpmax-project/SKILL.md +37 -1
  178. package/skills/bpmax-project-detail-template-editor/SKILL.md +13 -39
  179. package/skills/bpmax-project-detail-template-editor/agents/openai.yaml +2 -2
  180. package/skills/bpmax-role-editor/SKILL.md +11 -30
  181. package/skills/bpmax-shared/SKILL.md +19 -9
  182. package/skills/bpmax-team-editor/SKILL.md +27 -0
  183. package/skills/bpmax-ui-ux-audit/LICENSE.upstream +23 -0
  184. package/skills/bpmax-ui-ux-audit/SKILL.md +42 -0
  185. package/skills/bpmax-ui-ux-audit/agents/openai.yaml +4 -0
  186. package/skills/bpmax-ui-ux-audit/references/audit-framework.md +39 -0
  187. package/skills/bpmax-ui-ux-audit/references/bpmax-ux-findings.md +56 -0
  188. package/skills/bpmax-user/SKILL.md +33 -1
  189. package/skills/bpmax-user-mock-operator/SKILL.md +58 -56
  190. package/skills/bpmax-user-mock-operator/agents/openai.yaml +2 -2
  191. package/skills/bpmax-user-mock-operator/scripts/chrome_identity_bridge.mjs +1766 -0
  192. package/skills/bpmax-user-model-editor/SKILL.md +24 -0
  193. package/skills/bpmax-workspace-editor/SKILL.md +1 -0
  194. package/skills/form-control-library/references/form-template-submit-schema.md +3 -1
  195. package/skills/bpmax-user-mock-operator/scripts/switch_user_identity.py +0 -37
  196. package/skills/bpmax-user-mock-operator/scripts/user_mock_operator_common.py +0 -136
  197. package/skills/bpmax-user-mock-operator/tests/test_user_mock_operator.py +0 -138
@@ -2,8 +2,8 @@
2
2
 
3
3
  说明:
4
4
  - `references/negative-sale-api-matrix.md` 记录的是负卖配置样板流程的对象映射和证据来源。
5
- - 实际执行脚本已统一为通用接口骨架:`flow_api_matrix.py`、`flow_form_runtime.py`、`flow_filter_fields.py`、`flow_runner.py`,通过 `--profile negative_sale` 载入本样板。
6
- - 默认 profile 文件:`.codex/skills/bpmax-e2e-flow-test-operator/profiles/negative_sale.json`
5
+ - 接口诊断脚本已统一为通用骨架:`flow_api_matrix.py`、`flow_form_runtime.py`、`flow_filter_fields.py`、`flow_runner.py`,通过 `--profile negative_sale` 载入本样板。它们只能用于离线摸底、状态记录和接口取证,不能替代真实页面 E2E。
6
+ - 默认 profile 文件:当前 skill 根目录的 `profiles/negative_sale.json`;在 `bpmax-cli` 源码仓库中是 `skills/bpmax-e2e-flow-test-operator/profiles/negative_sale.json`
7
7
 
8
8
  适用样板流程:
9
9
  - 工作区:`store_mgr`
@@ -64,12 +64,12 @@
64
64
  - 第一优先:当前浏览器 network 里同节点真实 `PUT /step/{id}?action=approve`
65
65
  - 第二优先:同类流程已有真实骨架 `.codex/tmp/step10424_approve.json`
66
66
 
67
- ## 当前落地脚本
67
+ ## 当前诊断脚本
68
68
  - `scripts/flow_api_matrix.py --profile negative_sale`
69
69
  - `scripts/flow_form_runtime.py --profile negative_sale`
70
70
  - `scripts/flow_filter_fields.py --profile negative_sale`
71
71
  - `scripts/flow_runner.py --profile negative_sale`
72
72
 
73
73
  额外说明:
74
- - 若浏览器请求需要额外 header,可统一走 `--header-file <json>` 或 `BPMAX_EXTRA_HEADERS_JSON`
74
+ - 若诊断接口需要额外 header,可统一走 `--header-file <json>` 或 `BPMAX_EXTRA_HEADERS_JSON`;只允许传脱敏、非鉴权类 header,不得保存 cookie、Authorization 或可复放凭据。
75
75
  - 若需要脱离目录内默认样板,直接改用 `--profile-file <path>`
@@ -1,6 +1,6 @@
1
1
  # Flow Test Profile 规范
2
2
 
3
- Profile 目录默认在 `.codex/skills/bpmax-e2e-flow-test-operator/profiles/`。
3
+ Profile 目录默认在当前 skill 根目录的 `profiles/`;在 `bpmax-cli` 源码仓库中是 `skills/bpmax-e2e-flow-test-operator/profiles/`。
4
4
 
5
5
  ## 必填字段
6
6
  - `workspace`
@@ -48,9 +48,11 @@
48
48
  - `method`
49
49
  - `path`
50
50
  - `status`
51
- - `request` 或 `body`
51
+ - `request_summary` 或 `body_redacted`
52
52
  - `response_excerpt`
53
53
 
54
+ `endpoint_calls` 只能保存脱敏摘要。不得写 cookie、Authorization、token、手机号、密码、完整 request/body、完整 response 或可复放 payload。
55
+
54
56
  `browser_only_steps` 每项建议包含:
55
57
  - `title`
56
58
  - `reason`
@@ -13,7 +13,7 @@ def main():
13
13
  state = json.loads(Path(args.state).read_text(encoding="utf-8"))
14
14
  scenarios = state.get("scenarios", [])
15
15
  issues = state.get("issues", [])
16
- counts = {"pass": 0, "fail": 0, "blocked": 0, "pending": 0}
16
+ counts = {"pass": 0, "diagnostic": 0, "fail": 0, "blocked": 0, "pending": 0}
17
17
  for item in scenarios:
18
18
  counts[item["status"]] = counts.get(item["status"], 0) + 1
19
19
 
@@ -28,14 +28,16 @@ def main():
28
28
  for k, v in state["dependencies"].items():
29
29
  lines.append(f" - `{k}`: `{v}`")
30
30
  lines.append("")
31
- lines.append("## 2. AI 自动测试结论")
31
+ lines.append("## 2. AI 诊断记录(非页面 E2E 结论)")
32
+ lines.append("- 该文档由旧诊断脚本生成,只能记录接口/脚本摸底结果;不能作为完整页面 E2E 通过报告。")
33
+ lines.append("- 正式重新运行报告必须使用 `.ai_test/report/<run_id>/` 并通过 `bpmax-cli test-suite lint-report`。")
32
34
  lines.append(f"- 已测场景数:`{len(scenarios)}`")
33
- lines.append(f"- 通过:`{counts['pass']}`")
35
+ lines.append(f"- 诊断成功:`{counts['diagnostic'] + counts['pass']}`")
34
36
  lines.append(f"- 失败:`{counts['fail']}`")
35
37
  lines.append(f"- 阻塞:`{counts['blocked']}`")
36
38
  lines.append(f"- 待测:`{counts['pending']}`")
37
39
  lines.append("")
38
- lines.append("### 2.1 已测场景")
40
+ lines.append("### 2.1 诊断场景")
39
41
  for item in scenarios:
40
42
  lines.append(f"- `{item['id']}` {item['title']}:`{item['status']}`")
41
43
  if item.get("sample"):
@@ -102,7 +104,7 @@ def main():
102
104
  lines.append(f"- {item['id']}:{item['title']}")
103
105
  lines.append("")
104
106
  lines.append("### 3.3 预期结果")
105
- lines.append("- 逐场景以 2.1 中的通过标准为准。")
107
+ lines.append("- 逐场景以 2.1 中的诊断记录为参考;完整 E2E 通过必须另有真实页面报告。")
106
108
  if state.get("runtime_bindings"):
107
109
  lines.append("")
108
110
  lines.append("## 4. 运行时绑定")
@@ -164,7 +164,7 @@ def cmd_endpoint(args):
164
164
  "path": args.path,
165
165
  "status": args.status,
166
166
  "note": args.note,
167
- "body": body,
167
+ "body_redacted": body,
168
168
  "at": now_iso(),
169
169
  }
170
170
  ],
@@ -231,7 +231,7 @@ def main():
231
231
  p.add_argument("--id", required=True)
232
232
  p.add_argument("--scenario", required=True)
233
233
  p.add_argument("--title")
234
- p.add_argument("--status", required=True, choices=["pass", "fail", "blocked", "pending"])
234
+ p.add_argument("--status", required=True, choices=["pass", "fail", "blocked", "pending", "diagnostic"])
235
235
  p.add_argument("--sample")
236
236
  p.add_argument("--note")
237
237
  p.set_defaults(func=cmd_record)
@@ -326,11 +326,15 @@ def main() -> None:
326
326
  if args.state_id and getattr(err, "code", 0) not in (0, None):
327
327
  record_state_scenario(args.state_id, args.scenario.upper(), "fail", note=str(err))
328
328
  raise
329
- status = "pass"
329
+ status = "diagnostic"
330
330
  note = scenario_note(result)
331
331
  if args.scenario == "full" and not result.get("terminal_reached"):
332
332
  status = "fail"
333
333
  note = (note + ", " if note else "") + "terminal step not reached"
334
+ elif note:
335
+ note = f"{note}; api/script diagnostic only, not browser E2E pass"
336
+ else:
337
+ note = "api/script diagnostic only, not browser E2E pass"
334
338
  record_state_scenario(args.state_id, args.scenario.upper(), status, note=note, sample=str(result.get("project_id") or ""))
335
339
  if args.output:
336
340
  save_json(Path(args.output), result)
@@ -11,6 +11,7 @@ if str(SCRIPT_DIR) not in sys.path:
11
11
  sys.path.insert(0, str(SCRIPT_DIR))
12
12
 
13
13
  import e2e_state # noqa: E402
14
+ import flow_test_profile # noqa: E402
14
15
  from bpmax_session import resolve_extra_headers # noqa: E402
15
16
  from flow_test_profile import FlowTestProfile, load_profile, resolve_profile # noqa: E402
16
17
  from flow_api_matrix import build_matrix # noqa: E402
@@ -19,6 +20,76 @@ from flow_form_runtime import build_create_skeleton, infer_transition # noqa: E
19
20
 
20
21
 
21
22
  class NegativeSaleApiToolsTests(unittest.TestCase):
23
+ @classmethod
24
+ def setUpClass(cls) -> None:
25
+ cls.fixture = tempfile.TemporaryDirectory()
26
+ cls.fixture_root = Path(cls.fixture.name)
27
+ cls.original_root = flow_test_profile.ROOT
28
+ flow_test_profile.ROOT = cls.fixture_root
29
+ cls._write_fixture()
30
+
31
+ @classmethod
32
+ def tearDownClass(cls) -> None:
33
+ flow_test_profile.ROOT = cls.original_root
34
+ cls.fixture.cleanup()
35
+
36
+ @classmethod
37
+ def _write_json(cls, path: Path, payload: object) -> None:
38
+ path.parent.mkdir(parents=True, exist_ok=True)
39
+ path.write_text(json.dumps(payload, ensure_ascii=False), encoding="utf-8")
40
+
41
+ @classmethod
42
+ def _write_fixture(cls) -> None:
43
+ profile = resolve_profile()
44
+
45
+ form_dir = cls.fixture_root / "think_form_template" / f"uuid'{profile.form_template_uuid}"
46
+ cls._write_json(form_dir / "form_template", {"name": profile.form_template_name})
47
+ cls._write_json(
48
+ form_dir / "think_form_rule" / "001-negativeQuota" / "form_rule.value",
49
+ {"field": "negativeQuota", "title": "负卖额度", "template_id": 1, "field_type": "i_input_number", "key": "negativeQuota"},
50
+ )
51
+ cls._write_json(
52
+ form_dir / "think_form_rule" / "002-seller" / "form_rule.value",
53
+ {"field": "seller", "title": "经销商团队", "template_id": 1, "field_type": "group_select", "key": "seller"},
54
+ )
55
+
56
+ data_set_base = (
57
+ cls.fixture_root
58
+ / "think_data_set"
59
+ / f"uuid'{profile.data_set_uuid}"
60
+ / "think_data_set_data_set_fields_think_data_set_field"
61
+ )
62
+ for field in ("name", "seller", "product", "status"):
63
+ field_dir = data_set_base / f"id'1___key'{field}___is_del'0"
64
+ cls._write_json(field_dir / "data_set_data_set_fields_think_data_set_field", {"key": field})
65
+
66
+ for uuid, config in (
67
+ (profile.filter_template_uuid, [{"field": field, "label": field, "is": "input", "type": "like"} for field in ("name", "seller", "product", "status")]),
68
+ (profile.list_template_uuid, [{"field": field, "title": field, "icon": ""} for field in ("name", "seller", "product", "status")]),
69
+ ):
70
+ cls._write_json(
71
+ cls.fixture_root / "think_flow_page_template" / f"uuid'{uuid}" / "flow_page_template.content",
72
+ {"config": config},
73
+ )
74
+
75
+ cls._write_json(
76
+ cls.fixture_root / "think_flow" / f"flow_type'{profile.flow_type}" / "flow.data",
77
+ {
78
+ "nodes": [
79
+ {
80
+ "id": "1777001001001",
81
+ "name": "经销商负责人审批",
82
+ "approve_actions": ["通过|1777001001002"],
83
+ "approve_fail_actions": ["驳回|1775123074529"],
84
+ },
85
+ {"id": "1775123074529", "name": "修改配置", "approve_to_step": "1777001001001"},
86
+ {"id": "1777001001002", "name": "区域经理审批", "approve_to_step": "1777001001003"},
87
+ {"id": "1777001001003", "name": "零售业务部审批", "approve_to_step": "1775123027709"},
88
+ {"id": "1775123027709", "name": "生效中"},
89
+ ]
90
+ },
91
+ )
92
+
22
93
  def test_build_create_skeleton_from_local_template(self) -> None:
23
94
  profile = resolve_profile()
24
95
  payload = build_create_skeleton(profile=profile)
@@ -0,0 +1,64 @@
1
+ ---
2
+ name: bpmax-e2e-flow-test-operator-v2
3
+ description: "仅在用户显式调用时,用已审查脚本自动执行 BPMAX 端到端流程测试。用于先预检用例与线上配置、隔离执行指定用例、自动处理写入并保存本轮证据。"
4
+ ---
5
+
6
+ # BPMAX E2E Flow Test Operator V2
7
+
8
+ 只在用户显式要求使用 V2 时执行。本 Skill 与 V1 并行,绝不修改或替代 V1。
9
+
10
+ ## 固定流程
11
+ 1. 读取线上最新 live/draft 配置和当前 `.ai_test` 资产;先读取 `references/test-preflight-and-confirmation.md`。
12
+ 2. 输出测试用例预检:可复用用例、计划范围、失效或缺失步骤、排除项与资产动作。用户已经明确要求执行测试时,该请求即授权在所述业务范围内自动推进,不再等待第二次确认;读取 `references/autonomous-execution.md`。
13
+ 3. 先运行 automation status,将 selected steps 分为 `reusable`、`regenerate_required` 和 `blocked`;展示复用项、需更新项、warning 和排除项。
14
+ 4. `reusable` 保持现有已 promote automation,不重复录制或回放。只对需更新步骤按 `references/browser-recording-and-replay.md` 录制、生成候选并在全新 browser context 回放。
15
+ 5. 只对 changed steps 在 `suite_draft` 完成最小 diff、scoped lint 和 review;自动修复 P0/P1 后冻结候选。warning 和 UX 建议不阻断业务执行。
16
+ 6. 向用户展示最终 case、排除项、资产 diff 和执行动作,同时自动生成并接受绑定当前明确测试请求的内部授权回执;仅在有资产变化时 promote,再按 `references/scoped-execution.md` 创建 scoped run,不为 promote、run 或写入步骤再次询问确认。
17
+ 7. 需要造前置数据时,先把 `fixtures.json` 作为场景资产纳入 diff、review、promote 和授权范围;scoped run 会复制并锚定该清单。创建 run 后,自动用 typed CLI 创建或校验依赖数据。父子项目、跨流程和中间状态使用 fixture dependency graph、精确 outputs 与 typed transitions;需图片输入时使用清单中带 SHA-256/MIME/大小的 reviewed `assets`,由 typed upload adapter 回读内容后绑定 `{{assets.<key>.url}}`。CLI 将结果写入本轮 `fixture-runtime-data.json`,后续 automation 只能通过 `precondition` data binding 消费;重复且领域化的参数推导优先沉淀为 BBS。前置证据通过后,正式业务页面的导航、读取、截图、输入、点击、提交、审批、登录、身份切换和验证才由已审查 automation 脚本执行。表单步骤必须先按最新版表单生成表单契约并覆盖全部必填字段;数据和选择器按 `references/test-data-and-selector-contract.md` 绑定。读取 `references/browser-action-runner.md`、`references/step-restartability-and-state.md` 和 `references/identity-and-failure-routing.md`。
18
+ 8. 涉及一次交互产生多个写请求时读取 `references/multi-request-mutation.md`;批量场景按 `references/batch-generation-and-execution.md` 分批熔断和隔离发布。
19
+ 9. 逐步骤保存本轮证据、完成 UX 审计和报告 lint;读取 `references/test-assets-and-evidence.md`。
20
+ 10. 出现身份、环境、脚本或产品异常时,按 `references/identity-and-failure-routing.md` 分流并如实报告。
21
+
22
+ ## 不可绕过的门禁
23
+ - 新建或修复 automation 时的受控录制是唯一例外;正式执行不得手工操作浏览器。不得通过 Chrome Control、DevTools 或 AppleScript 直接执行正式测试或绕过脚本诊断,录制动作必须完整进入 trace 和 `recording_only` 报告。
24
+ - 需录制时必须使用 `Chrome` 插件直接操作并由 Agent 结构化记录;不得使用 Record & Replay、`event_stream` 或其他事件流录制器。
25
+ - 文件上传录制出现文件选择器无响应时,不得反复点击或改用未审查旁路;必须按 `references/browser-recording-and-replay.md` 的已知问题恢复协议重建控制会话和标签页,并在点击前启动文件选择监听。
26
+ - 可使用 Chrome 插件发现已登录会话,并将与当前 profile 匹配的认证数据交接给 Playwright context;具体规则见身份 reference。
27
+ - 不得使用 `runner=browser`;正式页面步骤必须使用已审查的 `browser_action` automation。
28
+ - 不得用 raw API、控制台请求或修改请求体替代页面路径。
29
+ - 前置依赖数据不是被测页面动作时,必须优先使用 `test-fixture create`、领域 typed adapter 或调用它们的已审核 BBS 创建;不得为了准备数据临时探索浏览器。只有“页面创建本身”属于本次验证目标时,才由 Playwright 执行创建。
30
+ - `test-fixture create` 只能使用已随场景 review/promote、由确认后的 scoped run 锚定的 `fixtures.json`;不得在 run 创建后临时替换造数清单。
31
+ - fixture graph 的依赖、运行时引用、output 精确回读路径、目标 owner 和 transition action 都必须在自动授权回执生成前进入清单;不得把 CLI 输出只留在聊天或 shell 中,也不得在 run 后补写父项目 ID、step ID 或办理人。
32
+ - fixture reviewed asset 必须位于场景 `fixtures/`、在清单声明相对路径、SHA-256、MIME、大小和用途;不得把本地路径、旧 `/upload/` URL 或未回读的新 URL 直接填入业务数据。
33
+ - `--diagnostic` 仅可用于非页面的配置、接口或日志诊断;不得生成页面结论或正式通过证据。
34
+ - 只有明确要求执行、回归或测试某个业务范围的请求才能启用自动授权;“继续”“看一下”“分析一下”等模糊回复不能新建或扩大执行范围。自动授权仍必须由 CLI 回执绑定 selected cases 和资产哈希。
35
+ - 不得在聊天输出、测试报告、截图证据或完整环境变量转储中暴露 Cookie、token 或 Authorization;认证数据可以在 Chrome 与 Playwright 之间受控交接。
36
+ - 用户发送 Cookie 后不得复述、引用或写入 memory、automation、manifest、报告和 Git 文件;只允许写入权限为 `0600` 的本轮临时认证文件,并在测试收口时清理。
37
+ - 不得按浏览器标签页顺序选择页面,也不得将遗留 `/login` 页面当作业务页面;登录 bootstrap 失败时必须 `blocked`,不得创建或重试业务数据。
38
+ - Playwright 登录超时后,普通 `--resume` 不得再次打开登录窗口;只有用户已准备完成一次可见登录时,才显式使用 `--retry-interactive-login` 重新授权一次登录尝试。
39
+ - 上次 scenario 进程异常结束且 checkpoint 仍为 `running` 时,普通 `--resume` 必须阻断;确认残留浏览器已退出且 mutation 未尝试后,才显式使用 `--recover-orphaned-run` 恢复。
40
+ - 不得假定 `browser.contexts()[0]` 是认证 context,也不得仅按候选 URL 判定登录有效;认证 context 不唯一或导入后认证探测失败时必须在业务动作前阻断。
41
+ - 不得因为 Chrome 插件看到了已登录页面,就假定指定 CDP endpoint 属于同一浏览器进程;必须以 Playwright 对目标 route 的认证探测为准。
42
+ - 身份操作必须绑定实际执行页面动作的浏览器:录制阶段在 Chrome Control 当前录制标签页使用同一 recording session 执行 `ensure actor/release actor`;回放和正式运行阶段由 scenario runner 自动执行已审核的 `runner=identity` mock/unmock 步骤。`actor` 字段和 typed 用户回读只描述目标身份,不会自行切换 Playwright 会话;存在精确身份阶段合同时,缺少对应 mock/unmock 必须被 lint/run start 阻断。Agent不得为正式 run 手工调用 identity browser prepare/helper/complete。Playwright 未登录时必须打开有界的非 headless 登录窗口,认证回读通过后才能继续。
43
+ - 既有 case 不足或与配置不一致时,默认建立最小隔离 draft 场景;只有用户明确要求,才修改共享主场景。
44
+
45
+ ## 结论边界
46
+ - `pass`:确认范围内的每个必需步骤都由本轮脚本完成,当前 run 证据和业务断言完整;若只覆盖部分 active case,场景级结论只能是 `partial`。
47
+ - `partial`:仅执行 selected cases 或未覆盖完整场景。UX findings 独立报告,不改变已证明的业务步骤结论。
48
+ - `blocked`:缺少执行授权、环境/权限阻塞、脚本无法自动修复、证据或写入状态无法确认。每次必须输出已完成边界、解除条件、下一责任方和一条可直接继续对话的提示词;具体格式见身份 reference。
49
+
50
+ ## Reference 路由
51
+ - 预检内容、确认语句与状态机:`references/test-preflight-and-confirmation.md`
52
+ - 自动授权、连续推进、自动修复与唯一停止边界:`references/autonomous-execution.md`
53
+ - selected case、隔离场景与 scoped run:`references/scoped-execution.md`
54
+ - automation 编译、原子提交、修复与续跑:`references/browser-action-runner.md`
55
+ - 表单契约、必填字段覆盖和批量脚本熔断:`references/form-script-generation.md`
56
+ - 业务场景覆盖矩阵与 PC/H5 建模:`references/scenario-coverage-generation.md`
57
+ - 多来源生成、canonicalization 与 publishability:`references/automation-generation-pipeline.md`
58
+ - 真实浏览器录制、录制报告和独立回放:`references/browser-recording-and-replay.md`
59
+ - 本轮数据、fixture 与 selector 主数据契约:`references/test-data-and-selector-contract.md`
60
+ - 独立步骤重建、上下文提取和断点状态:`references/step-restartability-and-state.md`
61
+ - 单次交互的主写入与伴随写入:`references/multi-request-mutation.md`
62
+ - 多流程批量生成、隔离 lint/review/promote 与熔断:`references/batch-generation-and-execution.md`
63
+ - 用例资产、逐步骤证据、报告与重跑:`references/test-assets-and-evidence.md`
64
+ - 身份桥、环境证据、失败归因与 issue:`references/identity-and-failure-routing.md`
@@ -0,0 +1,7 @@
1
+ interface:
2
+ display_name: "BPMAX E2E Flow Test Operator V2"
3
+ short_description: "Confirm scope then run BPMAX E2E with reviewed scripts"
4
+ default_prompt: "Use $bpmax-e2e-flow-test-operator-v2 to preflight and run a confirmed BPMAX E2E test scope."
5
+
6
+ policy:
7
+ allow_implicit_invocation: false
@@ -0,0 +1,33 @@
1
+ # 自动化生成流水线
2
+
3
+ ## Canonical 输入
4
+
5
+ 多 Agent、录制器或历史资产的输出只能作为候选材料,不能直接 promote。统一映射到 CLI 生成的 `bpmax_e2e_automation_compile_input`,逐步骤保留 case 快照、来源、publishability、数据契约和 automation。
6
+
7
+ 不得让不同 Agent 自定义三套 JSON 结构。CLI 生成的 compile input 是唯一可编译结构;未知字段、孤立步骤或过期 case 快照必须阻断。
8
+
9
+ ## 生成顺序
10
+
11
+ 1. 从线上最新配置和已审核用例生成步骤清单,并运行 automation status。
12
+ 2. `reusable` 步骤直接保留;仅对 `regenerate_required` 步骤由 LLM 使用 `Chrome` 插件受控录制,禁止使用 Record & Replay 或 `event_stream`。
13
+ 3. 对新录制步骤生成 `recording_only` 报告和 review-required 候选;平台源码和线上配置用于补充校验。
14
+ 4. 生成 `surface`、页面指纹、动作、断言、数据契约和写入回读。
15
+ 5. 在全新 browser context 独立回放,修复后重新回放,直到脚本稳定。
16
+ 6. 执行语义 lint,而非只检查 JSON 结构。
17
+ 7. 标记 publishability,完成 review 后再 compile。
18
+
19
+ 新生成页面步骤建议保留 `browser_recording_report:<path>#sha256=<hash>`。缺少或格式不完整时输出 warning;报告始终只能声明 `recording_only`,不能声明正式通过。
20
+
21
+ ## 最小必要 Lint
22
+
23
+ Hard lint 只保护页面动作安全、mutation 防重、身份边界、必填字段、核心断言、资产哈希和本轮证据真实性。来源措辞、时间格式、缺省 PC surface、未使用 binding 和 UX 完整性进入 warning 或 review。
24
+
25
+ ## Publishability
26
+
27
+ `ready` 表示身份、样本、selector、路由、权限、控件、下载和 DOM 均可确定执行,且 `blocked_reasons` 为空。
28
+
29
+ 任何未解决项必须标记 `blocked` 并列出结构化原因。`issue_count=0` 只说明结构正确,不代表可发布;blocked step 不能 compile、review 为通过或 promote。
30
+
31
+ ## 批量熔断
32
+
33
+ 发现连续的标题-only 脚本、相同 selector 缺失、相同路由猜测或相同身份阻塞时,立即停止批次。先修生成规则,再重新初始化受影响步骤,避免继续扩大错误资产。
@@ -0,0 +1,40 @@
1
+ # 自动全链路执行
2
+
3
+ 用户明确要求“执行测试”“回归测试”或“运行这些用例”时,该请求即构成本轮所述业务范围的执行授权。Agent 必须先输出预检范围,但不得为了 promote、创建 run、造前置数据、mock 身份或执行写入步骤再次等待用户确认。
4
+
5
+ CLI 仍生成 confirmation request,并以 `explicit_test_request` 模式自动接受。回执继续绑定 scenario、selected cases、资产哈希和操作范围;它用于防止执行范围或测试资产在运行中漂移,不代表需要第二轮人机确认。模糊的“继续”“看一下”不能新建授权,也不能扩大先前范围。
6
+
7
+ ## 连续推进
8
+
9
+ 获得自动授权后,Agent 在同一轮持续执行:
10
+
11
+ 1. 完成 automation status,并自动修复 `regenerate_required` 的步骤。
12
+ 2. 对 changed steps 执行 compile、scoped lint、review,自动解决 P0/P1。
13
+ 3. 自动 promote 最终候选并创建 selected-case scoped run。
14
+ 4. 有 reviewed fixtures 时自动执行 typed fixture create;没有造数需求时执行 typed readback。
15
+ 5. 自动生成、校验并登记当前 run 的 precondition evidence。
16
+ 6. 启动 scenario runner,自动完成登录态探测、identity mock/unmock、全部页面动作、写入、写后回读和证据登记。
17
+ 7. 遇到可确定的 selector、等待、页面漂移或脚本问题时,暂停当前步骤,修复 draft automation、lint/review、生成 repair receipt,并从 checkpoint 自动续跑。
18
+ 8. 完成 UX 审计、报告 lint 和最终结论;只执行部分 case 时保持 `partial` 边界。
19
+
20
+ 不得把命令阶段边界解释为需要用户推进。只要下一动作可由当前授权、typed CLI、已审核 automation 或确定性 readback 完成,就必须自动继续。
21
+
22
+ ## 自动处理范围
23
+
24
+ - 可重试的只读动作、路由等待、稳定 selector 修复和非语义脚本修复。
25
+ - reviewed fixture 的创建、校验、typed transition 和清理。
26
+ - 已审核 identity 阶段中的 mock、身份回读和 unmock。
27
+ - `mutation_state=not_committed` 且具有当前 run 确定性证据时,从步骤边界继续。
28
+ - 页面写入已经 committed、步骤证据已登记但报告同步失败时,只修复报告,不重放业务步骤。
29
+
30
+ ## 唯一停止边界
31
+
32
+ 只有以下情况允许停止并输出恢复提示词:
33
+
34
+ - 没有可用认证材料,且必须由用户在可见 Playwright 窗口完成登录。
35
+ - mutation 已尝试但 committed/not_committed 无法由当前 run 确定性回读确认。
36
+ - 修复会改变用户最初请求的业务范围、业务预期或新增高风险清理目标。
37
+ - 平台权限、环境或产品缺陷无法由 CLI、automation 或配置修复。
38
+ - 缺少必须由用户提供且无法安全推导的业务输入。
39
+
40
+ 普通 warning、UX finding、可自动修复的 P0/P1 脚本问题、fixture 创建、身份切换和已审核写入动作都不是停下来询问确认的理由。
@@ -0,0 +1,17 @@
1
+ # 批量生成与执行
2
+
3
+ ## 隔离单元
4
+
5
+ 批量任务按 scenario 或 flow 分成独立单元。每个单元分别执行 init、生成、lint、review、promote 和 scoped run;另一个流程的 case、脚本或阻塞项不得阻断本单元。
6
+
7
+ 共享输出只能作为候选输入。多 Agent 结果必须由主流程 canonicalize、去重、核对 case 快照和 publishability 后才能进入 CLI compile。
8
+
9
+ ## 批次状态
10
+
11
+ 批次矩阵至少记录:场景、case 数、脚本数、ready 数、blocked 数、阻塞原因、PC/H5 覆盖、lint、review、promote 和 run 状态。不能用总 `issue_count=0` 覆盖场景级 blocked。
12
+
13
+ ## 熔断与恢复
14
+
15
+ 同类生成缺陷连续出现时停止剩余生成,修复规则并回归一个代表场景后再恢复。已生成但未 review 的资产全部重新 lint;不得只修最后一个失败场景。
16
+
17
+ 批量执行仍为每个 scoped run 创建独立 manifest、lease、data profile、automation snapshot 和证据目录。历史通过不构成本轮跳过条件;用户要求重跑时必须执行选中 case 的全部步骤。
@@ -0,0 +1,19 @@
1
+ # Browser Action Runner
2
+
3
+ 所有页面动作由已审查的 `browser_action` automation 一次执行。正常路径使用 scenario runner,而非 Agent 逐按钮操作。
4
+
5
+ scenario runner 启动业务步骤前,当前 run 的前置记录必须已经由 typed CLI fixture/readback 标记为 passed。前置造数不属于页面 runner;不得在 Playwright 打开页面后临时发现缺数据并现场创建。若创建页面本身是用例目标,则它必须作为普通 `browser_action` 步骤执行并保留页面证据,不能同时算作隐藏前置动作。
6
+
7
+ runner 的认证和身份状态属于当前执行 context。回放或正式运行没有有效登录态时,runner 必须打开非 headless Playwright 窗口并等待用户完成登录;认证探测必须确认目标工作区页面未跳转登录页且当前用户回读有效,之后才能开始业务动作。登录等待必须有超时,超时后 `blocked`,不得创建业务数据。
8
+
9
+ 回放和正式运行中的已审核 `runner=identity` 步骤由 scenario runner 自动执行。业务步骤上的 `actor` 不会隐式触发 mock;资产必须通过 identity 步骤声明目标 actor、精确 `user_id` 和目标业务 route。runner 自行完成当前身份回读、必要的 mock、路由刷新和写后验证。mock 后的连续业务步骤以及 unmock 都必须使用该 run 的 Playwright profile/storage state;不得调用 Chrome Control 身份桥替代正式执行,也不得让 Agent手工执行 prepare/helper/complete。
10
+
11
+ 相同 actor 的连续步骤复用当前身份,不重复产生 identity mutation。独立 status 只用于测试身份展示本身,不是 mock 的固定前置。actor 变化、case 收口或 run 清理时,runner 才按 lease 执行 release;lease 状态未知时先 resolve,禁止重试身份 mutation。
12
+
13
+ 涉及表单填写时,先按 `form-script-generation.md` 生成并审查表单契约;automation 结构正确但必填字段覆盖不完整,同样不得 compile、review 或 promote。
14
+
15
+ 新建或修复脚本时按 `browser-recording-and-replay.md` 完成录制、候选生成和独立回放;reusable automation 直接进入新的 scoped run。页面漂移、控件不支持或执行异常时,暂停当前 run;修复 draft automation,重新编译和 review,生成 repair receipt 后从受控 checkpoint 续跑。不得手工编辑 manifest、运行时 automation 或重放已确认 mutation。
16
+
17
+ checkpoint 使用 `status/prepare/complete/resolve` 管理录制或执行中断。mutation 在 prepare 后中断时必须先 resolve committed/not_committed,普通动作才允许从 checkpoint 继续。
18
+
19
+ 每个远端 mutation 必须是单一步骤、在动作前完成证据目录预检,并具备 committed/not_committed 两套回读检查。写入状态不确定时必须先 resolve,不能重试提交。
@@ -0,0 +1,95 @@
1
+ # 真实浏览器录制与独立回放
2
+
3
+ ## 适用边界
4
+
5
+ 仅当 automation status 返回 `regenerate_required`,或用户明确要求重新录制时,LLM 才使用 `Chrome` 插件在真实浏览器中直接操作。已有 reusable automation 不重复录制或回放。录制不是正式测试,不能形成 `pass`。
6
+
7
+ 不得启动或读取 Record & Replay,不得调用 `event_stream_start`、`event_stream_status` 或 `event_stream_stop`。V2 的录制来源是本轮 Chrome 插件操作及其页面证据,不是浏览器事件流。
8
+
9
+ 录制前必须完成认证探测。涉及创建、提交、审批、删除、身份切换或清理时,还必须在已确认范围内使用唯一测试数据,并预先定义写后回读和清理方式。
10
+
11
+ 录制阶段需要模拟身份时,使用 Chrome Control 当前录制标签页执行 `ensure actor` 和 `release actor`。mock 前的当前身份回读由 `ensure actor` 内置,不再额外创建固定 status 步骤。两次身份动作必须绑定同一个 recording session 根目录和同一份 identity lease;禁止使用 `--diagnostic`、不同 evidence 根目录或临时用户管理页探索来拼接身份链路。身份截图、回读和后续录制动作必须来自同一个标签页。
12
+
13
+ ## 逐步骤完整录制
14
+
15
+ 录制前必须读取本次 selected cases 对应的 `case_steps.csv` 行,并按当前配置、表单契约和测试数据生成逐步骤录制作业单。作业单必须固定 case/step、surface、前置状态、单一动作、目标、输入、即时结果、mutation、写后回读、清理和证据要求;没有达到 `ready` 的步骤必须在打开业务页面前标记 `blocked`,不能进入临场分析。
16
+
17
+ 仅对 regenerate_required 步骤按 case 顺序完整录制。一个需更新步骤包含创建、提交、审批或删除 mutation 时,其即时结果、回读和必要清理也必须完整进入该步骤录制,不得只录到提交前就声明完成。未变化步骤继续使用已审核 automation,不得为了补 provenance 强制重录。
18
+
19
+ 录制中发现的配置漂移、控件异常、权限穿透、身份偏差、写入失败或回读不一致,必须保留在当前 step 的 trace 和报告中,记录动作位置、预期、实际结果及对应截图、DOM 或网络证据。不得降低原预期、跳过失败步骤或重新解释用例来生成可通过候选。
20
+
21
+ ## PC/H5 可见区域
22
+
23
+ PC 与 H5 必须使用独立页面。H5 通过页面级设备模拟或内容 viewport 将可见区域固定为 `390x844`、portrait、touch;只调整页面可见区域,不得调整操作系统窗口或 Chrome 整个外层窗口大小。不得通过缩放或拖动已经使用过的 PC 浏览器窗口来模拟 H5。
24
+
25
+ viewport 必须在打开业务路由前设置。首个业务动作前校验 `window.innerWidth`、`window.innerHeight` 和 `visualViewport` 与声明一致,并确认 H5 使用移动端路由、PC 使用桌面路由;不一致时以 `recording_surface_invalid` 阻断,不得继续录制。
26
+
27
+ ## 文件上传已知问题与恢复协议
28
+
29
+ Codex 的 Chrome 控制链路存在已知文件选择器问题:[openai/codex#35051](https://github.com/openai/codex/issues/35051)。当点击上传后文件选择器事件没有被控制会话捕获、上传控件无变化或旧标签页持续无法接收文件时,不得反复点击、复用旧 element id、切换到 Record & Replay,或把 `locator.setInputFiles` 当作录制旁路。
30
+
31
+ 必须按以下顺序恢复,顺序不可交换:
32
+
33
+ 1. 将当前 step 保持为录制中断状态,不记录 mutation 成功,也不继续后续业务动作。
34
+ 2. 关闭失效的控制连接并重建 Chrome 控制会话。
35
+ 3. 创建全新标签页,重新打开目标 route,完成认证、身份和步骤前置状态回读;不得继续使用原上传标签页。
36
+ 4. 将待上传文件解析为绝对路径,并在点击前确认它是当前机器上存在、可读的普通文件。trace、automation 和报告只记录脱敏后的测试资产标识,不记录敏感本地路径。
37
+ 5. 先启动最长 10 秒的文件选择监听,再点击页面上可见的上传触发器;监听必须先于点击进入等待状态。捕获 chooser 后,通过 chooser 设置该绝对路径。
38
+ 6. 上传后立即核对文件名或预览、控件状态和必要 DOM/readback,并保存当前步骤截图;只有这些断言通过,上传动作才可进入候选 automation。
39
+
40
+ 等价的受控动作顺序为:
41
+
42
+ ```js
43
+ const chooserPromise = page.waitForEvent('filechooser', { timeout: 10_000 });
44
+ await uploadTrigger.click();
45
+ const chooser = await chooserPromise;
46
+ await chooser.setFiles(absoluteFilePath);
47
+ ```
48
+
49
+ 该片段只描述动作顺序,实际 selector、文件数据绑定和断言仍必须来自当前已审查 case/step。文件路径必须由本轮 data binding 提供绝对路径,禁止把开发机固定路径写入正式 automation。
50
+
51
+ 若全新控制会话和全新标签页仍未在 10 秒内捕获 chooser,当前步骤必须标记为 `blocked`,输出目标 URL、控件、已完成的恢复动作、无业务 mutation 的证明和下一步提示词。不得继续重试点击或把上传未完成解释为页面通过。
52
+
53
+ ## 固定顺序
54
+
55
+ 1. 使用 `Chrome` 插件打开与 profile、workspace 和目标终端一致的真实页面。
56
+ 2. 每次操作前读取最新页面快照,由 LLM 执行一个明确动作;操作后保存新的快照或截图以及即时结果。
57
+ 3. Agent 将本轮 Chrome 操作依次规范化写入 `browser-action-trace.json`,并声明 `capture_method=chrome_plugin`;不得从 Record & Replay 事件转换。
58
+ 4. CLI 首先生成 `browser-recording-report.json`。
59
+ 5. 报告通过结构与哈希检查后,才生成 review-required automation candidate。
60
+ 6. 将候选映射到 canonical compile input,不直接写正式 `automation.json`。
61
+ 7. 在新的 Playwright browser context 中独立回放候选,不复用录制页面状态。
62
+ 回放包含身份步骤时,mock/unmock 必须在该 Playwright context 的认证会话中执行,并在同一 context 回读精确用户身份。
63
+ 8. 回放失败时根据本轮证据修复 draft 脚本,再从步骤起点回放;不得手改 manifest 或任何哈希。
64
+ 9. 独立回放稳定后,才进入 scoped lint、多视角 review、最终确认和 promote。
65
+
66
+ ## 录制报告
67
+
68
+ 报告必须至少记录:
69
+
70
+ - `kind=bpmax_e2e_browser_recording_report`
71
+ - `result=recording_only`
72
+ - `formal_conclusion=false`
73
+ - `capture_method=chrome_plugin`
74
+ - scenario、case 和 case step
75
+ - trace 路径及 SHA-256
76
+ - 页面指纹、动作数、断言数
77
+ - 截图、DOM 和网络摘要清单
78
+ - 是否包含 mutation
79
+ - 未解决项和下一步
80
+
81
+ 新候选应绑定报告和 trace,便于 review;这些 provenance 缺口输出 warning,不得使结构、资产哈希和安全门禁均有效的 legacy automation 失效。
82
+
83
+ `browser-action-trace.json` 由 Agent 根据 Chrome 插件调用顺序生成,至少包含页面指纹、规范化动作、即时断言和 `capture_method=chrome_plugin`。Chrome 返回的临时 element id 不能直接成为正式 selector;必须转换为稳定字段名、标签、角色、文本或测试标识。
84
+
85
+ ## 回放要求
86
+
87
+ 录制不能验证自己。独立回放必须:
88
+
89
+ - 使用新 browser context 或已清理且可证明独立的 context。
90
+ - 从步骤声明的前置状态开始,不继承录制后的业务页面或内存状态。
91
+ - 使用新的唯一测试数据;mutation 结果按 committed/not_committed 规则回读。
92
+ - 保存回放自己的截图、DOM、trace 和断言结果。
93
+ - 失败时只修复 draft automation,再重新 lint 和回放。
94
+
95
+ 只有独立回放通过,候选脚本才能标记为可 review。正式运行仍需创建新的 scoped run,并生成另一套本轮证据。
@@ -0,0 +1,41 @@
1
+ # 表单脚本生成
2
+
3
+ ## 生成基线
4
+
5
+ 每个表单填写步骤都必须先读取线上最新流程创建节点和实际绑定表单,再生成独立的 `form_contract`。契约至少记录表单模板身份、来源、来源 SHA-256、采集时间和 `required_fields`。
6
+
7
+ 不得从另一个流程复制通用填写脚本,也不得把“按当前表单补齐最小必填字段”写进 `case_steps.csv` 后交给执行阶段临场判断。多流程批量生成时必须逐表读取、逐表建契约、逐表 lint。
8
+
9
+ ## 必填字段覆盖
10
+
11
+ `required_fields` 必须递归覆盖当前条件下会生效的必填字段,包括普通字段、条件必填、附件、子表字段和关联选择器。标题类静态控件不属于字段,也不进入契约。
12
+
13
+ 每个必填字段必须选择一种覆盖方式:
14
+
15
+ - `action_assertion`:automation 中同时存在与字段对应的写动作和确定性断言。
16
+ - `auto_filled`:由平台自动填充,并提供可审查的来源或只读页面证据。
17
+ - `defaulted`:由表单默认值提供,并记录默认值定义来源。
18
+ - `conditional_not_applicable`:本用例条件明确不触发该字段,并记录条件证据。
19
+ - `precondition_provided`:由同一 scoped run 的前置阶段准备,并引用前置证据。
20
+
21
+ 除 `action_assertion` 外,其他方式都必须提供具体 `evidence`,不得填写“无”“待确认”或类似占位内容。
22
+
23
+ ## 控件动作
24
+
25
+ - `i_input`、`i_textarea`、`i_input_number` 使用 `form.set_value`。
26
+ - `i_select`、`radio`、`checkbox` 使用 `form.select_option`。
27
+ - `bp-date-picker` 使用确定性的日期写入动作。
28
+ - `bp-upload` 使用 `form.upload_file`,并绑定本轮 fixture、MIME、大小和 SHA-256。
29
+ - `selector`、人员/组织/项目/流程关联选择器和 `sub_form` 在 runner 没有稳定动作时必须报告 `blocked`,不得伪造为已覆盖。
30
+
31
+ 每个 `action_assertion` 字段都必须有匹配 `field` 或 `label` 的 `form.assert_value`。仅截图、仅等待可见或最终提交成功不能替代字段级断言。
32
+
33
+ ## Compile 门禁
34
+
35
+ V2 的表单填写步骤缺少 `form_contract`、`required_fields` 为空、来源不可审查、必填字段未覆盖或控件不支持时,CLI 必须阻断 compile。未通过 compile 的资产不得进入 review、promote 或正式 run。
36
+
37
+ compile 前输出字段覆盖矩阵,至少包含:字段、标签、控件类型、必填条件、覆盖方式、动作、断言或豁免证据。发现契约还有其他必填字段但脚本只填标题时,必须判为生成缺陷。
38
+
39
+ ## 批量熔断
40
+
41
+ 批量生成不得以同一份“只填标题”脚本覆盖多个不同表单。连续场景出现相同缺失必填字段、相同 unsupported 控件或相同来源缺失时,立即停止本批次,修复生成规则并重新初始化受影响场景,不继续产生更多可 promote 的错误资产。