@qingflow-tech/qingflow-cli 1.1.57 → 1.1.59

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 (82) 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 +1 -2
  5. package/skills/qingflow-cli/SKILL.md +319 -90
  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_DATA_RETRIEVAL_WORKFLOW.md +137 -3
  10. package/skills/qingflow-cli/reference/QINGFLOW_CLI_EXPLORATION_REPORT.md +4 -6
  11. package/skills/qingflow-cli/reference/QINGFLOW_CLI_FIELD_DATA_TYPES.md +14 -14
  12. package/skills/qingflow-cli/reference/QINGFLOW_CLI_MEMBER_CHEATSHEET.md +19 -20
  13. package/skills/qingflow-cli/reference/QINGFLOW_CLI_ONE_SHOT_CHEATSHEET.md +14 -18
  14. package/skills/qingflow-cli/reference/QINGFLOW_CLI_RECORD_CREATE_WORKFLOW.md +12 -7
  15. package/skills/qingflow-cli/reference/QINGFLOW_CLI_RECORD_UPDATE_WORKFLOW.md +1 -2
  16. package/skills/qingflow-cli/reference/builder/20-build-complete-system.md +2 -2
  17. package/skills/qingflow-cli/reference/builder/30-schema-fields.md +5 -9
  18. package/skills/qingflow-cli/reference/builder/reference/app-delivery-sop.md +3 -3
  19. package/skills/qingflow-cli/reference/core/QINGFLOW_CLI_ADMIN_CHEATSHEET.md +1 -1
  20. package/skills/qingflow-cli/reference/core/QINGFLOW_CLI_DATA_RETRIEVAL_WORKFLOW.md +95 -76
  21. package/skills/qingflow-cli/reference/core/QINGFLOW_CLI_EXPLORATION_REPORT.md +4 -6
  22. package/skills/qingflow-cli/reference/core/QINGFLOW_CLI_FIELD_DATA_TYPES.md +13 -13
  23. package/skills/qingflow-cli/reference/core/QINGFLOW_CLI_MEMBER_CHEATSHEET.md +19 -20
  24. package/skills/qingflow-cli/reference/core/QINGFLOW_CLI_ONE_SHOT_CHEATSHEET.md +14 -18
  25. package/skills/qingflow-cli/reference/record/QINGFLOW_CLI_RECORD_UPDATE_WORKFLOW.md +1 -2
  26. package/skills/qingflow-cli/reference/record/analysis/README.md +113 -21
  27. package/skills/qingflow-cli/reference/record/analysis/analysis-gotchas.md +10 -10
  28. package/skills/qingflow-cli/reference/record/analysis/analysis-patterns.md +9 -9
  29. package/skills/qingflow-cli/reference/record/analysis/business-context.md +1 -1
  30. package/skills/qingflow-cli/reference/record/analysis/confidence-reporting.md +10 -10
  31. package/skills/qingflow-cli/reference/record/analysis/data-access-playbook.md +80 -52
  32. package/skills/qingflow-cli/reference/record/analysis/pandas-recipes.md +2 -2
  33. package/skills/qingflow-common/SKILL.md +4 -7
  34. package/src/qingflow_mcp/app_form_compat.py +0 -3
  35. package/src/qingflow_mcp/app_form_validator.py +17 -69
  36. package/src/qingflow_mcp/builder_facade/app_form.py +100 -497
  37. package/src/qingflow_mcp/builder_facade/models.py +2 -2
  38. package/src/qingflow_mcp/builder_facade/schemas/app_form/manifest.json +0 -1
  39. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/complete.json +30 -64
  40. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/address.json +8 -4
  41. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/amount.json +8 -4
  42. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/attachment.json +10 -6
  43. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/code_block.json +10 -6
  44. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/data_relation.json +18 -11
  45. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/date.json +8 -4
  46. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/datetime.json +8 -4
  47. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/department.json +10 -6
  48. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/email.json +8 -4
  49. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/link.json +8 -4
  50. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/long_text.json +8 -4
  51. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/member.json +10 -6
  52. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/multi_select.json +8 -4
  53. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/number.json +8 -4
  54. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/phone.json +8 -4
  55. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/q_linker.json +10 -6
  56. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/relation.json +15 -46
  57. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/single_choice.json +8 -4
  58. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/single_select.json +8 -4
  59. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/subtable.json +27 -61
  60. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/text.json +8 -4
  61. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/formula.json +0 -43
  62. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/summary.json +12 -7
  63. package/src/qingflow_mcp/builder_facade/schemas/views/v1alpha1/complete.json +3 -4
  64. package/src/qingflow_mcp/builder_facade/schemas/views/v1alpha1/details/data-permission.json +3 -3
  65. package/src/qingflow_mcp/builder_facade/schemas/views/v1alpha1/summary.json +2 -3
  66. package/src/qingflow_mcp/builder_facade/service.py +6 -43
  67. package/src/qingflow_mcp/builder_facade/views_extract.py +12 -2
  68. package/src/qingflow_mcp/cli/commands/__init__.py +1 -2
  69. package/src/qingflow_mcp/cli/commands/record.py +1 -1
  70. package/src/qingflow_mcp/cli/context.py +0 -3
  71. package/src/qingflow_mcp/cli/formatters.py +1 -97
  72. package/src/qingflow_mcp/public_surface.py +0 -5
  73. package/src/qingflow_mcp/response_trim.py +1 -2
  74. package/src/qingflow_mcp/server.py +0 -2
  75. package/src/qingflow_mcp/server_app_user.py +0 -4
  76. package/src/qingflow_mcp/tools/record_tools.py +46 -11
  77. package/skills/qingflow-cli/reference/data/README.md +0 -32
  78. package/skills/qingflow-cli/reference/record/QINGFLOW_CLI_RECORD_SPECIALIZED_WORKFLOW.md +0 -50
  79. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/rich_text.json +0 -146
  80. package/src/qingflow_mcp/cli/commands/data.py +0 -134
  81. package/src/qingflow_mcp/tools/csv_export.py +0 -168
  82. package/src/qingflow_mcp/tools/data_tools.py +0 -284
@@ -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
 
@@ -1,78 +1,106 @@
1
- # data CSV 取数状态机
1
+ # Data Access Playbook
2
2
 
3
- ## 必须路径
3
+ This file is the operational state machine for `record_access`.
4
4
 
5
- 1. 明确 `app_key` 与指标意图。
6
- 2. 从当前 data schema 或已确认上下文选择字段 id。
7
- 3. 构造 columns、where、sort JSON 文件。
8
- 4. 执行 `data query --all --output csv`。
9
- 5. 读取全部 `files[].local_path` 并在 Python/pandas 中合并。
5
+ ## Required Sequence
10
6
 
11
- CLI 发现与调用:
7
+ 1. `app_get`
8
+ 2. choose `view_id` from `accessible_views`
9
+ 3. `record_browse_schema_get(app_key, view_id)`
10
+ 4. build `record_access.columns / where / order_by` from field ids
11
+ 5. run `record_access`
12
+ 6. read every CSV shard with Python
13
+
14
+ Do not call `record_access` with field titles, guessed ids, page controls, row limits, or profile.
15
+ CSV columns are readable and field-id anchored, for example `项目状态__field_343283094`; do not look for extra `schema.json` or README files.
16
+
17
+ ## Finding `record_access`
18
+
19
+ `record_access` can be available as an MCP tool or as a CLI subcommand. If the MCP surface does not show a top-level `record_access` tool, look under the Qingflow CLI record group before choosing any other path:
20
+
21
+ ```bash
22
+ qingflow record --help
23
+ qingflow record access --help
24
+ ```
25
+
26
+ The CLI call is:
12
27
 
13
28
  ```bash
14
- qingflow data --help
15
- qingflow data query --help
16
- qingflow --json data query \
29
+ qingflow record access \
17
30
  --app-key APP_KEY \
31
+ --view-id VIEW_ID \
18
32
  --columns-file columns.json \
19
33
  --where-file where.json \
20
- --sort-file sort.json \
21
- --all --output csv
34
+ --order-by-file order_by.json \
35
+ --json
22
36
  ```
23
37
 
24
- columns 是字段 id 数组,例如 `[2, 18]`;where 和 sort 是带 `field_id` 的对象数组。`--all` 与 `--output csv` 必须同时出现。
38
+ This is the same analysis path: it writes CSV shards and metadata for Python. Do not replace it with list browsing, export, QingBI, or aggregate helpers just because the MCP tool is not visible.
39
+
40
+ ## Request Patterns
25
41
 
26
- ## 真实输出字段
42
+ ### Count or distribution
27
43
 
28
- 分析前先读取:
44
+ Fetch the grouping field and any time/business filter field.
29
45
 
30
- - `status`
31
- - `files[].local_path`、`files[].row_count`、`files[].part`
32
- - `row_count`
33
- - `complete`
34
- - `truncated`
35
- - `safe_for_final_conclusion`
36
- - `fetched_pages`
37
- - `stopped_reason`
38
- - `fields`
46
+ ```json
47
+ {
48
+ "app_key": "APP_KEY",
49
+ "view_id": "system:all",
50
+ "columns": [{ "field_id": 18 }],
51
+ "where": [{ "field_id": 2, "op": "between", "value": ["2026-05-01", "2026-05-31"] }],
52
+ "order_by": []
53
+ }
54
+ ```
39
55
 
40
- 输出还可能包含 `local_dir`、访问上下文和动态提示;这些内容保持原样解释,不在本地补造。
56
+ ### Trend
41
57
 
42
- ## 状态决策
58
+ Fetch the date/time field plus metric fields.
43
59
 
44
- | 状态 | 含义 | 动作 |
60
+ ```json
61
+ {
62
+ "app_key": "APP_KEY",
63
+ "view_id": "system:all",
64
+ "columns": [{ "field_id": 2 }, { "field_id": 18 }],
65
+ "where": [{ "field_id": 2, "op": "between", "value": ["2026-01-01", "2026-12-31"] }],
66
+ "order_by": [{ "field_id": 2, "direction": "asc" }]
67
+ }
68
+ ```
69
+
70
+ ### Ratio
71
+
72
+ If numerator and denominator use different filters, run separate `record_access` calls. Only compute the ratio after both source datasets are complete and compatible.
73
+
74
+ ## Status Decisions
75
+
76
+ | Status | Meaning | Agent action |
45
77
  |---|---|---|
46
- | `success` 且完整性三项满足 | 请求范围完整可用 | 读取所有分片后形成总体结论 |
47
- | `needs_scope` | 无范围大查询被拒绝,未写 CSV | 读取 `scope.reported_total` 与 `scope.row_threshold`,请求时间或业务范围 |
48
- | `partial` | 已写部分 CSV,但未完成 | 只给局部观察,说明 `row_count` 与 `stopped_reason` |
49
- | `complete=false` | 未取完请求范围 | 不给总体结论 |
50
- | `truncated=true` | 提前停止 | 收窄范围后重试 |
51
- | `safe_for_final_conclusion=false` | 不适合最终总体结论 | 降级或重试 |
78
+ | `success` + `safe_for_final_conclusion=true` | Full retrieved scope is reliable | Give final conclusion |
79
+ | `needs_scope` | Tool refused large unbounded scan, no CSV | Ask for scope or retry with explicit period/business filter |
80
+ | `partial` | Some CSV files written, but not full data | Give only subset observation |
81
+ | `complete=false` | Not all requested data is available | Do not present full-population conclusion |
82
+ | `truncated=true` | Tool had to stop before full scope | Disclose and narrow scope |
52
83
 
53
- `needs_scope` 时 `files=[]`、`row_count=0`;不要寻找不存在的 CSV。partial 时保留的文件可用于局部观察,但不能使用“全部”“整体”“全量”等措辞。
84
+ ## `needs_scope` Recovery
54
85
 
55
- ## 请求示例
86
+ Use the returned `scope` object:
56
87
 
57
- `columns.json`:
88
+ - `reported_total`: explain why scope is needed
89
+ - `suggested_time_fields`: choose likely date fields
90
+ - `recommended_where_examples`: reuse if they match the user request
58
91
 
59
- ```json
60
- [2, 18]
61
- ```
92
+ If the user already provided a concrete month/quarter/year, retry with that period. If no business boundary is available, ask one short clarification.
62
93
 
63
- `where.json`(同一字段的范围使用两个公开操作符并按 AND 组合):
94
+ ## `partial` Recovery
64
95
 
65
- ```json
66
- [
67
- {"field_id": 2, "op": "gte", "value": "2026-05-01"},
68
- {"field_id": 2, "op": "lte", "value": "2026-05-31"}
69
- ]
70
- ```
96
+ You may read the files, but must label output as partial:
71
97
 
72
- `sort.json`:
98
+ - say which files/rows were analyzed
99
+ - do not use `全部`, `所有`, `整体`, or `全量`
100
+ - suggest narrowing time or business scope before final conclusion
73
101
 
74
- ```json
75
- [{"field_id": 2, "direction": "asc"}]
76
- ```
102
+ ## View Scope
103
+
104
+ For custom views, the result is scoped to that saved view. If `verification.view_filter_verified=false`, disclose that the saved-filter scope could not be fully verified.
77
105
 
78
- 若分子和分母使用不同筛选,分别执行兼容范围的 data query;两侧都满足完整性门禁后再计算比例。
106
+ For board/gantt views, switch to a table-style view or `system:all` plus explicit filters.
@@ -9,14 +9,14 @@ import pandas as pd
9
9
 
10
10
  files = [
11
11
  "/absolute/path/records-0001.csv",
12
- # 包含 data query 返回的每个 files[].local_path
12
+ # include every record_access.files[].local_path
13
13
  ]
14
14
 
15
15
  frames = [pd.read_csv(path, dtype=str, keep_default_na=False) for path in files]
16
16
  df = pd.concat(frames, ignore_index=True) if frames else pd.DataFrame()
17
17
 
18
18
  # Columns are readable and field-id anchored, e.g. 项目状态__field_343283094.
19
- fields = [] # 需要字段 id 元数据时使用 data query 返回的 fields
19
+ fields = [] # optionally paste record_access.fields here if you need field-id metadata
20
20
  field_by_id = {int(item["field_id"]): item for item in fields if "field_id" in item}
21
21
  title_by_col = {item["column_name"]: item["title"] for item in fields if item.get("column_name")}
22
22
  ```
@@ -19,8 +19,7 @@ Do not require both surfaces. If only one is installed, complete the workflow on
19
19
  ## Shared Concepts
20
20
 
21
21
  - **AppForm** is the versioned declarative definition for an application form: app metadata, fields, sections, layout, settings, and field configuration. The same JSON declaration is used by CLI and Qingflow MCP.
22
- - **Data** 是既有应用中的普通业务数据。查询、单条读取和直接增删改默认使用视图无关的 data 入口,并以当次 schema、字段能力和访问范围为准。
23
- - **Record** 用于详情页附件/图片、完整日志、导入、代码块,以及用户明确指定的 record 命令;不要把普通应用数据工作路由到 record。
22
+ - **Record** is runtime data written to an existing app. Use the record schema before an insert, update, import, or analysis workflow.
24
23
  - **Task** is a workflow work item. Prefer task operations for approval, transfer, rollback, and assignee actions.
25
24
  - **Builder resource** is package, app, view, chart, portal, navigation, or workflow configuration. It is separate from record data.
26
25
  - **Schema version** is part of the public contract. Pin it for one AppForm or workflow operation and do not combine values from different versions.
@@ -31,13 +30,11 @@ Do not require both surfaces. If only one is installed, complete the workflow on
31
30
  | --- | --- | --- |
32
31
  | Form schema/read/apply/delete | `qingflow --json builder app-form ...` / `builder app delete` | `app_form_schema`, `app_form_get`, `app_form_apply`, `app_delete` |
33
32
  | AppForm static validation | `qingflow --json builder app-form validate --file ...` | Performed inside `app_form_apply`; no separate tool |
34
- | 普通应用数据查询与直接增删改 | `qingflow --json data ...` | Qingflow MCP `data_query/get/insert/update/delete` |
35
- | 日志、附件、导入、代码块或用户指定的 record 命令 | `qingflow --json record ...` / `import ...` | Qingflow MCP 对应 record/import 专项工具 |
36
- | 待办与流程动作 | `qingflow --json task ...` | Qingflow MCP task tools |
37
- | 免登录打开网页或指定业务页面 | `qingflow --json auth login-link [--redirect-path PATH]` | `get_login_link` |
33
+ | Record and task work | `qingflow --json record ...` / `task ...` | Qingflow MCP record and task tools |
34
+ | Open a workspace or confirmed business page | `qingflow --json auth login-link [--redirect-path PATH]` | `get_login_link` |
38
35
  | Package, view, portal, chart, workflow | `qingflow --json builder ...` | Qingflow MCP configuration tools |
39
36
 
40
- The operation names and payload schemas are defined by the public surface. Use the current Schema or tool input schema as the source of truth, not another command's shape or a backend payload.
37
+ The operation names and payload schemas are defined by the public surface. Use the current Schema or tool input schema as the source of truth, not a legacy command name or backend payload.
41
38
 
42
39
  ## Package Boundaries
43
40
 
@@ -10,9 +10,6 @@ from .json_types import JSONObject
10
10
  TYPE_ALIASES = {
11
11
  "multiline": "long_text",
12
12
  "textarea": "long_text",
13
- "richtext": "rich_text",
14
- "rich-text": "rich_text",
15
- "rich_text": "rich_text",
16
13
  "radio": "single_choice",
17
14
  "boolean": "single_choice",
18
15
  "select": "single_select",