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.
- package/README.md +30 -7
- package/dist/bin.js +45185 -12834
- package/dist/bin.js.map +1 -1
- package/package.json +12 -5
- package/scripts/install-skills.mjs +27 -60
- package/scripts/run-source-cli.mjs +145 -0
- package/skills/bpmax-ai-taskbook/SKILL.md +17 -1
- package/skills/bpmax-ai-taskbook/references/blueprint-taskbook-gates.md +141 -0
- package/skills/bpmax-ai-taskbook/references/taskbook-template.md +43 -3
- package/skills/bpmax-api-platform-editor/SKILL.md +24 -31
- package/skills/bpmax-api-platform-editor/agents/openai.yaml +2 -2
- package/skills/bpmax-api-platform-editor/references/platform-api-map.md +2 -2
- package/skills/bpmax-api-platform-editor/references/runtime-workflow.md +3 -3
- package/skills/bpmax-approval-matrix/SKILL.md +54 -2
- package/skills/bpmax-blueprint-doc-workflow/SKILL.md +38 -5
- package/skills/bpmax-blueprint-doc-workflow/references/blueprint-structure.md +24 -8
- package/skills/bpmax-blueprint-doc-workflow/references/business-language.md +74 -0
- package/skills/bpmax-blueprint-doc-workflow/references/per-flow-required-structure.md +13 -0
- package/skills/bpmax-blueprint-doc-workflow/references/review-and-confirmation-dialogue.md +70 -0
- package/skills/bpmax-blueprint-doc-workflow/references/sample-missing-modeling-review.xml +23 -0
- package/skills/bpmax-blueprint-doc-workflow/references/sample-missing-review-record.xml +72 -0
- package/skills/bpmax-blueprint-doc-workflow/references/sample-paragraph-flow-details.xml +27 -0
- package/skills/bpmax-blueprint-doc-workflow/references/sample-pass.xml +59 -35
- package/skills/bpmax-blueprint-doc-workflow/references/sample-system-identifier.xml +79 -0
- package/skills/bpmax-blueprint-doc-workflow/references/source-traceability-and-flow-modeling.md +115 -0
- package/skills/bpmax-blueprint-doc-workflow/scripts/lint_blueprint_doc.py +586 -5
- package/skills/bpmax-bug-reporting/SKILL.md +72 -0
- package/skills/bpmax-builder-shared/SKILL.md +1 -0
- package/skills/bpmax-builder-shared/configuration-impact-review.md +76 -0
- package/skills/bpmax-builder-shared/template_script_hard_rules.py +3 -1
- package/skills/bpmax-builder-shared/tests/test_template_script_hard_rules.py +16 -0
- package/skills/bpmax-business-skill/SKILL.md +3 -1
- package/skills/bpmax-cli/SKILL.md +46 -0
- package/skills/bpmax-config-latest/SKILL.md +4 -0
- package/skills/bpmax-console-template-editor/SKILL.md +113 -523
- package/skills/bpmax-console-template-editor/agents/openai.yaml +2 -2
- package/skills/bpmax-console-template-editor/references/full-detail-guide.md +45 -0
- package/skills/bpmax-console-template-editor/references/local-temp-workflow.md +13 -12
- package/skills/bpmax-console-template-editor/scripts/console_template_editor_common.py +299 -78
- package/skills/bpmax-console-template-editor/tests/test_console_template_editor.py +344 -30
- package/skills/bpmax-dataset-field-template-editor/SKILL.md +131 -594
- package/skills/bpmax-dataset-field-template-editor/references/full-detail-guide.md +570 -0
- package/skills/bpmax-dataset-field-template-editor/references/nested-field-patterns.md +8 -8
- package/skills/bpmax-dataset-field-template-editor/references/runtime-verified-field-page-shape.md +1 -1
- package/skills/bpmax-dataset-field-template-editor/scripts/dataset_field_editor_common.py +11 -77
- package/skills/bpmax-dataset-field-template-editor/scripts/export_dataset_field.py +4 -57
- package/skills/bpmax-dataset-field-template-editor/scripts/init_create_dataset_field.py +2 -0
- package/skills/bpmax-dataset-field-template-editor/scripts/inspect_dataset_field_runtime.py +4 -78
- package/skills/bpmax-dataset-field-template-editor/scripts/submit_dataset_field.py +3 -89
- package/skills/bpmax-dataset-field-template-editor/tests/test_dataset_field_editor.py +14 -0
- package/skills/bpmax-dataset-field-template-editor/tests/test_init_create_dataset_field.py +2 -0
- package/skills/bpmax-dataset-template-editor/SKILL.md +123 -778
- package/skills/bpmax-dataset-template-editor/references/dataset-script-runtime-matrix.md +11 -0
- package/skills/bpmax-dataset-template-editor/references/full-detail-guide.md +753 -0
- package/skills/bpmax-dataset-template-editor/references/runtime-gotchas.md +12 -0
- package/skills/bpmax-dataset-template-editor/references/ui-to-backend-field-map.md +1 -0
- package/skills/bpmax-dataset-template-editor/references/work-file-to-submit-mapping.md +2 -2
- package/skills/bpmax-dataset-template-editor/scripts/basic_table_audit.py +8 -1
- package/skills/bpmax-dataset-template-editor/scripts/dataset_editor_common.py +9 -90
- package/skills/bpmax-dataset-template-editor/scripts/export_dataset.py +8 -1
- package/skills/bpmax-dataset-template-editor/scripts/resolve_dataset.py +8 -1
- package/skills/bpmax-dataset-template-editor/scripts/submit_dataset.py +1 -2
- package/skills/bpmax-dataset-template-editor/scripts/verify_dataset_list.py +8 -1
- package/skills/bpmax-dataset-template-editor/scripts/verify_publish_health.py +8 -1
- package/skills/bpmax-dataset-template-editor/tests/test_dataset_editor.py +6 -40
- package/skills/bpmax-e2e-flow-config-orchestrator/SKILL.md +18 -4
- package/skills/bpmax-e2e-flow-config-orchestrator/agents/openai.yaml +2 -2
- package/skills/bpmax-e2e-flow-config-orchestrator/references/orchestration-matrix.md +13 -9
- package/skills/bpmax-e2e-flow-test-operator/SKILL.md +174 -546
- package/skills/bpmax-e2e-flow-test-operator/agents/openai.yaml +2 -3
- package/skills/bpmax-e2e-flow-test-operator/references/ai-test-suite.md +181 -15
- package/skills/bpmax-e2e-flow-test-operator/references/browser-action-dsl.md +169 -0
- package/skills/bpmax-e2e-flow-test-operator/references/browser-only-checkpoints.md +15 -7
- package/skills/bpmax-e2e-flow-test-operator/references/full-detail-guide.md +589 -0
- package/skills/bpmax-e2e-flow-test-operator/references/minimal-test-loop.md +12 -8
- package/skills/bpmax-e2e-flow-test-operator/references/negative-sale-api-matrix.md +4 -4
- package/skills/bpmax-e2e-flow-test-operator/references/profile-schema.md +1 -1
- package/skills/bpmax-e2e-flow-test-operator/references/state-schema.md +3 -1
- package/skills/bpmax-e2e-flow-test-operator/scripts/e2e_doc.py +7 -5
- package/skills/bpmax-e2e-flow-test-operator/scripts/e2e_state.py +2 -2
- package/skills/bpmax-e2e-flow-test-operator/scripts/flow_runner.py +5 -1
- package/skills/bpmax-e2e-flow-test-operator/tests/test_negative_sale_api_tools.py +71 -0
- package/skills/bpmax-e2e-flow-test-operator-v2/SKILL.md +64 -0
- package/skills/bpmax-e2e-flow-test-operator-v2/agents/openai.yaml +7 -0
- package/skills/bpmax-e2e-flow-test-operator-v2/references/automation-generation-pipeline.md +33 -0
- package/skills/bpmax-e2e-flow-test-operator-v2/references/autonomous-execution.md +40 -0
- package/skills/bpmax-e2e-flow-test-operator-v2/references/batch-generation-and-execution.md +17 -0
- package/skills/bpmax-e2e-flow-test-operator-v2/references/browser-action-runner.md +19 -0
- package/skills/bpmax-e2e-flow-test-operator-v2/references/browser-recording-and-replay.md +95 -0
- package/skills/bpmax-e2e-flow-test-operator-v2/references/form-script-generation.md +41 -0
- package/skills/bpmax-e2e-flow-test-operator-v2/references/identity-and-failure-routing.md +92 -0
- package/skills/bpmax-e2e-flow-test-operator-v2/references/multi-request-mutation.md +9 -0
- package/skills/bpmax-e2e-flow-test-operator-v2/references/scenario-coverage-generation.md +17 -0
- package/skills/bpmax-e2e-flow-test-operator-v2/references/scoped-execution.md +13 -0
- package/skills/bpmax-e2e-flow-test-operator-v2/references/step-restartability-and-state.md +23 -0
- package/skills/bpmax-e2e-flow-test-operator-v2/references/test-assets-and-evidence.md +9 -0
- package/skills/bpmax-e2e-flow-test-operator-v2/references/test-data-and-selector-contract.md +51 -0
- package/skills/bpmax-e2e-flow-test-operator-v2/references/test-preflight-and-confirmation.md +32 -0
- package/skills/bpmax-filter-template-editor/SKILL.md +114 -551
- package/skills/bpmax-filter-template-editor/references/experience-coverage-matrix.md +18 -18
- package/skills/bpmax-filter-template-editor/references/filter-content-schema.md +21 -0
- package/skills/bpmax-filter-template-editor/references/filter-request-shape.md +29 -26
- package/skills/bpmax-filter-template-editor/references/filter-runtime-patterns.md +19 -2
- package/skills/bpmax-filter-template-editor/references/full-detail-guide.md +56 -0
- package/skills/bpmax-filter-template-editor/references/runtime-verified-filter-page-shape.md +10 -9
- package/skills/bpmax-filter-template-editor/scripts/filter_template_editor_common.py +7 -57
- package/skills/bpmax-filter-template-editor/tests/test_filter_template_editor.py +4 -48
- package/skills/bpmax-flow/SKILL.md +2 -0
- package/skills/bpmax-flow-detail-template-editor/SKILL.md +53 -0
- package/skills/bpmax-flow-template-editor/SKILL.md +132 -1137
- package/skills/bpmax-flow-template-editor/agents/openai.yaml +2 -2
- package/skills/bpmax-flow-template-editor/references/diff-strategy.md +3 -3
- package/skills/bpmax-flow-template-editor/references/editor-runtime-vs-draft.md +9 -9
- package/skills/bpmax-flow-template-editor/references/flow-template-api-workflow.md +2 -1
- package/skills/bpmax-flow-template-editor/references/full-detail-guide.md +1162 -0
- package/skills/bpmax-flow-template-editor/references/local-temp-workflow.md +1 -1
- package/skills/bpmax-flow-template-editor/references/message-card-professional-standard.md +234 -0
- package/skills/bpmax-flow-template-editor/references/payload-checklist.md +2 -0
- package/skills/bpmax-flow-template-editor/references/project-create-runtime-gotchas.md +17 -0
- package/skills/bpmax-flow-template-editor/references/requirement-to-node-mapping.md +8 -3
- package/skills/bpmax-flow-template-editor/references/runtime-verified-flow-detail-shape.md +7 -7
- package/skills/bpmax-flow-template-editor/references/runtime-verified-meta-fields.md +2 -2
- package/skills/bpmax-flow-template-editor/references/runtime-verified-node-fields.md +12 -2
- package/skills/bpmax-flow-template-editor/references/save-draft-request-shape.md +7 -23
- package/skills/bpmax-flow-template-editor/references/script-review-hard-rules.md +17 -0
- package/skills/bpmax-flow-template-editor/references/work-file-to-submit-mapping.md +1 -1
- package/skills/bpmax-flow-template-editor/tests/test_flow_template_editor.py +19 -75
- package/skills/bpmax-form-template-editor/SKILL.md +138 -1151
- package/skills/bpmax-form-template-editor/agents/openai.yaml +2 -2
- package/skills/bpmax-form-template-editor/references/dynamic-field-state.md +167 -0
- package/skills/bpmax-form-template-editor/references/form-template-api-workflow.md +51 -51
- package/skills/bpmax-form-template-editor/references/full-detail-guide.md +1115 -0
- package/skills/bpmax-form-template-editor/references/local-temp-workflow.md +4 -4
- package/skills/bpmax-form-template-editor/references/payload-checklist.md +3 -1
- package/skills/bpmax-form-template-editor/references/sub-form-patterns.md +6 -0
- package/skills/bpmax-form-template-editor/scripts/form_template_editor_common.py +8 -0
- package/skills/bpmax-form-template-editor/tests/test_form_template_editor.py +42 -19
- package/skills/bpmax-functional-test-design/LICENSE.upstream +24 -0
- package/skills/bpmax-functional-test-design/SKILL.md +80 -0
- package/skills/bpmax-functional-test-design/agents/openai.yaml +4 -0
- package/skills/bpmax-functional-test-design/references/bpmax-test-suite-output.md +95 -0
- package/skills/bpmax-functional-test-design/references/decision-table-testing.md +50 -0
- package/skills/bpmax-functional-test-design/references/domain-testing.md +43 -0
- package/skills/bpmax-functional-test-design/references/state-transition-testing.md +47 -0
- package/skills/bpmax-functional-test-design/references/technique-selection.md +38 -0
- package/skills/bpmax-functional-test-design/references/use-case-testing.md +55 -0
- package/skills/bpmax-group-model-editor/SKILL.md +24 -0
- package/skills/bpmax-home-portal-editor/SKILL.md +81 -0
- 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 +133 -466
- package/skills/bpmax-list-template-editor/agents/openai.yaml +2 -2
- package/skills/bpmax-list-template-editor/references/content-config-shape.md +16 -4
- package/skills/bpmax-list-template-editor/references/full-detail-guide.md +461 -0
- package/skills/bpmax-list-template-editor/references/list-template-api-workflow.md +6 -9
- package/skills/bpmax-list-template-editor/references/local-temp-workflow.md +1 -1
- package/skills/bpmax-list-template-editor/references/runtime-verified-workflow.md +50 -2
- package/skills/bpmax-list-template-editor/references/special-formats.md +5 -2
- package/skills/bpmax-list-template-editor/scripts/list_template_editor_common.py +9 -78
- package/skills/bpmax-memory-protocol/SKILL.md +7 -6
- package/skills/bpmax-nav-config-editor/SKILL.md +14 -17
- package/skills/bpmax-nav-config-editor/agents/openai.yaml +2 -2
- package/skills/bpmax-nav-config-editor/references/api-workflow.md +2 -2
- package/skills/bpmax-nav-config-editor/references/runtime-probing.md +11 -12
- package/skills/bpmax-page-composition-template-editor/SKILL.md +398 -0
- package/skills/bpmax-page-composition-template-editor/examples/presets/catalog.json +41 -0
- package/skills/bpmax-page-composition-template-editor/examples/presets/full-capability-workbench.json +294 -0
- package/skills/bpmax-page-composition-template-editor/examples/presets/project-detail-step-panel.json +184 -0
- package/skills/bpmax-page-composition-template-editor/examples/presets/project-list-quick-process.json +177 -0
- package/skills/bpmax-page-composition-template-editor/examples/presets/project-operations-dashboard.json +400 -0
- package/skills/bpmax-page-composition-template-editor/examples/presets/project-operations-visual-light.json +214 -0
- package/skills/bpmax-page-composition-template-editor/examples/presets/step-related-projects.json +184 -0
- package/skills/bpmax-page-composition-template-editor/references/resource-api.md +9 -0
- package/skills/bpmax-plugin-config/SKILL.md +55 -5
- package/skills/bpmax-project/SKILL.md +37 -1
- package/skills/bpmax-project-detail-template-editor/SKILL.md +13 -39
- package/skills/bpmax-project-detail-template-editor/agents/openai.yaml +2 -2
- package/skills/bpmax-role-editor/SKILL.md +11 -30
- package/skills/bpmax-shared/SKILL.md +19 -9
- package/skills/bpmax-team-editor/SKILL.md +27 -0
- package/skills/bpmax-ui-ux-audit/LICENSE.upstream +23 -0
- package/skills/bpmax-ui-ux-audit/SKILL.md +42 -0
- package/skills/bpmax-ui-ux-audit/agents/openai.yaml +4 -0
- package/skills/bpmax-ui-ux-audit/references/audit-framework.md +39 -0
- package/skills/bpmax-ui-ux-audit/references/bpmax-ux-findings.md +56 -0
- package/skills/bpmax-user/SKILL.md +33 -1
- package/skills/bpmax-user-mock-operator/SKILL.md +58 -56
- package/skills/bpmax-user-mock-operator/agents/openai.yaml +2 -2
- package/skills/bpmax-user-mock-operator/scripts/chrome_identity_bridge.mjs +1766 -0
- package/skills/bpmax-user-model-editor/SKILL.md +24 -0
- package/skills/bpmax-workspace-editor/SKILL.md +1 -0
- package/skills/form-control-library/references/form-template-submit-schema.md +3 -1
- package/skills/bpmax-user-mock-operator/scripts/switch_user_identity.py +0 -37
- package/skills/bpmax-user-mock-operator/scripts/user_mock_operator_common.py +0 -136
- package/skills/bpmax-user-mock-operator/tests/test_user_mock_operator.py +0 -138
|
@@ -52,6 +52,105 @@ 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 = ["禁止", "不可", "无权限", "隐藏", "只读", "不适用"]
|
|
116
|
+
|
|
117
|
+
REVIEW_RECORD_TABLES = {
|
|
118
|
+
"流程评审记录": ["流程评审记录", "设计评审记录"],
|
|
119
|
+
"业务确认问答": ["业务确认问答", "业务确认记录", "确认问答"],
|
|
120
|
+
"待确认事项": ["待确认事项"],
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
# System identifiers that must not appear in reader-facing prose. Each pattern
|
|
124
|
+
# catches a shape that carries no business meaning for a business reader.
|
|
125
|
+
#
|
|
126
|
+
# `\b` is unusable here on two counts: `_` is a word character, so it never forms
|
|
127
|
+
# a boundary inside snake_case keys; and CJK characters are word characters too,
|
|
128
|
+
# so `本流程编号flow454372735由系统生成` has no boundary at all. Since Chinese prose
|
|
129
|
+
# is the normal case, every pattern guards on ASCII characters explicitly.
|
|
130
|
+
_KEY_LEFT = r"(?<![A-Za-z0-9_])"
|
|
131
|
+
_KEY_RIGHT = r"(?![A-Za-z0-9_])"
|
|
132
|
+
SYSTEM_IDENTIFIER_PATTERNS = [
|
|
133
|
+
(rf"{_KEY_LEFT}flow\d{{6,}}{_KEY_RIGHT}", "流程编号(如 flow454372735)"),
|
|
134
|
+
(rf"{_KEY_LEFT}ctx\.[A-Za-z_$][\w$]*", "系统变量(如 ctx.status、ctx.$PROJECT)"),
|
|
135
|
+
(rf"{_KEY_LEFT}\$CAN_[A-Z_]+{_KEY_RIGHT}", "权限变量(如 $CAN_DELETE)"),
|
|
136
|
+
(rf"{_KEY_LEFT}(?:form_template|flow_page_template|data_set_field|data_set|plugin_[a-z0-9_]+){_KEY_RIGHT}", "配置对象键名"),
|
|
137
|
+
(rf"{_KEY_LEFT}[a-z][a-z0-9]*(?:_[a-z0-9]+)*_id{_KEY_RIGHT}", "字段键名(如 form_template_id)"),
|
|
138
|
+
(rf"{_KEY_LEFT}sn_number{_KEY_RIGHT}", "程序类型名"),
|
|
139
|
+
(rf"{_KEY_LEFT}(?:auto_action|enable_auto_action|bpmax_lint){_KEY_RIGHT}", "配置项键名"),
|
|
140
|
+
(rf"{_KEY_LEFT}flow_type{_KEY_RIGHT}", "流程类型键名"),
|
|
141
|
+
(rf"{_KEY_LEFT}/api/[a-z0-9_/{{}}:.-]+", "接口路径"),
|
|
142
|
+
(rf"{_KEY_LEFT}(?:null|undefined|true|false){_KEY_RIGHT}", "程序取值"),
|
|
143
|
+
]
|
|
144
|
+
|
|
145
|
+
# Sections whose text is meant for implementers, where identifiers are legitimate.
|
|
146
|
+
IMPLEMENTATION_SECTION_TERMS = [
|
|
147
|
+
"BPMAX 实现边界",
|
|
148
|
+
"实现边界",
|
|
149
|
+
"配置对象",
|
|
150
|
+
"对应配置",
|
|
151
|
+
"字段字典",
|
|
152
|
+
"流程数据集",
|
|
153
|
+
]
|
|
55
154
|
|
|
56
155
|
|
|
57
156
|
@dataclass
|
|
@@ -71,6 +170,12 @@ class FlowSection:
|
|
|
71
170
|
missing: list[str] = field(default_factory=list)
|
|
72
171
|
|
|
73
172
|
|
|
173
|
+
@dataclass
|
|
174
|
+
class TableData:
|
|
175
|
+
headers: list[str]
|
|
176
|
+
rows: list[dict[str, str]]
|
|
177
|
+
|
|
178
|
+
|
|
74
179
|
def read_content(path: Path) -> str:
|
|
75
180
|
raw = path.read_text(encoding="utf-8")
|
|
76
181
|
stripped = raw.lstrip()
|
|
@@ -113,19 +218,122 @@ def extract_title(xml: str) -> str:
|
|
|
113
218
|
return plain_text(match.group(1)).strip() if match else ""
|
|
114
219
|
|
|
115
220
|
|
|
221
|
+
def extract_heading_sections(xml: str) -> list[tuple[int, str, str]]:
|
|
222
|
+
heading_re = re.compile(r"<h([1-3])[^>]*>(.*?)</h\1>", re.S)
|
|
223
|
+
matches = list(heading_re.finditer(xml))
|
|
224
|
+
sections: list[tuple[int, str, str]] = []
|
|
225
|
+
for index, match in enumerate(matches):
|
|
226
|
+
level = int(match.group(1))
|
|
227
|
+
title = plain_text(match.group(2)).strip()
|
|
228
|
+
end = len(xml)
|
|
229
|
+
for next_match in matches[index + 1 :]:
|
|
230
|
+
if int(next_match.group(1)) <= level:
|
|
231
|
+
end = next_match.start()
|
|
232
|
+
break
|
|
233
|
+
sections.append((level, title, xml[match.start() : end]))
|
|
234
|
+
return sections
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
def matching_sections(xml: str, title_terms: Iterable[str]) -> list[str]:
|
|
238
|
+
return [
|
|
239
|
+
content
|
|
240
|
+
for _, title, content in extract_heading_sections(xml)
|
|
241
|
+
if any(term in title for term in title_terms)
|
|
242
|
+
]
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
def extract_tables(xml: str) -> list[TableData]:
|
|
246
|
+
tables: list[TableData] = []
|
|
247
|
+
for table_match in re.finditer(r"<table\b[^>]*>(.*?)</table>", xml, re.I | re.S):
|
|
248
|
+
parsed_rows: list[list[str]] = []
|
|
249
|
+
row_cell_tags: list[list[str]] = []
|
|
250
|
+
for row_match in re.finditer(r"<tr\b[^>]*>(.*?)</tr>", table_match.group(1), re.I | re.S):
|
|
251
|
+
cells: list[str] = []
|
|
252
|
+
tags: list[str] = []
|
|
253
|
+
for cell_match in re.finditer(r"<(th|td)\b[^>]*>(.*?)</\1>", row_match.group(1), re.I | re.S):
|
|
254
|
+
tags.append(cell_match.group(1).lower())
|
|
255
|
+
cells.append(plain_text(cell_match.group(2)).strip())
|
|
256
|
+
if cells:
|
|
257
|
+
parsed_rows.append(cells)
|
|
258
|
+
row_cell_tags.append(tags)
|
|
259
|
+
if not parsed_rows:
|
|
260
|
+
continue
|
|
261
|
+
header_index = 0
|
|
262
|
+
for index, tags in enumerate(row_cell_tags):
|
|
263
|
+
if tags and all(tag == "th" for tag in tags):
|
|
264
|
+
header_index = index
|
|
265
|
+
break
|
|
266
|
+
headers = parsed_rows[header_index]
|
|
267
|
+
rows: list[dict[str, str]] = []
|
|
268
|
+
for cells in parsed_rows[header_index + 1 :]:
|
|
269
|
+
rows.append({header: cells[index] if index < len(cells) else "" for index, header in enumerate(headers)})
|
|
270
|
+
tables.append(TableData(headers=headers, rows=rows))
|
|
271
|
+
return tables
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
def header_name(table: TableData, aliases: Iterable[str]) -> str | None:
|
|
275
|
+
for header in table.headers:
|
|
276
|
+
normalized = re.sub(r"\s+", "", header).lower()
|
|
277
|
+
for alias in aliases:
|
|
278
|
+
expected = re.sub(r"\s+", "", alias).lower()
|
|
279
|
+
if normalized == expected or expected in normalized:
|
|
280
|
+
return header
|
|
281
|
+
return None
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
def row_value(row: dict[str, str], table: TableData, aliases: Iterable[str]) -> str:
|
|
285
|
+
header = header_name(table, aliases)
|
|
286
|
+
return row.get(header, "").strip() if header else ""
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
def is_placeholder(value: str) -> bool:
|
|
290
|
+
normalized = value.strip().strip("<>")
|
|
291
|
+
return normalized in {"", "-", "待填写", "待确认", "待补充", "未知"}
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
def flow_business_name(title: str) -> str:
|
|
295
|
+
parts = re.split(r"[::]", title, maxsplit=1)
|
|
296
|
+
return parts[1].strip() if len(parts) > 1 else title.strip()
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
def row_mentions_flow(row: dict[str, str], table: TableData, flow: FlowSection) -> bool:
|
|
300
|
+
flow_value = row_value(row, table, ["流程"])
|
|
301
|
+
return flow.title in flow_value or flow_business_name(flow.title) in flow_value
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
def require_table_headers(
|
|
305
|
+
findings: list[Finding],
|
|
306
|
+
table: TableData,
|
|
307
|
+
rules: dict[str, list[str]],
|
|
308
|
+
code: str,
|
|
309
|
+
label: str,
|
|
310
|
+
) -> bool:
|
|
311
|
+
ok = True
|
|
312
|
+
for required, aliases in rules.items():
|
|
313
|
+
if header_name(table, aliases) is None:
|
|
314
|
+
add_error(findings, code, f"{label} table is missing required header: {required}")
|
|
315
|
+
ok = False
|
|
316
|
+
return ok
|
|
317
|
+
|
|
318
|
+
|
|
116
319
|
def extract_flows(xml: str) -> list[FlowSection]:
|
|
117
320
|
heading_re = re.compile(r"<h([1-3])[^>]*>(.*?)</h\1>", re.S)
|
|
118
321
|
matches = list(heading_re.finditer(xml))
|
|
119
|
-
flow_matches = []
|
|
120
|
-
for match in matches:
|
|
322
|
+
flow_matches: list[tuple[int, re.Match[str], str]] = []
|
|
323
|
+
for match_index, match in enumerate(matches):
|
|
121
324
|
title = plain_text(match.group(2)).strip()
|
|
122
325
|
if re.search(r"流程[一二三四五六七八九十\d]+[::]", title):
|
|
123
|
-
flow_matches.append((match, title))
|
|
326
|
+
flow_matches.append((match_index, match, title))
|
|
124
327
|
|
|
125
328
|
flows = []
|
|
126
|
-
for
|
|
329
|
+
for match_index, match, title in flow_matches:
|
|
127
330
|
start = match.start()
|
|
128
|
-
|
|
331
|
+
level = int(match.group(1))
|
|
332
|
+
end = len(xml)
|
|
333
|
+
for next_match in matches[match_index + 1 :]:
|
|
334
|
+
if int(next_match.group(1)) <= level:
|
|
335
|
+
end = next_match.start()
|
|
336
|
+
break
|
|
129
337
|
content = xml[start:end]
|
|
130
338
|
flows.append(
|
|
131
339
|
FlowSection(
|
|
@@ -138,10 +346,324 @@ def extract_flows(xml: str) -> list[FlowSection]:
|
|
|
138
346
|
return flows
|
|
139
347
|
|
|
140
348
|
|
|
349
|
+
def validate_review_record(findings: list[Finding], xml: str) -> None:
|
|
350
|
+
"""Require the design-review and user-confirmation record.
|
|
351
|
+
|
|
352
|
+
A blueprint can be structurally complete and still be wrong for the business.
|
|
353
|
+
The record is the only durable place where review findings and the user's
|
|
354
|
+
answers live, so its absence means those decisions exist nowhere.
|
|
355
|
+
"""
|
|
356
|
+
for label, title_terms in REVIEW_RECORD_TABLES.items():
|
|
357
|
+
# Match the heading itself, not any text containing the term: a stray
|
|
358
|
+
# 「待确认」 in an unrelated heading must not satisfy this gate.
|
|
359
|
+
sections = [
|
|
360
|
+
content
|
|
361
|
+
for _, title, content in extract_heading_sections(xml)
|
|
362
|
+
if _heading_matches(title, title_terms)
|
|
363
|
+
]
|
|
364
|
+
if not sections:
|
|
365
|
+
add_error(
|
|
366
|
+
findings,
|
|
367
|
+
"REVIEW_RECORD_MISSING",
|
|
368
|
+
f"Blueprint must record the design review and business confirmation: missing 「{label}」.",
|
|
369
|
+
)
|
|
370
|
+
continue
|
|
371
|
+
tables = [table for section in sections for table in extract_tables(section)]
|
|
372
|
+
if not tables:
|
|
373
|
+
add_error(
|
|
374
|
+
findings,
|
|
375
|
+
"REVIEW_RECORD_TABLE_MISSING",
|
|
376
|
+
f"「{label}」must be presented as a table.",
|
|
377
|
+
)
|
|
378
|
+
continue
|
|
379
|
+
# An empty table is an unfilled placehorder, not a record. `待确认事项` is
|
|
380
|
+
# allowed to say 无 — but it must say it in a row.
|
|
381
|
+
if not any(table.rows for table in tables):
|
|
382
|
+
add_error(
|
|
383
|
+
findings,
|
|
384
|
+
"REVIEW_RECORD_ROW_MISSING",
|
|
385
|
+
f"「{label}」table has no data row; record the findings/answers, or state 无 explicitly.",
|
|
386
|
+
)
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
def _heading_matches(title: str, terms: Iterable[str]) -> bool:
|
|
390
|
+
"""True when the heading *is* the section, allowing a numeric prefix and a suffix.
|
|
391
|
+
|
|
392
|
+
`待确认` appears inside many ordinary headings (「待确认的业务背景」), so a
|
|
393
|
+
substring test would let an unrelated table satisfy the review-record gate.
|
|
394
|
+
But a real heading may also be annotated (`待确认事项(持续更新)`), so allow a
|
|
395
|
+
trailing parenthetical or colon after the term.
|
|
396
|
+
"""
|
|
397
|
+
stripped = re.sub(r"^[\d.、\s]+", "", title).strip()
|
|
398
|
+
for term in terms:
|
|
399
|
+
if stripped == term:
|
|
400
|
+
return True
|
|
401
|
+
if re.match(rf"^{re.escape(term)}(?:[::]|(|\()\s*.*$", stripped):
|
|
402
|
+
return True
|
|
403
|
+
return False
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
def _identifier_free_prose(xml: str) -> list[tuple[str, str]]:
|
|
407
|
+
"""Return (section title, prose text) for sections meant for business readers.
|
|
408
|
+
|
|
409
|
+
Implementation sections are skipped: identifiers there are the point. Only
|
|
410
|
+
the innermost section is returned, because a parent heading's content already
|
|
411
|
+
contains its children and would otherwise report the same leak twice.
|
|
412
|
+
"""
|
|
413
|
+
headings = list(re.finditer(r"<h([1-4])[^>]*>(.*?)</h\1>", xml, re.S))
|
|
414
|
+
results: list[tuple[str, str]] = []
|
|
415
|
+
for index, match in enumerate(headings):
|
|
416
|
+
level = int(match.group(1))
|
|
417
|
+
title = plain_text(match.group(2)).strip()
|
|
418
|
+
if _is_implementation_heading(title):
|
|
419
|
+
continue
|
|
420
|
+
end = len(xml)
|
|
421
|
+
for next_match in headings[index + 1 :]:
|
|
422
|
+
# A following heading at the same or shallower level ends this section.
|
|
423
|
+
if int(next_match.group(1)) <= level:
|
|
424
|
+
end = next_match.start()
|
|
425
|
+
break
|
|
426
|
+
else:
|
|
427
|
+
end = len(xml)
|
|
428
|
+
content = xml[match.end() : end]
|
|
429
|
+
# If a child heading exists, this section's own prose ends before it.
|
|
430
|
+
child = re.search(r"<h[1-4]\b", content)
|
|
431
|
+
if child:
|
|
432
|
+
content = content[: child.start()]
|
|
433
|
+
results.append((title, f"{title} {_scan_text(content)}"))
|
|
434
|
+
return results
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
def _is_implementation_heading(title: str) -> bool:
|
|
438
|
+
"""True only when the heading *is* the implementation section.
|
|
439
|
+
|
|
440
|
+
Substring matching would exempt `6.6 流程数据集口径` entirely, hiding real
|
|
441
|
+
business prose; the section name has to be the whole heading or its tail.
|
|
442
|
+
"""
|
|
443
|
+
stripped = re.sub(r"^[\d.、\s]+", "", title).strip()
|
|
444
|
+
return any(
|
|
445
|
+
stripped == term or stripped.endswith(term)
|
|
446
|
+
for term in IMPLEMENTATION_SECTION_TERMS
|
|
447
|
+
)
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
def _scan_text(content: str) -> str:
|
|
451
|
+
"""Text a business reader actually reads: prose, node labels, and table cells.
|
|
452
|
+
|
|
453
|
+
Tables and diagrams are checked, not stripped — the node tables and the
|
|
454
|
+
process diagram are where a leaked `flow454372735` does the most damage. The
|
|
455
|
+
only exception is the navigation table's 路由/页面 column, whose values are
|
|
456
|
+
URLs by design.
|
|
457
|
+
|
|
458
|
+
Implementation sections are exempt entirely and never reach here.
|
|
459
|
+
"""
|
|
460
|
+
return plain_text(_drop_route_cells(content))
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
def _drop_route_cells(content: str) -> str:
|
|
464
|
+
"""Blank the 路由/页面 column of any table that has one, elsewhere keep it."""
|
|
465
|
+
replaced: list[str] = []
|
|
466
|
+
for table in re.findall(r"<table\b.*?</table>", content, flags=re.I | re.S):
|
|
467
|
+
rows = re.findall(r"<tr\b[^>]*>.*?</tr>", table, flags=re.I | re.S)
|
|
468
|
+
if not rows:
|
|
469
|
+
continue
|
|
470
|
+
header_cells = [
|
|
471
|
+
plain_text(cell).strip()
|
|
472
|
+
for cell in re.findall(r"<(?:th|td)\b[^>]*>(.*?)</(?:th|td)>", rows[0], flags=re.I | re.S)
|
|
473
|
+
]
|
|
474
|
+
route_index = next(
|
|
475
|
+
(index for index, name in enumerate(header_cells) if "路由" in name or "页面" in name),
|
|
476
|
+
None,
|
|
477
|
+
)
|
|
478
|
+
if route_index is None:
|
|
479
|
+
continue
|
|
480
|
+
scrubbed = table
|
|
481
|
+
for row in rows[1:]:
|
|
482
|
+
row_cells = re.findall(r"<(?:td|th)\b[^>]*>.*?</(?:td|th)>", row, flags=re.I | re.S)
|
|
483
|
+
if len(row_cells) > route_index:
|
|
484
|
+
scrubbed = scrubbed.replace(row_cells[route_index], " ", 1)
|
|
485
|
+
replaced.append((table, scrubbed))
|
|
486
|
+
for original, scrubbed in replaced:
|
|
487
|
+
content = content.replace(original, scrubbed, 1)
|
|
488
|
+
return content
|
|
489
|
+
|
|
490
|
+
|
|
491
|
+
def validate_business_language(findings: list[Finding], xml: str) -> None:
|
|
492
|
+
"""Reject system identifiers in sections a business reader is meant to read."""
|
|
493
|
+
seen: set[tuple[str, str]] = set()
|
|
494
|
+
for title, prose in _identifier_free_prose(xml):
|
|
495
|
+
for pattern, description in SYSTEM_IDENTIFIER_PATTERNS:
|
|
496
|
+
for match in re.finditer(pattern, prose):
|
|
497
|
+
key = (title, match.group(0))
|
|
498
|
+
if key in seen:
|
|
499
|
+
continue
|
|
500
|
+
seen.add(key)
|
|
501
|
+
add_error(
|
|
502
|
+
findings,
|
|
503
|
+
"BUSINESS_LANGUAGE_IDENTIFIER",
|
|
504
|
+
f"章节「{title}」出现{description}:{match.group(0)}。改用业务名称;标识符只放在实现边界/配置表格里。",
|
|
505
|
+
)
|
|
506
|
+
|
|
507
|
+
|
|
141
508
|
def add_error(findings: list[Finding], code: str, message: str, flow: str | None = None) -> None:
|
|
142
509
|
findings.append(Finding("error", code, message, flow))
|
|
143
510
|
|
|
144
511
|
|
|
512
|
+
def validate_matrix_design(findings: list[Finding], sections: list[str]) -> None:
|
|
513
|
+
if not sections:
|
|
514
|
+
return
|
|
515
|
+
tables = extract_tables(" ".join(sections))
|
|
516
|
+
if not tables:
|
|
517
|
+
return
|
|
518
|
+
table = tables[0]
|
|
519
|
+
if not require_table_headers(
|
|
520
|
+
findings,
|
|
521
|
+
table,
|
|
522
|
+
MATRIX_HEADER_RULES,
|
|
523
|
+
"DOC_MATRIX_HEADER_MISSING",
|
|
524
|
+
"Approval/decision matrix assessment",
|
|
525
|
+
):
|
|
526
|
+
return
|
|
527
|
+
if not table.rows:
|
|
528
|
+
add_error(findings, "DOC_MATRIX_ROW_MISSING", "Approval/decision matrix assessment requires at least one rule row.")
|
|
529
|
+
return
|
|
530
|
+
section_text = plain_text(" ".join(sections))
|
|
531
|
+
for row_index, row in enumerate(table.rows, start=1):
|
|
532
|
+
for required, aliases in MATRIX_HEADER_RULES.items():
|
|
533
|
+
if is_placeholder(row_value(row, table, aliases)):
|
|
534
|
+
add_error(
|
|
535
|
+
findings,
|
|
536
|
+
"DOC_MATRIX_VALUE_MISSING",
|
|
537
|
+
f"Approval/decision matrix row {row_index} has no concrete value for: {required}",
|
|
538
|
+
)
|
|
539
|
+
formal_value = row_value(row, table, MATRIX_HEADER_RULES["正式 BPMAX 矩阵"])
|
|
540
|
+
formal_selected = bool(formal_value) and not re.search(r"不采用|不使用|不需要|否|无|不适用", formal_value)
|
|
541
|
+
if formal_selected:
|
|
542
|
+
for label, terms in FORMAL_MATRIX_RUNTIME_TERMS.items():
|
|
543
|
+
if not has_any(section_text, terms):
|
|
544
|
+
add_error(
|
|
545
|
+
findings,
|
|
546
|
+
"DOC_FORMAL_MATRIX_LIFECYCLE_MISSING",
|
|
547
|
+
f"Formal BPMAX matrix design is missing runtime lifecycle detail: {label}",
|
|
548
|
+
)
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
def validate_navigation_design(findings: list[Finding], xml: str, flows: list[FlowSection]) -> None:
|
|
552
|
+
sections = matching_sections(xml, NAVIGATION_SECTION_TITLES)
|
|
553
|
+
if not sections:
|
|
554
|
+
add_error(findings, "DOC_NAVIGATION_DESIGN_MISSING", "Missing required PC/H5 navigation design section.")
|
|
555
|
+
return
|
|
556
|
+
tables = extract_tables(" ".join(sections))
|
|
557
|
+
if not tables:
|
|
558
|
+
add_error(findings, "DOC_NAVIGATION_TABLE_MISSING", "PC/H5 navigation design must be presented as a table.")
|
|
559
|
+
return
|
|
560
|
+
table = tables[0]
|
|
561
|
+
if not require_table_headers(
|
|
562
|
+
findings,
|
|
563
|
+
table,
|
|
564
|
+
NAVIGATION_HEADER_RULES,
|
|
565
|
+
"DOC_NAVIGATION_HEADER_MISSING",
|
|
566
|
+
"PC/H5 navigation design",
|
|
567
|
+
):
|
|
568
|
+
return
|
|
569
|
+
if not table.rows:
|
|
570
|
+
add_error(findings, "DOC_NAVIGATION_ROW_MISSING", "PC/H5 navigation design requires at least one row.")
|
|
571
|
+
return
|
|
572
|
+
for row_index, row in enumerate(table.rows, start=1):
|
|
573
|
+
terminal = row_value(row, table, NAVIGATION_HEADER_RULES["终端"])
|
|
574
|
+
if "PC" in terminal.upper() and "H5" in terminal.upper():
|
|
575
|
+
add_error(
|
|
576
|
+
findings,
|
|
577
|
+
"DOC_NAVIGATION_TERMINAL_COMBINED",
|
|
578
|
+
f"Navigation row {row_index} combines PC and H5; design them as separate rows.",
|
|
579
|
+
)
|
|
580
|
+
for required, aliases in NAVIGATION_HEADER_RULES.items():
|
|
581
|
+
if is_placeholder(row_value(row, table, aliases)):
|
|
582
|
+
add_error(
|
|
583
|
+
findings,
|
|
584
|
+
"DOC_NAVIGATION_VALUE_MISSING",
|
|
585
|
+
f"Navigation row {row_index} has no concrete value for: {required}",
|
|
586
|
+
)
|
|
587
|
+
for flow in flows:
|
|
588
|
+
rows = [row for row in table.rows if row_mentions_flow(row, table, flow)]
|
|
589
|
+
if not rows:
|
|
590
|
+
add_error(
|
|
591
|
+
findings,
|
|
592
|
+
"FLOW_NAVIGATION_COVERAGE_MISSING",
|
|
593
|
+
"Navigation design has no row for this flow.",
|
|
594
|
+
flow.title,
|
|
595
|
+
)
|
|
596
|
+
continue
|
|
597
|
+
terminals = [row_value(row, table, NAVIGATION_HEADER_RULES["终端"]).upper() for row in rows]
|
|
598
|
+
if not any("PC" in terminal and "H5" not in terminal for terminal in terminals):
|
|
599
|
+
add_error(findings, "FLOW_PC_NAVIGATION_MISSING", "Flow has no independent PC navigation design.", flow.title)
|
|
600
|
+
if not any("H5" in terminal and "PC" not in terminal for terminal in terminals):
|
|
601
|
+
add_error(findings, "FLOW_H5_NAVIGATION_MISSING", "Flow has no independent H5 navigation design or explicit H5 non-applicability row.", flow.title)
|
|
602
|
+
|
|
603
|
+
|
|
604
|
+
def validate_permission_design(findings: list[Finding], xml: str, flows: list[FlowSection]) -> None:
|
|
605
|
+
sections = matching_sections(xml, PERMISSION_SECTION_TITLES)
|
|
606
|
+
if not sections:
|
|
607
|
+
add_error(findings, "DOC_PERMISSION_DESIGN_MISSING", "Missing required permission design section.")
|
|
608
|
+
return
|
|
609
|
+
tables = extract_tables(" ".join(sections))
|
|
610
|
+
if not tables:
|
|
611
|
+
add_error(findings, "DOC_PERMISSION_TABLE_MISSING", "Permission design must be presented as a table.")
|
|
612
|
+
return
|
|
613
|
+
table = tables[0]
|
|
614
|
+
if not require_table_headers(
|
|
615
|
+
findings,
|
|
616
|
+
table,
|
|
617
|
+
PERMISSION_HEADER_RULES,
|
|
618
|
+
"DOC_PERMISSION_HEADER_MISSING",
|
|
619
|
+
"Permission design",
|
|
620
|
+
):
|
|
621
|
+
return
|
|
622
|
+
if not table.rows:
|
|
623
|
+
add_error(findings, "DOC_PERMISSION_ROW_MISSING", "Permission design requires at least one row.")
|
|
624
|
+
return
|
|
625
|
+
for row_index, row in enumerate(table.rows, start=1):
|
|
626
|
+
for required, aliases in PERMISSION_HEADER_RULES.items():
|
|
627
|
+
if is_placeholder(row_value(row, table, aliases)):
|
|
628
|
+
add_error(
|
|
629
|
+
findings,
|
|
630
|
+
"DOC_PERMISSION_VALUE_MISSING",
|
|
631
|
+
f"Permission row {row_index} has no concrete value for: {required}",
|
|
632
|
+
)
|
|
633
|
+
for flow in flows:
|
|
634
|
+
rows = [row for row in table.rows if row_mentions_flow(row, table, flow)]
|
|
635
|
+
if not rows:
|
|
636
|
+
add_error(findings, "FLOW_PERMISSION_COVERAGE_MISSING", "Permission design has no row for this flow.", flow.title)
|
|
637
|
+
continue
|
|
638
|
+
row_text = plain_text(" ".join(" ".join(row.values()) for row in rows))
|
|
639
|
+
action_text = " ".join(
|
|
640
|
+
row_value(row, table, PERMISSION_HEADER_RULES["操作权限"])
|
|
641
|
+
for row in rows
|
|
642
|
+
)
|
|
643
|
+
for action in PERMISSION_ACTION_TERMS:
|
|
644
|
+
if action not in action_text:
|
|
645
|
+
add_error(
|
|
646
|
+
findings,
|
|
647
|
+
"FLOW_PERMISSION_ACTION_MISSING",
|
|
648
|
+
f"Permission design does not explicitly cover action: {action}",
|
|
649
|
+
flow.title,
|
|
650
|
+
)
|
|
651
|
+
if "字段" not in row_text:
|
|
652
|
+
add_error(
|
|
653
|
+
findings,
|
|
654
|
+
"FLOW_FIELD_PERMISSION_MISSING",
|
|
655
|
+
"Permission design does not include field visibility/editability for this flow.",
|
|
656
|
+
flow.title,
|
|
657
|
+
)
|
|
658
|
+
if not has_any(row_text, PERMISSION_DENY_TERMS):
|
|
659
|
+
add_error(
|
|
660
|
+
findings,
|
|
661
|
+
"FLOW_PERMISSION_DENY_BOUNDARY_MISSING",
|
|
662
|
+
"Permission design does not state the denied or read-only behavior for unauthorized users.",
|
|
663
|
+
flow.title,
|
|
664
|
+
)
|
|
665
|
+
|
|
666
|
+
|
|
145
667
|
def lint(xml: str, require_terms: list[str], forbid_terms: list[str]) -> tuple[list[Finding], list[FlowSection]]:
|
|
146
668
|
findings: list[Finding] = []
|
|
147
669
|
text = plain_text(xml)
|
|
@@ -170,9 +692,48 @@ def lint(xml: str, require_terms: list[str], forbid_terms: list[str]) -> tuple[l
|
|
|
170
692
|
if re.search(r"<pre[^>]*lang=[\"']mermaid[\"']", xml, re.I):
|
|
171
693
|
add_error(findings, "MERMAID_CODE_BLOCK", "Final blueprint must use whiteboard blocks, not Mermaid code blocks.")
|
|
172
694
|
|
|
695
|
+
first_flow_start: int | None = None
|
|
696
|
+
for _, title, section in extract_heading_sections(xml):
|
|
697
|
+
if re.search(r"流程[一二三四五六七八九十\d]+[::]", title):
|
|
698
|
+
first_flow_start = xml.find(section)
|
|
699
|
+
break
|
|
700
|
+
document_design = xml[:first_flow_start] if first_flow_start is not None else xml
|
|
701
|
+
|
|
702
|
+
for label, title_terms in DOCUMENT_MODELING_TABLES.items():
|
|
703
|
+
sections = matching_sections(document_design, title_terms)
|
|
704
|
+
if not sections:
|
|
705
|
+
add_error(
|
|
706
|
+
findings,
|
|
707
|
+
"DOC_MODELING_REVIEW_MISSING",
|
|
708
|
+
f"Missing required blueprint modeling review section: {label}",
|
|
709
|
+
)
|
|
710
|
+
continue
|
|
711
|
+
if not any(re.search(r"<table\b", section, re.I) for section in sections):
|
|
712
|
+
add_error(
|
|
713
|
+
findings,
|
|
714
|
+
"DOC_MODELING_TABLE_MISSING",
|
|
715
|
+
f"Blueprint modeling review must be presented as a table: {label}",
|
|
716
|
+
)
|
|
717
|
+
|
|
718
|
+
matrix_sections = matching_sections(document_design, DOCUMENT_MODELING_TABLES["审批/决策矩阵评估"])
|
|
719
|
+
matrix_text = plain_text(" ".join(matrix_sections))
|
|
720
|
+
for term in MATRIX_ASSESSMENT_TERMS:
|
|
721
|
+
if matrix_sections and term not in matrix_text:
|
|
722
|
+
add_error(
|
|
723
|
+
findings,
|
|
724
|
+
"DOC_MATRIX_BOUNDARY_MISSING",
|
|
725
|
+
f"Approval/decision matrix assessment must distinguish: {term}",
|
|
726
|
+
)
|
|
727
|
+
validate_matrix_design(findings, matrix_sections)
|
|
728
|
+
|
|
729
|
+
validate_review_record(findings, xml)
|
|
730
|
+
validate_business_language(findings, xml)
|
|
731
|
+
|
|
173
732
|
flows = extract_flows(xml)
|
|
174
733
|
if not flows:
|
|
175
734
|
add_error(findings, "FLOW_SECTION_MISSING", "No flow sections matching 流程X: were found.")
|
|
735
|
+
validate_navigation_design(findings, xml, flows)
|
|
736
|
+
validate_permission_design(findings, xml, flows)
|
|
176
737
|
|
|
177
738
|
for flow in flows:
|
|
178
739
|
flow_text = plain_text(flow.content)
|
|
@@ -188,6 +749,26 @@ def lint(xml: str, require_terms: list[str], forbid_terms: list[str]) -> tuple[l
|
|
|
188
749
|
add_error(findings, "FLOW_REQUIRED_CONTENT_MISSING", f"Missing per-flow content: {label}", flow.title)
|
|
189
750
|
flow.missing.append(label)
|
|
190
751
|
|
|
752
|
+
for label, title_terms in FLOW_DETAIL_TABLES.items():
|
|
753
|
+
sections = matching_sections(flow.content, title_terms)
|
|
754
|
+
if not sections:
|
|
755
|
+
add_error(
|
|
756
|
+
findings,
|
|
757
|
+
"FLOW_DETAIL_SECTION_MISSING",
|
|
758
|
+
f"Missing per-flow detail section required for tabular implementation: {label}",
|
|
759
|
+
flow.title,
|
|
760
|
+
)
|
|
761
|
+
flow.missing.append(f"{label} section")
|
|
762
|
+
continue
|
|
763
|
+
if not any(re.search(r"<table\b", section, re.I) for section in sections):
|
|
764
|
+
add_error(
|
|
765
|
+
findings,
|
|
766
|
+
"FLOW_DETAIL_TABLE_MISSING",
|
|
767
|
+
f"Per-flow implementation detail must be presented as a table: {label}",
|
|
768
|
+
flow.title,
|
|
769
|
+
)
|
|
770
|
+
flow.missing.append(f"{label} table")
|
|
771
|
+
|
|
191
772
|
if "AI" in flow_text or "agent" in flow_text or "Agent" in flow_text:
|
|
192
773
|
for term in AI_REQUIRED_TERMS:
|
|
193
774
|
if term not in flow_text:
|