@josephyan/qingflow-app-builder-mcp 1.1.24 → 1.1.26

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 (98) hide show
  1. package/README.md +5 -6
  2. package/docs/local-agent-install.md +6 -57
  3. package/entry_point.py +1 -1
  4. package/npm/bin/qingflow-app-builder-mcp.mjs +33 -2
  5. package/npm/lib/runtime.mjs +101 -21
  6. package/npm/scripts/postinstall.mjs +10 -1
  7. package/package.json +2 -3
  8. package/pyproject.toml +1 -1
  9. package/skills/qingflow-app-builder/SKILL.md +42 -104
  10. package/skills/qingflow-app-builder/references/build-complete-system.md +428 -0
  11. package/skills/qingflow-app-builder/references/build-single-app.md +530 -0
  12. package/skills/qingflow-app-builder/references/create-app.md +11 -30
  13. package/skills/qingflow-app-builder/references/environments.md +1 -1
  14. package/skills/qingflow-app-builder/references/gotchas.md +9 -31
  15. package/skills/qingflow-app-builder/references/match-rules.md +0 -15
  16. package/skills/qingflow-app-builder/references/solution-playbooks.md +0 -10
  17. package/skills/qingflow-app-builder/references/tool-selection.md +23 -38
  18. package/skills/qingflow-app-builder/references/update-flow.md +38 -22
  19. package/skills/qingflow-app-builder/references/update-schema.md +0 -14
  20. package/skills/qingflow-app-builder/references/update-views.md +14 -83
  21. package/skills/qingflow-app-builder-code-integrations/SKILL.md +3 -5
  22. package/skills/qingflow-app-builder-code-integrations/references/code-block.md +1 -1
  23. package/skills/qingflow-app-builder-code-integrations/references/q-linker.md +1 -1
  24. package/skills/qingflow-mcp-setup/SKILL.md +111 -0
  25. package/skills/qingflow-mcp-setup/agents/openai.yaml +4 -0
  26. package/skills/qingflow-mcp-setup/references/claude-desktop.md +34 -0
  27. package/skills/qingflow-mcp-setup/references/environments.md +61 -0
  28. package/skills/qingflow-mcp-setup/references/generic-stdio.md +31 -0
  29. package/skills/qingflow-mcp-setup/scripts/check_local_server.sh +38 -0
  30. package/skills/qingflow-workflow-builder/SKILL.md +96 -0
  31. package/skills/qingflow-workflow-builder/manifest.yaml +8 -0
  32. package/skills/qingflow-workflow-builder/references/01-overview.md +45 -0
  33. package/skills/qingflow-workflow-builder/references/02-update-mode.md +53 -0
  34. package/skills/qingflow-workflow-builder/references/03-flow-patterns.md +57 -0
  35. package/skills/qingflow-workflow-builder/references/04-stage1-business-modeling.md +131 -0
  36. package/skills/qingflow-workflow-builder/references/05-stage2-members-roles.md +29 -0
  37. package/skills/qingflow-workflow-builder/references/06-stage3-build-spec.md +165 -0
  38. package/skills/qingflow-workflow-builder/references/07-stage4-validate-spec.md +33 -0
  39. package/skills/qingflow-workflow-builder/references/08-stage5-apply-verify.md +51 -0
  40. package/skills/qingflow-workflow-builder/references/09-stage6-summary.md +88 -0
  41. package/skills/qingflow-workflow-builder/references/10-node-config-reference.md +93 -0
  42. package/skills/qingflow-workflow-builder/references/11-troubleshooting.md +15 -0
  43. package/skills/qingflow-workflow-builder/scripts/diff_flow_spec.py +275 -0
  44. package/skills/qingflow-workflow-builder/scripts/validate_flow_spec.py +605 -0
  45. package/src/qingflow_mcp/__init__.py +1 -1
  46. package/src/qingflow_mcp/__main__.py +2 -6
  47. package/src/qingflow_mcp/builder_facade/models.py +108 -485
  48. package/src/qingflow_mcp/builder_facade/service.py +1686 -6674
  49. package/src/qingflow_mcp/cli/commands/builder.py +364 -322
  50. package/src/qingflow_mcp/cli/commands/chart.py +1 -1
  51. package/src/qingflow_mcp/cli/commands/common.py +3 -12
  52. package/src/qingflow_mcp/cli/commands/exports.py +2 -2
  53. package/src/qingflow_mcp/cli/commands/imports.py +3 -3
  54. package/src/qingflow_mcp/cli/commands/portal.py +2 -2
  55. package/src/qingflow_mcp/cli/commands/record.py +27 -101
  56. package/src/qingflow_mcp/cli/commands/task.py +47 -28
  57. package/src/qingflow_mcp/cli/commands/view.py +1 -1
  58. package/src/qingflow_mcp/cli/context.py +3 -0
  59. package/src/qingflow_mcp/cli/formatters.py +16 -784
  60. package/src/qingflow_mcp/cli/main.py +33 -117
  61. package/src/qingflow_mcp/errors.py +2 -43
  62. package/src/qingflow_mcp/public_surface.py +17 -26
  63. package/src/qingflow_mcp/response_trim.py +17 -81
  64. package/src/qingflow_mcp/server.py +12 -14
  65. package/src/qingflow_mcp/server_app_builder.py +36 -79
  66. package/src/qingflow_mcp/server_app_user.py +16 -22
  67. package/src/qingflow_mcp/session_store.py +7 -11
  68. package/src/qingflow_mcp/solution/compiler/__init__.py +1 -3
  69. package/src/qingflow_mcp/solution/executor.py +18 -245
  70. package/src/qingflow_mcp/tools/ai_builder_tools.py +1396 -3100
  71. package/src/qingflow_mcp/tools/app_tools.py +43 -184
  72. package/src/qingflow_mcp/tools/approval_tools.py +35 -197
  73. package/src/qingflow_mcp/tools/auth_tools.py +16 -92
  74. package/src/qingflow_mcp/tools/code_block_tools.py +40 -298
  75. package/src/qingflow_mcp/tools/custom_button_tools.py +10 -64
  76. package/src/qingflow_mcp/tools/directory_tools.py +72 -236
  77. package/src/qingflow_mcp/tools/export_tools.py +34 -244
  78. package/src/qingflow_mcp/tools/feedback_tools.py +0 -9
  79. package/src/qingflow_mcp/tools/file_tools.py +3 -9
  80. package/src/qingflow_mcp/tools/import_tools.py +49 -336
  81. package/src/qingflow_mcp/tools/navigation_tools.py +12 -91
  82. package/src/qingflow_mcp/tools/package_tools.py +6 -118
  83. package/src/qingflow_mcp/tools/portal_tools.py +3 -39
  84. package/src/qingflow_mcp/tools/qingbi_report_tools.py +7 -116
  85. package/src/qingflow_mcp/tools/record_tools.py +360 -1145
  86. package/src/qingflow_mcp/tools/resource_read_tools.py +39 -188
  87. package/src/qingflow_mcp/tools/role_tools.py +9 -80
  88. package/src/qingflow_mcp/tools/solution_tools.py +45 -59
  89. package/src/qingflow_mcp/tools/task_context_tools.py +158 -662
  90. package/src/qingflow_mcp/tools/task_tools.py +29 -113
  91. package/src/qingflow_mcp/tools/view_tools.py +3 -106
  92. package/src/qingflow_mcp/tools/workflow_tools.py +4 -48
  93. package/src/qingflow_mcp/tools/workspace_tools.py +3 -71
  94. package/npm/bin/qingflow-skills.mjs +0 -5
  95. package/skills/qingflow-app-builder/references/complete-system-development-guide.md +0 -172
  96. package/skills/qingflow-app-builder/references/single-app-development-guide.md +0 -87
  97. package/skills/qingflow-app-builder/scripts/validate_system_build_summary.py +0 -124
  98. package/src/qingflow_mcp/solution/compiler/workflow_compiler.py +0 -173
@@ -1,23 +1,20 @@
1
1
  ---
2
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.
3
+ description: Build, configure, and modify Qingflow apps and systems after the MCP is already connected and authenticated. 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
4
  metadata:
5
5
  short-description: Build and modify Qingflow apps and systems
6
6
  ---
7
7
 
8
8
  # Qingflow App Builder
9
9
 
10
- > **Skill 版本**:`qingflow-skills-2026.06.28.3`(入口文档版本;CLI 实际执行包以 `qingflow --json version` 返回的 `package / version / package_root / skill_version` 为准)。
11
-
12
10
  ## Overview
13
11
 
14
12
  This skill is for the current **public builder surface**, not for legacy low-level builder writes.
15
- In Wingent Momo runtime, trust the injected MCP session, credentials, workspace, and route context until a tool explicitly reports otherwise.
13
+ Assumes MCP is already connected, authenticated, and on the correct workspace.
16
14
 
17
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`.
18
16
 
19
17
  Before choosing a route, skim the shared maintenance baseline: [public-surface-sync.md](references/public-surface-sync.md).
20
- Then pick the matching development guide: [single-app-development-guide.md](references/single-app-development-guide.md) for one app, or [complete-system-development-guide.md](references/complete-system-development-guide.md) for app packages/systems.
21
18
 
22
19
  ## Current Public Mental Model
23
20
 
@@ -35,42 +32,10 @@ Default modeling rules:
35
32
  - Another business object -> a separate app, not a text field
36
33
  - Cross-object links -> relation fields, not text fields
37
34
 
38
- ## Route First
39
-
40
- Before any builder write, classify the request:
41
-
42
- - **Complete system / app package**: the user asks for a system, package, workspace module set, or several related forms/apps. Use `package_apply` for the package, then one `app_schema_apply(package_id=..., apps=[...])` for the app shells and fields. This is the main path for complete systems, not a bulk shortcut to abandon after the first slow response. Do not squeeze several business objects into one app.
43
- - **Single app**: the user names one form/app or gives one `app_key`. Use `app_resolve`/`app_get`, then `app_schema_apply` and the app-scoped apply tools.
44
- - **Record/user operation**: the user wants to add, edit, delete, approve, or analyze data. Route to the record/task skills instead of builder tools.
45
-
46
- For complete systems, `apps[]` should use stable `client_key` values. Same-call relation fields should use `target_app_ref` for another `apps[].client_key`; use `target_app_key` only when the target app already exists or has been confirmed by readback. Create the related apps with one multi-app schema apply; do not create each app separately just to collect app keys and then patch relations afterward.
47
-
48
- If a complete-system `app_schema_apply` times out, returns `partial_success`, returns `write_executed=true`, has `safe_to_retry=false`, or has incomplete readback, treat it as an uncertain write, not as a failed create. The next action is always `readback_before_retry`: read the package/app/fields first, compare intended `client_key`/`app_name`/relations against reality, and only then repair the missing slice. Do not retry the whole multi-app create, create `V2`/`测试`/random-suffix apps, or split the system into single-app rebuilds to bypass a duplicate/conflict.
49
-
50
- Before any write, apply this decision gate:
51
-
52
- | Evidence | Action |
53
- | --- | --- |
54
- | Exact `app_key`, `view_key`, `chart_id`, `dash_key`, or `package_id` is provided | Update that existing target unless the user explicitly asks for a new one |
55
- | Several forms/modules or a “system/package” are requested | Use the complete-system path; do not compress them into one app |
56
- | Same/similar package or app already exists and user did not say extend/replace/new | Stop and ask which target strategy to use |
57
- | Readback already contains part of the requested build | Patch only verified missing or incorrect slices |
58
- | Write state is uncertain | Read back before retrying; do not create duplicate names with suffixes |
59
-
60
- Builder schema inputs should follow agent-intuitive semantics:
61
-
62
- - choose field type by business intent first: title/short text -> `text`; notes/description -> `multiline`; status/type/stage -> `select` with `options`; labels/multiple choices -> `multi_select`; quantities/ratios/scores/durations -> `number`; money -> `amount`; cross-app link -> `relation`
63
- - field types in drafts may use intuitive aliases: `multiline -> long_text`, `select -> single_select`, `multi_select -> multi_select`, `amount -> amount`, `phone -> phone`; readback returns canonical types and that is not a schema mismatch
64
- - primary icon syntax is `icon + color`, for example `icon: "table", color: "blue"`; `icon_name/icon_color`, `icon_config`, and `icon: {name, color}` are compatibility aliases only
65
- - select-style field `options` may be strings or objects such as `{label, value}`; tools normalize to option labels
66
- - relation fields need a target plus object selectors: same-batch `target_app_ref`, existing app `target_app_key`, `display_field: {"name": "..."}`, and `visible_fields: [{"name": "..."}]`
67
- - do not impose an artificial one-relation-field-per-app limit; create the relation fields the business model needs, then rely on backend validation and readback
68
- - do not create built-in system fields as form fields: `数据ID`, `编号`, `申请人`, `申请时间`, `创建人`, `创建时间`, `提交人`, `提交时间`, `更新时间`, `更新人`, `当前流程状态`, `当前处理人`, `当前处理节点`, `流程标题`. They are platform-generated; only reference supported system fields where a tool explicitly says so, such as button `source_field: "数据ID"`
69
-
70
35
  ## Public Tools You Should Think In
71
36
 
72
37
  - Package: `package_get`, `package_apply`
73
- - App reads: `app_resolve`, `app_get`, `app_get_fields`, `app_get_layout`, `app_get_views`, `app_get_flow`, `app_get_charts`
38
+ - App reads: `app_resolve`, `app_get`, `app_get_fields`, `app_get_layout`, `app_get_views`, `app_get_flow`, `app_get_charts`, `app_get_buttons`, `app_get_associated_resources`
74
39
  - Builder reads: `portal_list`, `portal_get`, `view_get`, `chart_get`, `builder_tool_contract`
75
40
  - Directory: `member_search`, `role_search`, `role_create`
76
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`
@@ -85,10 +50,8 @@ Treat these as the official surface. Do not default to `package_create`, `packag
85
50
  - use `package_get(package_id=...)` to read one known package
86
51
  - use `package_apply(...)` for package creation, rename, icon, visibility, grouping, ordering, and app/portal layout
87
52
  - Multi-app schema work:
88
- - use one `app_schema_apply(package_id=..., apps=[...])` / CLI `builder schema apply --apps-file` when creating several apps in one package
89
- - every `apps[]` item should carry its own `client_key`, `app_name`, `icon`, `color`, and `add_fields`
90
- - same-call relation fields should use `target_app_ref` to point at another `apps[].client_key`; use `target_app` only when the app name is unique and stable, and use `target_app_key` only after the target app already exists or readback has confirmed it
91
- - timeout / `partial_success` / `write_executed=true` / `safe_to_retry=false` means `readback_before_retry`; do not directly downgrade to single-app creation
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`
92
55
  - App base permissions:
93
56
  - trust `app_get.editability.can_edit_app_base` for app base-info writes like app name, icon, and visibility
94
57
  - `can_edit_form` only means schema/form-route capability; it no longer implies app base-info write capability
@@ -100,46 +63,23 @@ Treat these as the official surface. Do not default to `package_create`, `packag
100
63
  - `portal_apply` is the public write path
101
64
  - in edit mode, omitting `sections` means “preserve existing layout and update base info only”
102
65
  - supplying `sections` means full replace semantics for sections
103
- - `patch_sections[]` is the preferred path for changing one existing portal block
104
- - do not confuse form layout with portal layout: form layout uses field-name `rows`; portal layout uses component `position.pc.x/y/cols/rows`
105
- - portal PC layout uses a 24-column grid; components with the same `y` must share the same `rows`, and their `cols` should sum to 24 unless the user explicitly wants blank space
106
- - standard workbench heights: metric cards `rows=5`, BI charts `rows=7`, data views `rows=11`
107
- - business-entry grid sections must include real `config.items[]`; do not submit an empty grid container
108
- - build portals only after referenced apps, raw `view_key`s, and chart ids/keys are known by readback
109
- - standard order is business entry -> metric cards -> BI charts -> concrete data views
110
- - do not use platform default views such as `全部数据` / `我的数据` as the main portal views
111
- - do not use `source_type: "filter"` as the normal automation path; portal filter is raw/unstable and not part of the unified filter DSL
66
+ - portal sections use a 24-column PC grid; all components sharing the same `y` coordinate must have identical `rows` values and their `cols` must sum to exactly 24; mixing `rows` in the same row causes height misalignment, and a `cols` sum under 24 leaves blank space at the row end; the next row's `y` must equal the previous row's `y` + `rows`
112
67
  - Chart work:
113
68
  - `app_charts_apply` is the public write path for app-source QingBI report bodies/configs; it creates/updates reports with `dataSourceType=qingflow`
114
69
  - 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"`
115
70
  - it does not attach the report to the Qingflow app associated-resource display; use `app_associated_resources_apply` for that
116
- - use `app_get_fields.chart_fields` as the source for dimensions, metrics, and filters; normal record/form fields are not enough
117
- - choose chart type by goal: `target/indicator` for one KPI, `bar/columnar/pie` for distribution, `line/area` for trend, `table/detail/summary` for tabular summaries, `dualaxes` for two-metric comparison
118
- - use semantic metrics: `count(*)`, `sum(金额)`, `avg(工时)`, `group_by`, `where`; do not handwrite raw `indicator_field_ids`, `selectedMetrics`, or QingBI filter matrices on the main path
119
- - do not use `summary` for a single metric card; use `target` / `indicator`
120
71
  - 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`
121
- - chart `filters` use the unified fixed-filter DSL: `field_name + operator + value/values`; the tool compiles them to QingBI string judge types
122
- - for complete systems, keep chart payloads business-scoped, commonly 4-8 `upsert_charts` by app or topic. Larger calls are accepted; if `CHART_UPSERT_BATCH_SIZE_RECOMMENDED` appears, read back before retrying and only repair failed items.
123
72
  - use `patch_charts` for changing a chart name, visibility, filters, or one config fragment on an existing chart
124
73
  - `visibility` is a public capability and should be treated as a base-only permission update
125
74
  - do not model chart visibility changes as raw config rewrites
126
75
  - Button work:
127
- - for normal view-specific business buttons, prefer `app_views_apply.upsert_views[].action_buttons` or `patch_views[].set.action_buttons`; design the view and its actions together
128
- - use `app_custom_buttons_apply` for advanced button maintenance: style/icon changes, cross-view reuse, deleting button bodies, bulk reordering view bindings, or exact qRobot/wings configs
76
+ - `app_custom_buttons_apply` is the public write path for custom button bodies and view placement
129
77
  - use `patch_buttons` for changing a single existing button parameter such as URL, text, icon, style, or add-data mapping
130
- - choose by user intent first: current record -> downstream record uses `add_data`; global independent entry uses `header`; URL/SOP/help uses `link`; approval/status transition/close task is workflow/task/automation, not a fake normal button
131
- - action choice:
132
- - current record -> downstream/child record: use `add_data` in view `action_buttons`, or `addData` in standalone buttons, with `target_app_key + field_mappings`
133
- - global independent create: use `add_data`/`addData` on `header` without current-record `source_field`
134
- - SOP/external/fixed page: use `link` with `url`
135
- - existing automation only: use `qRobot`/`wings` only when the user provides exact config
136
- - approval/status transition/close task is not a generic button action; model workflow/task action first, or use existing automation. Do not fake it with `link`
137
78
  - for add-data buttons, use `trigger_add_data_config.target_app_key + field_mappings/default_values`; do not handwrite raw `que_relation`
138
79
  - use `field_mappings` for dynamic current-record values, including system fields such as `数据ID` (`field_id=-17`) and `编号` (`field_id=0`)
139
80
  - to prefill a target relation field with the current source record, map `{"source_field": "数据ID", "target_field": "目标引用字段"}`; use `default_values` only for static constants
140
81
  - if field type compatibility is unclear, read [references/match-rules.md](references/match-rules.md)
141
- - placement choice: `header` is global and has no current-row context; `list` is row/list action and maps to backend `INSIDE`; `detail` is the safest current-record context action. Do not use current-record `field_mappings` on `header`
142
- - bind advanced standalone buttons to views through `view_configs[].buttons[]`; default to `placement`: `header` or `detail`
82
+ - bind buttons to views through `view_configs[].buttons[]`; default to `placement`: `header` or `detail`
143
83
  - builder `view_configs[].view_key` uses the raw key from `app_get.views[].view_key`, without a `custom:` prefix
144
84
  - `buttons` is required in merge mode; do not send a view config with only `view_key`
145
85
  - `view_configs[].mode` defaults to `merge`; use `mode: "replace"` or an explicit empty `buttons: []` to clear a view's custom button bindings
@@ -147,35 +87,30 @@ Treat these as the official surface. Do not default to `package_create`, `packag
147
87
  - advanced bindings may use `button_limit`, `button_formula`, `button_formula_type`, and `print_tpls` only when visibility or print-template behavior is required
148
88
  - Associated resources:
149
89
  - `app_associated_resources_apply` is the public write path for the Qingflow app-level associated report/view pool and per-view display config
90
+ - for multi-app systems, use `apps[]` to batch associated-resource writes; each item carries its own `app_key` plus `upsert_resources` / `patch_resources` / `view_configs`
150
91
  - it attaches existing BI reports/views for in-app display; it does not create or edit QingBI report bodies/configs, including dataset reports
151
92
  - use `patch_resources` for changing match rules or other existing associated-resource parameters; the tool preserves backend-required raw fields internally
152
93
  - `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
153
94
  - 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`
154
95
  - `client_key` is only a same-call reference for `view_configs[].associated_item_refs`; it is not saved and cannot deduplicate later calls
155
96
  - 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"`
156
- - use `match_mappings` for associated view/report filters; dynamic context matches use `source_field`, static filters use `value`; do not handwrite raw `matchRules`
97
+ - use `match_mappings` for associated view/report filters; dynamic conditions use `source_field`, static conditions use `value`
157
98
  - if field type compatibility is unclear, read [references/match-rules.md](references/match-rules.md)
158
99
  - Views and flows:
159
100
  - stay on `app_views_apply` / `app_flow_apply`
160
- - before building approval/fill/copy flows, make sure the app schema has an explicit business status `select` field such as `状态` / `处理状态` / `审批状态`; do not create platform workflow system fields such as `当前流程状态`
161
101
  - use `patch_views` for existing-view parameter changes such as `query_conditions`, `filters`, `columns`, or visibility
162
102
  - 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`
163
- - do not create platform default/system views named `全部数据`, `我的数据`, `我发起的`, `待办`, `已办`, or `抄送`; they are built in. New views must use business-specific names. To change a built-in view, patch by its existing raw `view_key`
164
103
  - use `builder_tool_contract` whenever the minimal legal shape is unclear
165
- - keep view `filters` and `query_conditions` separate: `filters` use `field_name + operator + value/values` and are fixed saved filters; `query_conditions` configure the frontend query panel fields and only take effect after users enter query values
166
- - choose condition/matching surface by intent: fixed saved filters -> `filters`; frontend query panel -> `query_conditions.rows`; current-record associated report/view filtering -> `match_mappings`; current-record add-data prefill -> `field_mappings`; button visibility -> `visible_when` / `button_limit`
167
- - keep relation/attachment/subtable/address/Q-Linker/code-block fields out of `query_conditions`; member/department fields may be used as query-panel fields when readback supports them. Use `filters` for fixed filters or associated-resource `match_mappings` for current-record related report/view matching
104
+ - 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
105
+ - when creating any new table or card view, always include `query_conditions` with `enabled: true`; populate `rows` with the fields most useful for searching — typically the data-title field, any status/type select fields, date fields, and member fields; do not omit `query_conditions` or leave `rows` empty on a new view
168
106
  - 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
169
107
  - configure associated reports/views through `app_associated_resources_apply`, not through `app_views_apply`
170
108
 
171
109
  ## Standard Operating Order
172
110
 
173
- 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
174
- 2. Confirm whether the task is read-only or write-impacting
175
- 3. Classify the build scope:
176
- - complete system/package -> `package_apply` or `package_get`, then one `app_schema_apply(package_id=..., apps=[...])`
177
- - single app -> `app_resolve` / `app_get`, then app-scoped apply tools
178
- - record/task/data request -> leave builder and use the matching record/task skill
111
+ 1. Ensure auth exists
112
+ 2. Ensure workspace is selected
113
+ 3. Confirm whether the task is read-only or write-impacting
179
114
  4. Resolve the smallest stable target:
180
115
  - app-scoped work -> `app_resolve`
181
116
  - package-scoped work with known id -> `package_get`
@@ -185,14 +120,14 @@ Treat these as the official surface. Do not default to `package_create`, `packag
185
120
  - fields -> `app_get_fields`
186
121
  - layout -> `app_get_layout`
187
122
  - views -> `app_get_views` only when the app_get compact list is not enough
188
- - flow -> `app_get_flow` only when the task involves approval, fill/copy, reminders, process routing, task handling, or flow repair
123
+ - flow -> `app_get_flow`
189
124
  - charts -> `app_get_charts` only when the app_get compact list is not enough
190
125
  - portal -> `portal_get`
191
126
  6. If the public shape is unclear, call `builder_tool_contract`
192
127
  7. Apply the smallest patch tool that fits:
193
128
  - fields -> `app_schema_apply`
194
129
  - layout -> `app_layout_apply`
195
- - flow -> `app_flow_apply` only when workflow is requested or clearly required
130
+ - flow -> `app_flow_apply`
196
131
  - existing views -> `app_views_apply.patch_views`; new/full views -> `app_views_apply.upsert_views`
197
132
  - existing buttons -> `app_custom_buttons_apply.patch_buttons`; new/full buttons -> `app_custom_buttons_apply.upsert_buttons`
198
133
  - existing associated resources -> `app_associated_resources_apply.patch_resources`; new/full resources -> `app_associated_resources_apply.upsert_resources`
@@ -200,22 +135,17 @@ Treat these as the official surface. Do not default to `package_create`, `packag
200
135
  - portal -> `portal_apply`
201
136
  - package metadata/layout -> `package_apply`
202
137
  8. Use `app_publish_verify` only when the user explicitly wants final publish/live verification or you need a dedicated verification pass
203
- 9. For complete-system builds, write `tmp/qingflow_system_build_summary.json` before the final response and make the final report match that file
204
138
 
205
139
  ## Safe Usage Rules
206
140
 
207
141
  - 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`.
208
- - 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.
209
142
  - 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.
210
- - Do not bypass package/app-name conflicts by inventing `V2`, `测试`, timestamp, or random suffix apps in a real business package. Read back and decide whether to update the existing app, create only a truly missing app, or ask the user.
211
- - After any uncertain schema write, do `readback_before_retry` with `package_get` / `app_resolve` / `app_get_fields`; retry only the verified missing or failed slice.
212
143
  - 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.
213
144
  - Do not use raw `portal_*` writes or raw `qingbi_report_*` writes as the default builder strategy.
214
- - `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.
145
+ - Always pass `publish: true` (or CLI `--publish`) explicitly on `app_schema_apply`, `app_layout_apply`, `app_flow_apply`, `app_views_apply`, and `portal_apply` do not rely on the default. `app_custom_buttons_apply` and `app_associated_resources_apply` publish automatically after at least one write succeeds and do not accept a `publish` parameter. `app_charts_apply` is immediate-live without a publish step.
215
146
  - 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.
216
- - Do not add platform system fields to `add_fields`; if the user asks for record id, number, applicant, creation/update time, or workflow status, use the built-in data/list/readback fields instead of creating duplicate controls.
147
+ - When any tool returns `error_code` or `VALIDATION_ERROR`, read the `message` field verbatim first before guessing at parameter or CLI parsing issues. A clear `message` like "relation field requires visible_fields" is the root cause do not redirect to unrelated hypotheses such as `create_if_missing` parsing or flag conflicts.
217
148
  - If the same validation error repeats twice, stop guessing and re-read `builder_tool_contract`.
218
- - Do not create workflows just to make a build look complete. If no approval/fill/copy/reminder/process-routing requirement exists, report workflow as not requested/not configured.
219
149
  - For workflow assignees, prefer `role_search` over explicit members unless the user explicitly wants named members.
220
150
  - 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.
221
151
  - Respect collaborative edit locks. Only use `app_release_edit_lock_if_mine` when the lock owner is the current authenticated user.
@@ -228,18 +158,10 @@ Treat these as the official surface. Do not default to `package_create`, `packag
228
158
  - For UI cards or quick narration, read `resources[]` first. Each resource has `resource_type`, `operation`, `status`, `id`, `key`, `name`, typed `ids`, and `parent`.
229
159
  - Use legacy fields such as `field_diff`, `views_diff`, `chart_results`, `created/updated/removed`, and `verification` only for compatibility and troubleshooting.
230
160
  - Treat post-write readback as the source of truth, not just write status codes.
231
- - `success` means write and verification completed; `partial_success` means the write landed or may have landed but verification is incomplete. If `write_executed=true`, `safe_to_retry=false`, or readback is unavailable, do `readback_before_retry` before any create retry.
232
- - Final status rule:
233
- - write result answers whether the write was attempted
234
- - readback answers what actually exists
235
- - publish/portal verification answers whether it is front-end visible
236
- - validation/contract error with `write_executed=false` is a real failure and can be fixed/retried
237
- - `partial_success`, timeout, post-write 40002/404, or readback unavailable is not enough to call the write failed; read back first and patch only proven gaps
161
+ - `success` means write and verification completed; `partial_success` means the write landed but verification is incomplete.
238
162
  - For portals, distinguish clearly between:
239
163
  - base-info-only update with layout preserved
240
164
  - full sections replace
241
- - patching one section with `patch_sections[]`
242
- - layout validity: same-row `rows`, same-row `cols` sum, and non-empty grid `items`
243
165
  - For object apply tools, distinguish clearly between:
244
166
  - `patch_*`: public partial parameter replacement; the tool hydrates current config and full-saves internally
245
167
  - `upsert_*`: create or full target configuration; omitted fields may mean default/clear depending on that object
@@ -265,17 +187,17 @@ Treat these as the official surface. Do not default to `package_create`, `packag
265
187
  - Add/update/remove fields: `app_schema_apply`
266
188
  - Merge or replace layout: `app_layout_apply`
267
189
  - Replace workflow: `app_flow_apply`
268
- - Upsert/patch/remove views, including ordinary view-specific `action_buttons`: `app_views_apply`
269
- - Advanced custom button maintenance and cross-view binding: `app_custom_buttons_apply`
190
+ - Upsert/patch/remove views: `app_views_apply`
191
+ - Upsert/patch/remove custom buttons and bind them to header/detail view positions: `app_custom_buttons_apply`
270
192
  - Upsert/patch/remove app associated reports/views and per-view display: `app_associated_resources_apply`
271
193
  - Upsert/patch/remove/reorder charts: `app_charts_apply`
272
194
  - Create or update portal pages: `portal_apply`
273
195
  - Release your own stale edit lock: `app_release_edit_lock_if_mine`
274
196
  - Final publish verification: `app_publish_verify`
275
197
 
276
- ## Advanced Button Pattern
198
+ ## Button Pattern
277
199
 
278
- For ordinary view-specific buttons, prefer `app_views_apply` with `action_buttons`; see [references/update-views.md](references/update-views.md). Use `app_custom_buttons_apply` only when you need standalone/advanced maintenance: custom style or icon, cross-view reuse, deleting button bodies, bulk binding reorder, or exact qRobot/wings config.
200
+ Use `app_custom_buttons_apply` for the whole custom-button path: button body, add-data mapping, default values, and placement.
279
201
 
280
202
  ```json
281
203
  {
@@ -321,6 +243,22 @@ For ordinary view-specific buttons, prefer `app_views_apply` with `action_button
321
243
 
322
244
  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.
323
245
 
246
+ ## Playbook Selection
247
+
248
+ Before starting any build or create task, route to the right reference first:
249
+
250
+ | User intent | Signal phrases | Playbook |
251
+ |-------------|---------------|---------|
252
+ | Multi-app business system with cross-app relations, shared workflow, and a portal dashboard | "建一套系统"、"包含 N 个模块"、"这几个表单之间建立关联"、"完整的业务系统" | [build-complete-system.md](references/build-complete-system.md) |
253
+ | Single app end-to-end: rich schema, layout, flow, multiple view types, custom buttons, in-app charts, associated resources, and sample data | "建一个应用"、"帮我搭一个XX管理"、"从零开始建一个XX"、"我需要一个管理XX的应用" | [build-single-app.md](references/build-single-app.md) |
254
+ | Add one new app inside an existing package | "在这个包里加一个表单"、"现有系统里新增一个模块" | [create-app.md](references/create-app.md) |
255
+ | Update fields or schema only | "加一个字段"、"改字段名"、"删除字段" | [update-schema.md](references/update-schema.md) |
256
+ | Update layout only | "调整分组"、"改排列顺序" | [update-layout.md](references/update-layout.md) |
257
+ | Update workflow only | "修改审批流"、"加一个审批节点" | [update-flow.md](references/update-flow.md) |
258
+ | Update views only | "加一个看板"、"改筛选条件"、"新增视图" | [update-views.md](references/update-views.md) |
259
+
260
+ Decision rule: if the user mentions **multiple related apps or a portal**, use `build-complete-system.md`. If it is **one app** with a from-scratch setup request, use `build-single-app.md`. If the target app already exists and the user only wants to change one layer, use the matching single-layer playbook.
261
+
324
262
  ## Resources
325
263
 
326
264
  - Shared public-surface baseline: [public-surface-sync.md](references/public-surface-sync.md)
@@ -328,8 +266,6 @@ For add-data buttons that create a child record linked back to the current recor
328
266
  - Tool choice and sequencing: [references/tool-selection.md](references/tool-selection.md)
329
267
  - Field matching rules: [references/match-rules.md](references/match-rules.md)
330
268
  - Result semantics and gotchas: [references/gotchas.md](references/gotchas.md)
331
- - Single app development guide: [references/single-app-development-guide.md](references/single-app-development-guide.md)
332
- - Complete system development guide: [references/complete-system-development-guide.md](references/complete-system-development-guide.md)
333
269
  - Create one app in an existing package: [references/create-app.md](references/create-app.md)
334
270
  - Update fields only: [references/update-schema.md](references/update-schema.md)
335
271
  - Update layout only: [references/update-layout.md](references/update-layout.md)
@@ -337,3 +273,5 @@ For add-data buttons that create a child record linked back to the current recor
337
273
  - Workflow assignees and node permissions: [references/flow-actors-and-permissions.md](references/flow-actors-and-permissions.md)
338
274
  - Update views only: [references/update-views.md](references/update-views.md)
339
275
  - Standard end-to-end builder sequences: [references/solution-playbooks.md](references/solution-playbooks.md)
276
+ - Build a complete multi-app system from scratch: [references/build-complete-system.md](references/build-complete-system.md)
277
+ - Build a single app end-to-end (schema + layout + flow + views + buttons + charts + associated resources + data): [references/build-single-app.md](references/build-single-app.md)