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
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
# 流程消息卡片专业标准
|
|
2
|
+
|
|
3
|
+
面向流程配置执行者:当你为 BPMAX 流程节点、流程级抄送、项目结束通知写 `message_template` / `message_template_simple` / `cc_message_template` 时,按本文件判断"能不能发、发得对不对、发得专不专业"。
|
|
4
|
+
|
|
5
|
+
本文件只写"专业标准"增量。两种模式的字段事实和源码调用链见 `full-detail-guide.md`「消息模板分两种配置模式」一节;本文件不重复字段清单,只补标准、正反例和门禁判断。
|
|
6
|
+
|
|
7
|
+
## 0. 先记住这一条:返回的是 BPMAX 自有消息对象,不是飞书 Card JSON
|
|
8
|
+
|
|
9
|
+
这是本主题里最容易犯、后果最严重的错误,所以放在最前面。
|
|
10
|
+
|
|
11
|
+
code 模式脚本 `return` 的对象必须是 BPMAX 自有消息结构:
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
return {
|
|
15
|
+
title: '...',
|
|
16
|
+
content: '...', // 字符串;simple 模式是 content[0].body
|
|
17
|
+
actions: [{ type: 'link', btnType: 'primary', text: '...', url: '/...', m_url: '/...' }],
|
|
18
|
+
color: 'wathet',
|
|
19
|
+
messageType: 'step',
|
|
20
|
+
};
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
它不是飞书 interactive card,也不是飞书 Card 2.0。下面这类写法是错的:
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
// 错误:飞书 Card 2.0 结构
|
|
27
|
+
return {
|
|
28
|
+
schema: '2.0',
|
|
29
|
+
body: { elements: [{ tag: 'markdown', content: '请审批' }] },
|
|
30
|
+
};
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
后果链(已从后端源码确认):
|
|
34
|
+
|
|
35
|
+
1. `messageAdaptor` 只用四个业务字段判断消息是否有效:`content`、`title`、`elements?.length`、`actions?.length`。
|
|
36
|
+
2. Card 2.0 的顶层只有 `schema` / `body`,四个业务键全空 → 判定为无效消息。
|
|
37
|
+
3. 函数直接 `return []`,只打一条 `[messageAdaptor:无效的消息内容]` 日志。
|
|
38
|
+
4. 最终结果是**消息静默不发**:没有报错、没有默认消息兜底,配置看起来"保存成功"。
|
|
39
|
+
|
|
40
|
+
判定的准确口径:**只有 title / content / elements / actions 四个业务键全部缺失时才判定为空消息**。单独出现 `header` / `config`(或 `schema` 但仍有业务键)并不导致消息丢失——后端会忽略这些多余键、照常按业务键发送。真实存量里就有同时带 `title/content/elements/actions` 和一个额外 `header` 的模板(`sysconfig-cltxdev` / `sysconfig-hoocoo` 的 `flow541143431`),消息正常发出。因此:
|
|
41
|
+
|
|
42
|
+
- 四个业务键全缺 → lint **error**(`flow.message.card_no_business_keys`,消息真的不会发)。
|
|
43
|
+
- 业务键存在、同时带了 `schema`/`body`/`header`/`config` → lint **warning**(`flow.message.card2_key_ignored`),提示这些键被忽略、容易被误读为飞书原生卡片。
|
|
44
|
+
- 只带 `header`/`config` 而没有 `schema`/`body`,且没有业务键 → 同上 error(现有键里没有任何业务键,消息同样不会发)。
|
|
45
|
+
- 带 `schema`/`body` 但对象里还有 `spread` 或 `Object.assign` 的不可解析实参 → **warning**(`flow.message.card_schema_unsupported`):静态分析无法证明业务键缺失,需人工确认运行时会补出 title/content/actions;全字面量时仍按 error 处理。
|
|
46
|
+
|
|
47
|
+
同样被丢弃的还有所有未知顶层字段。平台发送前还会把 `project`、`messageType`、`currentStep` 从落库内容里剔除,因此不要把自己的业务字段塞进这几个对象里期望被渲染。
|
|
48
|
+
|
|
49
|
+
全量统计(2340 个流程配置)中 Card 2.0 用量为 0,`code` 模式 40783 处,`standard/simple` 对象模式仅 83 处 —— 说明真实生产配置全部走自有消息对象,不要发明新结构。
|
|
50
|
+
|
|
51
|
+
源码证据:`huanpingtong-server/src/service/feishu.js` 的 `messageAdaptor`(有效性判断、硬编码重建卡片);`huanpingtong-server/src/model/message.js` 的 `getMessageContent` / `sendMessage`。
|
|
52
|
+
|
|
53
|
+
## 1. 后端实际消费哪些字段
|
|
54
|
+
|
|
55
|
+
| 字段 | 作用 | 备注 |
|
|
56
|
+
| --- | --- | --- |
|
|
57
|
+
| `title` | 卡片标题 | 纯文本渲染,不解析 Markdown |
|
|
58
|
+
| `content` | 正文第一段 | 按 `lark_md` 渲染,支持换行和简单 Markdown |
|
|
59
|
+
| `elements` | 追加正文块 | 支持 `div/lark_md`、`markdown`、`column_set/column`、`img`、`note`、`person_list` |
|
|
60
|
+
| `unshiftElements` | 插到正文最前的块 | 常用来放单号、金额、申请人等摘要 |
|
|
61
|
+
| `actions[]` | 按钮 | 消费 `text`、`url`、`m_url`、`btnType`、`is_absolute` |
|
|
62
|
+
| `color` | 标题栏配色 | 后端 `template: data.color || 'wathet'` |
|
|
63
|
+
| `messageType` | 决定移动端按钮跳转包装方式 | `step` 走「消息中转 + `m_url`」的环节待办跳转;其它值优先用按钮的 `inAppLink`,否则走站内拼接 |
|
|
64
|
+
| `popup` | 是否弹窗提示 | 真实存在,但不要用来替代正文信息 |
|
|
65
|
+
|
|
66
|
+
必须同时知道的三条运行时行为:
|
|
67
|
+
|
|
68
|
+
- **simple 模式只读第一个正文块**:后端取 `content?.[0]?.body`。写在 `content[1]`、`content[2]` 的内容不会渲染。多行内容请放在同一个 `body` 里用换行拼接。
|
|
69
|
+
- **simple 模式没有 actions 会自动补一个"查看"按钮**:指到 `/projectContinue`。看起来"能用",但按钮文案和跳转都不体现业务语义,属于隐性降级。
|
|
70
|
+
- **simple 模式标题或正文为空会走默认文案**:默认标题是"新的流程消息",默认正文是"「项目名」项目「环节名」环节需要你处理,请前往查看"。很多配置"看起来有卡片",其实全靠这个默认值在撑,等于固定文案标题。code 模式没有这层兜底:`return {};` 会一路走到 `messageAdaptor`,被判为无效消息后不生成卡片,也不会补默认文案;而平台消息记录(`think_platform_message`)在解析模板之前就已经写入,于是出现"站内有待办记录、外部渠道没收到卡片"的不一致。只有 `return "";` 才会在 `buildStepMessage` 解析后、发送前提前停止。
|
|
71
|
+
|
|
72
|
+
模式值本身也有坑:后端分支判断的是 `message_config_mode === 'standard'` 且 `message_template_simple` 存在。写成 `simple` 不会被命中,会回落到 `message_template`(通常为空)或默认消息。**对象模式请写 `standard`**;本地配置镜像里确有少量节点写成 `simple`,这些节点的自定义卡片按当前后端逻辑不会生效。
|
|
73
|
+
|
|
74
|
+
链接形态(决定按钮点开去哪里):
|
|
75
|
+
|
|
76
|
+
- `url` 是站内 PC 路径,必须以 `/` 开头,后端会拼上工作区前缀;`m_url` 是移动端路径,后端拼 `/#/工作区`。
|
|
77
|
+
- 指向外部系统时用 `is_absolute: true`,否则会被错误地拼成站内地址。
|
|
78
|
+
- standard / simple 模式下 `actions[].url` / `m_url` 字段本身是**脚本**:后端 `parseTemplateString` 把它当函数体执行,没有 `return` 就得到 `undefined`,最终按钮 URL 会拼成 `/工作区undefined`。所以这里必须写 `return '/projectContinue?id=' + ...`,不能只写模板字符串字面量。code 模式则相反,`url` 直接就是求值后的字符串。代码模式节点上的 `message_template_simple.actions[].url` 若含 `${...}` 插值却不是函数体,会报错;standard 模式下 literal URL 目前不会被 lint 拦下,不能靠 lint 兜底。
|
|
79
|
+
|
|
80
|
+
## 2. 专业卡片由四件事构成
|
|
81
|
+
|
|
82
|
+
### 2.1 title:写业务语义,不写"新消息"
|
|
83
|
+
|
|
84
|
+
合格标题至少包含"业务对象 + 环节/动作",让用户不进系统就能判断要不要现在处理。
|
|
85
|
+
|
|
86
|
+
- 好:`ZD02制度修订/废止待处理:部门领导`
|
|
87
|
+
- 好:`XS02 销售订单变更:部门负责人`
|
|
88
|
+
- 好:`CW08非合同付款流程已完成`
|
|
89
|
+
- 差:`您有新消息`、`新的流程消息`、`待办提醒`、`流程通知`
|
|
90
|
+
|
|
91
|
+
真实配置中合格标题的共同点是:`流程编号/名称 + 环节名`,或用变量拼出项目名(`ctx.$PROJECT?.name`)。标题里的变量必须能取到值,否则会渲染成空串或 `undefined`。
|
|
92
|
+
|
|
93
|
+
lint 口径(`flow.message.card_title_static`):**只有整句都是泛化词时才告警**——去掉"新的流程消息 / 您有新消息 / 待办提醒 / 流程通知 / 待处理"等泛化片段和标点、数字后不再剩任何业务词;含流程编号(如 `CW08`、`ZD02`)、单据/流程类型词或环节名的固定标题都算合格,不告警。存量里 1383 条固定标题属于这一类合格标题。
|
|
94
|
+
|
|
95
|
+
**注意:simple/standard 的字段是脚本,不是字面量。** 后端 `parseTemplateString` 把每个字段(`title`、`content[i].body`、`actions[].url`/`m_url`)交给 `parseEvalFunction`,按**函数体** eval。写成普通字面量(`title: "采购审批待处理"`,没有 `return`)时函数体没有返回值,运行时得到 `undefined`,`|| ''` 后实际是空串——编辑器里看得到文字,收件人收到的却是默认文案。这类字段会报 `flow.message.simple_field_missing_return`,并连带触发 `card_title_empty`/`card_content_empty` 或 `missing_for_human_node`。正确写法是 `return "采购审批待处理"` 或 `` return `采购审批待处理:${step.name}` ``。
|
|
96
|
+
|
|
97
|
+
### 2.2 content:谁、什么事、需要你做什么
|
|
98
|
+
|
|
99
|
+
正文建议三段式,用换行连接:
|
|
100
|
+
|
|
101
|
+
1. 谁/什么事:单号、申请人、项目名等能唯一定位的业务标识;
|
|
102
|
+
2. 当前状态:到了哪个环节、因为什么到这里;
|
|
103
|
+
3. 需要你做什么:审批、修改、确认、知悉。
|
|
104
|
+
|
|
105
|
+
真实正例(来自生产配置):
|
|
106
|
+
|
|
107
|
+
```js
|
|
108
|
+
content: [
|
|
109
|
+
`${ctx.$i18n('单号')}:${requestNo}`,
|
|
110
|
+
ctx.$i18n('请审批特殊出差申请。'),
|
|
111
|
+
].join('\n')
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
```js
|
|
115
|
+
content: `【${ctx.$PROJECT.name}】已结束,请悉知`
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
差例:`请处理`、`您有一条待办`、`请查看`。这类文案在收件箱里和十条其它待办无法区分。
|
|
119
|
+
|
|
120
|
+
### 2.3 actions:至少一个跳转,文案要具体
|
|
121
|
+
|
|
122
|
+
- 数量:至少 1 个;审批类建议 1 个主按钮即可,不要把"同意/驳回"做成消息按钮(动作要回前端走后端流程动作,消息按钮只负责跳转)。
|
|
123
|
+
- 文案:`查看并审批`、`填写处理`、`查看订单`,不要只写"查看"(simple 模式默认就是"查看",等于没写)。
|
|
124
|
+
- 类型:code 模式固定 `type: 'link'`;simple 模式的 `actions[0].type` 会变成 `messageType`,环节待办用 `step`,项目详情用 `project`,但 `link` 也是合法的——后端 `parseSimpleMessageTemplate` 固定把每个按钮的 `type` 改写成 `'link'`,`m_url` 仍会变成 `inAppLink`,所以 `type: 'link'` 不会让按钮失效,lint 允许它。`none/step/project/custom` 之外的值仍会报 `flow.message.action_invalid`。
|
|
125
|
+
- 跳转:环节待办用 `/projectContinue?id=<project_id>&step_id=<step_id>`,移动端 `/pages/taskDetails/taskDetails?id=...`;完成/归档通知指向项目页。
|
|
126
|
+
- 实参要带兜底:`step?.project_id || ctx?.$PROJECT?.id`,避免某个上下文缺字段导致按钮 URL 变成 `undefined`。
|
|
127
|
+
|
|
128
|
+
### 2.4 color:按紧急度选色,不要全靠默认
|
|
129
|
+
|
|
130
|
+
标题色由 `color`(code 模式)或 `title_color`(simple 模式)控制,后端默认 `wathet`。前端真实可选 12 个值,按语义用:
|
|
131
|
+
|
|
132
|
+
| 场景 | 推荐色 | 说明 |
|
|
133
|
+
| --- | --- | --- |
|
|
134
|
+
| 常规待办:审批、填写、确认 | `wathet` | 默认色;真实配置绝大多数使用此色,可读性最好 |
|
|
135
|
+
| 通过、完成、归档 | `green` | 正向结束语义 |
|
|
136
|
+
| 临期、待关注、需要催办 | `orange` 或 `yellow` | 提醒但不等于失败 |
|
|
137
|
+
| 驳回、拒绝、异常、退单 | `red` 或 `carmine` | 负向语义 |
|
|
138
|
+
| 抄送、知会(非主待办) | `turquoise` 或 `purple` | 与主待办区分,别用灰色降低可读性 |
|
|
139
|
+
| 一般不用 | `grey` | 对比度低,重要信息容易漏看 |
|
|
140
|
+
|
|
141
|
+
同一流程内不要超过 3 种颜色。颜色是辅助信号,不能替代标题里的语义。
|
|
142
|
+
|
|
143
|
+
## 3. 正例 / 反例对照
|
|
144
|
+
|
|
145
|
+
| # | 反例 | 问题 | 正例 |
|
|
146
|
+
| --- | --- | --- | --- |
|
|
147
|
+
| 1 | `return { schema: '2.0', body: { elements: [] } }` | 飞书 Card 2.0;后端判空,消息静默不发 | 返回 `{ title, content, actions, color, messageType }` 自有消息对象 |
|
|
148
|
+
| 2 | `return "请处理【环节】。";` | 裸字符串;truthy 进入发送链路但无法渲染卡片,也发不出有效消息 | `return { title: 'XS02销售订单变更:部门负责人', content: '单号:...\n请审批', actions: [...] }` |
|
|
149
|
+
| 3 | 只写 `title` + `content`,`actions` 为空 | 用户只能读不能跳,必须自己找环节;simple 模式下还会被后端补成通用"查看" | 至少一个 `text: '查看并审批'` 的跳转按钮,指向 `/projectContinue` |
|
|
150
|
+
| 4 | `title: '您有新消息'` / `title: '新的流程消息'` | 固定文案,无项目、无环节、无动作指向;多条待办在收件箱完全不可区分 | `title: 'ZD02制度修订/废止待处理:部门领导'`(流程 + 环节) |
|
|
151
|
+
| 5 | simple 模式把多段正文分别放在 `content[0]`、`content[1]` | 后端只读 `content[0].body`,后续内容全部丢失 | 合并为 `content: [{ body: '单号:...\n请审批' }]` |
|
|
152
|
+
| 6 | 该发消息的审批节点留空 `message_template` | 走默认文案"新的流程消息",看起来"配了"其实没有业务信息 | 写完整卡片;确实不需要通知的节点才用 `return "";` + ack |
|
|
153
|
+
|
|
154
|
+
## 4. `return "";` 的正确用法
|
|
155
|
+
|
|
156
|
+
`return "";` 是**显式禁发**,不是"占位"。返回空串后 `buildStepMessage` 判空直接 return,不再发送,也不会触发后端默认文案。留空串 `""`(空模板)反而会触发默认消息,两者语义完全相反。
|
|
157
|
+
|
|
158
|
+
什么时候该显式禁发:
|
|
159
|
+
|
|
160
|
+
- 系统自动节点、定时/数据回写节点、子流程父节点的汇总等待态(无真实办理人)。
|
|
161
|
+
- 中间过渡态:如"申请人修改"由创建人自己完成,且前置申请页已提示过,不需要再打扰。
|
|
162
|
+
- 已经从别的渠道通知过(例如插件已发飞书群消息),且主消息会重复刷屏。
|
|
163
|
+
|
|
164
|
+
什么时候不该用:
|
|
165
|
+
|
|
166
|
+
- 只要节点有真实办理人(审批人、填写人、矩阵/角色/字段取值算出的负责人),禁发会导致该人没有待办入口提醒。
|
|
167
|
+
- 用禁发来"绕过"消息模板没写完:这是把配置缺口藏起来。
|
|
168
|
+
|
|
169
|
+
门禁与 ack:
|
|
170
|
+
|
|
171
|
+
- 有真实办理人 + 静态禁发且没有 ack → lint hard error `[flow.message.suppression_requires_ack]`。
|
|
172
|
+
- 无真实办理人 + 静态禁发且没有 ack → warning `[flow.message.suppression_unacked]`,允许通过但要人工确认。
|
|
173
|
+
- 加 ack 后只剩说明性 warning `[flow.message.suppression_acked]`。
|
|
174
|
+
- 运行时可能返回空串(条件分支)→ warning `[flow.message.suppression_dynamic]`,必须运行态证明消息仍会发。
|
|
175
|
+
- ack 写在 work 文件的 `bpmax_lint.suppressed_node_messages[]`,每项 `{ node_id, channel, reason }`,`channel` 只能是 `message` 或 `cc`,`reason` 非空。
|
|
176
|
+
- ack 必须精确对应某个节点的静态空返回,且普通消息与抄送**互不抵扣**:只 ack 了 `cc`,普通消息仍然报错。
|
|
177
|
+
- ack 必须指向真实存在的节点 id,否则本身报错。
|
|
178
|
+
- **"静态禁发"不止 `return "";`**:`return;`、`return null;`、`return undefined;`、`return [];` 在运行期同样得到空值/空数组,`buildStepMessage` 判空后一样不发消息,所以走同一套 ack 门禁。存量里 `return;` 66 个、`return null` 51 个,以前几乎零告警。
|
|
179
|
+
- `return {};` 走另一条 error:`[flow.message.card_no_business_keys]`(见第 0 节),也可以用同一个 ack 声明为有意禁发。
|
|
180
|
+
- 上述 ack 门禁覆盖显式 `code` 模式,以及**没写模式但带非空 `message_template`** 的节点(后端同样按 code 执行)。`standard/simple` 模式的空字段走的是 `simple_field_missing_return` / `*_empty` 一类告警,不触发 ack 门禁。
|
|
181
|
+
|
|
182
|
+
流程级(meta)消息走各自的模式开关,没有节点 ack 可挂:
|
|
183
|
+
|
|
184
|
+
- 项目创建抄送:`data.meta.cc_message_template` + `project_cc_message_config_mode`,对象模式字段是 `project_cc_message_template_simple`。
|
|
185
|
+
- 项目结束通知项目负责人:源码读的字段名是拼错的 `notify_project_owner_on_end_message_tempalte`(`template` 少一个 `e`,后端 `project.ts` 与前端编辑器 v-model 都按这个拼写读写),对象模式字段是 `notify_project_owner_on_end_message_template_simple`。写成正确拼写 `..._template` 的模板不会被任何代码读取;本地镜像里有 13 处配置用了正确拼写且没有对应的拼错字段,属于"配了但不生效"。另外发送前还要求 `enable_notify_project_owner_on_end = true`,否则 `project.ts` 在读取模板之前就整段 return——此时无论模板写成 `standard` 还是 `simple` 都不会执行,lint 也不再对它报错(报"收件人只会收到默认消息"是错误诊断,会无谓挡住提交)。
|
|
186
|
+
- 结束节点通知:`meta.success_end_config` / `meta.fail_end_config` 里的 `message_template` + `project_end_message_config_mode`,且必须同时 `enable_end_message=true` 与 `notify_users` 非空才会发。
|
|
187
|
+
|
|
188
|
+
这几处要停发,就删掉模板或关掉对应的 `enable_*` 开关;它们没有节点 ack 可挂,写 `return "";` 只会得到一条空内容消息(项目创建抄送/结束通知的 `withDefault=false`,空内容会直接不发送,但这不是可审计的 ack)。
|
|
189
|
+
|
|
190
|
+
## 5. 这个环节到底要不要发消息
|
|
191
|
+
|
|
192
|
+
| 环节类型 | 判断 | 做法 |
|
|
193
|
+
| --- | --- | --- |
|
|
194
|
+
| 审批、审核、会签、确认、填写、修改 | 有人要处理 | 必须发,专业卡片 + 跳转按钮 |
|
|
195
|
+
| 转办目标环节 | 新负责人要处理 | 必须发;转办通知走 `step_transfer_message_template` 系列 |
|
|
196
|
+
| 归档、结束通知 | 有人需要知道结果 | 对申请人/负责人发完成通知,标题体现"已完成/已归档",用 `green` |
|
|
197
|
+
| 系统等待、汇总、子流程父节点(`auto_trigger_flows` 非空、`approve_count_required` 为 0/空) | 无真实办理人 | 不发;若平台会创建待办壳,才用 `return "";` + `suppressed_node_messages` ack |
|
|
198
|
+
| 纯自动节点(定时、回写、数据同步) | 无真实办理人 | 不发;不写模板即可,确需阻止平台默认消息时用 `return "";` + ack |
|
|
199
|
+
| 需要知会的下游角色(财务、仓库、HRBP 等) | 有人要知道,但不需要他办理 | 走抄送模板,不要把这些角色塞进主消息收件人 |
|
|
200
|
+
| 项目创建成功 | 申请人要知道已提交 | 用 `meta.cc_message_template` 或项目创建消息,不要靠节点消息代发 |
|
|
201
|
+
|
|
202
|
+
判断口径只有一句:**这个节点存在一个"必须打开系统才能推进"的人吗?** 有就发,没有就禁发或改抄送。
|
|
203
|
+
|
|
204
|
+
## 6. 抄送消息模板
|
|
205
|
+
|
|
206
|
+
抄送是独立字段,渲染链路与主消息完全相同,因此部分"抄送就是一句话"的写法不成立:
|
|
207
|
+
|
|
208
|
+
- 节点抄送:`cc_message_template` + `step_cc_message_config_mode`(`code`),或 `step_cc_message_template_simple` + `step_cc_message_config_mode: 'standard'`。
|
|
209
|
+
- 项目级抄送(项目创建时):`meta.cc_message_template` + `project_cc_message_config_mode`,对象模式字段 `project_cc_message_template_simple`。
|
|
210
|
+
- 项目结束通知项目负责人:字段名是拼错的 `notify_project_owner_on_end_message_tempalte`(+ `_template_simple`)配 `notify_project_owner_on_end_message_config_mode`,并要求 `enable_notify_project_owner_on_end=true`。
|
|
211
|
+
- 转办通知:`step_transfer_message_template` / `step_transfer_message_template_simple` + `step_transfer_message_config_mode`。
|
|
212
|
+
|
|
213
|
+
抄送卡片同样要满足第 2 节四要素,并且明确说明"为什么通知你":
|
|
214
|
+
|
|
215
|
+
- 标题:`抄送:XS02 销售订单变更 - 财务确认`,不要只写"抄送"或"流程抄送"。
|
|
216
|
+
- 正文:单号、项目名、当前环节、抄送原因(如"你作为财务需要关注付款信息")。
|
|
217
|
+
- 按钮:`查看项目`,指向项目详情或环节详情。
|
|
218
|
+
- 颜色:与主待办区分,用 `turquoise` / `purple`;不要用与主消息相同的待办色,避免用户误以为需要自己处理。
|
|
219
|
+
|
|
220
|
+
禁止的抄送内容:`已抄送你`、`流程已抄送`、仅一个项目名。这类消息没有信息量,属于噪声。
|
|
221
|
+
|
|
222
|
+
抄送与普通消息的禁发 ack 相互独立:`channel: 'cc'` 不能替 `channel: 'message'` 豁免。
|
|
223
|
+
|
|
224
|
+
## 7. 提交前自查
|
|
225
|
+
|
|
226
|
+
1. 结构:返回的是 `{ title, content, actions, ... }` 自有对象;不要写飞书 Card 2.0 的 `schema` / `body`。带了 `header`/`config` 不会被拦,但属于被忽略的多余键,lint 会给 warning。
|
|
227
|
+
2. 标题:含流程名或编号 + 环节名 / 业务动作,不是"新消息""待办提醒";simple 模式标题不能为空,否则后端用默认「新的流程消息」兜底。
|
|
228
|
+
3. 正文:有单号或项目名等定位信息,有一句"需要你做什么";simple 模式 `content[0].body` 不能为空,否则后端用默认文案兜底。code 模式 `content` 必须是字符串(数组会被塞进 `lark_md` 且渲染失败)。
|
|
229
|
+
4. 按钮:至少一个,文案具体,`url` 与 `m_url` 成对,带空值兜底;外链已加 `is_absolute`。code 模式按钮 `type` 不是 `link` 时仍会发送,但点击行为可能不符合预期,lint 会给 warning。
|
|
230
|
+
5. 颜色:按第 2.4 节选色,未使用 `grey` 承载关键待办;不写颜色时后端默认 `wathet`(推荐色),lint 不再因此告警。
|
|
231
|
+
6. 模式:对象模式写 `standard`,脚本模式写 `code`。**不要写 `simple`**:后端只判断 `message_config_mode === 'standard'`,写成 `simple` 的卡片不会生效,lint 直接报 error。
|
|
232
|
+
7. 必要性:每个禁发节点都在 `bpmax_lint.suppressed_node_messages[]` 有 `node_id` + `channel` + 非空 `reason`,且 ack 精确对应静态 `return "";`。
|
|
233
|
+
8. 抄送:独立检查,标题/正文/按钮达到同一标准,并说明抄送原因;`cc_type` 为 `role` / `user` 且选了接收人时同样必须有抄送模板。
|
|
234
|
+
9. 验证:先跑 `bpmax-cli config flow-template lint`,再用新样本项目触发该环节,在真实消息收件箱里看到卡片(标题、正文、按钮、颜色四项都对),才能宣称消息模板完成。
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
## data 结构
|
|
9
9
|
- `periods` 是否是数组
|
|
10
10
|
- `nodes` 是否是数组
|
|
11
|
+
- 最小结构硬门禁(无豁免):`periods` 至少一个非空名称的阶段,`nodes` 至少一个 `id` 和非空 `name` 都齐全的环节;否则 `lint/build/create/submit` 会在远端请求前阻断
|
|
12
|
+
- 只改 `meta` 或只改创建页时,是否误把既有阶段和节点清空
|
|
11
13
|
- 如存在 `meta`、`group`、`settings`,是否被意外删除
|
|
12
14
|
- `meta` 下已有 `project_name_template`、`object_events`、`hook`、`plugin_*` 是否被误删
|
|
13
15
|
- `meta` 是否仍保留发起入口语义:
|
|
@@ -57,6 +57,23 @@ return (function () {
|
|
|
57
57
|
- `form_template` 必须是当前环境远端数字 `id`,不能是本地 `uuid`、目录名或模板名。
|
|
58
58
|
- typed CLI lint 会阻断“standard/page + node.form_template + meta.form_template 为空”的配置。
|
|
59
59
|
|
|
60
|
+
## 创建页提交后不要再生成申请人首节点
|
|
61
|
+
- 表单驱动创建页本身已经承载申请填写与提交。项目初始化时,后端默认直接创建并进入 `data.nodes[0]`;`start_step=true` 或 `create_step=true` 主要是编辑器标记,不能可靠地把该节点视为已完成。
|
|
62
|
+
- 因此不要把由创建人办理的 `申请人`、`发起人`、`提交人` 节点放在 `data.nodes[0]`,再依赖它的 `condational_nodes` 去选择审批人。这会在创建成功后产生一条新的申请人待办,必须人工再次确认才能进入审批。
|
|
63
|
+
- 正确做法是把申请人节点上的创建期分流迁移到 `data.meta.condational_jump`,让每条规则直接返回创建后的真实首个审批节点 id,并在最后增加 `return true;` 的显式兜底。
|
|
64
|
+
- typed CLI semantic lint 会阻断以下高风险组合:已配置创建表单、首节点名称具有申请人/发起人/提交人语义、`owner_is_creater=true`,且 `data.meta.condational_jump` 为空或任一 `result` 仍指回该首节点。
|
|
65
|
+
- 如果业务明确要求“创建后由申请人二次确认”,可在本地 work 根节点声明:
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"bpmax_lint": {
|
|
70
|
+
"allow_post_create_initiator_step": true
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
- 这是 lint-only 豁免,不会进入提交 payload。使用豁免时必须在验收证据中说明二次确认的业务依据,并验证创建后确实应停留在申请人待办。
|
|
76
|
+
|
|
60
77
|
## 经验 1:脚本存在不等于校验生效
|
|
61
78
|
- BPMAX 后端通过 `parseEvalFunction()` 执行创建期脚本。
|
|
62
79
|
- 这类脚本不是直接 `eval` 结果,而是作为“函数体”包进去执行。
|
|
@@ -83,6 +83,11 @@
|
|
|
83
83
|
- `node.cc_user_by_script`
|
|
84
84
|
- “抄送消息自定义”
|
|
85
85
|
- `node.cc_message_template`
|
|
86
|
+
- “WEWF `signorder=4` / 确认型抄送 / acknowledged CC”
|
|
87
|
+
- 当前已验证的 BPMAX 节点字段没有“抄送人必须提交确认后才完成”的独立参与通道,必须标记 `cc_ack_not_supported` 并停止等价迁移。
|
|
88
|
+
- `need_confirm` 只控制环节负责人接收任务,不会把普通 CC 变成确认参与人。
|
|
89
|
+
- 不得降级成普通 CC,也不得提升成普通审批人;两者都会改变源流程的参与与完成语义。
|
|
90
|
+
- 只有平台 capability、typed export/readback 或插件契约明确出现对应参与通道后,才能补充映射并做运行态回测。
|
|
86
91
|
|
|
87
92
|
## 消息模板
|
|
88
93
|
- “节点完成后发通知”
|
|
@@ -136,14 +141,14 @@
|
|
|
136
141
|
- 同时存在“简单配置”和“脚本配置”两种实现时:
|
|
137
142
|
- 优先保留现有实现风格
|
|
138
143
|
- 不要把脚本型实现无故改成纯配置
|
|
139
|
-
- 如果本地目录里找到的是表单模板 `uuid` /
|
|
140
|
-
-
|
|
144
|
+
- 如果本地目录里找到的是表单模板 `uuid` / 目录引用,但 typed CLI export/readback 显示当前环境使用远端表单模板数字 `id`:
|
|
145
|
+
- 优先以 typed CLI 线上回读和当前环境接口返回为准
|
|
141
146
|
- 先把候选模板从本地目录定位出来,再解析成当前环境可提交的真实引用值
|
|
142
147
|
|
|
143
148
|
## 用法要求
|
|
144
149
|
- 这张表不是补充说明,而是主流程第 1 步到第 6 步之间的核心映射依据。
|
|
145
150
|
- 当意图模型里出现某条业务需求时,应先来这里找默认落点,再决定是否需要脚本、外链文件或页面模板联动。
|
|
146
151
|
- 如果这里没有明确覆盖某种需求:
|
|
147
|
-
-
|
|
152
|
+
- 先参考 typed CLI 当前线上回读
|
|
148
153
|
- 再参考 `sysconfig-n`
|
|
149
154
|
- 最后再做最小保守推断
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Runtime Verified Flow Detail Shape
|
|
2
2
|
|
|
3
|
-
基于当前 skill 已确认的
|
|
3
|
+
基于当前 skill 已确认的 typed CLI export/readback 和 verify 结果整理。
|
|
4
4
|
|
|
5
5
|
## 顶层共识
|
|
6
6
|
- `name`
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
- 常伴随 `FlowMap Invalid DIV id` 一类后续报错
|
|
24
24
|
|
|
25
25
|
## 当前闭环的使用方式
|
|
26
|
-
1.
|
|
27
|
-
- `
|
|
28
|
-
- `
|
|
29
|
-
2.
|
|
30
|
-
3.
|
|
26
|
+
1. 优先读取 typed CLI export/readback:
|
|
27
|
+
- `bpmax-cli config flow-template export --id <id> --profile <profile> --format json`
|
|
28
|
+
- `bpmax-cli config readback flow-template --id <id> --profile <profile> --format json`
|
|
29
|
+
2. 若 readback 返回空壳、残缺数据或与只读编辑器画布不一致,停止继续修改,先重新导出或恢复到最新可信草稿
|
|
30
|
+
3. 导出到本地 `work` 文件时统一转成:
|
|
31
31
|
- `basic.name`
|
|
32
32
|
- `basic.updateTime`
|
|
33
33
|
- `data.periods`
|
|
@@ -38,4 +38,4 @@
|
|
|
38
38
|
## 当前闭环不做的事
|
|
39
39
|
- 不在 `work` 阶段对 `data` 做抽象 DSL
|
|
40
40
|
- 不在 `submit` 阶段对 `data` 做最小化裁剪
|
|
41
|
-
-
|
|
41
|
+
- 不把页面运行时对象当成事实来源或写入基线
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Runtime Verified Meta Fields
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
基于历史流程编辑器运行时字段观察整理,用于解释流程 meta 字段背景;当前配置读取、构造和提交必须以 typed CLI export/build/verify/readback 为准。
|
|
4
4
|
|
|
5
5
|
## 适用范围
|
|
6
6
|
- 仅代表当前环境、当前前端版本、当前流程编辑器的已验证字段。
|
|
7
|
-
-
|
|
7
|
+
- 若其他环境或当前 typed CLI readback 不同,以当前 typed CLI export/readback 为准。
|
|
8
8
|
|
|
9
9
|
## 核心结论
|
|
10
10
|
- 保存草稿时主流程主体是:
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Runtime Verified Node Fields
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
基于当前 typed CLI export/readback 中的 `data.nodes` 和 verify 结果整理。
|
|
4
4
|
|
|
5
5
|
## 适用范围
|
|
6
6
|
- 仅代表当前环境已验证的节点字段集合。
|
|
7
|
-
-
|
|
7
|
+
- 节点字段总数会随插件和平台版本增加,遇到新字段以 typed CLI export/readback 为准。
|
|
8
8
|
|
|
9
9
|
## 当前页面已验证的高频字段
|
|
10
10
|
|
|
@@ -107,6 +107,12 @@
|
|
|
107
107
|
### `step_detail_id`
|
|
108
108
|
- 节点详情模板不是 `detail_template`,当前页面已验证使用 `step_detail_id`。
|
|
109
109
|
|
|
110
|
+
### 确认型抄送边界
|
|
111
|
+
- WEWF `signorder=4` 表示的确认型抄送当前没有已验证的 BPMAX 对等字段,迁移结论必须是 `cc_ack_not_supported`。
|
|
112
|
+
- `need_confirm` 是环节负责人接收任务的开关,不是抄送确认开关。
|
|
113
|
+
- `cc_user`、`cc_user_role` 可能存在于历史 export 字段中,但当前服务端已验证的有效普通 CC 运行模式只有 `cc_type=fieldvalue` + `cc_user_by_script` 和 `cc_type=matrix` + `cc_matrix`;普通 CC 不贡献确认完成。
|
|
114
|
+
- 不得用普通审批人替代确认型抄送,因为这会引入审批阈值、通过和拒绝语义。
|
|
115
|
+
|
|
110
116
|
### `attachment_required`
|
|
111
117
|
- 对应“配置附件要求”。
|
|
112
118
|
- 当前页未配置时为 `[]`,不是 `null`。
|
|
@@ -168,6 +174,10 @@
|
|
|
168
174
|
}
|
|
169
175
|
```
|
|
170
176
|
|
|
177
|
+
- 当 `flows` 非空且 `manual_end=false` 时,该节点默认是自动等待/汇总节点,`approve_count_required` 必须为 `0` 或空。
|
|
178
|
+
- 确需人工兜底时,在顶层 `bpmax_lint.manual_child_flow_fallbacks[]` 中按节点 ID/名称声明非空 `reason`,并配置带文案的 `approve_actions` 与可用拒绝目标;`bpmax_lint` 不进入提交 payload。
|
|
179
|
+
- 任意有效审批阈值都必须有可用拒绝目标,同意与拒绝目标归一化后不得相同。
|
|
180
|
+
|
|
171
181
|
### `beforeNextStepScript`
|
|
172
182
|
- 需要同时关注:
|
|
173
183
|
- `enableBeforeNextStepScript`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Save Draft Request Shape
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
基于历史流程编辑器保存草稿行为整理。本文只记录字段形态与兼容背景;不得把这里的历史接口示例或页面运行时对象当作配置写入路径。真实写入必须回到 `bpmax-cli config flow-template build/submit/verify`。
|
|
4
4
|
|
|
5
5
|
## 主流程保存草稿
|
|
6
6
|
|
|
@@ -35,26 +35,9 @@ Referer: /w:store_mgr/flow_editor_dark/beta?key_of_flow=flow352878207:
|
|
|
35
35
|
GET /api/flow?flow_type=flow352878207&draft=1&$workspace=store_mgr&$language=zhCN
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
##
|
|
38
|
+
## 历史编辑器背景
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
- `FlowEditorDark`
|
|
42
|
-
- `FlowEditorAsideLeft`
|
|
43
|
-
|
|
44
|
-
### 关键方法
|
|
45
|
-
- `FlowEditorDark.getSubmitData()`
|
|
46
|
-
- `FlowEditorDark.refresh()`
|
|
47
|
-
- `FlowEditorDark.getRemoteData()`
|
|
48
|
-
- `FlowEditorDark.formatRemoteData()`
|
|
49
|
-
- `FlowEditorAsideLeft.saveRemoteData()`
|
|
50
|
-
|
|
51
|
-
### 关键状态
|
|
52
|
-
- `flowTypeKey`
|
|
53
|
-
- `flowTypeName`
|
|
54
|
-
- `updateTime`
|
|
55
|
-
- `flowData`
|
|
56
|
-
- `graphData`
|
|
57
|
-
- `currentNode`
|
|
40
|
+
这些字段曾由流程编辑器运行时维护,但当前配置工作不得依赖页面运行时对象。需要确认字段时,优先使用 typed CLI export/readback、build 输出和 verify 结果。
|
|
58
41
|
|
|
59
42
|
## 当前页面确认到的结构特征
|
|
60
43
|
|
|
@@ -86,6 +69,7 @@ GET /api/flow?flow_type=flow352878207&draft=1&$workspace=store_mgr&$language=zhC
|
|
|
86
69
|
- `*_template_simple`
|
|
87
70
|
|
|
88
71
|
## 对 skill 的约束
|
|
89
|
-
-
|
|
90
|
-
-
|
|
91
|
-
-
|
|
72
|
+
- 这里的历史接口形态只用于理解平台保存草稿的字段背景,不是 Agent 可执行命令。
|
|
73
|
+
- 构造 submit payload 时应以 typed CLI `export/build` 输出和当前远端 readback 为准,而不是手写最小对象。
|
|
74
|
+
- 任何差量编辑都应在 typed CLI work 文件上修改,不能自行省略未知字段。
|
|
75
|
+
- 若文档与当前线上结构冲突,以 typed CLI export/readback 和 verify 结果为准。
|
|
@@ -42,6 +42,23 @@
|
|
|
42
42
|
- code-mode `message_template` 留空以为能阻止外发;实际会触发后端默认消息,必须显式写 `return "";`(空串是唯一合法的裸字符串返回值)
|
|
43
43
|
- code-mode 消息卡片按钮 URL 写成 `/projectContinue?id=${step?.project_id}&step_id=${step?.id}`,而不是 `return '/projectContinue?id=' + step.project_id + '&step_id=' + step.id;`
|
|
44
44
|
|
|
45
|
+
## 消息模板硬规则(补充五条)
|
|
46
|
+
|
|
47
|
+
专业卡片标准全量说明见 [message-card-professional-standard.md](message-card-professional-standard.md)。
|
|
48
|
+
|
|
49
|
+
- **禁止返回 Card 2.0 结构 / 禁止无业务键的返回对象**
|
|
50
|
+
- 判定标准:`message_template` / `cc_message_template` 的返回对象里 title/content/elements/actions 四个业务键**全部缺失**(含 `return {}`、`return { color: 'blue' }`、只带 `header`/`config`),或顶层出现 `schema`/`body` 却没有任何业务键,或把飞书 interactive card 的 `elements/column_set` 当成顶层结构直接 `return`。BPMAX 模板返回的是自有消息对象 `{ title, content, actions, color, messageType }`,不是飞书 Card JSON。单独出现 `header`/`config` 但仍有业务键,不影响发送(后端会忽略),只算冗余。返回对象里带 `spread` 或 `Object.assign` 的不可解析实参时,静态分析无法证明缺键,降为 warning 并要求人工确认。
|
|
51
|
+
- 修法:改成 `return { title: '流程名:环节名待处理', content: '单号:...\n请审批', actions: [{ type: 'link', btnType: 'primary', text: '查看并审批', url: ... , m_url: ... }], color: 'wathet', messageType: 'step' }`。多维内容放 `content` 字符串换行或 `elements`,不要套 Card 2.0。后端 `messageAdaptor` 会丢弃未知字段并判空,Card 2.0 只会静默不发。
|
|
52
|
+
- **禁止固定文案标题**
|
|
53
|
+
- 判定标准:`title` 是常量且**整句只有泛化词**,如 `您有新消息`、`新的流程消息`、`待办提醒`、`流程通知`;或 simple 模式 `title` 为空、靠后端默认值"新的流程消息"兜底。含流程编号(`CW08`/`ZD02`)、单据/流程类型词或环节名的固定标题是合格的,不告警。
|
|
54
|
+
- 修法:标题至少写「流程编号/名称 + 环节名」或「项目名 + 业务动作」,如 `return \`ZD02制度修订/废止待处理:${step.name}\`;`;标题里用到的变量必须能取到值,避免渲染成空串或 `undefined`。
|
|
55
|
+
- **simple/standard 字段必须是带 return 的脚本**
|
|
56
|
+
- 判定标准:后端 `parseTemplateString` 把 `title`、`content[i].body`、`actions[].url`/`m_url` 当**函数体** eval;写成普通字面量(如 `title: "采购审批待处理"`,没有 `return`)时函数体没有返回值,运行时得到空串。lint 报 `flow.message.simple_field_missing_return`,并连带触发 `card_title_empty`/`card_content_empty` 或 `missing_for_human_node`。
|
|
57
|
+
- 修法:写成 `return "采购审批待处理"` 或 `` return `采购审批待处理:${step.name}` ``。simple 模式 `actions[].type` 写 `link` 是合法的。
|
|
58
|
+
- **有真实办理人的节点必须有消息模板**
|
|
59
|
+
- 判定标准:节点有真实办理人(审批/填写/确认,或 `owner_is_creater`、`owner_roles`、`auto_range_*` 能算出人)时,`message_template` 为空、或静态禁发(`return "";`、`return;`、`return null;`、`return undefined;`、`return [];`)且 `bpmax_lint.suppressed_node_messages[]` 里没有对应 `channel: 'message'` 的 ack。留空模板会触发后端默认文案,静默禁发会让办理人收不到待办提醒。
|
|
60
|
+
- 修法:补完整卡片并至少给一个跳转按钮;确实不能通知时,在 work 的 `bpmax_lint.suppressed_node_messages[]` 写 `{ node_id, channel: 'message', reason: '<业务原因>' }`,并同步确认抄送渠道已覆盖该角色的知会需求。
|
|
61
|
+
|
|
45
62
|
## 前端失焦查重专项核查
|
|
46
63
|
- 任何 `customeValidate`、字段级 `blur` 校验、前端 `fetch`/`$axios` 查重脚本,都必须额外确认调用的是只读接口。
|
|
47
64
|
- 不要因为接口名里有 `search` / `check` / `validate` 就默认它无副作用;先到对应 controller 看这个 action 是否真的实现。
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import json
|
|
2
|
-
import os
|
|
3
2
|
import sys
|
|
4
3
|
import tempfile
|
|
5
4
|
import unittest
|
|
6
5
|
from pathlib import Path
|
|
7
|
-
from unittest import mock
|
|
8
6
|
|
|
9
7
|
|
|
10
8
|
SCRIPT_DIR = Path(__file__).resolve().parents[1] / "scripts"
|
|
@@ -12,8 +10,6 @@ if str(SCRIPT_DIR) not in sys.path:
|
|
|
12
10
|
sys.path.insert(0, str(SCRIPT_DIR))
|
|
13
11
|
|
|
14
12
|
from flow_template_editor_common import ( # noqa: E402
|
|
15
|
-
ApiClient,
|
|
16
|
-
build_client,
|
|
17
13
|
build_drift_report,
|
|
18
14
|
build_submit_payload,
|
|
19
15
|
detail_to_work_payload,
|
|
@@ -536,91 +532,39 @@ class FlowTemplateEditorCommonTests(unittest.TestCase):
|
|
|
536
532
|
self.assertEqual(normalized["name"], "ST销售出库")
|
|
537
533
|
self.assertEqual(normalized["update_time"], "2026-04-22 16:58:41")
|
|
538
534
|
|
|
539
|
-
def
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
cookie_header="token=demo",
|
|
545
|
-
timeout=30,
|
|
546
|
-
)
|
|
547
|
-
self.assertEqual(
|
|
548
|
-
client._build_url("/api/flow?flow_type=flow352878207&draft=1&skip_i18n=true"),
|
|
549
|
-
"https://bpmax.example.com/api/flow?flow_type=flow352878207&draft=1&skip_i18n=true&$workspace=store_mgr&$language=zhCN",
|
|
550
|
-
)
|
|
551
|
-
|
|
552
|
-
def test_publish_flow_uses_publish_1_endpoint(self) -> None:
|
|
553
|
-
client = ApiClient(
|
|
554
|
-
base_url="https://bpmax.example.com",
|
|
555
|
-
workspace="store_mgr",
|
|
556
|
-
language="zhCN",
|
|
557
|
-
cookie_header="token=demo",
|
|
558
|
-
timeout=30,
|
|
559
|
-
)
|
|
560
|
-
with mock.patch.object(client, "request", return_value={"code": 0}) as request:
|
|
561
|
-
client.publish_flow(
|
|
562
|
-
flow_type="flow352878207",
|
|
563
|
-
update_time="2026-04-02 20:48:50",
|
|
564
|
-
body={"name": "ST销售出库", "data": {}},
|
|
565
|
-
)
|
|
566
|
-
request.assert_called_once()
|
|
567
|
-
self.assertIn("publish=1", request.call_args.args[1])
|
|
535
|
+
def test_publish_guidance_uses_typed_cli_publish_live(self) -> None:
|
|
536
|
+
skill_path = Path(__file__).resolve().parents[1] / "SKILL.md"
|
|
537
|
+
content = skill_path.read_text(encoding="utf-8")
|
|
538
|
+
self.assertIn("必须通过 typed CLI 的 `--publish-live` 路径执行", content)
|
|
539
|
+
self.assertIn("不要手动调用 `PUT /api/flow`", content)
|
|
568
540
|
|
|
569
541
|
def test_legacy_submit_script_is_disabled(self) -> None:
|
|
570
542
|
with self.assertRaises(SystemExit) as ctx:
|
|
571
543
|
__import__("submit_flow_template")
|
|
572
544
|
self.assertEqual(ctx.exception.code, 2)
|
|
573
545
|
|
|
574
|
-
def
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
"base_url": None,
|
|
580
|
-
"workspace": "store_mgr",
|
|
581
|
-
"language": "zhCN",
|
|
582
|
-
"cookie_header": "token=demo",
|
|
583
|
-
"timeout": 30,
|
|
584
|
-
"insecure": False,
|
|
585
|
-
},
|
|
586
|
-
)()
|
|
587
|
-
with mock.patch.dict(os.environ, {"BPMAX_BASE_URL": "https://bpmax.example.com/"}, clear=False):
|
|
588
|
-
client = build_client(args)
|
|
589
|
-
self.assertEqual(client.base_url, "https://bpmax.example.com")
|
|
590
|
-
|
|
591
|
-
def test_build_client_requires_runtime_origin_when_not_explicitly_configured(self) -> None:
|
|
592
|
-
args = type(
|
|
593
|
-
"Args",
|
|
594
|
-
(),
|
|
595
|
-
{
|
|
596
|
-
"base_url": None,
|
|
597
|
-
"workspace": "store_mgr",
|
|
598
|
-
"language": "zhCN",
|
|
599
|
-
"cookie_header": "token=demo",
|
|
600
|
-
"timeout": 30,
|
|
601
|
-
"insecure": False,
|
|
602
|
-
},
|
|
603
|
-
)()
|
|
604
|
-
with mock.patch.dict(os.environ, {}, clear=True):
|
|
605
|
-
with self.assertRaises(SystemExit) as ctx:
|
|
606
|
-
build_client(args)
|
|
607
|
-
self.assertIn("BPMAX_BASE_URL", str(ctx.exception))
|
|
546
|
+
def test_skill_forbids_browser_credentials_for_config_writes(self) -> None:
|
|
547
|
+
skill_path = Path(__file__).resolve().parents[1] / "SKILL.md"
|
|
548
|
+
content = skill_path.read_text(encoding="utf-8")
|
|
549
|
+
self.assertIn("配置写入只使用 CLI profile/auth/capability", content)
|
|
550
|
+
self.assertIn("不得读取或复用浏览器凭据、浏览器存储或手工请求头", content)
|
|
608
551
|
|
|
609
552
|
def test_skill_references_exist(self) -> None:
|
|
610
553
|
skill_path = Path(__file__).resolve().parents[1] / "SKILL.md"
|
|
611
554
|
content = skill_path.read_text(encoding="utf-8")
|
|
612
555
|
expected = [
|
|
613
|
-
"
|
|
614
|
-
"
|
|
615
|
-
"
|
|
616
|
-
"
|
|
556
|
+
"bpmax-cli config flow-template export",
|
|
557
|
+
"bpmax-cli config flow-template lint",
|
|
558
|
+
"bpmax-cli config flow-template build",
|
|
559
|
+
"bpmax-cli config flow-template submit",
|
|
560
|
+
"bpmax-cli config flow-template verify",
|
|
561
|
+
"references/full-detail-guide.md",
|
|
617
562
|
"references/local-temp-workflow.md",
|
|
618
563
|
"references/work-file-to-submit-mapping.md",
|
|
619
564
|
".codex/tmp/flow-template-editor/",
|
|
620
|
-
"
|
|
621
|
-
"
|
|
622
|
-
"
|
|
623
|
-
"仍需人工确认",
|
|
565
|
+
"不得直接编辑 `think_*/`",
|
|
566
|
+
"required-collateral",
|
|
567
|
+
"workspace_binding",
|
|
624
568
|
]
|
|
625
569
|
for item in expected:
|
|
626
570
|
self.assertIn(item, content)
|