@dazitech/cli 3.0.0 → 3.0.1

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 (58) hide show
  1. package/README.md +15 -13
  2. package/dist/clis/dazi-app.js +5 -5
  3. package/dist/clis/dazi-flow.js +600 -170
  4. package/dist/docs/app/app-init.md +15 -15
  5. package/dist/docs/app/build-upload.md +13 -13
  6. package/dist/docs/app/release-guide.md +9 -9
  7. package/dist/docs/app//344/270/273/350/246/201/350/264/242/345/212/241/346/214/207/346/240/207/345/244/215/346/235/202/346/212/245/350/241/250/345/274/200/345/217/221/345/256/236/350/267/265.md +45 -41
  8. package/dist/docs/auth/auth-login.md +4 -4
  9. package/dist/docs/auth/token-management.md +5 -5
  10. package/dist/docs/data/cube-guide.md +2 -2
  11. package/dist/docs/data/data-spaces.md +4 -3
  12. package/dist/docs/data/table-preview.md +6 -6
  13. package/dist/docs/flow/ai-workflow-playbook.md +69 -0
  14. package/dist/docs/flow/flow-project-guide.md +92 -87
  15. package/dist/docs/flow/flows-guide.md +98 -94
  16. package/dist/docs/flow/local-files-spec.md +194 -0
  17. package/dist/docs/flow/node-code-guide.md +57 -55
  18. package/dist/docs/flow/run-guide.md +18 -18
  19. package/dist/docs/flow/variables-guide.md +61 -61
  20. package/dist/docs/flow//346/265/201/347/250/213/345/274/200/345/217/221/346/234/200/344/275/263/345/256/236/350/267/265-VS-flow0/346/241/210/344/276/213.md +31 -31
  21. package/dist/docs/guides/cli-invocation.md +30 -29
  22. package/dist/docs/guides/cli-reference.md +72 -71
  23. package/dist/docs/guides/flow-consistency-checklist.md +42 -0
  24. package/dist/docs/guides/mcp-setup.md +34 -34
  25. package/dist/docs/guides/migrate-v2-v3.md +6 -5
  26. package/dist/docs/guides/quickstart.md +8 -8
  27. package/dist/docs/guides/troubleshooting.md +39 -21
  28. package/dist/docs/guides/workspace-v3.md +17 -17
  29. package/dist/docs/index.json +18 -6
  30. package/dist/docs/onto/action-guide.md +4 -3
  31. package/dist/docs/onto/dazi_script_sdk_reference.md +20 -14
  32. package/dist/docs/onto/dazi_script_seed_data_guide.md +14 -14
  33. package/dist/docs/onto/function-guide.md +5 -5
  34. package/dist/docs/onto/rule-guide.md +7 -6
  35. package/dist/docs/onto/space-management.md +5 -3
  36. package/dist/docs/onto//346/234/254/344/275/223/350/204/232/346/234/254/347/274/226/345/206/231/346/214/207/345/215/227.md +35 -35
  37. package/dist/docs/onto//346/234/254/344/275/223/350/247/204/345/210/222/346/214/207/345/215/227.md +21 -21
  38. package/dist/docs/onto//350/247/204/345/210/222/347/244/272/344/276/213_/345/210/251/346/266/246/345/210/206/346/236/220/346/234/254/344/275/223/346/226/271/346/241/210.md +11 -11
  39. package/dist/examples/flow/minimal-excel-python/README.md +5 -0
  40. package/dist/examples/flow/minimal-excel-python/flow.json +48 -0
  41. package/dist/examples/flow/minimal-excel-python/flow.meta.json +23 -0
  42. package/dist/examples/flow/minimal-excel-python//350/212/202/347/202/271/Excel/347/244/272/344/276/213/code.py +7 -0
  43. package/dist/examples/flow/minimal-excel-python//350/212/202/347/202/271/Excel/347/244/272/344/276/213/node.info.json +14 -0
  44. package/dist/examples/index.json +6 -0
  45. package/dist/prompts/data/data-analysis.md +2 -2
  46. package/dist/prompts/flow/ai-workflow-playbook.md +69 -0
  47. package/dist/prompts/flow/flow-design.md +33 -19
  48. package/dist/prompts/flow/plan-generate.md +7 -7
  49. package/dist/prompts/flow/run-debug.md +15 -15
  50. package/dist/prompts/flow/run-fix-loop.md +20 -17
  51. package/dist/prompts/general/ask-dazi.md +6 -6
  52. package/dist/prompts/general/troubleshoot.md +4 -3
  53. package/dist/prompts/index.json +1 -0
  54. package/dist/prompts/onto/action-design.md +7 -5
  55. package/dist/prompts/onto/function-design.md +6 -4
  56. package/dist/prompts/onto/rule-seed.md +4 -2
  57. package/dist/prompts/onto/script-publish-run.md +19 -19
  58. package/package.json +1 -1
@@ -5,6 +5,7 @@
5
5
  ## 规则概念
6
6
 
7
7
  规则(Rule)存储在 `ads_ontology_rules` 表,通过种子脚本写入,通常用于:
8
+
8
9
  - 数据校验规则
9
10
  - 业务约束条件
10
11
  - 权限规则集
@@ -12,16 +13,16 @@
12
13
  ## 列出规则
13
14
 
14
15
  ```bash
15
- .\scripts\dazi.ps1 onto rule list --space <space-id>
16
+ dazi onto rule list --space <space-id>
16
17
 
17
18
  # 按规则集过滤
18
- .\scripts\dazi.ps1 onto rule list --space <space-id> --rule-set finance_rules
19
+ dazi onto rule list --space <space-id> --rule-set finance_rules
19
20
  ```
20
21
 
21
22
  ## 执行规则种子
22
23
 
23
24
  ```bash
24
- .\scripts\dazi.ps1 onto rule run-seed --space <space-id> --stem cw_001_rules_seed
25
+ dazi onto rule run-seed --space <space-id> --stem cw_001_rules_seed
25
26
  ```
26
27
 
27
28
  ## 种子脚本示例
@@ -44,9 +45,9 @@ def main(params: dict, s) -> dict:
44
45
 
45
46
  ```bash
46
47
  # 删除单条
47
- .\scripts\dazi.ps1 onto rule delete fin_001 --space <space-id>
48
+ dazi onto rule delete fin_001 --space <space-id>
48
49
 
49
50
  # 按规则集批量删除(先 dry-run)
50
- .\scripts\dazi.ps1 onto rule delete-all --space <space-id> --rule-set old_rules --dry-run
51
- .\scripts\dazi.ps1 onto rule delete-all --space <space-id> --rule-set old_rules --yes
51
+ dazi onto rule delete-all --space <space-id> --rule-set old_rules --dry-run
52
+ dazi onto rule delete-all --space <space-id> --rule-set old_rules --yes
52
53
  ```
@@ -5,6 +5,7 @@
5
5
  ## 空间概念
6
6
 
7
7
  本体空间(Space)是搭子平台的基础组织单位,每个空间包含:
8
+
8
9
  - 函数定义(FunctionDef)
9
10
  - 动作定义(ActionDef)
10
11
  - 规则(Rule)
@@ -13,16 +14,17 @@
13
14
  ## 列出空间
14
15
 
15
16
  ```bash
16
- .\scripts\dazi.ps1 onto space list
17
+ dazi onto space list
17
18
  ```
18
19
 
19
20
  ## 初始化本地工作区
20
21
 
21
22
  ```bash
22
- .\scripts\dazi.ps1 onto space init --space-id <space-id>
23
+ dazi onto space init --space-id <space-id>
23
24
  ```
24
25
 
25
26
  本地目录结构:
27
+
26
28
  ```
27
29
  onto/<space-id>/
28
30
  editorial/
@@ -40,7 +42,7 @@ onto/<space-id>/
40
42
  将远端本体数据同步到本地:
41
43
 
42
44
  ```bash
43
- .\scripts\dazi.ps1 onto space snapshot --space-id <space-id>
45
+ dazi onto space snapshot --space-id <space-id>
44
46
  ```
45
47
 
46
48
  快照保存到 `onto/<space-id>/snapshot.json`。
@@ -4,14 +4,14 @@
4
4
 
5
5
  本文说明本体项目内 **Python 脚本的目录、类型、发布与运行**(原独立的「脚本开发与发布」已与本文合并)。
6
6
 
7
- > 终端命令均在 **`dazi-work` 根目录**执行:`.\scripts\dazi.ps1 ...`(见 [CLI 调用约定](../guides/cli-invocation.md))。
7
+ > 终端命令均在 **`dazi-work` 根目录**执行:`dazi ...`(见 [CLI 调用约定](../guides/cli-invocation.md))。
8
8
 
9
9
  ## 环境
10
10
 
11
11
  - 推荐 **Python 3.10+**
12
12
  - 脚本目录:**`<工作区根>/项目/onto_<项目名>/脚本/`**(新建本体项目时自动创建)
13
13
  - 扩展默认脚本语言:`dazi.onto.defaultScriptLang` = `python`
14
- - 平台 API:`dazi.serverUrl`;登录:`.\scripts\dazi.ps1 auth login` / `.\scripts\dazi.ps1 auth set-token`
14
+ - 平台 API:`dazi.serverUrl`;登录:`dazi auth login` / `dazi auth set-token`
15
15
 
16
16
  ## 目录约定
17
17
 
@@ -25,7 +25,7 @@
25
25
  └── ...
26
26
  ```
27
27
 
28
- 参考示例(可复制后修改)位于 **`资源/examples/onto/`**(侧栏 **帮助 → 示例** 或 `.\scripts\dazi.ps1 examples sync`)。
28
+ 参考示例(可复制后修改)位于 **`资源/examples/onto/`**(侧栏 **帮助 → 示例** 或 `dazi examples sync`)。
29
29
 
30
30
  > **不再使用** 历史路径 `onto/<space_id>/editorial/`、`editorial/functions/` 等作为本地开发约定。
31
31
 
@@ -33,67 +33,67 @@
33
33
 
34
34
  编写 `脚本/` 下 `.py` 前请阅读:
35
35
 
36
- | 文档 | 说明 |
37
- |------|------|
38
- | **[DaziScript SDK 参考](./dazi_script_sdk_reference.md)** | `space` / `s.sql` / `s.onto` / `s.tables` / Cube 等 API 与本体落库顺序 |
39
- | **[DaziScript 灌数脚本编写指南](./dazi_script_seed_data_guide.md)** | 造数、补数、`insert_rows` 与 ClickHouse `INSERT` 约束、幂等约定 |
36
+ | 文档 | 说明 |
37
+ | ------------------------------------------------------------------- | ---------------------------------------------------------------------- |
38
+ | **[DaziScript SDK 参考](./dazi_script_sdk_reference.md)** | `space` / `s.sql` / `s.onto` / `s.tables` / Cube 等 API 与本体落库顺序 |
39
+ | **[DaziScript 灌数脚本编写指南](./dazi_script_seed_data_guide.md)** | 造数、补数、`insert_rows` 与 ClickHouse `INSERT` 约束、幂等约定 |
40
40
 
41
- 同步到工作区:`.\scripts\dazi.ps1 docs sync` → `资源/docs/onto/`。
41
+ 同步到工作区:`dazi docs sync` → `资源/docs/onto/`。
42
42
 
43
43
  ## 脚本类型
44
44
 
45
45
  类型由 **发布命令参数** 区分;文件可平铺在 `脚本/`,也可分子目录(如 `脚本/functions/`、`脚本/actions/`):
46
46
 
47
- | 类型 | 路径约定 | 说明 |
48
- |------|---------|------|
47
+ | 类型 | 路径约定 | 说明 |
48
+ | ------------------- | --------------------------------- | -------------------------------------------------- |
49
49
  | `ontology_function` | `项目/onto_<项目名>/脚本/**/*.py` | **必须**带 `--register-function-id` 发布(见下节) |
50
- | `ontology_action` | `项目/onto_<项目名>/脚本/**/*.py` | 发布时加 `--register-action-id` 等 Action 参数 |
51
- | `data_script` | `项目/onto_<项目名>/脚本/**/*.py` | 普通 `script publish`,不注册函数/动作 |
50
+ | `ontology_action` | `项目/onto_<项目名>/脚本/**/*.py` | 发布时加 `--register-action-id` 等 Action 参数 |
51
+ | `data_script` | `项目/onto_<项目名>/脚本/**/*.py` | 普通 `script publish`,不注册函数/动作 |
52
52
 
53
53
  `<space-id>` 从 **`项目/onto_<项目名>/README.md`** 读取,勿手写错空间。
54
54
 
55
55
  ## 发布预检
56
56
 
57
57
  ```powershell
58
- .\scripts\dazi.ps1 onto script publish-preview 项目/onto_<项目名>/脚本/my_func.py --space <space-id>
58
+ dazi onto script publish-preview 项目/onto_<项目名>/脚本/my_func.py --space <space-id>
59
59
  ```
60
60
 
61
61
  ## 发布脚本
62
62
 
63
- > **勿用** 独立命令 `dazi-onto`(v3 未安装到 PATH)。统一使用 **`.\scripts\dazi.ps1 onto ...`**。
63
+ > **勿用** 独立命令 `dazi-onto`(v3 未安装到 PATH)。统一使用 **`dazi onto ...`**。
64
64
 
65
65
  ### 本体函数:**必须注册**,否则侧栏与测试看不到
66
66
 
67
67
  `脚本/functions/`(或规划中的本体函数 `.py`)**不能**只执行「普通 publish」:
68
68
 
69
- | 仅 `script publish`(无 `--register-function-id`) | 带 `--register-function-id` 发布 |
70
- |--------------------------------------------------|----------------------------------|
71
- | 脚本代码进入 `ads_scripts` | 同上 **且** 写入 `ontology_function_defs` |
72
- | **不会**出现在 **Onto → 函数列表** | 出现在函数列表,可 **运行函数** / 工作台测试 |
73
- | `.\scripts\dazi.ps1 onto function run <id>` **找不到** | `function run`、侧栏运行可用 |
69
+ | 仅 `script publish`(无 `--register-function-id`) | 带 `--register-function-id` 发布 |
70
+ | -------------------------------------------------- | -------------------------------------------- |
71
+ | 脚本代码进入 `ads_scripts` | 同上 **且** 写入 `ontology_function_defs` |
72
+ | **不会**出现在 **Onto → 函数列表** | 出现在函数列表,可 **运行函数** / 工作台测试 |
73
+ | `dazi onto function run <id>` **找不到** | `function run`、侧栏运行可用 |
74
74
 
75
75
  因此:**首次发布本体函数时,命令里必须包含 `--register-function-id`**,且 `function_id` 与规划文档、脚本内约定 **完全一致**(建议带点号命名空间,如 `sales.fn.get_summary`,勿随意简写为 `get_summary`)。
76
76
 
77
77
  智能体(TRAE 等)实施自检:
78
78
 
79
- 1. 发布命令是否包含 `--register-function-id`?
80
- 2. 发布输出是否含 `functionId: xxx` / `function_registration.ok`?
81
- 3. `.\scripts\dazi.ps1 onto function list --space <space-id>` 能否看到该 `function_id`?
79
+ 1. 发布命令是否包含 `--register-function-id`?
80
+ 2. 发布输出是否含 `functionId: xxx` / `function_registration.ok`?
81
+ 3. `dazi onto function list --space <space-id>` 能否看到该 `function_id`?
82
82
 
83
83
  任一步不满足 → **视为未注册**,需重新 publish(带注册参数),不要仅 `script run` 以为函数已可用。
84
84
 
85
85
  ```powershell
86
86
  # 初始化 / 灌数:普通发布即可(不要加 register-function-id)
87
- .\scripts\dazi.ps1 onto script publish 项目/onto_<项目名>/脚本/setup/xxx_ontology_init.py --space <space-id> --type setup
88
- .\scripts\dazi.ps1 onto script publish 项目/onto_<项目名>/脚本/setup/xxx_seed_data.py --space <space-id> --type data
87
+ dazi onto script publish 项目/onto_<项目名>/脚本/setup/xxx_ontology_init.py --space <space-id> --type setup
88
+ dazi onto script publish 项目/onto_<项目名>/脚本/setup/xxx_seed_data.py --space <space-id> --type data
89
89
 
90
90
  # ★ 本体函数:必须注册(示例)
91
- .\scripts\dazi.ps1 onto script publish 项目/onto_<项目名>/脚本/functions/get_summary.py `
91
+ dazi onto script publish 项目/onto_<项目名>/脚本/functions/get_summary.py `
92
92
  --space <space-id> `
93
93
  --register-function-id sales.fn.get_summary
94
94
 
95
95
  # 发布并注册为本体动作(示例)
96
- .\scripts\dazi.ps1 onto script publish 项目/onto_<项目名>/脚本/my_action.py `
96
+ dazi onto script publish 项目/onto_<项目名>/脚本/my_action.py `
97
97
  --space <space-id> `
98
98
  --register-action-id my_action_code `
99
99
  --register-action-permission-tag "finance.write"
@@ -102,22 +102,22 @@
102
102
  发布后验证:
103
103
 
104
104
  ```powershell
105
- .\scripts\dazi.ps1 onto function list --space <space-id>
106
- .\scripts\dazi.ps1 onto function run sales.fn.get_summary --space <space-id>
105
+ dazi onto function list --space <space-id>
106
+ dazi onto function run sales.fn.get_summary --space <space-id>
107
107
  ```
108
108
 
109
109
  亦可在 VS Code 侧栏 **Onto 本体 → 发布函数** 发布(须填写/绑定 **function_id**);发布后在 **函数** 节点下应能看到该函数。
110
110
 
111
- 函数生命周期与 `update-code` 详见 **[本体函数开发指南](./function-guide.md)**。给 TRAE 的完整命令模板见内置提示词 **`onto/script-publish-run`**(`.\scripts\dazi.ps1 prompt sync` 后位于 `资源/prompts/onto/`)。
111
+ 函数生命周期与 `update-code` 详见 **[本体函数开发指南](./function-guide.md)**。给 TRAE 的完整命令模板见内置提示词 **`onto/script-publish-run`**(`dazi prompt sync` 后位于 `资源/prompts/onto/`)。
112
112
 
113
113
  ## 从平台拉取脚本(可选)
114
114
 
115
115
  若需将平台上已有脚本拉回本地对照(**非**日常开发主路径):
116
116
 
117
117
  ```powershell
118
- .\scripts\dazi.ps1 onto script sync --space <space-id>
119
- .\scripts\dazi.ps1 onto script sync --space <space-id> --type ontology_function
120
- .\scripts\dazi.ps1 onto script sync --space <space-id> --dry-run
118
+ dazi onto script sync --space <space-id>
119
+ dazi onto script sync --space <space-id> --type ontology_function
120
+ dazi onto script sync --space <space-id> --dry-run
121
121
  ```
122
122
 
123
123
  拉取目标目录以 CLI 为准;**新建与修改仍以 `项目/onto_<项目名>/脚本/` 为准**。
@@ -125,15 +125,15 @@
125
125
  ## 清理重复脚本
126
126
 
127
127
  ```powershell
128
- .\scripts\dazi.ps1 onto script dedupe --space <space-id> --dry-run
129
- .\scripts\dazi.ps1 onto script dedupe --space <space-id> --yes
128
+ dazi onto script dedupe --space <space-id> --dry-run
129
+ dazi onto script dedupe --space <space-id> --yes
130
130
  ```
131
131
 
132
132
  ## 编写建议
133
133
 
134
134
  1. 先阅读 `快速启动.md` 与 `README.md` 中的**数据空间 ID**
135
135
  2. 在 `脚本/` 中按模块拆分 `.py`(初始化、灌数、本体函数可分机文件)
136
- 3. 发布与运行:`.\scripts\dazi.ps1 onto script publish`(**函数必须** `--register-function-id`)/ 侧栏 **Onto 本体**;函数运行见 **[function-guide](./function-guide.md)**、**[action-guide](./action-guide.md)**
136
+ 3. 发布与运行:`dazi onto script publish`(**函数必须** `--register-function-id`)/ 侧栏 **Onto 本体**;函数运行见 **[function-guide](./function-guide.md)**、**[action-guide](./action-guide.md)**
137
137
  4. 本地仅调试 Python 语法时可用 VS Code 运行 `脚本/main.py`(**不会**自动连平台;连平台须发布后在侧栏或 CLI 执行)
138
138
 
139
139
  ## 相关文档
@@ -25,12 +25,12 @@
25
25
  - 接受 **多对一**:多表、多 Cube 可收敛为一种业务对象;一宽表也可拆成多种业务对象。
26
26
  - **链接**两端必须是对象类型 **`code`**,不是 Cube 名;表中仅有 `xxx_id` 时,规划文中仍应写清本体链接语义。
27
27
 
28
- **与业界对象中心实践的对照**:上述分层与「对象优先、数据为 backing」的思路,可与 **Palantir Foundry Ontology**(对象类型、链接、Action、Function 分层)等成熟产品对照阅读;落地脚本时以平台当前 API 与 **`.\scripts\dazi.ps1 onto`** 能力为准,**不**假设已实现对方全部特性。
28
+ **与业界对象中心实践的对照**:上述分层与「对象优先、数据为 backing」的思路,可与 **Palantir Foundry Ontology**(对象类型、链接、Action、Function 分层)等成熟产品对照阅读;落地脚本时以平台当前 API 与 **`dazi onto`** 能力为准,**不**假设已实现对方全部特性。
29
29
 
30
30
  ## 必读文档
31
31
 
32
32
  1. **本体规划示例**:`规划示例_利润分析本体方案.md`(扩展内置于 `docs/onto/`;同步到工作区后为 `资源/docs/onto/规划示例_利润分析本体方案.md`)
33
- 2. **工作区与 CLI**:`guides/workspace-v3.md`、`guides/cli-reference.md`(`.\scripts\dazi.ps1 docs sync` 后位于 `资源/docs/guides/`)
33
+ 2. **工作区与 CLI**:`guides/workspace-v3.md`、`guides/cli-reference.md`(`dazi docs sync` 后位于 `资源/docs/guides/`)
34
34
 
35
35
  ## 产出约定
36
36
 
@@ -44,12 +44,12 @@
44
44
 
45
45
  ## LLM 执行指引(必须遵循)
46
46
 
47
- 面向 **dazi-vscode v3**:终端用 **`.\scripts\dazi.ps1`**(本体/流程/数据/鉴权),DRAP 在 **`项目/app_<名称>/` 应用项目根** 用 **`pnpm run dazi-app --`**;**禁止**全局 `dazi-onto` / 已废弃的 `dazi-agent`。
47
+ 面向 **dazi-vscode v3**:终端用 **`dazi`**(本体/流程/数据/鉴权),DRAP 在 **`项目/app_<名称>/` 应用项目根** 用 **`pnpm run dazi-app --`**;**禁止**全局 `dazi-onto` / 已废弃的 `dazi-agent`。
48
48
 
49
49
  ### 工作区与项目
50
50
 
51
51
  - **工作区根**:VS Code 已打开的文件夹;多根工作区时在设置 **`dazi.workspaceRoot`** 指定。
52
- - **平台与登录**:`dazi.serverUrl`;`.\scripts\dazi.ps1 auth login` 或 `.\scripts\dazi.ps1 auth set-token`(Token 存 `.dazi/auth.json`)。
52
+ - **平台与登录**:`dazi.serverUrl`;`dazi auth login` 或 `dazi auth set-token`(Token 存 `.dazi/auth.json`)。
53
53
  - **本体项目即工作单元**(扩展「新建项目」时已选定数据空间,**无需**再建 `onto/<space_id>/` 等平行目录):
54
54
 
55
55
  ```text
@@ -58,7 +58,7 @@
58
58
  README.md ← 数据空间 ID、项目元信息(规划/实施均以此为准)
59
59
  规划/ ← 规划阶段 Markdown 产出
60
60
  脚本/ ← 本体 Python 脚本
61
- 资源/docs/onto/ ← 本体指南与规划示例(.\scripts\dazi.ps1 docs sync)
61
+ 资源/docs/onto/ ← 本体指南与规划示例(dazi docs sync)
62
62
  资源/dataspaces/ ← 侧栏下载的表结构 Markdown
63
63
  ```
64
64
 
@@ -72,26 +72,26 @@
72
72
  在 **工作区根目录** 打开终端执行:
73
73
 
74
74
  ```bash
75
- .\scripts\dazi.ps1 doctor
76
- .\scripts\dazi.ps1 auth whoami
77
- .\scripts\dazi.ps1 docs sync # 可选:同步帮助文档到 资源/docs/
75
+ dazi doctor
76
+ dazi auth whoami
77
+ dazi docs sync # 可选:同步帮助文档到 资源/docs/
78
78
  ```
79
79
 
80
80
  **核对数据空间与现网资产**(`<space_id>` 取自当前项目的 `README.md`,勿另猜目录):
81
81
 
82
82
  ```bash
83
- .\scripts\dazi.ps1 onto space list
84
- .\scripts\dazi.ps1 onto space get <space_id> # 可选:查看空间详情
83
+ dazi onto space list
84
+ dazi onto space get <space_id> # 可选:查看空间详情
85
85
  ```
86
86
 
87
87
  **扩展侧栏(规划阶段主要入口)**:
88
88
 
89
- | 目的 | 操作 |
90
- | -------------- | ---- |
91
- | 确认绑定空间 | 打开 **`项目/onto_<名称>/README.md`** 中的数据空间 ID |
92
- | 查看表 / Cube | **数据资源** → 对应数据空间 → 展开表、Cube |
93
- | 下载表结构 | 表节点右键「下载表信息」→ `资源/dataspaces/` |
94
- | 同步帮助文档 | **帮助** → 下载文档(`.\scripts\dazi.ps1 docs sync`) |
89
+ | 目的 | 操作 |
90
+ | ------------- | ----------------------------------------------------- |
91
+ | 确认绑定空间 | 打开 **`项目/onto_<名称>/README.md`** 中的数据空间 ID |
92
+ | 查看表 / Cube | **数据资源** → 对应数据空间 → 展开表、Cube |
93
+ | 下载表结构 | 表节点右键「下载表信息」→ `资源/dataspaces/` |
94
+ | 同步帮助文档 | **帮助** → 下载文档(`dazi docs sync`) |
95
95
 
96
96
  > 规划阶段**不**要求本地 `snapshot.json`、`editorial/` 或 `onto/<space_id>/` 目录;以侧栏 **数据资源** 与项目内文档为准即可。
97
97
 
@@ -102,21 +102,21 @@
102
102
  脚本写在 **`项目/<onto_项目>/脚本/`**(Python,见 `dazi.onto.defaultScriptLang`)。发布与运行见 **`本体脚本编写指南.md`**、**`function-guide.md`**:
103
103
 
104
104
  ```bash
105
- .\scripts\dazi.ps1 onto script publish-preview 项目/onto_<名称>/脚本/my_func.py --space <space_id>
106
- .\scripts\dazi.ps1 onto script publish 项目/onto_<名称>/脚本/my_func.py \
105
+ dazi onto script publish-preview 项目/onto_<名称>/脚本/my_func.py --space <space_id>
106
+ dazi onto script publish 项目/onto_<名称>/脚本/my_func.py \
107
107
  --space <space_id> \
108
108
  --register-function-id <function_id>
109
- .\scripts\dazi.ps1 onto function run <function_id> --space <space_id> --params '{}'
109
+ dazi onto function run <function_id> --space <space_id> --params '{}'
110
110
  ```
111
111
 
112
112
  亦可在侧栏 **Onto 本体** 使用「发布函数」「运行函数」等命令(与终端 CLI **同源** bundled;`--space` 与项目 README 中的 `space_id` 一致)。
113
113
 
114
- 实施前可用 `.\scripts\dazi.ps1 onto function list --space <space_id>` 核对平台已有函数定义,**开发入口始终是 `项目/<onto_项目>/脚本/`**,不以历史 `onto/`、`editorial` 目录为约定路径。
114
+ 实施前可用 `dazi onto function list --space <space_id>` 核对平台已有函数定义,**开发入口始终是 `项目/<onto_项目>/脚本/`**,不以历史 `onto/`、`editorial` 目录为约定路径。
115
115
 
116
116
  ### 失败处理
117
117
 
118
118
  - 命令失败时输出 **完整错误** 与修复建议(登录、`dazi.serverUrl`、工作区路径、`space_id`),**不得** 静默跳过。
119
- - v2 → v3 命令对照见 `guides/troubleshooting.md`(`.\scripts\dazi.ps1 docs sync` 后位于 `资源/docs/guides/`)。
119
+ - v2 → v3 命令对照见 `guides/troubleshooting.md`(`dazi docs sync` 后位于 `资源/docs/guides/`)。
120
120
 
121
121
  ## 自检
122
122
 
@@ -417,9 +417,9 @@
417
417
  ## 七、实施计划
418
418
 
419
419
  > **dazi-vscode v3 命令对照**(`space_id` 见本文「一、空间概述」;项目目录 `项目/onto_<名称>/` 在新建项目时绑定该空间)
420
- > 环境:`.\scripts\dazi.ps1 doctor` · 现网表/Cube:**数据资源** 侧栏 ·
421
- > 发布:`.\scripts\dazi.ps1 onto script publish 项目/onto_<名称>/脚本/<file>.py --space space__profit0520 --register-function-id <id>` ·
422
- > 运行:`.\scripts\dazi.ps1 onto function run <function_id> --space space__profit0520 --params '{}'`
420
+ > 环境:`dazi doctor` · 现网表/Cube:**数据资源** 侧栏 ·
421
+ > 发布:`dazi onto script publish 项目/onto_<名称>/脚本/<file>.py --space space__profit0520 --register-function-id <id>` ·
422
+ > 运行:`dazi onto function run <function_id> --space space__profit0520 --params '{}'`
423
423
  > 细则见 **`本体规划指南.md`**「LLM 执行指引」。
424
424
 
425
425
  ### 7.1 阶段一:物理层(优先级:高)
@@ -460,7 +460,7 @@
460
460
  | 17 | 开发 mom_analysis | 环比分析函数 |
461
461
  | 18 | 开发 top_products | 产品排行函数 |
462
462
  | 19 | 开发 customer_segmentation | 客户分层函数 |
463
- | 20 | 发布并注册函数 | `.\scripts\dazi.ps1 onto script publish … --space space__profit0520 --register-function-id` |
463
+ | 20 | 发布并注册函数 | `dazi onto script publish … --space space__profit0520 --register-function-id` |
464
464
 
465
465
  ### 7.5 阶段五:数据层(优先级:中)
466
466
 
@@ -473,7 +473,7 @@
473
473
 
474
474
  | 步骤 | 任务 | 说明 |
475
475
  | ---- | -------- | --------------------------------------------------------------------------------------- |
476
- | 23 | 验收核对 | 侧栏 **数据资源** 查表/Cube;`.\scripts\dazi.ps1 onto function list --space space__profit0520` 查函数 |
476
+ | 23 | 验收核对 | 侧栏 **数据资源** 查表/Cube;`dazi onto function list --space space__profit0520` 查函数 |
477
477
  | 24 | 函数测试 | 验证函数功能 |
478
478
  | 25 | 文档归档 | 更新规划文档 |
479
479
 
@@ -526,12 +526,12 @@
526
526
 
527
527
  ## 十、相关文档
528
528
 
529
- | 文档路径 | 说明 |
530
- | --------------------------------------- | ---------------------------------------------- |
531
- | `本体规划指南.md` | 规划方法、空间约束、**LLM 执行指引(v3 CLI)** |
532
- | `本体脚本编写指南.md` | 项目内 `脚本/` 目录约定 |
533
- | `本体脚本编写指南.md` / `function-guide.md` | `.\scripts\dazi.ps1 onto` 脚本发布与函数生命周期 |
534
- | `guides/workspace-v3.md` | 工作区 `项目/`、`资源/` 布局 |
529
+ | 文档路径 | 说明 |
530
+ | ------------------------------------------- | ---------------------------------------------- |
531
+ | `本体规划指南.md` | 规划方法、空间约束、**LLM 执行指引(v3 CLI)** |
532
+ | `本体脚本编写指南.md` | 项目内 `脚本/` 目录约定 |
533
+ | `本体脚本编写指南.md` / `function-guide.md` | `dazi onto` 脚本发布与函数生命周期 |
534
+ | `guides/workspace-v3.md` | 工作区 `项目/`、`资源/` 布局 |
535
535
 
536
536
  ---
537
537
 
@@ -0,0 +1,5 @@
1
+ # 示例:minimal-excel-python
2
+
3
+ 标准三文件结构参考,详见 `docs/flow/local-files-spec.md`。
4
+
5
+ 勿直接当作可运行流程;`flowId` / `managed_file_id` 需替换为平台真实值。
@@ -0,0 +1,48 @@
1
+ {
2
+ "nodes": [
3
+ {
4
+ "id": "start-node",
5
+ "type": "custom",
6
+ "position": { "x": 50, "y": 250 },
7
+ "data": { "label": "开始", "type": "start" },
8
+ "deletable": false,
9
+ "node_uuid": "00000000-0000-4000-8000-000000000001"
10
+ },
11
+ {
12
+ "id": "n-excel-demo",
13
+ "type": "custom",
14
+ "position": { "x": 310, "y": 250 },
15
+ "data": {
16
+ "label": "Excel示例",
17
+ "type": "excel-python",
18
+ "managed_file_id": "<平台文件 UUID>",
19
+ "output_variable_name": "示例输出表"
20
+ },
21
+ "node_uuid": "00000000-0000-4000-8000-000000000002"
22
+ },
23
+ {
24
+ "id": "end-node",
25
+ "type": "custom",
26
+ "position": { "x": 850, "y": 250 },
27
+ "data": { "label": "结束", "type": "end" },
28
+ "deletable": false,
29
+ "node_uuid": "00000000-0000-4000-8000-000000000003"
30
+ }
31
+ ],
32
+ "edges": [
33
+ {
34
+ "id": "e1",
35
+ "source": "start-node",
36
+ "sourceHandle": "r",
37
+ "target": "n-excel-demo",
38
+ "targetHandle": "l"
39
+ },
40
+ {
41
+ "id": "e2",
42
+ "source": "n-excel-demo",
43
+ "sourceHandle": "r",
44
+ "target": "end-node",
45
+ "targetHandle": "l"
46
+ }
47
+ ]
48
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "flowId": "<平台 flowId>",
3
+ "flowName": "minimal-excel-python",
4
+ "nodes": {
5
+ "00000000-0000-4000-8000-000000000001": {
6
+ "nodeId": "start-node",
7
+ "nodeType": "start"
8
+ },
9
+ "00000000-0000-4000-8000-000000000002": {
10
+ "nodeId": "n-excel-demo",
11
+ "nodeType": "excel-python",
12
+ "dir": "节点/Excel示例",
13
+ "codeFile": "code.py",
14
+ "codeLanguage": "python",
15
+ "codeHash": ""
16
+ },
17
+ "00000000-0000-4000-8000-000000000003": {
18
+ "nodeId": "end-node",
19
+ "nodeType": "end"
20
+ }
21
+ },
22
+ "graphFingerprint": "sha1:example"
23
+ }
@@ -0,0 +1,7 @@
1
+ # -*- coding: utf-8 -*-
2
+ # 示例:excel-python 最小代码(复制到真实流程目录后替换 managed_file_id)
3
+ import pandas as pd
4
+
5
+ OUTPUT_VAR = "示例输出表"
6
+ raw = pd.read_excel(excel_source_path, sheet_name=0)
7
+ set_table_output(OUTPUT_VAR, raw)
@@ -0,0 +1,14 @@
1
+ {
2
+ "_readonly": "示例文件;真实流程由 pull / repair-meta 生成",
3
+ "node_uuid": "00000000-0000-4000-8000-000000000002",
4
+ "nodeId": "n-excel-demo",
5
+ "nodeType": "excel-python",
6
+ "label": "Excel示例",
7
+ "codeFile": "code.py",
8
+ "codeLanguage": "python",
9
+ "data": {
10
+ "type": "excel-python",
11
+ "managed_file_id": "<平台文件 UUID>",
12
+ "output_variable_name": "示例输出表"
13
+ }
14
+ }
@@ -31,6 +31,12 @@
31
31
  "title": "客户分层",
32
32
  "category": "onto-function",
33
33
  "file": "onto/function/profit_fn_customer_segmentation.py"
34
+ },
35
+ {
36
+ "id": "flow/minimal-excel-python",
37
+ "title": "流程目录标准示例(excel-python)",
38
+ "category": "flow",
39
+ "file": "flow/minimal-excel-python/README.md"
34
40
  }
35
41
  ]
36
42
  }
@@ -32,10 +32,10 @@
32
32
 
33
33
  ```bash
34
34
  # 查看表结构
35
- .\scripts\dazi.ps1 data table schema <table-id> --space <space-id>
35
+ dazi data table schema <table-id> --space <space-id>
36
36
 
37
37
  # 采样数据(在 VS Code 侧栏点击表名)
38
- .\scripts\dazi.ps1 data table sample <table-id> --space <space-id> --rows 20
38
+ dazi data table sample <table-id> --space <space-id> --rows 20
39
39
 
40
40
  # 使用 Flow 做批量分析
41
41
  dazi-flow run start <analysis-flow-id>
@@ -0,0 +1,69 @@
1
+ # 流程项目 AI 工作手册(提示词)
2
+
3
+ **文档 ID**: `flow/ai-workflow-playbook`
4
+ **适用**: Cursor / Trae / 任何 Agent 修改 `项目/flow_*/流程/<名>/`
5
+
6
+ > 完整文件规范见资源文档 `flow/local-files-spec`;与 `docs/flow/ai-workflow-playbook.md` 同步维护。
7
+
8
+ ---
9
+
10
+ ## 1. 一分钟决策树
11
+
12
+ ```text
13
+ 要做什么?
14
+ ├─ 新增代码节点 → node new(禁止手搓 uuid)
15
+ ├─ 改 managed_file_id / output_variable_name / 连线 → project push --canvas
16
+ ├─ 改 code.py / code.sql → node push --node <uuid>
17
+ ├─ 目录 doctor 报错 → repair-meta,再 push --canvas / node push
18
+ └─ 运行前 → 先 push 成功,再 flow-exec / node-exec
19
+ ```
20
+
21
+ ---
22
+
23
+ ## 2. 禁止清单
24
+
25
+ 1. **禁止**只编辑 `flow.json` 而不更新 `flow.meta.json`
26
+ 2. **禁止**伪造 `node_uuid`
27
+ 3. **禁止**把 SQL/Python 正文写入 `flow.json`
28
+ 4. **禁止**用 `project push`(无 `--canvas`)提交画布配置
29
+ 5. **禁止**在本地画布节点多于平台时直接 `project pull`(覆盖本地)
30
+ 6. **禁止**未 `push --canvas` 就 `flow-exec` 并声称配置已上线
31
+
32
+ ---
33
+
34
+ ## 3. 标准流程(改现有 excel-python)
35
+
36
+ ```powershell
37
+ cd "项目\flow_xxx\流程\<流程名>"
38
+
39
+ dazi flow project doctor --dir .
40
+ # 若不一致:
41
+ dazi flow project repair-meta --dir .
42
+
43
+ # 改 flow.json 配置后:
44
+ dazi flow project push --dir . --canvas
45
+
46
+ # 改 code.py 后:
47
+ dazi flow node push --node <node_uuid> --dir .
48
+
49
+ dazi flow run node-exec --node <node_uuid> --dir .
50
+ dazi flow run flow-exec --dir . --type debug
51
+ ```
52
+
53
+ 确认终端出现 **`✅ 画布已全量推送`**。
54
+
55
+ ---
56
+
57
+ ## 4. 提交前自检
58
+
59
+ - [ ] `doctor` 为 ✅
60
+ - [ ] 配置变更已 `push --canvas`
61
+ - [ ] 代码变更已 `node push`
62
+ - [ ] `flow.json` 无代码正文
63
+ - [ ] 测试通过后再声称完成
64
+
65
+ ---
66
+
67
+ ## 5. 相关提示词
68
+
69
+ `flow/flow-design`、`flow/run-fix-loop`(⭐)。