@qingflow-tech/qingflow-cli 1.1.2 → 1.1.34
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 +2 -2
- package/docs/local-agent-install.md +10 -0
- package/package.json +1 -1
- package/pyproject.toml +1 -1
- package/skills/qingflow-cli/SKILL.md +61 -47
- package/skills/qingflow-cli/manifest.yaml +1 -1
- package/skills/qingflow-cli/reference/00-INDEX.md +35 -0
- package/skills/qingflow-cli/reference/QINGFLOW_CLI_BUILDER_APP_DELIVERY_WORKFLOW.md +21 -477
- package/skills/qingflow-cli/reference/QINGFLOW_CLI_BUILDER_VIEWS_WORKFLOW.md +44 -290
- package/skills/qingflow-cli/reference/QINGFLOW_CLI_SCHEMA_APPLY_FIELD_TYPES_AND_SCENARIOS.md +11 -102
- package/skills/qingflow-cli/reference/builder/10-build-single-app.md +57 -0
- package/skills/qingflow-cli/reference/builder/20-build-complete-system.md +84 -0
- package/skills/qingflow-cli/reference/builder/30-schema-fields.md +317 -0
- package/skills/qingflow-cli/reference/builder/40-layout.md +70 -0
- package/skills/qingflow-cli/reference/builder/50-views.md +540 -0
- package/skills/qingflow-cli/reference/builder/60-charts.md +328 -0
- package/skills/qingflow-cli/reference/builder/70-portal.md +372 -0
- package/skills/qingflow-cli/reference/builder/80-buttons-associated-resources.md +148 -0
- package/skills/qingflow-cli/reference/builder/90-workflow.md +35 -0
- package/skills/qingflow-cli/reference/builder/99-publish-verify.md +64 -0
- package/skills/qingflow-cli/reference/builder/README.md +62 -0
- package/skills/qingflow-cli/reference/builder/code-integrations/README.md +130 -0
- package/skills/qingflow-cli/reference/builder/code-integrations/code-block.md +66 -0
- package/skills/qingflow-cli/reference/builder/code-integrations/q-linker.md +77 -0
- package/skills/qingflow-cli/reference/builder/reference/app-delivery-sop.md +508 -0
- package/skills/qingflow-cli/reference/builder/reference/match-rules.md +229 -0
- package/skills/qingflow-cli/reference/builder/reference/workspace-icons.md +89 -0
- package/skills/qingflow-cli/reference/builder/workflow/01-overview.md +48 -0
- package/skills/qingflow-cli/reference/builder/workflow/02-update-mode.md +63 -0
- package/skills/qingflow-cli/reference/builder/workflow/03-flow-patterns.md +59 -0
- package/skills/qingflow-cli/reference/builder/workflow/04-stage1-business-modeling.md +131 -0
- package/skills/qingflow-cli/reference/builder/workflow/05-stage2-members-roles.md +29 -0
- package/skills/qingflow-cli/reference/builder/workflow/06-stage3-build-spec.md +211 -0
- package/skills/qingflow-cli/reference/builder/workflow/07-stage4-validate-spec.md +36 -0
- package/skills/qingflow-cli/reference/builder/workflow/08-stage5-apply-verify.md +66 -0
- package/skills/qingflow-cli/reference/builder/workflow/09-stage6-summary.md +88 -0
- package/skills/qingflow-cli/reference/builder/workflow/10-node-config-reference.md +93 -0
- package/skills/qingflow-cli/reference/builder/workflow/11-troubleshooting.md +18 -0
- package/skills/qingflow-cli/reference/builder/workflow/README.md +88 -0
- package/skills/qingflow-cli/reference/builder/workflow/workflow-schema.json +1754 -0
- package/skills/qingflow-cli/reference/charts_upsert_dashboard_starter.example.json +81 -0
- package/skills/qingflow-cli/reference/core/QINGFLOW_CLI_ADMIN_CHEATSHEET.md +94 -0
- package/skills/qingflow-cli/reference/core/QINGFLOW_CLI_DATA_RETRIEVAL_WORKFLOW.md +139 -0
- package/skills/qingflow-cli/reference/core/QINGFLOW_CLI_EXPLORATION_REPORT.md +84 -0
- package/skills/qingflow-cli/reference/core/QINGFLOW_CLI_FIELD_DATA_TYPES.md +129 -0
- package/skills/qingflow-cli/reference/core/QINGFLOW_CLI_MEMBER_CHEATSHEET.md +195 -0
- package/skills/qingflow-cli/reference/core/QINGFLOW_CLI_ONE_SHOT_CHEATSHEET.md +159 -0
- package/skills/qingflow-cli/reference/examples/README.md +17 -0
- package/skills/qingflow-cli/reference/examples/associated/associated_resources_semantic_full.example.json +50 -0
- package/skills/qingflow-cli/reference/examples/buttons/custom_buttons_advanced.example.json +56 -0
- package/skills/qingflow-cli/reference/examples/charts/charts_remove.example.json +1 -0
- package/skills/qingflow-cli/reference/examples/charts/charts_reorder.example.json +1 -0
- package/skills/qingflow-cli/reference/examples/charts/charts_upsert_bar.example.json +8 -0
- package/skills/qingflow-cli/reference/examples/charts/charts_upsert_dashboard_starter.example.json +118 -0
- package/skills/qingflow-cli/reference/examples/charts/charts_upsert_minimal.example.json +13 -0
- package/skills/qingflow-cli/reference/examples/layout/layout_sections_full.example.json +22 -0
- package/skills/qingflow-cli/reference/examples/portal/portal_sections_all_types.example.json +145 -0
- package/skills/qingflow-cli/reference/examples/portal/portal_sections_five_types.example.json +126 -0
- package/skills/qingflow-cli/reference/examples/portal/portal_sections_standard_workbench.example.json +178 -0
- package/skills/qingflow-cli/reference/examples/record/record_insert_all_field_types.example.json +35 -0
- package/skills/qingflow-cli/reference/examples/schema/_batch_schema_complex.json +18 -0
- package/skills/qingflow-cli/reference/examples/schema/_batch_schema_scalar.json +17 -0
- package/skills/qingflow-cli/reference/examples/schema/schema_add_fields_minimal.example.json +7 -0
- package/skills/qingflow-cli/reference/examples/schema/schema_apply_add_fields_all_types.json +78 -0
- package/skills/qingflow-cli/reference/examples/schema/schema_multi_app_form_relation_layout.example.json +166 -0
- package/skills/qingflow-cli/reference/examples/schema/schema_single_app_form_standard.example.json +95 -0
- package/skills/qingflow-cli/reference/examples/views/views_batch_full.example.json +159 -0
- package/skills/qingflow-cli/reference/examples/views/views_upsert_table_minimal.example.json +42 -0
- package/skills/qingflow-cli/reference/portal_sections_all_types.example.json +18 -4
- package/skills/qingflow-cli/reference/portal_sections_five_types.example.json +3 -3
- package/skills/qingflow-cli/reference/portal_sections_standard_workbench.example.json +57 -7
- package/skills/qingflow-cli/reference/record/QINGFLOW_CLI_RECORD_CREATE_WORKFLOW.md +22 -0
- package/skills/qingflow-cli/reference/record/QINGFLOW_CLI_RECORD_DELETE_WORKFLOW.md +31 -0
- package/skills/qingflow-cli/reference/record/QINGFLOW_CLI_RECORD_IMPORT_WORKFLOW.md +176 -0
- package/skills/qingflow-cli/reference/record/QINGFLOW_CLI_RECORD_UPDATE_WORKFLOW.md +167 -0
- package/skills/qingflow-cli/reference/record/analysis/README.md +130 -0
- package/skills/qingflow-cli/reference/record/analysis/analysis-gotchas.md +91 -0
- package/skills/qingflow-cli/reference/record/analysis/analysis-patterns.md +112 -0
- package/skills/qingflow-cli/reference/record/analysis/business-context.md +74 -0
- package/skills/qingflow-cli/reference/record/analysis/confidence-reporting.md +69 -0
- package/skills/qingflow-cli/reference/record/analysis/data-access-playbook.md +106 -0
- package/skills/qingflow-cli/reference/record/analysis/pandas-recipes.md +172 -0
- package/skills/qingflow-cli/reference/record/analysis/report-format.md +76 -0
- package/skills/qingflow-cli/reference/record/insert/README.md +125 -0
- package/skills/qingflow-cli/reference/schema_apply_add_fields_all_types.json +1 -1
- package/skills/qingflow-cli/reference/task/QINGFLOW_CLI_TASK_CONTEXT_WORKFLOW.md +153 -0
- package/skills/qingflow-cli/reference/task/ops/README.md +134 -0
- package/skills/qingflow-cli/reference/task/ops/environments.md +43 -0
- package/skills/qingflow-cli/reference/task/ops/workflow-usage.md +29 -0
- package/skills/qingflow-cli/reference/views_upsert_table_minimal.example.json +42 -7
- package/skills/qingflow-cli/scripts/validate_system_build_summary.py +124 -0
- package/skills/qingflow-cli/scripts/workflow/diff_flow_spec.py +275 -0
- package/skills/qingflow-cli/scripts/workflow/validate_flow_spec.py +627 -0
- package/src/qingflow_mcp/builder_facade/models.py +413 -119
- package/src/qingflow_mcp/builder_facade/service.py +4238 -666
- package/src/qingflow_mcp/cli/commands/builder.py +232 -75
- package/src/qingflow_mcp/cli/main.py +34 -0
- package/src/qingflow_mcp/public_surface.py +10 -0
- package/src/qingflow_mcp/server_app_builder.py +62 -34
- package/src/qingflow_mcp/solution/compiler/workflow_compiler.py +173 -0
- package/src/qingflow_mcp/solution/executor.py +2 -0
- package/src/qingflow_mcp/tools/ai_builder_tools.py +2649 -457
- package/src/qingflow_mcp/tools/record_tools.py +23 -11
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Qingflow CLI:删除记录 SOP
|
|
2
|
+
|
|
3
|
+
删除记录是高风险写操作,默认先定位、再确认目标、再最小删除。
|
|
4
|
+
|
|
5
|
+
## 主链路
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
qingflow --json record list --app-key <APP_KEY> --view-id <VIEW_ID> --query "<关键词>"
|
|
9
|
+
qingflow --json record get --app-key <APP_KEY> --record-id <RECORD_ID> --view-id <VIEW_ID>
|
|
10
|
+
qingflow --json record delete --app-key <APP_KEY> --record-id <RECORD_ID> --view-id system:all
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
批量删除用文件传 record ids:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
qingflow --json record delete --app-key <APP_KEY> --record-ids-file tmp/delete_record_ids.json --view-id system:all
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`tmp/delete_record_ids.json` 是记录 ID 数组:
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
["535734615263924225", "535734615263924226"]
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## 规则
|
|
26
|
+
|
|
27
|
+
1. 先用 `record list` 或 `record get` 解析精确 `record_id`,不要用模糊标题直接删。
|
|
28
|
+
2. 高风险或批量删除前,向用户确认记录数量、关键字段和应用名。
|
|
29
|
+
3. `record delete` 必须传可访问的系统 `--view-id system:*`;读取定位时可以使用 custom/system view,删除提交时不要传 `custom:*`、`list_type`,也不要省略系统视图上下文。
|
|
30
|
+
4. 删除后需要验证时,用 `record get` 或 `record list` 读回确认;读回 404/不存在才代表已删除,权限型 40002 只说明当前读回路径不可见。
|
|
31
|
+
5. 批量删除若出现部分成功,按返回的成功/失败项只处理失败 ID,不要重放全批。
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# 记录批量导入 SOP:`app_get`(`import_capability`)→ 模板 → 校验 →(可选)本地修复 → 启动 → 状态
|
|
2
|
+
|
|
3
|
+
本文与 **MCP 工具命名**一致,并映射到 **`qingflow` CLI**。编写前已 **实跑**:`app get`、`record schema import`、`import template`、`import verify`、`import repair`(未授权分支 + 授权分支遇 **合并单元格** 异常)、`import start`、`import status`(**仅** `--import-id`);环境为当前持久化 CLI 会话、应用 `ead8ims5i401`。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. 编排顺序(固定)
|
|
8
|
+
|
|
9
|
+
| 顺序 | 工具名 | CLI | 说明 |
|
|
10
|
+
|------|--------|-----|------|
|
|
11
|
+
| 1 | `app_get` | `qingflow --json app get --app-key <APP_KEY>` | 读 **`data.import_capability`**,预检是否有导入能力 |
|
|
12
|
+
| (可选) | `record_import_schema_get` | `qingflow --json record schema import --app-key <APP_KEY>` | `schema_scope: import_ready`,列 **`columns`**;能力仍以 **`app get`** 为准 |
|
|
13
|
+
| 2 | `record_import_template_get` | `qingflow [--json] import template --app-key <APP_KEY> [--download-to-path <PATH>]` | 官方模板 URL 或 **本地生成的 applicant 模板**(无数据管理权限或导入权限预检未知时可能 fallback) |
|
|
14
|
+
| 3 | `record_import_verify` | `qingflow [--json] import verify --app-key <APP_KEY> --file-path <*.xlsx\|*.xls>` | 产出 **`verification_id`**;**`can_import`** 为真后才应 **`import start`** |
|
|
15
|
+
| (可选) | `record_import_repair_local` | `qingflow [--json] import repair --verification-id <UUID> --authorized-file-modification …` | **必须** 显式授权;**仅 `.xlsx`**;可重复 **`--repair`** |
|
|
16
|
+
| 4 | `record_import_start` | `qingflow [--json] import start --app-key <APP_KEY> --verification-id <UUID> --being-enter-auditing <true\|false> [--view-key …]` | **会真实发起导入** |
|
|
17
|
+
| 5 | `record_import_status_get` | `qingflow [--json] import status (--app-key \| --import-id \| --process-id-str)` **三者择一** | **不要**同时传多个 selector(例如 **`--import-id` 与 `--app-key` 同时**会被 CLI 拒绝) |
|
|
18
|
+
|
|
19
|
+
CLI 注册见全局包 **`qingflow_mcp/cli/commands/imports.py`**(`template` / `verify` / `repair` / `start` / `status` → 上述 `ImportTools` 方法)。
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 2. `import_capability`(来自 `app get`)
|
|
24
|
+
|
|
25
|
+
`app get` 在 **`data.import_capability`** 中附带由 `baseInfo` 推导的能力(实现:**`_derive_import_capability`**):
|
|
26
|
+
|
|
27
|
+
| 字段 | 含义 |
|
|
28
|
+
|------|------|
|
|
29
|
+
| **`can_import`** | `true` / `false` / `null`(未知) |
|
|
30
|
+
| **`auth_source`** | `apply_auth`(申请人导入开关)、`data_manage_auth`(数据管理)、`none`、`unknown` |
|
|
31
|
+
| **`applicant_import_enabled`** | 与 `dataImportStatus` 对应 |
|
|
32
|
+
| **`data_manage_status`** | 与 `dataManageStatus` 对应 |
|
|
33
|
+
| **`runtime_checks_required`** | 预检后仍可能受 **`user_disabled`**、**`function_demoted`** 等运行态影响 |
|
|
34
|
+
| **`confidence`** | `preflight`(由元数据推出)或 `unknown` |
|
|
35
|
+
|
|
36
|
+
- **`record_import_schema_get` / `record_import_template_get` / `record_import_verify`**:若 `can_import === false` 且来源非 `unknown`,会直接 **`IMPORT_AUTH_PRECHECK_FAILED`**,不会继续读取导入列、官方模板或进入后端文件校验。
|
|
37
|
+
- **`record_import_template_get`**:当具备申请人导入能力但无数据管理权限时,可能对 **`/app/{appKey}/apply/excelTemplate`** 失败并 **本地生成** applicant 模板(警告 **`IMPORT_TEMPLATE_LOCAL_FALLBACK`**)。
|
|
38
|
+
- 若 **`app get` / `baseInfo`** 权限受限导致 **`import_capability.auth_source: unknown`**,但 applicant 字段 schema 可读,且官方模板接口返回 **40002 / 40027**,`record_import_template_get` 也可能返回 **`status: partial_success`** 并本地生成模板(警告 **`IMPORT_TEMPLATE_LOCAL_FALLBACK_AUTH_UNKNOWN`**)。这只说明“模板准备成功”,**不证明用户有导入权限**;后续仍以 **`record_import_verify` / `record_import_start`** 的 `can_import` 与最终结果为准。
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## 3. 本地校验仓与运行环境
|
|
43
|
+
|
|
44
|
+
- **`verification_id`** 由 **`record_import_verify`** 生成,并写入本机 **`~/.qingflow-mcp/import-verifications/<id>.json`**(**`ImportVerificationStore`**)。
|
|
45
|
+
- **`record_import_start` / `repair`** 依赖该目录;**自动化/CI 需允许写此目录**,且 **`verify` → `start` 须在** 同一 profile、可达后端的会话内完成。
|
|
46
|
+
- **`record_import_status_get`** 在仅传 **`--import-id`** 时,会结合本地 **`ImportJobStore`** 与后端 **`GET /app/apply/dataImport/record`** 解析 **`app_key` / `process_id_str`**;与 **`import start`** 返回的 **`import_id`**、**`process_id_str`** 对齐使用。
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## 4. 命令要点
|
|
51
|
+
|
|
52
|
+
### 4.0 文件形态、CSV 源数据与字段映射
|
|
53
|
+
|
|
54
|
+
- 当前 `import verify/start` 主链路面向官方 Excel 模板(`.xlsx` / `.xls`),不是直接把任意 CSV 交给后端。
|
|
55
|
+
- CSV 可以作为源数据或中间表,但必须先映射到官方模板列名,再写入模板副本;不要改模板表头。
|
|
56
|
+
- 字段映射以 `record schema import` / 模板列为准:源列名可以是用户习惯名,目标列名必须是官方模板 header。
|
|
57
|
+
- 关联字段批量导入优先使用稳定 `record_id` 或 schema 明确支持的唯一搜索值;显示名可能重复时不要猜。
|
|
58
|
+
- 成员/部门字段必须使用 schema/candidate 范围内的值;选项字段优先使用模板里的选项文案。
|
|
59
|
+
|
|
60
|
+
CSV 源数据示例(规划用):
|
|
61
|
+
|
|
62
|
+
```csv
|
|
63
|
+
客户名称,关联客户,状态,负责人
|
|
64
|
+
上海示例客户,CUST_RECORD_ID_001,有效,张三
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
映射到模板后的行语义:
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"客户名称": "上海示例客户",
|
|
72
|
+
"关联客户": "CUST_RECORD_ID_001",
|
|
73
|
+
"状态": "有效",
|
|
74
|
+
"负责人": "张三"
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 4.1 模板
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
qingflow --json import template --app-key "<APP_KEY>" \
|
|
82
|
+
--download-to-path tmp/qingflow_import_template.xlsx \
|
|
83
|
+
> tmp/qingflow_import_template_meta.json
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
- 关注 **`verification.template_source`**:`official` 或本地 fallback。
|
|
87
|
+
- 若 `verification.import_auth_prechecked: false`,表示模板来自 schema 可读分支但导入权限尚未预检成功;不要把该模板结果当作导入授权结论。
|
|
88
|
+
- **`expected_columns`** 在部分响应负荷中给出;**与校验**一致。
|
|
89
|
+
|
|
90
|
+
### 4.2 校验
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
qingflow --json import verify --app-key "<APP_KEY>" \
|
|
94
|
+
--file-path tmp/qingflow_import_template.xlsx \
|
|
95
|
+
> tmp/qingflow_import_verify.json
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
- 始终解析 **`verification_id`**;仅 **`can_import: true`** 时进入后端 multipart **`/upload/verification`**。
|
|
99
|
+
- **标准输出**上 OpenPyXL 可能对某些 xlsx 打出 **`UserWarning`**(**出现在 JSON 前**)。 jq/直解 **`json.load` 失败时,从首个 `{` 起截取再解析**。
|
|
100
|
+
|
|
101
|
+
### 4.3 本地修复(可选)
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
qingflow --json import repair \
|
|
105
|
+
--verification-id "<VERIFICATION_UUID>" \
|
|
106
|
+
--authorized-file-modification \
|
|
107
|
+
[--output-path tmp/repaired.xlsx] \
|
|
108
|
+
[--repair normalize_headers] [--repair trim_trailing_blank_rows] \
|
|
109
|
+
... \
|
|
110
|
+
> tmp/qingflow_import_repair.json
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
- **未加** `--authorized-file-modification` → **`IMPORT_REPAIR_NOT_AUTHORIZED`**。
|
|
114
|
+
- **`--repair`** 可重复;允许集合(实现 **`SAFE_REPAIRS`**):
|
|
115
|
+
**`normalize_headers`**、**`trim_trailing_blank_rows`**、**`normalize_enum_values`**、**`normalize_date_formats`**、**`normalize_number_formats`**、**`normalize_url_cells`**。
|
|
116
|
+
**省略 `--repair`** 时实现默认对 **全集** 尝试。
|
|
117
|
+
- **仅 `.xlsx`**;**合并单元格表格** 在 **`normalize_headers`** 等路径上可能触发 **`MergedCell` 只读** 类异常(实跑曾遇到);此时应改模板或跳过 repair、重新导出模板再 **`verify`**。
|
|
118
|
+
|
|
119
|
+
成功时返回 **`new_verification_id`**,后续 **`start`** 应用 **新 ID**(若 repair 后重新校验通过)。
|
|
120
|
+
|
|
121
|
+
### 4.4 启动导入
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
qingflow --json import start \
|
|
125
|
+
--app-key "<APP_KEY>" \
|
|
126
|
+
--verification-id "<VERIFICATION_UUID>" \
|
|
127
|
+
--being-enter-auditing false \
|
|
128
|
+
[--view-key "<VIEW_KEY>"] \
|
|
129
|
+
> tmp/qingflow_import_start.json
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
- **`--being-enter-auditing`**:**必填**,布尔字面量:`true` / `false` / `1` / `0` / `yes` / `no` 等(见 argparse `parse_bool_text`)。
|
|
133
|
+
- **会校验**:校验记录仍存在、**`can_import`**、**文件 sha256** 未变、**`schema_fingerprint`** 未变;否则 **`IMPORT_VERIFICATION_STALE`** / **`IMPORT_FILE_CHANGED_AFTER_VERIFY`** / **`IMPORT_SCHEMA_CHANGED_AFTER_VERIFY`**。
|
|
134
|
+
|
|
135
|
+
### 4.5 状态
|
|
136
|
+
|
|
137
|
+
**参数规则(CLI)**:**必须且只能** 提供 **`--app-key`**、**`--import-id`**、**`--process-id-str`** 中的 **一个**。
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
# 已知本次 start 返回的 import_id(不要同时加 --app-key)
|
|
141
|
+
qingflow --json import status --import-id "<IMPORT_UUID>" \
|
|
142
|
+
> tmp/qingflow_import_status.json
|
|
143
|
+
|
|
144
|
+
# 或只看该应用最近一次导入(仅 --app-key)
|
|
145
|
+
qingflow --json import status --app-key "<APP_KEY>" \
|
|
146
|
+
> tmp/qingflow_import_status_latest.json
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## 5. 与 `record schema import` 的关系
|
|
152
|
+
|
|
153
|
+
- **`record schema import`**:专注 **导入列 / 指纹**(与校验用的 schema bundle 一致思路),**不替代** **`app get` 的 `import_capability`**。
|
|
154
|
+
- 推荐顺序:**`app get`(能力)** →(可选)**`record schema import`(列清单)** → **`import template`** → …
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## 6. 实测摘要(编写时)
|
|
159
|
+
|
|
160
|
+
| 步骤 | 结果 |
|
|
161
|
+
|------|------|
|
|
162
|
+
| `app get` | `import_capability.can_import: true`,`auth_source: data_manage_auth` |
|
|
163
|
+
| `record schema import` | `schema_scope: import_ready` |
|
|
164
|
+
| `import template --download-to-path` | 落盘 xlsx 成功 |
|
|
165
|
+
| `import verify` | `can_import: true`,`verification_id` 可用;可能有 **`IMPORT_HEADERS_AUTO_NORMALIZED`** |
|
|
166
|
+
| `import repair --authorized-file-modification` | 特定模板因 **合并单元格** 在 **`normalize_headers`** 崩溃;属 **模板/实现边界** |
|
|
167
|
+
| `import start` | `status: accepted`,返回 **`import_id`**、**`process_id_str`** |
|
|
168
|
+
| `import status --import-id …` | 返回 `app_key`、**`process_id_str`**、**`status`**(后端枚举字符串,如实测 `"3"`) |
|
|
169
|
+
| `import status --import-id … --app-key …` | **CLI 拒绝**:只能选一个 selector |
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## 7. 交叉引用
|
|
174
|
+
|
|
175
|
+
- 主技能 [SKILL.md](../../SKILL.md):**落盘**、导入类权限码 **`IMPORT_*`** 提示。
|
|
176
|
+
- [QINGFLOW_CLI_ADMIN_CHEATSHEET.md](../core/QINGFLOW_CLI_ADMIN_CHEATSHEET.md):管理侧与 **`IMPORT_*`** 失败排查。
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# Qingflow CLI:更新记录工作流(详情后直接写入)
|
|
2
|
+
|
|
3
|
+
> **用途**:使用当前 CLI 会话读取目标记录详情后,用 **`record update`** 直接提交差异字段。主链路是 `record get -> record update`;字段范围不清、候选歧义或失败排查时,才追加 **`record schema update`**。
|
|
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)**。
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 习惯概念名 → CLI
|
|
9
|
+
|
|
10
|
+
| 概念名 | CLI |
|
|
11
|
+
| --- | --- |
|
|
12
|
+
| `app_get`(含 `accessible_views`) | `qingflow --json app get --app-key <APP_KEY>` |
|
|
13
|
+
| `record_schema_get`,`schema_mode=browse`,带 `view_id` | `qingflow --json record schema browse --app-key <APP_KEY> --view-id <VIEW_ID>` |
|
|
14
|
+
| `record_get` | `qingflow --json record get --app-key <APP_KEY> --record-id <RECORD_ID> [--view-id <VIEW_ID>]` |
|
|
15
|
+
| `record_update`(单条) | `qingflow --json record update --app-key <APP_KEY> --record-id <RECORD_ID> --fields-file <FIELDS.json> [--view-id <VIEW_ID>]` |
|
|
16
|
+
| `record_update`(批量) | `qingflow --json record update --app-key <APP_KEY> --items-file <ITEMS.json> [--view-id <VIEW_ID>] [--dry-run]`(见下文) |
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 推荐顺序
|
|
21
|
+
|
|
22
|
+
```text
|
|
23
|
+
record get(得到 RECORD_ID、当前值、fields[].title/field_id/kind;已知前端视图时带 view_id)
|
|
24
|
+
→ 智能体按用户要求组 fields key/value
|
|
25
|
+
→ record update --fields-file [--view-id](只提交需要改的题;大 JSON 落盘)
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**何时先 `app get` / `record list`**:不知道 `view_id` 或 `record_id` 时,先用 `app get` 选视图,再用 `record list` 定位候选。已知 `record_id` 但已知前端/custom view 时,直接 `record get --view-id <VIEW_ID>`。
|
|
29
|
+
**何时追加 `record schema browse`**:只在需要提前看视图表头或搜索字段时使用;`record get` 已经会返回单条详情所需字段信息。
|
|
30
|
+
**何时追加 `record schema update`**:该命令 **必须 `record_id`**,返回 **`writable_fields` / `payload_template` / `available_update_routes` / `recommended_update_route`**,只用于排查「能改什么」和「会走哪条更新路径」。已知前端/custom view 时同样带 `--view-id`,让诊断优先探测同一个详情页上下文;字段明确时不要把它当必经步骤。
|
|
31
|
+
|
|
32
|
+
**更新路径自动选择**:`record update --view-id <VIEW_ID>` 会优先用这个 view 做字段解析和 custom view 写入候选;未传时自动探测可读 route。写入时仍会先尝试 **数据管理员直改**,若后端返回权限拒绝,再 fallback 到 **前端同源 custom view 详情编辑路径**;如果当前用户存在这条记录的唯一待办且目标字段在当前节点可编辑,最后会尝试 **workflow save-only**。成功时响应中的 **`update_route`** 是最终成功路径;失败时再查看失败原因与路线诊断。若诊断里有 `40002`,只代表某条 route 被拒绝,不一定表示用户对记录完全无编辑能力。
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## 命令模板
|
|
37
|
+
|
|
38
|
+
**1)读取详情**
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
qingflow --json record get \
|
|
42
|
+
--app-key <APP_KEY> \
|
|
43
|
+
--record-id <RECORD_ID> \
|
|
44
|
+
--view-id <VIEW_ID> \
|
|
45
|
+
> tmp/qingflow_record_get.json
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
已知用户前端所在视图时传同一个 `--view-id`;未知时 CLI 默认先尝试 `system:all/type=8`,若该详情 route 被权限/不可见类错误拒绝,会继续尝试可访问视图。读取 `fields[]` 中的标题、`field_id`、`kind` 与当前值来组更新 payload。
|
|
49
|
+
|
|
50
|
+
`record_get` 的 `unavailable_context[]` 是辅助上下文提示:`detail_schema` / `audit_info` / 首屏日志等 40002 不等于记录详情读取失败。只要顶层 `status=ok` 且 `fields[]` 中已有目标字段,就按这些字段组 `record update` 的 key/value;只有顶层失败才按失败原因排查。
|
|
51
|
+
|
|
52
|
+
`record update` 的字段集合应是当前 `record get.fields[]` 的子集。带 `--view-id` 时,当前前端详情/视图隐藏的字段不要强写;字段不在 `fields[]` 中时,先切到包含该字段的视图/详情上下文,或用 `record schema update` 诊断可写字段和失败路径。`FIELD_NOT_FOUND` 通常表示当前更新上下文没有这个题,不等于整条记录不可编辑。
|
|
53
|
+
|
|
54
|
+
**2)如果缺 `record_id`,先定位候选**
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
qingflow --json record list \
|
|
58
|
+
--app-key <APP_KEY> \
|
|
59
|
+
--view-id <VIEW_ID> \
|
|
60
|
+
> tmp/qingflow_records.json
|
|
61
|
+
# 或
|
|
62
|
+
qingflow --json record get --app-key <APP_KEY> --record-id <RECORD_ID> \
|
|
63
|
+
> tmp/qingflow_record_get.json
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**3)单条更新**
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
qingflow --json record update \
|
|
70
|
+
--app-key <APP_KEY> \
|
|
71
|
+
--record-id <RECORD_ID> \
|
|
72
|
+
--fields-file tmp/qingflow_patch_fields.json \
|
|
73
|
+
--view-id <VIEW_ID> \
|
|
74
|
+
> tmp/qingflow_update_result.json
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
`--view-id` 可省略;已知用户来自某个 `custom:...` 前端详情页时建议传入,CLI 会优先尝试该 view,失败后再按自动路径 fallback。
|
|
78
|
+
|
|
79
|
+
**4)(仅排障)本条记录的更新诊断**
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
qingflow --json record schema update \
|
|
83
|
+
--app-key <APP_KEY> \
|
|
84
|
+
--record-id <RECORD_ID> \
|
|
85
|
+
--view-id <VIEW_ID> \
|
|
86
|
+
> tmp/qingflow_schema_update.json
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**`tmp/qingflow_patch_fields.json`**:JSON **对象**,键为 **题目标题**(优先来自 `record get.fields[]`),**只放需要修改的键**;值类型与 **新建** 相同(成员、部门、附件等见 **[QINGFLOW_CLI_RECORD_CREATE_WORKFLOW.md](./QINGFLOW_CLI_RECORD_CREATE_WORKFLOW.md)**)。实现要求 **`fields` 为「按标题索引的 map」**(与 `record insert` 一致)。
|
|
90
|
+
|
|
91
|
+
不要把 schema 中见过但当前 `record get.fields[]` 没出现的隐藏字段直接放进 `fields-file`。这会让智能体把视图上下文问题误判成权限或字段不存在问题。
|
|
92
|
+
|
|
93
|
+
**特殊字段值**:
|
|
94
|
+
|
|
95
|
+
- **成员字段 `kind=member`**:先传自然语言字符串,如 `{"客户成功":"周颖"}`。若返回 `status="needs_confirmation"`,说明尚未写入;从 `confirmation_requests[].candidates[]` 选一项,改传显式对象,如 `{"客户成功":{"uid":1048599,"name":"沈嘉慧Seth","email":"shenjiahui@exiao.tech"}}`。
|
|
96
|
+
- **部门字段 `kind=department`**:先传部门名,如 `{"负责部门":"客户成功部"}`;歧义时同样按候选对象/id 重试。
|
|
97
|
+
- **关联字段 `kind=relation`**:传唯一可解析的自然语言、或 `{"apply_id":"..."}`;多匹配时按候选记录重试,不要猜 `apply_id`。
|
|
98
|
+
- **选项字段 `kind=select`**:单选传一个选项字符串;多选传字符串数组。
|
|
99
|
+
- **引用/公式/自动填充/只读/系统字段**:不要强写目标字段;改写上游驱动字段,或把 blocker 原因反馈给用户。
|
|
100
|
+
|
|
101
|
+
`needs_confirmation` 的语义是 **`write_executed=false`,等待确认候选**;不要把它当成功,也不要把它当最终权限失败。只有用明确候选对象重试并成功后,才报告写入完成。
|
|
102
|
+
|
|
103
|
+
**`--verify-write` / `--no-verify-write`**:见 `qingflow record update -h`;默认倾向 **保留校验**。
|
|
104
|
+
|
|
105
|
+
更新后优先查看:
|
|
106
|
+
|
|
107
|
+
- **`update_route.route_type`**:`admin_direct`、`view_edit` 或 `task_save_only`。
|
|
108
|
+
- **`tried_routes[]`**:只在失败或 verbose 诊断时需要看;成功时不要把中间路径失败当最终结果。
|
|
109
|
+
- **`write_executed`**:是否已经发出写请求;为 `true` 时不要盲目整单重试。
|
|
110
|
+
- **`verification_status`**:读回校验是否通过。
|
|
111
|
+
|
|
112
|
+
**`record_id` 与写入(排查前置)**:若后端 **`record_id` 超出 JavaScript `Number.MAX_SAFE_INTEGER`(约为 `9007199254740991`)**:在旧 1.0.x 或同类实现分支上,**`record list` / `record get` / `record schema update` 常仍可正常**,而 **`record update` 的实际落库**可能在 **`apply_id` 二次校验**处失败——stdout 常表现为 **`apply_id must be positive`**,根本原因多为 **「整数超过 JS 安全范围」**。**批量 `--dry-run`** 仍可用于覆盖 **预检**流程。处理方式见 **「排查摘要」**末行。
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## 批量模式(`--items-file`)
|
|
117
|
+
|
|
118
|
+
- **不可**与 **`--record-id` / `--fields-file`** 同时使用。
|
|
119
|
+
- `items` 为 **数组**,每项为对象,至少包含:
|
|
120
|
+
- **`record_id`**:正整数(字符串或可解析数字均可,以 CLI 校验为准)
|
|
121
|
+
- **`fields`**:与单条相同的「标题 → 值」map
|
|
122
|
+
|
|
123
|
+
示例:
|
|
124
|
+
|
|
125
|
+
```json
|
|
126
|
+
[
|
|
127
|
+
{ "record_id": "518257794791628802", "fields": { "客户名称": "新名称" } },
|
|
128
|
+
{ "record_id": "518257794791628803", "fields": { "备注": "批量第 2 条" } }
|
|
129
|
+
]
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
- **`--dry-run`**:**仅批量模式**支持(单条模式需走 `items-file` 才能 dry-run);用于预检。详见 `qingflow record update -h` 与 CLI 报错指引。
|
|
133
|
+
- 批量输出优先读顶层语义,不需要再钻进 `data.summary`:
|
|
134
|
+
- `mode="batch"`、`dry_run`
|
|
135
|
+
- `total`、`succeeded`、`failed`、`needs_confirmation`
|
|
136
|
+
- `updated_record_ids`
|
|
137
|
+
- `write_executed`、`safe_to_retry`、`verification_status`
|
|
138
|
+
- `items[].row_number / record_id / status / failed_fields / confirmation_requests`
|
|
139
|
+
- `dry_run=true` 时 `write_executed=false`、`safe_to_retry=true`,只能说明预检通过;真正写入仍需去掉 `--dry-run` 再执行。
|
|
140
|
+
- `write_executed=true` 后不要盲目整批重试;根据 `items[].row_number` 和 `updated_record_ids` 判断是否只补失败行。
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## 安全与落盘
|
|
145
|
+
|
|
146
|
+
- **`record update` 为写操作**;仅在授权环境、**必要时**对测试应用演练。
|
|
147
|
+
- **`list` / `get` / `schema browse` / `schema update` / 更新结果** 体大量时按主技能 **落盘规则** 重定向。
|
|
148
|
+
- 主技能 **危险操作** 中对 `record update --dry-run`(批量)的说明仍适用。
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## 排查摘要
|
|
153
|
+
|
|
154
|
+
| 现象 | 处理 |
|
|
155
|
+
| --- | --- |
|
|
156
|
+
| 缺 `record_id` | 先用 **`record list`**(同一 `view_id`)或 **`record get`**。 |
|
|
157
|
+
| 不知道字段标题或当前值 | 先查 **`record get`** 的 `fields[]`。 |
|
|
158
|
+
| 不知道能改哪些题 / 路径失败 | 再查 **`record schema update`** 的 `writable_fields` / `payload_template` / 路径诊断;它不是主链路前置步骤。 |
|
|
159
|
+
| 配置类报错 | 单条更新必须 **`--record-id` + `--fields-file`**;批量必须 **`--items-file`**,且勿混用单条参数。 |
|
|
160
|
+
| `needs_confirmation` | 尚未写入;从 `confirmation_requests[].candidates[]` 选明确对象/id 后重试,再读回确认。 |
|
|
161
|
+
| `40002` | 先看 **`tried_routes`**:如果 `admin_direct` 拒绝但 `view_edit` 或 `task_save_only` 成功,说明某条具体通道不可用但仍有可写路径;如果所有 route 都拒绝,再按权限问题处理。 |
|
|
162
|
+
| 成员/部门格式错误 | 与 **创建记录** 文档同一套结构;必要时用 **`record member-candidates` / `record department-candidates`** 走字段候选范围。不要改用 `builder member search` 做记录字段候选。 |
|
|
163
|
+
| **`apply_id must be positive`**,或内部报错含 **`exceeds JavaScript's safe integer range`**(单条 **`record update`** 或批量 **非 dry-run**) | **`record_id` 典型超出 JavaScript 安全整数上限**(`Number.MAX_SAFE_INTEGER`,约为 `9007199254740991`):读链路与 **`schema update`、批量 `--dry-run`** 可走通;**写入**须在 **新版本 CLI** 重做或向维护方确认。短期仅用 **更小 id 的授权测试应用/记录**演练。 |
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
*维护:复核 `qingflow record schema update -h`、`record update -h`;`view_id` 与成员策略以当前 CLI help 与同目录成员速查表为准。*
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# Qingflow CLI Record Analysis
|
|
2
|
+
|
|
3
|
+
Use this section for final statistical conclusions: counts, distributions, ratios, averages, rankings, trends, comparisons, and analysis reports.
|
|
4
|
+
|
|
5
|
+
Default path, every time:
|
|
6
|
+
|
|
7
|
+
```text
|
|
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
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
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:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
qingflow record access \
|
|
81
|
+
--app-key APP_KEY \
|
|
82
|
+
--view-id system:all \
|
|
83
|
+
--columns-file columns.json \
|
|
84
|
+
--where-file where.json \
|
|
85
|
+
--order-by-file order_by.json \
|
|
86
|
+
--json
|
|
87
|
+
```
|
|
88
|
+
|
|
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.
|
|
115
|
+
|
|
116
|
+
## References
|
|
117
|
+
|
|
118
|
+
Load only what is needed:
|
|
119
|
+
|
|
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)
|
|
127
|
+
|
|
128
|
+
## Feedback Escalation
|
|
129
|
+
|
|
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`.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Analysis Gotchas
|
|
2
|
+
|
|
3
|
+
## Do Not Skip Schema
|
|
4
|
+
|
|
5
|
+
Correct path:
|
|
6
|
+
|
|
7
|
+
1. `app_get`
|
|
8
|
+
2. `record_browse_schema_get`
|
|
9
|
+
3. `record_access`
|
|
10
|
+
4. Python
|
|
11
|
+
|
|
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
|
+
|
|
14
|
+
## Do Not Use Export For Analysis
|
|
15
|
+
|
|
16
|
+
Export tools are for user-requested files. Analysis uses `record_access` because it returns structured completeness and compact field metadata.
|
|
17
|
+
|
|
18
|
+
## Do Not Treat `record_list` As Full Data
|
|
19
|
+
|
|
20
|
+
`record_list` is sample/browse only. It can be capped and should not justify:
|
|
21
|
+
|
|
22
|
+
- average
|
|
23
|
+
- share
|
|
24
|
+
- ranking
|
|
25
|
+
- trend
|
|
26
|
+
- regional distribution
|
|
27
|
+
- "all data" insights
|
|
28
|
+
|
|
29
|
+
## Do Not Control Paging
|
|
30
|
+
|
|
31
|
+
`record_access` owns paging internally.
|
|
32
|
+
|
|
33
|
+
Do not invent:
|
|
34
|
+
|
|
35
|
+
- `page`
|
|
36
|
+
- `page_size`
|
|
37
|
+
- `limit`
|
|
38
|
+
- `requested_pages`
|
|
39
|
+
- `scan_max_pages`
|
|
40
|
+
- `max_rows`
|
|
41
|
+
- `timeout`
|
|
42
|
+
|
|
43
|
+
## Do Not Print Raw CSV
|
|
44
|
+
|
|
45
|
+
Read CSV files with pandas. Summarize computed results, not raw rows.
|
|
46
|
+
|
|
47
|
+
## Do Not Rename Source Files
|
|
48
|
+
|
|
49
|
+
CSV columns are directly readable and field-id anchored: `record_id`, `<字段标题>__field_<id>`. Use those columns directly in pandas.
|
|
50
|
+
|
|
51
|
+
## Do Not Trust Sparse Dimensions
|
|
52
|
+
|
|
53
|
+
Before final grouping, run a field-quality profile. If the selected field is mostly blank, say so and downgrade the claim.
|
|
54
|
+
|
|
55
|
+
Rules of thumb:
|
|
56
|
+
|
|
57
|
+
- Overall blank rate above 40%: not a primary conclusion dimension.
|
|
58
|
+
- Any compared period blank rate above 80%: do not use that field for period comparison.
|
|
59
|
+
- A sparse field can support only `已填写样本观察`.
|
|
60
|
+
|
|
61
|
+
If the user asks for a semantic field such as `板块`, test nearby candidates like product, platform, module, stage, source, owner, or department before concluding.
|
|
62
|
+
|
|
63
|
+
## Do Not Hide Incomplete Access
|
|
64
|
+
|
|
65
|
+
If `needs_scope`, no CSV exists. Ask for a time/business scope.
|
|
66
|
+
|
|
67
|
+
If `partial`, use only subset wording and avoid full-population claims.
|
|
68
|
+
|
|
69
|
+
If field meaning is ambiguous, ask the user to confirm from a short list.
|
|
70
|
+
|
|
71
|
+
## Do Not Guess Metrics
|
|
72
|
+
|
|
73
|
+
Before fetching data, decide whether the request needs count, sum, average, distinct count, ratio, ranking, trend, or comparison.
|
|
74
|
+
|
|
75
|
+
## Do Not Call A Ratio Without Denominator
|
|
76
|
+
|
|
77
|
+
For penetration, conversion, or share:
|
|
78
|
+
|
|
79
|
+
1. define numerator
|
|
80
|
+
2. define denominator
|
|
81
|
+
3. query compatible source data
|
|
82
|
+
4. compute in Python
|
|
83
|
+
5. report numerator and denominator
|
|
84
|
+
|
|
85
|
+
## Normalize Relative Dates
|
|
86
|
+
|
|
87
|
+
Convert relative phrases into exact ranges before `record_access`.
|
|
88
|
+
|
|
89
|
+
- `今年5月` -> exact May 1 to May 31 in the current year
|
|
90
|
+
- `去年同期` -> same date range in previous year
|
|
91
|
+
- `最近30天` -> exact rolling start/end dates
|