@qingflow-tech/qingflow-cli 1.1.51 → 1.1.54
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.
- package/README.md +4 -4
- package/npm/lib/runtime.mjs +29 -13
- package/package.json +1 -1
- package/pyproject.toml +8 -2
- package/skills/qingflow-cli/SKILL.md +93 -322
- package/skills/qingflow-cli/manifest.yaml +1 -1
- package/skills/qingflow-cli/reference/00-INDEX.md +4 -4
- package/skills/qingflow-cli/reference/QINGFLOW_CLI_ADMIN_CHEATSHEET.md +1 -1
- package/skills/qingflow-cli/reference/QINGFLOW_CLI_BUILDER_VIEWS_WORKFLOW.md +3 -9
- package/skills/qingflow-cli/reference/QINGFLOW_CLI_DATA_RETRIEVAL_WORKFLOW.md +3 -137
- package/skills/qingflow-cli/reference/QINGFLOW_CLI_EXPLORATION_REPORT.md +6 -4
- package/skills/qingflow-cli/reference/QINGFLOW_CLI_FIELD_DATA_TYPES.md +14 -14
- package/skills/qingflow-cli/reference/QINGFLOW_CLI_MEMBER_CHEATSHEET.md +20 -19
- package/skills/qingflow-cli/reference/QINGFLOW_CLI_ONE_SHOT_CHEATSHEET.md +18 -14
- package/skills/qingflow-cli/reference/QINGFLOW_CLI_RECORD_CREATE_WORKFLOW.md +7 -12
- package/skills/qingflow-cli/reference/QINGFLOW_CLI_RECORD_UPDATE_WORKFLOW.md +2 -1
- package/skills/qingflow-cli/reference/builder/20-build-complete-system.md +3 -2
- package/skills/qingflow-cli/reference/builder/30-schema-fields.md +9 -5
- package/skills/qingflow-cli/reference/builder/50-views.md +192 -191
- package/skills/qingflow-cli/reference/builder/80-buttons-associated-resources.md +2 -0
- package/skills/qingflow-cli/reference/builder/README.md +1 -1
- package/skills/qingflow-cli/reference/builder/reference/app-delivery-sop.md +6 -6
- package/skills/qingflow-cli/reference/core/QINGFLOW_CLI_ADMIN_CHEATSHEET.md +1 -1
- package/skills/qingflow-cli/reference/core/QINGFLOW_CLI_DATA_RETRIEVAL_WORKFLOW.md +76 -95
- package/skills/qingflow-cli/reference/core/QINGFLOW_CLI_EXPLORATION_REPORT.md +6 -4
- package/skills/qingflow-cli/reference/core/QINGFLOW_CLI_FIELD_DATA_TYPES.md +13 -13
- package/skills/qingflow-cli/reference/core/QINGFLOW_CLI_MEMBER_CHEATSHEET.md +20 -19
- package/skills/qingflow-cli/reference/core/QINGFLOW_CLI_ONE_SHOT_CHEATSHEET.md +18 -14
- package/skills/qingflow-cli/reference/data/README.md +32 -0
- package/skills/qingflow-cli/reference/examples/README.md +1 -1
- package/skills/qingflow-cli/reference/examples/views/views_apply_v1alpha1.example.json +14 -0
- package/skills/qingflow-cli/reference/examples/views/views_upsert_table_minimal.example.json +30 -36
- package/skills/qingflow-cli/reference/record/QINGFLOW_CLI_RECORD_SPECIALIZED_WORKFLOW.md +50 -0
- package/skills/qingflow-cli/reference/record/QINGFLOW_CLI_RECORD_UPDATE_WORKFLOW.md +2 -1
- package/skills/qingflow-cli/reference/record/analysis/README.md +21 -113
- package/skills/qingflow-cli/reference/record/analysis/analysis-gotchas.md +10 -10
- package/skills/qingflow-cli/reference/record/analysis/analysis-patterns.md +9 -9
- package/skills/qingflow-cli/reference/record/analysis/business-context.md +1 -1
- package/skills/qingflow-cli/reference/record/analysis/confidence-reporting.md +10 -10
- package/skills/qingflow-cli/reference/record/analysis/data-access-playbook.md +52 -80
- package/skills/qingflow-cli/reference/record/analysis/pandas-recipes.md +2 -2
- package/skills/qingflow-common/SKILL.md +7 -4
- package/src/qingflow_mcp/app_form_compat.py +3 -0
- package/src/qingflow_mcp/app_form_validator.py +69 -17
- package/src/qingflow_mcp/builder_facade/app_form.py +497 -100
- package/src/qingflow_mcp/builder_facade/models.py +227 -17
- package/src/qingflow_mcp/builder_facade/schemas/app_form/manifest.json +1 -0
- package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/complete.json +64 -30
- package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/address.json +4 -8
- package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/amount.json +4 -8
- package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/attachment.json +6 -10
- package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/code_block.json +6 -10
- package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/data_relation.json +11 -18
- package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/date.json +4 -8
- package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/datetime.json +4 -8
- package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/department.json +6 -10
- package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/email.json +4 -8
- package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/link.json +4 -8
- package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/long_text.json +4 -8
- package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/member.json +6 -10
- package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/multi_select.json +4 -8
- package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/number.json +4 -8
- package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/phone.json +4 -8
- package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/q_linker.json +6 -10
- package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/relation.json +46 -15
- package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/rich_text.json +146 -0
- package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/single_choice.json +4 -8
- package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/single_select.json +4 -8
- package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/subtable.json +61 -27
- package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/text.json +4 -8
- package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/formula.json +43 -0
- package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/summary.json +7 -12
- package/src/qingflow_mcp/builder_facade/schemas/views/manifest.json +42 -0
- package/src/qingflow_mcp/builder_facade/schemas/views/v1alpha1/complete.json +1245 -0
- package/src/qingflow_mcp/builder_facade/schemas/views/v1alpha1/details/button-config.json +53 -0
- package/src/qingflow_mcp/builder_facade/schemas/views/v1alpha1/details/data-permission.json +60 -0
- package/src/qingflow_mcp/builder_facade/schemas/views/v1alpha1/details/display.json +73 -0
- package/src/qingflow_mcp/builder_facade/schemas/views/v1alpha1/details/operation-permission.json +48 -0
- package/src/qingflow_mcp/builder_facade/schemas/views/v1alpha1/details/query-condition.json +47 -0
- package/src/qingflow_mcp/builder_facade/schemas/views/v1alpha1/summary.json +319 -0
- package/src/qingflow_mcp/builder_facade/service.py +1709 -518
- package/src/qingflow_mcp/builder_facade/views_extract.py +595 -0
- package/src/qingflow_mcp/builder_facade/views_schema.py +400 -0
- package/src/qingflow_mcp/cli/commands/__init__.py +2 -1
- package/src/qingflow_mcp/cli/commands/builder.py +76 -55
- package/src/qingflow_mcp/cli/commands/data.py +134 -0
- package/src/qingflow_mcp/cli/commands/record.py +1 -1
- package/src/qingflow_mcp/cli/context.py +3 -0
- package/src/qingflow_mcp/cli/formatters.py +97 -1
- package/src/qingflow_mcp/public_surface.py +8 -0
- package/src/qingflow_mcp/response_trim.py +11 -2
- package/src/qingflow_mcp/server.py +2 -0
- package/src/qingflow_mcp/server_app_builder.py +34 -10
- package/src/qingflow_mcp/server_app_user.py +4 -0
- package/src/qingflow_mcp/solution/compiler/view_compiler.py +2 -1
- package/src/qingflow_mcp/solution/executor.py +96 -8
- package/src/qingflow_mcp/solution/spec_models.py +1 -0
- package/src/qingflow_mcp/tools/ai_builder_tools.py +218 -398
- package/src/qingflow_mcp/tools/csv_export.py +168 -0
- package/src/qingflow_mcp/tools/data_tools.py +284 -0
- package/src/qingflow_mcp/tools/record_tools.py +11 -46
- package/src/qingflow_mcp/tools/solution_tools.py +2 -0
- package/src/qingflow_mcp/tools/view_tools.py +0 -6
- package/src/qingflow_mcp/tools/view_writer.py +44 -0
- package/skills/qingflow-cli/reference/examples/views/views_batch_full.example.json +0 -159
- package/skills/qingflow-cli/reference/views_upsert_table_minimal.example.json +0 -42
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Qingflow CLI 直接数据操作
|
|
2
|
+
|
|
3
|
+
直接查询、读取、新增、更新和删除分别使用:
|
|
4
|
+
|
|
5
|
+
- `qingflow data query`
|
|
6
|
+
- `qingflow data get`
|
|
7
|
+
- `qingflow data insert`
|
|
8
|
+
- `qingflow data update`
|
|
9
|
+
- `qingflow data delete`
|
|
10
|
+
|
|
11
|
+
参数、JSON 文件形状和可选项必须来自当前工具 schema、当次 `--help` 或响应字段能力,不得从其他命令推测。
|
|
12
|
+
|
|
13
|
+
## 字段能力合同
|
|
14
|
+
|
|
15
|
+
1. 首次操作当前应用时,只通过只读 `data query/get` 请求 `include_schema=true`,读取同一次响应中的 `schema` 与递归 `field_capabilities`;不得用 insert/update 探测能力。
|
|
16
|
+
2. 构造 `where` 时,只使用目标字段 `filter_operators` 实际暴露的 `op`,并匹配对应 `value_shape`;不要在本文复制操作符矩阵。
|
|
17
|
+
3. 写入前优先执行不设置 `columns` 的只读 `data query` 并请求 schema,检查响应中的 `access`,再检查 `insertable`、`updatable` 与 `required_on_insert`。
|
|
18
|
+
4. `write_kind`、schema 与当次 `--help` 共同决定 payload 形状;运行时字段错误和权限结果优先于预检。
|
|
19
|
+
|
|
20
|
+
## 执行与恢复
|
|
21
|
+
|
|
22
|
+
- 已知 `app_key` 时直接执行目标业务命令;只有应用名称时先用 `app list --query` 查找并核对 `app_name/title`,目标明确且唯一时取其 `app_key`,否则请用户确认。不能把名称传给 `--app-key`。只有业务命令明确报告会话或工作区错误后才恢复认证上下文。
|
|
23
|
+
- 定位目标记录时先 query,再按需 get。字段只使用当前 schema 与字段能力允许的 id、能力和形状。
|
|
24
|
+
- insert、update、delete 会改变真实业务数据。删除、覆盖已有值或批量写入前,必须确认目标和影响范围。
|
|
25
|
+
- 返回后先检查 `write_executed`、`retry_safe`、字段错误和 hints。已执行、部分成功或状态不明时不得重放原请求。
|
|
26
|
+
- data 命令失败时只修正响应明确指出的问题,不得切换其他数据入口绕过权限或校验。
|
|
27
|
+
|
|
28
|
+
## 任务分流
|
|
29
|
+
|
|
30
|
+
- 批量导入:阅读 [批量导入 SOP](../record/QINGFLOW_CLI_RECORD_IMPORT_WORKFLOW.md)。
|
|
31
|
+
- 统计分析:阅读 [数据分析说明](../record/analysis/README.md),使用 `data query --all --output csv` 并读取全部 CSV 分片。
|
|
32
|
+
- 待办和流程动作:阅读 [任务上下文 SOP](../task/QINGFLOW_CLI_TASK_CONTEXT_WORKFLOW.md)。
|
|
@@ -7,7 +7,7 @@ Use these files as copyable bases after reading the matching resource document.
|
|
|
7
7
|
| Historical single-app schema probe | [schema/schema_single_app_form_standard.example.json](./schema/schema_single_app_form_standard.example.json) | Retired `--form-file` shape; use `builder app-form schema/get/validate/apply` for current declarations. |
|
|
8
8
|
| Historical multi-app schema probe | [schema/schema_multi_app_form_relation_layout.example.json](./schema/schema_multi_app_form_relation_layout.example.json) | Retired `--apps-file` shape; current systems create independent AppForms and then bind confirmed app keys. |
|
|
9
9
|
| Existing-app layout probe | [layout/layout_sections_full.example.json](./layout/layout_sections_full.example.json) | Historical layout-patch shape; current new and existing forms use the complete AppForm `spec.body`. |
|
|
10
|
-
| Views | [views/views_upsert_table_minimal.example.json](./views/views_upsert_table_minimal.example.json), [views/
|
|
10
|
+
| Views | [views/views_upsert_table_minimal.example.json](./views/views_upsert_table_minimal.example.json), [views/views_apply_v1alpha1.example.json](./views/views_apply_v1alpha1.example.json) | 单视图 JSON 对象,包含筛选、查询面板和视图绑定按钮;通过 `--app-key` 指定应用。 |
|
|
11
11
|
| Charts | [charts/charts_upsert_dashboard_starter.example.json](./charts/charts_upsert_dashboard_starter.example.json) | Standalone chart apply; portal usually creates missing charts inline. |
|
|
12
12
|
| Portal | [portal/portal_sections_standard_workbench.example.json](./portal/portal_sections_standard_workbench.example.json) | Standard workbench with inline QingBI charts and data views. |
|
|
13
13
|
| Associated resources | [associated/associated_resources_semantic_full.example.json](./associated/associated_resources_semantic_full.example.json) | Current-record matching through `match_mappings`. |
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "项目台账视图",
|
|
3
|
+
"type": "table",
|
|
4
|
+
"columns": [100, 101, 102, 103],
|
|
5
|
+
"data_permission": {"type": "custom", "scope": "dept"},
|
|
6
|
+
"sort": [{"que_id": 100, "ascending": false}],
|
|
7
|
+
"display": {"row_height": "compact", "pin_navigate": true},
|
|
8
|
+
"query_conditions": {
|
|
9
|
+
"enabled": true,
|
|
10
|
+
"exact": false,
|
|
11
|
+
"hide_before_query": false,
|
|
12
|
+
"rows": [["项目名称", "负责人"], ["创建时间"]]
|
|
13
|
+
}
|
|
14
|
+
}
|
package/skills/qingflow-cli/reference/examples/views/views_upsert_table_minimal.example.json
CHANGED
|
@@ -1,42 +1,36 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
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": [
|
|
3
15
|
{
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
"filters": [
|
|
10
|
-
{"field_name": "状态", "operator": "neq", "value": "已关闭"}
|
|
16
|
+
"text": "行内创建子记录",
|
|
17
|
+
"action": "add_data",
|
|
18
|
+
"target_app_key": "TARGET_APP_KEY",
|
|
19
|
+
"field_mappings": [
|
|
20
|
+
{"source_field": "数据ID", "target_field": "关联主记录"}
|
|
11
21
|
],
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
]
|
|
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"
|
|
40
34
|
}
|
|
41
35
|
]
|
|
42
36
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Qingflow CLI:record 日志与附件参考
|
|
2
|
+
|
|
3
|
+
> **适用范围**:任务需要完整数据/流程日志、附件或图片上下文时使用。普通应用数据查询使用 [`data query/get`](../core/QINGFLOW_CLI_DATA_RETRIEVAL_WORKFLOW.md)。
|
|
4
|
+
|
|
5
|
+
## record 查询链
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
app get(解析 accessible_views,选定 VIEW_ID)
|
|
9
|
+
→ record schema browse(读取该视图字段口径)
|
|
10
|
+
→ record list(样本浏览或模糊定位候选)
|
|
11
|
+
→ record get(可选:详情页首屏、附件与图片上下文)
|
|
12
|
+
→ record logs(可选:完整数据日志与流程日志)
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## 命令形状
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
qingflow --json app get --app-key APP_KEY > tmp/qingflow_app_get.json
|
|
19
|
+
|
|
20
|
+
qingflow --json record schema browse \
|
|
21
|
+
--app-key APP_KEY --view-id VIEW_ID \
|
|
22
|
+
> tmp/qingflow_record_schema.json
|
|
23
|
+
|
|
24
|
+
qingflow --json record list \
|
|
25
|
+
--app-key APP_KEY --view-id VIEW_ID \
|
|
26
|
+
> tmp/qingflow_record_list.json
|
|
27
|
+
|
|
28
|
+
qingflow --json record get \
|
|
29
|
+
--app-key APP_KEY --record-id RECORD_ID --view-id VIEW_ID \
|
|
30
|
+
> tmp/qingflow_record_get.json
|
|
31
|
+
|
|
32
|
+
qingflow --json record logs \
|
|
33
|
+
--app-key APP_KEY --record-id RECORD_ID --view-id VIEW_ID \
|
|
34
|
+
> tmp/qingflow_record_logs.json
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
`VIEW_ID` 只能来自 `app get.accessible_views`、已经确认的前端 URL 或用户明确提供的上下文。显式视图失败时不要自动换成另一系统视图。
|
|
38
|
+
|
|
39
|
+
## 专有结果
|
|
40
|
+
|
|
41
|
+
- `record get`:用于详情页字段、首屏日志、引用、关联资源、`media_assets` 和 `file_assets`。附件与图片优先使用返回的本地路径,不直接访问远端附件 URL。
|
|
42
|
+
- `record logs`:用于完整可见数据日志和流程日志。响应只读取摘要与 JSONL 文件路径,按需筛选本地文件,不把全文放入上下文。
|
|
43
|
+
- `record list`:只在用户明确指定该命令时用于样本浏览/模糊定位,不用于完整统计结论。
|
|
44
|
+
|
|
45
|
+
## 边界
|
|
46
|
+
|
|
47
|
+
- 统计分析仍转 `data query --all --output csv -> Python/pandas`。
|
|
48
|
+
- `CUSTOM_VIEW_LIST_UNAVAILABLE` 只说明自定义视图列表读取受限;不要据此断言应用整体不可读。
|
|
49
|
+
- 待办、已办和抄送属于 `task list --task-box ...`,不使用 `record list --view-id system:todo/done/cc`。
|
|
50
|
+
- 所有大 JSON、附件清单和日志摘要必须落盘。
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# Qingflow CLI:更新记录工作流(详情后直接写入)
|
|
2
2
|
|
|
3
|
+
> **兼容范围**:本文仅限用户明确要求旧 CLI `record` 兼容入口时使用。默认更新必须切换到 [data 操作说明](../data/README.md) 的 `data get` → `data update`;禁止在 data update 失败后自动回退本文链路。
|
|
3
4
|
> **用途**:使用当前 CLI 会话读取目标记录详情后,用 **`record update`** 直接提交差异字段。主链路是 `record get -> record update`;字段范围不清、候选歧义或失败排查时,才追加 **`record schema update`**。
|
|
4
|
-
>
|
|
5
|
+
> **关联**:直接数据操作统一使用 [data 操作说明](../data/README.md);最终统计结论统一使用 **[record/analysis](./analysis/README.md) 的 `data query --all --output csv -> Python/pandas`**;主技能 **[../SKILL.md](../../SKILL.md)**。
|
|
5
6
|
|
|
6
7
|
---
|
|
7
8
|
|
|
@@ -1,130 +1,38 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 轻流记录数据分析
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Default path, every time:
|
|
3
|
+
最终统计结论、分析报告、趋势、排名、比例和分布统一使用以下路径:
|
|
6
4
|
|
|
7
5
|
```text
|
|
8
|
-
|
|
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
|
-
}
|
|
6
|
+
qingflow data query --all --output csv -> 读取全部 CSV 分片 -> Python/pandas
|
|
71
7
|
```
|
|
72
8
|
|
|
73
|
-
|
|
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:
|
|
9
|
+
先用当前 CLI 帮助确认参数:
|
|
78
10
|
|
|
79
11
|
```bash
|
|
80
|
-
qingflow
|
|
12
|
+
qingflow data --help
|
|
13
|
+
qingflow data query --help
|
|
14
|
+
qingflow --json data query \
|
|
81
15
|
--app-key APP_KEY \
|
|
82
|
-
--view-id system:all \
|
|
83
16
|
--columns-file columns.json \
|
|
84
17
|
--where-file where.json \
|
|
85
|
-
--
|
|
86
|
-
--
|
|
18
|
+
--sort-file sort.json \
|
|
19
|
+
--all --output csv
|
|
87
20
|
```
|
|
88
21
|
|
|
89
|
-
|
|
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.
|
|
22
|
+
`--all` 与 `--output csv` 必须同时使用。columns 使用字段 id 数组;where 与 sort 使用包含 `field_id` 的对象数组。字段 id 来自当前 data schema 或已确认上下文,不得猜测。
|
|
115
23
|
|
|
116
|
-
##
|
|
24
|
+
## 分析门禁
|
|
117
25
|
|
|
118
|
-
|
|
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;导出工具只用于用户明确要求下载文件的场景。
|
|
119
33
|
|
|
120
|
-
|
|
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)
|
|
34
|
+
## 输出要求
|
|
127
35
|
|
|
128
|
-
|
|
36
|
+
默认输出结论、关键数据、口径与范围、可信度/限制。比例必须包含分子与分母,趋势必须说明时间字段与日期范围,排名必须来自 pandas 显式排序。
|
|
129
37
|
|
|
130
|
-
|
|
38
|
+
进一步细节见同目录的取数状态机、pandas 模板、分析模式、业务上下文、可信度和报告模板。
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
# Analysis Gotchas
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 不要猜字段 schema
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
正确路径:
|
|
6
6
|
|
|
7
|
-
1.
|
|
8
|
-
2. `
|
|
9
|
-
3. `
|
|
10
|
-
4. Python
|
|
7
|
+
1. 从当前 data schema 或已确认上下文选择字段 id
|
|
8
|
+
2. `data query --all --output csv`
|
|
9
|
+
3. 读取全部 `files[].local_path`
|
|
10
|
+
4. Python/pandas
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
data 工具返回的 schema、字段错误与访问范围是事实源;缺失字段不是猜测隐藏 id 的理由。
|
|
13
13
|
|
|
14
14
|
## Do Not Use Export For Analysis
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
导出工具只用于用户明确要求下载文件。分析使用 `data query --all --output csv`,因为它返回本地 CSV 分片与结构化完整性字段。
|
|
17
17
|
|
|
18
18
|
## Do Not Treat `record_list` As Full Data
|
|
19
19
|
|
|
@@ -28,7 +28,7 @@ Export tools are for user-requested files. Analysis uses `record_access` because
|
|
|
28
28
|
|
|
29
29
|
## Do Not Control Paging
|
|
30
30
|
|
|
31
|
-
`
|
|
31
|
+
`data query --all --output csv` 内部处理分页。
|
|
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
|
-
|
|
87
|
+
在 data query 前把相对日期转换为精确范围。
|
|
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. `
|
|
6
|
-
2.
|
|
7
|
-
3.
|
|
8
|
-
4.
|
|
9
|
-
5. `
|
|
10
|
-
6. Python
|
|
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`
|
|
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.
|
|
77
|
+
1. 从 data schema 或查询响应的 `fields` 中选择日期/时间字段,并核对其 id、标题与类型。
|
|
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.
|
|
108
|
-
2.
|
|
107
|
+
1. 检查 data schema 或返回的 `fields`
|
|
108
|
+
2. 按 `fields` 中的标题、字段 id 与类型筛选候选字段
|
|
109
109
|
3. if one candidate is clearly dominant, proceed
|
|
110
110
|
4. otherwise ask the user to confirm
|
|
111
111
|
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
Use `全量可信结论` only when:
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
- data
|
|
7
|
+
- 字段 id 来自当前 data schema 或已确认上下文
|
|
8
|
+
- 数据来自 `data query --all --output csv`
|
|
9
9
|
- all returned CSV shards were read in Python
|
|
10
|
-
- `
|
|
11
|
-
- `
|
|
12
|
-
- `
|
|
10
|
+
- `complete=true`
|
|
11
|
+
- `truncated=false`
|
|
12
|
+
- `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
|
-
- `
|
|
23
|
-
- `
|
|
24
|
-
- `
|
|
25
|
-
- `
|
|
26
|
-
- `
|
|
22
|
+
- `status=needs_scope`
|
|
23
|
+
- `status=partial`
|
|
24
|
+
- `complete=false`
|
|
25
|
+
- `truncated=true`
|
|
26
|
+
- `safe_for_final_conclusion=false`
|
|
27
27
|
- evidence came from `record_list`
|
|
28
28
|
- scope or saved view filter is unverified
|
|
29
29
|
|
|
@@ -1,106 +1,78 @@
|
|
|
1
|
-
#
|
|
1
|
+
# data CSV 取数状态机
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## 必须路径
|
|
4
4
|
|
|
5
|
-
|
|
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 中合并。
|
|
6
10
|
|
|
7
|
-
|
|
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:
|
|
11
|
+
CLI 发现与调用:
|
|
27
12
|
|
|
28
13
|
```bash
|
|
29
|
-
qingflow
|
|
14
|
+
qingflow data --help
|
|
15
|
+
qingflow data query --help
|
|
16
|
+
qingflow --json data query \
|
|
30
17
|
--app-key APP_KEY \
|
|
31
|
-
--view-id VIEW_ID \
|
|
32
18
|
--columns-file columns.json \
|
|
33
19
|
--where-file where.json \
|
|
34
|
-
--
|
|
35
|
-
--
|
|
20
|
+
--sort-file sort.json \
|
|
21
|
+
--all --output csv
|
|
36
22
|
```
|
|
37
23
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
## Request Patterns
|
|
24
|
+
columns 是字段 id 数组,例如 `[2, 18]`;where 和 sort 是带 `field_id` 的对象数组。`--all` 与 `--output csv` 必须同时出现。
|
|
41
25
|
|
|
42
|
-
|
|
26
|
+
## 真实输出字段
|
|
43
27
|
|
|
44
|
-
|
|
28
|
+
分析前先读取:
|
|
45
29
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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`
|
|
55
39
|
|
|
56
|
-
|
|
40
|
+
输出还可能包含 `local_dir`、访问上下文和动态提示;这些内容保持原样解释,不在本地补造。
|
|
57
41
|
|
|
58
|
-
|
|
42
|
+
## 状态决策
|
|
59
43
|
|
|
60
|
-
|
|
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 |
|
|
44
|
+
| 状态 | 含义 | 动作 |
|
|
77
45
|
|---|---|---|
|
|
78
|
-
| `success`
|
|
79
|
-
| `needs_scope` |
|
|
80
|
-
| `partial` |
|
|
81
|
-
| `complete=false` |
|
|
82
|
-
| `truncated=true` |
|
|
83
|
-
|
|
84
|
-
## `needs_scope` Recovery
|
|
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` | 不适合最终总体结论 | 降级或重试 |
|
|
85
52
|
|
|
86
|
-
|
|
53
|
+
`needs_scope` 时 `files=[]`、`row_count=0`;不要寻找不存在的 CSV。partial 时保留的文件可用于局部观察,但不能使用“全部”“整体”“全量”等措辞。
|
|
87
54
|
|
|
88
|
-
|
|
89
|
-
- `suggested_time_fields`: choose likely date fields
|
|
90
|
-
- `recommended_where_examples`: reuse if they match the user request
|
|
55
|
+
## 请求示例
|
|
91
56
|
|
|
92
|
-
|
|
57
|
+
`columns.json`:
|
|
93
58
|
|
|
94
|
-
|
|
59
|
+
```json
|
|
60
|
+
[2, 18]
|
|
61
|
+
```
|
|
95
62
|
|
|
96
|
-
|
|
63
|
+
`where.json`(同一字段的范围使用两个公开操作符并按 AND 组合):
|
|
97
64
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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
|
+
```
|
|
101
71
|
|
|
102
|
-
|
|
72
|
+
`sort.json`:
|
|
103
73
|
|
|
104
|
-
|
|
74
|
+
```json
|
|
75
|
+
[{"field_id": 2, "direction": "asc"}]
|
|
76
|
+
```
|
|
105
77
|
|
|
106
|
-
|
|
78
|
+
若分子和分母使用不同筛选,分别执行兼容范围的 data query;两侧都满足完整性门禁后再计算比例。
|