@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.
Files changed (103) hide show
  1. package/README.md +2 -2
  2. package/docs/local-agent-install.md +10 -0
  3. package/package.json +1 -1
  4. package/pyproject.toml +1 -1
  5. package/skills/qingflow-cli/SKILL.md +61 -47
  6. package/skills/qingflow-cli/manifest.yaml +1 -1
  7. package/skills/qingflow-cli/reference/00-INDEX.md +35 -0
  8. package/skills/qingflow-cli/reference/QINGFLOW_CLI_BUILDER_APP_DELIVERY_WORKFLOW.md +21 -477
  9. package/skills/qingflow-cli/reference/QINGFLOW_CLI_BUILDER_VIEWS_WORKFLOW.md +44 -290
  10. package/skills/qingflow-cli/reference/QINGFLOW_CLI_SCHEMA_APPLY_FIELD_TYPES_AND_SCENARIOS.md +11 -102
  11. package/skills/qingflow-cli/reference/builder/10-build-single-app.md +57 -0
  12. package/skills/qingflow-cli/reference/builder/20-build-complete-system.md +84 -0
  13. package/skills/qingflow-cli/reference/builder/30-schema-fields.md +317 -0
  14. package/skills/qingflow-cli/reference/builder/40-layout.md +70 -0
  15. package/skills/qingflow-cli/reference/builder/50-views.md +540 -0
  16. package/skills/qingflow-cli/reference/builder/60-charts.md +328 -0
  17. package/skills/qingflow-cli/reference/builder/70-portal.md +372 -0
  18. package/skills/qingflow-cli/reference/builder/80-buttons-associated-resources.md +148 -0
  19. package/skills/qingflow-cli/reference/builder/90-workflow.md +35 -0
  20. package/skills/qingflow-cli/reference/builder/99-publish-verify.md +64 -0
  21. package/skills/qingflow-cli/reference/builder/README.md +62 -0
  22. package/skills/qingflow-cli/reference/builder/code-integrations/README.md +130 -0
  23. package/skills/qingflow-cli/reference/builder/code-integrations/code-block.md +66 -0
  24. package/skills/qingflow-cli/reference/builder/code-integrations/q-linker.md +77 -0
  25. package/skills/qingflow-cli/reference/builder/reference/app-delivery-sop.md +508 -0
  26. package/skills/qingflow-cli/reference/builder/reference/match-rules.md +229 -0
  27. package/skills/qingflow-cli/reference/builder/reference/workspace-icons.md +89 -0
  28. package/skills/qingflow-cli/reference/builder/workflow/01-overview.md +48 -0
  29. package/skills/qingflow-cli/reference/builder/workflow/02-update-mode.md +63 -0
  30. package/skills/qingflow-cli/reference/builder/workflow/03-flow-patterns.md +59 -0
  31. package/skills/qingflow-cli/reference/builder/workflow/04-stage1-business-modeling.md +131 -0
  32. package/skills/qingflow-cli/reference/builder/workflow/05-stage2-members-roles.md +29 -0
  33. package/skills/qingflow-cli/reference/builder/workflow/06-stage3-build-spec.md +211 -0
  34. package/skills/qingflow-cli/reference/builder/workflow/07-stage4-validate-spec.md +36 -0
  35. package/skills/qingflow-cli/reference/builder/workflow/08-stage5-apply-verify.md +66 -0
  36. package/skills/qingflow-cli/reference/builder/workflow/09-stage6-summary.md +88 -0
  37. package/skills/qingflow-cli/reference/builder/workflow/10-node-config-reference.md +93 -0
  38. package/skills/qingflow-cli/reference/builder/workflow/11-troubleshooting.md +18 -0
  39. package/skills/qingflow-cli/reference/builder/workflow/README.md +88 -0
  40. package/skills/qingflow-cli/reference/builder/workflow/workflow-schema.json +1754 -0
  41. package/skills/qingflow-cli/reference/charts_upsert_dashboard_starter.example.json +81 -0
  42. package/skills/qingflow-cli/reference/core/QINGFLOW_CLI_ADMIN_CHEATSHEET.md +94 -0
  43. package/skills/qingflow-cli/reference/core/QINGFLOW_CLI_DATA_RETRIEVAL_WORKFLOW.md +139 -0
  44. package/skills/qingflow-cli/reference/core/QINGFLOW_CLI_EXPLORATION_REPORT.md +84 -0
  45. package/skills/qingflow-cli/reference/core/QINGFLOW_CLI_FIELD_DATA_TYPES.md +129 -0
  46. package/skills/qingflow-cli/reference/core/QINGFLOW_CLI_MEMBER_CHEATSHEET.md +195 -0
  47. package/skills/qingflow-cli/reference/core/QINGFLOW_CLI_ONE_SHOT_CHEATSHEET.md +159 -0
  48. package/skills/qingflow-cli/reference/examples/README.md +17 -0
  49. package/skills/qingflow-cli/reference/examples/associated/associated_resources_semantic_full.example.json +50 -0
  50. package/skills/qingflow-cli/reference/examples/buttons/custom_buttons_advanced.example.json +56 -0
  51. package/skills/qingflow-cli/reference/examples/charts/charts_remove.example.json +1 -0
  52. package/skills/qingflow-cli/reference/examples/charts/charts_reorder.example.json +1 -0
  53. package/skills/qingflow-cli/reference/examples/charts/charts_upsert_bar.example.json +8 -0
  54. package/skills/qingflow-cli/reference/examples/charts/charts_upsert_dashboard_starter.example.json +118 -0
  55. package/skills/qingflow-cli/reference/examples/charts/charts_upsert_minimal.example.json +13 -0
  56. package/skills/qingflow-cli/reference/examples/layout/layout_sections_full.example.json +22 -0
  57. package/skills/qingflow-cli/reference/examples/portal/portal_sections_all_types.example.json +145 -0
  58. package/skills/qingflow-cli/reference/examples/portal/portal_sections_five_types.example.json +126 -0
  59. package/skills/qingflow-cli/reference/examples/portal/portal_sections_standard_workbench.example.json +178 -0
  60. package/skills/qingflow-cli/reference/examples/record/record_insert_all_field_types.example.json +35 -0
  61. package/skills/qingflow-cli/reference/examples/schema/_batch_schema_complex.json +18 -0
  62. package/skills/qingflow-cli/reference/examples/schema/_batch_schema_scalar.json +17 -0
  63. package/skills/qingflow-cli/reference/examples/schema/schema_add_fields_minimal.example.json +7 -0
  64. package/skills/qingflow-cli/reference/examples/schema/schema_apply_add_fields_all_types.json +78 -0
  65. package/skills/qingflow-cli/reference/examples/schema/schema_multi_app_form_relation_layout.example.json +166 -0
  66. package/skills/qingflow-cli/reference/examples/schema/schema_single_app_form_standard.example.json +95 -0
  67. package/skills/qingflow-cli/reference/examples/views/views_batch_full.example.json +159 -0
  68. package/skills/qingflow-cli/reference/examples/views/views_upsert_table_minimal.example.json +42 -0
  69. package/skills/qingflow-cli/reference/portal_sections_all_types.example.json +18 -4
  70. package/skills/qingflow-cli/reference/portal_sections_five_types.example.json +3 -3
  71. package/skills/qingflow-cli/reference/portal_sections_standard_workbench.example.json +57 -7
  72. package/skills/qingflow-cli/reference/record/QINGFLOW_CLI_RECORD_CREATE_WORKFLOW.md +22 -0
  73. package/skills/qingflow-cli/reference/record/QINGFLOW_CLI_RECORD_DELETE_WORKFLOW.md +31 -0
  74. package/skills/qingflow-cli/reference/record/QINGFLOW_CLI_RECORD_IMPORT_WORKFLOW.md +176 -0
  75. package/skills/qingflow-cli/reference/record/QINGFLOW_CLI_RECORD_UPDATE_WORKFLOW.md +167 -0
  76. package/skills/qingflow-cli/reference/record/analysis/README.md +130 -0
  77. package/skills/qingflow-cli/reference/record/analysis/analysis-gotchas.md +91 -0
  78. package/skills/qingflow-cli/reference/record/analysis/analysis-patterns.md +112 -0
  79. package/skills/qingflow-cli/reference/record/analysis/business-context.md +74 -0
  80. package/skills/qingflow-cli/reference/record/analysis/confidence-reporting.md +69 -0
  81. package/skills/qingflow-cli/reference/record/analysis/data-access-playbook.md +106 -0
  82. package/skills/qingflow-cli/reference/record/analysis/pandas-recipes.md +172 -0
  83. package/skills/qingflow-cli/reference/record/analysis/report-format.md +76 -0
  84. package/skills/qingflow-cli/reference/record/insert/README.md +125 -0
  85. package/skills/qingflow-cli/reference/schema_apply_add_fields_all_types.json +1 -1
  86. package/skills/qingflow-cli/reference/task/QINGFLOW_CLI_TASK_CONTEXT_WORKFLOW.md +153 -0
  87. package/skills/qingflow-cli/reference/task/ops/README.md +134 -0
  88. package/skills/qingflow-cli/reference/task/ops/environments.md +43 -0
  89. package/skills/qingflow-cli/reference/task/ops/workflow-usage.md +29 -0
  90. package/skills/qingflow-cli/reference/views_upsert_table_minimal.example.json +42 -7
  91. package/skills/qingflow-cli/scripts/validate_system_build_summary.py +124 -0
  92. package/skills/qingflow-cli/scripts/workflow/diff_flow_spec.py +275 -0
  93. package/skills/qingflow-cli/scripts/workflow/validate_flow_spec.py +627 -0
  94. package/src/qingflow_mcp/builder_facade/models.py +413 -119
  95. package/src/qingflow_mcp/builder_facade/service.py +4238 -666
  96. package/src/qingflow_mcp/cli/commands/builder.py +232 -75
  97. package/src/qingflow_mcp/cli/main.py +34 -0
  98. package/src/qingflow_mcp/public_surface.py +10 -0
  99. package/src/qingflow_mcp/server_app_builder.py +62 -34
  100. package/src/qingflow_mcp/solution/compiler/workflow_compiler.py +173 -0
  101. package/src/qingflow_mcp/solution/executor.py +2 -0
  102. package/src/qingflow_mcp/tools/ai_builder_tools.py +2649 -457
  103. package/src/qingflow_mcp/tools/record_tools.py +23 -11
@@ -0,0 +1,125 @@
1
+ # Qingflow CLI Record Insert
2
+
3
+ ## Default Path
4
+
5
+ `record schema insert -> record insert --items-file -> optional record get/readback`
6
+
7
+ Default to batch-shaped insert. A single new record is `items` with one row.
8
+
9
+ ## Core Tools
10
+
11
+ - `qingflow record schema insert`
12
+ - `qingflow record insert --items-file`
13
+ - `qingflow record member-candidates`
14
+ - `qingflow record department-candidates`
15
+ - file upload command when attachments are required
16
+
17
+ ## Working Rules
18
+
19
+ 1. Start with `record schema insert`
20
+ 2. Read `required_fields`, `optional_fields`, `runtime_linked_required_fields`, and `payload_template`
21
+ 3. Inside every field bucket, read field-level `linkage` first when present; it is the canonical static hint for linked visibility, reference-driven auto fill, or formula-driven fields
22
+ 4. Inside `optional_fields`, pay special attention to any field with `may_become_required=true`; these are writable fields that can become required when linked visibility or option-driven rules activate
23
+ 5. Build `items` as `[{"fields": {...}}]`, where each `fields` map uses field titles from the insert schema
24
+ 6. Treat `runtime_linked_required_fields` as required-but-not-directly-writable runtime/upstream dependencies, not as fields to hand-fill blindly
25
+ 7. For `linkage.kind=logic_visibility`, read `sources` as upstream trigger fields and treat `role=manual_input_after_activation` as "fill this only after the upstream condition is satisfied"
26
+ 8. For `linkage.kind=reference_fill`, prefer filling the source field first; treat target fields with `role=auto_fill_preferred` or `auto_fill_only` as reference-driven outputs rather than blind manual inputs
27
+ 9. For `linkage.kind=formula_fill`, treat the field as formula/default-auto-fill driven unless the user explicitly asks to override it and the field is still writable
28
+ 10. If insert succeeds and single-record detail/readback matters, prefer `record get`; use `record list` only for batch row-shaped normalized readback
29
+ 11. Keep subtable payloads under the parent field as a row array
30
+ 12. Member / department / relation fields may accept natural strings directly, such as `"张三"`, `"直销部"`, or `"海军军医大学"`; do not pre-query ids by default
31
+ 13. If the write returns `status="needs_confirmation"`, stop and surface the candidates
32
+ 14. Retry failed rows only with explicit ids / objects after the user confirms
33
+ 15. Keep `verify_write=true` for production inserts
34
+ 16. If post-write detail context matters, read `record get` fields, `media_assets.items[].local_path`, `file_assets.items[].local_path`, `file_assets.items[].extraction.text_path`, and `semantic_context`; `record get` follows the frontend storage cookie redirect path for Qingflow attachments, so prefer local paths over remote URLs and do not expect legacy `data.normalized_record`
35
+ 17. Treat nested schema shape as guidance, not a brittle contract; do not hard-code transient implementation details like optional nested `field_id` shape when composing inserts
36
+ 18. For `partial_success`, read `created_record_ids`, then repair only the failed `items[].row_number` using `failed_fields`; never retry the whole batch after any row has `write_executed=true`
37
+ 19. For numeric / amount-like fields, follow insert schema `expected_format` and `example_value`, not the builder field name alone. If the schema or error says decimals are not allowed, retry only the failed row with an integer value.
38
+
39
+ ## Field Value Quick Table
40
+
41
+ Use this table after reading `record schema insert`. Field titles, options, candidates, and requiredness always come from the schema of the target app.
42
+
43
+ | Field kind | Write value | Notes |
44
+ | --- | --- | --- |
45
+ | Text / long text | JSON string | Use exact field title as key. Do not write system fields such as `编号` or `创建时间`. |
46
+ | Number / amount / score / rate | JSON number | Follow `expected_format`, `example_value`, and `allow_decimal`; if decimals are rejected, retry failed rows only with integers. |
47
+ | Date | `YYYY-MM-DD` | Use schema format if it differs. |
48
+ | Datetime | `YYYY-MM-DD HH:mm:ss` | Keep timezone/business date consistent with the user's request. |
49
+ | Single select | Exact option text or option id | Option text must exist in schema `options`; do not invent synonyms such as `月检` when the option is `每月`. |
50
+ | Multi select | Array of exact option texts or ids | Example: `["重点", "续约"]`. |
51
+ | Boolean / yes-no | Schema-supported boolean value | Prefer the schema example; some apps use option-like text. |
52
+ | Member | Natural name first, candidate object/id only after `needs_confirmation` | Example: `"张三"`. Do not pre-query admin contacts by default. |
53
+ | Department | Natural department name first, candidate object/id only after `needs_confirmation` | Example: `"销售部"`. Do not use ContactAuth/admin department tree as fallback. |
54
+ | Relation / reference record | Real `record_id/apply_id` for batch-created upstream rows; natural name only when unique | In full systems, insert upstream master data first, then use returned ids for downstream rows. |
55
+ | Subtable | Parent field value is an array of row objects | Keep subtable leaf fields inside the parent array; do not flatten subfields to top level. |
56
+ | Attachment | Upload first, then write returned attachment value/object | Do not write a local path directly unless the upload command returned that shape. |
57
+ | Formula / reference-fill / auto-fill | Fill the source/driver field, not the auto-filled target | Override only if schema says writable and user explicitly asks. |
58
+
59
+ ## Copyable Shape Example
60
+
61
+ This file shape is the default for both one row and many rows. Replace field titles, option texts, record ids, and attachment values with values from `record schema insert`.
62
+
63
+ ```json
64
+ [
65
+ {
66
+ "fields": {
67
+ "客户名称": "上海样例客户",
68
+ "客户状态": "有效",
69
+ "客户标签": ["重点", "续约"],
70
+ "预计金额": 12000,
71
+ "预计签约日期": "2026-07-15",
72
+ "负责人": "张三",
73
+ "所属部门": "销售部",
74
+ "关联客户": "540000000000000001",
75
+ "明细子表": [
76
+ {"明细名称": "首批巡检", "数量": 2, "结果": "正常"}
77
+ ],
78
+ "备注": "由 CLI 样例创建"
79
+ }
80
+ }
81
+ ]
82
+ ```
83
+
84
+ Full shape example: [record_insert_all_field_types.example.json](../../examples/record/record_insert_all_field_types.example.json).
85
+
86
+ ## Field Notes
87
+
88
+ - `searchable_fields` on relation fields defines the backend-native searchable columns
89
+ - `accepts_natural_input=true` means the field may accept a natural string before explicit id fallback
90
+ - `may_become_required=true` means the field is writable now, but may turn required after linked visibility or option rules activate
91
+ - `linkage.kind=logic_visibility` means the field is statically tied to linked visibility or option-driven rules
92
+ - `linkage.kind=reference_fill` means the field participates in reference-based auto fill or default matching logic
93
+ - `linkage.kind=formula_fill` means the field usually comes from formula/default auto-fill logic
94
+ - `linkage.sources` lists the upstream field titles that influence the current field
95
+ - `linkage.affects_fields` lists downstream field titles that may change when this field changes
96
+ - `linkage.role=auto_fill_only` means "normally do not hand-fill this unless the product explicitly requires it"
97
+ - `requires_upload=true` means upload the file first, then write the returned value
98
+ - `failed_fields[].next_action` tells the next repair step for that row
99
+ - `allow_decimal=false` or errors like `requires an integer amount` mean the current write path wants an integer even if the business label says hours, rate, or score
100
+
101
+ ## CLI Pattern
102
+
103
+ Use a JSON array file:
104
+
105
+ ```bash
106
+ qingflow record insert --app-key APP_KEY --items-file records.json --json
107
+ ```
108
+
109
+ `records.json`:
110
+
111
+ ```json
112
+ [
113
+ { "fields": { "客户名称": "测试客户", "负责人": "张三" } }
114
+ ]
115
+ ```
116
+
117
+ ## Do Not
118
+
119
+ - Do not skip `record schema insert`
120
+ - Do not invent missing required fields
121
+ - Do not flatten subtable leaf fields to the top level
122
+ - Do not pre-query or silently guess member / department / relation ids when a natural string is enough
123
+ - Do not retry a whole batch after `created_record_ids` is non-empty
124
+ - Do not bind logic to a transient nested schema serialization detail when the field title and parent table already identify the legal payload shape
125
+ - Do not infer decimal support from the field label or builder type; the insert schema is the write contract
@@ -3,7 +3,7 @@
3
3
  "name": "QFCLI_AT_text",
4
4
  "type": "text",
5
5
  "as_data_title": true,
6
- "description": "【本文件用法】推荐一次成功:npx @qingflow-tech/qingflow-cli --profile default builder schema apply --package-id <你的包tag_id> --app-name \"新应用名\" --create-if-missing --no-publish --add-fields-file schema_apply_add_fields_all_types.json。内含19种搭建 type(另含远程查询/代码块所需辅助 text),且已在本字段标记 as_data_title。关联字段 target_app_key 默认为本仓库实测用的模板应用 ead8ims5i401(须含「单行文字」「多行文字」);其它租户请改成你方可读的目标应用 app_key。若用 --app-key 向已有应用追加:须无「关联」字段且字段名不重复;每应用仅允许一个 relation。"
6
+ "description": "【本文件用法】字段能力覆盖探针,不是正式新建应用主模板。正式新建应用优先使用 form;完整系统优先使用 examples/schema/schema_multi_app_form_relation_layout.example.json。此文件用于测试 19 种搭建 type(另含远程查询/代码块所需辅助 text),关联字段 target_app_key 默认为本仓库实测模板应用 ead8ims5i401;其它租户请改成你方可读的目标应用 app_key。"
7
7
  },
8
8
  {"name": "QFCLI_AT_long_text", "type": "long_text"},
9
9
  {"name": "QFCLI_AT_number", "type": "number"},
@@ -0,0 +1,153 @@
1
+ # 任务上下文 SOP:待办列表 → 详情 → 审批历史 → 关联报表 → 执行动作
2
+
3
+ 本文与 **MCP / 服务端公开工具命名**对齐,并给出已安装的 `**qingflow` CLI** 等价命令。编写前已在当前环境对 `**task list` / `task get` / `task log`** 实跑;`**task report`** 在抽样任务上遇到过后端 `**40038` Object not exist**(见文末「实测排障」),属数据/权限/报表生命周期问题,**不否定**标准编排顺序。
4
+
5
+ **必须落盘**:`task` 的 `list`、`get`、`log`、`report` 以及 `**task action` 的响应**若体积大,均应 `> tmp/qingflow_*.json`,与主技能 [SKILL.md](../../SKILL.md) 一致。
6
+
7
+ **输出解包**:`task list/get/log/report` 的主数据通常在 `data` 下,不要求有顶层 `status`。没有顶层 `status` 不代表失败;先检查是否有错误字段,再按 `task list -> data.items[]`、`task get -> data.task / data.available_actions`、`task log -> data.items[]`、`task report -> data` 解包。
8
+
9
+ ---
10
+
11
+ ## 1. 编排顺序(固定)
12
+
13
+
14
+ | 步骤 | 工具名(文档/编排常用) | CLI 子命令 | 说明 |
15
+ | --- | ----------------------------------- | ------------------------------- | ----------------------------------------------------------------------------- |
16
+ | 1 | `task_list` | `qingflow [--json] task list` | `--task-box todo` 为待办(可省略则默认 todo) |
17
+ | 2 | `task_get` | `qingflow [--json] task get` | **优先** `--task-id`;从响应中取动作能力、关联报表摘要 |
18
+ | 3 | `task_workflow_log_get` | `qingflow [--json] task log` | 当前任务上下文的流程/审批历史条目(与详情独立接口,勿与 `extras.workflow_log` 混为一谈;记录级全量日志用 `record logs`) |
19
+ | 4 | `task_associated_report_detail_get` | `qingflow [--json] task report` | **必须** `--report-id`;ID 来自 **步骤 2** 的关联报表列表 |
20
+ | 5 | `task_action_execute` | `qingflow [--json] task action` | **无 `--dry-run`**;调用即生效,`**--action` 须落在 `task get` 的 `available_actions` 内** |
21
+
22
+
23
+ 实现侧 CLI 将上述工具映射到 `qingflow_mcp` 的 `TaskContextTools`(`task` 子命令源码:`task list/get/log/report/action` → `task_list`、`task_get`、`task_workflow_log_get`、`task_associated_report_detail_get`、`task_action_execute`)。
24
+
25
+ ---
26
+
27
+ ## 2. 定位方式
28
+
29
+ - **唯一默认路径**:全程使用列表里拿到的 `**task_id`**(字符串十进制;与大雪花 ID 一致时保持 **引号 / JSON 字符串** 习惯,避免其它子系统精度问题)。`task_id` 必须来自 `task_list.data.items[].task_id`,不是列表序号、record_id 或 workflow_node_id。
30
+ - `task_action_execute` / `task action` **只使用 `task_id` 定位**。不要传 `app_key`、`record_id`、`workflow_node_id`,也不要从其它输出里自行拼三键。
31
+ - `task get` / `task log` / `task report` 的底层读接口仍可能保留完整 locator 作为兼容排障能力;主链路不使用。
32
+
33
+ ---
34
+
35
+ ## 3. 步骤说明与命令模板
36
+
37
+ ### 3.1 `task_list`(`task list`)
38
+
39
+ ```bash
40
+ qingflow --json task list \
41
+ --task-box todo \
42
+ --flow-status all \
43
+ --page 1 \
44
+ --page-size 50 \
45
+ > tmp/qingflow_tasks_todo.json
46
+ ```
47
+
48
+ - `**--task-box**`:`todo`(待办)、`done`(已办)、`cc`(抄送)、`initiated`(我发起)等;与 `**--flow-status**`(箱内流程状态)为 **两个独立维度**,可同一次请求带给后端。
49
+ - `**--query`**:优先走后端检索;若后端零条,公开列表可能 **本地回退**匹配应用名、节点名、`app_key`、`record_id`(JSON 中可能出现 `TASK_LIST_QUERY_FALLBACK_APPLIED` 类警告)。
50
+ - `**--app-key`**:列表阶段 **常省略**(不按应用过滤);与下钻阶段不同。
51
+
52
+ 从 `data.items[]` 取 `**task_id`** 进入下一步。
53
+
54
+ ### 3.2 `task_get`(`task get`)
55
+
56
+ ```bash
57
+ qingflow --json task get \
58
+ --task-id "<TASK_ID>" \
59
+ > tmp/qingflow_task_get.json
60
+ ```
61
+
62
+ 可选(默认开启,大响应可关):`--no-include-candidates`、`--no-include-associated-reports`。
63
+
64
+ **解析要点**(以 CLI `--json` 紧凑载荷为准,字段名以你环境实际 JSON 为准):
65
+
66
+ - `**data.task`**:`app_key`、`record_id`、`workflow_node_id`、`workflow_node_name`、`actionable`、`task_id`。
67
+ - `**data.available_actions`**:当前节点 **允许** 的动作子集(**下文 `task action` 的 `--action` 必须落在此列表中**,否则 CLI 报 config)。
68
+ - `**data.editable_fields`**:可编辑字段(与 `**save_only`** 等配合)。
69
+ - `**data.extras**`:摘要信息,例如 `**workflow_log**`(是否可见、条数提示等)、`**associated_reports**`(`count`、`items[]`,每项含 `**report_id**` / `chart_key` / `chart_name` 等)。
70
+
71
+ ### 3.3 `task_workflow_log_get`(`task log`)
72
+
73
+ ```bash
74
+ qingflow --json task log \
75
+ --task-id "<TASK_ID>" \
76
+ > tmp/qingflow_task_log.json
77
+ ```
78
+
79
+ - 典型结构:`data.items[]` 含节点、操作者、`operation`、`operation_time`、备注与附件等(具体字段以后端为准)。
80
+ - `**data.visibility**`:审计/机器人日志可见性等元数据。
81
+ - 这不是记录详情页的全量数据日志工具;如果用户要某条记录的完整数据日志 + 流程日志,先定位 `app_key/record_id/view_id`,再用 `qingflow --json record logs ...`。
82
+
83
+ ### 3.4 `task_associated_report_detail_get`(`task report`)
84
+
85
+ 1. 在 `**task get**` 的 `**data.extras.associated_reports.items**` 中选一条,读取其 `**report_id**`(整数)。
86
+ 2. 若 `**count == 0**`,跳过本步,无 `**--report-id**` 可填。
87
+
88
+ ```bash
89
+ qingflow --json task report \
90
+ --task-id "<TASK_ID>" \
91
+ --report-id <REPORT_ID> \
92
+ --page 1 \
93
+ --page-size 20 \
94
+ > tmp/qingflow_task_report.json
95
+ ```
96
+
97
+ - 定位方式与 `task get` 相同:默认传 `task_list.data.items[].task_id`。
98
+ - 若关联项是 QingBI 报表,详情读取优先走前端同源的 **`/qingbi/charts/data/qflow/{chartId}/detail`**,再按 qflow `asos` 降级;只有 qflow 路由明确不存在/不适用时才退回旧 BI 数据接口。不要把中间 **`CHART_SEE` / 40002** 当成任务关联报表最终不可见。
99
+
100
+ ### 3.5 `task_action_execute`(`task action`)
101
+
102
+ ```bash
103
+ qingflow --json task action \
104
+ --task-id "<TASK_ID>" \
105
+ --action <ACTION> \
106
+ [--payload-file tmp/task_action_payload.json] \
107
+ [--fields-file tmp/task_action_fields.json] \
108
+ > tmp/qingflow_task_action.json
109
+ ```
110
+
111
+ `**--action` 允许字面量**(实现校验,大小写不敏感):
112
+ `approve`、`reject`、`rollback`、`transfer`、`urge`、`save_only`。
113
+
114
+ **约束摘要**(与实现一致):
115
+
116
+ - **定位只认 `task_id`**:来自 `task list` 的 `data.items[].task_id`;`app_key`、`record_id`、`workflow_node_id` 不是动作执行入参。
117
+ - `**approve` / `reject`**:执行上下文以当前待办详情或用户/前端已给出的显式 `formId` 为准;只有缺少 `formId` 时才兜底读取应用 baseInfo。不要把应用 baseInfo 的 `40002` 当作待办动作最终无权结论,最终是否可执行以后端审批动作接口为准。
118
+ - `**save_only`**:必须 提供非空 `**--fields-file`**(或 payload 与 fields 不能同时塞 `answers` 与 fields,具体以报错为准)。以当前待办节点的 `data.editable_fields` / `editableQueIds` 为准;若 `editableQueIds` 被当前权限链路挡住,但任务详情里的 `queAuthSetting` 已暴露可编辑字段,CLI 会按任务详情继续允许 save-only,并由最终保存接口裁决。申请表单 schema 或辅助 `editableQueIds` 的 `40002` 不是待办字段保存的最终无权结论。
119
+ - `**transfer**`:`**payload` 内需要** `target_member_id`(或别名 `uid` / `targetMemberId`);不能转给当前登录人。
120
+ - **意见必填**:若详情里 `**action_constraints.feedback_required_for`** 包含当前动作,需在 `**payload.audit_feedback`**(实现从 payload 抽取审计意见,具体键名以 `--help` / 服务端为准)中提供,否则会 config 错误。
121
+ - `**urge`**:**不支持** 与 `fields` 同时提交。
122
+ - **禁止臆测动作**:只允许 `**data.available_actions`** 中出现的动作;`approve` 不在列表则不可硬放行。
123
+
124
+ `**--payload-file` / `--fields-file`**:UTF-8 JSON 对象,与 `record update` 同类「文件用 JSON」习惯一致。
125
+
126
+ ---
127
+
128
+ ## 4. 与「应用内 `record list`」的边界
129
+
130
+ - **任务中心待办 / 已办 / 抄送**:用 `**task list --task-box …`**,**不要**再用过时的 `record list --view-id system:todo` 等当作任务箱。
131
+ - **业务表读数**:仍在 `app get` 的 `**accessible_views`** 里选 `**custom:`* 等**,走 [QINGFLOW_CLI_DATA_RETRIEVAL_WORKFLOW.md](../core/QINGFLOW_CLI_DATA_RETRIEVAL_WORKFLOW.md)。
132
+
133
+ ---
134
+
135
+ ## 5. 实测与排障(编写时实跑)
136
+
137
+
138
+ | 命令 | 结果 |
139
+ | --------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
140
+ | `task list --task-box todo` | 返回多条,`items[].task_id` 为字符串;列表项可能不含 `app_key`(详情阶段再解析)。 |
141
+ | `task get --task-id …` | `data.task` 含完整定位;`available_actions` 示例含 `approve`/`reject`/`rollback`/`transfer`;`extras.associated_reports` 可为 `count: 0` 或大于 0。 |
142
+ | `task log --task-id …` | 返回 `data.items` 审批/流程历史。 |
143
+ | `task report --task-id … --report-id …` | 某条 `**count>0`** 的抽样上曾返回后端 `**40038` Object not exist**;同一 `task get` 里仍列出 `report_id`。**建议**:换 `report_id`、确认报表未删除、核对轻流 BI 权限与节点关联;仍失败时保留 `request_id` 报障。 |
144
+
145
+
146
+ **说明**:本文编写时仅用读接口抽样校验;`**task action`** 可依照 **第 3.5 节** 在自动化剧本中直接调用,由编排侧控制目标待办与动作,避免误批。
147
+
148
+ ---
149
+
150
+ ## 6. 交叉引用
151
+
152
+ - 主技能 [SKILL.md](../../SKILL.md):**落盘规则**、`**task-box` / `flow-status`** 枚举、与 `record` 混用雷区。
153
+ - [QINGFLOW_CLI_MEMBER_CHEATSHEET.md](../core/QINGFLOW_CLI_MEMBER_CHEATSHEET.md):成员侧最短路径。
@@ -0,0 +1,134 @@
1
+ # Qingflow CLI Task Ops
2
+
3
+ ## Overview
4
+
5
+ This section is for task workflow operations only. Do not use it for record CRUD or final statistical analysis.
6
+
7
+ ## Default Paths
8
+
9
+ Use exactly one of these default paths:
10
+
11
+ 1. Find target todos
12
+ `qingflow task list`
13
+
14
+ 2. Read one task context
15
+ `task list -> exact target -> task get`
16
+
17
+ 3. Read associated approval context
18
+ `task get -> task report` or `task log`
19
+
20
+ 4. Execute workflow action
21
+ `task list -> exact target -> task get -> task action`
22
+
23
+ 5. Execute a user-specified action on an already-clear target
24
+ `task list -> exact target -> (optional task get) -> task action`
25
+
26
+ ## Core Tools
27
+
28
+ - `qingflow task list`
29
+ - `qingflow task get`
30
+ - `qingflow task action`
31
+ - `qingflow task report`
32
+ - `qingflow task log`
33
+
34
+ ## Supporting Tools
35
+
36
+ - `app_list`
37
+ - `app_search`
38
+
39
+ ## Standard Operating Order
40
+
41
+ Before any task action, comment, transfer, urge, approve, reject, or rollback, resolve the target environment with [environments.md](./environments.md). If the user does not specify one, default to `prod`.
42
+
43
+ Use one of these two modes:
44
+
45
+ 1. Recommendation mode
46
+ 1. Discover the exact target with `task list`
47
+ 2. Read node context with `task get`
48
+ 3. Before giving any approval recommendation, read `task log`
49
+ 4. If `task get` returns any `associated_reports`, read every visible report through `task report`
50
+ 5. Give a recommendation only after reviewing node context, workflow log, and associated reports
51
+ 6. Wait for explicit user confirmation before `task action`
52
+
53
+ 2. User-directed execution mode
54
+ 1. Discover the exact target with `task list`
55
+ 2. If the target or action requirements are ambiguous, read `task get`; otherwise go straight to `task action`
56
+ 3. Execute through `task action --task-id ...`
57
+ 4. After actions, report the exact `task_id`, executed action, and any returned `app_key / record_id` plus warnings
58
+
59
+ ## Task-Center Rules
60
+
61
+ - Use `task list` for flat browsing
62
+ - `task_box` must be one of:
63
+ - `todo`
64
+ - `initiated`
65
+ - `cc`
66
+ - `done`
67
+ - `flow_status` must be one of:
68
+ - `all`
69
+ - `in_progress`
70
+ - `approved`
71
+ - `rejected`
72
+ - `pending_fix`
73
+ - `urged`
74
+ - `overdue`
75
+ - `due_soon`
76
+ - `unread`
77
+ - `ended`
78
+ - `task list` is the only public task discovery path
79
+ - `task list --query` uses backend `searchKey` first; only when backend returns zero rows does CLI apply a local fallback match on normalized `app_name / workflow_node_name / app_key / record_id`
80
+ - Treat `task_id` from `task list.data.items[]` as the public action locator. Do not reconstruct action identity from `app_key + record_id + workflow_node_id`.
81
+ - Default box usage:
82
+ - `todo`: `task list -> task get -> task log / task report -> recommendation -> explicit user confirmation -> task action`
83
+ - `initiated`: `task list -> record get`
84
+ - `done`: `task list -> record get`
85
+ - `cc`: `task list -> record get`
86
+ - Treat `initiated`, `done`, and `cc` primarily as list-plus-record-detail flows, not task action flows
87
+
88
+ ## Workflow Usage Actions
89
+
90
+ - `task get.capabilities.available_actions` is the source of truth for executable actions
91
+ - Current public actions are:
92
+ - `approve`
93
+ - `reject`
94
+ - `rollback`
95
+ - `transfer`
96
+ - `urge`
97
+ - `save_only`
98
+ - Before any approve/reject/rollback/transfer recommendation, always review `task log` when `task get.visibility.audit_record_visible=true`
99
+ - If `task get` returns visible `associated_reports`, review each one with `task report`; do not rely on report summary alone
100
+ - Do not give an approval recommendation based only on `task get`
101
+ - Do not execute `task action` until the user explicitly confirms the chosen action
102
+ - Exception: if the user has already explicitly authorized a concrete action on exact targets, you may execute directly after exact target resolution
103
+ - Avoid actions on ambiguous tasks or records
104
+ - Summarize the final action and the exact `task_id`
105
+ - `reject` requires `payload.audit_feedback`
106
+ - `save_only` requires non-empty `fields` and is only available when the backend exposes editable fields for the current node
107
+ - `task action` distinguishes action execution from workflow continuation. Read `verification.runtime_continuation_verified` before claiming the workflow actually moved on.
108
+ - If `task action` returns `partial_success` with `WORKFLOW_CONTINUATION_UNVERIFIED`, report the action as sent but the downstream continuation as unverified.
109
+ - If `task action` returns `TASK_CONTEXT_VISIBILITY_UNVERIFIED` after a `46001`-style context loss, do not claim the task was already processed unless the workflow log or record state proves it.
110
+ - If `task_action_execute` returns `TASK_RUNTIME_CONSUMED_AFTER_ACTION`, treat that as a normal post-success state: the current node runtime was consumed, the workflow likely continued, and `46001` does not by itself mean the action failed
111
+
112
+ ## Feedback Escalation
113
+
114
+ - If task capabilities, associated report detail, workflow log visibility, or action support still cannot satisfy the user's goal after reasonable use of this skill, summarize the exact gap in plain language.
115
+ - Ask whether the user wants you to submit product feedback.
116
+ - Only after explicit user confirmation, call `feedback_submit`.
117
+
118
+ ## Response Interpretation
119
+
120
+ - `task_list` returns normalized todo rows and is the only default discovery path
121
+ - `task_list` may return `TASK_LIST_QUERY_FALLBACK_APPLIED`; this means backend search missed the query and MCP recovered the result through local exact-field fallback
122
+ - `task_get` returns node context summary, not full historical report data
123
+ - `task_associated_report_detail_get` may return either:
124
+ - `result_type=view_list`
125
+ - `result_type=chart_data`
126
+ - `task_workflow_log_get` returns workflow log detail only when the node grants log visibility
127
+ - A successful approve/reject/rollback/transfer may still lose the current-node runtime immediately; treat `record_state_readable=false + backend 46001` as a post-action runtime loss unless continuation verification says otherwise
128
+ - Treat `request_route` as the source of truth for live route debugging
129
+ - If only part of the requested work is completed, explicitly disclose which parts are done and which are not
130
+
131
+ ## Resources
132
+
133
+ - Environment switching: [environments.md](./environments.md)
134
+ - Workflow and task usage actions: [workflow-usage.md](./workflow-usage.md)
@@ -0,0 +1,43 @@
1
+ # Environment Switching
2
+
3
+ Use this reference before any workflow usage action, comment, or task-center operation that might affect live work.
4
+
5
+ ## Step 1: Resolve the active environment
6
+
7
+ Decide explicitly whether the task targets:
8
+
9
+ - `test`: demo, mock data, smoke usage validation, training scenarios
10
+ - `prod`: real operational tasks, comments, and workflow actions
11
+
12
+ If the user did not specify an environment, default to `prod`.
13
+
14
+ ## Test Environment
15
+
16
+ Use test for:
17
+
18
+ - workflow walkthroughs
19
+ - user acceptance demos
20
+ - comment or transfer rehearsals
21
+
22
+ ## Production Environment
23
+
24
+ Use production for:
25
+
26
+ - live task-center operations
27
+ - live comments on real business records
28
+ - approve / reject / rollback / transfer / urge on real work
29
+
30
+ Production guardrails:
31
+
32
+ - never assume a task id, record id, or workflow node id
33
+ - find the exact target first
34
+ - if the task can be answered read-only, do not act
35
+
36
+ ## Reporting Rule
37
+
38
+ For task ops, always report:
39
+
40
+ - active environment
41
+ - target app or task box
42
+ - operation type: read, comment, approve, reject, rollback, transfer, urge, or mark_read
43
+ - affected task ids or record ids
@@ -0,0 +1,29 @@
1
+ # Workflow and Task Usage Actions
2
+
3
+ Use these when the user is operating inside an existing process, not redesigning it.
4
+
5
+ Examples:
6
+
7
+ - add a comment to a record
8
+ - approve or reject a workflow task
9
+ - transfer a task
10
+ - roll back a task
11
+ - list todo, initiated, done, or cc tasks
12
+ - inspect workload by worksheet or workflow node
13
+ - urge a pending task
14
+
15
+ Rules:
16
+
17
+ - if the user starts from inbox, todo, workload, cc, or bottleneck language, use `task_*` first
18
+ - use `task_summary` for headline counts
19
+ - use `task_list` for flat browsing
20
+ - use `task_facets` when worksheet or workflow-node buckets matter
21
+ - treat task counts as task-center counts, not record counts
22
+ - switch to `record_get` only after locating the exact business record behind a task
23
+ - identify the exact target first through `task_list`
24
+ - for approve, reject, rollback, transfer, urge, or save-only, use only `task_list.data.items[].task_id` as the public action locator
25
+ - read `task_get` before action when the allowed action or required payload is not already explicit; `task_get.data.available_actions` is the source of truth
26
+ - avoid usage-side workflow actions on ambiguous records
27
+ - do not reconstruct an action target from `app_key + record_id + workflow_node_id`; those fields are readback/debug context, not the default action input
28
+ - execute actions through `task action --task-id ... --action ...`
29
+ - summarize the final action and exact `task_id`; include record ids only as returned context
@@ -1,7 +1,42 @@
1
- [
2
- {
3
- "name": "示例表视图_CLI模板",
4
- "type": "table",
5
- "columns": ["单行文字", "多行文字"]
6
- }
7
- ]
1
+ {
2
+ "views": [
3
+ {
4
+ "operation": "upsert",
5
+ "app_key": "APP_KEY",
6
+ "name": "示例业务操作视图_CLI模板",
7
+ "type": "table",
8
+ "columns": ["主记录编号", "主记录名称", "状态", "负责人"],
9
+ "filters": [
10
+ {"field_name": "状态", "operator": "neq", "value": "已关闭"}
11
+ ],
12
+ "query_conditions": {
13
+ "enabled": true,
14
+ "exact": false,
15
+ "hide_before_query": false,
16
+ "rows": [["主记录编号", "主记录名称"], ["状态", "负责人"]]
17
+ },
18
+ "action_buttons": [
19
+ {
20
+ "text": "行内创建子记录",
21
+ "action": "add_data",
22
+ "target_app_key": "TARGET_APP_KEY",
23
+ "field_mappings": [
24
+ {"source_field": "数据ID", "target_field": "关联主记录"}
25
+ ],
26
+ "default_values": {"目标状态字段": "REPLACE_WITH_TARGET_OPTION_LABEL"},
27
+ "placement": "list"
28
+ },
29
+ {
30
+ "text": "详情创建子记录",
31
+ "action": "add_data",
32
+ "target_app_key": "TARGET_APP_KEY",
33
+ "field_mappings": [
34
+ {"source_field": "数据ID", "target_field": "关联主记录"}
35
+ ],
36
+ "default_values": {"目标状态字段": "REPLACE_WITH_TARGET_OPTION_LABEL"},
37
+ "placement": "detail"
38
+ }
39
+ ]
40
+ }
41
+ ]
42
+ }