@josephyan/qingflow-cli 1.1.4 → 1.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/README.md +7 -3
  2. package/docs/local-agent-install.md +57 -6
  3. package/entry_point.py +1 -1
  4. package/npm/bin/qingflow-skills.mjs +5 -0
  5. package/npm/bin/qingflow.mjs +1 -34
  6. package/npm/lib/runtime.mjs +21 -101
  7. package/npm/scripts/postinstall.mjs +1 -10
  8. package/package.json +3 -2
  9. package/pyproject.toml +1 -1
  10. package/skills/qingflow-cli/SKILL.md +58 -44
  11. package/skills/qingflow-cli/manifest.yaml +1 -1
  12. package/skills/qingflow-cli/reference/00-INDEX.md +35 -0
  13. package/skills/qingflow-cli/reference/builder/10-build-single-app.md +38 -0
  14. package/skills/qingflow-cli/reference/builder/20-build-complete-system.md +39 -0
  15. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_SCHEMA_APPLY_FIELD_TYPES_AND_SCENARIOS.md → builder/30-schema-fields.md} +52 -10
  16. package/skills/qingflow-cli/reference/builder/40-layout.md +52 -0
  17. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_BUILDER_VIEWS_WORKFLOW.md → builder/50-views.md} +39 -15
  18. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_BUILDER_CHARTS_WORKFLOW.md → builder/60-charts.md} +36 -13
  19. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_BUILDER_PORTAL_WORKFLOW.md → builder/70-portal.md} +36 -13
  20. package/skills/qingflow-cli/reference/builder/80-buttons-associated-resources.md +41 -0
  21. package/skills/qingflow-cli/reference/builder/90-workflow.md +34 -0
  22. package/skills/qingflow-cli/reference/builder/99-publish-verify.md +46 -0
  23. package/skills/qingflow-cli/reference/builder/README.md +41 -0
  24. package/skills/qingflow-cli/reference/builder/code-integrations/README.md +130 -0
  25. package/skills/qingflow-cli/reference/builder/code-integrations/code-block.md +66 -0
  26. package/skills/qingflow-cli/reference/builder/code-integrations/q-linker.md +77 -0
  27. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_BUILDER_APP_DELIVERY_WORKFLOW.md → builder/reference/app-delivery-sop.md} +26 -16
  28. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/README.md +293 -0
  29. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/build-complete-system.md +809 -0
  30. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/build-single-app.md +830 -0
  31. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/complete-system-development-guide.md +123 -0
  32. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/create-app.md +182 -0
  33. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/environments.md +63 -0
  34. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/flow-actors-and-permissions.md +142 -0
  35. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/gotchas.md +108 -0
  36. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/match-rules.md +114 -0
  37. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/public-surface-sync.md +75 -0
  38. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/single-app-development-guide.md +58 -0
  39. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/solution-playbooks.md +52 -0
  40. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/tool-selection.md +107 -0
  41. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/update-flow.md +7 -0
  42. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/update-layout.md +7 -0
  43. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/update-schema.md +7 -0
  44. package/skills/qingflow-cli/reference/builder/reference/legacy-playbooks/update-views.md +7 -0
  45. package/skills/qingflow-cli/reference/builder/workflow/01-overview.md +45 -0
  46. package/skills/qingflow-cli/reference/builder/workflow/02-update-mode.md +53 -0
  47. package/skills/qingflow-cli/reference/builder/workflow/03-flow-patterns.md +57 -0
  48. package/skills/qingflow-cli/reference/builder/workflow/04-stage1-business-modeling.md +131 -0
  49. package/skills/qingflow-cli/reference/builder/workflow/05-stage2-members-roles.md +29 -0
  50. package/skills/qingflow-cli/reference/builder/workflow/06-stage3-build-spec.md +165 -0
  51. package/skills/qingflow-cli/reference/builder/workflow/07-stage4-validate-spec.md +33 -0
  52. package/skills/qingflow-cli/reference/builder/workflow/08-stage5-apply-verify.md +51 -0
  53. package/skills/qingflow-cli/reference/builder/workflow/09-stage6-summary.md +88 -0
  54. package/skills/qingflow-cli/reference/builder/workflow/10-node-config-reference.md +93 -0
  55. package/skills/qingflow-cli/reference/builder/workflow/11-troubleshooting.md +15 -0
  56. package/skills/qingflow-cli/reference/builder/workflow/README.md +88 -0
  57. package/skills/qingflow-cli/reference/builder/workflow/workflow-schema.json +1754 -0
  58. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_ADMIN_CHEATSHEET.md → core/QINGFLOW_CLI_ADMIN_CHEATSHEET.md} +3 -3
  59. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_DATA_RETRIEVAL_WORKFLOW.md → core/QINGFLOW_CLI_DATA_RETRIEVAL_WORKFLOW.md} +6 -6
  60. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_EXPLORATION_REPORT.md → core/QINGFLOW_CLI_EXPLORATION_REPORT.md} +2 -2
  61. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_FIELD_DATA_TYPES.md → core/QINGFLOW_CLI_FIELD_DATA_TYPES.md} +11 -11
  62. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_MEMBER_CHEATSHEET.md → core/QINGFLOW_CLI_MEMBER_CHEATSHEET.md} +4 -4
  63. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_ONE_SHOT_CHEATSHEET.md → core/QINGFLOW_CLI_ONE_SHOT_CHEATSHEET.md} +4 -4
  64. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_RECORD_CREATE_WORKFLOW.md → record/QINGFLOW_CLI_RECORD_CREATE_WORKFLOW.md} +3 -3
  65. package/skills/qingflow-cli/reference/record/QINGFLOW_CLI_RECORD_DELETE_WORKFLOW.md +31 -0
  66. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_RECORD_IMPORT_WORKFLOW.md → record/QINGFLOW_CLI_RECORD_IMPORT_WORKFLOW.md} +4 -4
  67. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_RECORD_UPDATE_WORKFLOW.md → record/QINGFLOW_CLI_RECORD_UPDATE_WORKFLOW.md} +7 -7
  68. package/skills/qingflow-cli/reference/record/analysis/README.md +130 -0
  69. package/skills/qingflow-cli/reference/record/analysis/analysis-gotchas.md +91 -0
  70. package/skills/qingflow-cli/reference/record/analysis/analysis-patterns.md +112 -0
  71. package/skills/qingflow-cli/reference/record/analysis/business-context.md +74 -0
  72. package/skills/qingflow-cli/reference/record/analysis/confidence-reporting.md +69 -0
  73. package/skills/qingflow-cli/reference/record/analysis/data-access-playbook.md +106 -0
  74. package/skills/qingflow-cli/reference/record/analysis/pandas-recipes.md +172 -0
  75. package/skills/qingflow-cli/reference/record/analysis/report-format.md +76 -0
  76. package/skills/qingflow-cli/reference/record/insert/README.md +75 -0
  77. package/skills/qingflow-cli/reference/{QINGFLOW_CLI_TASK_CONTEXT_WORKFLOW.md → task/QINGFLOW_CLI_TASK_CONTEXT_WORKFLOW.md} +5 -5
  78. package/skills/qingflow-cli/reference/task/ops/README.md +131 -0
  79. package/skills/qingflow-cli/reference/task/ops/environments.md +43 -0
  80. package/skills/qingflow-cli/reference/task/ops/workflow-usage.md +26 -0
  81. package/skills/qingflow-cli/scripts/validate_system_build_summary.py +124 -0
  82. package/skills/qingflow-cli/scripts/workflow/diff_flow_spec.py +275 -0
  83. package/skills/qingflow-cli/scripts/workflow/validate_flow_spec.py +605 -0
  84. package/skills/qingflow-mcp-setup/SKILL.md +115 -0
  85. package/skills/qingflow-mcp-setup/agents/openai.yaml +4 -0
  86. package/skills/qingflow-mcp-setup/references/claude-desktop.md +34 -0
  87. package/skills/qingflow-mcp-setup/references/environments.md +62 -0
  88. package/skills/qingflow-mcp-setup/references/generic-stdio.md +32 -0
  89. package/skills/qingflow-mcp-setup/scripts/check_local_server.sh +38 -0
  90. package/src/qingflow_mcp/__init__.py +1 -1
  91. package/src/qingflow_mcp/__main__.py +6 -2
  92. package/src/qingflow_mcp/builder_facade/models.py +282 -102
  93. package/src/qingflow_mcp/builder_facade/service.py +4166 -929
  94. package/src/qingflow_mcp/cli/commands/builder.py +316 -298
  95. package/src/qingflow_mcp/cli/commands/chart.py +1 -1
  96. package/src/qingflow_mcp/cli/commands/common.py +12 -3
  97. package/src/qingflow_mcp/cli/commands/exports.py +2 -2
  98. package/src/qingflow_mcp/cli/commands/imports.py +3 -3
  99. package/src/qingflow_mcp/cli/commands/portal.py +2 -2
  100. package/src/qingflow_mcp/cli/commands/record.py +101 -27
  101. package/src/qingflow_mcp/cli/commands/task.py +28 -47
  102. package/src/qingflow_mcp/cli/commands/view.py +1 -1
  103. package/src/qingflow_mcp/cli/context.py +0 -3
  104. package/src/qingflow_mcp/cli/formatters.py +784 -16
  105. package/src/qingflow_mcp/cli/main.py +117 -33
  106. package/src/qingflow_mcp/errors.py +43 -2
  107. package/src/qingflow_mcp/public_surface.py +26 -17
  108. package/src/qingflow_mcp/response_trim.py +81 -17
  109. package/src/qingflow_mcp/server.py +14 -12
  110. package/src/qingflow_mcp/server_app_builder.py +65 -21
  111. package/src/qingflow_mcp/server_app_user.py +22 -16
  112. package/src/qingflow_mcp/session_store.py +11 -7
  113. package/src/qingflow_mcp/solution/compiler/__init__.py +3 -1
  114. package/src/qingflow_mcp/solution/compiler/workflow_compiler.py +173 -0
  115. package/src/qingflow_mcp/solution/executor.py +245 -18
  116. package/src/qingflow_mcp/tools/ai_builder_tools.py +1780 -406
  117. package/src/qingflow_mcp/tools/app_tools.py +184 -43
  118. package/src/qingflow_mcp/tools/approval_tools.py +197 -35
  119. package/src/qingflow_mcp/tools/auth_tools.py +92 -16
  120. package/src/qingflow_mcp/tools/code_block_tools.py +298 -40
  121. package/src/qingflow_mcp/tools/custom_button_tools.py +64 -10
  122. package/src/qingflow_mcp/tools/directory_tools.py +236 -72
  123. package/src/qingflow_mcp/tools/export_tools.py +244 -34
  124. package/src/qingflow_mcp/tools/feedback_tools.py +9 -0
  125. package/src/qingflow_mcp/tools/file_tools.py +9 -3
  126. package/src/qingflow_mcp/tools/import_tools.py +336 -49
  127. package/src/qingflow_mcp/tools/navigation_tools.py +91 -12
  128. package/src/qingflow_mcp/tools/package_tools.py +118 -6
  129. package/src/qingflow_mcp/tools/portal_tools.py +39 -3
  130. package/src/qingflow_mcp/tools/qingbi_report_tools.py +116 -7
  131. package/src/qingflow_mcp/tools/record_tools.py +1141 -356
  132. package/src/qingflow_mcp/tools/resource_read_tools.py +188 -39
  133. package/src/qingflow_mcp/tools/role_tools.py +80 -9
  134. package/src/qingflow_mcp/tools/solution_tools.py +59 -45
  135. package/src/qingflow_mcp/tools/task_context_tools.py +662 -158
  136. package/src/qingflow_mcp/tools/task_tools.py +113 -29
  137. package/src/qingflow_mcp/tools/view_tools.py +106 -3
  138. package/src/qingflow_mcp/tools/workflow_tools.py +48 -4
  139. package/src/qingflow_mcp/tools/workspace_tools.py +71 -3
  140. /package/skills/qingflow-cli/reference/{QINGFLOW_CLI_BUILDER_MATCH_RULES.md → builder/reference/match-rules.md} +0 -0
  141. /package/skills/qingflow-cli/reference/{QINGFLOW_CLI_BUILDER_WORKSPACE_ICONS.md → builder/reference/workspace-icons.md} +0 -0
  142. /package/skills/qingflow-cli/reference/{charts_remove.example.json → examples/charts/charts_remove.example.json} +0 -0
  143. /package/skills/qingflow-cli/reference/{charts_reorder.example.json → examples/charts/charts_reorder.example.json} +0 -0
  144. /package/skills/qingflow-cli/reference/{charts_upsert_bar.example.json → examples/charts/charts_upsert_bar.example.json} +0 -0
  145. /package/skills/qingflow-cli/reference/{charts_upsert_dashboard_starter.example.json → examples/charts/charts_upsert_dashboard_starter.example.json} +0 -0
  146. /package/skills/qingflow-cli/reference/{charts_upsert_minimal.example.json → examples/charts/charts_upsert_minimal.example.json} +0 -0
  147. /package/skills/qingflow-cli/reference/{portal_sections_all_types.example.json → examples/portal/portal_sections_all_types.example.json} +0 -0
  148. /package/skills/qingflow-cli/reference/{portal_sections_five_types.example.json → examples/portal/portal_sections_five_types.example.json} +0 -0
  149. /package/skills/qingflow-cli/reference/{portal_sections_standard_workbench.example.json → examples/portal/portal_sections_standard_workbench.example.json} +0 -0
  150. /package/skills/qingflow-cli/reference/{_batch_schema_complex.json → examples/schema/_batch_schema_complex.json} +0 -0
  151. /package/skills/qingflow-cli/reference/{_batch_schema_scalar.json → examples/schema/_batch_schema_scalar.json} +0 -0
  152. /package/skills/qingflow-cli/reference/{schema_add_fields_minimal.example.json → examples/schema/schema_add_fields_minimal.example.json} +0 -0
  153. /package/skills/qingflow-cli/reference/{schema_apply_add_fields_all_types.json → examples/schema/schema_apply_add_fields_all_types.json} +0 -0
  154. /package/skills/qingflow-cli/reference/{views_upsert_table_minimal.example.json → examples/views/views_upsert_table_minimal.example.json} +0 -0
@@ -1,13 +1,36 @@
1
- # Builder 视图创建与变更 SOP:`qingflow builder views apply`
1
+ # Builder Views
2
2
 
3
- 稳定命令:**`qingflow builder views apply`**(别名 **`qingflow build views apply`**)。编写前已结合 **builder 契约**与实现要点整理;**最小可用 `upsert` 文件**见 **[views_upsert_table_minimal.example.json](./views_upsert_table_minimal.example.json)**(与门户/报表 **`.example.json`** 同风格)。已对应用 **`ead8ims5i401`** **实跑**该文件。
3
+ Read this when the task is about table/card/board/gantt views, fixed filters, query panels, view sorting, associated report/view display on a view, or repairing existing views.
4
+
5
+ ## Scope
6
+
7
+ Responsible for: `builder views apply`, `upsert_views`, `patch_views`, `remove_views`, `columns`, `filters`, `query_conditions`, and view readback.
8
+
9
+ Not responsible for: creating associated report resources or buttons. Use [80-buttons-associated-resources.md](./80-buttons-associated-resources.md) after the target views/charts exist.
10
+
11
+ ## Main chain
12
+
13
+ ```text
14
+ app get -> app get fields/views -> views apply -> associated-resource apply when needed -> app get/views readback
15
+ ```
16
+
17
+ ## Update existing views
18
+
19
+ - Prefer `patch_views` for small changes to an existing view.
20
+ - Use raw `view_key` from `app_get.views[].view_key`; do not use record-data `custom:<view_key>` prefixes.
21
+ - Do not send a partial `upsert_views` object to update a complex existing view unless the contract says that shape is complete.
22
+ - Verify filters, query conditions, and associated resources separately before reporting success.
23
+
24
+ ## Detailed contract notes
25
+
26
+ 稳定命令:**`qingflow builder views apply`**(别名 **`qingflow build views apply`**)。编写前已结合 **builder 契约**与实现要点整理;**最小可用 `upsert` 文件**见 **[views_upsert_table_minimal.example.json](../examples/views/views_upsert_table_minimal.example.json)**(与门户/报表 **`.example.json`** 同风格)。已对应用 **`ead8ims5i401`** **实跑**该文件。
4
27
 
5
28
  > **权限**:视图**新建**走后端 `createViewgraphConfig`,需要同时满足 **视图管理 / ViewManagementAuth**(`beingViewManageStatus`)和 **数据管理 / DataManageAuth**;视图**更新/删除**只走 **ViewManagementAuth**。未开启高级应用权限时 `beingViewManageStatus` 等价回落到 **DataManageAuth**。失败时常见 **40002 / 40161 / 编辑锁**,参见主技能与 **ADMIN** 速查。
6
29
 
7
30
  > **默认系统视图**:`全部数据`、`我的数据`、`我发起的`、`待办`、`已办`、`抄送` 等由轻流自带,**不要新建同名业务视图**。新建视图必须用业务名,例如 `项目台账视图`、`客户跟进视图`、`逾期任务看板`。如果确实要调整默认系统视图,只能从 `app get views` 取已存在的 raw **`view_key`** 后用 `patch_views` 或带 `view_key` 的 `upsert_views` 更新。
8
31
 
9
- > **契约**(权威键名、枚举、`execution_notes`、示例):
10
- > `qingflow --json builder contract --tool-name app_views_apply`
32
+ > **契约**(权威键名、枚举、`execution_notes`、示例):
33
+ > `qingflow --json builder contract --tool-name app_views_apply`
11
34
  > (`--tool-name` 为契约索引,用于拉取 **`allowed_keys` / 别名 / 示例**。)
12
35
  > 契约示例若带 `"profile"`,不要复制到 `--upsert-views-file`;CLI 指定 profile 用根级 `qingflow --profile …`。
13
36
 
@@ -24,7 +47,7 @@
24
47
  | ⑤ 涉及关联/按钮 | 用专项 apply,不把它们塞进 view patch | `builder associated-resource apply` / `builder button apply` |
25
48
  | ⑥ 需要上线时 | 发布侧校验 | `qingflow builder publish verify --app-key …` |
26
49
 
27
- **说明**:`views apply` 的 **`--publish`** 对应契约里的 **`publish`**;自动化可先 **`--no-publish`**,与 schema/layout 改完再 **`publish verify`** 的节奏一致,见 **[QINGFLOW_CLI_BUILDER_APP_DELIVERY_WORKFLOW.md](./QINGFLOW_CLI_BUILDER_APP_DELIVERY_WORKFLOW.md)** 的发布校验章节。
50
+ **说明**:`views apply` 的 **`--publish`** 对应契约里的 **`publish`**;自动化可先 **`--no-publish`**,与 schema/layout 改完再 **`publish verify`** 的节奏一致,见 **[99-publish-verify.md](./99-publish-verify.md)**。
28
51
 
29
52
  ---
30
53
 
@@ -47,7 +70,7 @@ qingflow builder views apply \
47
70
 
48
71
  | 文件 | 用途 |
49
72
  |------|------|
50
- | [views_upsert_table_minimal.example.json](./views_upsert_table_minimal.example.json) | **新建 table 视图**最小 **`upsert_views` 数组**:`name` + `type` + **`columns`**(字段 **显示名**,须来自 **`builder app get --app-key … fields`**) |
73
+ | [views_upsert_table_minimal.example.json](../examples/views/views_upsert_table_minimal.example.json) | **新建 table 视图**最小 **`upsert_views` 数组**:`name` + `type` + **`columns`**(字段 **显示名**,须来自 **`builder app get --app-key … fields`**) |
51
74
 
52
75
  **本仓实测**(`ead8ims5i401`,`--no-publish`):使用文件内 **`columns`**(`单行文字`、`多行文字`)与视图 **`name`** **`示例表视图_CLI模板`** 可 **`status: success` 创建**。复制到其他应用前务必 **`app get fields`** 替换 **`columns`**;**`name`** 重名时会 **更新** 已有同名视图而非新建(见 **§4**)。
53
76
 
@@ -96,7 +119,7 @@ CLI 将参数与文件内容拼装为服务层载荷,**顶层键**如下:
96
119
  | **`board`**(看板) | 列;且须 **`group_by`**(分组字段名) | **`group_by`** |
97
120
  | **`gantt`** | 列;须 **`start_field`**、**`end_field`**(通常为日期类字段名) | 可选 **`title_field`** |
98
121
 
99
- 实现侧校验:对 **table/card**,若声明了 **`columns`**,在 **过滤系统列**后须 **至少保留一个**真实应用字段,否则报错——**不能**只用系统列名凑一列(系统列集合见 **[QINGFLOW_CLI_BUILDER_APP_DELIVERY_WORKFLOW.md](./QINGFLOW_CLI_BUILDER_APP_DELIVERY_WORKFLOW.md) §7.1**)。
122
+ 实现侧校验:对 **table/card**,若声明了 **`columns`**,在 **过滤系统列**后须 **至少保留一个**真实应用字段,否则报错——**不能**只用系统列名凑一列(系统列集合见 **[reference/app-delivery-sop.md](./reference/app-delivery-sop.md)**)。
100
123
 
101
124
  ---
102
125
 
@@ -181,7 +204,7 @@ CLI 将参数与文件内容拼装为服务层载荷,**顶层键**如下:
181
204
  - 已有资源的最终口径是 `app_get.associated_resources[].associated_item_id`;它不是 `chart_id`、`chart_key` 或 `view_key`。
182
205
  - 新版 CLI 在关联报表时可先传 `chart_id` / `chart_key`,内部会解析为轻流后端需要的 id;创建前先检查是否已有相同 `target_app_key + view_key/chart_key`,已存在时用 `patch_resources`;`client_key` 只在同一次 apply 中可被 `associated_item_refs` 引用,不会持久化。
183
206
  - 数据集 BI 报表只能关联已有报表,使用 `report_source: "dataset"`;应用源报表可先用 `builder charts apply` 创建/更新。
184
- - 关联筛选优先用 `match_mappings`;字段匹配规则见 **[QINGFLOW_CLI_BUILDER_MATCH_RULES.md](./QINGFLOW_CLI_BUILDER_MATCH_RULES.md)**。
207
+ - 关联筛选优先用 `match_mappings`;字段匹配规则见 **[reference/match-rules.md](./reference/match-rules.md)**。
185
208
 
186
209
  ---
187
210
 
@@ -260,7 +283,7 @@ CLI 将参数与文件内容拼装为服务层载荷,**顶层键**如下:
260
283
 
261
284
  ## 9. 实测记录(`ead8ims5i401`,`--no-publish`)
262
285
 
263
- 内容与仓库 **[views_upsert_table_minimal.example.json](./views_upsert_table_minimal.example.json)** 一致(或历史探针名 **`CLI探针视图_可删`**)。
286
+ 内容与仓库 **[views_upsert_table_minimal.example.json](../examples/views/views_upsert_table_minimal.example.json)** 一致(或历史探针名 **`CLI探针视图_可删`**)。
264
287
 
265
288
  **读视图**:
266
289
 
@@ -274,7 +297,7 @@ qingflow --json builder app get --app-key ead8ims5i401 views
274
297
  qingflow builder views apply \
275
298
  --app-key ead8ims5i401 \
276
299
  --no-publish \
277
- --upsert-views-file ./reference/views_upsert_table_minimal.example.json
300
+ --upsert-views-file ./reference/examples/views/views_upsert_table_minimal.example.json
278
301
  ```
279
302
 
280
303
  **结果摘要**(示例视图名 **`示例表视图_CLI模板`**):`status: success`,`verification.by_view[0].status: created`,返回 **`view_key`**(如 **`ecdk22v65c02`**),`published: false`。
@@ -292,13 +315,14 @@ qingflow builder views apply \
292
315
  | 后端 **40038 / Object not exist** | 先读失败项 **`details.per_view_results[].details.field_level_diagnostics`** 与 **`recommended_minimal_retry`**。不要删除字段、不要重建应用;先按最小列重试,再逐步加非关键列/筛选。 |
293
316
  | 按钮/关联资源配置 | 按钮走 **`builder button apply`**;关联视图/报表走 **`builder associated-resource apply`** |
294
317
  | 部分失败 | 读 **`views_diff.failed`** 与契约 **execution_notes** 中 **partial_success** |
295
- | 权限/锁 | 同 [交付 SOP](./QINGFLOW_CLI_BUILDER_APP_DELIVERY_WORKFLOW.md)(**`publish verify`**、编辑锁) |
318
+ | 权限/锁 | 同 [publish verify](./99-publish-verify.md) [app delivery reference](./reference/app-delivery-sop.md) |
296
319
 
297
320
  ---
298
321
 
299
322
  ## 11. 交叉引用
300
323
 
301
- - [views_upsert_table_minimal.example.json](./views_upsert_table_minimal.example.json)(**table** 视图最小 **`upsert`**)
302
- - [SKILL.md](../SKILL.md):builder 直接输出、鉴权顺序。
303
- - [QINGFLOW_CLI_BUILDER_APP_DELIVERY_WORKFLOW.md](./QINGFLOW_CLI_BUILDER_APP_DELIVERY_WORKFLOW.md):系统列、**`publish verify`**、整体交付阶段。
304
- - [QINGFLOW_CLI_EXPLORATION_REPORT.md](./QINGFLOW_CLI_EXPLORATION_REPORT.md):CLI 覆盖与 **`view_id` vs `view_key`** 备忘。
324
+ - [views_upsert_table_minimal.example.json](../examples/views/views_upsert_table_minimal.example.json)(**table** 视图最小 **`upsert`**)
325
+ - [SKILL.md](../../SKILL.md):builder 直接输出、鉴权顺序。
326
+ - [99-publish-verify.md](./99-publish-verify.md):发布与回读。
327
+ - [reference/app-delivery-sop.md](./reference/app-delivery-sop.md):系统列与历史交付细节。
328
+ - [QINGFLOW_CLI_EXPLORATION_REPORT.md](../core/QINGFLOW_CLI_EXPLORATION_REPORT.md):CLI 覆盖与 **`view_id` vs `view_key`** 备忘。
@@ -1,4 +1,27 @@
1
- # Builder 报表(QingBI)创建与变更 SOP:`qingflow builder charts apply`
1
+ # Builder Charts
2
+
3
+ Read this when the task is about QingBI charts, indicator cards, chart filters, chart ordering, chart update, or chart removal.
4
+
5
+ ## Scope
6
+
7
+ Responsible for: `builder charts apply`, `upsert_charts`, `patch_charts`, remove/reorder, semantic metrics such as `count(*)` or `sum(金额)`, `group_by`, `where`/`filters`, and chart readback.
8
+
9
+ Not responsible for: portal placement of charts. Use [70-portal.md](./70-portal.md) after charts exist.
10
+
11
+ ## Main chain
12
+
13
+ ```text
14
+ app get fields -> app get charts -> charts apply -> app get charts/chart get readback -> portal reference if needed
15
+ ```
16
+
17
+ ## Update existing charts
18
+
19
+ - Use `chart_id` for exact updates when names may be duplicated.
20
+ - Use `patch_charts` for small changes and `reorder_chart_ids` for ordering.
21
+ - Prefer semantic metrics and filters; do not handwrite QingBI raw matrices unless the contract requires raw diagnosis.
22
+ - Chart writes are immediate-live and are not the same as app `publish verify`.
23
+
24
+ ## Detailed contract notes
2
25
 
3
26
  稳定命令:**`qingflow builder charts apply`**(子命令 **`builder charts apply`**;**`qingflow build charts apply`** 等价)。
4
27
 
@@ -8,7 +31,7 @@
8
31
 
9
32
  > **读取链路**:`builder chart get` / `chart_get` 读取基础信息时优先走前端同源的 **`/qingbi/charts/qflow/baseinfo/{chartId}`** 可见性链路;仅当该 qflow 路由明确不存在/不适用时才退回 BI 管理详情 **`/qingbi/charts/baseinfo/{chartId}`**。配置详情 **`/qingbi/charts/{chartId}/configs`** 仍可能需要 **`CHART_SEE`**,不可用时会尝试从 qflow 数据接口返回的 embedded config 降级。不要把中间 **`CHART_SEE` / 40002** 直接当成“用户看不到报表”。
10
33
 
11
- > **契约**:`qingflow --json builder contract --tool-name app_charts_apply`
34
+ > **契约**:`qingflow --json builder contract --tool-name app_charts_apply`
12
35
  > (`--tool-name` 为契约索引。)
13
36
 
14
37
  > **与「应用发布」的关系**:契约 **execution_notes** 写明 **`app_charts_apply` 为 immediate-live,不走 `app_publish`**。改报表不等价于 **`builder publish verify`**。
@@ -165,15 +188,15 @@ CLI 对外推荐使用 **`group_by` + `metric(s)`**;旧的 **`dimension_field_
165
188
  ## 4. 创建流程(实现摘要)
166
189
 
167
190
  1. **读** 应用表单 **`fields`** + QingBI datasource **`chart_fields`**;报表维度/指标/筛选/查询条件字段以 **`chart_fields`** 为权威,表单字段只用于补充显示名/类型。
168
- 2. **无 `chart_id` 且无名或名未命中**:**`qingbi_report_create`**(临时 **`chartId`** 形如 **`mcp_<hex>`**),再以 **`chartName`/`chartType`** 做 **读回确认**,得到 **最终 `chart_id`**。
169
- 3. **有名唯一命中** 或 **`chart_id` 命中**:必要时 **`qingbi_report_update_base`**(改名、类型、**`visibleAuth`**)。
191
+ 2. **无 `chart_id` 且无名或名未命中**:**`qingbi_report_create`**(临时 **`chartId`** 形如 **`mcp_<hex>`**),再以 **`chartName`/`chartType`** 做 **读回确认**,得到 **最终 `chart_id`**。
192
+ 3. **有名唯一命中** 或 **`chart_id` 命中**:必要时 **`qingbi_report_update_base`**(改名、类型、**`visibleAuth`**)。
170
193
  4. **新建或 config 有变**:**`qingbi_report_update_config`**(**`_build_public_chart_config_payload`**);特殊 BI 类型会按上文转换后端字段。
171
194
 
172
195
  ---
173
196
 
174
197
  ## 5. **remove** / **reorder**
175
198
 
176
- - **`--remove-chart-ids-file`**:字符串 id 数组 → **`qingbi_report_delete`**。
199
+ - **`--remove-chart-ids-file`**:字符串 id 数组 → **`qingbi_report_delete`**。
177
200
  - 删除成功后工具会用单个 **`chart_id`** 回读验证是否已不存在;**纯删除不会再读全量报表列表**。若返回 **`readback_status: unavailable`** 或 **`still_exists`**,表示删除请求已发出但回读未确认,**不要盲目重复删除**,可稍后用 **`builder chart get --chart-id …`** 确认。
178
201
  - **`--reorder-chart-ids-file`**:期望的 **展示顺序前缀**;实现会 **反转** 后调 **`qingbi_report_reorder`**;验证时要求列表 **`chart_list_source == "sorted"`** 且前缀与请求一致。
179
202
 
@@ -210,10 +233,10 @@ CLI 对外推荐使用 **`group_by` + `metric(s)`**;旧的 **`dimension_field_
210
233
 
211
234
  ## 7. 示例文件(可复制)
212
235
 
213
- - **目标图(契约极简)**:[charts_upsert_minimal.example.json](./charts_upsert_minimal.example.json)
214
- - **柱状(须替换 `field_id`)**:[charts_upsert_bar.example.json](./charts_upsert_bar.example.json)
215
- - **重排**:[charts_reorder.example.json](./charts_reorder.example.json)
216
- - **删除**:[charts_remove.example.json](./charts_remove.example.json)
236
+ - **目标图(契约极简)**:[charts_upsert_minimal.example.json](../examples/charts/charts_upsert_minimal.example.json)
237
+ - **柱状(须替换 `field_id`)**:[charts_upsert_bar.example.json](../examples/charts/charts_upsert_bar.example.json)
238
+ - **重排**:[charts_reorder.example.json](../examples/charts/charts_reorder.example.json)
239
+ - **删除**:[charts_remove.example.json](../examples/charts/charts_remove.example.json)
217
240
 
218
241
  ---
219
242
 
@@ -231,7 +254,7 @@ CLI 对外推荐使用 **`group_by` + `metric(s)`**;旧的 **`dimension_field_
231
254
 
232
255
  ## 9. 交叉引用
233
256
 
234
- - [SKILL.md](../SKILL.md)
235
- - [QINGFLOW_CLI_BUILDER_APP_DELIVERY_WORKFLOW.md](./QINGFLOW_CLI_BUILDER_APP_DELIVERY_WORKFLOW.md)
236
- - [QINGFLOW_CLI_BUILDER_PORTAL_WORKFLOW.md](./QINGFLOW_CLI_BUILDER_PORTAL_WORKFLOW.md)(**`chart_ref`**)
237
- - [QINGFLOW_CLI_FIELD_DATA_TYPES.md](./QINGFLOW_CLI_FIELD_DATA_TYPES.md)(成员侧 **`kind`** 与搭建 **`type`** 对照理解业务)
257
+ - [SKILL.md](../../SKILL.md)
258
+ - [reference/app-delivery-sop.md](./reference/app-delivery-sop.md)
259
+ - [70-portal.md](./70-portal.md)(**`chart_ref`**)
260
+ - [QINGFLOW_CLI_FIELD_DATA_TYPES.md](../core/QINGFLOW_CLI_FIELD_DATA_TYPES.md)(成员侧 **`kind`** 与搭建 **`type`** 对照理解业务)
@@ -1,6 +1,29 @@
1
- # Builder 门户创建与变更 SOP:`qingflow builder portal`
1
+ # Builder Portal
2
2
 
3
- 搭建侧稳定入口:**`qingflow builder portal`**:`list` / `get` / **`apply`** / **`delete`**(与根命令 **`qingflow portal`** 的「成员可读列表/详情」不同,见 **[QINGFLOW_CLI_EXPLORATION_REPORT.md](./QINGFLOW_CLI_EXPLORATION_REPORT.md) §4.6**)。
3
+ Read this when the task is about creating, updating, deleting, publishing, or validating a portal/workbench/dashboard page.
4
+
5
+ ## Scope
6
+
7
+ Responsible for: `builder portal list/get/apply/delete`, portal sections, standard workbench layout, business entry grid items, chart/view references, publish, and portal readback.
8
+
9
+ Not responsible for: creating the apps, views, or charts referenced by the portal. Create or verify them first through [20-build-complete-system.md](./20-build-complete-system.md), [50-views.md](./50-views.md), and [60-charts.md](./60-charts.md).
10
+
11
+ ## Main chain
12
+
13
+ ```text
14
+ portal list/get if updating -> verify apps/views/charts -> portal apply -> portal get readback -> publish state
15
+ ```
16
+
17
+ ## Update existing portal
18
+
19
+ - Use `--dash-key` for updates and do not send `package_id`.
20
+ - Use `patch_sections[]` for targeted section changes when possible.
21
+ - If using a business-entry grid, include real `items`; do not submit an empty entry container.
22
+ - Validate referenced `chart_key`, `chart_id`, `view_key`, or `app_key` before claiming the portal is complete.
23
+
24
+ ## Detailed contract notes
25
+
26
+ 搭建侧稳定入口:**`qingflow builder portal`**:`list` / `get` / **`apply`** / **`delete`**(与根命令 **`qingflow portal`** 的「成员可读列表/详情」不同,见 **[QINGFLOW_CLI_EXPLORATION_REPORT.md](../core/QINGFLOW_CLI_EXPLORATION_REPORT.md) §4.6**)。
4
27
 
5
28
  实现要点来自 CLI 打包内的 `builder_facade/models.py`(`PortalApplyRequest`、`PortalSectionPatch`)、`builder_facade/service.py`(`portal_apply` / `portal_delete`)、`cli/commands/builder.py`。已对 **`package_id=2030703`**、应用 **`ead8ims5i401`** **实跑**:**新建**(`--no-publish`)、**`--publish` 更新**(网关 **503** 恢复后已重试成功)、**五类区块可稳定落库**;**`filter`(`type:6`)经 CLI 直传未落库** 见 **§3.4 / §8**。另已对测试包 **`1414907`** 实跑 **`portal delete`**:临时门户 **`etcivtmv5402`** 删除后回读 **`readback_status=deleted`**。
6
29
 
@@ -115,7 +138,7 @@ mobile 固定按 **6 栅格** 从上到下堆叠:通常所有组件 `x=0, cols
115
138
 
116
139
  - 公开 `sections-file` 稳定支持:**`grid` / `chart` / `view` / `text` / `link`**;`filter` 仍按 **§3.4** 的 raw `filterConfig` 边界处理,不作为主路径。
117
140
  - **待办 `task` / 常用 `favorite`** 是前端/后端 raw 组件形状,不在当前公开 `source_type` 合约里。智能体不要在 `sections-file` 中写 `source_type: "task"`;只有工具后续显式支持 `task`,或维护者走 raw 门户写入链路时,才使用待办槽位。
118
- - 推荐门户的可直接 apply 示例见 **[portal_sections_standard_workbench.example.json](./portal_sections_standard_workbench.example.json)**。该示例使用当前公开 CLI 可稳定写入的组件,顶部先用一个业务入口 `grid` 占满 24 栅格;如果工具已支持待办组件,再把顶部拆成 `grid cols=12 + task cols=12`。
141
+ - 推荐门户的可直接 apply 示例见 **[portal_sections_standard_workbench.example.json](../examples/portal/portal_sections_standard_workbench.example.json)**。该示例使用当前公开 CLI 可稳定写入的组件,顶部先用一个业务入口 `grid` 占满 24 栅格;如果工具已支持待办组件,再把顶部拆成 `grid cols=12 + task cols=12`。
119
142
  - `grid` 必须写 **`config.items[]`**;只写 `gridTitle` / `beingShowTitle` 会生成空入口容器,工具会返回 **`PORTAL_GRID_ITEMS_EMPTY`**。
120
143
 
121
144
  **待办组件 raw 形状参考**(仅用于工具实现对齐,当前不要作为 `--sections-file` 输入):
@@ -165,7 +188,7 @@ CLI 校验(`PortalSectionPatch`):**chart** 须 **`chart_ref`**;**view**
165
188
  实现:组件为 **`{"type": 6, "filterConfig": deepcopy(section.config)}`**。
166
189
 
167
190
  - **理论上**与 solution 编译器一致:外层 **`{"filterConfig": [ … ], "graphList": [ … ]}`**;**`graphList`** 常含 **`graphType`**(如 **`CHART`**)、**`graphKey`** 或 **`graphRef`(`entity_id` / `chart_id`)** 等。
168
- - **本环境 CLI 直写实测(多次 `--publish`)**:在已验证 **chart / view / grid / text / link** 均可落库的前提下,**`source_type: filter` 始终未出现在 `draft_result.components` 中**;尝试过:**空数组**、**仅 `graphList` + QingBI `chart_id`**、**`graphKey` 为门户 `dashChartId`**、**`chart` 排在 **`filter` 前**、**仅 2 块(chart+filter)** 等,回读仍 **只有 chart(`count: 1`)** 或 **五类缺 `type: 6`**。
191
+ - **本环境 CLI 直写实测(多次 `--publish`)**:在已验证 **chart / view / grid / text / link** 均可落库的前提下,**`source_type: filter` 始终未出现在 `draft_result.components` 中**;尝试过:**空数组**、**仅 `graphList` + QingBI `chart_id`**、**`graphKey` 为门户 `dashChartId`**、**`chart` 排在 **`filter` 前**、**仅 2 块(chart+filter)** 等,回读仍 **只有 chart(`count: 1`)** 或 **五类缺 `type: 6`**。
169
192
  **结论**:当前宜 **在搭建界面创建筛选条**,再 **`builder portal get` 反抓** 原始 `filterConfig` 形状;或向后端确认 **POST `/dash/{dashKey}`** 对 **`type: 6`** 的必填字段。**自动化不要默认认为 `filter` 已写入。**
170
193
  - portal `filter` 组件仍按 raw `filterConfig` 处理,不纳入视图 / 报表 / 关联资源的统一筛选 DSL 主链路。
171
194
 
@@ -231,12 +254,12 @@ qingflow --json builder portal delete --dash-key "<DASH_KEY>" > tmp/builder_port
231
254
  | 补报表 | **`builder charts apply`**,`name: 门户探针_目标图`,**`target`** | **`chart_id`: `mcp_fb104267c5c249ca`** |
232
255
  | 503 后重试 | **`--dash-key ecdcell64s02`、`--publish`** + 含 **filter** 的六类 **`sections-file`** | **`published: true`**;**`filter` 仍不落库** → **`partial_success`**,**`components expected 6, got 5`**(与 **§3.4** 一致) |
233
256
  | **filter 专项** | 仅 **chart + filter** 两块的多种 **`graphList`/`graphRef`/`dashChartId`/`filterGroupConfig`** 组合 | **回读恒为 1 块(仅 `type: 9`)** |
234
- | **稳定可复现** | **`--publish`** + **[portal_sections_five_types.example.json](./portal_sections_five_types.example.json)**(**grid / text / link / view / chart**) | **`status: success`**,**`types: [2,4,5,9,10]`**,**`published: true`** |
257
+ | **稳定可复现** | **`--publish`** + **[portal_sections_five_types.example.json](../examples/portal/portal_sections_five_types.example.json)**(**grid / text / link / view / chart**) | **`status: success`**,**`types: [2,4,5,9,10]`**,**`published: true`** |
235
258
  | 删除门户 | `builder portal delete --dash-key etcivtmv5402` | **`status: success`**,**`delete_executed: true`**,**`readback_status: deleted`**,**`summary.removed: 1`** |
236
259
 
237
- **推荐工作台模板示例**:[portal_sections_standard_workbench.example.json](./portal_sections_standard_workbench.example.json)
260
+ **推荐工作台模板示例**:[portal_sections_standard_workbench.example.json](../examples/portal/portal_sections_standard_workbench.example.json)
238
261
 
239
- **含 `filter` 的六类示例(`filter` 是否落库视环境/后端而定)**:[portal_sections_all_types.example.json](./portal_sections_all_types.example.json)
262
+ **含 `filter` 的六类示例(`filter` 是否落库视环境/后端而定)**:[portal_sections_all_types.example.json](../examples/portal/portal_sections_all_types.example.json)
240
263
 
241
264
  ---
242
265
 
@@ -248,7 +271,7 @@ qingflow --json builder portal delete --dash-key "<DASH_KEY>" > tmp/builder_port
248
271
  | `PORTAL_READBACK_PENDING` / **`components expected N, got M`** | **`portal get`** 数组件;若多写了 **`filter`** 而回读少一块,见 **§3.4**(**CLI 写 filter 可能整体不生效**);也可能是 **异步回读**,可再 **`get`** 一次。 |
249
272
  | **`published: true` 但 `verified: false`** | 读 **§7**;用 **`get` 草稿+线上**对照。 |
250
273
  | **503** | 网关/运维;稍后重试。 |
251
- | 缺 **chart** | **[QINGFLOW_CLI_BUILDER_CHARTS_WORKFLOW.md](./QINGFLOW_CLI_BUILDER_CHARTS_WORKFLOW.md)**:`builder charts apply`;或换有报表的应用。 |
274
+ | 缺 **chart** | **[60-charts.md](./60-charts.md)**:`builder charts apply`;或换有报表的应用。 |
252
275
  | **VISIBILITY_CONFLICT** | 只用 **`--visibility-file`**。 |
253
276
  | `delete_executed=true` 但 `readback_status=unavailable|still_exists` | DELETE 已发出,回读未确认;不要重复删除,稍后 `builder portal get/list` 复核。 |
254
277
 
@@ -256,8 +279,8 @@ qingflow --json builder portal delete --dash-key "<DASH_KEY>" > tmp/builder_port
256
279
 
257
280
  ## 11. 交叉引用
258
281
 
259
- - [SKILL.md](../SKILL.md)
260
- - [QINGFLOW_CLI_BUILDER_APP_DELIVERY_WORKFLOW.md](./QINGFLOW_CLI_BUILDER_APP_DELIVERY_WORKFLOW.md)
261
- - [QINGFLOW_CLI_BUILDER_VIEWS_WORKFLOW.md](./QINGFLOW_CLI_BUILDER_VIEWS_WORKFLOW.md)
262
- - [QINGFLOW_CLI_BUILDER_CHARTS_WORKFLOW.md](./QINGFLOW_CLI_BUILDER_CHARTS_WORKFLOW.md)
263
- - [QINGFLOW_CLI_EXPLORATION_REPORT.md](./QINGFLOW_CLI_EXPLORATION_REPORT.md)
282
+ - [SKILL.md](../../SKILL.md)
283
+ - [reference/app-delivery-sop.md](./reference/app-delivery-sop.md)
284
+ - [50-views.md](./50-views.md)
285
+ - [60-charts.md](./60-charts.md)
286
+ - [QINGFLOW_CLI_EXPLORATION_REPORT.md](../core/QINGFLOW_CLI_EXPLORATION_REPORT.md)
@@ -0,0 +1,41 @@
1
+ # Builder Buttons And Associated Resources
2
+
3
+ Read this when the task mentions custom buttons, button visibility, add-data button mappings, associated views, associated reports, or current-record context matching.
4
+
5
+ ## Scope
6
+
7
+ Responsible for: `builder button apply`, `builder associated-resource apply`, view button placement, associated view/report display config, `match_mappings`, and button add-data mappings.
8
+
9
+ Not responsible for: creating the target views or charts themselves. Create or verify them first through [50-views.md](./50-views.md) and [60-charts.md](./60-charts.md).
10
+
11
+ ## Main chain
12
+
13
+ ```text
14
+ app get -> app get views/charts/buttons/associated resources -> apply button or associated-resource -> readback
15
+ ```
16
+
17
+ ## Custom buttons
18
+
19
+ - Use `upsert_buttons` for create/update and `patch_buttons` for small changes.
20
+ - Use `view_configs` only after reading target `view_key`.
21
+ - Use semantic conditions: `field_name + operator + value/values`. Do not handwrite raw `judgeType` or backend match matrices.
22
+ - For add-data button field mappings, use target/source semantics, not raw backend ids, unless a contract explicitly requires ids.
23
+
24
+ ## Associated views and reports
25
+
26
+ - Manage the app-level resource pool and view detail display through `associated-resource apply`.
27
+ - For current-record filtering, use `match_mappings`:
28
+
29
+ ```json
30
+ {
31
+ "target_field": "关联客户",
32
+ "operator": "eq",
33
+ "source_field": "数据ID"
34
+ }
35
+ ```
36
+
37
+ - Static filters can use `target_field + operator + value`.
38
+ - Do not mix semantic `match_mappings` with raw `match_rules` in the same resource.
39
+ - Dataset BI reports can only be associated after they already exist; `charts apply` creates application-source QingBI reports.
40
+
41
+ Detailed compatibility rules are in [reference/match-rules.md](./reference/match-rules.md). The older full delivery notes are in [reference/app-delivery-sop.md](./reference/app-delivery-sop.md).
@@ -0,0 +1,34 @@
1
+ # Builder Workflow
2
+
3
+ Read this when the task is about approval/fill/copy/webhook workflow configuration or workflow repair.
4
+
5
+ ## Scope
6
+
7
+ Responsible for: `builder flow apply`, flow presets, `patch_nodes`, assignees, editable fields, and workflow readback.
8
+
9
+ Not responsible for: unsupported arbitrary backend workflow graphs. Public flow building is intentionally limited to stable linear workflows.
10
+
11
+ ## Main chain
12
+
13
+ ```text
14
+ contract -> app get fields -> app get flow -> member/role lookup -> flow apply -> readback if partial
15
+ ```
16
+
17
+ ## Recommended write path
18
+
19
+ - Start from a preset when possible: `basic_approval` or `basic_fill_then_approve`.
20
+ - Patch preset node ids instead of adding duplicate nodes:
21
+ - `basic_approval` -> `approve_1`
22
+ - `basic_fill_then_approve` -> `fill_1`, `approve_1`
23
+ - Use `patch_nodes[]` for targeted updates to an existing flow.
24
+ - Do not mix `patch_nodes` and full `spec` in the same call.
25
+
26
+ ## Supported public node types
27
+
28
+ Use only `start`, `approve`, `fill`, `copy`, `webhook`, and `end`.
29
+
30
+ Do not generate `branch` or `condition` nodes through `app_flow_apply`; the public CLI should return an unsupported-node error rather than write a visually broken flow.
31
+
32
+ ## Detailed workflow docs
33
+
34
+ Use [workflow/README.md](./workflow/README.md) for full staged workflow modeling and [workflow/workflow-schema.json](./workflow/workflow-schema.json) for schema validation.
@@ -0,0 +1,46 @@
1
+ # Builder Publish And Readback Verification
2
+
3
+ Read this before reporting a builder task as finished.
4
+
5
+ ## Scope
6
+
7
+ Responsible for: `builder publish verify`, readback-before-retry, partial success interpretation, and final user-facing completion wording.
8
+
9
+ Not responsible for: replacing resource-specific verification. Views, charts, portal, workflow, buttons, and associated resources still need their own apply/readback checks.
10
+
11
+ ## Main chain
12
+
13
+ ```text
14
+ apply result -> resource readback -> publish verify when app resources changed -> final status
15
+ ```
16
+
17
+ ## Readback-before-retry rule
18
+
19
+ If a write returns any of these, do not immediately replay the same write:
20
+
21
+ - timeout
22
+ - `partial_success`
23
+ - `write_executed=true`
24
+ - `safe_to_retry=false`
25
+ - readback unavailable
26
+ - backend readback 40002 after a write
27
+
28
+ Next action:
29
+
30
+ ```text
31
+ package get / app resolve / app get fields|layout|views|charts / portal get / publish verify
32
+ ```
33
+
34
+ Then patch only the missing or mismatched resources.
35
+
36
+ ## Final report requirements
37
+
38
+ Always state:
39
+
40
+ - whether the intended write appears successful;
41
+ - which path made it successful;
42
+ - what is verified as front-end visible or published;
43
+ - what remains unverified or incomplete;
44
+ - whether further repair is needed.
45
+
46
+ Do not report "全部完成" when required workflows, charts, relations, portal references, or readback checks are missing.
@@ -0,0 +1,41 @@
1
+ # Builder Index
2
+
3
+ This directory is for Qingflow system-building work through `qingflow builder ...`.
4
+
5
+ ## Choose the main path
6
+
7
+ | Situation | Read |
8
+ |-----------|------|
9
+ | User asks for one app only | [10-build-single-app.md](./10-build-single-app.md) |
10
+ | User asks for a complete system, app package, or several related apps | [20-build-complete-system.md](./20-build-complete-system.md) |
11
+ | User asks to change one existing resource | Read that resource document directly: [fields](./30-schema-fields.md), [layout](./40-layout.md), [views](./50-views.md), [charts](./60-charts.md), [portal](./70-portal.md), [buttons/resources](./80-buttons-associated-resources.md), or [workflow](./90-workflow.md) |
12
+
13
+ ## Default build order
14
+
15
+ ```text
16
+ package -> schema/apps -> layout -> workflow -> views -> charts -> buttons/resources -> portal -> publish/readback verify
17
+ ```
18
+
19
+ Rules:
20
+
21
+ - Complete systems create all app shells and relation fields with `builder schema apply --apps-file`; use `apps[].client_key` and `relation.target_app_ref`.
22
+ - Single-app builds use one app path; do not add relation fields unless the user asks for cross-app modeling.
23
+ - Update instructions live inside the resource document. Do not use `update-*` as a separate main route.
24
+ - Batch read, batch write, and patch are resource-specific variants, not separate workflows.
25
+
26
+ ## File responsibilities
27
+
28
+ | File | Responsibility |
29
+ |------|----------------|
30
+ | [10-build-single-app.md](./10-build-single-app.md) | One-app delivery order and completion standard |
31
+ | [20-build-complete-system.md](./20-build-complete-system.md) | Multi-app package delivery order and relation strategy |
32
+ | [30-schema-fields.md](./30-schema-fields.md) | Field types, schema apply, data title/cover, schema updates |
33
+ | [40-layout.md](./40-layout.md) | Form grouping, rows matrix, layout updates |
34
+ | [50-views.md](./50-views.md) | Table/card/board/gantt views, filters, query panel, view patches |
35
+ | [60-charts.md](./60-charts.md) | QingBI chart create/update/remove/reorder, metrics, filters |
36
+ | [70-portal.md](./70-portal.md) | Portal apply/delete, standard workbench layout, component config |
37
+ | [80-buttons-associated-resources.md](./80-buttons-associated-resources.md) | Custom buttons, associated views/reports, context mappings |
38
+ | [90-workflow.md](./90-workflow.md) | Flow presets, patch_nodes, workflow verification |
39
+ | [99-publish-verify.md](./99-publish-verify.md) | Publish verification, partial success, readback-before-retry |
40
+
41
+ Detailed historical playbooks and low-level notes start from [reference/app-delivery-sop.md](./reference/app-delivery-sop.md). Load them only when a main document points there or the main document is insufficient.
@@ -0,0 +1,130 @@
1
+ # Qingflow CLI Code Block / Q-Linker Builder
2
+
3
+ Use this section when the user wants to build or repair:
4
+ - `code_block` fields
5
+ - `q_linker` fields
6
+ - output alias parsing
7
+ - target field binding
8
+ - form configurations that depend on code block or Q-Linker relations
9
+
10
+ Do not use this section for generic field CRUD or runtime execution debugging unless those are strictly supporting code block or Q-Linker configuration work.
11
+
12
+ ## Core Rule
13
+
14
+ Treat code blocks and Q-Linkers as **integration fields**, not ordinary fields.
15
+
16
+ For both of them, the public builder request may look like one step, but the real backend form structure has multiple layers. Never invent a new backend meaning. Only compile into the backend structures that already exist.
17
+
18
+ ## Mental Model
19
+
20
+ ### Code block
21
+
22
+ There are three conceptual layers:
23
+
24
+ 1. Code block field itself
25
+ 2. Parsed output aliases
26
+ 3. Target field bindings
27
+
28
+ Current builder support:
29
+ - configure the code block field itself
30
+ - configure input insertion into code content
31
+ - configure alias parsing
32
+
33
+ Important:
34
+ - keep `qf_output = {...}` as a plain assignment
35
+ - do not emit `const qf_output =` or `let qf_output =`
36
+
37
+ ### Q-Linker
38
+
39
+ There are two conceptual layers:
40
+
41
+ 1. Q-Linker field itself via `remoteLookupConfig`
42
+ 2. Target field bindings via relation-default + `questionRelations(relationType=Q_LINKER)`
43
+
44
+ Current builder support:
45
+ - one-step high-level config through `q_linker_binding`
46
+ - internal compilation into existing backend payloads
47
+
48
+ ## Operating Order
49
+
50
+ For code block or Q-Linker work, use this order:
51
+
52
+ 1. Resolve the app and read fields:
53
+ - `qingflow builder app resolve`
54
+ - `qingflow builder app get fields`
55
+ 2. Confirm the target field set already exists.
56
+ 3. Apply schema updates with `qingflow builder schema apply`.
57
+ 4. Read fields again and verify:
58
+ - field type
59
+ - alias config
60
+ - target field binding shape
61
+ 5. For page-safety checks, use user-side schema or insert checks:
62
+ - `qingflow record schema insert`
63
+ - optional safe `qingflow record insert`
64
+
65
+ Do not treat raw apply success as enough. Always re-read the field config.
66
+
67
+ ## Code Block Rules
68
+
69
+ Read [code-block.md](./code-block.md) before changing a code block field.
70
+
71
+ Use builder high-level config only for:
72
+ - input field insertion
73
+ - code content
74
+ - alias parsing
75
+ - auto trigger
76
+ - custom button text
77
+
78
+ When binding outputs to target fields, do not guess payload shape from memory. Follow the current builder implementation and the readback shape.
79
+
80
+ Hard rules:
81
+ - target fields must already exist
82
+ - keep target field types business-compatible
83
+ - if a page starts hanging on “关联中”, inspect whether the target field default type or relation config was written incorrectly
84
+
85
+ ## Q-Linker Rules
86
+
87
+ Read [q-linker.md](./q-linker.md) before changing a Q-Linker field.
88
+
89
+ First-stage stable support is only:
90
+ - custom mode
91
+ - request config
92
+ - alias parsing
93
+ - target field binding
94
+ - auto trigger / button text
95
+
96
+ Do not generate:
97
+ - template mode
98
+ - openApp/light-wing branches
99
+ - subtable table-match bindings
100
+
101
+ Hard rules:
102
+ - `outputs[*].target_field` is required
103
+ - use only supported target field types
104
+ - on rebinding, old target fields must be restored from relation-default to safe default type
105
+ - `resultFormatPath` must preserve backend-required alias metadata
106
+
107
+ ## Verification Checklist
108
+
109
+ After each code block or Q-Linker change, verify all of these:
110
+
111
+ - `qingflow builder app get ... fields` shows the intended field type
112
+ - the high-level config is readable and stable
113
+ - target fields still have valid types
114
+ - insert schema can be opened
115
+ - record insert does not get blocked by malformed integration config
116
+
117
+ If the task explicitly includes runtime verification, keep it separate from configuration verification.
118
+
119
+ ## Common Pitfalls
120
+
121
+ - Writing code block code with `const qf_output =`
122
+ - Treating a Q-Linker or code block binding as a plain field default
123
+ - Forgetting to restore old target fields after unbinding
124
+ - Using unsupported target field types
125
+ - Assuming apply success means the form page can open
126
+
127
+ ## References
128
+
129
+ - Code block details: [references/code-block.md](./code-block.md)
130
+ - Q-Linker details: [references/q-linker.md](./q-linker.md)