bpmax-cli 0.2.1-beta.53 → 0.2.1-beta.54

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 (30) hide show
  1. package/dist/bin.js +4321 -1038
  2. package/dist/bin.js.map +1 -1
  3. package/package.json +1 -1
  4. package/scripts/install-skills.mjs +21 -57
  5. package/skills/bpmax-ai-taskbook/SKILL.md +10 -0
  6. package/skills/bpmax-ai-taskbook/references/blueprint-taskbook-gates.md +120 -0
  7. package/skills/bpmax-ai-taskbook/references/taskbook-template.md +41 -1
  8. package/skills/bpmax-blueprint-doc-workflow/SKILL.md +15 -2
  9. package/skills/bpmax-blueprint-doc-workflow/references/blueprint-structure.md +8 -0
  10. package/skills/bpmax-blueprint-doc-workflow/references/per-flow-required-structure.md +13 -0
  11. package/skills/bpmax-blueprint-doc-workflow/references/sample-missing-modeling-review.xml +23 -0
  12. package/skills/bpmax-blueprint-doc-workflow/references/sample-paragraph-flow-details.xml +27 -0
  13. package/skills/bpmax-blueprint-doc-workflow/references/sample-pass.xml +45 -28
  14. package/skills/bpmax-blueprint-doc-workflow/references/source-traceability-and-flow-modeling.md +115 -0
  15. package/skills/bpmax-blueprint-doc-workflow/scripts/lint_blueprint_doc.py +386 -5
  16. package/skills/bpmax-e2e-flow-test-operator-v2/SKILL.md +56 -0
  17. package/skills/bpmax-e2e-flow-test-operator-v2/agents/openai.yaml +7 -0
  18. package/skills/bpmax-e2e-flow-test-operator-v2/references/automation-generation-pipeline.md +33 -0
  19. package/skills/bpmax-e2e-flow-test-operator-v2/references/batch-generation-and-execution.md +17 -0
  20. package/skills/bpmax-e2e-flow-test-operator-v2/references/browser-action-runner.md +15 -0
  21. package/skills/bpmax-e2e-flow-test-operator-v2/references/browser-recording-and-replay.md +69 -0
  22. package/skills/bpmax-e2e-flow-test-operator-v2/references/form-script-generation.md +41 -0
  23. package/skills/bpmax-e2e-flow-test-operator-v2/references/identity-and-failure-routing.md +74 -0
  24. package/skills/bpmax-e2e-flow-test-operator-v2/references/multi-request-mutation.md +9 -0
  25. package/skills/bpmax-e2e-flow-test-operator-v2/references/scenario-coverage-generation.md +17 -0
  26. package/skills/bpmax-e2e-flow-test-operator-v2/references/scoped-execution.md +13 -0
  27. package/skills/bpmax-e2e-flow-test-operator-v2/references/step-restartability-and-state.md +17 -0
  28. package/skills/bpmax-e2e-flow-test-operator-v2/references/test-assets-and-evidence.md +9 -0
  29. package/skills/bpmax-e2e-flow-test-operator-v2/references/test-data-and-selector-contract.md +28 -0
  30. package/skills/bpmax-e2e-flow-test-operator-v2/references/test-preflight-and-confirmation.md +32 -0
@@ -52,6 +52,67 @@ AI_FORBIDDEN_PATTERNS = [
52
52
  r"AI[^。;\n]{0,30}自动认证",
53
53
  r"AI[^。;\n]{0,30}自动对账",
54
54
  ]
55
+ DOCUMENT_MODELING_TABLES = {
56
+ "源流程逻辑映射与完整性核对": ["源流程逻辑映射与完整性核对"],
57
+ "人工调整记录": ["人工调整记录"],
58
+ "主流程阶段划分": ["主流程阶段划分"],
59
+ "并行场景建模决策": ["并行场景建模决策"],
60
+ "审批/决策矩阵评估": ["审批/决策矩阵评估", "审批与决策矩阵评估"],
61
+ }
62
+ FLOW_DETAIL_TABLES = {
63
+ "开始节点与创建表单": ["开始节点与创建表单", "开始节点", "创建表单"],
64
+ "环节配置": ["环节配置", "节点配置"],
65
+ "表单模板": ["表单模板"],
66
+ "流程数据集": ["流程数据集", "数据集"],
67
+ "列表/筛选/详情/看板入口": ["列表/筛选/详情/看板入口", "列表", "视图入口"],
68
+ "自动化与 AI/agent": ["自动化与 AI/agent", "自动化与 AI", "自动化"],
69
+ "办结口径与下游联动": ["办结口径与下游联动", "办结口径", "下游联动"],
70
+ "BPMAX 实现边界": ["BPMAX 实现边界", "实现边界"],
71
+ }
72
+ MATRIX_ASSESSMENT_TERMS = ["蓝图规则矩阵", "正式 BPMAX 矩阵"]
73
+ MATRIX_HEADER_RULES = {
74
+ "决策范围": ["决策范围", "决策"],
75
+ "条件": ["条件", "判断条件"],
76
+ "处理人/审批人来源": ["处理人/审批人来源", "处理人来源", "审批人来源", "人员来源"],
77
+ "结果/下一步": ["结果/下一步", "结果", "下一步"],
78
+ "维护责任人": ["维护责任人", "维护角色", "维护人"],
79
+ "蓝图规则矩阵": ["蓝图规则矩阵"],
80
+ "正式 BPMAX 矩阵": ["正式 BPMAX 矩阵"],
81
+ "运行态验收": ["运行态验收", "验收"],
82
+ }
83
+ FORMAL_MATRIX_RUNTIME_TERMS = {
84
+ "矩阵应用": ["矩阵应用"],
85
+ "规则记录": ["规则记录", "矩阵规则"],
86
+ "真实用户": ["真实用户", "BPMAX 用户"],
87
+ "消费节点": ["消费节点", "使用节点", "引用节点"],
88
+ "缺失规则": ["缺失", "未命中"],
89
+ "重复规则": ["重复", "多条命中"],
90
+ "readback": ["readback", "回读"],
91
+ "owner resolve": ["owner resolve", "owner-resolve", "处理人解析", "owner 解析"],
92
+ }
93
+ NAVIGATION_SECTION_TITLES = ["PC/H5 导航设计", "多端导航设计", "导航设计"]
94
+ NAVIGATION_HEADER_RULES = {
95
+ "流程": ["流程"],
96
+ "终端": ["终端", "端"],
97
+ "目标用户": ["目标用户", "用户", "角色"],
98
+ "入口/菜单": ["入口/菜单", "入口", "菜单"],
99
+ "路由/页面": ["路由/页面", "路由", "页面"],
100
+ "可见权限": ["可见权限", "显示权限", "权限"],
101
+ "验收": ["验收", "验收方式"],
102
+ }
103
+ PERMISSION_SECTION_TITLES = ["权限设计", "权限模型", "权限与可见性设计"]
104
+ PERMISSION_HEADER_RULES = {
105
+ "流程": ["流程"],
106
+ "对象/字段": ["对象/字段", "对象", "字段"],
107
+ "环节": ["环节", "节点", "阶段"],
108
+ "用户/角色": ["用户/角色", "用户", "角色", "主体"],
109
+ "可见": ["可见", "可见性"],
110
+ "可编辑": ["可编辑", "编辑性"],
111
+ "操作权限": ["操作权限", "动作权限", "权限动作"],
112
+ "验收": ["验收", "验收方式"],
113
+ }
114
+ PERMISSION_ACTION_TERMS = ["创建", "查看", "编辑", "删除", "提交", "审批", "导航"]
115
+ PERMISSION_DENY_TERMS = ["禁止", "不可", "无权限", "隐藏", "只读", "不适用"]
55
116
 
56
117
 
57
118
  @dataclass
@@ -71,6 +132,12 @@ class FlowSection:
71
132
  missing: list[str] = field(default_factory=list)
72
133
 
73
134
 
135
+ @dataclass
136
+ class TableData:
137
+ headers: list[str]
138
+ rows: list[dict[str, str]]
139
+
140
+
74
141
  def read_content(path: Path) -> str:
75
142
  raw = path.read_text(encoding="utf-8")
76
143
  stripped = raw.lstrip()
@@ -113,19 +180,122 @@ def extract_title(xml: str) -> str:
113
180
  return plain_text(match.group(1)).strip() if match else ""
114
181
 
115
182
 
183
+ def extract_heading_sections(xml: str) -> list[tuple[int, str, str]]:
184
+ heading_re = re.compile(r"<h([1-3])[^>]*>(.*?)</h\1>", re.S)
185
+ matches = list(heading_re.finditer(xml))
186
+ sections: list[tuple[int, str, str]] = []
187
+ for index, match in enumerate(matches):
188
+ level = int(match.group(1))
189
+ title = plain_text(match.group(2)).strip()
190
+ end = len(xml)
191
+ for next_match in matches[index + 1 :]:
192
+ if int(next_match.group(1)) <= level:
193
+ end = next_match.start()
194
+ break
195
+ sections.append((level, title, xml[match.start() : end]))
196
+ return sections
197
+
198
+
199
+ def matching_sections(xml: str, title_terms: Iterable[str]) -> list[str]:
200
+ return [
201
+ content
202
+ for _, title, content in extract_heading_sections(xml)
203
+ if any(term in title for term in title_terms)
204
+ ]
205
+
206
+
207
+ def extract_tables(xml: str) -> list[TableData]:
208
+ tables: list[TableData] = []
209
+ for table_match in re.finditer(r"<table\b[^>]*>(.*?)</table>", xml, re.I | re.S):
210
+ parsed_rows: list[list[str]] = []
211
+ row_cell_tags: list[list[str]] = []
212
+ for row_match in re.finditer(r"<tr\b[^>]*>(.*?)</tr>", table_match.group(1), re.I | re.S):
213
+ cells: list[str] = []
214
+ tags: list[str] = []
215
+ for cell_match in re.finditer(r"<(th|td)\b[^>]*>(.*?)</\1>", row_match.group(1), re.I | re.S):
216
+ tags.append(cell_match.group(1).lower())
217
+ cells.append(plain_text(cell_match.group(2)).strip())
218
+ if cells:
219
+ parsed_rows.append(cells)
220
+ row_cell_tags.append(tags)
221
+ if not parsed_rows:
222
+ continue
223
+ header_index = 0
224
+ for index, tags in enumerate(row_cell_tags):
225
+ if tags and all(tag == "th" for tag in tags):
226
+ header_index = index
227
+ break
228
+ headers = parsed_rows[header_index]
229
+ rows: list[dict[str, str]] = []
230
+ for cells in parsed_rows[header_index + 1 :]:
231
+ rows.append({header: cells[index] if index < len(cells) else "" for index, header in enumerate(headers)})
232
+ tables.append(TableData(headers=headers, rows=rows))
233
+ return tables
234
+
235
+
236
+ def header_name(table: TableData, aliases: Iterable[str]) -> str | None:
237
+ for header in table.headers:
238
+ normalized = re.sub(r"\s+", "", header).lower()
239
+ for alias in aliases:
240
+ expected = re.sub(r"\s+", "", alias).lower()
241
+ if normalized == expected or expected in normalized:
242
+ return header
243
+ return None
244
+
245
+
246
+ def row_value(row: dict[str, str], table: TableData, aliases: Iterable[str]) -> str:
247
+ header = header_name(table, aliases)
248
+ return row.get(header, "").strip() if header else ""
249
+
250
+
251
+ def is_placeholder(value: str) -> bool:
252
+ normalized = value.strip().strip("<>")
253
+ return normalized in {"", "-", "待填写", "待确认", "待补充", "未知"}
254
+
255
+
256
+ def flow_business_name(title: str) -> str:
257
+ parts = re.split(r"[::]", title, maxsplit=1)
258
+ return parts[1].strip() if len(parts) > 1 else title.strip()
259
+
260
+
261
+ def row_mentions_flow(row: dict[str, str], table: TableData, flow: FlowSection) -> bool:
262
+ flow_value = row_value(row, table, ["流程"])
263
+ return flow.title in flow_value or flow_business_name(flow.title) in flow_value
264
+
265
+
266
+ def require_table_headers(
267
+ findings: list[Finding],
268
+ table: TableData,
269
+ rules: dict[str, list[str]],
270
+ code: str,
271
+ label: str,
272
+ ) -> bool:
273
+ ok = True
274
+ for required, aliases in rules.items():
275
+ if header_name(table, aliases) is None:
276
+ add_error(findings, code, f"{label} table is missing required header: {required}")
277
+ ok = False
278
+ return ok
279
+
280
+
116
281
  def extract_flows(xml: str) -> list[FlowSection]:
117
282
  heading_re = re.compile(r"<h([1-3])[^>]*>(.*?)</h\1>", re.S)
118
283
  matches = list(heading_re.finditer(xml))
119
- flow_matches = []
120
- for match in matches:
284
+ flow_matches: list[tuple[int, re.Match[str], str]] = []
285
+ for match_index, match in enumerate(matches):
121
286
  title = plain_text(match.group(2)).strip()
122
287
  if re.search(r"流程[一二三四五六七八九十\d]+[::]", title):
123
- flow_matches.append((match, title))
288
+ flow_matches.append((match_index, match, title))
124
289
 
125
290
  flows = []
126
- for index, (match, title) in enumerate(flow_matches):
291
+ for match_index, match, title in flow_matches:
127
292
  start = match.start()
128
- end = flow_matches[index + 1][0].start() if index + 1 < len(flow_matches) else len(xml)
293
+ level = int(match.group(1))
294
+ end = len(xml)
295
+ for next_match in matches[match_index + 1 :]:
296
+ if int(next_match.group(1)) <= level:
297
+ end = next_match.start()
298
+ break
129
299
  content = xml[start:end]
130
300
  flows.append(
131
301
  FlowSection(
@@ -142,6 +312,161 @@ def add_error(findings: list[Finding], code: str, message: str, flow: str | None
142
312
  findings.append(Finding("error", code, message, flow))
143
313
 
144
314
 
315
+ def validate_matrix_design(findings: list[Finding], sections: list[str]) -> None:
316
+ if not sections:
317
+ return
318
+ tables = extract_tables(" ".join(sections))
319
+ if not tables:
320
+ return
321
+ table = tables[0]
322
+ if not require_table_headers(
323
+ findings,
324
+ table,
325
+ MATRIX_HEADER_RULES,
326
+ "DOC_MATRIX_HEADER_MISSING",
327
+ "Approval/decision matrix assessment",
328
+ ):
329
+ return
330
+ if not table.rows:
331
+ add_error(findings, "DOC_MATRIX_ROW_MISSING", "Approval/decision matrix assessment requires at least one rule row.")
332
+ return
333
+ section_text = plain_text(" ".join(sections))
334
+ for row_index, row in enumerate(table.rows, start=1):
335
+ for required, aliases in MATRIX_HEADER_RULES.items():
336
+ if is_placeholder(row_value(row, table, aliases)):
337
+ add_error(
338
+ findings,
339
+ "DOC_MATRIX_VALUE_MISSING",
340
+ f"Approval/decision matrix row {row_index} has no concrete value for: {required}",
341
+ )
342
+ formal_value = row_value(row, table, MATRIX_HEADER_RULES["正式 BPMAX 矩阵"])
343
+ formal_selected = bool(formal_value) and not re.search(r"不采用|不使用|不需要|否|无|不适用", formal_value)
344
+ if formal_selected:
345
+ for label, terms in FORMAL_MATRIX_RUNTIME_TERMS.items():
346
+ if not has_any(section_text, terms):
347
+ add_error(
348
+ findings,
349
+ "DOC_FORMAL_MATRIX_LIFECYCLE_MISSING",
350
+ f"Formal BPMAX matrix design is missing runtime lifecycle detail: {label}",
351
+ )
352
+
353
+
354
+ def validate_navigation_design(findings: list[Finding], xml: str, flows: list[FlowSection]) -> None:
355
+ sections = matching_sections(xml, NAVIGATION_SECTION_TITLES)
356
+ if not sections:
357
+ add_error(findings, "DOC_NAVIGATION_DESIGN_MISSING", "Missing required PC/H5 navigation design section.")
358
+ return
359
+ tables = extract_tables(" ".join(sections))
360
+ if not tables:
361
+ add_error(findings, "DOC_NAVIGATION_TABLE_MISSING", "PC/H5 navigation design must be presented as a table.")
362
+ return
363
+ table = tables[0]
364
+ if not require_table_headers(
365
+ findings,
366
+ table,
367
+ NAVIGATION_HEADER_RULES,
368
+ "DOC_NAVIGATION_HEADER_MISSING",
369
+ "PC/H5 navigation design",
370
+ ):
371
+ return
372
+ if not table.rows:
373
+ add_error(findings, "DOC_NAVIGATION_ROW_MISSING", "PC/H5 navigation design requires at least one row.")
374
+ return
375
+ for row_index, row in enumerate(table.rows, start=1):
376
+ terminal = row_value(row, table, NAVIGATION_HEADER_RULES["终端"])
377
+ if "PC" in terminal.upper() and "H5" in terminal.upper():
378
+ add_error(
379
+ findings,
380
+ "DOC_NAVIGATION_TERMINAL_COMBINED",
381
+ f"Navigation row {row_index} combines PC and H5; design them as separate rows.",
382
+ )
383
+ for required, aliases in NAVIGATION_HEADER_RULES.items():
384
+ if is_placeholder(row_value(row, table, aliases)):
385
+ add_error(
386
+ findings,
387
+ "DOC_NAVIGATION_VALUE_MISSING",
388
+ f"Navigation row {row_index} has no concrete value for: {required}",
389
+ )
390
+ for flow in flows:
391
+ rows = [row for row in table.rows if row_mentions_flow(row, table, flow)]
392
+ if not rows:
393
+ add_error(
394
+ findings,
395
+ "FLOW_NAVIGATION_COVERAGE_MISSING",
396
+ "Navigation design has no row for this flow.",
397
+ flow.title,
398
+ )
399
+ continue
400
+ terminals = [row_value(row, table, NAVIGATION_HEADER_RULES["终端"]).upper() for row in rows]
401
+ if not any("PC" in terminal and "H5" not in terminal for terminal in terminals):
402
+ add_error(findings, "FLOW_PC_NAVIGATION_MISSING", "Flow has no independent PC navigation design.", flow.title)
403
+ if not any("H5" in terminal and "PC" not in terminal for terminal in terminals):
404
+ add_error(findings, "FLOW_H5_NAVIGATION_MISSING", "Flow has no independent H5 navigation design or explicit H5 non-applicability row.", flow.title)
405
+
406
+
407
+ def validate_permission_design(findings: list[Finding], xml: str, flows: list[FlowSection]) -> None:
408
+ sections = matching_sections(xml, PERMISSION_SECTION_TITLES)
409
+ if not sections:
410
+ add_error(findings, "DOC_PERMISSION_DESIGN_MISSING", "Missing required permission design section.")
411
+ return
412
+ tables = extract_tables(" ".join(sections))
413
+ if not tables:
414
+ add_error(findings, "DOC_PERMISSION_TABLE_MISSING", "Permission design must be presented as a table.")
415
+ return
416
+ table = tables[0]
417
+ if not require_table_headers(
418
+ findings,
419
+ table,
420
+ PERMISSION_HEADER_RULES,
421
+ "DOC_PERMISSION_HEADER_MISSING",
422
+ "Permission design",
423
+ ):
424
+ return
425
+ if not table.rows:
426
+ add_error(findings, "DOC_PERMISSION_ROW_MISSING", "Permission design requires at least one row.")
427
+ return
428
+ for row_index, row in enumerate(table.rows, start=1):
429
+ for required, aliases in PERMISSION_HEADER_RULES.items():
430
+ if is_placeholder(row_value(row, table, aliases)):
431
+ add_error(
432
+ findings,
433
+ "DOC_PERMISSION_VALUE_MISSING",
434
+ f"Permission row {row_index} has no concrete value for: {required}",
435
+ )
436
+ for flow in flows:
437
+ rows = [row for row in table.rows if row_mentions_flow(row, table, flow)]
438
+ if not rows:
439
+ add_error(findings, "FLOW_PERMISSION_COVERAGE_MISSING", "Permission design has no row for this flow.", flow.title)
440
+ continue
441
+ row_text = plain_text(" ".join(" ".join(row.values()) for row in rows))
442
+ action_text = " ".join(
443
+ row_value(row, table, PERMISSION_HEADER_RULES["操作权限"])
444
+ for row in rows
445
+ )
446
+ for action in PERMISSION_ACTION_TERMS:
447
+ if action not in action_text:
448
+ add_error(
449
+ findings,
450
+ "FLOW_PERMISSION_ACTION_MISSING",
451
+ f"Permission design does not explicitly cover action: {action}",
452
+ flow.title,
453
+ )
454
+ if "字段" not in row_text:
455
+ add_error(
456
+ findings,
457
+ "FLOW_FIELD_PERMISSION_MISSING",
458
+ "Permission design does not include field visibility/editability for this flow.",
459
+ flow.title,
460
+ )
461
+ if not has_any(row_text, PERMISSION_DENY_TERMS):
462
+ add_error(
463
+ findings,
464
+ "FLOW_PERMISSION_DENY_BOUNDARY_MISSING",
465
+ "Permission design does not state the denied or read-only behavior for unauthorized users.",
466
+ flow.title,
467
+ )
468
+
469
+
145
470
  def lint(xml: str, require_terms: list[str], forbid_terms: list[str]) -> tuple[list[Finding], list[FlowSection]]:
146
471
  findings: list[Finding] = []
147
472
  text = plain_text(xml)
@@ -170,9 +495,45 @@ def lint(xml: str, require_terms: list[str], forbid_terms: list[str]) -> tuple[l
170
495
  if re.search(r"<pre[^>]*lang=[\"']mermaid[\"']", xml, re.I):
171
496
  add_error(findings, "MERMAID_CODE_BLOCK", "Final blueprint must use whiteboard blocks, not Mermaid code blocks.")
172
497
 
498
+ first_flow_start: int | None = None
499
+ for _, title, section in extract_heading_sections(xml):
500
+ if re.search(r"流程[一二三四五六七八九十\d]+[::]", title):
501
+ first_flow_start = xml.find(section)
502
+ break
503
+ document_design = xml[:first_flow_start] if first_flow_start is not None else xml
504
+
505
+ for label, title_terms in DOCUMENT_MODELING_TABLES.items():
506
+ sections = matching_sections(document_design, title_terms)
507
+ if not sections:
508
+ add_error(
509
+ findings,
510
+ "DOC_MODELING_REVIEW_MISSING",
511
+ f"Missing required blueprint modeling review section: {label}",
512
+ )
513
+ continue
514
+ if not any(re.search(r"<table\b", section, re.I) for section in sections):
515
+ add_error(
516
+ findings,
517
+ "DOC_MODELING_TABLE_MISSING",
518
+ f"Blueprint modeling review must be presented as a table: {label}",
519
+ )
520
+
521
+ matrix_sections = matching_sections(document_design, DOCUMENT_MODELING_TABLES["审批/决策矩阵评估"])
522
+ matrix_text = plain_text(" ".join(matrix_sections))
523
+ for term in MATRIX_ASSESSMENT_TERMS:
524
+ if matrix_sections and term not in matrix_text:
525
+ add_error(
526
+ findings,
527
+ "DOC_MATRIX_BOUNDARY_MISSING",
528
+ f"Approval/decision matrix assessment must distinguish: {term}",
529
+ )
530
+ validate_matrix_design(findings, matrix_sections)
531
+
173
532
  flows = extract_flows(xml)
174
533
  if not flows:
175
534
  add_error(findings, "FLOW_SECTION_MISSING", "No flow sections matching 流程X: were found.")
535
+ validate_navigation_design(findings, xml, flows)
536
+ validate_permission_design(findings, xml, flows)
176
537
 
177
538
  for flow in flows:
178
539
  flow_text = plain_text(flow.content)
@@ -188,6 +549,26 @@ def lint(xml: str, require_terms: list[str], forbid_terms: list[str]) -> tuple[l
188
549
  add_error(findings, "FLOW_REQUIRED_CONTENT_MISSING", f"Missing per-flow content: {label}", flow.title)
189
550
  flow.missing.append(label)
190
551
 
552
+ for label, title_terms in FLOW_DETAIL_TABLES.items():
553
+ sections = matching_sections(flow.content, title_terms)
554
+ if not sections:
555
+ add_error(
556
+ findings,
557
+ "FLOW_DETAIL_SECTION_MISSING",
558
+ f"Missing per-flow detail section required for tabular implementation: {label}",
559
+ flow.title,
560
+ )
561
+ flow.missing.append(f"{label} section")
562
+ continue
563
+ if not any(re.search(r"<table\b", section, re.I) for section in sections):
564
+ add_error(
565
+ findings,
566
+ "FLOW_DETAIL_TABLE_MISSING",
567
+ f"Per-flow implementation detail must be presented as a table: {label}",
568
+ flow.title,
569
+ )
570
+ flow.missing.append(f"{label} table")
571
+
191
572
  if "AI" in flow_text or "agent" in flow_text or "Agent" in flow_text:
192
573
  for term in AI_REQUIRED_TERMS:
193
574
  if term not in flow_text:
@@ -0,0 +1,56 @@
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. 输出测试用例预检:可复用用例、计划范围、失效或缺失步骤、排除项与资产动作。
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;同一范围不重复确认。
17
+ 7. 正式执行中的页面导航、读取、截图、输入、点击、提交、审批、登录、身份切换和验证必须由已审查 automation 脚本执行。表单步骤必须先按最新版表单生成表单契约并覆盖全部必填字段;数据和选择器按 `references/test-data-and-selector-contract.md` 绑定。优先使用本轮有效 Cookie/storage state 或目标 CDP context;Playwright 认证探测失败时停止并要求用户复制完整 Cookie,认证成功前不得开始业务步骤。读取 `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
+ - 可使用 Chrome 插件发现已登录会话,并将与当前 profile 匹配的认证数据交接给 Playwright context;具体规则见身份 reference。
26
+ - 不得使用 `runner=browser`;正式页面步骤必须使用已审查的 `browser_action` automation。
27
+ - 不得用 raw API、控制台请求或修改请求体替代页面路径。
28
+ - `--diagnostic` 仅可用于非页面的配置、接口或日志诊断;不得生成页面结论或正式通过证据。
29
+ - 不得从“继续”“看一下”“可以”等模糊回复推断用户已确认执行;必须收到明确的范围确认。
30
+ - 不得在聊天输出、测试报告、截图证据或完整环境变量转储中暴露 Cookie、token 或 Authorization;认证数据可以在 Chrome 与 Playwright 之间受控交接。
31
+ - 用户发送 Cookie 后不得复述、引用或写入 memory、automation、manifest、报告和 Git 文件;只允许写入权限为 `0600` 的本轮临时认证文件,并在测试收口时清理。
32
+ - 不得按浏览器标签页顺序选择页面,也不得将遗留 `/login` 页面当作业务页面;登录 bootstrap 失败时必须 `blocked`,不得创建或重试业务数据。
33
+ - 不得假定 `browser.contexts()[0]` 是认证 context,也不得仅按候选 URL 判定登录有效;认证 context 不唯一或导入后认证探测失败时必须在业务动作前阻断。
34
+ - 不得因为 Chrome 插件看到了已登录页面,就假定指定 CDP endpoint 属于同一浏览器进程;必须以 Playwright 对目标 route 的认证探测为准。
35
+ - 身份操作必须绑定实际执行页面动作的浏览器:录制阶段在 Chrome Control 当前录制标签页 mock/unmock;回放和正式运行阶段在对应 Playwright context 中 mock/unmock。Playwright 未登录时必须打开有界的非 headless 登录窗口,认证回读通过后才能继续。
36
+ - 既有 case 不足或与配置不一致时,默认建立最小隔离 draft 场景;只有用户明确要求,才修改共享主场景。
37
+
38
+ ## 结论边界
39
+ - `pass`:确认范围内的每个必需步骤都由本轮脚本完成,当前 run 证据和业务断言完整;若只覆盖部分 active case,场景级结论只能是 `partial`。
40
+ - `partial`:仅执行 selected cases 或未覆盖完整场景。UX findings 独立报告,不改变已证明的业务步骤结论。
41
+ - `blocked`:确认前、环境/权限阻塞、脚本未审查、证据或写入状态无法确认。每次必须输出已完成边界、解除条件、下一责任方和一条可直接继续对话的提示词;具体格式见身份 reference。
42
+
43
+ ## Reference 路由
44
+ - 预检内容、确认语句与状态机:`references/test-preflight-and-confirmation.md`
45
+ - selected case、隔离场景与 scoped run:`references/scoped-execution.md`
46
+ - automation 编译、原子提交、修复与续跑:`references/browser-action-runner.md`
47
+ - 表单契约、必填字段覆盖和批量脚本熔断:`references/form-script-generation.md`
48
+ - 业务场景覆盖矩阵与 PC/H5 建模:`references/scenario-coverage-generation.md`
49
+ - 多来源生成、canonicalization 与 publishability:`references/automation-generation-pipeline.md`
50
+ - 真实浏览器录制、录制报告和独立回放:`references/browser-recording-and-replay.md`
51
+ - 本轮数据、fixture 与 selector 主数据契约:`references/test-data-and-selector-contract.md`
52
+ - 独立步骤重建、上下文提取和断点状态:`references/step-restartability-and-state.md`
53
+ - 单次交互的主写入与伴随写入:`references/multi-request-mutation.md`
54
+ - 多流程批量生成、隔离 lint/review/promote 与熔断:`references/batch-generation-and-execution.md`
55
+ - 用例资产、逐步骤证据、报告与重跑:`references/test-assets-and-evidence.md`
56
+ - 身份桥、环境证据、失败归因与 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,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,15 @@
1
+ # Browser Action Runner
2
+
3
+ 所有页面动作由已审查的 `browser_action` automation 一次执行。正常路径使用 scenario runner,而非 Agent 逐按钮操作。
4
+
5
+ runner 的认证和身份状态属于当前执行 context。回放或正式运行没有有效登录态时,runner 必须打开非 headless Playwright 窗口并等待用户完成登录;认证探测必须确认目标工作区页面未跳转登录页且当前用户回读有效,之后才能开始业务动作。登录等待必须有超时,超时后 `blocked`,不得创建业务数据。
6
+
7
+ 回放和正式运行中的 `identity` 步骤由 scenario runner 在同一套 Playwright 会话配置中执行。mock 后的业务步骤以及 unmock 都必须使用该 run 的 Playwright profile/storage state;不得调用 Chrome Control 身份桥替代正式执行,也不得把另一个浏览器中的 mock 结果作为当前 Playwright 身份证据。
8
+
9
+ 涉及表单填写时,先按 `form-script-generation.md` 生成并审查表单契约;automation 结构正确但必填字段覆盖不完整,同样不得 compile、review 或 promote。
10
+
11
+ 新建或修复脚本时按 `browser-recording-and-replay.md` 完成录制、候选生成和独立回放;reusable automation 直接进入新的 scoped run。页面漂移、控件不支持或执行异常时,暂停当前 run;修复 draft automation,重新编译和 review,生成 repair receipt 后从受控 checkpoint 续跑。不得手工编辑 manifest、运行时 automation 或重放已确认 mutation。
12
+
13
+ checkpoint 使用 `status/prepare/complete/resolve` 管理录制或执行中断。mutation 在 prepare 后中断时必须先 resolve committed/not_committed,普通动作才允许从 checkpoint 继续。
14
+
15
+ 每个远端 mutation 必须是单一步骤、在动作前完成证据目录预检,并具备 committed/not_committed 两套回读检查。写入状态不确定时必须先 resolve,不能重试提交。
@@ -0,0 +1,69 @@
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
+ 录制阶段需要模拟身份时,`status/mock/unmock` 必须在 Chrome Control 当前录制标签页中完成。身份截图、回读和后续录制动作必须来自同一个标签页;不得在另一个 Chrome 标签页或 Playwright context 中切换身份后,继续把当前录制页当作已切换。
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
+ 1. 使用 `Chrome` 插件打开与 profile、workspace 和目标终端一致的真实页面。
30
+ 2. 每次操作前读取最新页面快照,由 LLM 执行一个明确动作;操作后保存新的快照或截图以及即时结果。
31
+ 3. Agent 将本轮 Chrome 操作依次规范化写入 `browser-action-trace.json`,并声明 `capture_method=chrome_plugin`;不得从 Record & Replay 事件转换。
32
+ 4. CLI 首先生成 `browser-recording-report.json`。
33
+ 5. 报告通过结构与哈希检查后,才生成 review-required automation candidate。
34
+ 6. 将候选映射到 canonical compile input,不直接写正式 `automation.json`。
35
+ 7. 在新的 Playwright browser context 中独立回放候选,不复用录制页面状态。
36
+ 回放包含身份步骤时,mock/unmock 必须在该 Playwright context 的认证会话中执行,并在同一 context 回读精确用户身份。
37
+ 8. 回放失败时根据本轮证据修复 draft 脚本,再从步骤起点回放;不得手改 manifest 或任何哈希。
38
+ 9. 独立回放稳定后,才进入 scoped lint、多视角 review、最终确认和 promote。
39
+
40
+ ## 录制报告
41
+
42
+ 报告必须至少记录:
43
+
44
+ - `kind=bpmax_e2e_browser_recording_report`
45
+ - `result=recording_only`
46
+ - `formal_conclusion=false`
47
+ - `capture_method=chrome_plugin`
48
+ - scenario、case 和 case step
49
+ - trace 路径及 SHA-256
50
+ - 页面指纹、动作数、断言数
51
+ - 截图、DOM 和网络摘要清单
52
+ - 是否包含 mutation
53
+ - 未解决项和下一步
54
+
55
+ 新候选应绑定报告和 trace,便于 review;这些 provenance 缺口输出 warning,不得使结构、资产哈希和安全门禁均有效的 legacy automation 失效。
56
+
57
+ `browser-action-trace.json` 由 Agent 根据 Chrome 插件调用顺序生成,至少包含页面指纹、规范化动作、即时断言和 `capture_method=chrome_plugin`。Chrome 返回的临时 element id 不能直接成为正式 selector;必须转换为稳定字段名、标签、角色、文本或测试标识。
58
+
59
+ ## 回放要求
60
+
61
+ 录制不能验证自己。独立回放必须:
62
+
63
+ - 使用新 browser context 或已清理且可证明独立的 context。
64
+ - 从步骤声明的前置状态开始,不继承录制后的业务页面或内存状态。
65
+ - 使用新的唯一测试数据;mutation 结果按 committed/not_committed 规则回读。
66
+ - 保存回放自己的截图、DOM、trace 和断言结果。
67
+ - 失败时只修复 draft automation,再重新 lint 和回放。
68
+
69
+ 只有独立回放通过,候选脚本才能标记为可 review。正式运行仍需创建新的 scoped run,并生成另一套本轮证据。