@qingflow-tech/qingflow-app-user-mcp 1.0.11 → 1.0.13

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 (88) hide show
  1. package/README.md +9 -3
  2. package/docs/local-agent-install.md +54 -3
  3. package/entry_point.py +1 -1
  4. package/npm/bin/qingflow-skills.mjs +5 -0
  5. package/npm/lib/runtime.mjs +304 -13
  6. package/npm/scripts/postinstall.mjs +1 -5
  7. package/package.json +3 -2
  8. package/pyproject.toml +1 -1
  9. package/skills/qingflow-app-builder/SKILL.md +255 -0
  10. package/skills/qingflow-app-builder/agents/openai.yaml +4 -0
  11. package/skills/qingflow-app-builder/references/create-app.md +149 -0
  12. package/skills/qingflow-app-builder/references/environments.md +63 -0
  13. package/skills/qingflow-app-builder/references/flow-actors-and-permissions.md +123 -0
  14. package/skills/qingflow-app-builder/references/gotchas.md +107 -0
  15. package/skills/qingflow-app-builder/references/match-rules.md +114 -0
  16. package/skills/qingflow-app-builder/references/public-surface-sync.md +75 -0
  17. package/skills/qingflow-app-builder/references/solution-playbooks.md +52 -0
  18. package/skills/qingflow-app-builder/references/tool-selection.md +99 -0
  19. package/skills/qingflow-app-builder/references/update-flow.md +158 -0
  20. package/skills/qingflow-app-builder/references/update-layout.md +68 -0
  21. package/skills/qingflow-app-builder/references/update-schema.md +72 -0
  22. package/skills/qingflow-app-builder/references/update-views.md +284 -0
  23. package/skills/qingflow-app-builder-code-integrations/SKILL.md +137 -0
  24. package/skills/qingflow-app-builder-code-integrations/agents/openai.yaml +4 -0
  25. package/skills/qingflow-app-builder-code-integrations/references/code-block.md +66 -0
  26. package/skills/qingflow-app-builder-code-integrations/references/q-linker.md +77 -0
  27. package/skills/qingflow-app-user/SKILL.md +12 -11
  28. package/skills/qingflow-app-user/references/data-gotchas.md +2 -2
  29. package/skills/qingflow-app-user/references/public-surface-sync.md +3 -3
  30. package/skills/qingflow-app-user/references/record-patterns.md +5 -5
  31. package/skills/qingflow-app-user/references/workflow-usage.md +4 -5
  32. package/skills/qingflow-mcp-setup/SKILL.md +113 -0
  33. package/skills/qingflow-mcp-setup/agents/openai.yaml +4 -0
  34. package/skills/qingflow-mcp-setup/references/claude-desktop.md +34 -0
  35. package/skills/qingflow-mcp-setup/references/environments.md +62 -0
  36. package/skills/qingflow-mcp-setup/references/generic-stdio.md +32 -0
  37. package/skills/qingflow-mcp-setup/scripts/check_local_server.sh +38 -0
  38. package/skills/qingflow-record-analysis/SKILL.md +6 -7
  39. package/skills/qingflow-record-analysis/manifest.yaml +10 -0
  40. package/skills/qingflow-record-delete/SKILL.md +5 -3
  41. package/skills/qingflow-record-import/SKILL.md +6 -2
  42. package/skills/qingflow-record-insert/SKILL.md +48 -4
  43. package/skills/qingflow-record-insert/manifest.yaml +6 -0
  44. package/skills/qingflow-record-update/SKILL.md +36 -24
  45. package/skills/qingflow-task-ops/SKILL.md +25 -25
  46. package/skills/qingflow-task-ops/references/environments.md +0 -1
  47. package/skills/qingflow-task-ops/references/workflow-usage.md +4 -6
  48. package/src/qingflow_mcp/__main__.py +6 -2
  49. package/src/qingflow_mcp/builder_facade/models.py +11 -0
  50. package/src/qingflow_mcp/builder_facade/service.py +1488 -288
  51. package/src/qingflow_mcp/cli/commands/builder.py +2 -2
  52. package/src/qingflow_mcp/cli/commands/exports.py +2 -2
  53. package/src/qingflow_mcp/cli/commands/imports.py +1 -1
  54. package/src/qingflow_mcp/cli/commands/record.py +91 -19
  55. package/src/qingflow_mcp/cli/context.py +0 -3
  56. package/src/qingflow_mcp/cli/formatters.py +206 -7
  57. package/src/qingflow_mcp/cli/main.py +47 -3
  58. package/src/qingflow_mcp/errors.py +43 -2
  59. package/src/qingflow_mcp/public_surface.py +21 -15
  60. package/src/qingflow_mcp/response_trim.py +74 -13
  61. package/src/qingflow_mcp/server.py +11 -9
  62. package/src/qingflow_mcp/server_app_builder.py +3 -2
  63. package/src/qingflow_mcp/server_app_user.py +19 -13
  64. package/src/qingflow_mcp/session_store.py +11 -7
  65. package/src/qingflow_mcp/solution/executor.py +112 -15
  66. package/src/qingflow_mcp/tools/ai_builder_tools.py +36 -11
  67. package/src/qingflow_mcp/tools/app_tools.py +184 -43
  68. package/src/qingflow_mcp/tools/approval_tools.py +196 -34
  69. package/src/qingflow_mcp/tools/auth_tools.py +92 -16
  70. package/src/qingflow_mcp/tools/code_block_tools.py +298 -40
  71. package/src/qingflow_mcp/tools/custom_button_tools.py +64 -10
  72. package/src/qingflow_mcp/tools/directory_tools.py +236 -72
  73. package/src/qingflow_mcp/tools/export_tools.py +244 -34
  74. package/src/qingflow_mcp/tools/file_tools.py +7 -3
  75. package/src/qingflow_mcp/tools/import_tools.py +336 -49
  76. package/src/qingflow_mcp/tools/navigation_tools.py +91 -12
  77. package/src/qingflow_mcp/tools/package_tools.py +118 -6
  78. package/src/qingflow_mcp/tools/portal_tools.py +39 -3
  79. package/src/qingflow_mcp/tools/qingbi_report_tools.py +116 -7
  80. package/src/qingflow_mcp/tools/record_tools.py +1067 -349
  81. package/src/qingflow_mcp/tools/resource_read_tools.py +188 -39
  82. package/src/qingflow_mcp/tools/role_tools.py +80 -9
  83. package/src/qingflow_mcp/tools/solution_tools.py +57 -15
  84. package/src/qingflow_mcp/tools/task_context_tools.py +569 -119
  85. package/src/qingflow_mcp/tools/task_tools.py +113 -29
  86. package/src/qingflow_mcp/tools/view_tools.py +106 -3
  87. package/src/qingflow_mcp/tools/workflow_tools.py +17 -1
  88. package/src/qingflow_mcp/tools/workspace_tools.py +71 -3
@@ -0,0 +1,255 @@
1
+ ---
2
+ name: qingflow-app-builder
3
+ description: Build, configure, and modify Qingflow apps and systems using the current Wingent Momo runtime MCP session. Use when the user wants to apply or repair an existing SolutionSpec, modify an existing package with app, view, workflow, portal, navigation, or reporting tools, verify builder-side results, or troubleshoot system-building behavior. Do not use this skill to install the MCP or to author a brand new SolutionSpec from scratch.
4
+ metadata:
5
+ short-description: Build and modify Qingflow apps and systems
6
+ ---
7
+
8
+ # Qingflow App Builder
9
+
10
+ ## Overview
11
+
12
+ This skill is for the current **public builder surface**, not for legacy low-level builder writes.
13
+ In Wingent Momo runtime, trust the injected MCP session, credentials, workspace, and route context until a tool explicitly reports otherwise.
14
+
15
+ Before any write or verification flow, identify whether the task targets `test` or `prod` and read [references/environments.md](references/environments.md). If the user did not specify one, default to `prod`.
16
+
17
+ Before choosing a route, skim the shared maintenance baseline: [public-surface-sync.md](references/public-surface-sync.md).
18
+
19
+ ## Current Public Mental Model
20
+
21
+ Model builder requests in four layers and keep them separate:
22
+
23
+ - `package`: the app bundle or solution container
24
+ - `app`: one form/app inside that package
25
+ - `field`: one field inside one app
26
+ - `relation`: a field that links one app to another app
27
+
28
+ Default modeling rules:
29
+
30
+ - One business object -> one app
31
+ - Attributes of that object -> fields inside that app
32
+ - Another business object -> a separate app, not a text field
33
+ - Cross-object links -> relation fields, not text fields
34
+
35
+ ## Public Tools You Should Think In
36
+
37
+ - Package: `package_get`, `package_apply`
38
+ - App reads: `app_resolve`, `app_get`, `app_get_fields`, `app_get_layout`, `app_get_views`, `app_get_flow`, `app_get_charts`
39
+ - Builder reads: `portal_list`, `portal_get`, `view_get`, `chart_get`, `builder_tool_contract`
40
+ - Directory: `member_search`, `role_search`, `role_create`
41
+ - Writes: `app_schema_apply`, `app_layout_apply`, `app_flow_apply`, `app_views_apply`, `app_custom_buttons_apply`, `app_associated_resources_apply`, `app_charts_apply`, `portal_apply`, `app_release_edit_lock_if_mine`
42
+ - Verification: `app_publish_verify`
43
+ - Cross-cutting escalation: `feedback_submit` after explicit user confirmation when the public builder surface still cannot satisfy the user's need
44
+
45
+ Treat these as the official surface. Do not default to `package_create`, `package_attach_app`, raw `portal_*` writes, or raw `qingbi_report_*` writes.
46
+
47
+ ## Current Public Defaults
48
+
49
+ - Package work:
50
+ - use `package_get(package_id=...)` to read one known package
51
+ - use `package_apply(...)` for package creation, rename, icon, visibility, grouping, ordering, and app/portal layout
52
+ - Multi-app schema work:
53
+ - use one `app_schema_apply(apps=[...])` / CLI `builder schema apply --apps-file` when creating several apps in one package
54
+ - same-call relation fields may use `target_app_ref` to point at another `apps[].client_key`
55
+ - App base permissions:
56
+ - trust `app_get.editability.can_edit_app_base` for app base-info writes like app name, icon, and visibility
57
+ - `can_edit_form` only means schema/form-route capability; it no longer implies app base-info write capability
58
+ - Partial update rule:
59
+ - for existing views, custom buttons, associated resources, and charts, prefer `patch_views` / `patch_buttons` / `patch_resources` / `patch_charts`
60
+ - each patch item uses the object's real selector field (`view_key` / `button_id` / `associated_item_id` / `chart_id`, or unique name where supported) plus `set` and optional `unset`; do not send a literal `selector` key for these tools
61
+ - use `upsert_*` for creation or full target configuration; do not send a partial `upsert_*` and expect the backend to merge missing required fields
62
+ - Portal work:
63
+ - `portal_apply` is the public write path
64
+ - in edit mode, omitting `sections` means “preserve existing layout and update base info only”
65
+ - supplying `sections` means full replace semantics for sections
66
+ - Chart work:
67
+ - `app_charts_apply` is the public write path for app-source QingBI report bodies/configs; it creates/updates reports with `dataSourceType=qingflow`
68
+ - dataset BI reports are not created or edited by `app_charts_apply` yet; create them in QingBI first, then attach the existing report with `app_associated_resources_apply` and `report_source="dataset"`
69
+ - it does not attach the report to the Qingflow app associated-resource display; use `app_associated_resources_apply` for that
70
+ - supported `chart_type` values include legacy public aliases `target`, `table` and QingBI types such as `summary`, `columnar`, `area`, `stacked_area`, `funnel`, `waterfall`, `gauge`, `heatmap`, `histogram`, `treemap`, `radar`, `stacked_bar`, `stacked_column`, `scatter`, `ring`, `rose`, `dualaxes`, `map`, and `timeline`
71
+ - use `patch_charts` for changing a chart name, visibility, filters, or one config fragment on an existing chart
72
+ - `visibility` is a public capability and should be treated as a base-only permission update
73
+ - do not model chart visibility changes as raw config rewrites
74
+ - Button work:
75
+ - `app_custom_buttons_apply` is the public write path for custom button bodies and view placement
76
+ - use `patch_buttons` for changing a single existing button parameter such as URL, text, icon, style, or add-data mapping
77
+ - for add-data buttons, use `trigger_add_data_config.target_app_key + field_mappings/default_values`; do not handwrite raw `que_relation`
78
+ - use `field_mappings` for dynamic current-record values, including system fields such as `数据ID` (`field_id=-17`) and `编号` (`field_id=0`)
79
+ - to prefill a target relation field with the current source record, map `{"source_field": "数据ID", "target_field": "目标引用字段"}`; use `default_values` only for static constants
80
+ - if field type compatibility is unclear, read [references/match-rules.md](references/match-rules.md)
81
+ - bind buttons to views through `view_configs[].buttons[]`; default to `placement`: `header` or `detail`
82
+ - builder `view_configs[].view_key` uses the raw key from `app_get.views[].view_key`, without a `custom:` prefix
83
+ - `buttons` is required in merge mode; do not send a view config with only `view_key`
84
+ - `view_configs[].mode` defaults to `merge`; use `mode: "replace"` or an explicit empty `buttons: []` to clear a view's custom button bindings
85
+ - `placement=list` configures row/list buttons and maps to the backend `INSIDE` button position
86
+ - advanced bindings may use `button_limit`, `button_formula`, `button_formula_type`, and `print_tpls` only when visibility or print-template behavior is required
87
+ - Associated resources:
88
+ - `app_associated_resources_apply` is the public write path for the Qingflow app-level associated report/view pool and per-view display config
89
+ - it attaches existing BI reports/views for in-app display; it does not create or edit QingBI report bodies/configs, including dataset reports
90
+ - use `patch_resources` for changing match rules or other existing associated-resource parameters; the tool preserves backend-required raw fields internally
91
+ - `associated_item_id` is the backend internal associated-resource id; for `view_configs`, `remove_associated_item_ids`, and `reorder_associated_item_ids`, you may pass `associated_item_id` or an existing resource's `chart_id`/`chart_key`/`view_key`, and the tool resolves it to the internal id
92
+ - before creating a resource, check `app_get.associated_resources` for the same `target_app_key + view_key/chart_key`; if it already exists, use `patch_resources` with that `associated_item_id`
93
+ - `client_key` is only a same-call reference for `view_configs[].associated_item_refs`; it is not saved and cannot deduplicate later calls
94
+ - do not pass backend raw `sourceType`; view resources infer the internal Qingflow view source, report/chart resources default to BI app reports, and existing dataset reports use `report_source="dataset"`
95
+ - use `match_mappings` for associated view/report filters; dynamic conditions use `source_field`, static conditions use `value`
96
+ - if field type compatibility is unclear, read [references/match-rules.md](references/match-rules.md)
97
+ - Views and flows:
98
+ - stay on `app_views_apply` / `app_flow_apply`
99
+ - use `patch_views` for existing-view parameter changes such as `query_conditions`, `filters`, `columns`, or visibility
100
+ - builder view writes use raw `view_key` values from `app_get.views`; `custom:<viewKey>` is a record-data `view_id` form, not a builder `view_key`
101
+ - use `builder_tool_contract` whenever the minimal legal shape is unclear
102
+ - keep view `filters` and `query_conditions` separate: `filters` are fixed saved filters; `query_conditions` configure the frontend query panel fields and only take effect after users enter query values
103
+ - new views default the associated report/view display area to visible with `limit_type="all"`; existing views preserve their current associated-resource display unless `associated_resources` is explicitly patched
104
+ - configure associated reports/views through `app_associated_resources_apply`, not through `app_views_apply`
105
+
106
+ ## Standard Operating Order
107
+
108
+ 1. Trust the current MCP/session when it is already injected by the runtime; only run auth/workspace recovery after a tool explicitly reports an auth, credential, or workspace error
109
+ 2. Confirm whether the task is read-only or write-impacting
110
+ 3. Resolve the smallest stable target:
111
+ - app-scoped work -> `app_resolve`
112
+ - package-scoped work with known id -> `package_get`
113
+ - portal inventory -> `portal_list`
114
+ 4. Read only the smallest config slice needed:
115
+ - app map -> `app_get` (default entry; includes compact views, charts, custom buttons, and associated resource pool)
116
+ - fields -> `app_get_fields`
117
+ - layout -> `app_get_layout`
118
+ - views -> `app_get_views` only when the app_get compact list is not enough
119
+ - flow -> `app_get_flow`
120
+ - charts -> `app_get_charts` only when the app_get compact list is not enough
121
+ - portal -> `portal_get`
122
+ 5. If the public shape is unclear, call `builder_tool_contract`
123
+ 6. Apply the smallest patch tool that fits:
124
+ - fields -> `app_schema_apply`
125
+ - layout -> `app_layout_apply`
126
+ - flow -> `app_flow_apply`
127
+ - existing views -> `app_views_apply.patch_views`; new/full views -> `app_views_apply.upsert_views`
128
+ - existing buttons -> `app_custom_buttons_apply.patch_buttons`; new/full buttons -> `app_custom_buttons_apply.upsert_buttons`
129
+ - existing associated resources -> `app_associated_resources_apply.patch_resources`; new/full resources -> `app_associated_resources_apply.upsert_resources`
130
+ - existing charts -> `app_charts_apply.patch_charts`; new/full charts -> `app_charts_apply.upsert_charts`
131
+ - portal -> `portal_apply`
132
+ - package metadata/layout -> `package_apply`
133
+ 7. Use `app_publish_verify` only when the user explicitly wants final publish/live verification or you need a dedicated verification pass
134
+
135
+ ## Safe Usage Rules
136
+
137
+ - Do not guess package identity from a loose name. Public package work assumes a known `package_id`, or an explicit create/update intent through `package_apply`.
138
+ - Do not perform routine auth probes before every builder action in runtime contexts with injected MCP credentials; recover auth only after an actual auth/workspace failure.
139
+ - If `package_id` is unknown, derive it from related app/portal readback when possible; otherwise ask the user instead of falling back to hidden package lookup tools.
140
+ - Do not use `package_create` or `package_attach_app` as a public default path. If they still appear in low-level code, treat them as internal/legacy implementation details.
141
+ - Do not use raw `portal_*` writes or raw `qingbi_report_*` writes as the default builder strategy.
142
+ - `app_schema_apply`, `app_layout_apply`, `app_flow_apply`, and `app_views_apply` publish by default; `app_custom_buttons_apply` and `app_associated_resources_apply` publish after at least one write succeeds and do not accept a draft-only `publish` parameter; `app_charts_apply` is immediate-live without publish.
143
+ - When creating or updating fields, configure the app data title/cover directly in field JSON: `as_data_title: true` is required on exactly one readable top-level title field; `as_data_cover: true` is optional and only valid on one top-level `attachment` field.
144
+ - If the same validation error repeats twice, stop guessing and re-read `builder_tool_contract`.
145
+ - For workflow assignees, prefer `role_search` over explicit members unless the user explicitly wants named members.
146
+ - Public flow building is still intentionally limited to stable linear workflows. If a requirement sounds like branches/conditions, explain the limitation instead of freehanding unsupported graph shapes.
147
+ - Respect collaborative edit locks. Only use `app_release_edit_lock_if_mine` when the lock owner is the current authenticated user.
148
+ - If the supported builder surface is still awkward or blocked after reasonable use, summarize the gap, ask whether to submit feedback, and call `feedback_submit` only after explicit user confirmation.
149
+
150
+ ## Response Interpretation
151
+
152
+ - All builder apply/write tools return a standard UI envelope in addition to legacy fields:
153
+ `schema_version`, `operation`, `summary`, and `resources[]`.
154
+ - For UI cards or quick narration, read `resources[]` first. Each resource has `resource_type`, `operation`, `status`, `id`, `key`, `name`, typed `ids`, and `parent`.
155
+ - Use legacy fields such as `field_diff`, `views_diff`, `chart_results`, `created/updated/removed`, and `verification` only for compatibility and troubleshooting.
156
+ - Treat post-write readback as the source of truth, not just write status codes.
157
+ - `success` means write and verification completed; `partial_success` means the write landed but verification is incomplete.
158
+ - For portals, distinguish clearly between:
159
+ - base-info-only update with layout preserved
160
+ - full sections replace
161
+ - For object apply tools, distinguish clearly between:
162
+ - `patch_*`: public partial parameter replacement; the tool hydrates current config and full-saves internally
163
+ - `upsert_*`: create or full target configuration; omitted fields may mean default/clear depending on that object
164
+ - For charts, distinguish clearly between:
165
+ - base / visibility change
166
+ - real chart-config change
167
+ - For app permissions, report `can_edit_app_base` separately from `can_edit_form / can_edit_flow / can_edit_views / can_edit_charts`.
168
+
169
+ ## Practical Patterns
170
+
171
+ - Read one package: `package_get`
172
+ - Create or update one package: `package_apply`
173
+ - Resolve one app: `app_resolve`
174
+ - Read one app map: `app_get`
175
+ - Read fields only: `app_get_fields`
176
+ - Read layout summary: `app_get_layout`
177
+ - Read views summary: `app_get_views`
178
+ - Read flow summary: `app_get_flow`
179
+ - Read chart summary: `app_get_charts`
180
+ - Read portal config: `portal_get`
181
+ - Search members or roles: `member_search`, `role_search`
182
+ - Create reusable role: `role_create`
183
+ - Add/update/remove fields: `app_schema_apply`
184
+ - Merge or replace layout: `app_layout_apply`
185
+ - Replace workflow: `app_flow_apply`
186
+ - Upsert/patch/remove views: `app_views_apply`
187
+ - Upsert/patch/remove custom buttons and bind them to header/detail view positions: `app_custom_buttons_apply`
188
+ - Upsert/patch/remove app associated reports/views and per-view display: `app_associated_resources_apply`
189
+ - Upsert/patch/remove/reorder charts: `app_charts_apply`
190
+ - Create or update portal pages: `portal_apply`
191
+ - Release your own stale edit lock: `app_release_edit_lock_if_mine`
192
+ - Final publish verification: `app_publish_verify`
193
+
194
+ ## Button Pattern
195
+
196
+ Use `app_custom_buttons_apply` for the whole custom-button path: button body, add-data mapping, default values, and placement.
197
+
198
+ ```json
199
+ {
200
+ "tool_name": "app_custom_buttons_apply",
201
+ "arguments": {
202
+ "app_key": "EMPLOYEE_APP",
203
+ "upsert_buttons": [
204
+ {
205
+ "client_key": "add_worklog",
206
+ "button_text": "快捷添加工时",
207
+ "style_preset": "primary_blue",
208
+ "button_icon": "ex-plus-circle",
209
+ "trigger_action": "addData",
210
+ "trigger_add_data_config": {
211
+ "target_app_key": "WORKLOG_APP",
212
+ "field_mappings": [
213
+ {"source_field": "数据ID", "target_field": "关联员工"},
214
+ {"source_field": "员工名称", "target_field": "员工姓名"},
215
+ {"source_field": "所属部门", "target_field": "部门名称"}
216
+ ],
217
+ "default_values": {
218
+ "工时类型": "日常工作",
219
+ "状态": "待提交"
220
+ }
221
+ }
222
+ }
223
+ ],
224
+ "remove_buttons": [],
225
+ "view_configs": [
226
+ {
227
+ "view_key": "EMPLOYEE_VIEW",
228
+ "mode": "merge",
229
+ "buttons": [
230
+ {"button_ref": "add_worklog", "placement": "detail", "primary": true}
231
+ ]
232
+ }
233
+ ]
234
+ }
235
+ }
236
+ ```
237
+
238
+ `button_ref` may be a same-call `client_key` or an existing `button_id`. Supported placements are `header`, `detail`, and `list`; `list` maps to the backend `INSIDE` row/list button position.
239
+
240
+ For add-data buttons that create a child record linked back to the current record, map `source_field: "数据ID"` to the target relation field. Do not use raw `que_relation` unless maintaining an existing backend config.
241
+
242
+ ## Resources
243
+
244
+ - Shared public-surface baseline: [public-surface-sync.md](references/public-surface-sync.md)
245
+ - Environment switching: [references/environments.md](references/environments.md)
246
+ - Tool choice and sequencing: [references/tool-selection.md](references/tool-selection.md)
247
+ - Field matching rules: [references/match-rules.md](references/match-rules.md)
248
+ - Result semantics and gotchas: [references/gotchas.md](references/gotchas.md)
249
+ - Create one app in an existing package: [references/create-app.md](references/create-app.md)
250
+ - Update fields only: [references/update-schema.md](references/update-schema.md)
251
+ - Update layout only: [references/update-layout.md](references/update-layout.md)
252
+ - Update workflow only: [references/update-flow.md](references/update-flow.md)
253
+ - Workflow assignees and node permissions: [references/flow-actors-and-permissions.md](references/flow-actors-and-permissions.md)
254
+ - Update views only: [references/update-views.md](references/update-views.md)
255
+ - Standard end-to-end builder sequences: [references/solution-playbooks.md](references/solution-playbooks.md)
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "Qingflow App Builder"
3
+ short_description: "Build and modify Qingflow apps and systems"
4
+ default_prompt: "Use $qingflow-app-builder to build or modify a Qingflow app or system safely, and verify environment routing and post-write readbacks when builder flows touch live data."
@@ -0,0 +1,149 @@
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(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
12
+
13
+ Hierarchy reminder:
14
+
15
+ - package -> app -> field -> relation
16
+ - another business object is another app, not a text field
17
+
18
+ If creating a brand new package would help, ask the user to confirm package creation first. After confirmation, create it through `package_apply(create_if_missing=true, package_name=...)`.
19
+
20
+ ## Minimal sequence
21
+
22
+ 1. `package_get` if `package_id` is already known; otherwise derive the package from related readback or ask the user for the id
23
+ 2. `app_resolve`
24
+ 3. `app_schema_apply`
25
+ 4. `app_publish_verify` only when the user asks for explicit final verification
26
+
27
+ ## Multi-app systems are different
28
+
29
+ If the user says things like:
30
+
31
+ - “创建一个完整应用包”
32
+ - “包含项目、需求、任务、缺陷、团队这几个表单”
33
+ - “这些表单之间建立关联关系”
34
+
35
+ then do not treat that as one app.
36
+
37
+ Use this pattern instead:
38
+
39
+ 1. `package_get` or `package_apply(create_if_missing=true, package_name=...)`
40
+ 2. for a multi-app system, run one `app_schema_apply` with `apps[]`
41
+ 3. use `apps[].client_key` plus relation field `target_app_ref` when one new app references another new app
42
+
43
+ ## Example
44
+
45
+ Create a new package only after the user confirms package creation:
46
+
47
+ ```json
48
+ {
49
+ "tool_name": "package_apply",
50
+ "arguments": {
51
+ "profile": "default",
52
+ "package_name": "研发项目管理",
53
+ "create_if_missing": true
54
+ }
55
+ }
56
+ ```
57
+
58
+ Read the package when `package_id` is already known:
59
+
60
+ ```json
61
+ {
62
+ "tool_name": "package_get",
63
+ "arguments": {
64
+ "profile": "default",
65
+ "package_id": 1218950
66
+ }
67
+ }
68
+ ```
69
+
70
+ Apply schema for a new app:
71
+
72
+ ```json
73
+ {
74
+ "tool_name": "app_schema_apply",
75
+ "arguments": {
76
+ "profile": "default",
77
+ "app_name": "客户订单",
78
+ "package_id": 1218950,
79
+ "create_if_missing": true,
80
+ "publish": true,
81
+ "add_fields": [
82
+ {"name": "订单编号", "type": "text", "required": true, "as_data_title": true},
83
+ {"name": "客户名称", "type": "text", "required": true},
84
+ {"name": "订单封面", "type": "attachment", "as_data_cover": true},
85
+ {"name": "订单金额", "type": "amount"},
86
+ {"name": "状态", "type": "single_select", "options": ["草稿", "进行中", "已完成"], "required": true}
87
+ ],
88
+ "update_fields": [],
89
+ "remove_fields": []
90
+ }
91
+ }
92
+ ```
93
+
94
+ Apply schema for multiple apps in one call:
95
+
96
+ ```json
97
+ {
98
+ "tool_name": "app_schema_apply",
99
+ "arguments": {
100
+ "profile": "default",
101
+ "package_id": 1218950,
102
+ "create_if_missing": true,
103
+ "publish": true,
104
+ "apps": [
105
+ {
106
+ "client_key": "customer",
107
+ "app_name": "客户",
108
+ "add_fields": [
109
+ {"name": "客户名称", "type": "text", "required": true, "as_data_title": true}
110
+ ]
111
+ },
112
+ {
113
+ "client_key": "order",
114
+ "app_name": "订单",
115
+ "add_fields": [
116
+ {"name": "订单编号", "type": "text", "required": true, "as_data_title": true},
117
+ {
118
+ "name": "关联客户",
119
+ "type": "relation",
120
+ "target_app_ref": "customer",
121
+ "display_field": {"name": "客户名称"},
122
+ "visible_fields": [{"name": "客户名称"}]
123
+ }
124
+ ]
125
+ }
126
+ ]
127
+ }
128
+ }
129
+ ```
130
+
131
+ 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.
132
+
133
+ ## Common failures
134
+
135
+ ### `APP_NOT_FOUND`
136
+
137
+ Expected on create. Continue with `create_if_missing=true`.
138
+
139
+ ### `CREATE_APP_ROUTE_NOT_FOUND`
140
+
141
+ The create route did not resolve in the current backend route context. In Wingent Momo runtime, first retry the same `app_schema_apply` after confirming the injected session is still active. Only run `workspace_select` if a business tool explicitly reports a missing or wrong workspace.
142
+
143
+ ### Hierarchy modeling mistake
144
+
145
+ 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:
146
+
147
+ - one package
148
+ - many apps
149
+ - relation fields between those apps
@@ -0,0 +1,63 @@
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 builder apply flows end-to-end with readback verification, or `solution_install` when the user is installing an existing packaged solution
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
+ - `preflight` or `plan` is still preferred, but fast `apply` is acceptable when the user explicitly wants an end-to-end smoke test
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
+ - default to `preflight` or `plan` before any `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 `plan`, `apply`, `repair`, or `verify`
63
+ - whether it touches an existing package or creates a new one
@@ -0,0 +1,123 @@
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
+ ```json
32
+ {
33
+ "tool_name": "app_flow_apply",
34
+ "arguments": {
35
+ "profile": "default",
36
+ "app_key": "APP_123",
37
+ "preset": "basic_approval",
38
+ "nodes": [
39
+ {
40
+ "id": "approve_1",
41
+ "type": "approve",
42
+ "name": "部门审批",
43
+ "assignees": {
44
+ "role_names": ["项目经理"]
45
+ }
46
+ }
47
+ ]
48
+ }
49
+ }
50
+ ```
51
+
52
+ ### Route to explicit members when the user names people
53
+
54
+ ```json
55
+ {
56
+ "tool_name": "app_flow_apply",
57
+ "arguments": {
58
+ "profile": "default",
59
+ "app_key": "APP_123",
60
+ "preset": "basic_approval",
61
+ "nodes": [
62
+ {
63
+ "id": "approve_1",
64
+ "type": "approve",
65
+ "name": "部门审批",
66
+ "assignees": {
67
+ "member_names": ["严琪东", "张三"]
68
+ }
69
+ }
70
+ ]
71
+ }
72
+ }
73
+ ```
74
+
75
+ ### Let one node edit selected fields only
76
+
77
+ ```json
78
+ {
79
+ "tool_name": "app_flow_apply",
80
+ "arguments": {
81
+ "profile": "default",
82
+ "app_key": "APP_123",
83
+ "mode": "replace",
84
+ "publish": true,
85
+ "nodes": [
86
+ {"id": "start", "type": "start", "name": "发起"},
87
+ {
88
+ "id": "approve_1",
89
+ "type": "approve",
90
+ "name": "部门审批",
91
+ "assignees": {
92
+ "role_names": ["项目经理"]
93
+ },
94
+ "permissions": {
95
+ "editable_fields": ["状态", "审批意见", "项目负责人"]
96
+ }
97
+ },
98
+ {"id": "end", "type": "end", "name": "结束"}
99
+ ],
100
+ "transitions": [
101
+ {"from": "start", "to": "approve_1"},
102
+ {"from": "approve_1", "to": "end"}
103
+ ]
104
+ }
105
+ }
106
+ ```
107
+
108
+ ## Common recovery
109
+
110
+ ### `ROLE_NOT_FOUND` / `AMBIGUOUS_ROLE`
111
+
112
+ - retry with `role_search`
113
+ - if the business wants a reusable route and no exact role exists, create one with `role_create`
114
+
115
+ ### `MEMBER_NOT_FOUND` / `AMBIGUOUS_MEMBER`
116
+
117
+ - retry with `member_search`
118
+ - do not guess user ids
119
+
120
+ ### `UNKNOWN_FLOW_FIELD`
121
+
122
+ - reread fields with `app_get_fields`
123
+ - only pass real current field names to `permissions.editable_fields`