@dazitech/cli 3.0.7 → 3.0.9

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 (70) hide show
  1. package/README.md +1 -1
  2. package/dist/clis/dazi-app.js +1 -1
  3. package/dist/clis/dazi-flow.js +1 -1
  4. package/dist/clis/dazi-onto.js +73 -22
  5. package/dist/clis/dazi.js +266 -171
  6. package/dist/docs/flow/flow-project-guide.md +1 -1
  7. package/dist/docs/guides/quickstart.md +18 -4
  8. package/dist/docs/guides/troubleshooting.md +12 -1
  9. package/dist/docs/guides/workspace-v3.md +43 -23
  10. package/dist/docs/index.json +28 -3
  11. package/dist/docs/onto/action-guide.md +3 -3
  12. package/dist/docs/onto/dazi_script_sdk_reference.md +244 -174
  13. package/dist/docs/onto/dazi_script_seed_data_guide.md +158 -155
  14. package/dist/docs/onto/function-guide.md +82 -27
  15. package/dist/docs/onto/space-management.md +3 -1
  16. package/dist/docs/onto//346/234/254/344/275/223/345/210/206/347/261/273/350/247/204/345/210/222/344/270/216SDK/346/211/251/345/261/225/346/226/271/346/241/210.md +168 -0
  17. package/dist/docs/onto//346/234/254/344/275/223/345/221/275/345/220/215/350/247/204/350/214/203_/347/211/251/347/220/206/350/241/250Cube/344/270/216/345/257/271/350/261/241.md +402 -0
  18. 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 +200 -34
  19. package/dist/docs/onto//346/234/254/344/275/223/350/247/204/345/210/222/346/214/207/345/215/227.md +188 -38
  20. package/dist/docs/onto//350/204/232/346/234/254/350/277/220/350/241/214/347/272/240/351/224/231_/345/225/206/345/212/241/346/210/220/346/234/254/346/226/271/346/241/210/345/274/200/345/217/221/350/277/207/347/250/213.md +213 -0
  21. package/dist/docs/onto//350/247/204/345/210/222/347/244/272/344/276/213_/344/272/247/345/223/201/351/224/200/345/224/256/346/234/254/344/275/223/350/247/204/345/210/222/346/226/271/346/241/210.md +620 -0
  22. 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 +680 -541
  23. package/dist/examples/index.json +208 -22
  24. package/dist/examples/onto/README.md +51 -0
  25. package/dist/examples/onto/_templates/ontology_function_template.py +50 -0
  26. package/dist/examples/onto//345/210/251/346/266/246/347/244/272/344/276/213/functions/profit_fn_account_breakdown.py +62 -0
  27. package/dist/examples/onto//345/210/251/346/266/246/347/244/272/344/276/213/functions/profit_fn_budget_vs_actual.py +69 -0
  28. package/dist/examples/onto//345/210/251/346/266/246/347/244/272/344/276/213/functions/profit_fn_cost_center_profit.py +64 -0
  29. package/dist/examples/onto//345/210/251/346/266/246/347/244/272/344/276/213/functions/profit_fn_get_summary.py +61 -0
  30. package/dist/examples/onto//345/210/251/346/266/246/347/244/272/344/276/213/functions/profit_fn_mom_analysis.py +82 -0
  31. package/dist/examples/onto//345/210/251/346/266/246/347/244/272/344/276/213/functions/profit_fn_top_accounts.py +61 -0
  32. package/dist/examples/onto//345/210/251/346/266/246/347/244/272/344/276/213/functions/profit_fn_yoy_analysis.py +79 -0
  33. package/dist/examples/onto//345/210/251/346/266/246/347/244/272/344/276/213/functions/save_test_arguments.ps1 +38 -0
  34. package/dist/examples/onto//345/210/251/346/266/246/347/244/272/344/276/213/functions/test_arguments/profit.fn.account_breakdown.json +1 -0
  35. package/dist/examples/onto//345/210/251/346/266/246/347/244/272/344/276/213/functions/test_arguments/profit.fn.budget_vs_actual.json +1 -0
  36. package/dist/examples/onto//345/210/251/346/266/246/347/244/272/344/276/213/functions/test_arguments/profit.fn.cost_center_profit.json +1 -0
  37. package/dist/examples/onto//345/210/251/346/266/246/347/244/272/344/276/213/functions/test_arguments/profit.fn.get_summary.json +1 -0
  38. package/dist/examples/onto//345/210/251/346/266/246/347/244/272/344/276/213/functions/test_arguments/profit.fn.mom_analysis.json +1 -0
  39. package/dist/examples/onto//345/210/251/346/266/246/347/244/272/344/276/213/functions/test_arguments/profit.fn.top_accounts.json +1 -0
  40. package/dist/examples/onto//345/210/251/346/266/246/347/244/272/344/276/213/functions/test_arguments/profit.fn.yoy_analysis.json +1 -0
  41. package/dist/examples/onto//345/210/251/346/266/246/347/244/272/344/276/213/setup/profit_ontology_init.py +679 -0
  42. package/dist/examples/onto//345/210/251/346/266/246/347/244/272/344/276/213/setup/profit_seed_data.py +216 -0
  43. package/dist/examples/onto//351/224/200/345/224/256/347/244/272/344/276/213/functions/sales_fn_channel_mix.py +89 -0
  44. package/dist/examples/onto//351/224/200/345/224/256/347/244/272/344/276/213/functions/sales_fn_customer_segmentation.py +121 -0
  45. package/dist/examples/onto//351/224/200/345/224/256/347/244/272/344/276/213/functions/sales_fn_get_summary.py +78 -0
  46. package/dist/examples/onto//351/224/200/345/224/256/347/244/272/344/276/213/functions/sales_fn_mom_analysis.py +89 -0
  47. package/dist/examples/onto//351/224/200/345/224/256/347/244/272/344/276/213/functions/sales_fn_region_breakdown.py +84 -0
  48. package/dist/examples/onto//351/224/200/345/224/256/347/244/272/344/276/213/functions/sales_fn_top_products.py +98 -0
  49. package/dist/examples/onto//351/224/200/345/224/256/347/244/272/344/276/213/functions/sales_fn_yoy_analysis.py +87 -0
  50. package/dist/examples/onto//351/224/200/345/224/256/347/244/272/344/276/213/functions/save_test_arguments.ps1 +38 -0
  51. package/dist/examples/onto//351/224/200/345/224/256/347/244/272/344/276/213/functions/test_arguments/sales.fn.channel_mix.json +5 -0
  52. package/dist/examples/onto//351/224/200/345/224/256/347/244/272/344/276/213/functions/test_arguments/sales.fn.customer_segmentation.json +5 -0
  53. package/dist/examples/onto//351/224/200/345/224/256/347/244/272/344/276/213/functions/test_arguments/sales.fn.get_summary.json +5 -0
  54. package/dist/examples/onto//351/224/200/345/224/256/347/244/272/344/276/213/functions/test_arguments/sales.fn.mom_analysis.json +5 -0
  55. package/dist/examples/onto//351/224/200/345/224/256/347/244/272/344/276/213/functions/test_arguments/sales.fn.region_breakdown.json +5 -0
  56. package/dist/examples/onto//351/224/200/345/224/256/347/244/272/344/276/213/functions/test_arguments/sales.fn.top_products.json +5 -0
  57. package/dist/examples/onto//351/224/200/345/224/256/347/244/272/344/276/213/functions/test_arguments/sales.fn.yoy_analysis.json +5 -0
  58. package/dist/examples/onto//351/224/200/345/224/256/347/244/272/344/276/213/setup/sales_ontology_init.py +539 -0
  59. package/dist/examples/onto//351/224/200/345/224/256/347/244/272/344/276/213/setup/sales_seed_data.py +163 -0
  60. package/dist/prompts/index.json +2 -2
  61. package/dist/prompts/onto/action-design.md +4 -1
  62. package/dist/prompts/onto/function-design.md +46 -19
  63. package/dist/prompts/onto/rule-seed.md +5 -1
  64. package/dist/prompts/onto/script-publish-run.md +87 -25
  65. package/package.json +1 -1
  66. package/dist/examples/onto/function/profit_fn_customer_segmentation.py +0 -117
  67. package/dist/examples/onto/function/profit_fn_mom_analysis.py +0 -89
  68. package/dist/examples/onto/function/profit_fn_top_products.py +0 -89
  69. package/dist/examples/onto/function/profit_fn_yoy_analysis.py +0 -89
  70. package/dist/examples/onto/setup/profit_ontology_init.py +0 -388
@@ -1,7 +1,7 @@
1
1
  # 数据流程项目开发指南
2
2
 
3
3
  **文档 ID**: `flow/flow-project-guide`
4
- **适用**: `dazi-vscode` v3.0.5+、`dazi-work` 工作区、业务项目 `项目/<业务名>/`
4
+ **适用**: `dazi-vscode` v3.0.9+、`dazi-work` 工作区、业务项目 `项目/<业务名>/`
5
5
 
6
6
  ---
7
7
 
@@ -17,8 +17,11 @@ code --install-extension dazi-vscode-3.x.x.vsix
17
17
 
18
18
  ### 2. 打开工作区
19
19
 
20
- 将 **`dazi-work`** 文件夹作为 VS Code 工作区根目录打开(含 `项目/`、`资源/`、`scripts/`)。
21
- DRAP 应用项目位于 **`项目/app_<名称>/`**(完整 monorepo,见 [§331](../../docs/331-应用项目多项目与组件重构.md));不再要求根目录必须有 `runtime-apps/`。
20
+ 将 **`dazi-work`** 文件夹作为 VS Code 工作区根目录打开(含 `项目/`、`资源/`、`scripts/`)。
21
+
22
+ 业务项目位于 **`项目/<业务名>/`**,内含固定子目录 `本体/`、`流程/`、`应用/`。
23
+ 本体开发入口为 **`项目/<业务名>/本体/ontos/<实现名>/`**(含 `plans/`、`setup/`、`functions/`;`space_id` 写在 `README.md`)。
24
+ 应用组件位于 **`项目/<业务名>/应用/apps/<app_id>/`**(见 [§331](../../docs/331-应用项目多项目与组件重构.md))。
22
25
 
23
26
  ### 3. 自检 CLI
24
27
 
@@ -49,11 +52,21 @@ dazi auth set-token --token "your-jwt-token"
49
52
 
50
53
  ### 6. 初始化工作区
51
54
 
55
+ **推荐(v3 业务项目 + per-item 本体)**:
56
+
57
+ 1. 命令面板执行 **搭子: 新建业务项目**,创建 `项目/<业务名>/`
58
+ 2. 命令面板执行 **搭子: 新建本体实现**,在 `本体/ontos/<实现名>/` 下生成 `plans/`、`setup/`、`functions/` 及 `快速启动_<实现名>.md`
59
+ 3. 在 `ontos/<实现名>/README.md` 中确认或填写数据空间 ID
60
+
61
+ **兼容(历史 CLI 布局,非日常开发入口)**:
62
+
52
63
  ```powershell
53
- # 新项目(本体空间)
54
64
  dazi onto space init --space-id <your-space-id>
65
+ ```
66
+
67
+ 已有 v2 项目迁移:
55
68
 
56
- # 已有 v2 项目迁移
69
+ ```powershell
57
70
  dazi migrate workspace
58
71
  ```
59
72
 
@@ -72,6 +85,7 @@ dazi auth whoami
72
85
  - [CLI 调用约定](./cli-invocation.md)
73
86
  - [认证管理](../auth/auth-login.md)
74
87
  - [本体开发入门](../onto/space-management.md)
88
+ - [工作区 v3 规范](./workspace-v3.md) — 业务项目目录树与 per-item 本体结构
75
89
  - [数据流程项目开发](../flow/flow-project-guide.md) — **推荐**:`项目/<业务名>/流程/flows/`、菜单、pull/push
76
90
  - [节点代码编写](../flow/node-code-guide.md) — python-script、sql-query 等
77
91
  - [流程开发索引](../flow/flows-guide.md) — Flow 文档入口
@@ -84,7 +84,7 @@ dazi doctor --workspace-root D:\path\to\dazi-work
84
84
  检查 `.cursor/mcp.json` 配置。MCP 需能调用 bundled CLI,示例:
85
85
 
86
86
  ```powershell
87
- $env:DAZI_BUNDLED_DIR = "$env:USERPROFILE\.cursor\extensions\dazitech.dazi-vscode-3.0.5\bundled\clis"
87
+ $env:DAZI_BUNDLED_DIR = "$env:USERPROFILE\.cursor\extensions\dazitech.dazi-vscode-3.0.9\bundled\clis"
88
88
  node "$env:DAZI_BUNDLED_DIR\dazi.js" mcp stdio
89
89
  ```
90
90
 
@@ -99,3 +99,14 @@ pnpm run dazi-app -- --version
99
99
  ```
100
100
 
101
101
  应用 CLI 由 bundled + 启动器提供,**不需要** monorepo 源码。
102
+
103
+ ## 本体脚本:发布 / 运行 / test_arguments
104
+
105
+ | 现象 | 原因 | 处理 |
106
+ | ---- | ---- | ---- |
107
+ | init 报 `sync_metrics` / `cubes` 不存在 | API 误用 | 见 [脚本运行纠错](../onto/脚本运行纠错_商务成本方案开发过程.md) §1 |
108
+ | 函数聚合 SQL 报 `float` 无 `.get()` | `query_one` 用于多列聚合 | 改用 `query()` 取 `rows[0]`,见纠错文档 §2 |
109
+ | `function run --arguments-json-file` unknown | 该子命令不支持此参数 | 先 `save-test-arguments`,再 `function run <function_id>` |
110
+ | `save-test-arguments` 404 | 传了 `function_id` 而非 `ofn_xxx` | `dazi onto function list` 取内部 `id` |
111
+
112
+ 完整 CLI 清单与商务成本方案实录:`dazi docs show onto/script-run-troubleshooting`(`dazi docs sync` 后位于 `资源/docs/onto/`)。
@@ -2,52 +2,72 @@
2
2
 
3
3
  **文档 ID**: `guides/workspace-v3`
4
4
  **适用版本**: dazi-vscode v3.0+
5
- **最后更新**: 2026-05-28(应用项目 `项目/app_*`)
5
+ **最后更新**: 2026-06-05(业务项目 + per-item 本体结构)
6
6
 
7
7
  ## 目录结构(搭子工作区,如 dazi-work)
8
8
 
9
9
  ```text
10
10
  <workspace>/
11
11
  ├── 项目/
12
- ├── onto_<名称>/ 本体项目(规划、脚本、快速启动)
13
- └── app_<名称>/ ← ★ 应用项目 = DRAP monorepo(sdk、templates、apps)
14
- ├── 资源/ ← 帮助文档、提示词等(dazi docs sync)
15
- ├── scripts/ ← dazi.ps1、doctor-cli(终端 CLI 包装)
16
- ├── tools/dazi-clis/ 可选:离线 bundled CLI 副本
17
- └── (可选)runtime-apps/ ← 兼容旧布局;可与 项目/app_* 并存
12
+ └── <业务名>/ 业务项目(固定子目录:本体、流程、应用)
13
+ ├── README.md
14
+ ├── 本体/
15
+ │ │ ├── README.md
16
+ │ │ ├── onto-assets/ 平台元数据缓存(侧栏懒拉取)
17
+ │ │ └── ontos/
18
+ │ │ └── <实现名>/ ← ★ 本体实现工作单元
19
+ │ │ ├── README.md ← space_id(权威)
20
+ │ │ ├── 快速启动_<实现名>.md
21
+ │ │ ├── plans/ ← 本实现规划
22
+ │ │ ├── setup/ ← init / seed 脚本
23
+ │ │ └── functions/ ← 本体函数
24
+ │ ├── 流程/
25
+ │ │ ├── plans/
26
+ │ │ └── flows/<流程名>/...
27
+ │ └── 应用/
28
+ │ ├── plans/
29
+ │ └── apps/<组件名>/...
30
+ ├── 资源/ ← 帮助文档、提示词等(dazi docs sync)
31
+ ├── scripts/ ← dazi.ps1、doctor-cli(终端 CLI 包装)
32
+ ├── tools/dazi-clis/ ← 可选:离线 bundled CLI 副本
33
+ └── (可选)runtime-apps/ ← 兼容旧布局
18
34
  ```
19
35
 
20
- > v3.1+ **推荐**在 `项目/app_<名称>/` 下维护 DRAP,由扩展「新建应用项目」生成。详见 [§331](../../docs/331-应用项目多项目与组件重构.md)。
36
+ > v3.1+ 应用项目位于 `项目/<业务名>/应用/apps/<组件名>/`。详见 [§331](../../docs/331-应用项目多项目与组件重构.md)。
21
37
 
22
38
  ## 目录说明
23
39
 
24
- | 路径 | 对应 CLI | 用途 |
25
- | -------------------------------- | ------------------------------------------ | -------------------------------------- |
26
- | `项目/onto_<名称>/` | `dazi onto ...` | 本体规划、脚本、发布 |
27
- | `项目/app_<名称>/` | `pnpm run dazi-app -- ...`(在应用项目根) | DRAP monorepo;组件在 `apps/<app_id>/` |
28
- | `项目/app_<名称>/apps/<app_id>/` | 同上 + `--cwd apps/<app_id>` | 单个应用组件源码 |
29
- | `资源/docs/` | `dazi docs ...` | 同步后的内置文档 |
30
- | `scripts/` | `dazi ...` | 本体/流程/鉴权/数据(非 DRAP) |
31
- | `~/.dazi/auth.json` | 共享 | 登录凭据(扩展与 CLI 共用) |
40
+ | 路径 | 对应 CLI | 用途 |
41
+ | ---------------------------------------------------------- | ------------------------------------------ | -------------------------------------- |
42
+ | `项目/<业务名>/本体/ontos/<实现名>/` | `dazi onto ...` | 本体规划、脚本、发布(per-item spaceId) |
43
+ | `项目/<业务名>/本体/onto-assets/` | `dazi onto ...` | 平台对象/函数/动作/规则缓存 |
44
+ | `项目/<业务名>/流程/flows/<流程名>/` | `dazi flow ...` | 数据流程定义与节点代码 |
45
+ | `项目/<业务名>/应用/apps/<app_id>/` | `pnpm run dazi-app -- ...`(在应用项目根) | DRAP 应用组件源码 |
46
+ | `资源/docs/` | `dazi docs ...` | 同步后的内置文档 |
47
+ | `scripts/` | `dazi ...` | 本体/流程/鉴权/数据(非 DRAP) |
48
+ | `~/.dazi/auth.json` | 共享 | 登录凭据(扩展与 CLI 共用) |
32
49
 
33
50
  ## 扩展侧栏对应
34
51
 
35
- | 侧栏 | 工作区路径 |
36
- | -------- | ----------------------------------------- |
37
- | 本体 | `项目/onto_*` |
38
- | App 应用 | `项目/app_*`(monorepo)→ `apps/<app_id>` |
39
- | 数据资源 | 平台数据空间(非目录) |
52
+ | 侧栏 | 工作区路径 |
53
+ | -------- | ------------------------------------------------------- |
54
+ | 本体 | `项目/<业务名>/本体/ontos/<实现名>/` → plans/setup/functions |
55
+ | 流程 | `项目/<业务名>/流程/flows/<流程名>/` |
56
+ | App 应用 | `项目/<业务名>/应用/apps/<app_id>/` |
57
+ | 数据资源 | 平台数据空间(非目录) |
40
58
 
41
59
  ## v2 → v3 目录映射
42
60
 
43
61
  | v2 | v3(搭子工作区) |
44
62
  | ----------------------- | ---------------------------------------------------------------- |
45
- | `ontology/` | `项目/onto_*` |
46
- | `runtime-apps/apps/*` | `项目/app_*/apps/*`(推荐)或 `<ws>/runtime-apps/apps/*`(兼容) |
63
+ | `ontology/` | `项目/<业务名>/本体/ontos/<实现名>/` |
64
+ | `项目/onto_<名称>/` | `项目/<业务名>/本体/ontos/<实现名>/`(并入业务项目) |
65
+ | `runtime-apps/apps/*` | `项目/<业务名>/应用/apps/*`(推荐)或 `<ws>/runtime-apps/apps/*`(兼容) |
47
66
  | `.dazi-agent/auth.json` | `~/.dazi/auth.json` |
48
67
 
49
68
  ## 相关文档
50
69
 
51
70
  - [§331 应用项目多项目与组件重构](../../docs/331-应用项目多项目与组件重构.md)
52
71
  - [§333 本轮扩展总结](../../docs/333-dazi-vscode应用项目多项目与本轮优化总结.md)
72
+ - [§346 本体结构对齐开发方案](../../docs/346-dazi-vscode本体结构对齐开发方案.md)
53
73
  - [CLI 调用约定](./cli-invocation.md)
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "3.0.5",
3
- "updatedAt": "2026-05-29T00:00:00.000Z",
2
+ "version": "3.0.9",
3
+ "updatedAt": "2026-06-06T12:00:00.000Z",
4
4
  "docs": [
5
5
  {
6
6
  "id": "guides/quickstart",
@@ -86,12 +86,30 @@
86
86
  "category": "onto",
87
87
  "file": "onto/本体规划指南.md"
88
88
  },
89
+ {
90
+ "id": "onto/naming-conventions",
91
+ "title": "本体命名规范(物理表 · Cube · 对象)",
92
+ "category": "onto",
93
+ "file": "onto/本体命名规范_物理表Cube与对象.md"
94
+ },
95
+ {
96
+ "id": "onto/category-taxonomy-sdk",
97
+ "title": "349 · 本体分类规划与 SDK 扩展方案",
98
+ "category": "onto",
99
+ "file": "onto/本体分类规划与SDK扩展方案.md"
100
+ },
89
101
  {
90
102
  "id": "onto/planning-example-profit",
91
- "title": "规划示例:利润分析本体",
103
+ "title": "规划示例:利润分析本体(GL 域)",
92
104
  "category": "onto",
93
105
  "file": "onto/规划示例_利润分析本体方案.md"
94
106
  },
107
+ {
108
+ "id": "onto/planning-example-sales",
109
+ "title": "规划示例:产品销售本体",
110
+ "category": "onto",
111
+ "file": "onto/规划示例_产品销售本体规划方案.md"
112
+ },
95
113
  {
96
114
  "id": "onto/script-authoring",
97
115
  "title": "本体脚本编写指南(含发布)",
@@ -110,6 +128,13 @@
110
128
  "category": "onto",
111
129
  "file": "onto/dazi_script_seed_data_guide.md"
112
130
  },
131
+ {
132
+ "id": "onto/script-run-troubleshooting",
133
+ "title": "【必读】脚本运行纠错(商务成本实录)",
134
+ "category": "onto",
135
+ "file": "onto/脚本运行纠错_商务成本方案开发过程.md",
136
+ "featured": true
137
+ },
113
138
  {
114
139
  "id": "flow/local-files-spec",
115
140
  "title": "流程本地文件规范与示例",
@@ -18,16 +18,16 @@ dazi onto action list --space <space-id>
18
18
 
19
19
  ## 发布 Action
20
20
 
21
- 脚本放在 **`项目/onto_<项目名>/脚本/`**(可与函数脚本同目录,用文件名区分):
21
+ 脚本放在 **`项目/<业务名>/本体/ontos/<实现名>/functions/`**(可与函数脚本同目录,用文件名区分):
22
22
 
23
23
  ```bash
24
- dazi onto script publish 项目/onto_<项目名>/脚本/my_action.py \
24
+ dazi onto script publish 项目/<业务名>/本体/ontos/<实现名>/functions/my_action.py \
25
25
  --space <space-id> \
26
26
  --register-action-id my_action_code \
27
27
  --register-action-permission-tag "finance.write"
28
28
  ```
29
29
 
30
- `<space-id>` 取自项目 **`README.md`**。
30
+ `<space-id>` 取自实现单元 **`README.md`**(`项目/<业务名>/本体/ontos/<实现名>/README.md`)。
31
31
 
32
32
  ## 更新 Action 代码
33
33