@qingflow-tech/qingflow-cli 1.1.2 → 1.1.34
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 +2 -2
- package/docs/local-agent-install.md +10 -0
- package/package.json +1 -1
- package/pyproject.toml +1 -1
- package/skills/qingflow-cli/SKILL.md +61 -47
- package/skills/qingflow-cli/manifest.yaml +1 -1
- package/skills/qingflow-cli/reference/00-INDEX.md +35 -0
- package/skills/qingflow-cli/reference/QINGFLOW_CLI_BUILDER_APP_DELIVERY_WORKFLOW.md +21 -477
- package/skills/qingflow-cli/reference/QINGFLOW_CLI_BUILDER_VIEWS_WORKFLOW.md +44 -290
- package/skills/qingflow-cli/reference/QINGFLOW_CLI_SCHEMA_APPLY_FIELD_TYPES_AND_SCENARIOS.md +11 -102
- package/skills/qingflow-cli/reference/builder/10-build-single-app.md +57 -0
- package/skills/qingflow-cli/reference/builder/20-build-complete-system.md +84 -0
- package/skills/qingflow-cli/reference/builder/30-schema-fields.md +317 -0
- package/skills/qingflow-cli/reference/builder/40-layout.md +70 -0
- package/skills/qingflow-cli/reference/builder/50-views.md +540 -0
- package/skills/qingflow-cli/reference/builder/60-charts.md +328 -0
- package/skills/qingflow-cli/reference/builder/70-portal.md +372 -0
- package/skills/qingflow-cli/reference/builder/80-buttons-associated-resources.md +148 -0
- package/skills/qingflow-cli/reference/builder/90-workflow.md +35 -0
- package/skills/qingflow-cli/reference/builder/99-publish-verify.md +64 -0
- package/skills/qingflow-cli/reference/builder/README.md +62 -0
- package/skills/qingflow-cli/reference/builder/code-integrations/README.md +130 -0
- package/skills/qingflow-cli/reference/builder/code-integrations/code-block.md +66 -0
- package/skills/qingflow-cli/reference/builder/code-integrations/q-linker.md +77 -0
- package/skills/qingflow-cli/reference/builder/reference/app-delivery-sop.md +508 -0
- package/skills/qingflow-cli/reference/builder/reference/match-rules.md +229 -0
- package/skills/qingflow-cli/reference/builder/reference/workspace-icons.md +89 -0
- package/skills/qingflow-cli/reference/builder/workflow/01-overview.md +48 -0
- package/skills/qingflow-cli/reference/builder/workflow/02-update-mode.md +63 -0
- package/skills/qingflow-cli/reference/builder/workflow/03-flow-patterns.md +59 -0
- package/skills/qingflow-cli/reference/builder/workflow/04-stage1-business-modeling.md +131 -0
- package/skills/qingflow-cli/reference/builder/workflow/05-stage2-members-roles.md +29 -0
- package/skills/qingflow-cli/reference/builder/workflow/06-stage3-build-spec.md +211 -0
- package/skills/qingflow-cli/reference/builder/workflow/07-stage4-validate-spec.md +36 -0
- package/skills/qingflow-cli/reference/builder/workflow/08-stage5-apply-verify.md +66 -0
- package/skills/qingflow-cli/reference/builder/workflow/09-stage6-summary.md +88 -0
- package/skills/qingflow-cli/reference/builder/workflow/10-node-config-reference.md +93 -0
- package/skills/qingflow-cli/reference/builder/workflow/11-troubleshooting.md +18 -0
- package/skills/qingflow-cli/reference/builder/workflow/README.md +88 -0
- package/skills/qingflow-cli/reference/builder/workflow/workflow-schema.json +1754 -0
- package/skills/qingflow-cli/reference/charts_upsert_dashboard_starter.example.json +81 -0
- package/skills/qingflow-cli/reference/core/QINGFLOW_CLI_ADMIN_CHEATSHEET.md +94 -0
- package/skills/qingflow-cli/reference/core/QINGFLOW_CLI_DATA_RETRIEVAL_WORKFLOW.md +139 -0
- package/skills/qingflow-cli/reference/core/QINGFLOW_CLI_EXPLORATION_REPORT.md +84 -0
- package/skills/qingflow-cli/reference/core/QINGFLOW_CLI_FIELD_DATA_TYPES.md +129 -0
- package/skills/qingflow-cli/reference/core/QINGFLOW_CLI_MEMBER_CHEATSHEET.md +195 -0
- package/skills/qingflow-cli/reference/core/QINGFLOW_CLI_ONE_SHOT_CHEATSHEET.md +159 -0
- package/skills/qingflow-cli/reference/examples/README.md +17 -0
- package/skills/qingflow-cli/reference/examples/associated/associated_resources_semantic_full.example.json +50 -0
- package/skills/qingflow-cli/reference/examples/buttons/custom_buttons_advanced.example.json +56 -0
- package/skills/qingflow-cli/reference/examples/charts/charts_remove.example.json +1 -0
- package/skills/qingflow-cli/reference/examples/charts/charts_reorder.example.json +1 -0
- package/skills/qingflow-cli/reference/examples/charts/charts_upsert_bar.example.json +8 -0
- package/skills/qingflow-cli/reference/examples/charts/charts_upsert_dashboard_starter.example.json +118 -0
- package/skills/qingflow-cli/reference/examples/charts/charts_upsert_minimal.example.json +13 -0
- package/skills/qingflow-cli/reference/examples/layout/layout_sections_full.example.json +22 -0
- package/skills/qingflow-cli/reference/examples/portal/portal_sections_all_types.example.json +145 -0
- package/skills/qingflow-cli/reference/examples/portal/portal_sections_five_types.example.json +126 -0
- package/skills/qingflow-cli/reference/examples/portal/portal_sections_standard_workbench.example.json +178 -0
- package/skills/qingflow-cli/reference/examples/record/record_insert_all_field_types.example.json +35 -0
- package/skills/qingflow-cli/reference/examples/schema/_batch_schema_complex.json +18 -0
- package/skills/qingflow-cli/reference/examples/schema/_batch_schema_scalar.json +17 -0
- package/skills/qingflow-cli/reference/examples/schema/schema_add_fields_minimal.example.json +7 -0
- package/skills/qingflow-cli/reference/examples/schema/schema_apply_add_fields_all_types.json +78 -0
- package/skills/qingflow-cli/reference/examples/schema/schema_multi_app_form_relation_layout.example.json +166 -0
- package/skills/qingflow-cli/reference/examples/schema/schema_single_app_form_standard.example.json +95 -0
- package/skills/qingflow-cli/reference/examples/views/views_batch_full.example.json +159 -0
- package/skills/qingflow-cli/reference/examples/views/views_upsert_table_minimal.example.json +42 -0
- package/skills/qingflow-cli/reference/portal_sections_all_types.example.json +18 -4
- package/skills/qingflow-cli/reference/portal_sections_five_types.example.json +3 -3
- package/skills/qingflow-cli/reference/portal_sections_standard_workbench.example.json +57 -7
- package/skills/qingflow-cli/reference/record/QINGFLOW_CLI_RECORD_CREATE_WORKFLOW.md +22 -0
- package/skills/qingflow-cli/reference/record/QINGFLOW_CLI_RECORD_DELETE_WORKFLOW.md +31 -0
- package/skills/qingflow-cli/reference/record/QINGFLOW_CLI_RECORD_IMPORT_WORKFLOW.md +176 -0
- package/skills/qingflow-cli/reference/record/QINGFLOW_CLI_RECORD_UPDATE_WORKFLOW.md +167 -0
- package/skills/qingflow-cli/reference/record/analysis/README.md +130 -0
- package/skills/qingflow-cli/reference/record/analysis/analysis-gotchas.md +91 -0
- package/skills/qingflow-cli/reference/record/analysis/analysis-patterns.md +112 -0
- package/skills/qingflow-cli/reference/record/analysis/business-context.md +74 -0
- package/skills/qingflow-cli/reference/record/analysis/confidence-reporting.md +69 -0
- package/skills/qingflow-cli/reference/record/analysis/data-access-playbook.md +106 -0
- package/skills/qingflow-cli/reference/record/analysis/pandas-recipes.md +172 -0
- package/skills/qingflow-cli/reference/record/analysis/report-format.md +76 -0
- package/skills/qingflow-cli/reference/record/insert/README.md +125 -0
- package/skills/qingflow-cli/reference/schema_apply_add_fields_all_types.json +1 -1
- package/skills/qingflow-cli/reference/task/QINGFLOW_CLI_TASK_CONTEXT_WORKFLOW.md +153 -0
- package/skills/qingflow-cli/reference/task/ops/README.md +134 -0
- package/skills/qingflow-cli/reference/task/ops/environments.md +43 -0
- package/skills/qingflow-cli/reference/task/ops/workflow-usage.md +29 -0
- package/skills/qingflow-cli/reference/views_upsert_table_minimal.example.json +42 -7
- package/skills/qingflow-cli/scripts/validate_system_build_summary.py +124 -0
- package/skills/qingflow-cli/scripts/workflow/diff_flow_spec.py +275 -0
- package/skills/qingflow-cli/scripts/workflow/validate_flow_spec.py +627 -0
- package/src/qingflow_mcp/builder_facade/models.py +413 -119
- package/src/qingflow_mcp/builder_facade/service.py +4238 -666
- package/src/qingflow_mcp/cli/commands/builder.py +232 -75
- package/src/qingflow_mcp/cli/main.py +34 -0
- package/src/qingflow_mcp/public_surface.py +10 -0
- package/src/qingflow_mcp/server_app_builder.py +62 -34
- package/src/qingflow_mcp/solution/compiler/workflow_compiler.py +173 -0
- package/src/qingflow_mcp/solution/executor.py +2 -0
- package/src/qingflow_mcp/tools/ai_builder_tools.py +2649 -457
- package/src/qingflow_mcp/tools/record_tools.py +23 -11
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
# 阶段 3:获取 Schema + 构建流程输入
|
|
2
|
+
|
|
3
|
+
## 3.1 获取当前工作流 Schema
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
qingflow builder flow schema --json > tmp/flow_schema.json
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
> 注意:若已在阶段 1 前执行过,可复用。建议每次搭建前刷新以获取最新 schema。
|
|
10
|
+
|
|
11
|
+
## 3.2 读取现有 Flow Spec(更新模式下必须执行)
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
qingflow --json builder flow get --app-key <APP_KEY> > tmp/current_flow.json
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
从返回的 `spec` 中提取 `nodes` 和 `edges` 作为修改基础。
|
|
18
|
+
|
|
19
|
+
**更新模式下**:如果走 `patch_nodes[]`,直接使用读回的 `spec.nodes[].id` 做局部修改;如果提交完整 `--spec-file`,用 diff 脚本确认变更范围是否符合预期:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
python3 scripts/workflow/diff_flow_spec.py tmp/current_flow.json tmp/flow_spec.json
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
新建场景可跳过此步。
|
|
26
|
+
|
|
27
|
+
## 3.3 主路径:构建 WorkflowSpec
|
|
28
|
+
|
|
29
|
+
`--spec-file` 用于已经从 `builder flow schema` / `builder flow get` 读回并理解的 WorkflowSpec。节点结构、节点 id、负责人、字段权限和边条件都以 schema/readback 为准。
|
|
30
|
+
|
|
31
|
+
所有需要继续向下路由的节点都显式写 `sync: true`。Q-Robot 也在 WorkflowSpec 中表达为 `type: "automation"`,由 `attrs.subType` 选择具体能力。
|
|
32
|
+
|
|
33
|
+
WorkflowSpec 示例:
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"nodes": [
|
|
38
|
+
{
|
|
39
|
+
"id": "n1",
|
|
40
|
+
"type": "applicant",
|
|
41
|
+
"name": "员工提交申请",
|
|
42
|
+
"sync": true,
|
|
43
|
+
"attrs": {}
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"id": "n2",
|
|
47
|
+
"type": "approval",
|
|
48
|
+
"name": "部门经理审批",
|
|
49
|
+
"sync": true,
|
|
50
|
+
"attrs": {
|
|
51
|
+
"responsible": [
|
|
52
|
+
{"type": "role", "roleId": 123}
|
|
53
|
+
],
|
|
54
|
+
"approveType": "or_signed",
|
|
55
|
+
"auditUserType": "role",
|
|
56
|
+
"revert": true,
|
|
57
|
+
"revertScope": "all",
|
|
58
|
+
"transferScope": "all"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"id": "g1",
|
|
63
|
+
"type": "gateway",
|
|
64
|
+
"name": "服务类型判断",
|
|
65
|
+
"sync": true,
|
|
66
|
+
"attrs": {"mode": "parallel"}
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"id": "n3",
|
|
70
|
+
"type": "filling",
|
|
71
|
+
"name": "补充信息",
|
|
72
|
+
"sync": true,
|
|
73
|
+
"attrs": {
|
|
74
|
+
"responsible": [
|
|
75
|
+
{"type": "user", "uid": 456}
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"id": "n4",
|
|
81
|
+
"type": "approval",
|
|
82
|
+
"name": "技术服务审批",
|
|
83
|
+
"sync": true,
|
|
84
|
+
"attrs": {
|
|
85
|
+
"responsible": [
|
|
86
|
+
{"type": "role", "roleId": 456}
|
|
87
|
+
],
|
|
88
|
+
"approveType": "or_signed",
|
|
89
|
+
"auditUserType": "role"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"id": "g2",
|
|
94
|
+
"type": "gateway",
|
|
95
|
+
"name": "分支汇合",
|
|
96
|
+
"sync": true,
|
|
97
|
+
"attrs": {"mode": "join"}
|
|
98
|
+
}
|
|
99
|
+
],
|
|
100
|
+
"edges": {
|
|
101
|
+
"edges": [
|
|
102
|
+
{"from": "n1", "to": "n2"},
|
|
103
|
+
{"from": "n2", "to": "g1"},
|
|
104
|
+
{
|
|
105
|
+
"from": "g1",
|
|
106
|
+
"to": "n3",
|
|
107
|
+
"label": "客诉",
|
|
108
|
+
"condition": {
|
|
109
|
+
"kind": "rules",
|
|
110
|
+
"autoJudges": [
|
|
111
|
+
[
|
|
112
|
+
{
|
|
113
|
+
"fieldId": 343290994,
|
|
114
|
+
"fieldType": "single_select",
|
|
115
|
+
"matchType": "literal",
|
|
116
|
+
"judgeType": "equals",
|
|
117
|
+
"values": ["客诉"]
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"from": "g1",
|
|
125
|
+
"to": "n4",
|
|
126
|
+
"label": "技术服务",
|
|
127
|
+
"condition": {
|
|
128
|
+
"kind": "rules",
|
|
129
|
+
"autoJudges": [
|
|
130
|
+
[
|
|
131
|
+
{
|
|
132
|
+
"fieldId": 343290994,
|
|
133
|
+
"fieldType": "single_select",
|
|
134
|
+
"matchType": "literal",
|
|
135
|
+
"judgeType": "equals",
|
|
136
|
+
"values": ["技术服务"]
|
|
137
|
+
}
|
|
138
|
+
]
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
{"from": "n3", "to": "g2"},
|
|
143
|
+
{"from": "n4", "to": "g2"}
|
|
144
|
+
]
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## WorkflowSpec 节点类型速查
|
|
150
|
+
|
|
151
|
+
| type | 说明 | 必要 attrs |
|
|
152
|
+
|------|------|-----------|
|
|
153
|
+
| `applicant` | 工作流入口(仅1个) | 可选: `commentStatus`, `submitText`, `fieldPermissions` |
|
|
154
|
+
| `approval` | 审批节点 | `responsible`, `approveType`, `auditUserType` |
|
|
155
|
+
| `filling` | 填写节点 | `responsible` |
|
|
156
|
+
| `gateway` | 分支/汇合 | `mode`: `parallel`(分支)或 `join`(汇合) |
|
|
157
|
+
| `cc` | 抄送节点 | `receivers` |
|
|
158
|
+
| `automation` | 自动化/Q-Robot | `subType` + 对应配置 |
|
|
159
|
+
|
|
160
|
+
## 边条件体系
|
|
161
|
+
|
|
162
|
+
本节属于 `--spec-file` WorkflowSpec 路径。不要凭记忆手写 `autoJudges`、`judgeType` 或 raw `fieldId` 条件;先读 `builder flow schema` / `builder flow get`,再按读回结构修改。
|
|
163
|
+
|
|
164
|
+
| condition.kind | 含义 | 要求 |
|
|
165
|
+
|---------------|------|------|
|
|
166
|
+
| `rules` | 条件选路 | 必须含 `autoJudges`(OR-of-AND 二维数组) |
|
|
167
|
+
| `default` | 兜底边 | 无 `autoJudges` |
|
|
168
|
+
| 省略 | 无条件线性边 | — |
|
|
169
|
+
|
|
170
|
+
## autoJudges 结构
|
|
171
|
+
|
|
172
|
+
OR-of-AND 二维数组:
|
|
173
|
+
|
|
174
|
+
```json
|
|
175
|
+
"autoJudges": [
|
|
176
|
+
[ // OR 组 1
|
|
177
|
+
{"fieldId": N, "fieldType": "single_select", "matchType": "literal", "judgeType": "equals", "values": ["选项"]}
|
|
178
|
+
],
|
|
179
|
+
[ // OR 组 2
|
|
180
|
+
{"fieldId": M, "fieldType": "single_select", "matchType": "literal", "judgeType": "equals", "values": ["另一个选项"]}
|
|
181
|
+
]
|
|
182
|
+
]
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
**关键约束:`autoJudges` 必须是 `[[{...}]]` 二维数组!一维数组 `[{...}]` 格式会被后端静默吞掉。**
|
|
186
|
+
|
|
187
|
+
**judgeType 常用值**:`equals`, `not_equals`, `equals_any`, `includes`, `greater_than` 等(共21种,详见 schema)。
|
|
188
|
+
|
|
189
|
+
## 3.4 局部修改 patch_nodes
|
|
190
|
+
|
|
191
|
+
局部修改现有流程时,先 `builder flow get`,使用读回 `spec.nodes[].id`:
|
|
192
|
+
|
|
193
|
+
```json
|
|
194
|
+
[
|
|
195
|
+
{"id": "89160906", "set": {"name": "需求评审(局部改)"}}
|
|
196
|
+
]
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
qingflow --json builder flow apply \
|
|
201
|
+
--app-key <APP_KEY> \
|
|
202
|
+
--patch-nodes-file tmp/flow_patch_nodes.json \
|
|
203
|
+
--publish \
|
|
204
|
+
> tmp/flow_patch_apply.json
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
← 上一步:[05-stage2-members-roles.md](05-stage2-members-roles.md)
|
|
210
|
+
← 返回主流程:[../SKILL.md](../../../SKILL.md)
|
|
211
|
+
→ 下一步:[07-stage4-validate-spec.md](07-stage4-validate-spec.md)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# 阶段 4:验证流程输入
|
|
2
|
+
|
|
3
|
+
主链路 `--spec-file` 使用本 Skill 自带的 WorkflowSpec 验证脚本;局部修改 `patch_nodes[]` 至少检查节点 id 来自 `builder flow get` 读回,且 `set/unset` 只包含要改的字段。
|
|
4
|
+
|
|
5
|
+
WorkflowSpec 验证命令:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# WorkflowSpec 新建模式
|
|
9
|
+
python3 scripts/workflow/validate_flow_spec.py \
|
|
10
|
+
tmp/flow_spec.json --schema tmp/flow_schema.json
|
|
11
|
+
|
|
12
|
+
# WorkflowSpec 更新模式(同时校验最小修改原则)
|
|
13
|
+
python3 scripts/workflow/validate_flow_spec.py \
|
|
14
|
+
tmp/flow_spec.json --schema tmp/flow_schema.json --previous tmp/current_flow.json
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## 验证内容
|
|
18
|
+
|
|
19
|
+
1. JSON Schema 结构校验(基于 `qingflow builder flow schema` 的官方 schema)
|
|
20
|
+
2. DAG 无环检查
|
|
21
|
+
3. 单 applicant 节点检查
|
|
22
|
+
4. Gateway 出边条件完整性检查(rules 边必须有 autoJudges)
|
|
23
|
+
5. 审批/填写/抄送节点必要字段检查
|
|
24
|
+
6. 自动化节点配置检查
|
|
25
|
+
7. 孤立节点检查
|
|
26
|
+
8. 入口节点和需要继续路由的节点显式 `sync: true`
|
|
27
|
+
|
|
28
|
+
## 验证不通过时的处理
|
|
29
|
+
|
|
30
|
+
WorkflowSpec 根据验证脚本错误修正 spec,重新验证,直到全部通过再进入 apply。
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
← 上一步:[06-stage3-build-spec.md](06-stage3-build-spec.md)
|
|
35
|
+
← 返回主流程:[../SKILL.md](../../../SKILL.md)
|
|
36
|
+
→ 下一步:[08-stage5-apply-verify.md](08-stage5-apply-verify.md)
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# 阶段 5:Apply + 验证循环
|
|
2
|
+
|
|
3
|
+
## 5.1 部署工作流
|
|
4
|
+
|
|
5
|
+
推荐主链路:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
qingflow --json builder flow apply \
|
|
9
|
+
--app-key <APP_KEY> \
|
|
10
|
+
--spec-file tmp/flow_spec.json \
|
|
11
|
+
--publish \
|
|
12
|
+
> tmp/flow_apply.json
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
局部修改已存在节点:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
qingflow --json builder flow apply \
|
|
19
|
+
--app-key <APP_KEY> \
|
|
20
|
+
--patch-nodes-file tmp/flow_patch_nodes.json \
|
|
21
|
+
--publish \
|
|
22
|
+
> tmp/flow_patch_apply.json
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### 解读响应
|
|
26
|
+
|
|
27
|
+
- `status: success` → 进入验证
|
|
28
|
+
- `status: failed` → 查看 `error_code` / `message` / `blocking_issues`,修正后重试
|
|
29
|
+
- `missing_input_node_ids` 警告(新建时常见)→ 可忽略,是正常现象
|
|
30
|
+
- 成功写入应读取 `write_executed=true`、`write_succeeded=true`、`safe_to_retry=false`;不要因中间读回 pending 立刻重放。
|
|
31
|
+
|
|
32
|
+
## 5.2 验证部署结果
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
qingflow --json builder flow get --app-key <APP_KEY> > tmp/deployed_flow.json
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### 逐项对比
|
|
39
|
+
|
|
40
|
+
1. **节点数量与类型**:`nodes` 数量是否一致,每个节点的 `type` 和 `name` 是否正确
|
|
41
|
+
2. **边连通性**:`edges` 数量是否一致,`from`/`to` 关系是否正确
|
|
42
|
+
- 必须确认 `applicant` 入口节点存在出边,不能只停留在“提交申请”
|
|
43
|
+
3. **分支条件**(WorkflowSpec 路径):每个 gateway 出边是否有正确的 `autoJudges`
|
|
44
|
+
- 检查 `condition.kind` 是否为 `rules`
|
|
45
|
+
- 检查 `autoJudges` 中的 `fieldId`、`judgeType`、`values` 是否正确
|
|
46
|
+
- **`autoJudges` 必须是非空二维数组 `[[{...}]]`,空数组或一维数组说明条件未生效**
|
|
47
|
+
4. **自动化节点**:`automation` 节点的 `subType`、`appKey`、`fieldMappings` 等是否正确
|
|
48
|
+
- 必要时拉取其他应用数据验证:`qingflow --json builder app get --app-key <目标APP_KEY> fields`
|
|
49
|
+
5. **审批节点**:`responsible`、`approveType`、`revert` 等是否与建模一致
|
|
50
|
+
|
|
51
|
+
## 5.3 不一致时的循环
|
|
52
|
+
|
|
53
|
+
若验证发现不一致:
|
|
54
|
+
1. 分析差异原因(条件格式错误、节点缺失、边遗漏等)
|
|
55
|
+
2. 主路径修正 `tmp/flow_spec.json` 或 `tmp/flow_patch_nodes.json`
|
|
56
|
+
3. 重新验证 → apply → 对比
|
|
57
|
+
4. **最多循环 3 次**;若 3 次后仍有不可修复的差异,告知用户并列出:
|
|
58
|
+
- 已成功配置的部分
|
|
59
|
+
- 仍存在差异的部分及可能原因
|
|
60
|
+
- 建议用户在 Web 端手动调整的部分
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
← 上一步:[07-stage4-validate-spec.md](07-stage4-validate-spec.md)
|
|
65
|
+
← 返回主流程:[../SKILL.md](../../../SKILL.md)
|
|
66
|
+
→ 下一步:[09-stage6-summary.md](09-stage6-summary.md)
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# 阶段 6:总结搭建结果
|
|
2
|
+
|
|
3
|
+
搭建完成后,输出结构化的总结报告到文件 `tmp/工作流搭建报告_<应用名>.md`:
|
|
4
|
+
|
|
5
|
+
```markdown
|
|
6
|
+
# 工作流搭建报告
|
|
7
|
+
|
|
8
|
+
## 业务描述
|
|
9
|
+
<一段话概括流程业务场景,如"工单从员工提交开始,经部门领导审批,根据服务类型分流至不同处理部门...">
|
|
10
|
+
|
|
11
|
+
## 应用信息
|
|
12
|
+
- 应用名称: <xxx>
|
|
13
|
+
- APP_KEY: <xxx>
|
|
14
|
+
|
|
15
|
+
## Mermaid 流程图
|
|
16
|
+
|
|
17
|
+
\`\`\`mermaid
|
|
18
|
+
graph TD
|
|
19
|
+
n1[员工提交工单申请] --> n2[申请部门领导逐级审批]
|
|
20
|
+
n2 --> g1{服务类型}
|
|
21
|
+
g1 -->|客诉| n3[质量部负责人接单]
|
|
22
|
+
g1 -->|技术服务| n4[技术服务部负责人接单]
|
|
23
|
+
...
|
|
24
|
+
\`\`\`
|
|
25
|
+
|
|
26
|
+
## 节点统计
|
|
27
|
+
- 总节点数: N
|
|
28
|
+
- applicant: 1
|
|
29
|
+
- approval: X
|
|
30
|
+
- filling: Y
|
|
31
|
+
- gateway: Z
|
|
32
|
+
- cc: W
|
|
33
|
+
|
|
34
|
+
## 分支条件配置
|
|
35
|
+
| Gateway | 分支 | 字段 | 条件 | 目标 |
|
|
36
|
+
|---------|------|------|------|------|
|
|
37
|
+
| ... | ... | ... | ... | ... |
|
|
38
|
+
|
|
39
|
+
## 业务完整性回顾
|
|
40
|
+
|
|
41
|
+
> 对照阶段 1 的七维度自检清单,逐项回顾部署结果。如有不一致,说明原因(如后端不支持、用户要求修改等)。
|
|
42
|
+
|
|
43
|
+
| 维度 | 检查项 | 建模时 | 部署后 | 一致 |
|
|
44
|
+
|------|--------|:------:|:------:|:----:|
|
|
45
|
+
| 一、审批强度 | 审批层数是否与风险匹配? | ✅/❌ | ✅/❌ | ✅ |
|
|
46
|
+
| 一、审批强度 | 低风险是否简化路径? | ✅/❌ | ✅/❌ | ✅ |
|
|
47
|
+
| 一、审批强度 | 是否存在冗余审批节点? | ✅/❌ | ✅/❌ | ✅ |
|
|
48
|
+
| 二、角色策略 | 审批人是否基于角色? | ✅/❌ | ✅/❌ | ✅ |
|
|
49
|
+
| 二、角色策略 | 不同层级是否代表不同能力? | ✅/❌ | ✅/❌ | ✅ |
|
|
50
|
+
| 二、角色策略 | 是否考虑缺席替代方案? | ✅/❌ | ✅/❌ | ✅ |
|
|
51
|
+
| 三、执行效率 | 独立审批是否并行化? | ✅/❌ | ✅/❌ | ✅ |
|
|
52
|
+
| 三、执行效率 | 串行链是否过长? | ✅/❌ | ✅/❌ | ✅ |
|
|
53
|
+
| 三、执行效率 | 是否存在可合并环节? | ✅/❌ | ✅/❌ | ✅ |
|
|
54
|
+
| 四、条件路由 | 是否需要动态路由? | ✅/❌ | ✅/❌ | ✅ |
|
|
55
|
+
| 四、条件路由 | 分支条件是否全覆盖? | ✅/❌ | ✅/❌ | ✅ |
|
|
56
|
+
| 四、条件路由 | 是否有默认兜底? | ✅/❌ | ✅/❌ | ✅ |
|
|
57
|
+
| 五、异常处理 | 驳回后是否可修正重提? | ✅/❌ | ✅/❌ | ✅ |
|
|
58
|
+
| 五、异常处理 | 是否考虑审批超时? | ✅/❌ | ✅/❌ | ✅ |
|
|
59
|
+
| 五、异常处理 | 异常升级是否有终态? | ✅/❌ | ✅/❌ | ✅ |
|
|
60
|
+
| 六、信息透明 | 关键节点是否抄送? | ✅/❌ | ✅/❌ | ✅ |
|
|
61
|
+
| 六、信息透明 | 提交人能否明确结果? | ✅/❌ | ✅/❌ | ✅ |
|
|
62
|
+
| 六、信息透明 | 状态字段是否自动更新? | ✅/❌ | ✅/❌ | ✅ |
|
|
63
|
+
| 七、业务衔接 | 是否有前置校验? | ✅/❌ | ✅/❌ | ✅ |
|
|
64
|
+
| 七、业务衔接 | 审批后是否有后续动作? | ✅/❌ | ✅/❌ | ✅ |
|
|
65
|
+
| 七、业务衔接 | 是否涉及上下游系统? | ✅/❌ | ✅/❌ | ✅ |
|
|
66
|
+
|
|
67
|
+
## 部署状态
|
|
68
|
+
- ✅ 部署成功 / ⚠️ 部分差异 / ❌ 失败
|
|
69
|
+
- <详情>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## 搭建失败时的回退策略
|
|
73
|
+
|
|
74
|
+
| 失败类型 | 处理 |
|
|
75
|
+
|----------|------|
|
|
76
|
+
| 应用不存在 | 先完成应用搭建和字段配置,再继续工作流搭建 |
|
|
77
|
+
| 字段缺失 | 查阅 qingflow CLI 相关 Skill 先补充缺失字段 |
|
|
78
|
+
| 条件多次无法生效(autoJudges 被吞) | 告知用户这是已知限制,需在 Web 端手动补条件 |
|
|
79
|
+
| 验证脚本持续性报错 | 检查 schema 是否需要刷新(`builder flow schema --json`) |
|
|
80
|
+
| apply 返回 blocking_issues | 逐一排查并修复 |
|
|
81
|
+
|
|
82
|
+
**回退原则**:不删除用户应用、不修改已有字段,仅告知差异和推荐操作。
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
← 上一步:[08-stage5-apply-verify.md](08-stage5-apply-verify.md)
|
|
87
|
+
← 返回主流程:[../SKILL.md](../../../SKILL.md)
|
|
88
|
+
→ 扩展参考:[10-node-config-reference.md](10-node-config-reference.md)
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# 节点配置参考
|
|
2
|
+
|
|
3
|
+
## `responsible` 数组结构
|
|
4
|
+
|
|
5
|
+
审批、填写节点的 `responsible` 必须是 **MemberRefDTO 数组**(`minItems: 1`),而不是单值对象。
|
|
6
|
+
|
|
7
|
+
```json
|
|
8
|
+
"responsible": [
|
|
9
|
+
{"type": "role", "roleId": 123},
|
|
10
|
+
{"type": "user", "uid": 456},
|
|
11
|
+
{"type": "dept", "deptId": 789, "havingSubDept": true}
|
|
12
|
+
]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### MemberRefDTO 字段
|
|
16
|
+
|
|
17
|
+
| 字段 | 类型 | 必填场景 | 说明 |
|
|
18
|
+
|------|------|----------|------|
|
|
19
|
+
| `type` | string | always | `user` / `dept` / `role` / `applicant` / `leader` / `formEmail` / `formMember` / `formDept` / `nodeLeader` |
|
|
20
|
+
| `uid` | integer | `type="user"` | 成员 ID |
|
|
21
|
+
| `deptId` | integer | `type="dept"` | 部门 ID |
|
|
22
|
+
| `roleId` | integer | `type="role"` | 角色 ID |
|
|
23
|
+
| `queId` | integer | `leader` / `formEmail` / `formMember` / `formDept` | 字段/队列 ID |
|
|
24
|
+
| `havingSubDept` | boolean | `type="dept"` | 是否包含子部门 |
|
|
25
|
+
|
|
26
|
+
> ⚠️ **关键区别**:
|
|
27
|
+
> - 成员类型 `type` 必须是 `"user"`,不是 `"member"`
|
|
28
|
+
> - 用户 ID 字段是 `"uid"`(整数),不是 `"uids"`(字符串数组)
|
|
29
|
+
> - 角色 ID 字段是 `"roleId"`(整数),不是 `"roleIds"`(字符串数组)
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## 审批节点(approval)完整 attrs
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"responsible": [
|
|
38
|
+
{"type": "role", "roleId": 123}
|
|
39
|
+
],
|
|
40
|
+
"approveType": "or_signed",
|
|
41
|
+
"auditUserType": "role",
|
|
42
|
+
"revert": true,
|
|
43
|
+
"revertScope": "all",
|
|
44
|
+
"transferScope": "all",
|
|
45
|
+
"auditFeedback": false,
|
|
46
|
+
"commentStatus": "not_required",
|
|
47
|
+
"timeoutConfig": {"duration": {"value": 24, "unit": "hour"}, "autoExecute": "approved"}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
| 字段 | 说明 | 可选值 |
|
|
52
|
+
|------|------|--------|
|
|
53
|
+
| `responsible` | 审批人(MemberRefDTO 数组) | 见上方 MemberRefDTO |
|
|
54
|
+
| `approveType` | 审批模式 | `or_signed`(或签) / `countersigned`(会签) |
|
|
55
|
+
| `auditUserType` | 审批人来源 | `role` / `user` / `dept` |
|
|
56
|
+
| `revert` | 允许驳回 | `true` / `false` |
|
|
57
|
+
| `revertScope` | 驳回范围 | `all`(可回退到任意节点) |
|
|
58
|
+
| `transferScope` | 转交范围 | `all` |
|
|
59
|
+
|
|
60
|
+
## 填写节点(filling)完整 attrs
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"responsible": [
|
|
65
|
+
{"type": "user", "uid": 456}
|
|
66
|
+
],
|
|
67
|
+
"auditFeedback": false,
|
|
68
|
+
"timeoutConfig": null,
|
|
69
|
+
"fieldPermissions": [
|
|
70
|
+
{"fieldId": 343290996, "permission": "editable"}
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Gateway 节点
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"id": "g1",
|
|
80
|
+
"type": "gateway",
|
|
81
|
+
"name": "分支名称",
|
|
82
|
+
"attrs": {"mode": "parallel"}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
`mode` 取值:
|
|
87
|
+
- `parallel`:并行分支(出边 ≥ 2,每条边可选择 `rules` 或 `default`)
|
|
88
|
+
- `join`:汇合节点(多入边、单出边)
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
← 返回主流程:[../SKILL.md](../../../SKILL.md)
|
|
93
|
+
→ 排障参考:[11-troubleshooting.md](11-troubleshooting.md)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# 常见问题与排障
|
|
2
|
+
|
|
3
|
+
`autoJudges` 属于 WorkflowSpec 路径。公开主链路是先读 `builder flow schema` / `builder flow get`,再提交 `--spec-file` 或 `--patch-nodes-file`。
|
|
4
|
+
|
|
5
|
+
| 问题 | 原因 | 解决 |
|
|
6
|
+
|------|------|------|
|
|
7
|
+
| `autoJudges` apply 后为空 | 使用了一维数组 `[{...}]` 格式 | 改为二维 `[[{...}]]` |
|
|
8
|
+
| 条件分支不生效 | `autoJudges` 中的 `values` 与表单选项 label 不一致 | 核对字段选项文本,确保完全一致 |
|
|
9
|
+
| apply 返回 `missing_input_node_ids` | 新建 flow 首次 apply 的正常提示 | 可忽略,再次 get 验证即可 |
|
|
10
|
+
| 录入数据后只留下“提交申请”日志,不进入下一节点 | WorkflowSpec 入口节点没有出边,或入口/路由节点缺少 `sync: true` | `builder flow get` 读回 spec,确认 applicant 出边和节点 `sync`,修正后用 `--spec-file` 发布 |
|
|
11
|
+
| 回退边(gateway → 前序节点)不生效 | 引擎不支持通过 gateway 实现回退 | 改用审批节点 `revert: true` |
|
|
12
|
+
| 审批节点无审批人 | `responsible` 中的 UID/角色 ID 无效或缺失 | 使用 `builder member search` / `role search` 确认 |
|
|
13
|
+
| `fieldType` 不匹配 | 单选用了 `text` 而非 `single_select` | 确认字段实际类型后更正 |
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
← 上一步:[10-node-config-reference.md](10-node-config-reference.md)
|
|
18
|
+
← 返回主流程:[../SKILL.md](../../../SKILL.md)
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Qingflow CLI 工作流搭建
|
|
2
|
+
|
|
3
|
+
## 快速索引
|
|
4
|
+
|
|
5
|
+
| 主题 | 文件 |
|
|
6
|
+
|------|------|
|
|
7
|
+
| 依赖命令、能力边界 | [01-overview.md](./01-overview.md) |
|
|
8
|
+
| 更新模式与最小修改原则 | [02-update-mode.md](./02-update-mode.md) |
|
|
9
|
+
| 流程模式速查(线性/分支/回退) | [03-flow-patterns.md](./03-flow-patterns.md) |
|
|
10
|
+
| 阶段 1:业务建模与自检 | [04-stage1-business-modeling.md](./04-stage1-business-modeling.md) |
|
|
11
|
+
| 阶段 2:成员/角色搜索 | [05-stage2-members-roles.md](./05-stage2-members-roles.md) |
|
|
12
|
+
| 阶段 3:Schema + 构建流程输入 | [06-stage3-build-spec.md](./06-stage3-build-spec.md) |
|
|
13
|
+
| 阶段 4:验证流程输入 | [07-stage4-validate-spec.md](./07-stage4-validate-spec.md) |
|
|
14
|
+
| 阶段 5:Apply + 验证循环 | [08-stage5-apply-verify.md](./08-stage5-apply-verify.md) |
|
|
15
|
+
| 阶段 6:总结报告与回退 | [09-stage6-summary.md](./09-stage6-summary.md) |
|
|
16
|
+
| 节点配置参考 | [10-node-config-reference.md](./10-node-config-reference.md) |
|
|
17
|
+
| 常见问题与排障 | [11-troubleshooting.md](./11-troubleshooting.md) |
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 一、思考(Thought):何时启用与前置条件
|
|
22
|
+
|
|
23
|
+
### 触发条件
|
|
24
|
+
|
|
25
|
+
当用户要求**在轻流应用中搭建工作流**时阅读本节,典型触发语:
|
|
26
|
+
|
|
27
|
+
- "帮我搭建审批流程"
|
|
28
|
+
- "在这个应用里创建工作流"
|
|
29
|
+
- "按照这张流程图实现工作流"
|
|
30
|
+
- "配置流程分支条件"
|
|
31
|
+
- "给这个应用加一个审批节点"
|
|
32
|
+
|
|
33
|
+
### 前提检查(进入行动前必须完成)
|
|
34
|
+
|
|
35
|
+
在开始任何搭建操作前,按顺序确认以下条件:
|
|
36
|
+
|
|
37
|
+
1. **应用存在性**:`qingflow --json app get --app-key <APP_KEY>` 成功返回
|
|
38
|
+
2. **字段就绪**:`qingflow --json builder app get --app-key <APP_KEY> fields` 返回字段列表,确认业务建模所需字段(如单选框、成员、部门字段)均已存在;流程应用还需要明确的业务状态单选字段(如 `状态`、`处理状态`、`审批状态`、`工单状态`、`计划状态`、`报工状态`、`单据状态`),不要只用 `检验结论` 这类结果字段替代状态字段
|
|
39
|
+
3. **未启用已有流程**(新建场景):`qingflow --json builder app get --app-key <APP_KEY> flow` 查看 `enabled` 状态,若已有流程则为**更新模式**
|
|
40
|
+
|
|
41
|
+
**不满足时的处理**:
|
|
42
|
+
- 应用不存在 → 先完成应用搭建和字段配置,再继续工作流搭建
|
|
43
|
+
- 字段缺失 → 先补充缺失的字段定义,再继续工作流搭建
|
|
44
|
+
- 应用已启用流程 → 进入更新模式(读取现有 spec 再修改)
|
|
45
|
+
|
|
46
|
+
### 能力边界
|
|
47
|
+
|
|
48
|
+
| 在范围内 | 超出范围 |
|
|
49
|
+
|----------|----------|
|
|
50
|
+
| 基于已有应用搭建工作流 | 从零创建应用 |
|
|
51
|
+
| WorkflowSpec 生成与 apply;`patch_nodes` 仅用于已有节点局部维护 | 操作复杂命令拼接 |
|
|
52
|
+
| 审批/填写/抄送/自动化/分支条件等 WorkflowSpec 支持的流程 | 不读 schema/spec 就猜 raw 后端字段 |
|
|
53
|
+
| 审批/填写/抄送/自动化节点配置 | 修改字段定义 |
|
|
54
|
+
| 成员/角色搜索用于节点负责人 | 组织架构管理 |
|
|
55
|
+
| 验证 → apply → 校验循环 | 前端 UI 拖拽操作 |
|
|
56
|
+
|
|
57
|
+
完整命令与依赖说明见 [01-overview.md](./01-overview.md)。
|
|
58
|
+
辅助脚本已合并到 `qingflow-cli/scripts/workflow/`。
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## 二、行动(Action):核心 SOP
|
|
63
|
+
|
|
64
|
+
按顺序执行以下阶段,每个阶段详见对应 reference 文件:
|
|
65
|
+
|
|
66
|
+
| 阶段 | 任务 | 参考文件 |
|
|
67
|
+
|------|------|----------|
|
|
68
|
+
| 阶段 0 | 判断是否为更新模式,确认最小修改原则 | [02-update-mode.md](./02-update-mode.md) |
|
|
69
|
+
| 阶段 1 | 提取业务建模,完成七维度业务自检 | [04-stage1-business-modeling.md](./04-stage1-business-modeling.md) |
|
|
70
|
+
| 阶段 2 | 搜索成员/角色,用于节点负责人配置 | [05-stage2-members-roles.md](./05-stage2-members-roles.md) |
|
|
71
|
+
| 阶段 3 | 获取 Schema、读取现有流程、构建 WorkflowSpec;已有节点小改才用 patch_nodes | [06-stage3-build-spec.md](./06-stage3-build-spec.md) |
|
|
72
|
+
| 阶段 4 | 验证 WorkflowSpec / patch_nodes | [07-stage4-validate-spec.md](./07-stage4-validate-spec.md) |
|
|
73
|
+
| 阶段 5 | Apply 工作流并验证部署结果 | [08-stage5-apply-verify.md](./08-stage5-apply-verify.md) |
|
|
74
|
+
|
|
75
|
+
构建流程输入前,若对流程模式有疑问,先查阅 [03-flow-patterns.md](./03-flow-patterns.md)。
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## 三、反思(Reflection):验证与总结
|
|
80
|
+
|
|
81
|
+
| 阶段 | 任务 | 参考文件 |
|
|
82
|
+
|------|------|----------|
|
|
83
|
+
| 阶段 6 | 输出结构化搭建报告,回顾业务完整性 | [references/09-stage6-summary.md](./09-stage6-summary.md) |
|
|
84
|
+
|
|
85
|
+
搭建失败时的回退策略、节点配置细节、常见问题排障分别见:
|
|
86
|
+
- [references/09-stage6-summary.md](./09-stage6-summary.md)
|
|
87
|
+
- [references/10-node-config-reference.md](./10-node-config-reference.md)
|
|
88
|
+
- [references/11-troubleshooting.md](./11-troubleshooting.md)
|