@qingflow-tech/qingflow-cli 1.1.50-beta.5 → 1.1.51

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 (110) hide show
  1. package/README.md +4 -4
  2. package/npm/lib/runtime.mjs +13 -29
  3. package/package.json +1 -1
  4. package/pyproject.toml +2 -8
  5. package/skills/qingflow-cli/SKILL.md +322 -93
  6. package/skills/qingflow-cli/manifest.yaml +1 -1
  7. package/skills/qingflow-cli/reference/00-INDEX.md +4 -4
  8. package/skills/qingflow-cli/reference/QINGFLOW_CLI_ADMIN_CHEATSHEET.md +1 -1
  9. package/skills/qingflow-cli/reference/QINGFLOW_CLI_BUILDER_VIEWS_WORKFLOW.md +9 -3
  10. package/skills/qingflow-cli/reference/QINGFLOW_CLI_DATA_RETRIEVAL_WORKFLOW.md +137 -3
  11. package/skills/qingflow-cli/reference/QINGFLOW_CLI_EXPLORATION_REPORT.md +4 -6
  12. package/skills/qingflow-cli/reference/QINGFLOW_CLI_FIELD_DATA_TYPES.md +14 -14
  13. package/skills/qingflow-cli/reference/QINGFLOW_CLI_MEMBER_CHEATSHEET.md +19 -20
  14. package/skills/qingflow-cli/reference/QINGFLOW_CLI_ONE_SHOT_CHEATSHEET.md +14 -18
  15. package/skills/qingflow-cli/reference/QINGFLOW_CLI_RECORD_CREATE_WORKFLOW.md +12 -7
  16. package/skills/qingflow-cli/reference/QINGFLOW_CLI_RECORD_UPDATE_WORKFLOW.md +1 -2
  17. package/skills/qingflow-cli/reference/builder/20-build-complete-system.md +2 -3
  18. package/skills/qingflow-cli/reference/builder/30-schema-fields.md +5 -9
  19. package/skills/qingflow-cli/reference/builder/50-views.md +191 -192
  20. package/skills/qingflow-cli/reference/builder/80-buttons-associated-resources.md +0 -2
  21. package/skills/qingflow-cli/reference/builder/README.md +1 -1
  22. package/skills/qingflow-cli/reference/builder/reference/app-delivery-sop.md +6 -6
  23. package/skills/qingflow-cli/reference/core/QINGFLOW_CLI_ADMIN_CHEATSHEET.md +1 -1
  24. package/skills/qingflow-cli/reference/core/QINGFLOW_CLI_DATA_RETRIEVAL_WORKFLOW.md +95 -76
  25. package/skills/qingflow-cli/reference/core/QINGFLOW_CLI_EXPLORATION_REPORT.md +4 -6
  26. package/skills/qingflow-cli/reference/core/QINGFLOW_CLI_FIELD_DATA_TYPES.md +13 -13
  27. package/skills/qingflow-cli/reference/core/QINGFLOW_CLI_MEMBER_CHEATSHEET.md +19 -20
  28. package/skills/qingflow-cli/reference/core/QINGFLOW_CLI_ONE_SHOT_CHEATSHEET.md +14 -18
  29. package/skills/qingflow-cli/reference/examples/README.md +1 -1
  30. package/skills/qingflow-cli/reference/examples/views/views_batch_full.example.json +159 -0
  31. package/skills/qingflow-cli/reference/examples/views/views_upsert_table_minimal.example.json +36 -30
  32. package/skills/qingflow-cli/reference/record/QINGFLOW_CLI_RECORD_UPDATE_WORKFLOW.md +1 -2
  33. package/skills/qingflow-cli/reference/record/analysis/README.md +113 -21
  34. package/skills/qingflow-cli/reference/record/analysis/analysis-gotchas.md +10 -10
  35. package/skills/qingflow-cli/reference/record/analysis/analysis-patterns.md +9 -9
  36. package/skills/qingflow-cli/reference/record/analysis/business-context.md +1 -1
  37. package/skills/qingflow-cli/reference/record/analysis/confidence-reporting.md +10 -10
  38. package/skills/qingflow-cli/reference/record/analysis/data-access-playbook.md +80 -52
  39. package/skills/qingflow-cli/reference/record/analysis/pandas-recipes.md +2 -2
  40. package/skills/qingflow-cli/reference/views_upsert_table_minimal.example.json +42 -0
  41. package/skills/qingflow-common/SKILL.md +4 -7
  42. package/src/qingflow_mcp/__init__.py +1 -1
  43. package/src/qingflow_mcp/app_form_compat.py +0 -3
  44. package/src/qingflow_mcp/app_form_validator.py +17 -69
  45. package/src/qingflow_mcp/builder_facade/app_form.py +100 -497
  46. package/src/qingflow_mcp/builder_facade/models.py +17 -227
  47. package/src/qingflow_mcp/builder_facade/schemas/app_form/manifest.json +0 -1
  48. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/complete.json +30 -64
  49. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/address.json +8 -4
  50. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/amount.json +8 -4
  51. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/attachment.json +10 -6
  52. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/code_block.json +10 -6
  53. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/data_relation.json +18 -11
  54. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/date.json +8 -4
  55. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/datetime.json +8 -4
  56. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/department.json +10 -6
  57. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/email.json +8 -4
  58. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/link.json +8 -4
  59. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/long_text.json +8 -4
  60. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/member.json +10 -6
  61. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/multi_select.json +8 -4
  62. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/number.json +8 -4
  63. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/phone.json +8 -4
  64. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/q_linker.json +10 -6
  65. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/relation.json +15 -46
  66. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/single_choice.json +8 -4
  67. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/single_select.json +8 -4
  68. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/subtable.json +27 -61
  69. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/text.json +8 -4
  70. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/formula.json +0 -43
  71. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/summary.json +12 -7
  72. package/src/qingflow_mcp/builder_facade/service.py +539 -1671
  73. package/src/qingflow_mcp/builder_facade/workflow_spec.py +1 -1
  74. package/src/qingflow_mcp/cli/commands/__init__.py +1 -2
  75. package/src/qingflow_mcp/cli/commands/builder.py +55 -76
  76. package/src/qingflow_mcp/cli/commands/record.py +1 -1
  77. package/src/qingflow_mcp/cli/context.py +0 -3
  78. package/src/qingflow_mcp/cli/formatters.py +1 -97
  79. package/src/qingflow_mcp/config.py +1 -0
  80. package/src/qingflow_mcp/public_surface.py +0 -8
  81. package/src/qingflow_mcp/response_trim.py +2 -11
  82. package/src/qingflow_mcp/server.py +0 -2
  83. package/src/qingflow_mcp/server_app_builder.py +10 -34
  84. package/src/qingflow_mcp/server_app_user.py +0 -4
  85. package/src/qingflow_mcp/solution/compiler/view_compiler.py +1 -2
  86. package/src/qingflow_mcp/solution/executor.py +8 -96
  87. package/src/qingflow_mcp/solution/spec_models.py +0 -1
  88. package/src/qingflow_mcp/tools/ai_builder_tools.py +398 -218
  89. package/src/qingflow_mcp/tools/base.py +42 -10
  90. package/src/qingflow_mcp/tools/record_tools.py +46 -11
  91. package/src/qingflow_mcp/tools/solution_tools.py +0 -2
  92. package/src/qingflow_mcp/tools/view_tools.py +6 -0
  93. package/skills/qingflow-cli/reference/data/README.md +0 -32
  94. package/skills/qingflow-cli/reference/examples/views/views_apply_v1alpha1.example.json +0 -14
  95. package/skills/qingflow-cli/reference/record/QINGFLOW_CLI_RECORD_SPECIALIZED_WORKFLOW.md +0 -50
  96. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/rich_text.json +0 -146
  97. package/src/qingflow_mcp/builder_facade/schemas/views/manifest.json +0 -42
  98. package/src/qingflow_mcp/builder_facade/schemas/views/v1alpha1/complete.json +0 -1245
  99. package/src/qingflow_mcp/builder_facade/schemas/views/v1alpha1/details/button-config.json +0 -53
  100. package/src/qingflow_mcp/builder_facade/schemas/views/v1alpha1/details/data-permission.json +0 -60
  101. package/src/qingflow_mcp/builder_facade/schemas/views/v1alpha1/details/display.json +0 -73
  102. package/src/qingflow_mcp/builder_facade/schemas/views/v1alpha1/details/operation-permission.json +0 -48
  103. package/src/qingflow_mcp/builder_facade/schemas/views/v1alpha1/details/query-condition.json +0 -47
  104. package/src/qingflow_mcp/builder_facade/schemas/views/v1alpha1/summary.json +0 -319
  105. package/src/qingflow_mcp/builder_facade/views_extract.py +0 -592
  106. package/src/qingflow_mcp/builder_facade/views_schema.py +0 -400
  107. package/src/qingflow_mcp/cli/commands/data.py +0 -134
  108. package/src/qingflow_mcp/tools/csv_export.py +0 -168
  109. package/src/qingflow_mcp/tools/data_tools.py +0 -284
  110. package/src/qingflow_mcp/tools/view_writer.py +0 -44
@@ -0,0 +1,159 @@
1
+ {
2
+ "views": [
3
+ {
4
+ "operation": "upsert",
5
+ "app_key": "WORK_ORDER_APP_KEY",
6
+ "name": "生产工单执行视图",
7
+ "type": "table",
8
+ "columns": ["工单编号", "产品", "工单状态", "负责人", "计划完成日期"],
9
+ "filters": [
10
+ {"field_name": "工单状态", "operator": "in", "values": ["待排产", "生产中"]},
11
+ {"field_name": "产品", "operator": "contains", "value": "标准"},
12
+ {"field_name": "计划完成日期", "operator": "lte", "value": "2026-07-31"}
13
+ ],
14
+ "query_conditions": {
15
+ "enabled": true,
16
+ "exact": false,
17
+ "hide_before_query": false,
18
+ "rows": [["工单编号", "工单状态"], ["负责人", "计划完成日期"]]
19
+ },
20
+ "visibility": {
21
+ "mode": "workspace",
22
+ "selectors": {},
23
+ "external_mode": "not",
24
+ "external_selectors": {}
25
+ },
26
+ "action_buttons": [
27
+ {
28
+ "client_key": "create_quality_from_list",
29
+ "text": "行内创建质检",
30
+ "action": "add_data",
31
+ "target_app_key": "QUALITY_APP_KEY",
32
+ "field_mappings": [
33
+ {"source_field": "数据ID", "target_field": "关联工单"}
34
+ ],
35
+ "default_values": {"处理状态": "待处理"},
36
+ "placement": "list",
37
+ "primary": true,
38
+ "style_preset": "primary_blue",
39
+ "visible_when": [
40
+ {"field_name": "工单状态", "operator": "eq", "value": "生产中"}
41
+ ]
42
+ },
43
+ {
44
+ "client_key": "create_quality_from_detail",
45
+ "text": "详情创建质检",
46
+ "action": "add_data",
47
+ "target_app_key": "QUALITY_APP_KEY",
48
+ "field_mappings": [
49
+ {"source_field": "数据ID", "target_field": "关联工单"}
50
+ ],
51
+ "default_values": {"处理状态": "待处理"},
52
+ "placement": "detail",
53
+ "style_preset": "neutral_outline"
54
+ },
55
+ {
56
+ "client_key": "open_work_order_sop",
57
+ "text": "打开SOP",
58
+ "action": "link",
59
+ "url": "https://example.com/sop/work-order",
60
+ "placement": "header",
61
+ "style_preset": "text_blue"
62
+ }
63
+ ]
64
+ },
65
+ {
66
+ "operation": "upsert",
67
+ "app_key": "WORK_ORDER_APP_KEY",
68
+ "name": "工单状态看板",
69
+ "type": "board",
70
+ "columns": ["工单编号", "产品", "负责人", "计划完成日期"],
71
+ "group_by": "工单状态",
72
+ "filters": [
73
+ {"field_name": "工单状态", "operator": "not_empty"},
74
+ {"field_name": "关闭日期", "operator": "is_empty"}
75
+ ],
76
+ "query_conditions": {
77
+ "enabled": true,
78
+ "rows": [["工单编号", "负责人"], ["计划完成日期"]]
79
+ },
80
+ "action_buttons": [
81
+ {
82
+ "text": "看板行内创建质检",
83
+ "action": "add_data",
84
+ "target_app_key": "QUALITY_APP_KEY",
85
+ "field_mappings": [
86
+ {"source_field": "数据ID", "target_field": "关联工单"}
87
+ ],
88
+ "placement": "list",
89
+ "visible_when": [
90
+ {"field_name": "工单状态", "operator": "eq", "value": "已完工"}
91
+ ]
92
+ },
93
+ {
94
+ "text": "看板详情创建质检",
95
+ "action": "add_data",
96
+ "target_app_key": "QUALITY_APP_KEY",
97
+ "field_mappings": [
98
+ {"source_field": "数据ID", "target_field": "关联工单"}
99
+ ],
100
+ "placement": "detail"
101
+ }
102
+ ]
103
+ },
104
+ {
105
+ "operation": "upsert",
106
+ "app_key": "WORK_ORDER_APP_KEY",
107
+ "name": "工单计划甘特图",
108
+ "type": "gantt",
109
+ "columns": ["工单编号", "产品", "工单状态", "计划开始日期", "计划完成日期"],
110
+ "start_field": "计划开始日期",
111
+ "end_field": "计划完成日期",
112
+ "title_field": "工单编号",
113
+ "filters": [
114
+ {"field_name": "计划开始日期", "operator": "gte", "value": "2026-07-01"}
115
+ ],
116
+ "query_conditions": {
117
+ "enabled": true,
118
+ "rows": [["工单编号", "工单状态"], ["计划开始日期", "计划完成日期"]]
119
+ },
120
+ "action_buttons": [
121
+ {
122
+ "text": "详情查看排产说明",
123
+ "action": "link",
124
+ "url": "https://example.com/sop/schedule",
125
+ "placement": "detail"
126
+ }
127
+ ]
128
+ },
129
+ {
130
+ "operation": "patch",
131
+ "app_key": "WORK_ORDER_APP_KEY",
132
+ "view_key": "RAW_VIEW_KEY_TO_PATCH",
133
+ "set": {
134
+ "columns": ["工单编号", "工单状态", "负责人"],
135
+ "filters": [
136
+ {"field_name": "工单状态", "operator": "neq", "value": "已关闭"}
137
+ ],
138
+ "query_conditions": {
139
+ "enabled": true,
140
+ "rows": [["工单编号", "工单状态"], ["负责人"]]
141
+ },
142
+ "action_buttons": [
143
+ {
144
+ "text": "补充详情按钮",
145
+ "action": "link",
146
+ "url": "https://example.com/detail-help",
147
+ "placement": "detail"
148
+ }
149
+ ],
150
+ "action_buttons_mode": "merge"
151
+ }
152
+ },
153
+ {
154
+ "operation": "remove",
155
+ "app_key": "WORK_ORDER_APP_KEY",
156
+ "view_key": "RAW_VIEW_KEY_TO_REMOVE"
157
+ }
158
+ ]
159
+ }
@@ -1,36 +1,42 @@
1
1
  {
2
- "name": "示例业务操作视图_CLI模板",
3
- "type": "table",
4
- "columns": [100, 101, 102, 103],
5
- "filters": [
6
- {"que_id": 100, "operator": "neq", "value": "已关闭"}
7
- ],
8
- "query_conditions": {
9
- "enabled": true,
10
- "exact": false,
11
- "hide_before_query": false,
12
- "rows": [["主记录编号", "主记录名称"], ["状态", "负责人"]]
13
- },
14
- "action_buttons": [
2
+ "views": [
15
3
  {
16
- "text": "行内创建子记录",
17
- "action": "add_data",
18
- "target_app_key": "TARGET_APP_KEY",
19
- "field_mappings": [
20
- {"source_field": "数据ID", "target_field": "关联主记录"}
4
+ "operation": "upsert",
5
+ "app_key": "APP_KEY",
6
+ "name": "示例业务操作视图_CLI模板",
7
+ "type": "table",
8
+ "columns": ["主记录编号", "主记录名称", "状态", "负责人"],
9
+ "filters": [
10
+ {"field_name": "状态", "operator": "neq", "value": "已关闭"}
21
11
  ],
22
- "default_values": {"目标状态字段": "REPLACE_WITH_TARGET_OPTION_LABEL"},
23
- "placement": "list"
24
- },
25
- {
26
- "text": "详情创建子记录",
27
- "action": "add_data",
28
- "target_app_key": "TARGET_APP_KEY",
29
- "field_mappings": [
30
- {"source_field": "数据ID", "target_field": "关联主记录"}
31
- ],
32
- "default_values": {"目标状态字段": "REPLACE_WITH_TARGET_OPTION_LABEL"},
33
- "placement": "detail"
12
+ "query_conditions": {
13
+ "enabled": true,
14
+ "exact": false,
15
+ "hide_before_query": false,
16
+ "rows": [["主记录编号", "主记录名称"], ["状态", "负责人"]]
17
+ },
18
+ "action_buttons": [
19
+ {
20
+ "text": "行内创建子记录",
21
+ "action": "add_data",
22
+ "target_app_key": "TARGET_APP_KEY",
23
+ "field_mappings": [
24
+ {"source_field": "数据ID", "target_field": "关联主记录"}
25
+ ],
26
+ "default_values": {"目标状态字段": "REPLACE_WITH_TARGET_OPTION_LABEL"},
27
+ "placement": "list"
28
+ },
29
+ {
30
+ "text": "详情创建子记录",
31
+ "action": "add_data",
32
+ "target_app_key": "TARGET_APP_KEY",
33
+ "field_mappings": [
34
+ {"source_field": "数据ID", "target_field": "关联主记录"}
35
+ ],
36
+ "default_values": {"目标状态字段": "REPLACE_WITH_TARGET_OPTION_LABEL"},
37
+ "placement": "detail"
38
+ }
39
+ ]
34
40
  }
35
41
  ]
36
42
  }
@@ -1,8 +1,7 @@
1
1
  # Qingflow CLI:更新记录工作流(详情后直接写入)
2
2
 
3
- > **兼容范围**:本文仅限用户明确要求旧 CLI `record` 兼容入口时使用。默认更新必须切换到 [data 操作说明](../data/README.md) 的 `data get` → `data update`;禁止在 data update 失败后自动回退本文链路。
4
3
  > **用途**:使用当前 CLI 会话读取目标记录详情后,用 **`record update`** 直接提交差异字段。主链路是 `record get -> record update`;字段范围不清、候选歧义或失败排查时,才追加 **`record schema update`**。
5
- > **关联**:直接数据操作统一使用 [data 操作说明](../data/README.md);最终统计结论统一使用 **[record/analysis](./analysis/README.md) 的 `data query --all --output csv -> Python/pandas`**;主技能 **[../SKILL.md](../../SKILL.md)**。
4
+ > **关联**:只读列表/详情见 **[QINGFLOW_CLI_DATA_RETRIEVAL_WORKFLOW.md](../core/QINGFLOW_CLI_DATA_RETRIEVAL_WORKFLOW.md)**;**字段 `kind` 与写入值总表**见 **[QINGFLOW_CLI_FIELD_DATA_TYPES.md](../core/QINGFLOW_CLI_FIELD_DATA_TYPES.md)**;最终统计结论统一使用 **[record/analysis](./analysis/README.md) 的 `record access -> Python/pandas`**;**成员 / 部门等** 的细颗粒写入见 **[QINGFLOW_CLI_RECORD_CREATE_WORKFLOW.md](./QINGFLOW_CLI_RECORD_CREATE_WORKFLOW.md)**;主技能 **[../SKILL.md](../../SKILL.md)**。
6
5
 
7
6
  ---
8
7
 
@@ -1,38 +1,130 @@
1
- # 轻流记录数据分析
1
+ # Qingflow CLI Record Analysis
2
2
 
3
- 最终统计结论、分析报告、趋势、排名、比例和分布统一使用以下路径:
3
+ Use this section for final statistical conclusions: counts, distributions, ratios, averages, rankings, trends, comparisons, and analysis reports.
4
+
5
+ Default path, every time:
4
6
 
5
7
  ```text
6
- qingflow data query --all --output csv -> 读取全部 CSV 分片 -> Python/pandas
8
+ app get -> record schema browse(view_id=...) -> record access -> Python/pandas -> final answer
9
+ ```
10
+
11
+ Use the CLI entry:
12
+
13
+ ```bash
14
+ qingflow record --help
15
+ qingflow record access --help
16
+ qingflow record access --app-key APP_KEY --view-id VIEW_ID --columns-file columns.json --where-file where.json --order-by-file order_by.json --json
17
+ ```
18
+
19
+ The CLI command is under the `record` command group, so the discovery path is: first inspect `qingflow record --help`, then inspect `qingflow record access --help`.
20
+
21
+ ## Hard Rules
22
+
23
+ - Never start analysis from `record_list`, export, QingBI, or guessed field ids.
24
+ - Never conclude `record_access` is unavailable just because it is not visible as a top-level MCP tool; check the CLI path `qingflow record access`.
25
+ - Never call `record access` before `record schema browse`.
26
+ - Use only field ids returned by `record schema browse`.
27
+ - If `app_get.accessible_views[].analysis_supported=false`, do not use that view for `record_access`.
28
+ - Prefer an explicit time range or business filter. If the user gives none and the table may be large, ask for scope or use a clearly provided month/quarter/year.
29
+ - Read every CSV shard in `record_access.files[].local_path` with Python. Do not print raw CSV or load raw rows into model context.
30
+ - Before final analysis, run a field-quality profile in pandas: row count, null rate, distinct count, and period coverage for candidate grouping fields.
31
+ - Do not use a high-missing field as the main conclusion dimension. If a candidate dimension is sparse, downgrade it to an `已填写样本观察` and choose a cleaner semantic fallback when available.
32
+ - Full final conclusions require `record_access.complete=true` and `record_access.safe_for_final_conclusion=true`.
33
+ - `record_list` is only for sample inspection after the aggregate result is understood.
34
+ - `record_get` is only for single-record detail verification, logs, references, images, or readable attachments. Read images from `media_assets.items[].local_path`; read documents/tables from `file_assets.items[].local_path` and `extraction.text_path`.
35
+ - `record_export_direct` is only for explicit export/download/Excel requests.
36
+ - `chart_get` / QingBI is only for user-provided report URLs or chart ids.
37
+
38
+ ## Tool Selection
39
+
40
+ | Need | Tool |
41
+ |---|---|
42
+ | Batch analysis, statistics, comparison, report | `record access -> Python` |
43
+ | Browse a few example rows | `record_list` |
44
+ | Inspect one record, logs, references, images, attachments | `record_get` |
45
+ | User asks to export/download/Excel | `record_export_direct` |
46
+ | User gives report URL or chart id | `chart_get` |
47
+ | Todo/workflow task actions | `reference/task/QINGFLOW_CLI_TASK_CONTEXT_WORKFLOW.md` |
48
+
49
+ ## Standard Procedure
50
+
51
+ 1. Run `app get` and choose a table-style `view_id` from `accessible_views`.
52
+ 2. Run `record schema browse --app-key APP_KEY --view-id VIEW_ID`.
53
+ 3. Decide metric intent before fetching data: `count`, `sum`, `avg`, `distinct_count`, ratio, ranking, trend, or comparison.
54
+ 4. Choose minimal `record_access.columns`, plus `where` and `order_by`.
55
+ 5. Run `qingflow record access`.
56
+ 6. Read all returned CSV files in Python; use `fields[]` only when field-id metadata is needed.
57
+ 7. Run field-quality checks for all candidate dimensions.
58
+ 8. Compute results in pandas.
59
+ 9. Report numbers with scope, field choices, field-quality caveats, completeness, and business assumptions.
60
+
61
+ Use field-id DSLs only:
62
+
63
+ ```json
64
+ {
65
+ "app_key": "APP_KEY",
66
+ "view_id": "system:all",
67
+ "columns": [{ "field_id": 2 }, { "field_id": 18 }],
68
+ "where": [{ "field_id": 2, "op": "between", "value": ["2026-05-01", "2026-05-31"] }],
69
+ "order_by": [{ "field_id": 2, "direction": "asc" }]
70
+ }
7
71
  ```
8
72
 
9
- 先用当前 CLI 帮助确认参数:
73
+ Never pass `page`, `page_size`, `limit`, `max_rows`, `timeout`, or `profile` to `record_access`.
74
+
75
+ CSV columns are already readable and field-id anchored, for example `项目状态__field_343283094`. Do not expect separate `schema.json` or `README.md` files.
76
+
77
+ For CLI use, write JSON argument files instead of embedding large JSON in shell text:
10
78
 
11
79
  ```bash
12
- qingflow data --help
13
- qingflow data query --help
14
- qingflow --json data query \
80
+ qingflow record access \
15
81
  --app-key APP_KEY \
82
+ --view-id system:all \
16
83
  --columns-file columns.json \
17
84
  --where-file where.json \
18
- --sort-file sort.json \
19
- --all --output csv
85
+ --order-by-file order_by.json \
86
+ --json
20
87
  ```
21
88
 
22
- `--all` 与 `--output csv` 必须同时使用。columns 使用字段 id 数组;where 与 sort 使用包含 `field_id` 的对象数组。字段 id 来自当前 data schema 或已确认上下文,不得猜测。
89
+ ## Status Handling
90
+
91
+ Read `record_access.status` before reading files or writing conclusions.
92
+
93
+ - `status=success`, `complete=true`, `safe_for_final_conclusion=true`: full-scope answer is allowed.
94
+ - `status=needs_scope`: no CSV was written. Ask for a time/business range or retry with a user-provided period using `scope.suggested_time_fields`.
95
+ - `status=partial`: read returned files only as a subset. Do not give a full-population conclusion.
96
+ - `complete=false`, `truncated=true`, or `safe_for_final_conclusion=false`: answer as `初步观察` or ask for a narrower scope.
97
+
98
+ ## Business Context
99
+
100
+ If the question mentions department, team, region, owner group, stage, product line, or a named business scope, check whether aliases or child scopes matter before concluding. Use explicit mappings provided by the user or local context; otherwise ask a short clarification.
101
+
102
+ Example: if `烈焰组` and `飓风组` are sub-departments of `北斗部门`, apply that mapping in Python and state it in the answer.
103
+
104
+ ## Output Shape
105
+
106
+ Default to:
107
+
108
+ 1. `结论`
109
+ 2. `关键数据`
110
+ 3. `口径与范围`
111
+ 4. `可信度 / 限制`
112
+
113
+ Concrete numbers are mandatory. Ratios require both numerator and denominator. Trends require a time field and explicit date range. Rankings must come from a sorted pandas result.
114
+ If a requested dimension has poor quality, say so explicitly and provide the nearest reliable fallback dimension, for example platform or product instead of a mostly empty module field.
23
115
 
24
- ## 分析门禁
116
+ ## References
25
117
 
26
- - 读取返回摘要的 `status`、`row_count`、`complete`、`truncated`、`safe_for_final_conclusion`、`files` 和 `stopped_reason`。
27
- - 用 Python/pandas 读取全部 `files[].local_path`,不要把原始 CSV 行打印到模型上下文。
28
- - 完整总体结论必须同时满足 `complete=true`、`truncated=false`、`safe_for_final_conclusion=true`。
29
- - `status=needs_scope` 时 `files` 为空;读取 `scope.reported_total` 与 `scope.row_threshold`,请求时间或业务范围后重试。
30
- - `status=partial` 或任一完整性条件不满足时,只能给出局部观察,或收窄范围后重试。
31
- - 最终分组前检查行数、空值率、唯一值数量与时间覆盖;高缺失维度只能作为“已填写样本观察”。
32
- - `record list` 仅用于样本核查,不能代替全量 CSV;导出工具只用于用户明确要求下载文件的场景。
118
+ Load only what is needed:
33
119
 
34
- ## 输出要求
120
+ - Data access status machine: [references/data-access-playbook.md](./data-access-playbook.md)
121
+ - Python/pandas templates: [references/pandas-recipes.md](./pandas-recipes.md)
122
+ - Analysis patterns: [references/analysis-patterns.md](./analysis-patterns.md)
123
+ - Business mappings and scope: [references/business-context.md](./business-context.md)
124
+ - Confidence and final wording: [references/confidence-reporting.md](./confidence-reporting.md)
125
+ - Common mistakes: [references/analysis-gotchas.md](./analysis-gotchas.md)
126
+ - Report templates: [references/report-format.md](./report-format.md)
35
127
 
36
- 默认输出结论、关键数据、口径与范围、可信度/限制。比例必须包含分子与分母,趋势必须说明时间字段与日期范围,排名必须来自 pandas 显式排序。
128
+ ## Feedback Escalation
37
129
 
38
- 进一步细节见同目录的取数状态机、pandas 模板、分析模式、业务上下文、可信度和报告模板。
130
+ If the desired analysis cannot be completed because of missing capability, unsupported data shape, or an awkward workflow after reasonable attempts, summarize the exact gap and ask whether to submit product feedback. Only after explicit user confirmation, call `feedback_submit`.
@@ -1,19 +1,19 @@
1
1
  # Analysis Gotchas
2
2
 
3
- ## 不要猜字段 schema
3
+ ## Do Not Skip Schema
4
4
 
5
- 正确路径:
5
+ Correct path:
6
6
 
7
- 1. 从当前 data schema 或已确认上下文选择字段 id
8
- 2. `data query --all --output csv`
9
- 3. 读取全部 `files[].local_path`
10
- 4. Python/pandas
7
+ 1. `app_get`
8
+ 2. `record_browse_schema_get`
9
+ 3. `record_access`
10
+ 4. Python
11
11
 
12
- data 工具返回的 schema、字段错误与访问范围是事实源;缺失字段不是猜测隐藏 id 的理由。
12
+ `record_browse_schema_get` returns readable fields for the selected view. Missing fields are permission or view-scope boundaries, not invitations to guess hidden ids.
13
13
 
14
14
  ## Do Not Use Export For Analysis
15
15
 
16
- 导出工具只用于用户明确要求下载文件。分析使用 `data query --all --output csv`,因为它返回本地 CSV 分片与结构化完整性字段。
16
+ Export tools are for user-requested files. Analysis uses `record_access` because it returns structured completeness and compact field metadata.
17
17
 
18
18
  ## Do Not Treat `record_list` As Full Data
19
19
 
@@ -28,7 +28,7 @@ data 工具返回的 schema、字段错误与访问范围是事实源;缺失
28
28
 
29
29
  ## Do Not Control Paging
30
30
 
31
- `data query --all --output csv` 内部处理分页。
31
+ `record_access` owns paging internally.
32
32
 
33
33
  Do not invent:
34
34
 
@@ -84,7 +84,7 @@ For penetration, conversion, or share:
84
84
 
85
85
  ## Normalize Relative Dates
86
86
 
87
- 在 data query 前把相对日期转换为精确范围。
87
+ Convert relative phrases into exact ranges before `record_access`.
88
88
 
89
89
  - `今年5月` -> exact May 1 to May 31 in the current year
90
90
  - `去年同期` -> same date range in previous year
@@ -2,12 +2,12 @@
2
2
 
3
3
  ## Canonical Sequence
4
4
 
5
- 1. 明确 `app_key`
6
- 2. 从当前 data schema 或已确认上下文选择字段 id
7
- 3. 决定指标意图
8
- 4. 选择 data query 的 columns / where / sort
9
- 5. `data query --all --output csv`
10
- 6. Python 读取每个 `files[].local_path`
5
+ 1. `app_get`
6
+ 2. `record_browse_schema_get`
7
+ 3. decide metric intent
8
+ 4. choose `record_access.columns / where / order_by`
9
+ 5. `record_access`
10
+ 6. Python over every returned CSV shard
11
11
  7. optional `record_list` or `record_get` only for sample/detail verification
12
12
 
13
13
  Metric intent must be one of:
@@ -74,7 +74,7 @@ If denominator is missing or scope differs, do not call the result a rate.
74
74
 
75
75
  ## Trend
76
76
 
77
- 1. 从 data schema 或查询响应的 `fields` 中选择日期/时间字段,并核对其 id、标题与类型。
77
+ 1. Choose a date/time field from `suggested_time_fields`.
78
78
  2. Convert relative phrases into exact date ranges.
79
79
  3. Fetch the date field and metrics.
80
80
  4. Bucket in pandas by day/week/month/quarter/year.
@@ -104,8 +104,8 @@ Never use `record_list` alone for final averages, shares, rankings, trends, or d
104
104
 
105
105
  If the exact field is unclear:
106
106
 
107
- 1. 检查 data schema 或返回的 `fields`
108
- 2. 按 `fields` 中的标题、字段 id 与类型筛选候选字段
107
+ 1. inspect `record_browse_schema_get.fields`
108
+ 2. use titles and suggested fields
109
109
  3. if one candidate is clearly dominant, proceed
110
110
  4. otherwise ask the user to confirm
111
111
 
@@ -54,7 +54,7 @@ If any part is ambiguous, ask. Do not rename a count as a rate.
54
54
 
55
55
  ## Time Scope
56
56
 
57
- 调用 data query 前把相对日期转换为精确日期。
57
+ Normalize relative dates to exact dates before calling `record_access`.
58
58
 
59
59
  Examples:
60
60
 
@@ -4,12 +4,12 @@
4
4
 
5
5
  Use `全量可信结论` only when:
6
6
 
7
- - 字段 id 来自当前 data schema 或已确认上下文
8
- - 数据来自 `data query --all --output csv`
7
+ - `record_browse_schema_get` was used
8
+ - data came from `record_access`
9
9
  - all returned CSV shards were read in Python
10
- - `complete=true`
11
- - `truncated=false`
12
- - `safe_for_final_conclusion=true`
10
+ - `record_access.complete=true`
11
+ - `record_access.truncated=false`
12
+ - `record_access.safe_for_final_conclusion=true`
13
13
  - metric definitions are complete
14
14
  - denominator exists for every ratio
15
15
  - time fields and date ranges are explicit
@@ -19,11 +19,11 @@ Use `全量可信结论` only when:
19
19
 
20
20
  Use `初步观察` when:
21
21
 
22
- - `status=needs_scope`
23
- - `status=partial`
24
- - `complete=false`
25
- - `truncated=true`
26
- - `safe_for_final_conclusion=false`
22
+ - `record_access.status=needs_scope`
23
+ - `record_access.status=partial`
24
+ - `record_access.complete=false`
25
+ - `record_access.truncated=true`
26
+ - `record_access.safe_for_final_conclusion=false`
27
27
  - evidence came from `record_list`
28
28
  - scope or saved view filter is unverified
29
29