@dazitech/cli 3.0.0 → 3.0.2

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 (60) hide show
  1. package/README.md +16 -14
  2. package/dist/clis/dazi-app.js +95 -14
  3. package/dist/clis/dazi-flow.js +602 -172
  4. package/dist/clis/dazi-onto.js +5 -3
  5. package/dist/clis/dazi.js +139 -38
  6. package/dist/docs/app/app-init.md +15 -15
  7. package/dist/docs/app/build-upload.md +13 -13
  8. package/dist/docs/app/release-guide.md +9 -9
  9. 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
  10. package/dist/docs/auth/auth-login.md +4 -4
  11. package/dist/docs/auth/token-management.md +5 -5
  12. package/dist/docs/data/cube-guide.md +2 -2
  13. package/dist/docs/data/data-spaces.md +4 -3
  14. package/dist/docs/data/table-preview.md +6 -6
  15. package/dist/docs/flow/ai-workflow-playbook.md +69 -0
  16. package/dist/docs/flow/flow-project-guide.md +92 -87
  17. package/dist/docs/flow/flows-guide.md +98 -94
  18. package/dist/docs/flow/local-files-spec.md +194 -0
  19. package/dist/docs/flow/node-code-guide.md +57 -55
  20. package/dist/docs/flow/run-guide.md +18 -18
  21. package/dist/docs/flow/variables-guide.md +61 -61
  22. 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
  23. package/dist/docs/guides/cli-invocation.md +30 -29
  24. package/dist/docs/guides/cli-reference.md +72 -71
  25. package/dist/docs/guides/flow-consistency-checklist.md +42 -0
  26. package/dist/docs/guides/mcp-setup.md +34 -34
  27. package/dist/docs/guides/migrate-v2-v3.md +6 -5
  28. package/dist/docs/guides/quickstart.md +8 -8
  29. package/dist/docs/guides/troubleshooting.md +40 -22
  30. package/dist/docs/guides/workspace-v3.md +17 -17
  31. package/dist/docs/index.json +19 -7
  32. package/dist/docs/onto/action-guide.md +4 -3
  33. package/dist/docs/onto/dazi_script_sdk_reference.md +20 -14
  34. package/dist/docs/onto/dazi_script_seed_data_guide.md +14 -14
  35. package/dist/docs/onto/function-guide.md +5 -5
  36. package/dist/docs/onto/rule-guide.md +7 -6
  37. package/dist/docs/onto/space-management.md +5 -3
  38. 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
  39. 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
  40. 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
  41. package/dist/examples/flow/minimal-excel-python/README.md +5 -0
  42. package/dist/examples/flow/minimal-excel-python/flow.json +48 -0
  43. package/dist/examples/flow/minimal-excel-python/flow.meta.json +23 -0
  44. package/dist/examples/flow/minimal-excel-python//350/212/202/347/202/271/Excel/347/244/272/344/276/213/code.py +7 -0
  45. 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
  46. package/dist/examples/index.json +7 -1
  47. package/dist/prompts/data/data-analysis.md +2 -2
  48. package/dist/prompts/flow/ai-workflow-playbook.md +69 -0
  49. package/dist/prompts/flow/flow-design.md +33 -19
  50. package/dist/prompts/flow/plan-generate.md +7 -7
  51. package/dist/prompts/flow/run-debug.md +15 -15
  52. package/dist/prompts/flow/run-fix-loop.md +20 -17
  53. package/dist/prompts/general/ask-dazi.md +6 -6
  54. package/dist/prompts/general/troubleshoot.md +4 -3
  55. package/dist/prompts/index.json +94 -15
  56. package/dist/prompts/onto/action-design.md +7 -5
  57. package/dist/prompts/onto/function-design.md +6 -4
  58. package/dist/prompts/onto/rule-seed.md +4 -2
  59. package/dist/prompts/onto/script-publish-run.md +19 -19
  60. package/package.json +1 -1
@@ -10,14 +10,14 @@
10
10
 
11
11
  ## 1. 适用场景
12
12
 
13
- | 项 | 说明 |
14
- |----|------|
15
- | 报表形态 | 多级表头 + 宽表(年度列 + 分月列) |
16
- | 典型列 | 类别、指标名称、2017–2022 年、2021/2022/2023 分月 |
17
- | 交互 | 表头固定、左侧两列冻结、类别纵向合并、条件行样式 |
18
- | 组件 | `@dazi/app-sdk-ui` → `ComplexReport` |
19
- | 布局 | RLIR(`报表布局.json`)→ `manifest.report_design.layout_snapshot` |
20
- | 数据 | 开发 `static`;上线 `sql_template` / `ontology_function` |
13
+ | 项 | 说明 |
14
+ | -------- | ----------------------------------------------------------------- |
15
+ | 报表形态 | 多级表头 + 宽表(年度列 + 分月列) |
16
+ | 典型列 | 类别、指标名称、2017–2022 年、2021/2022/2023 分月 |
17
+ | 交互 | 表头固定、左侧两列冻结、类别纵向合并、条件行样式 |
18
+ | 组件 | `@dazi/app-sdk-ui` → `ComplexReport` |
19
+ | 布局 | RLIR(`报表布局.json`)→ `manifest.report_design.layout_snapshot` |
20
+ | 数据 | 开发 `static`;上线 `sql_template` / `ontology_function` |
21
21
 
22
22
  ---
23
23
 
@@ -25,13 +25,13 @@
25
25
 
26
26
  ### 2.1 命令行(推荐)
27
27
 
28
- 在 **`dazi-work` 根**使用 `.\scripts\dazi.ps1 app`(自动解析 bundled CLI,最稳):
28
+ 在 **`dazi-work` 根**使用 `dazi app`(自动解析 bundled CLI,最稳):
29
29
 
30
30
  ```powershell
31
31
  cd D:\path\to\dazi-work
32
32
 
33
33
  # 初始化应用(将 my-fin-report-001、app_<名> 换成你的路径)
34
- .\scripts\dazi.ps1 app init financial-indicators-complex-report `
34
+ dazi app init financial-indicators-complex-report `
35
35
  --space space__0519 `
36
36
  --dir 项目/app_<名>/apps/my-fin-report-001
37
37
  ```
@@ -68,7 +68,7 @@ src/fixtures/generated/*.json
68
68
  ↓ 本地验收
69
69
  pnpm run dev
70
70
  ↓ 发布
71
- pnpm run build → .\scripts\dazi.ps1 app upload --activate(在 dazi-work 根,带 --cwd)
71
+ pnpm run build → dazi app upload --activate(在 dazi-work 根,带 --cwd)
72
72
  ```
73
73
 
74
74
  VS Code 分步说明见应用内 `.ai/implement-from-managed-file.md`。
@@ -128,20 +128,24 @@ const ds = useReportDataset({ visibleFields, wideTable: layout.wideTable });
128
128
  dataset={ds.data}
129
129
  maxHeight={640}
130
130
  onVisibleFieldsChange={handleVisibleFieldsChange}
131
- pagination={{ page: ds.page, pageSize: ds.pageSize, onPageChange: ds.setPage }}
132
- />
131
+ pagination={{
132
+ page: ds.page,
133
+ pageSize: ds.pageSize,
134
+ onPageChange: ds.setPage,
135
+ }}
136
+ />;
133
137
  ```
134
138
 
135
139
  `handleVisibleFieldsChange` 须 `useCallback`,并用 `join("\0")` 比较列集合,避免无意义重渲染。
136
140
 
137
141
  ### 5.2 业务规则(模板默认)
138
142
 
139
- | 规则 | 配置 |
140
- |------|------|
141
- | 类别合并 | `category` 列 `rowMerge: true` |
142
- | 利润总额加粗 | `features.rowEmphasis` → 指标含「利润总额」 |
143
+ | 规则 | 配置 |
144
+ | -------------------- | ------------------------------------------------- |
145
+ | 类别合并 | `category` 列 `rowMerge: true` |
146
+ | 利润总额加粗 | `features.rowEmphasis` → 指标含「利润总额」 |
143
147
  | 万元产值综合能耗标红 | `features.rowDanger` → 指标含「万元产值综合能耗」 |
144
- | 数值格式 | 除类别/指标外 `format: "number"` |
148
+ | 数值格式 | 除类别/指标外 `format: "number"` |
145
149
 
146
150
  ### 5.3 应用级样式
147
151
 
@@ -153,11 +157,11 @@ const ds = useReportDataset({ visibleFields, wideTable: layout.wideTable });
153
157
 
154
158
  ### 6.1 开发阶段
155
159
 
156
- | 文件 | 用途 |
157
- |------|------|
158
- | `generated/reportRows.json` | 静态样例行 |
159
- | `datasets.ts` | 包装为 `report_data` |
160
- | `manifest.data_sources` | `kind: static` |
160
+ | 文件 | 用途 |
161
+ | --------------------------- | -------------------- |
162
+ | `generated/reportRows.json` | 静态样例行 |
163
+ | `datasets.ts` | 包装为 `report_data` |
164
+ | `manifest.data_sources` | `kind: static` |
161
165
 
162
166
  建议 `refresh.on_mount: false`,由宿主首次注入 + 本地投影,避免重复请求。
163
167
 
@@ -207,13 +211,13 @@ SQL / 资产放在 `drap-assets/`,勿把 Excel 放进 `drap-assets/report-desi
207
211
 
208
212
  ## 8. 常见问题
209
213
 
210
- | 现象 | 原因 | 处理 |
211
- |------|------|------|
212
- | 分月表头错位 | `leaf:false` 父列未过滤 | `normalizeReportLayout` |
213
- | 类别未合并 | 未配置 `rowMerge` | `category` 列开启 |
214
- | 行样式无效 | `features` 未写入 layout | manifest 或 normalize 补全 |
215
- | 页面狂刷接口 | refetch 循环 / 未部署 SDK 补丁 | 见 §7.1,重建并发布 |
216
- | 运行时无数据 | 未绑定设计稿或未写快照 | 绑定 + 发布快照 |
214
+ | 现象 | 原因 | 处理 |
215
+ | ------------ | ------------------------------ | -------------------------- |
216
+ | 分月表头错位 | `leaf:false` 父列未过滤 | `normalizeReportLayout` |
217
+ | 类别未合并 | 未配置 `rowMerge` | `category` 列开启 |
218
+ | 行样式无效 | `features` 未写入 layout | manifest 或 normalize 补全 |
219
+ | 页面狂刷接口 | refetch 循环 / 未部署 SDK 补丁 | 见 §7.1,重建并发布 |
220
+ | 运行时无数据 | 未绑定设计稿或未写快照 | 绑定 + 发布快照 |
217
221
 
218
222
  ---
219
223
 
@@ -225,8 +229,8 @@ SQL / 资产放在 `drap-assets/`,勿把 Excel 放进 `drap-assets/report-desi
225
229
  - [ ] `manifest.report_design` 含 `managed_file_id` 与 `layout_snapshot`
226
230
  - [ ] `pnpm run dev` 验收:表头、合并、冻结列、行样式、无接口风暴
227
231
  - [ ] `pnpm run build`
228
- - [ ] `.\scripts\dazi.ps1 app manifest validate --scan-src`(`--cwd` 指向组件目录)
229
- - [ ] `.\scripts\dazi.ps1 app upload --activate`(在 dazi-work 根)
232
+ - [ ] `dazi app manifest validate --scan-src`(`--cwd` 指向组件目录)
233
+ - [ ] `dazi app upload --activate`(在 dazi-work 根)
230
234
  - [ ] 主站 frontend 已部署(含 static 本地投影)
231
235
 
232
236
  ---
@@ -241,21 +245,21 @@ pnpm run build
241
245
 
242
246
  # 校验与发布:在 dazi-work 根
243
247
  cd D:\path\to\dazi-work
244
- .\scripts\dazi.ps1 app manifest validate --cwd 项目/app_<名>/apps/my-fin-report-001 --scan-src
245
- .\scripts\dazi.ps1 app upload --cwd 项目/app_<名>/apps/my-fin-report-001 --space space__0519 --activate
248
+ dazi app manifest validate --cwd 项目/app_<名>/apps/my-fin-report-001 --scan-src
249
+ dazi app upload --cwd 项目/app_<名>/apps/my-fin-report-001 --space space__0519 --activate
246
250
  ```
247
251
 
248
252
  ---
249
253
 
250
254
  ## 11. 相关文档
251
255
 
252
- | 文档 | 说明 |
253
- |------|------|
254
- | [337-中国式复杂报表开发方案.md](../337-中国式复杂报表开发方案.md) | 平台架构与 Phase 规划 |
255
- | [问题和分析/复杂报表记录.md](../问题和分析/复杂报表记录.md) | 线上问题排查记录 |
256
- | `dazi-vscode/docs/app/release-guide.md` | 应用发布总览 |
257
- | 模板 `README.md` | `runtime-apps/templates/app-template-financial-indicators-complex-report/` |
256
+ | 文档 | 说明 |
257
+ | ----------------------------------------------------------------- | -------------------------------------------------------------------------- |
258
+ | [337-中国式复杂报表开发方案.md](../337-中国式复杂报表开发方案.md) | 平台架构与 Phase 规划 |
259
+ | [问题和分析/复杂报表记录.md](../问题和分析/复杂报表记录.md) | 线上问题排查记录 |
260
+ | `dazi-vscode/docs/app/release-guide.md` | 应用发布总览 |
261
+ | 模板 `README.md` | `runtime-apps/templates/app-template-financial-indicators-complex-report/` |
258
262
 
259
263
  ---
260
264
 
261
- *文档版本:2026-05-31 · 基于 complex-report-003 实践整理,对应模板 financial-indicators-complex-report*
265
+ _文档版本:2026-05-31 · 基于 complex-report-003 实践整理,对应模板 financial-indicators-complex-report_
@@ -7,7 +7,7 @@
7
7
  ### Token 登录(推荐 CI/CD)
8
8
 
9
9
  ```bash
10
- .\scripts\dazi.ps1 auth set-token --token "eyJ..."
10
+ dazi auth set-token --token "eyJ..."
11
11
  ```
12
12
 
13
13
  Token 存储在 `~/.dazi/auth.json`,可在多个项目间共享。
@@ -15,13 +15,13 @@ Token 存储在 `~/.dazi/auth.json`,可在多个项目间共享。
15
15
  ### 用户名密码登录
16
16
 
17
17
  ```bash
18
- .\scripts\dazi.ps1 auth login --username your@email.com --password yourpassword
18
+ dazi auth login --username your@email.com --password yourpassword
19
19
  ```
20
20
 
21
21
  ### 验证登录状态
22
22
 
23
23
  ```bash
24
- .\scripts\dazi.ps1 auth whoami
24
+ dazi auth whoami
25
25
  ```
26
26
 
27
27
  ## 多环境支持
@@ -30,7 +30,7 @@ Token 存储在 `~/.dazi/auth.json`,可在多个项目间共享。
30
30
 
31
31
  ```powershell
32
32
  $env:DAZI_BASE_URL = "https://staging.dazi.tech"
33
- .\scripts\dazi.ps1 auth whoami
33
+ dazi auth whoami
34
34
  ```
35
35
 
36
36
  或在 `.env` 文件中配置:
@@ -19,10 +19,10 @@ Token 存储在 `~/.dazi/auth.json`,格式:
19
19
 
20
20
  ```bash
21
21
  # 预览
22
- .\scripts\dazi.ps1 auth migrate --dry-run
22
+ dazi auth migrate --dry-run
23
23
 
24
24
  # 执行(从 ~/.dazi-app/auth.json 迁移)
25
- .\scripts\dazi.ps1 auth migrate
25
+ dazi auth migrate
26
26
  ```
27
27
 
28
28
  ## Token 刷新
@@ -30,13 +30,13 @@ Token 存储在 `~/.dazi/auth.json`,格式:
30
30
  Token 过期后重新登录,旧 Token 自动覆盖:
31
31
 
32
32
  ```bash
33
- .\scripts\dazi.ps1 auth login
33
+ dazi auth login
34
34
  # 或
35
- .\scripts\dazi.ps1 auth set-token --token "<new-token>"
35
+ dazi auth set-token --token "<new-token>"
36
36
  ```
37
37
 
38
38
  ## 清除 Token
39
39
 
40
40
  ```bash
41
- .\scripts\dazi.ps1 auth logout
41
+ dazi auth logout
42
42
  ```
@@ -9,13 +9,13 @@ Cube 是预聚合的数据集,基于数据表或视图构建,支持快速查
9
9
  ## 列出 Cube
10
10
 
11
11
  ```bash
12
- .\scripts\dazi.ps1 data cube list --space <space-id>
12
+ dazi data cube list --space <space-id>
13
13
  ```
14
14
 
15
15
  ## 查看 Cube 详情
16
16
 
17
17
  ```bash
18
- .\scripts\dazi.ps1 data cube info <cube-id> --space <space-id>
18
+ dazi data cube info <cube-id> --space <space-id>
19
19
  ```
20
20
 
21
21
  ## 在扩展中使用
@@ -5,24 +5,25 @@
5
5
  ## 列出数据空间
6
6
 
7
7
  ```bash
8
- .\scripts\dazi.ps1 data space list
8
+ dazi data space list
9
9
  ```
10
10
 
11
11
  ## 创建数据空间
12
12
 
13
13
  ```bash
14
- .\scripts\dazi.ps1 data space create --name "财务数据" --category-id finance
14
+ dazi data space create --name "财务数据" --category-id finance
15
15
  ```
16
16
 
17
17
  ## 刷新数据空间
18
18
 
19
19
  ```bash
20
- .\scripts\dazi.ps1 data space refresh <space-id>
20
+ dazi data space refresh <space-id>
21
21
  ```
22
22
 
23
23
  ## 扩展侧栏
24
24
 
25
25
  在 VS Code 侧栏「🗂 数据资源」节点下,按空间分组展示:
26
+
26
27
  - 数据表(Tables)
27
28
  - 数据集(Cubes)
28
29
  - 数据源(Sources)
@@ -5,19 +5,19 @@
5
5
  ## 列出数据表
6
6
 
7
7
  ```bash
8
- .\scripts\dazi.ps1 data table list --space <space-id>
8
+ dazi data table list --space <space-id>
9
9
  ```
10
10
 
11
11
  ## 查看表结构
12
12
 
13
13
  ```bash
14
- .\scripts\dazi.ps1 data table schema <table-id> --space <space-id>
14
+ dazi data table schema <table-id> --space <space-id>
15
15
  ```
16
16
 
17
17
  ## 采样数据
18
18
 
19
19
  ```bash
20
- .\scripts\dazi.ps1 data table sample <table-id> --space <space-id> --rows 10
20
+ dazi data table sample <table-id> --space <space-id> --rows 10
21
21
  ```
22
22
 
23
23
  ## 在扩展中预览
@@ -31,11 +31,11 @@
31
31
 
32
32
  ```bash
33
33
  # 列出平台文件
34
- .\scripts\dazi.ps1 data file list --space <space-id>
34
+ dazi data file list --space <space-id>
35
35
 
36
36
  # 上传本地文件
37
- .\scripts\dazi.ps1 data file upload ./data.csv --space <space-id>
37
+ dazi data file upload ./data.csv --space <space-id>
38
38
 
39
39
  # 下载文件
40
- .\scripts\dazi.ps1 data file pull remote/path.csv --space <space-id>
40
+ dazi data file pull remote/path.csv --space <space-id>
41
41
  ```
@@ -0,0 +1,69 @@
1
+ # 流程项目 AI 工作手册
2
+
3
+ **文档 ID**: `flow/ai-workflow-playbook`
4
+ **适用**: Cursor / Trae / 任何 Agent 修改 `项目/flow_*/流程/<名>/`
5
+
6
+ > 完整文件规范见 [流程本地文件规范](./local-files-spec.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`(⭐)。