@josephyan/qingflow-cli 1.1.4 → 1.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/README.md +7 -3
  2. package/docs/local-agent-install.md +57 -6
  3. package/entry_point.py +1 -1
  4. package/npm/bin/qingflow-skills.mjs +5 -0
  5. package/npm/bin/qingflow.mjs +1 -34
  6. package/npm/lib/runtime.mjs +21 -101
  7. package/npm/scripts/postinstall.mjs +1 -10
  8. package/package.json +3 -2
  9. package/pyproject.toml +1 -1
  10. package/skills/qingflow-cli/SKILL.md +58 -44
  11. package/skills/qingflow-cli/manifest.yaml +1 -1
  12. package/skills/qingflow-cli/reference/00-INDEX.md +35 -0
  13. package/skills/qingflow-cli/reference/builder/10-build-single-app.md +38 -0
  14. package/skills/qingflow-cli/reference/builder/20-build-complete-system.md +39 -0
  15. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_SCHEMA_APPLY_FIELD_TYPES_AND_SCENARIOS.md → builder/30-schema-fields.md} +52 -10
  16. package/skills/qingflow-cli/reference/builder/40-layout.md +52 -0
  17. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_BUILDER_VIEWS_WORKFLOW.md → builder/50-views.md} +39 -15
  18. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_BUILDER_CHARTS_WORKFLOW.md → builder/60-charts.md} +36 -13
  19. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_BUILDER_PORTAL_WORKFLOW.md → builder/70-portal.md} +36 -13
  20. package/skills/qingflow-cli/reference/builder/80-buttons-associated-resources.md +41 -0
  21. package/skills/qingflow-cli/reference/builder/90-workflow.md +34 -0
  22. package/skills/qingflow-cli/reference/builder/99-publish-verify.md +46 -0
  23. package/skills/qingflow-cli/reference/builder/README.md +41 -0
  24. package/skills/qingflow-cli/reference/builder/code-integrations/README.md +130 -0
  25. package/skills/qingflow-cli/reference/builder/code-integrations/code-block.md +66 -0
  26. package/skills/qingflow-cli/reference/builder/code-integrations/q-linker.md +77 -0
  27. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_BUILDER_APP_DELIVERY_WORKFLOW.md → builder/reference/app-delivery-sop.md} +26 -16
  28. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/README.md +293 -0
  29. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/build-complete-system.md +809 -0
  30. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/build-single-app.md +830 -0
  31. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/complete-system-development-guide.md +123 -0
  32. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/create-app.md +182 -0
  33. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/environments.md +63 -0
  34. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/flow-actors-and-permissions.md +142 -0
  35. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/gotchas.md +108 -0
  36. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/match-rules.md +114 -0
  37. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/public-surface-sync.md +75 -0
  38. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/single-app-development-guide.md +58 -0
  39. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/solution-playbooks.md +52 -0
  40. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/tool-selection.md +107 -0
  41. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/update-flow.md +7 -0
  42. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/update-layout.md +7 -0
  43. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/update-schema.md +7 -0
  44. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/update-views.md +7 -0
  45. package/skills/qingflow-cli/reference/builder/workflow/01-overview.md +45 -0
  46. package/skills/qingflow-cli/reference/builder/workflow/02-update-mode.md +53 -0
  47. package/skills/qingflow-cli/reference/builder/workflow/03-flow-patterns.md +57 -0
  48. package/skills/qingflow-cli/reference/builder/workflow/04-stage1-business-modeling.md +131 -0
  49. package/skills/qingflow-cli/reference/builder/workflow/05-stage2-members-roles.md +29 -0
  50. package/skills/qingflow-cli/reference/builder/workflow/06-stage3-build-spec.md +165 -0
  51. package/skills/qingflow-cli/reference/builder/workflow/07-stage4-validate-spec.md +33 -0
  52. package/skills/qingflow-cli/reference/builder/workflow/08-stage5-apply-verify.md +51 -0
  53. package/skills/qingflow-cli/reference/builder/workflow/09-stage6-summary.md +88 -0
  54. package/skills/qingflow-cli/reference/builder/workflow/10-node-config-reference.md +93 -0
  55. package/skills/qingflow-cli/reference/builder/workflow/11-troubleshooting.md +15 -0
  56. package/skills/qingflow-cli/reference/builder/workflow/README.md +88 -0
  57. package/skills/qingflow-cli/reference/builder/workflow/workflow-schema.json +1754 -0
  58. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_ADMIN_CHEATSHEET.md → core/QINGFLOW_CLI_ADMIN_CHEATSHEET.md} +3 -3
  59. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_DATA_RETRIEVAL_WORKFLOW.md → core/QINGFLOW_CLI_DATA_RETRIEVAL_WORKFLOW.md} +6 -6
  60. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_EXPLORATION_REPORT.md → core/QINGFLOW_CLI_EXPLORATION_REPORT.md} +2 -2
  61. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_FIELD_DATA_TYPES.md → core/QINGFLOW_CLI_FIELD_DATA_TYPES.md} +11 -11
  62. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_MEMBER_CHEATSHEET.md → core/QINGFLOW_CLI_MEMBER_CHEATSHEET.md} +4 -4
  63. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_ONE_SHOT_CHEATSHEET.md → core/QINGFLOW_CLI_ONE_SHOT_CHEATSHEET.md} +4 -4
  64. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_RECORD_CREATE_WORKFLOW.md → record/QINGFLOW_CLI_RECORD_CREATE_WORKFLOW.md} +3 -3
  65. package/skills/qingflow-cli/reference/record/QINGFLOW_CLI_RECORD_DELETE_WORKFLOW.md +31 -0
  66. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_RECORD_IMPORT_WORKFLOW.md → record/QINGFLOW_CLI_RECORD_IMPORT_WORKFLOW.md} +4 -4
  67. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_RECORD_UPDATE_WORKFLOW.md → record/QINGFLOW_CLI_RECORD_UPDATE_WORKFLOW.md} +7 -7
  68. package/skills/qingflow-cli/reference/record/analysis/README.md +130 -0
  69. package/skills/qingflow-cli/reference/record/analysis/analysis-gotchas.md +91 -0
  70. package/skills/qingflow-cli/reference/record/analysis/analysis-patterns.md +112 -0
  71. package/skills/qingflow-cli/reference/record/analysis/business-context.md +74 -0
  72. package/skills/qingflow-cli/reference/record/analysis/confidence-reporting.md +69 -0
  73. package/skills/qingflow-cli/reference/record/analysis/data-access-playbook.md +106 -0
  74. package/skills/qingflow-cli/reference/record/analysis/pandas-recipes.md +172 -0
  75. package/skills/qingflow-cli/reference/record/analysis/report-format.md +76 -0
  76. package/skills/qingflow-cli/reference/record/insert/README.md +75 -0
  77. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_TASK_CONTEXT_WORKFLOW.md → task/QINGFLOW_CLI_TASK_CONTEXT_WORKFLOW.md} +5 -5
  78. package/skills/qingflow-cli/reference/task/ops/README.md +131 -0
  79. package/skills/qingflow-cli/reference/task/ops/environments.md +43 -0
  80. package/skills/qingflow-cli/reference/task/ops/workflow-usage.md +26 -0
  81. package/skills/qingflow-cli/scripts/validate_system_build_summary.py +124 -0
  82. package/skills/qingflow-cli/scripts/workflow/diff_flow_spec.py +275 -0
  83. package/skills/qingflow-cli/scripts/workflow/validate_flow_spec.py +605 -0
  84. package/skills/qingflow-mcp-setup/SKILL.md +115 -0
  85. package/skills/qingflow-mcp-setup/agents/openai.yaml +4 -0
  86. package/skills/qingflow-mcp-setup/references/claude-desktop.md +34 -0
  87. package/skills/qingflow-mcp-setup/references/environments.md +62 -0
  88. package/skills/qingflow-mcp-setup/references/generic-stdio.md +32 -0
  89. package/skills/qingflow-mcp-setup/scripts/check_local_server.sh +38 -0
  90. package/src/qingflow_mcp/__init__.py +1 -1
  91. package/src/qingflow_mcp/__main__.py +6 -2
  92. package/src/qingflow_mcp/builder_facade/models.py +282 -102
  93. package/src/qingflow_mcp/builder_facade/service.py +4166 -929
  94. package/src/qingflow_mcp/cli/commands/builder.py +316 -298
  95. package/src/qingflow_mcp/cli/commands/chart.py +1 -1
  96. package/src/qingflow_mcp/cli/commands/common.py +12 -3
  97. package/src/qingflow_mcp/cli/commands/exports.py +2 -2
  98. package/src/qingflow_mcp/cli/commands/imports.py +3 -3
  99. package/src/qingflow_mcp/cli/commands/portal.py +2 -2
  100. package/src/qingflow_mcp/cli/commands/record.py +101 -27
  101. package/src/qingflow_mcp/cli/commands/task.py +28 -47
  102. package/src/qingflow_mcp/cli/commands/view.py +1 -1
  103. package/src/qingflow_mcp/cli/context.py +0 -3
  104. package/src/qingflow_mcp/cli/formatters.py +784 -16
  105. package/src/qingflow_mcp/cli/main.py +117 -33
  106. package/src/qingflow_mcp/errors.py +43 -2
  107. package/src/qingflow_mcp/public_surface.py +26 -17
  108. package/src/qingflow_mcp/response_trim.py +81 -17
  109. package/src/qingflow_mcp/server.py +14 -12
  110. package/src/qingflow_mcp/server_app_builder.py +65 -21
  111. package/src/qingflow_mcp/server_app_user.py +22 -16
  112. package/src/qingflow_mcp/session_store.py +11 -7
  113. package/src/qingflow_mcp/solution/compiler/__init__.py +3 -1
  114. package/src/qingflow_mcp/solution/compiler/workflow_compiler.py +173 -0
  115. package/src/qingflow_mcp/solution/executor.py +245 -18
  116. package/src/qingflow_mcp/tools/ai_builder_tools.py +1780 -406
  117. package/src/qingflow_mcp/tools/app_tools.py +184 -43
  118. package/src/qingflow_mcp/tools/approval_tools.py +197 -35
  119. package/src/qingflow_mcp/tools/auth_tools.py +92 -16
  120. package/src/qingflow_mcp/tools/code_block_tools.py +298 -40
  121. package/src/qingflow_mcp/tools/custom_button_tools.py +64 -10
  122. package/src/qingflow_mcp/tools/directory_tools.py +236 -72
  123. package/src/qingflow_mcp/tools/export_tools.py +244 -34
  124. package/src/qingflow_mcp/tools/feedback_tools.py +9 -0
  125. package/src/qingflow_mcp/tools/file_tools.py +9 -3
  126. package/src/qingflow_mcp/tools/import_tools.py +336 -49
  127. package/src/qingflow_mcp/tools/navigation_tools.py +91 -12
  128. package/src/qingflow_mcp/tools/package_tools.py +118 -6
  129. package/src/qingflow_mcp/tools/portal_tools.py +39 -3
  130. package/src/qingflow_mcp/tools/qingbi_report_tools.py +116 -7
  131. package/src/qingflow_mcp/tools/record_tools.py +1141 -356
  132. package/src/qingflow_mcp/tools/resource_read_tools.py +188 -39
  133. package/src/qingflow_mcp/tools/role_tools.py +80 -9
  134. package/src/qingflow_mcp/tools/solution_tools.py +59 -45
  135. package/src/qingflow_mcp/tools/task_context_tools.py +662 -158
  136. package/src/qingflow_mcp/tools/task_tools.py +113 -29
  137. package/src/qingflow_mcp/tools/view_tools.py +106 -3
  138. package/src/qingflow_mcp/tools/workflow_tools.py +48 -4
  139. package/src/qingflow_mcp/tools/workspace_tools.py +71 -3
  140. /package/skills/qingflow-cli/reference/{QINGFLOW_CLI_BUILDER_MATCH_RULES.md → builder/reference/match-rules.md} +0 -0
  141. /package/skills/qingflow-cli/reference/{QINGFLOW_CLI_BUILDER_WORKSPACE_ICONS.md → builder/reference/workspace-icons.md} +0 -0
  142. /package/skills/qingflow-cli/reference/{charts_remove.example.json → examples/charts/charts_remove.example.json} +0 -0
  143. /package/skills/qingflow-cli/reference/{charts_reorder.example.json → examples/charts/charts_reorder.example.json} +0 -0
  144. /package/skills/qingflow-cli/reference/{charts_upsert_bar.example.json → examples/charts/charts_upsert_bar.example.json} +0 -0
  145. /package/skills/qingflow-cli/reference/{charts_upsert_dashboard_starter.example.json → examples/charts/charts_upsert_dashboard_starter.example.json} +0 -0
  146. /package/skills/qingflow-cli/reference/{charts_upsert_minimal.example.json → examples/charts/charts_upsert_minimal.example.json} +0 -0
  147. /package/skills/qingflow-cli/reference/{portal_sections_all_types.example.json → examples/portal/portal_sections_all_types.example.json} +0 -0
  148. /package/skills/qingflow-cli/reference/{portal_sections_five_types.example.json → examples/portal/portal_sections_five_types.example.json} +0 -0
  149. /package/skills/qingflow-cli/reference/{portal_sections_standard_workbench.example.json → examples/portal/portal_sections_standard_workbench.example.json} +0 -0
  150. /package/skills/qingflow-cli/reference/{_batch_schema_complex.json → examples/schema/_batch_schema_complex.json} +0 -0
  151. /package/skills/qingflow-cli/reference/{_batch_schema_scalar.json → examples/schema/_batch_schema_scalar.json} +0 -0
  152. /package/skills/qingflow-cli/reference/{schema_add_fields_minimal.example.json → examples/schema/schema_add_fields_minimal.example.json} +0 -0
  153. /package/skills/qingflow-cli/reference/{schema_apply_add_fields_all_types.json → examples/schema/schema_apply_add_fields_all_types.json} +0 -0
  154. /package/skills/qingflow-cli/reference/{views_upsert_table_minimal.example.json → examples/views/views_upsert_table_minimal.example.json} +0 -0
@@ -0,0 +1,809 @@
1
+ # Build Complete System(完整系统搭建)
2
+
3
+ Use this when the user wants a multi-app business system: multiple related forms, shared workflow, cross-app relation fields, a portal dashboard, and sample data.
4
+
5
+ **Signal phrases**: "建一套系统"、"包含 X 个模块"、"这几个表单之间建立关联"、"完整的业务系统"
6
+
7
+ For a single new app inside an existing package, use [create-app.md](./create-app.md) instead.
8
+
9
+ ---
10
+
11
+ ## Execution order (never reorder)
12
+
13
+ ```
14
+ Phase 0 → Phase 1 → [Phase 2 → 3 → 4] per app → Phase 5 → Phase 6 → Phase 7
15
+ ```
16
+
17
+ - Phase 1 (schema) must complete for **all apps** before Phase 2/3/4 begins — all `app_key` values must be known first
18
+ - Phase 5 (portal) runs after **all** Phase 4 views are created — `view_key` values must be available
19
+ - Phase 6 (data) runs after Phase 5 — fields and flows must be live before inserting records
20
+
21
+ ---
22
+
23
+ ## Phase 0 — Scan workspace packages
24
+
25
+ > CLI-only note: this is the payload from former internal surface `package_list`. Execute it through the matching `qingflow` CLI command and `--*-file` flags from SKILL.md / builder reference; do not call internal tool JSON.
26
+
27
+ - **Package name already exists in workspace** → tell the user, wait for explicit confirmation before continuing
28
+ - **Package name not in workspace** → run `package_apply` immediately, no confirmation needed:
29
+
30
+ > CLI-only note: this is the payload from former internal surface `package_apply`. Execute it through the matching `qingflow` CLI command and `--*-file` flags from SKILL.md / builder reference; do not call internal tool JSON.
31
+
32
+ ```json
33
+ {
34
+ "package_name": "客户管理系统",
35
+ "create_if_missing": true
36
+ }
37
+ ```
38
+
39
+ Record the returned `package_id`. All subsequent phases use it.
40
+
41
+ ---
42
+
43
+ ## Phase 1 — Create all apps and fields in one call
44
+
45
+ > **Read first**: [30-schema-fields.md](../../30-schema-fields.md)
46
+
47
+ ### Field count requirement
48
+
49
+ **12–20 fields per app.** Distribute across types:
50
+
51
+ | Type | Count per app | Examples |
52
+ |------|--------------|---------|
53
+ | `text` / `long_text` | 2–3 | 名称、编号、描述 |
54
+ | `single_select` / `multi_select` | 2–4 | 状态、类型、优先级、阶段 |
55
+ | `date` / `datetime` | 1–2 | 开始日期、截止日期 |
56
+ | `number` / `amount` | 1–3 | 金额、数量、完成率 |
57
+ | `member` | 1–2 | 负责人、创建人 |
58
+ | `attachment` | 0–1 | 封面图或附件 |
59
+ | `relation` | 1–2 | 跨表关联字段 |
60
+
61
+ ### Hard rules
62
+
63
+ - Exactly one top-level field per app must have `as_data_title: true`
64
+ - Every `relation` field must include both `display_field: {"name": "..."}` and `visible_fields: [{"name": "..."}]` — missing either causes `VALIDATION_ERROR` and the entire batch fails with `write_executed=false`; read the `message` field verbatim first before guessing at other causes
65
+ - Use `target_app_ref` to reference another app in the same batch by its `client_key`; do not create apps separately and patch relations later
66
+ - If part of the batch fails, only resubmit the failed apps by `row_number`; do not resubmit the entire batch
67
+
68
+ ### Example (customer + opportunity system)
69
+
70
+ > CLI-only note: this is the payload from former internal surface `app_schema_apply`. Execute it through the matching `qingflow` CLI command and `--*-file` flags from SKILL.md / builder reference; do not call internal tool JSON.
71
+
72
+ ```json
73
+ {
74
+ "package_id": 1218950,
75
+ "create_if_missing": true,
76
+ "publish": true,
77
+ "apps": [
78
+ {
79
+ "client_key": "customer",
80
+ "app_name": "客户",
81
+ "add_fields": [
82
+ {
83
+ "name": "客户名称",
84
+ "type": "text",
85
+ "required": true,
86
+ "as_data_title": true
87
+ },
88
+ {
89
+ "name": "客户编号",
90
+ "type": "text"
91
+ },
92
+ {
93
+ "name": "客户类型",
94
+ "type": "single_select",
95
+ "options": [
96
+ "企业",
97
+ "个人",
98
+ "政府"
99
+ ]
100
+ },
101
+ {
102
+ "name": "行业",
103
+ "type": "single_select",
104
+ "options": [
105
+ "制造业",
106
+ "互联网",
107
+ "金融",
108
+ "零售",
109
+ "其他"
110
+ ]
111
+ },
112
+ {
113
+ "name": "客户状态",
114
+ "type": "single_select",
115
+ "options": [
116
+ "潜在",
117
+ "跟进中",
118
+ "已签约",
119
+ "流失"
120
+ ]
121
+ },
122
+ {
123
+ "name": "负责人",
124
+ "type": "member"
125
+ },
126
+ {
127
+ "name": "联系人",
128
+ "type": "text"
129
+ },
130
+ {
131
+ "name": "联系电话",
132
+ "type": "phone"
133
+ },
134
+ {
135
+ "name": "所在地区",
136
+ "type": "address"
137
+ },
138
+ {
139
+ "name": "首次合作日期",
140
+ "type": "date"
141
+ },
142
+ {
143
+ "name": "累计合同金额",
144
+ "type": "amount"
145
+ },
146
+ {
147
+ "name": "客户简介",
148
+ "type": "long_text"
149
+ },
150
+ {
151
+ "name": "客户封面",
152
+ "type": "attachment",
153
+ "as_data_cover": true
154
+ }
155
+ ]
156
+ },
157
+ {
158
+ "client_key": "opportunity",
159
+ "app_name": "商机",
160
+ "add_fields": [
161
+ {
162
+ "name": "商机名称",
163
+ "type": "text",
164
+ "required": true,
165
+ "as_data_title": true
166
+ },
167
+ {
168
+ "name": "关联客户",
169
+ "type": "relation",
170
+ "target_app_ref": "customer",
171
+ "display_field": {
172
+ "name": "客户名称"
173
+ },
174
+ "visible_fields": [
175
+ {
176
+ "name": "客户名称"
177
+ },
178
+ {
179
+ "name": "客户类型"
180
+ }
181
+ ]
182
+ },
183
+ {
184
+ "name": "商机阶段",
185
+ "type": "single_select",
186
+ "options": [
187
+ "初步接触",
188
+ "需求确认",
189
+ "方案报价",
190
+ "商务谈判",
191
+ "赢单",
192
+ "输单"
193
+ ]
194
+ },
195
+ {
196
+ "name": "预计金额",
197
+ "type": "amount"
198
+ },
199
+ {
200
+ "name": "赢单概率",
201
+ "type": "number"
202
+ },
203
+ {
204
+ "name": "负责人",
205
+ "type": "member"
206
+ },
207
+ {
208
+ "name": "预计成交日期",
209
+ "type": "date"
210
+ },
211
+ {
212
+ "name": "商机来源",
213
+ "type": "single_select",
214
+ "options": [
215
+ "官网",
216
+ "转介绍",
217
+ "市场活动",
218
+ "电话开发",
219
+ "其他"
220
+ ]
221
+ },
222
+ {
223
+ "name": "竞争对手",
224
+ "type": "text"
225
+ },
226
+ {
227
+ "name": "跟进记录",
228
+ "type": "long_text"
229
+ },
230
+ {
231
+ "name": "优先级",
232
+ "type": "single_select",
233
+ "options": [
234
+ "高",
235
+ "中",
236
+ "低"
237
+ ]
238
+ },
239
+ {
240
+ "name": "创建日期",
241
+ "type": "date"
242
+ }
243
+ ]
244
+ }
245
+ ]
246
+ }
247
+ ```
248
+
249
+ Record all `app_key` values from the response. Do not proceed to Phase 2 until all apps show `status: created`.
250
+
251
+ ---
252
+
253
+ ## Phase 2 — Per-app: Layout
254
+
255
+ > **Read first**: [40-layout.md](../../40-layout.md)
256
+
257
+ Run for each app in sequence. Group fields into logical sections with 2–3 fields per row.
258
+
259
+ > CLI-only note: this is the payload from former internal surface `app_layout_apply`. Execute it through the matching `qingflow` CLI command and `--*-file` flags from SKILL.md / builder reference; do not call internal tool JSON.
260
+
261
+ ```json
262
+ {
263
+ "app_key": "APP_KEY",
264
+ "mode": "merge",
265
+ "publish": true,
266
+ "sections": [
267
+ {
268
+ "title": "基础信息",
269
+ "rows": [
270
+ [
271
+ "客户名称",
272
+ "客户编号"
273
+ ],
274
+ [
275
+ "客户类型",
276
+ "行业"
277
+ ],
278
+ [
279
+ "客户状态",
280
+ "负责人"
281
+ ]
282
+ ]
283
+ },
284
+ {
285
+ "title": "联系信息",
286
+ "rows": [
287
+ [
288
+ "联系人",
289
+ "联系电话"
290
+ ],
291
+ [
292
+ "所在地区"
293
+ ]
294
+ ]
295
+ },
296
+ {
297
+ "title": "业务数据",
298
+ "rows": [
299
+ [
300
+ "首次合作日期",
301
+ "累计合同金额"
302
+ ],
303
+ [
304
+ "客户简介"
305
+ ]
306
+ ]
307
+ }
308
+ ]
309
+ }
310
+ ```
311
+
312
+ ---
313
+
314
+ ## Phase 3 — Per-app: Flow
315
+
316
+ > **Read first**: [90-workflow.md](../../90-workflow.md) and [flow-actors-and-permissions.md](./flow-actors-and-permissions.md)
317
+
318
+ Run for each app. Search for an existing role first; create one if none fits.
319
+
320
+ > CLI-only note: this is the payload from former internal surface `role_search`. Execute it through the matching `qingflow` CLI command and `--*-file` flags from SKILL.md / builder reference; do not call internal tool JSON.
321
+
322
+ ```json
323
+ {
324
+ "query": "审批"
325
+ }
326
+ ```
327
+
328
+ > CLI-only note: this is the payload from former internal surface `app_flow_apply`. Execute it through the matching `qingflow` CLI command and `--*-file` flags from SKILL.md / builder reference; do not call internal tool JSON.
329
+
330
+ ```json
331
+ {
332
+ "app_key": "APP_KEY",
333
+ "preset": "basic_approval",
334
+ "publish": true,
335
+ "nodes": [
336
+ {
337
+ "id": "approve_1",
338
+ "type": "approve",
339
+ "name": "主管审批",
340
+ "assignees": {
341
+ "role_names": [
342
+ "部门主管"
343
+ ]
344
+ },
345
+ "permissions": {
346
+ "editable_fields": [
347
+ "客户状态"
348
+ ]
349
+ }
350
+ }
351
+ ]
352
+ }
353
+ ```
354
+
355
+ ---
356
+
357
+ ## Phase 4 — Per-app: Views (multiple types)
358
+
359
+ > **Read first**: [50-views.md](../../50-views.md)
360
+
361
+ Build all applicable view types for each app in one `app_views_apply` call. All views require `query_conditions` with `enabled: true`.
362
+
363
+ | Type | Build condition | Key config |
364
+ |------|----------------|------------|
365
+ | **table** | Always — build first | `columns` + `query_conditions` on title / status / date / member fields |
366
+ | **board** | App has a `single_select` status or stage field | `group_by` = that field name |
367
+ | **gantt** | App has two date fields | `start_field` + `end_field` |
368
+ | **card** | App has an `attachment` field with `as_data_cover: true` | Visual browsing; same `query_conditions` |
369
+
370
+ > CLI-only note: this is the payload from former internal surface `app_views_apply`. Execute it through the matching `qingflow` CLI command and `--*-file` flags from SKILL.md / builder reference; do not call internal tool JSON.
371
+
372
+ ```json
373
+ {
374
+ "app_key": "APP_KEY",
375
+ "publish": true,
376
+ "upsert_views": [
377
+ {
378
+ "name": "全部客户",
379
+ "type": "table",
380
+ "columns": [
381
+ "客户名称",
382
+ "客户类型",
383
+ "客户状态",
384
+ "负责人",
385
+ "首次合作日期",
386
+ "累计合同金额"
387
+ ],
388
+ "query_conditions": {
389
+ "enabled": true,
390
+ "exact": false,
391
+ "hide_before_query": false,
392
+ "rows": [
393
+ [
394
+ "客户名称",
395
+ "客户类型"
396
+ ],
397
+ [
398
+ "客户状态",
399
+ "负责人"
400
+ ]
401
+ ]
402
+ }
403
+ },
404
+ {
405
+ "name": "客户看板",
406
+ "type": "board",
407
+ "columns": [
408
+ "客户名称",
409
+ "客户类型",
410
+ "负责人",
411
+ "累计合同金额"
412
+ ],
413
+ "group_by": "客户状态",
414
+ "query_conditions": {
415
+ "enabled": true,
416
+ "exact": false,
417
+ "hide_before_query": false,
418
+ "rows": [
419
+ [
420
+ "客户名称",
421
+ "负责人"
422
+ ]
423
+ ]
424
+ }
425
+ },
426
+ {
427
+ "name": "客户卡片",
428
+ "type": "card",
429
+ "columns": [
430
+ "客户名称",
431
+ "客户类型",
432
+ "客户状态",
433
+ "负责人"
434
+ ],
435
+ "query_conditions": {
436
+ "enabled": true,
437
+ "exact": false,
438
+ "hide_before_query": false,
439
+ "rows": [
440
+ [
441
+ "客户名称",
442
+ "客户状态"
443
+ ]
444
+ ]
445
+ }
446
+ }
447
+ ]
448
+ }
449
+ ```
450
+
451
+ Record all `view_key` values from the response before proceeding to Phase 5.
452
+
453
+ ---
454
+
455
+ ## Phase 5 — Charts + Portal
456
+
457
+ > **Read first**: [tool-selection.md — portal_apply section](./tool-selection.md)
458
+
459
+ ### 5.1 Build charts — 8 total
460
+
461
+ **4 indicator cards + 4 visual charts.** Build via `app_charts_apply` per app and record all `chart_id` values before calling `portal_apply`.
462
+
463
+ | Row | Count | Type | Examples |
464
+ |-----|-------|------|---------|
465
+ | Indicator row | 4 | `target`(指标卡) | 客户总数、商机总金额、赢单数、合同总额 |
466
+ | Visual row 1 | 2 | `funnel` / `columnar` | 商机阶段漏斗、客户类型分布 |
467
+ | Visual row 2 | 2 | `area` / `columnar` | 月度商机趋势、合同金额趋势 |
468
+
469
+ ### 5.2 Portal layout
470
+
471
+ ```
472
+ y=0, rows=4: 九宫格业务入口 (cols=24)
473
+ y=4, rows=3: 指标1(x=0,cols=6) 指标2(x=6,cols=6) 指标3(x=12,cols=6) 指标4(x=18,cols=6)
474
+ y=7, rows=8: 可视化图1(x=0,cols=12) 可视化图2(x=12,cols=12)
475
+ y=15, rows=8: 可视化图3(x=0,cols=12) 可视化图4(x=12,cols=12)
476
+ y=23, rows=8: 数据视图 (cols=24)
477
+ ```
478
+
479
+ Same-row rule: all components at the same `y` must have identical `rows` and `cols` summing to 24.
480
+
481
+ > CLI-only note: this is the payload from former internal surface `portal_apply`. Execute it through the matching `qingflow` CLI command and `--*-file` flags from SKILL.md / builder reference; do not call internal tool JSON.
482
+
483
+ ```json
484
+ {
485
+ "package_id": 1218950,
486
+ "dash_name": "客户管理工作台",
487
+ "publish": true,
488
+ "sections": [
489
+ {
490
+ "title": "业务入口",
491
+ "source_type": "grid",
492
+ "position": {
493
+ "pc": {
494
+ "x": 0,
495
+ "y": 0,
496
+ "cols": 24,
497
+ "rows": 4
498
+ },
499
+ "mobile": {
500
+ "x": 0,
501
+ "y": 0,
502
+ "cols": 6,
503
+ "rows": 4
504
+ }
505
+ },
506
+ "config": {
507
+ "gridTitle": "业务入口",
508
+ "beingShowTitle": true
509
+ }
510
+ },
511
+ {
512
+ "title": "客户总数",
513
+ "source_type": "chart",
514
+ "position": {
515
+ "pc": {
516
+ "x": 0,
517
+ "y": 4,
518
+ "cols": 6,
519
+ "rows": 3
520
+ },
521
+ "mobile": {
522
+ "x": 0,
523
+ "y": 4,
524
+ "cols": 6,
525
+ "rows": 3
526
+ }
527
+ },
528
+ "chart_ref": {
529
+ "app_key": "CUSTOMER_APP_KEY",
530
+ "chart_id": "INDICATOR_CHART_ID_1"
531
+ }
532
+ },
533
+ {
534
+ "title": "商机总金额",
535
+ "source_type": "chart",
536
+ "position": {
537
+ "pc": {
538
+ "x": 6,
539
+ "y": 4,
540
+ "cols": 6,
541
+ "rows": 3
542
+ },
543
+ "mobile": {
544
+ "x": 0,
545
+ "y": 7,
546
+ "cols": 6,
547
+ "rows": 3
548
+ }
549
+ },
550
+ "chart_ref": {
551
+ "app_key": "OPPORTUNITY_APP_KEY",
552
+ "chart_id": "INDICATOR_CHART_ID_2"
553
+ }
554
+ },
555
+ {
556
+ "title": "赢单数",
557
+ "source_type": "chart",
558
+ "position": {
559
+ "pc": {
560
+ "x": 12,
561
+ "y": 4,
562
+ "cols": 6,
563
+ "rows": 3
564
+ },
565
+ "mobile": {
566
+ "x": 0,
567
+ "y": 10,
568
+ "cols": 6,
569
+ "rows": 3
570
+ }
571
+ },
572
+ "chart_ref": {
573
+ "app_key": "OPPORTUNITY_APP_KEY",
574
+ "chart_id": "INDICATOR_CHART_ID_3"
575
+ }
576
+ },
577
+ {
578
+ "title": "合同总额",
579
+ "source_type": "chart",
580
+ "position": {
581
+ "pc": {
582
+ "x": 18,
583
+ "y": 4,
584
+ "cols": 6,
585
+ "rows": 3
586
+ },
587
+ "mobile": {
588
+ "x": 0,
589
+ "y": 13,
590
+ "cols": 6,
591
+ "rows": 3
592
+ }
593
+ },
594
+ "chart_ref": {
595
+ "app_key": "CONTRACT_APP_KEY",
596
+ "chart_id": "INDICATOR_CHART_ID_4"
597
+ }
598
+ },
599
+ {
600
+ "title": "商机阶段漏斗",
601
+ "source_type": "chart",
602
+ "position": {
603
+ "pc": {
604
+ "x": 0,
605
+ "y": 7,
606
+ "cols": 12,
607
+ "rows": 8
608
+ },
609
+ "mobile": {
610
+ "x": 0,
611
+ "y": 16,
612
+ "cols": 6,
613
+ "rows": 8
614
+ }
615
+ },
616
+ "chart_ref": {
617
+ "app_key": "OPPORTUNITY_APP_KEY",
618
+ "chart_id": "VISUAL_CHART_ID_1"
619
+ }
620
+ },
621
+ {
622
+ "title": "客户类型分布",
623
+ "source_type": "chart",
624
+ "position": {
625
+ "pc": {
626
+ "x": 12,
627
+ "y": 7,
628
+ "cols": 12,
629
+ "rows": 8
630
+ },
631
+ "mobile": {
632
+ "x": 0,
633
+ "y": 24,
634
+ "cols": 6,
635
+ "rows": 8
636
+ }
637
+ },
638
+ "chart_ref": {
639
+ "app_key": "CUSTOMER_APP_KEY",
640
+ "chart_id": "VISUAL_CHART_ID_2"
641
+ }
642
+ },
643
+ {
644
+ "title": "月度商机趋势",
645
+ "source_type": "chart",
646
+ "position": {
647
+ "pc": {
648
+ "x": 0,
649
+ "y": 15,
650
+ "cols": 12,
651
+ "rows": 8
652
+ },
653
+ "mobile": {
654
+ "x": 0,
655
+ "y": 32,
656
+ "cols": 6,
657
+ "rows": 8
658
+ }
659
+ },
660
+ "chart_ref": {
661
+ "app_key": "OPPORTUNITY_APP_KEY",
662
+ "chart_id": "VISUAL_CHART_ID_3"
663
+ }
664
+ },
665
+ {
666
+ "title": "合同金额趋势",
667
+ "source_type": "chart",
668
+ "position": {
669
+ "pc": {
670
+ "x": 12,
671
+ "y": 15,
672
+ "cols": 12,
673
+ "rows": 8
674
+ },
675
+ "mobile": {
676
+ "x": 0,
677
+ "y": 40,
678
+ "cols": 6,
679
+ "rows": 8
680
+ }
681
+ },
682
+ "chart_ref": {
683
+ "app_key": "CONTRACT_APP_KEY",
684
+ "chart_id": "VISUAL_CHART_ID_4"
685
+ }
686
+ },
687
+ {
688
+ "title": "客户列表",
689
+ "source_type": "view",
690
+ "position": {
691
+ "pc": {
692
+ "x": 0,
693
+ "y": 23,
694
+ "cols": 24,
695
+ "rows": 8
696
+ },
697
+ "mobile": {
698
+ "x": 0,
699
+ "y": 48,
700
+ "cols": 6,
701
+ "rows": 8
702
+ }
703
+ },
704
+ "view_ref": {
705
+ "app_key": "CUSTOMER_APP_KEY",
706
+ "view_key": "CUSTOMER_TABLE_VIEW_KEY"
707
+ }
708
+ }
709
+ ]
710
+ }
711
+ ```
712
+
713
+ ---
714
+
715
+ ## Phase 6 — Sample data
716
+
717
+ > **Use CLI record insert rules**: read [record/insert](../../../record/insert/README.md) before inserting sample data.
718
+
719
+ **Insertion order**: insert apps with no inbound relation dependencies first. If App A has a relation field pointing to App B, insert B's records before A — otherwise the relation field has no candidates.
720
+
721
+ Per app: insert **3–5 records** covering different status values and realistic business data.
722
+
723
+ > CLI-only note: this is the payload from former internal surface `qingflow record schema insert`. Execute it through the matching `qingflow` CLI command and `--*-file` flags from SKILL.md / builder reference; do not call internal tool JSON.
724
+
725
+ ```json
726
+ {
727
+ "app_key": "APP_KEY"
728
+ }
729
+ ```
730
+
731
+ > CLI-only note: this is the payload from former internal surface `record_insert`. Execute it through the matching `qingflow` CLI command and `--*-file` flags from SKILL.md / builder reference; do not call internal tool JSON.
732
+
733
+ ```json
734
+ {
735
+ "app_key": "APP_KEY",
736
+ "items": [
737
+ {
738
+ "客户名称": "上海科技有限公司",
739
+ "客户类型": "企业",
740
+ "客户状态": "已签约",
741
+ "负责人": "张三",
742
+ "累计合同金额": 1200000
743
+ },
744
+ {
745
+ "客户名称": "北京创新集团",
746
+ "客户类型": "企业",
747
+ "客户状态": "跟进中",
748
+ "负责人": "李四",
749
+ "累计合同金额": 500000
750
+ },
751
+ {
752
+ "客户名称": "广州贸易公司",
753
+ "客户类型": "企业",
754
+ "客户状态": "潜在",
755
+ "负责人": "王五",
756
+ "累计合同金额": 0
757
+ },
758
+ {
759
+ "客户名称": "深圳数字科技",
760
+ "客户类型": "企业",
761
+ "客户状态": "跟进中",
762
+ "负责人": "张三",
763
+ "累计合同金额": 300000
764
+ },
765
+ {
766
+ "客户名称": "杭州云计算公司",
767
+ "客户类型": "企业",
768
+ "客户状态": "已签约",
769
+ "负责人": "李四",
770
+ "累计合同金额": 800000
771
+ }
772
+ ]
773
+ }
774
+ ```
775
+
776
+ Member, department, and relation fields accept natural language values — do not look up IDs manually.
777
+
778
+ ---
779
+
780
+ ## Phase 7 — Publish verify
781
+
782
+ Run `app_publish_verify` with `app_keys[]` for all apps in one call. Confirm `publish_status` is live and `unplaced_fields` is empty for each.
783
+
784
+ > CLI-only note: this is the payload from former internal surface `app_publish_verify`. Execute it through the matching `qingflow` CLI command and `--*-file` flags from SKILL.md / builder reference; do not call internal tool JSON.
785
+
786
+ ```json
787
+ {
788
+ "app_keys": [
789
+ "APP_KEY_1",
790
+ "APP_KEY_2"
791
+ ]
792
+ }
793
+ ```
794
+
795
+ ---
796
+
797
+ ## Common failures
798
+
799
+ | Error | Phase | Fix |
800
+ |-------|-------|-----|
801
+ | `VALIDATION_ERROR` on relation field | 1 | Read `message` verbatim first. Add `display_field` + `visible_fields` to the failing relation field. |
802
+ | Partial app batch failure | 1 | Only resubmit failed apps by `row_number`. Do not resubmit the entire batch. |
803
+ | `UNKNOWN_LAYOUT_FIELD` | 2 | Re-read fields with `app_get_fields`. Field name in `rows` must match exactly. |
804
+ | `FLOW_ASSIGNEE_REQUIRED` | 3 | Run `role_search` first. Assign at least one role to every approve/fill node. |
805
+ | `FLOW_DEPENDENCY_MISSING` | 3 | Fix schema first, then retry flow. |
806
+ | View `partial_success` | 4 | Check `verification.view_query_conditions_verified`. Read `views_diff.failed`. |
807
+ | Portal height mismatch or blank space | 5 | All components at the same `y` must have identical `rows` and `cols` summing to 24. |
808
+ | `PORTAL_CHART_CARD_TOO_SMALL` | 5 | Indicator cards: `rows ≥ 3`. Visual charts: `rows ≥ 6`. |
809
+ | Relation field has no candidates on insert | 6 | The referenced app has no records yet. Insert that app's records first, then retry. |