@qingflow-tech/qingflow-cli 1.1.33 → 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.
Files changed (37) hide show
  1. package/README.md +2 -2
  2. package/docs/local-agent-install.md +10 -0
  3. package/package.json +1 -1
  4. package/pyproject.toml +1 -1
  5. package/skills/qingflow-cli/SKILL.md +5 -5
  6. package/skills/qingflow-cli/reference/builder/90-workflow.md +6 -12
  7. package/skills/qingflow-cli/reference/builder/README.md +1 -1
  8. package/skills/qingflow-cli/reference/builder/reference/app-delivery-sop.md +3 -6
  9. package/skills/qingflow-cli/reference/builder/workflow/01-overview.md +6 -5
  10. package/skills/qingflow-cli/reference/builder/workflow/03-flow-patterns.md +1 -1
  11. package/skills/qingflow-cli/reference/builder/workflow/06-stage3-build-spec.md +33 -39
  12. package/skills/qingflow-cli/reference/builder/workflow/07-stage4-validate-spec.md +4 -10
  13. package/skills/qingflow-cli/reference/builder/workflow/08-stage5-apply-verify.md +2 -3
  14. package/skills/qingflow-cli/reference/builder/workflow/11-troubleshooting.md +2 -1
  15. package/skills/qingflow-cli/reference/builder/workflow/README.md +3 -3
  16. package/skills/qingflow-cli/scripts/workflow/validate_flow_spec.py +24 -2
  17. package/src/qingflow_mcp/builder_facade/service.py +41 -4
  18. package/src/qingflow_mcp/cli/commands/builder.py +15 -17
  19. package/src/qingflow_mcp/server_app_builder.py +1 -7
  20. package/src/qingflow_mcp/tools/ai_builder_tools.py +32 -51
  21. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/README.md +0 -308
  22. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/build-complete-system.md +0 -819
  23. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/build-single-app.md +0 -836
  24. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/complete-system-development-guide.md +0 -137
  25. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/create-app.md +0 -203
  26. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/environments.md +0 -63
  27. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/flow-actors-and-permissions.md +0 -142
  28. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/gotchas.md +0 -116
  29. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/match-rules.md +0 -114
  30. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/public-surface-sync.md +0 -75
  31. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/single-app-development-guide.md +0 -69
  32. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/solution-playbooks.md +0 -52
  33. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/tool-selection.md +0 -113
  34. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/update-flow.md +0 -7
  35. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/update-layout.md +0 -7
  36. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/update-schema.md +0 -7
  37. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/update-views.md +0 -7
@@ -1,137 +0,0 @@
1
- # Complete System Development Guide
2
-
3
- Use this when the user asks for a system, app package, workspace module set, or several related apps/forms.
4
- Do not compress several business objects into one app.
5
-
6
- ## Recommended Completeness
7
-
8
- Required:
9
-
10
- - package exists or is created through `package_apply`
11
- - core business objects are modeled as separate apps
12
- - all new apps are created in one multi-app `app_schema_apply(package_id=..., apps=[...])`
13
- - every app has stable `client_key`, `app_name`, `icon`, `color`, and one readable `as_data_title: true`
14
- - no app creates platform system fields such as `数据ID`, `编号`, `申请人`, `申请时间`, `创建人`, `创建时间`, `提交人`, `提交时间`, `更新时间`, `更新人`, `当前流程状态`, `当前处理人`, `当前处理节点`, or `流程标题`
15
- - same-call relations use `target_app_ref` to point to another `apps[].client_key`
16
- - basic operating views exist for each core app
17
- - package/apps/fields/relations are read back before repair or retry
18
-
19
- Strongly recommended:
20
-
21
- - cross-app relation fields for the main business links
22
- - 1-3 concrete business buttons on core operating views through `app_views_apply.action_buttons`
23
- - core metric charts and BI charts using semantic `metric`, `metrics`, `group_by`, and `where`
24
- - a standard portal: business entry area, core metrics, BI charts, then concrete data views
25
- - portal grid/business-entry sections contain real `config.items[]`, not empty containers
26
-
27
- Workflow schema prerequisites:
28
-
29
- - If an app will have approval/fill/copy workflow nodes, create an explicit business status `select` field in schema first, such as `状态`, `处理状态`, `审批状态`, `工单状态`, or `流程阶段`.
30
- - Do not create platform workflow system fields such as `当前流程状态`, `当前处理人`, `当前处理节点`, or `流程标题`.
31
- - If `app_flow_apply` returns `FLOW_DEPENDENCY_MISSING`, fix schema with the returned `suggested_next_call`, read fields back, then retry the flow. Do not skip the workflow silently.
32
-
33
- Optional:
34
-
35
- - workflow, reminders, buttons, associated resources, sample data, roles, and permissions when the user asks for them or the business process clearly depends on them
36
-
37
- ## Standard Path
38
-
39
- 1. Resolve or create package: `package_get` / `package_apply`.
40
- 2. Draft all apps and relations with stable `client_key` values.
41
- 3. Run one multi-app `app_schema_apply` with `apps[]`.
42
- 4. If write result is uncertain, run readback before retrying.
43
- 5. For each app, apply layout and views; declare ordinary business buttons in `action_buttons` while designing the core operating views.
44
- 6. Create charts before portals when the portal needs metrics or BI sections. Keep chart upserts business-scoped, commonly 4-8 by app or topic. Larger calls are accepted; if `CHART_UPSERT_BATCH_SIZE_RECOMMENDED` appears, read back before retrying and only repair failed items.
45
- 7. Create portal only after referenced apps, views, and charts are known.
46
- 8. Add workflows/associated resources/advanced standalone buttons when they are part of the requested business process.
47
- 9. Before the final response, write the complete-system delivery summary file described below.
48
-
49
- ## Field Modeling Rules
50
-
51
- - Use agent-friendly field types in drafts: `text`, `multiline`, `select`, `multi_select`, `number`, `amount`, `date`, `datetime`, `member`, `department`, `attachment`, `relation`. The tool normalizes aliases such as `multiline -> long_text` and `select -> single_select`.
52
- - Create only business fields. Do not create platform system fields listed in Required; reference them only where a tool explicitly supports system fields, such as button `source_field: "数据ID"`.
53
- - Use `number` for ratios, completion rates, scores, percentages, durations, and quantities that may need decimals. Use `amount` only for currency/money semantics. This prevents sample data from producing decimal values for a field that the backend treats as integer money.
54
- - For select fields, define the option set during schema design. Later sample data must use only those option labels or ids.
55
-
56
- ## View Query Rules
57
-
58
- - Use `filters` for fixed saved filters that apply when the view opens.
59
- - Use `query_conditions` only for the frontend query panel layout. It is not another filter DSL and it does not express OR.
60
- - `query_conditions.rows` should contain query-panel fields such as text, long text, number, amount, date/datetime, select, member, department, phone, email, or boolean.
61
- - Do not put relation, attachment, subtable/subfield, address, Q-Linker, or code-block fields in `query_conditions`.
62
- - For current-record related views/reports, use `app_associated_resources_apply.match_mappings`, not `query_conditions`.
63
-
64
- ## Button Rules
65
-
66
- - Design ordinary business buttons with the view: `app_views_apply.upsert_views[].action_buttons` or `patch_views[].set.action_buttons`.
67
- - Use `app_custom_buttons_apply` only for style/icon changes, cross-view reuse, deleting button bodies, bulk binding reorder, or exact qRobot/wings configs.
68
- - Use `add_data` when a current record creates a downstream/child record, such as order -> acceptance, work order -> inspection, or customer -> follow-up. Configure `target_app_key + field_mappings`; map `source_field: "数据ID"` to the target relation/reference field when linking back to the source record.
69
- - Use `link` only for SOP, help, external system, or fixed URL navigation. Do not use `link` to fake approval, status transition, or data writeback.
70
- - Use `qRobot`/`wings` only when the user provides exact existing automation config. Do not invent ids, parameters, or hidden automation.
71
- - Prefer `detail` for current-record add-data actions, `list` for row actions, and `header` for global actions with no current-row context. Do not use current-record `field_mappings` on `header`.
72
- - Approval, rejection, close-task, and status transition should be modeled as workflow/task behavior or existing automation; they are not generic custom-button types.
73
- - Do not claim a complete operational system if all core operating views have no buttons and no reason is given.
74
-
75
- ## Delivery Summary File
76
-
77
- For complete-system builds, create or update one local JSON file before the final response:
78
-
79
- `tmp/qingflow_system_build_summary.json`
80
-
81
- Use this file as the structured source of truth for the final report. Include at least:
82
-
83
- ```json
84
- {
85
- "package_id": 0,
86
- "package_name": "",
87
- "portal_dash_key": "",
88
- "portal_live_status": "verified | unverified | not_created",
89
- "front_end_visible": true,
90
- "apps": [
91
- {
92
- "app_key": "",
93
- "app_name": "",
94
- "fields_count": 0,
95
- "views_count": 0,
96
- "flows_count": 0,
97
- "charts_count": 0,
98
- "publish_verify_status": "verified | unverified | failed"
99
- }
100
- ],
101
- "warnings": [],
102
- "partial_items": [],
103
- "needs_followup": []
104
- }
105
- ```
106
-
107
- Rules:
108
-
109
- - Populate IDs and counts from readback, not from intended payload only.
110
- - If a required resource is not verified, put it in `partial_items` or `needs_followup` instead of reporting the system as fully complete.
111
- - If the user later adds a data-entry task, keep that separate from the system-build summary unless the user explicitly wants one combined report.
112
- - The final response should match this file: completed resources, unverified items, frontend visibility, and follow-up needs must not contradict the JSON.
113
- - When running from the CLI repo or a test harness, validate the file with:
114
- `python scripts/validate_system_build_summary.py tmp/qingflow_system_build_summary.json`.
115
-
116
- ## Recovery Rules
117
-
118
- - Timeout, `partial_success`, `write_executed=true`, `safe_to_retry=false`, or incomplete readback means `write_may_have_succeeded`.
119
- - Next action is always `readback_before_retry`: read package, resolve intended apps, then read fields/relations.
120
- - Retry only verified missing apps, fields, or relations.
121
- - Do not rebuild the system as separate single-app creates.
122
- - Do not create `V2`, `测试`, timestamp, or random-suffix apps to bypass duplicate names.
123
-
124
- ## Portal Template
125
-
126
- - Top area: one business entry grid plus one todo/common/frequent component when useful.
127
- - Metrics: one row of 4-6 indicator/target cards with portal section `role: "metric"`; recommended height 5.
128
- - BI charts: one row of 2-3 charts, 1-2 rows; recommended height 7.
129
- - Data views: one row of 1-2 concrete views, 1-2 rows; recommended height 11.
130
- - PC layout uses 24 columns. Components in the same row share the same `y`, must have the same `rows`, and their `cols` should sum to 24.
131
- - Business-entry grid components must include real `config.items[]` entries linking to apps or portals; never submit an empty grid container.
132
-
133
- ## Stop Conditions
134
-
135
- - If the user only asked for one app, switch to the single-app guide.
136
- - If required package/app/field/relation readback contradicts the intended model, repair the specific missing slice before building dependent resources.
137
- - If a public tool cannot express a needed business feature, state the gap and ask before using any fallback or submitting feedback.
@@ -1,203 +0,0 @@
1
- # Create App
2
-
3
- Use this when the user wants one new app inside an existing package.
4
- This playbook follows the current public builder surface, not legacy package helper tools.
5
-
6
- Do not use this playbook when the user is really asking for a system/package with multiple forms or modules. In that case:
7
-
8
- 1. read or create the package through `package_get` / `package_apply`
9
- 2. create the related apps in one `app_schema_apply(package_id=..., apps=[...])` call
10
- 3. keep package ownership on the public `package_id` path instead of a separate attach step
11
- 4. add same-call relation fields with `target_app_ref` when one new app references another new app; use `target_app_key` only after the target app already exists or readback confirms it
12
- 5. choose explicit non-template `icon + color` for each new package/app
13
-
14
- Hierarchy reminder:
15
-
16
- - package -> app -> field -> relation
17
- - another business object is another app, not a text field
18
-
19
- If creating a brand new package would help, ask the user to confirm package creation first. After confirmation, create it through `package_apply(package_name + icon + color)`.
20
-
21
- ## Minimal sequence
22
-
23
- 1. `package_get` if `package_id` is already known; otherwise derive the package from related readback or ask the user for the id
24
- 2. `app_resolve`
25
- 3. `app_schema_apply`
26
- 4. `app_publish_verify` only when the user asks for explicit final verification
27
-
28
- ## Multi-app systems are different
29
-
30
- If the user says things like:
31
-
32
- - “创建一个完整应用包”
33
- - “包含项目、需求、任务、缺陷、团队这几个表单”
34
- - “这些表单之间建立关联关系”
35
-
36
- then do not treat that as one app.
37
-
38
- Use this pattern instead:
39
-
40
- 1. `package_get` or `package_apply(package_name + icon + color)`
41
- 2. for a multi-app system, run one `app_schema_apply` with `package_id` and `apps[]`
42
- 3. use `apps[].client_key` plus relation field `target_app_ref` when one new app references another new app
43
-
44
- If that multi-app call times out, returns `partial_success`, returns `write_executed=true`, has `safe_to_retry=false`, or has incomplete readback, do not decide that the create failed. Run `readback_before_retry`: read the package, resolve each intended app by package/name or returned app key, read fields, and retry only verified missing apps or fields. Do not rebuild the same complete system as separate single-app creates, and do not create `V2`, `测试`, timestamp, or random-suffix apps to bypass duplicate names.
45
-
46
- ## Example
47
-
48
- When designing fields, do not add platform system fields such as `数据ID`, `编号`, `申请人`, `申请时间`, `创建人`, `创建时间`, `提交人`, `提交时间`, `更新时间`, `更新人`, `当前流程状态`, `当前处理人`, `当前处理节点`, or `流程标题`. Qingflow provides them automatically; create only business fields.
49
-
50
- Field authoring rules:
51
-
52
- - Use intuitive field types in drafts: `text`, `multiline`, `select`, `multi_select`, `number`, `amount`, `date`, `datetime`, `member`, `department`, `attachment`, `relation`.
53
- - The tool normalizes aliases before writing: `multiline -> long_text`, `select -> single_select`, `checkbox -> multi_select`, `currency -> amount`, `mobile -> phone`. Readback may show canonical types; that is not a failed write.
54
- - Every new app must have exactly one top-level `as_data_title: true` field. `as_data_cover: true` is optional and only valid on a top-level `attachment`.
55
- - Select fields must define `options` during schema design. Options may be strings or objects such as `{"label": "进行中"}`; sample data must use those labels or ids.
56
- - Relation fields must use `target_app_ref` for same-batch apps or `target_app_key` for existing apps, plus object selectors: `display_field: {"name": "..."}` and `visible_fields: [{"name": "..."}]`. Do not write bare strings for display/visible field selectors.
57
- - Do not impose a one-relation-field-per-app limit. Model the real business links and let backend validation/readback decide.
58
-
59
- Create a new package only after the user confirms package creation:
60
-
61
- > 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.
62
-
63
- ```json
64
- {
65
- "package_name": "研发项目管理",
66
- "icon": "briefcase",
67
- "color": "azure"
68
- }
69
- ```
70
-
71
- Read the package when `package_id` is already known:
72
-
73
- > CLI-only note: this is the payload from former internal surface `package_get`. Execute it through the matching `qingflow` CLI command and `--*-file` flags from SKILL.md / builder reference; do not call internal tool JSON.
74
-
75
- ```json
76
- {
77
- "package_id": 1218950
78
- }
79
- ```
80
-
81
- Apply schema for a new app:
82
-
83
- > 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.
84
-
85
- ```json
86
- {
87
- "app_name": "客户订单",
88
- "package_id": 1218950,
89
- "icon": "delivery-box-1",
90
- "color": "emerald",
91
- "publish": true,
92
- "add_fields": [
93
- {
94
- "name": "订单编号",
95
- "type": "text",
96
- "required": true,
97
- "as_data_title": true
98
- },
99
- {
100
- "name": "客户名称",
101
- "type": "text",
102
- "required": true
103
- },
104
- {
105
- "name": "订单封面",
106
- "type": "attachment",
107
- "as_data_cover": true
108
- },
109
- {
110
- "name": "订单金额",
111
- "type": "amount"
112
- },
113
- {
114
- "name": "状态",
115
- "type": "select",
116
- "options": [
117
- "草稿",
118
- "进行中",
119
- "已完成"
120
- ],
121
- "required": true
122
- }
123
- ],
124
- "update_fields": [],
125
- "remove_fields": []
126
- }
127
- ```
128
-
129
- Apply schema for multiple apps in one call:
130
-
131
- > 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.
132
-
133
- ```json
134
- {
135
- "package_id": 1218950,
136
- "publish": true,
137
- "apps": [
138
- {
139
- "client_key": "customer",
140
- "app_name": "客户",
141
- "icon": "business-personalcard",
142
- "color": "emerald",
143
- "add_fields": [
144
- {
145
- "name": "客户名称",
146
- "type": "text",
147
- "required": true,
148
- "as_data_title": true
149
- }
150
- ]
151
- },
152
- {
153
- "client_key": "order",
154
- "app_name": "订单",
155
- "icon": "delivery-box-1",
156
- "color": "blue",
157
- "add_fields": [
158
- {
159
- "name": "订单编号",
160
- "type": "text",
161
- "required": true,
162
- "as_data_title": true
163
- },
164
- {
165
- "name": "关联客户",
166
- "type": "relation",
167
- "target_app_ref": "customer",
168
- "display_field": {
169
- "name": "客户名称"
170
- },
171
- "visible_fields": [
172
- {
173
- "name": "客户名称"
174
- }
175
- ]
176
- }
177
- ]
178
- }
179
- ]
180
- }
181
- ```
182
-
183
- Data title is required: mark exactly one top-level field with `as_data_title: true`. Data cover is optional and only valid on a top-level `attachment` field.
184
-
185
- ## Common failures
186
-
187
- ### `APP_NOT_FOUND`
188
-
189
- Expected when the request was accidentally treated as existing-app update. Use
190
- direct create mode (`package_id + app_name` for one app, or `{package_id,
191
- apps[]}` for multi-app) and submit the intended schema payload.
192
-
193
- ### `CREATE_APP_ROUTE_NOT_FOUND`
194
-
195
- The create route did not resolve in the current backend route context. Re-run `workspace_select`, then retry the same `app_schema_apply`.
196
-
197
- ### Hierarchy modeling mistake
198
-
199
- If the user asked for several named forms/apps but the draft patch turns them into text fields inside one app, stop and remodel the task as:
200
-
201
- - one package
202
- - many apps
203
- - relation fields between those apps
@@ -1,63 +0,0 @@
1
- # Environment Switching
2
-
3
- Use this reference before any builder-side write, repair, or verification flow.
4
-
5
- ## Step 1: Resolve the active environment
6
-
7
- Decide explicitly whether the task targets:
8
-
9
- - `test`: build validation, mock data, trial package creation, safe iteration
10
- - `prod`: formal business system changes in the live environment
11
-
12
- If the user did not specify an environment, default to `prod`.
13
-
14
- ## Test Environment
15
-
16
- Use test for:
17
-
18
- - first application of a new `SolutionSpec`
19
- - trying `solution_build_all(..., verify=true)`
20
- - package initialization and schema evolution experiments
21
- - mock data creation, with at least `5` records per relevant entity unless the user asks for fewer
22
-
23
- Builder behavior in test:
24
-
25
- - Read the target and contract first, then submit the chosen payload with `apply`
26
- - package creation is acceptable
27
- - verify should read back apps, views, portal, navigation, and sample records
28
-
29
- Known current test backend:
30
-
31
- - use an explicitly provided non-production backend
32
-
33
- ## Production Environment
34
-
35
- Use production for:
36
-
37
- - changes to real business systems
38
- - additive modifications to live packages and apps
39
- - controlled rollout of approved solution specs
40
-
41
- Builder behavior in prod:
42
-
43
- - always identify the target package or app set before changing anything
44
- - identify the target package or app set, read the relevant contract, then submit the chosen payload with `apply`
45
- - additive requirements should modify the existing package with ordinary tools by default
46
- - if creating a new package seems necessary in prod, ask the user to confirm package creation first
47
- - do not seed mock data unless the user explicitly approves it for production
48
- - verify is mandatory after writes
49
-
50
- Production guardrails:
51
-
52
- - restate the target workspace and target package before any write
53
- - call out whether the action creates, mutates, or deletes builder-side configuration
54
- - if a safer read-only inspection can answer the request, do that first
55
-
56
- ## Reporting Rule
57
-
58
- For builder work, always report:
59
-
60
- - active environment
61
- - target workspace
62
- - whether the operation is `apply`, `repair`, `verify`, or readback
63
- - whether it touches an existing package or creates a new one
@@ -1,142 +0,0 @@
1
- # Flow Actors And Permissions
2
-
3
- Use this when the workflow needs real assignees or node-level editable field permissions.
4
-
5
- ## Canonical policy
6
-
7
- - Approval, fill, and copy nodes must declare at least one assignee.
8
- - Prefer roles over explicit members.
9
- - Resolve directory actors before calling `app_flow_apply`.
10
- - Use canonical keys only:
11
- - `assignees.role_names`
12
- - `assignees.role_ids`
13
- - `assignees.member_names`
14
- - `assignees.member_emails`
15
- - `assignees.member_uids`
16
- - `permissions.editable_fields`
17
-
18
- ## Recommended order
19
-
20
- 1. `app_get_fields`
21
- 2. `app_get_flow`
22
- 3. `role_search`
23
- 4. `member_search` when the user explicitly names people
24
- 5. `role_create` when no reusable role exists and the user wants role-based routing
25
- 6. `app_flow_apply`
26
-
27
- ## Examples
28
-
29
- ### Route an approval node to a reusable role
30
-
31
- > 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.
32
-
33
- ```json
34
- {
35
- "app_key": "APP_123",
36
- "preset": "basic_approval",
37
- "nodes": [
38
- {
39
- "id": "approve_1",
40
- "type": "approve",
41
- "name": "部门审批",
42
- "assignees": {
43
- "role_names": [
44
- "项目经理"
45
- ]
46
- }
47
- }
48
- ]
49
- }
50
- ```
51
-
52
- ### Route to explicit members when the user names people
53
-
54
- > 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.
55
-
56
- ```json
57
- {
58
- "app_key": "APP_123",
59
- "preset": "basic_approval",
60
- "nodes": [
61
- {
62
- "id": "approve_1",
63
- "type": "approve",
64
- "name": "部门审批",
65
- "assignees": {
66
- "member_names": [
67
- "严琪东",
68
- "张三"
69
- ]
70
- }
71
- }
72
- ]
73
- }
74
- ```
75
-
76
- ### Let one node edit selected fields only
77
-
78
- > 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.
79
-
80
- ```json
81
- {
82
- "app_key": "APP_123",
83
- "mode": "replace",
84
- "publish": true,
85
- "nodes": [
86
- {
87
- "id": "start",
88
- "type": "start",
89
- "name": "发起"
90
- },
91
- {
92
- "id": "approve_1",
93
- "type": "approve",
94
- "name": "部门审批",
95
- "assignees": {
96
- "role_names": [
97
- "项目经理"
98
- ]
99
- },
100
- "permissions": {
101
- "editable_fields": [
102
- "状态",
103
- "审批意见",
104
- "项目负责人"
105
- ]
106
- }
107
- },
108
- {
109
- "id": "end",
110
- "type": "end",
111
- "name": "结束"
112
- }
113
- ],
114
- "transitions": [
115
- {
116
- "from": "start",
117
- "to": "approve_1"
118
- },
119
- {
120
- "from": "approve_1",
121
- "to": "end"
122
- }
123
- ]
124
- }
125
- ```
126
-
127
- ## Common recovery
128
-
129
- ### `ROLE_NOT_FOUND` / `AMBIGUOUS_ROLE`
130
-
131
- - retry with `role_search`
132
- - if the business wants a reusable route and no exact role exists, create one with `role_create`
133
-
134
- ### `MEMBER_NOT_FOUND` / `AMBIGUOUS_MEMBER`
135
-
136
- - retry with `member_search`
137
- - do not guess user ids
138
-
139
- ### `UNKNOWN_FLOW_FIELD`
140
-
141
- - reread fields with `app_get_fields`
142
- - only pass real current field names to `permissions.editable_fields`
@@ -1,116 +0,0 @@
1
- # Builder Gotchas
2
-
3
- ## Auth and workspace
4
-
5
- - `auth_*` success does not mean a workspace is selected
6
- - Re-run `workspace_select` after auth changes or route changes
7
-
8
- ## Package ownership
9
-
10
- - Public package work should stay on `package_get / package_apply`
11
- - Do not treat `package_attach_app` as the public default story anymore; if it still exists in low-level code, treat it as internal/legacy
12
- - Check package-related readback after schema writes instead of assuming package ownership from the write alone
13
-
14
- ## Package vs app vs field
15
-
16
- - A package/system is not an app
17
- - Another app is not a field
18
- - If the user names multiple forms/modules that relate to each other, create multiple apps and connect them with relation fields
19
- - Do not use child app names like “项目/需求/任务/缺陷/团队” as plain text fields inside one app
20
-
21
- ## Publish
22
-
23
- - Always pass `publish: true` explicitly on `app_schema_apply`, `app_layout_apply`, `app_flow_apply`, `app_views_apply`, and `portal_apply` — do not rely on the default
24
- - Pass `publish: false` on those five tools only when the user explicitly wants to leave changes in draft
25
- - `app_custom_buttons_apply` and `app_associated_resources_apply` publish after at least one write succeeds and do not accept a `publish` parameter
26
- - `app_charts_apply` is immediate-live and has no publish step
27
- - `app_publish_verify` is for explicit final verification, not the default next step after every write
28
-
29
- ## BI Reports
30
-
31
- - Use `app_charts_apply` for QingBI report body/config creation or updates.
32
- - Use `app_associated_resources_apply` only when an existing BI report or view needs to appear in the Qingflow app associated-resource area or a specific view.
33
- - `app_charts_apply` currently creates/updates app-source BI reports only (`dataSourceType=qingflow`); dataset BI reports can only be attached when they already exist.
34
- - Creating a chart with `app_charts_apply` does not automatically show it in the Qingflow app UI; attach it separately if display is required.
35
- - Main chart config should use semantic `metric`, `metrics`, `group_by`, and `where`; avoid raw `indicator_field_ids`, `selectedMetrics`, and QingBI filter matrices unless diagnosing or preserving existing raw config.
36
- - `target` and `table` remain compatibility aliases for QingBI `indicator` and `detail`; use the real QingBI chart type when you need a specific type such as `summary`, `columnar`, `stacked_bar`, `scatter`, or `dualaxes`.
37
-
38
- ## Custom buttons
39
-
40
- - For ordinary view-specific business buttons, use `app_views_apply.action_buttons`; do not use legacy `app_views_apply.buttons` unless you are maintaining an old full-replacement patch.
41
- - Use `app_custom_buttons_apply` for advanced button creation/update/removal and view placement: custom style/icon, cross-view reuse, deleting button bodies, bulk binding reorder, or exact qRobot/wings configs.
42
- - When changing one existing button parameter, use `patch_buttons` with `set/unset`. Do not send a partial `upsert_buttons` object and expect the backend to preserve hidden required fields.
43
- - `addData` / `add_data` creates a related/downstream Qingflow record; use current-record `field_mappings` only on `detail` or `list`. `link` only opens a URL. `qRobot`/`wings` require user-provided exact config and must not be invented.
44
- - For add-data buttons, prefer semantic `trigger_add_data_config.target_app_key`, `field_mappings`, and `default_values`.
45
- - Do not handwrite raw `que_relation` unless you are preserving an existing backend config. If `field_mappings` and `que_relation` are mixed, the tool blocks the write.
46
- - `field_mappings.source_field` can use source app fields and supported system fields such as `数据ID` (`field_id=-17`) and `编号` (`field_id=0`).
47
- - To fill a target relation field with the current source record, map `{"source_field": "数据ID", "target_field": "目标引用字段"}`. Use `default_values` only for static constants.
48
- - Do not put current-record `field_mappings` on a `header` button; `header` has no current row. Use `detail` or `list` for current-record add-data actions.
49
- - Do not model approval, rejection, close-task, or status transition as a generic `link` button. Use workflow/task behavior, or `qRobot`/`wings` only when the user provides existing automation config.
50
- - For field type compatibility, read `references/match-rules.md`.
51
- - Use `header` for global actions with no current-row context, `detail` for safest current-record actions, and `list` for row/list actions.
52
- - `view_configs[].buttons` is required in merge mode. Do not send a view config with only `view_key`; it is blocked to avoid no-op writes and accidental publish.
53
- - Builder view configs use raw `view_key` from `app_get.views[].view_key`; do not prefix it with `custom:`. The `custom:<viewKey>` form is for record-data `view_id`.
54
- - View button bindings merge by default. Use `view_configs[].mode="replace"` to replace the full set, or pass an explicit empty `buttons: []` when you intend to clear all custom button bindings for that view.
55
- - Advanced view button bindings can include `button_limit`, `button_formula`, `button_formula_type`, and `print_tpls`, but keep ordinary buttons simple unless the user asks for conditional visibility or print templates.
56
- - `placement=list` configures row/list buttons. The tool maps it to the backend `INSIDE` button position, not a raw `LIST` config type.
57
-
58
- ## Associated resources
59
-
60
- - Before creating an associated view/report, check `app_get.associated_resources` for the same `target_app_key + view_key/chart_key`.
61
- - If the resource already exists, use `patch_resources` with its `associated_item_id`; do not call `upsert_resources` again.
62
- - For per-view display, remove, and reorder, existing associated reports/views may be referenced by `associated_item_id`, `chart_id`/`chart_key`, or `view_key`; the tool resolves these to the internal id before writing.
63
- - `client_key` is only a same-call alias for `view_configs[].associated_item_refs`. It is not stored by Qingflow and cannot prevent duplicates in later calls.
64
- - Repeated `upsert_resources` without `associated_item_id` can create multiple app-level associated items pointing to the same view/report.
65
-
66
- ## Readback scope
67
-
68
- - Prefer summary reads over large raw payloads
69
- - Use `app_get_fields` before schema or view work
70
- - Use `app_get_layout` before layout work
71
- - Use `app_get_flow` before workflow work
72
- - Use `app_get_views` before view work
73
-
74
- ## Partial update discipline
75
-
76
- - Existing views, custom buttons, associated resources, and charts support the same public partial pattern: `patch_*[].set` plus optional `patch_*[].unset`.
77
- - The backend may still save a full payload. The CLI patch path is responsible for reading current config and preserving fields the user did not mention.
78
- - Do not use `upsert_views`, `upsert_buttons`, `upsert_resources`, or `upsert_charts` for a tiny parameter replacement unless you are deliberately providing the full desired target config.
79
- - `app_layout_apply(mode=merge)` is already a safe layout merge path; `mode=replace` is full layout replacement.
80
- - `portal_apply` without `sections` is base-info-only. Supplying `sections` replaces the portal sections list; use `patch_sections[]` for one-section updates.
81
- - PC portal layout is 24-column. Group components by the same `y`: all components in that row must have the same `rows`, and their `cols` should sum to 24 unless the user explicitly wants blank space.
82
- - Standard workbench heights: metric cards `rows=5`, BI charts `rows=7`, data views `rows=11`.
83
- - Business-entry `grid` sections must include real `config.items[]`; an empty grid container is not a valid business entrance.
84
- - `app_flow_apply` is intentionally replace-only for the public linear workflow graph.
85
-
86
- ## Workflow dependencies
87
-
88
- - Approval-style flows usually require an explicit status field
89
- - Approval, fill, and copy nodes also require at least one assignee
90
- - Prefer roles over explicit members unless the user explicitly names people
91
- - Resolve assignees with `role_search` / `member_search` before flow apply
92
- - Use `permissions.editable_fields` for node-level editable field permissions; do not guess field ids
93
- - Preset node ids matter. When patching `basic_approval` or `basic_fill_then_approve`, reuse `approve_1` and `fill_1` unless you are explicitly replacing the skeleton.
94
- - If `app_flow_apply` reports `FLOW_DEPENDENCY_MISSING`, fix schema first
95
- - Do not switch to hidden `solution_*` tools from public builder flows
96
-
97
- ## Retry discipline
98
-
99
- - If a write returns `partial_success`, read back before retrying
100
- - Do not repeat create steps after `app_key` already exists
101
- - For backend rejects, keep the retry narrow: retry only the failed tool, not the whole chain
102
- - For `VALIDATION_ERROR`, do not keep guessing. Reuse `suggested_next_call`, `canonical_arguments`, `allowed_keys`, and `allowed_values` first.
103
- - For layout `VALIDATION_ERROR`, also inspect `section_allowed_keys`, `section_aliases`, and `minimal_section_example`. If the same layout-shape error repeats twice, stop free-form retries and re-read `qingflow --json builder contract(app_layout_apply)`.
104
- - For flow work, do not replay internal keys from old logs or plan outputs. Public builder calls should stay on:
105
- - `assignees.role_ids` / `assignees.member_uids` / `assignees.member_emails`
106
- - `permissions.editable_fields`
107
- - For view work, treat `columns` as the only canonical public key. `app_get_views` and `app_views_apply` should all be read and written in that shape.
108
- - For existing view parameter changes, prefer `patch_views`. Example: to change only query-panel fields, set only `query_conditions`; the tool will preserve columns, filters, date config, card fields, buttons, and other backend-required fields.
109
- - For layout work, treat `title + rows` as the only canonical public section shape. `fields`, `field_ids`, and `columns` may appear in legacy/internal shapes, but they are not the preferred public write shape.
110
- - A created view is not enough to claim a filter succeeded. When `app_views_apply` returns `partial_success`, `views_verified=false`, or `details.filter_mismatches`, treat the view as present but the filter as unverified.
111
- - If duplicate view names exist, do not retry by name. Read the exact `view_key` and target that one.
112
- - If a view or flow write fails, report the smallest next action:
113
- - wrong key -> switch to canonical key
114
- - unsupported preset -> switch to allowed canonical preset
115
- - backend reject -> re-read summary and retry only the failed patch
116
- - Do not translate abstract user phrases like “灵活流程” or “默认视图” directly into CLI arguments. First convert them to a preset or explicit patch design.