@josephyan/qingflow-cli 1.1.4 → 1.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/README.md +7 -3
  2. package/docs/local-agent-install.md +57 -6
  3. package/entry_point.py +1 -1
  4. package/npm/bin/qingflow-skills.mjs +5 -0
  5. package/npm/bin/qingflow.mjs +1 -34
  6. package/npm/lib/runtime.mjs +21 -101
  7. package/npm/scripts/postinstall.mjs +1 -10
  8. package/package.json +3 -2
  9. package/pyproject.toml +1 -1
  10. package/skills/qingflow-cli/SKILL.md +58 -44
  11. package/skills/qingflow-cli/manifest.yaml +1 -1
  12. package/skills/qingflow-cli/reference/00-INDEX.md +35 -0
  13. package/skills/qingflow-cli/reference/builder/10-build-single-app.md +38 -0
  14. package/skills/qingflow-cli/reference/builder/20-build-complete-system.md +39 -0
  15. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_SCHEMA_APPLY_FIELD_TYPES_AND_SCENARIOS.md → builder/30-schema-fields.md} +52 -10
  16. package/skills/qingflow-cli/reference/builder/40-layout.md +52 -0
  17. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_BUILDER_VIEWS_WORKFLOW.md → builder/50-views.md} +39 -15
  18. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_BUILDER_CHARTS_WORKFLOW.md → builder/60-charts.md} +36 -13
  19. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_BUILDER_PORTAL_WORKFLOW.md → builder/70-portal.md} +36 -13
  20. package/skills/qingflow-cli/reference/builder/80-buttons-associated-resources.md +41 -0
  21. package/skills/qingflow-cli/reference/builder/90-workflow.md +34 -0
  22. package/skills/qingflow-cli/reference/builder/99-publish-verify.md +46 -0
  23. package/skills/qingflow-cli/reference/builder/README.md +41 -0
  24. package/skills/qingflow-cli/reference/builder/code-integrations/README.md +130 -0
  25. package/skills/qingflow-cli/reference/builder/code-integrations/code-block.md +66 -0
  26. package/skills/qingflow-cli/reference/builder/code-integrations/q-linker.md +77 -0
  27. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_BUILDER_APP_DELIVERY_WORKFLOW.md → builder/reference/app-delivery-sop.md} +26 -16
  28. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/README.md +293 -0
  29. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/build-complete-system.md +809 -0
  30. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/build-single-app.md +830 -0
  31. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/complete-system-development-guide.md +123 -0
  32. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/create-app.md +182 -0
  33. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/environments.md +63 -0
  34. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/flow-actors-and-permissions.md +142 -0
  35. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/gotchas.md +108 -0
  36. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/match-rules.md +114 -0
  37. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/public-surface-sync.md +75 -0
  38. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/single-app-development-guide.md +58 -0
  39. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/solution-playbooks.md +52 -0
  40. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/tool-selection.md +107 -0
  41. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/update-flow.md +7 -0
  42. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/update-layout.md +7 -0
  43. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/update-schema.md +7 -0
  44. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/update-views.md +7 -0
  45. package/skills/qingflow-cli/reference/builder/workflow/01-overview.md +45 -0
  46. package/skills/qingflow-cli/reference/builder/workflow/02-update-mode.md +53 -0
  47. package/skills/qingflow-cli/reference/builder/workflow/03-flow-patterns.md +57 -0
  48. package/skills/qingflow-cli/reference/builder/workflow/04-stage1-business-modeling.md +131 -0
  49. package/skills/qingflow-cli/reference/builder/workflow/05-stage2-members-roles.md +29 -0
  50. package/skills/qingflow-cli/reference/builder/workflow/06-stage3-build-spec.md +165 -0
  51. package/skills/qingflow-cli/reference/builder/workflow/07-stage4-validate-spec.md +33 -0
  52. package/skills/qingflow-cli/reference/builder/workflow/08-stage5-apply-verify.md +51 -0
  53. package/skills/qingflow-cli/reference/builder/workflow/09-stage6-summary.md +88 -0
  54. package/skills/qingflow-cli/reference/builder/workflow/10-node-config-reference.md +93 -0
  55. package/skills/qingflow-cli/reference/builder/workflow/11-troubleshooting.md +15 -0
  56. package/skills/qingflow-cli/reference/builder/workflow/README.md +88 -0
  57. package/skills/qingflow-cli/reference/builder/workflow/workflow-schema.json +1754 -0
  58. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_ADMIN_CHEATSHEET.md → core/QINGFLOW_CLI_ADMIN_CHEATSHEET.md} +3 -3
  59. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_DATA_RETRIEVAL_WORKFLOW.md → core/QINGFLOW_CLI_DATA_RETRIEVAL_WORKFLOW.md} +6 -6
  60. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_EXPLORATION_REPORT.md → core/QINGFLOW_CLI_EXPLORATION_REPORT.md} +2 -2
  61. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_FIELD_DATA_TYPES.md → core/QINGFLOW_CLI_FIELD_DATA_TYPES.md} +11 -11
  62. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_MEMBER_CHEATSHEET.md → core/QINGFLOW_CLI_MEMBER_CHEATSHEET.md} +4 -4
  63. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_ONE_SHOT_CHEATSHEET.md → core/QINGFLOW_CLI_ONE_SHOT_CHEATSHEET.md} +4 -4
  64. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_RECORD_CREATE_WORKFLOW.md → record/QINGFLOW_CLI_RECORD_CREATE_WORKFLOW.md} +3 -3
  65. package/skills/qingflow-cli/reference/record/QINGFLOW_CLI_RECORD_DELETE_WORKFLOW.md +31 -0
  66. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_RECORD_IMPORT_WORKFLOW.md → record/QINGFLOW_CLI_RECORD_IMPORT_WORKFLOW.md} +4 -4
  67. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_RECORD_UPDATE_WORKFLOW.md → record/QINGFLOW_CLI_RECORD_UPDATE_WORKFLOW.md} +7 -7
  68. package/skills/qingflow-cli/reference/record/analysis/README.md +130 -0
  69. package/skills/qingflow-cli/reference/record/analysis/analysis-gotchas.md +91 -0
  70. package/skills/qingflow-cli/reference/record/analysis/analysis-patterns.md +112 -0
  71. package/skills/qingflow-cli/reference/record/analysis/business-context.md +74 -0
  72. package/skills/qingflow-cli/reference/record/analysis/confidence-reporting.md +69 -0
  73. package/skills/qingflow-cli/reference/record/analysis/data-access-playbook.md +106 -0
  74. package/skills/qingflow-cli/reference/record/analysis/pandas-recipes.md +172 -0
  75. package/skills/qingflow-cli/reference/record/analysis/report-format.md +76 -0
  76. package/skills/qingflow-cli/reference/record/insert/README.md +75 -0
  77. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_TASK_CONTEXT_WORKFLOW.md → task/QINGFLOW_CLI_TASK_CONTEXT_WORKFLOW.md} +5 -5
  78. package/skills/qingflow-cli/reference/task/ops/README.md +131 -0
  79. package/skills/qingflow-cli/reference/task/ops/environments.md +43 -0
  80. package/skills/qingflow-cli/reference/task/ops/workflow-usage.md +26 -0
  81. package/skills/qingflow-cli/scripts/validate_system_build_summary.py +124 -0
  82. package/skills/qingflow-cli/scripts/workflow/diff_flow_spec.py +275 -0
  83. package/skills/qingflow-cli/scripts/workflow/validate_flow_spec.py +605 -0
  84. package/skills/qingflow-mcp-setup/SKILL.md +115 -0
  85. package/skills/qingflow-mcp-setup/agents/openai.yaml +4 -0
  86. package/skills/qingflow-mcp-setup/references/claude-desktop.md +34 -0
  87. package/skills/qingflow-mcp-setup/references/environments.md +62 -0
  88. package/skills/qingflow-mcp-setup/references/generic-stdio.md +32 -0
  89. package/skills/qingflow-mcp-setup/scripts/check_local_server.sh +38 -0
  90. package/src/qingflow_mcp/__init__.py +1 -1
  91. package/src/qingflow_mcp/__main__.py +6 -2
  92. package/src/qingflow_mcp/builder_facade/models.py +282 -102
  93. package/src/qingflow_mcp/builder_facade/service.py +4192 -935
  94. package/src/qingflow_mcp/cli/commands/builder.py +316 -298
  95. package/src/qingflow_mcp/cli/commands/chart.py +1 -1
  96. package/src/qingflow_mcp/cli/commands/common.py +12 -3
  97. package/src/qingflow_mcp/cli/commands/exports.py +2 -2
  98. package/src/qingflow_mcp/cli/commands/imports.py +3 -3
  99. package/src/qingflow_mcp/cli/commands/portal.py +2 -2
  100. package/src/qingflow_mcp/cli/commands/record.py +101 -27
  101. package/src/qingflow_mcp/cli/commands/task.py +28 -47
  102. package/src/qingflow_mcp/cli/commands/view.py +1 -1
  103. package/src/qingflow_mcp/cli/context.py +0 -3
  104. package/src/qingflow_mcp/cli/formatters.py +784 -16
  105. package/src/qingflow_mcp/cli/main.py +117 -33
  106. package/src/qingflow_mcp/errors.py +43 -2
  107. package/src/qingflow_mcp/public_surface.py +26 -17
  108. package/src/qingflow_mcp/response_trim.py +81 -17
  109. package/src/qingflow_mcp/server.py +14 -12
  110. package/src/qingflow_mcp/server_app_builder.py +65 -21
  111. package/src/qingflow_mcp/server_app_user.py +22 -16
  112. package/src/qingflow_mcp/session_store.py +11 -7
  113. package/src/qingflow_mcp/solution/compiler/__init__.py +3 -1
  114. package/src/qingflow_mcp/solution/compiler/workflow_compiler.py +173 -0
  115. package/src/qingflow_mcp/solution/executor.py +245 -18
  116. package/src/qingflow_mcp/tools/ai_builder_tools.py +1780 -406
  117. package/src/qingflow_mcp/tools/app_tools.py +184 -43
  118. package/src/qingflow_mcp/tools/approval_tools.py +197 -35
  119. package/src/qingflow_mcp/tools/auth_tools.py +92 -16
  120. package/src/qingflow_mcp/tools/code_block_tools.py +298 -40
  121. package/src/qingflow_mcp/tools/custom_button_tools.py +64 -10
  122. package/src/qingflow_mcp/tools/directory_tools.py +236 -72
  123. package/src/qingflow_mcp/tools/export_tools.py +244 -34
  124. package/src/qingflow_mcp/tools/feedback_tools.py +9 -0
  125. package/src/qingflow_mcp/tools/file_tools.py +9 -3
  126. package/src/qingflow_mcp/tools/import_tools.py +336 -49
  127. package/src/qingflow_mcp/tools/navigation_tools.py +91 -12
  128. package/src/qingflow_mcp/tools/package_tools.py +118 -6
  129. package/src/qingflow_mcp/tools/portal_tools.py +39 -3
  130. package/src/qingflow_mcp/tools/qingbi_report_tools.py +116 -7
  131. package/src/qingflow_mcp/tools/record_tools.py +1141 -356
  132. package/src/qingflow_mcp/tools/resource_read_tools.py +188 -39
  133. package/src/qingflow_mcp/tools/role_tools.py +80 -9
  134. package/src/qingflow_mcp/tools/solution_tools.py +59 -45
  135. package/src/qingflow_mcp/tools/task_context_tools.py +662 -158
  136. package/src/qingflow_mcp/tools/task_tools.py +113 -29
  137. package/src/qingflow_mcp/tools/view_tools.py +106 -3
  138. package/src/qingflow_mcp/tools/workflow_tools.py +48 -4
  139. package/src/qingflow_mcp/tools/workspace_tools.py +71 -3
  140. /package/skills/qingflow-cli/reference/{QINGFLOW_CLI_BUILDER_MATCH_RULES.md → builder/reference/match-rules.md} +0 -0
  141. /package/skills/qingflow-cli/reference/{QINGFLOW_CLI_BUILDER_WORKSPACE_ICONS.md → builder/reference/workspace-icons.md} +0 -0
  142. /package/skills/qingflow-cli/reference/{charts_remove.example.json → examples/charts/charts_remove.example.json} +0 -0
  143. /package/skills/qingflow-cli/reference/{charts_reorder.example.json → examples/charts/charts_reorder.example.json} +0 -0
  144. /package/skills/qingflow-cli/reference/{charts_upsert_bar.example.json → examples/charts/charts_upsert_bar.example.json} +0 -0
  145. /package/skills/qingflow-cli/reference/{charts_upsert_dashboard_starter.example.json → examples/charts/charts_upsert_dashboard_starter.example.json} +0 -0
  146. /package/skills/qingflow-cli/reference/{charts_upsert_minimal.example.json → examples/charts/charts_upsert_minimal.example.json} +0 -0
  147. /package/skills/qingflow-cli/reference/{portal_sections_all_types.example.json → examples/portal/portal_sections_all_types.example.json} +0 -0
  148. /package/skills/qingflow-cli/reference/{portal_sections_five_types.example.json → examples/portal/portal_sections_five_types.example.json} +0 -0
  149. /package/skills/qingflow-cli/reference/{portal_sections_standard_workbench.example.json → examples/portal/portal_sections_standard_workbench.example.json} +0 -0
  150. /package/skills/qingflow-cli/reference/{_batch_schema_complex.json → examples/schema/_batch_schema_complex.json} +0 -0
  151. /package/skills/qingflow-cli/reference/{_batch_schema_scalar.json → examples/schema/_batch_schema_scalar.json} +0 -0
  152. /package/skills/qingflow-cli/reference/{schema_add_fields_minimal.example.json → examples/schema/schema_add_fields_minimal.example.json} +0 -0
  153. /package/skills/qingflow-cli/reference/{schema_apply_add_fields_all_types.json → examples/schema/schema_apply_add_fields_all_types.json} +0 -0
  154. /package/skills/qingflow-cli/reference/{views_upsert_table_minimal.example.json → examples/views/views_upsert_table_minimal.example.json} +0 -0
@@ -0,0 +1,114 @@
1
+ # Builder Match Rules
2
+
3
+ Use this reference for builder-side field matching rules in custom buttons and associated view/report filters.
4
+
5
+ This is not the same thing as `record_access` analysis filters or normal view `filters`.
6
+
7
+ ## Where These Rules Apply
8
+
9
+ - `app_custom_buttons_apply.upsert_buttons[].trigger_add_data_config.field_mappings`
10
+ - `app_custom_buttons_apply.patch_buttons[].set.trigger_add_data_config.field_mappings`
11
+ - `app_associated_resources_apply.upsert_resources[].match_mappings`
12
+ - `app_associated_resources_apply.patch_resources[].set.match_mappings`
13
+
14
+ Prefer semantic mappings. Do not handwrite raw `que_relation` or `match_rules` unless you are preserving an existing backend config.
15
+
16
+ ## System Fields
17
+
18
+ System fields can participate in mappings:
19
+
20
+ - `数据ID`, `row_record_id`, `apply_id`, `_id` -> `field_id=-17`
21
+ This is the current record's real apply/record ID.
22
+ - `编号`, `数据编号`, `record_number` -> `field_id=0`
23
+ This is the frontend-visible record number. It may be custom formatted and is not the same as `数据ID`.
24
+
25
+ Explicit selectors such as `{"field_id": -17}` and `{"field_id": 0}` are allowed and remove ambiguity.
26
+
27
+ ## Custom Buttons
28
+
29
+ Use `field_mappings` for dynamic values copied from the current source record:
30
+
31
+ ```json
32
+ {
33
+ "target_app_key": "WORKLOG_APP",
34
+ "field_mappings": [
35
+ {"source_field": "数据ID", "target_field": "关联员工"},
36
+ {"source_field": "员工名称", "target_field": "员工姓名"}
37
+ ],
38
+ "default_values": {
39
+ "状态": "待提交"
40
+ }
41
+ }
42
+ ```
43
+
44
+ Use `default_values` only for static constants. Do not use `default_values` as the preferred way to pass the current record.
45
+
46
+ For an existing button, put the same semantic config under `patch_buttons[].set`:
47
+
48
+ ```json
49
+ {
50
+ "button_id": 3858041,
51
+ "set": {
52
+ "trigger_add_data_config": {
53
+ "target_app_key": "WORKLOG_APP",
54
+ "field_mappings": [
55
+ {"source_field": "数据ID", "target_field": "关联员工"}
56
+ ],
57
+ "default_values": {
58
+ "状态": "待提交"
59
+ }
60
+ }
61
+ }
62
+ }
63
+ ```
64
+
65
+ ## Associated Resources
66
+
67
+ Use `match_mappings` for associated view/report filters:
68
+
69
+ ```json
70
+ {
71
+ "graph_type": "view",
72
+ "target_app_key": "WORKLOG_APP",
73
+ "view_key": "WORKLOG_VIEW",
74
+ "match_mappings": [
75
+ {"target_field": "关联员工", "source_field": "数据ID"},
76
+ {"target_field": "状态", "value": "待提交"}
77
+ ]
78
+ }
79
+ ```
80
+
81
+ Dynamic conditions use `source_field`; static conditions use `value`.
82
+
83
+ For an existing associated resource, put the same filter mapping under `patch_resources[].set`:
84
+
85
+ ```json
86
+ {
87
+ "associated_item_id": 3497587,
88
+ "set": {
89
+ "match_mappings": [
90
+ {"target_field": "关联员工", "source_field": "数据ID"}
91
+ ]
92
+ }
93
+ }
94
+ ```
95
+
96
+ ## Type Compatibility
97
+
98
+ - Relation fields: match another relation field with the same target app, or match `数据ID(-17)` when the target relation points to the current source app.
99
+ - Record ID `数据ID(-17)`: can match relation fields that point to the current source app, or ID-compatible text/number fields.
100
+ - Record number `编号(0)`: can match text, long text, number, amount, or another record-number field.
101
+ - Member fields: only match member fields.
102
+ - Department fields: only match department fields.
103
+ - Option fields: single select, multi select, and boolean can match option-family fields or static option values.
104
+ - Date fields: date and datetime can match each other.
105
+ - Text fields: text, long text, phone, and email can match each other.
106
+ - Number fields: number and amount can match each other.
107
+ - Attachment, subtable, code block, Q-Linker, and address fields are not default match fields.
108
+
109
+ ## Error Interpretation
110
+
111
+ - Field not found: re-read `app_get` or `app_get_fields` and retry with an exact title or `field_id`.
112
+ - Type mismatch: choose a compatible source/target pair from the matrix above.
113
+ - Reference source mismatch: the target relation field points to a different app; choose a relation field that points back to the current source app, or match a non-relation field.
114
+ - Mixed raw and semantic modes: use either semantic `field_mappings/match_mappings` or raw `que_relation/match_rules`, never both in the same item.
@@ -0,0 +1,75 @@
1
+ # Qingflow Core Public Surface Sync
2
+
3
+ Use this file as the maintenance baseline for the core Qingflow skills.
4
+ It is not a user-facing product spec. It exists to prevent skill drift.
5
+
6
+ ## Current Public Defaults
7
+
8
+ ### User data
9
+
10
+ - Read range first with `app_get`, then `record_browse_schema_get(view_id=...)`
11
+ - Treat `record_browse_schema_get.fields` as the selected Qingflow table view header schema; `record_access.fields` and `record_list` field selectors must stay aligned with it.
12
+ - Standard flows:
13
+ - analyze: `app_get -> record_browse_schema_get -> record_access -> Python`
14
+ - browse detail: `app_get -> record_browse_schema_get -> record_list / record_get`
15
+ - explicit export/download/Excel: `app_get -> choose view_id -> view_get -> record_export_*` or `record_export_direct`; export tools require explicit `view_id`
16
+ - insert: `record_insert_schema_get -> record_insert(items)`
17
+ - update: `record_get -> record_update`; use `record_update_schema_get` only for failure diagnosis or ambiguous writable-field routing
18
+
19
+ ### Tasks
20
+
21
+ - Discovery stays on `task_list`
22
+ - `task_list --query` uses backend search first and only applies local fallback when backend returns zero rows
23
+ - Public actions are:
24
+ - `approve`
25
+ - `reject`
26
+ - `rollback`
27
+ - `transfer`
28
+ - `urge`
29
+ - `save_only`
30
+ - `reject` requires `payload.audit_feedback`
31
+ - `save_only` requires non-empty `fields`
32
+ - `TASK_RUNTIME_CONSUMED_AFTER_ACTION` is a normal post-success warning when the current node runtime is consumed and `46001` appears on re-read
33
+
34
+ ### Builder
35
+
36
+ - Official package entry: `package_get`, `package_apply`
37
+ - Official builder writes:
38
+ - `app_schema_apply`
39
+ - `app_layout_apply`
40
+ - `app_flow_apply`
41
+ - `app_views_apply`
42
+ - `app_custom_buttons_apply`
43
+ - `app_associated_resources_apply`
44
+ - `app_charts_apply`
45
+ - `portal_apply`
46
+ - `app_publish_verify`
47
+ - `portal_apply` edit mode may omit `sections` for base-info-only updates
48
+ - `app_charts_apply.visibility` is a public capability and should be treated as a base-only visibility update
49
+ - Existing object parameter replacement should use `patch_views`, `patch_buttons`, `patch_resources`, and `patch_charts`; `upsert_*` is for creation or full target config
50
+ - `app_get.editability` uses:
51
+ - `can_edit_app_base`
52
+ - `can_edit_form`
53
+ - `can_edit_flow`
54
+ - `can_edit_views`
55
+ - `can_edit_charts`
56
+
57
+ ## Known High-Drift Areas
58
+
59
+ - Task actions, especially `save_only`, reject payload requirements, and `46001` post-action interpretation
60
+ - Package public tools: do not regress to `package_create` / `package_attach_app` as the public default story
61
+ - App editability: do not let `can_edit_form` imply app base-info writes
62
+ - Portal and chart visibility: keep the public story on `portal_apply` / `app_charts_apply`, not low-level internal writes
63
+ - Analysis path: standard path stays `record_access -> Python`
64
+
65
+ ## Release Checklist For Skill Maintenance
66
+
67
+ After each beta that changes public behavior, re-check:
68
+
69
+ 1. `public_surface.py`
70
+ 2. `README.md`
71
+ 3. `server_app_builder.py` and `server.py` top-level guidance
72
+ 4. CLI help for `task`, `builder package`, `builder portal`, `builder charts`
73
+ 5. Whether new warnings or verification fields need to be explained in skills
74
+
75
+ If a tool behavior changed but the public surface did not, prefer updating the relevant skill section instead of expanding this file.
@@ -0,0 +1,58 @@
1
+ # Single App Development Guide
2
+
3
+ Use this when the user asks for one app/form, or gives one `app_key`.
4
+ If the user asks for a package, system, or several related modules, use `complete-system-development-guide.md` instead.
5
+
6
+ ## Recommended Completeness
7
+
8
+ Required:
9
+
10
+ - target package/app resolved by `package_get`, `app_resolve`, or `app_get`
11
+ - business fields created or updated through `app_schema_apply`
12
+ - exactly one readable top-level `as_data_title: true`
13
+ - no platform system fields in `add_fields`
14
+ - layout places the important fields
15
+ - at least one business view beyond platform default views when the task includes user-facing list work
16
+
17
+ Strongly recommended:
18
+
19
+ - saved filters and query panel fields for the main operating views
20
+ - simple charts when the app has status, amount, date, or owner fields worth tracking
21
+ - associated resources or buttons only when they support a concrete workflow
22
+
23
+ Optional:
24
+
25
+ - workflow, portal entry, sample data, roles, or visibility changes when requested by the user or clearly needed by the app's job
26
+
27
+ Workflow preflight:
28
+
29
+ - If the app will have approval/fill/copy workflow nodes, add one explicit business status `select` field first, such as `状态`, `处理状态`, `审批状态`, `工单状态`, or `流程阶段`.
30
+ - Do not create platform workflow system fields: `当前流程状态`, `当前处理人`, `当前处理节点`, or `流程标题`.
31
+
32
+ ## Standard Path
33
+
34
+ 1. Read current target: `app_resolve` or `app_get`.
35
+ 2. Read current fields: `app_get_fields`.
36
+ 3. Apply fields with `app_schema_apply`.
37
+ 4. Apply layout with `app_layout_apply`.
38
+ 5. Apply views with `app_views_apply` when list/table/card/gantt behavior is part of the request.
39
+ 6. Apply charts/buttons/associated resources only if they are part of the app's actual workflow.
40
+ 7. Use `app_publish_verify` only when explicit live verification is required.
41
+
42
+ ## Field Rules
43
+
44
+ - Use agent-friendly field types where possible: `text`, `multiline`, `select`, `multi_select`, `number`, `amount`, `date`, `datetime`, `member`, `department`, `attachment`, `relation`.
45
+ - Do not create `数据ID`, `编号`, `申请人`, `申请时间`, `创建人`, `创建时间`, `提交人`, `提交时间`, `更新时间`, `更新人`, `当前流程状态`, `当前处理人`, `当前处理节点`, or `流程标题`.
46
+ - Do not create built-in default views such as `全部数据` or `我的数据`; Qingflow provides system views.
47
+
48
+ ## View Query Rules
49
+
50
+ - `filters` are fixed saved filters; `query_conditions` only configures frontend query-panel fields.
51
+ - Put only query-panel fields in `query_conditions.rows`: text, long text, number, amount, date/datetime, select, member, department, phone, email, or boolean.
52
+ - Do not put relation, attachment, subtable/subfield, address, Q-Linker, or code-block fields in `query_conditions`; use fixed `filters` or associated-resource `match_mappings` instead.
53
+
54
+ ## Stop Conditions
55
+
56
+ - If the task actually needs multiple business objects, stop and switch to the complete-system guide.
57
+ - If a write returns `partial_success`, `write_executed=true`, or `safe_to_retry=false`, read back before retrying.
58
+ - If the same validation error repeats twice, re-read `qingflow --json builder contract` instead of guessing.
@@ -0,0 +1,52 @@
1
+ # Builder Playbooks
2
+
3
+ Use these when you need a quick reminder of the standard v2 builder sequences.
4
+
5
+ ## Create a new app in an existing package
6
+
7
+ 1. `package_get`
8
+ 2. `app_resolve`
9
+ 3. `app_schema_apply`
10
+ 5. `app_publish_verify` only if the user asks for explicit live verification
11
+
12
+ ## Update fields on an existing app
13
+
14
+ 1. `app_resolve`
15
+ 2. `app_get_fields`
16
+ 3. `app_schema_apply`
17
+
18
+ ## Rework layout
19
+
20
+ 1. `app_get_layout`
21
+ 2. `app_layout_apply`
22
+
23
+ Prefer `mode=merge`. Use `mode=replace` only when every field placement is intentional.
24
+
25
+ ## Add or update workflow
26
+
27
+ 1. `app_get_fields`
28
+ 2. `app_get_flow`
29
+ 3. `role_search` or `member_search`
30
+ 4. `role_create` if the business wants a reusable role and no good exact role exists
31
+ 5. `app_flow_apply`
32
+
33
+ If `app_flow_apply` reports `FLOW_DEPENDENCY_MISSING`, fix schema first.
34
+ If it reports `FLOW_ASSIGNEE_REQUIRED`, resolve roles or members first and retry with canonical `assignees.*`.
35
+
36
+ ## Add or update views
37
+
38
+ 1. `app_get_fields`
39
+ 2. `app_get_views`
40
+ 3. `app_views_apply`
41
+
42
+ For both workflow and view work, prefer `suggested_next_call` over re-guessing arguments after a validation failure.
43
+
44
+ ## Final readback
45
+
46
+ Prefer these fields after writes:
47
+
48
+ - `app_get.tag_ids`
49
+ - `app_get.publish_status`
50
+ - `app_get_layout.unplaced_fields`
51
+ - `app_get_views.views`
52
+ - `app_get_flow.nodes`
@@ -0,0 +1,107 @@
1
+ # Tool Selection
2
+
3
+ Use the smallest v2 builder tool chain that can finish the task.
4
+
5
+ ## Default path
6
+
7
+ `summary read -> apply -> publish_verify`
8
+
9
+ Public builder `apply` tools already perform server-side planning, normalization, and dependency checks internally. Do not route normal public builder work through explicit `*_plan` tools.
10
+
11
+ ## Hierarchy first
12
+
13
+ Before picking tools, decide which layer the request targets:
14
+
15
+ - `package`: a solution/app bundle like “研发项目管理” or “费控管理系统”
16
+ - `app`: one form/app inside that package
17
+ - `field`: one field inside one app
18
+ - `relation`: a field that links two apps
19
+
20
+ If the user asks for multiple forms/modules that relate to each other, this is a package-level multi-app task, not a single-app create.
21
+
22
+ ## Resolve
23
+
24
+ - `package_get`: read one known package by `package_id`
25
+ - `package_apply`: create or update one package; use `create_if_missing=true` only after explicit user intent
26
+ - `member_search`: resolve named people from the directory
27
+ - `role_search`: resolve reusable roles from the directory
28
+ - `role_create`: create a reusable role when the business owner wants role-based routing
29
+ - `app_resolve`: locate an existing app by exactly one selector mode: `app_key`, or `app_name + package_id`
30
+
31
+ ## Summary reads
32
+
33
+ All `app_get_*` tools accept either `app_key` (single) or `app_keys[]` (batch). Batch returns `{status, apps[], errors[]}` — prefer batch when reading multiple apps in one step.
34
+
35
+ - `app_get`: overall app config health, publish state, counts, and builder editability
36
+ - `app_get_fields`: field names, types, required flags, section ids
37
+ - `app_get_layout`: sections, rows, unplaced fields
38
+ - `app_get_views`: current view names, types, columns, group-by
39
+ - `app_get_flow`: workflow enabled state, full spec (nodes + transitions)
40
+ - `app_get_charts`: current chart ids, names, types, order
41
+ - `app_get_buttons`: current custom button list (draft state)
42
+ - `app_get_associated_resources`: current associated resource pool (draft state)
43
+ - `app_publish_verify`: publish state and package tag verification — accepts `app_keys[]` for multi-app batch
44
+ - `portal_get`: current portal config detail and component inventory
45
+
46
+ ## Apply tools
47
+
48
+ These execute normalized patches. Some app apply tools publish by default and still accept `publish=false`; custom button and associated-resource apply publish after at least one write succeeds and do not expose that switch.
49
+
50
+ - `app_schema_apply`: create app shell or change fields
51
+ - `app_layout_apply`: merge or replace layout; use `apps[]` (each item `{app_key, mode?, sections}`) for multi-app batch
52
+ - `app_flow_apply`: replace full workflow spec; use `patch_nodes[]` (`{id, set, unset}`) to update specific nodes without rewriting the full spec
53
+ - `app_views_apply`: use `patch_views` for existing-view parameter replacement; use `upsert_views` for creation or full target config; remove views by key; new views default associated report/view display to visible with `limit_type="all"`; use `apps[]` for multi-app batch
54
+ - `app_custom_buttons_apply`: use `patch_buttons` for existing-button parameter replacement; use `upsert_buttons` for creation or full target config; configure add-data field mappings/default values; bind buttons to header/detail/list view positions; `placement=list` maps to the backend `INSIDE` row/list button position; merge-mode view configs require `buttons`; use `view_configs[].mode="replace"` or `buttons=[]` to clear a view's custom button bindings. For child-record creation linked to the current source record, map `source_field: "数据ID"` to the target relation field. Use `apps[]` for multi-app batch.
55
+ - `app_associated_resources_apply`: attach existing BI reports/views to the Qingflow app associated-resource pool and per-view display area; it does not create or edit QingBI report bodies/configs. Use `patch_resources` for existing associated-resource parameter replacement; use `upsert_resources` for creation or full target config; `view_configs`, remove, and reorder may reference existing resources by internal `associated_item_id` or by `chart_id`/`chart_key`/`view_key`; use `match_mappings` for associated view/report filters; publishes after successful writes; omit raw `sourceType`, and use `report_source="dataset"` only to attach an existing BI dataset report. Before `upsert_resources`, read `app_get.associated_resources` and reuse an existing matching `target_app_key + view_key/chart_key`; repeated upsert can create duplicates because `client_key` is only valid inside one apply call. Use `apps[]` for multi-app batch.
56
+ - `app_charts_apply`: create/edit/remove/reorder app-source QingBI report bodies/configs with `dataSourceType=qingflow`; it does not create/edit dataset BI reports and does not attach reports to Qingflow app associated-resource display. Use `patch_charts` for existing-chart parameter replacement; use `upsert_charts` for creation or full target config; supports `target/table` aliases plus QingBI chart types such as `summary`, `columnar`, `area`, `funnel`, `radar`, `scatter`, `dualaxes`, and `map`; charts are immediate-live and do not publish; use `chart_id` when names are not unique; use `apps[]` for multi-app batch
57
+ - `portal_apply`: create or replace-update portal pages; use `dash_key` for update mode or `package_id + dash_name` for create mode; edit mode may omit `sections` for base-info-only updates; when sections are supplied they still use replace semantics; sections use a 24-column PC grid — all components in the same row (same `y`) must share the same `rows` value and their `cols` must sum to exactly 24; mismatched `rows` causes height misalignment, `cols` under 24 leaves trailing blank space; use `patch_sections[]` (`{chart_ref/view_ref/order, set, unset}`) to update individual sections without replacing all
58
+
59
+ For object-level updates, the safe partial syntax is `patch_*` with the object's real selector field plus `set` and optional `unset`. `selector` is only a concept, not a literal key. Examples: `patch_views: [{"view_key": "VIEW_KEY", "set": {...}}]`, `patch_buttons: [{"button_id": 1001, "set": {...}}]`, `patch_resources: [{"associated_item_id": 123, "set": {...}}]`, `patch_charts: [{"chart_id": 456, "set": {...}}]`, `patch_nodes: [{"id": "approve_1", "set": {...}}]`, `patch_sections: [{"chart_ref": {"chart_key": "ck_001"}, "set": {"title": "新标题"}}]`. The tool reads the current backend config, merges the patch, then submits the full backend payload internally. Do not send a partial `upsert_*` and expect missing required fields to be preserved.
60
+
61
+ ## Explicit post-apply tools
62
+
63
+ - `app_publish_verify`: explicit final publish verification when the user asks for live confirmation
64
+
65
+ ## Decision shortcuts
66
+
67
+ - Create one app inside an existing package:
68
+ `package_get -> app_resolve -> app_schema_apply`
69
+ - Create a brand new package, then create one app in it:
70
+ `package_apply(create_if_missing=true) -> app_schema_apply`
71
+ - Create a brand new multi-app system/package:
72
+ `package_apply(create_if_missing=true) -> app_schema_apply(apps[])`
73
+ - Update fields on an existing app:
74
+ `app_resolve -> app_get_fields -> app_schema_apply`
75
+ - Tidy layout:
76
+ `app_get_fields -> app_get_layout -> qingflow --json builder contract (if shape is unclear) -> app_layout_apply`
77
+ - Add workflow:
78
+ `qingflow --json builder contract -> app_get_fields -> app_get_flow -> role_search/member_search -> app_flow_apply -> app_get_flow`
79
+ - Update specific flow nodes:
80
+ `app_get_flow -> app_flow_apply.patch_nodes[]`
81
+ - Add views:
82
+ `qingflow --json builder contract -> app_get_fields -> app_get_views -> app_views_apply.patch_views/upsert_views -> app_get_views`
83
+ - Add QingBI charts:
84
+ `qingflow --json builder contract -> app_get_fields -> app_get_charts -> app_charts_apply.patch_charts/upsert_charts -> app_get_charts`
85
+ - Show an existing QingBI chart inside a Qingflow app/view:
86
+ `app_get -> app_associated_resources_apply.upsert_resources/patch_resources + view_configs -> app_get`
87
+ - Create or update a portal:
88
+ `qingflow --json builder contract -> portal_get -> portal_apply -> portal_get`
89
+ - Update portal section(s) without replacing all:
90
+ `portal_get -> portal_apply.patch_sections[]`
91
+
92
+ ## Avoid
93
+
94
+ - Do not handcraft raw Qingflow schema payloads
95
+ - Do not rely on internal `solution_*` tools in public builder flows
96
+ - Do not create a new package without first asking the user to confirm package creation
97
+ - Do not regress to `package_create` or `package_attach_app` as the public default story
98
+ - Do not treat a package/system name as `app_name` when the user clearly wants multiple apps inside it
99
+ - Do not compress multiple business objects into one app with several text fields
100
+ - Do not skip summary reads before flow or view work
101
+ - Do not emit `column_names`; always use `columns`
102
+ - Do not model layout shape with `fields`, `field_ids`, or top-level `columns`; custom layout sections should be `title + rows`
103
+ - Do not reuse internal flow keys such as `role_entries` or `editable_que_ids` in public builder calls
104
+ - Do not pass natural-language preset guesses such as `default_approval`; map them to canonical preset values first
105
+ - Do not omit assignees on approval/fill/copy nodes
106
+ - Do not patch preset flows with brand new approval/fill node ids unless you are intentionally replacing the skeleton; reuse preset ids like `approve_1` and `fill_1`
107
+ - Do not guess role ids, member ids, or editable field ids; resolve names first
@@ -0,0 +1,7 @@
1
+ # Legacy Redirect: Update Flow
2
+
3
+ This historical playbook is no longer a main entry point.
4
+
5
+ For current workflow creation, patching, and verification, read [../../90-workflow.md](../../90-workflow.md).
6
+
7
+ Reason: update behavior belongs inside the resource document. Route by target resource first, not by the generic word "update".
@@ -0,0 +1,7 @@
1
+ # Legacy Redirect: Update Layout
2
+
3
+ This historical playbook is no longer a main entry point.
4
+
5
+ For current form layout creation and update work, read [../../40-layout.md](../../40-layout.md).
6
+
7
+ Reason: update behavior belongs inside the resource document. Route by target resource first, not by the generic word "update".
@@ -0,0 +1,7 @@
1
+ # Legacy Redirect: Update Schema
2
+
3
+ This historical playbook is no longer a main entry point.
4
+
5
+ For current field creation and update work, read [../../30-schema-fields.md](../../30-schema-fields.md).
6
+
7
+ Reason: update behavior belongs inside the resource document. Route by target resource first, not by the generic word "update".
@@ -0,0 +1,7 @@
1
+ # Legacy Redirect: Update Views
2
+
3
+ This historical playbook is no longer a main entry point.
4
+
5
+ For current view creation, filtering, query panels, and patching, read [../../50-views.md](../../50-views.md).
6
+
7
+ Reason: update behavior belongs inside the resource document. Route by target resource first, not by the generic word "update".
@@ -0,0 +1,45 @@
1
+ # 轻流工作流搭建:概览与依赖
2
+
3
+ ## 关联文件
4
+
5
+ | 文件 | 说明 |
6
+ |------|------|
7
+ | `manifest.yaml` | 技能清单 |
8
+ | `SKILL.md` | 主流程入口 |
9
+ | `scripts/validate_flow_spec.py` | 工作流 Spec 验证脚本,基于 JSON Schema + 自定义约束 |
10
+ | `scripts/diff_flow_spec.py` | 新旧 Spec 差异分析脚本,辅助更新模式下最小修改原则判断 |
11
+
12
+ ---
13
+
14
+ ## 依赖声明
15
+
16
+ 本 Skill 关键依赖 **qingflow CLI**(已安装于 PATH,详见 `qingflow_cli` Skill)。以下 qingflow 命令为核心操作:
17
+
18
+ | 命令 | 用途 |
19
+ |------|------|
20
+ | `qingflow builder flow schema --json` | 获取最新 WorkflowSpecDTO JSON Schema |
21
+ | `qingflow builder flow get --app-key <KEY>` | 读取当前工作流 spec |
22
+ | `qingflow builder flow apply --app-key <KEY> --spec-file <FILE>` | 部署/更新工作流 |
23
+ | `qingflow builder member search --query <关键词>` | 搜索成员 |
24
+ | `qingflow builder role search --keyword <关键词>` | 搜索角色 |
25
+ | `qingflow --json app get --app-key <KEY>` | 获取应用信息(字段列表等) |
26
+ | `qingflow --json builder app get --app-key <KEY> fields` | 获取应用可搭建字段详情 |
27
+ | `qingflow --json builder app get --app-key <KEY> flow` | 获取流程摘要(是否启用等) |
28
+
29
+ ---
30
+
31
+ ## 能力边界
32
+
33
+ | 在范围内 | 超出范围 |
34
+ |----------|----------|
35
+ | 基于已有应用搭建工作流 | 从零创建应用 |
36
+ | 声明式 WorkflowSpec 生成与 apply | 操作复杂命令拼接 |
37
+ | 分支条件(gateway + autoJudges)配置 | 后端不支持的高级特性 |
38
+ | 审批/填写/抄送/自动化节点配置 | 修改字段定义 |
39
+ | 成员/角色搜索用于节点负责人 | 组织架构管理 |
40
+ | 验证 → apply → 校验循环 | 前端 UI 拖拽操作 |
41
+
42
+ ---
43
+
44
+ ← 返回主流程:[../SKILL.md](../../../SKILL.md)
45
+ → 下一步:[02-update-mode.md](02-update-mode.md)
@@ -0,0 +1,53 @@
1
+ # 更新模式与最小修改原则
2
+
3
+ 当应用已有工作流时,进入**更新模式**。核心原则是**最小修改**——只改动必要的部分,保持其他结构不变。
4
+
5
+ ## 为什么要保持节点 ID 稳定
6
+
7
+ 后端可能存储了 spec 中不支持的运行时配置(如审批策略、超时规则、高级权限等),这些配置与节点 ID 绑定。一旦修改节点 ID,后端会将其视为「删除旧节点 + 创建新节点」,导致不支持的配置全部丢失。
8
+
9
+ **因此:修改已有节点时,只改 attrs/name,绝不改 id。**
10
+
11
+ ## 最小修改原则速查
12
+
13
+ | 操作 | ✅ 正确做法 | ❌ 错误做法 |
14
+ |------|-----------|-----------|
15
+ | 添加节点 | 使用新 ID,追加到 nodes 末尾 | 重排已有节点 ID |
16
+ | 删除节点 | 删除对应 node 和关联边 | 不删关联边导致孤立边 |
17
+ | 修改节点配置 | 同一 ID 下只改 attrs/name | 改 ID 导致节点重建 |
18
+ | 添加边 | 追加到 edges 数组 | 修改已有边的 from/to |
19
+ | 修改条件 | 同一条边内改 condition | 删除边再新建 |
20
+ | 调整流转 | 修改边的 from/to | 改节点 ID 来适配 |
21
+
22
+ ## 使用 diff 脚本辅助判断
23
+
24
+ 在构建新 spec 后、apply 前,使用 diff 脚本对比新旧 spec:
25
+
26
+ ```bash
27
+ python3 scripts/diff_flow_spec.py tmp/current_flow.json tmp/flow_spec.json
28
+ ```
29
+
30
+ 输出会显示删除的节点/边、新增的节点/边、修改的节点/边,并自动评估是否符合最小修改原则。
31
+
32
+ 验证脚本也支持在更新模式下进行最小修改原则校验:
33
+
34
+ ```bash
35
+ python3 scripts/validate_flow_spec.py \
36
+ tmp/flow_spec.json \
37
+ --schema tmp/flow_schema.json \
38
+ --previous tmp/current_flow.json
39
+ ```
40
+
41
+ ## 更新模式 SOP 调整
42
+
43
+ 在更新模式下,阶段 3.2 变为**必须执行**(读取现有 spec),阶段 5.2 的对比验证增加最小修改原则检查:
44
+
45
+ - 节点 ID 不应无故变更
46
+ - 删除的节点/边应为业务需要,而非误删
47
+ - 修改范围应仅限于业务建模中变更的部分
48
+
49
+ ---
50
+
51
+ ← 上一步:[01-overview.md](01-overview.md)
52
+ ← 返回主流程:[../SKILL.md](../../../SKILL.md)
53
+ → 下一步:[03-flow-patterns.md](03-flow-patterns.md)
@@ -0,0 +1,57 @@
1
+ # 流程模式速查
2
+
3
+ 在构建 spec 前,先判断当前流程属于哪种模式,避免用错节点类型或边结构。
4
+
5
+ ## 线性流程
6
+
7
+ 最简单的流程模式:节点首尾相连,无分支、无条件。
8
+
9
+ ```
10
+ n1 → n2 → n3 → n4
11
+ ```
12
+
13
+ - 边不带 `condition`,按顺序流转即可
14
+ - 无需 gateway 节点
15
+ - 适用于:简单的提交→审批→结束
16
+
17
+ ## 分支流程
18
+
19
+ 轻流的分支采用**并行分支**模型——通过 `gateway` 节点(`mode: parallel`)分发,所有出边指向的分支**都会进入**,通过每条边上的条件(`condition.autoJudges`)控制分支内的节点逻辑是否执行。
20
+
21
+ ```
22
+ ┌──[条件A成立]→ n3 → n4
23
+ n1 → n2 → g1 ──┤
24
+ └──[条件B成立]→ n5
25
+ ```
26
+
27
+ **关键点**:
28
+ - 分支起点必须是 `gateway`(`mode: parallel`),终点必须是 `gateway`(`mode: join`)
29
+ - 每条分支边都需要配置 `condition`,其中至少一条为 `kind: rules` 带 `autoJudges`
30
+ - 没有条件的边使用 `kind: default` 作为兜底
31
+ - 所有分支并行进入,条件只决定分支内逻辑是否执行,不存在"条件匹配就跳过其他分支"的互斥语义
32
+
33
+ ## 循环/回退
34
+
35
+ **轻流工作流引擎不支持循环结构**。不要通过 gateway 或其他方式构建回到前序节点的环。
36
+
37
+ 如需回退到前序节点重新处理,应使用审批节点的回退开关:
38
+
39
+ ```json
40
+ {
41
+ "type": "approval",
42
+ "attrs": {
43
+ "revert": true,
44
+ "revertScope": "all"
45
+ }
46
+ }
47
+ ```
48
+
49
+ - `revert: true` 开启驳回/回退能力
50
+ - `revertScope` 控制回退范围:`all` 可回退到任意前序节点
51
+ - 这是引擎原生支持的回退机制,无需在 spec 中构建回退边
52
+
53
+ ---
54
+
55
+ ← 上一步:[02-update-mode.md](02-update-mode.md)
56
+ ← 返回主流程:[../SKILL.md](../../../SKILL.md)
57
+ → 下一步:[04-stage1-business-modeling.md](04-stage1-business-modeling.md)