@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.
- package/README.md +16 -14
- package/dist/clis/dazi-app.js +95 -14
- package/dist/clis/dazi-flow.js +602 -172
- package/dist/clis/dazi-onto.js +5 -3
- package/dist/clis/dazi.js +139 -38
- package/dist/docs/app/app-init.md +15 -15
- package/dist/docs/app/build-upload.md +13 -13
- package/dist/docs/app/release-guide.md +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
- package/dist/docs/auth/auth-login.md +4 -4
- package/dist/docs/auth/token-management.md +5 -5
- package/dist/docs/data/cube-guide.md +2 -2
- package/dist/docs/data/data-spaces.md +4 -3
- package/dist/docs/data/table-preview.md +6 -6
- package/dist/docs/flow/ai-workflow-playbook.md +69 -0
- package/dist/docs/flow/flow-project-guide.md +92 -87
- package/dist/docs/flow/flows-guide.md +98 -94
- package/dist/docs/flow/local-files-spec.md +194 -0
- package/dist/docs/flow/node-code-guide.md +57 -55
- package/dist/docs/flow/run-guide.md +18 -18
- package/dist/docs/flow/variables-guide.md +61 -61
- 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
- package/dist/docs/guides/cli-invocation.md +30 -29
- package/dist/docs/guides/cli-reference.md +72 -71
- package/dist/docs/guides/flow-consistency-checklist.md +42 -0
- package/dist/docs/guides/mcp-setup.md +34 -34
- package/dist/docs/guides/migrate-v2-v3.md +6 -5
- package/dist/docs/guides/quickstart.md +8 -8
- package/dist/docs/guides/troubleshooting.md +40 -22
- package/dist/docs/guides/workspace-v3.md +17 -17
- package/dist/docs/index.json +19 -7
- package/dist/docs/onto/action-guide.md +4 -3
- package/dist/docs/onto/dazi_script_sdk_reference.md +20 -14
- package/dist/docs/onto/dazi_script_seed_data_guide.md +14 -14
- package/dist/docs/onto/function-guide.md +5 -5
- package/dist/docs/onto/rule-guide.md +7 -6
- package/dist/docs/onto/space-management.md +5 -3
- 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
- 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
- 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
- package/dist/examples/flow/minimal-excel-python/README.md +5 -0
- package/dist/examples/flow/minimal-excel-python/flow.json +48 -0
- package/dist/examples/flow/minimal-excel-python/flow.meta.json +23 -0
- package/dist/examples/flow/minimal-excel-python//350/212/202/347/202/271/Excel/347/244/272/344/276/213/code.py +7 -0
- 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
- package/dist/examples/index.json +7 -1
- package/dist/prompts/data/data-analysis.md +2 -2
- package/dist/prompts/flow/ai-workflow-playbook.md +69 -0
- package/dist/prompts/flow/flow-design.md +33 -19
- package/dist/prompts/flow/plan-generate.md +7 -7
- package/dist/prompts/flow/run-debug.md +15 -15
- package/dist/prompts/flow/run-fix-loop.md +20 -17
- package/dist/prompts/general/ask-dazi.md +6 -6
- package/dist/prompts/general/troubleshoot.md +4 -3
- package/dist/prompts/index.json +94 -15
- package/dist/prompts/onto/action-design.md +7 -5
- package/dist/prompts/onto/function-design.md +6 -4
- package/dist/prompts/onto/rule-seed.md +4 -2
- package/dist/prompts/onto/script-publish-run.md +19 -19
- package/package.json +1 -1
|
@@ -18,46 +18,60 @@
|
|
|
18
18
|
3. 明确每个代码节点应写入哪个文件(`节点/<名>/code.sql|py`)
|
|
19
19
|
4. 给出最短执行命令链(拉取/测试/提交)
|
|
20
20
|
|
|
21
|
+
## 本地文件契约(必须遵守)
|
|
22
|
+
|
|
23
|
+
必读帮助文档:**`flow/local-files-spec`**、**`flow/ai-workflow-playbook`**。
|
|
24
|
+
|
|
25
|
+
| 文件 | 规则 |
|
|
26
|
+
|------|------|
|
|
27
|
+
| `flow.json` | 画布与节点配置(`managed_file_id` 等);禁止手搓 `node_uuid` |
|
|
28
|
+
| `flow.meta.json` | 仅由 `pull` / `node new` / `repair-meta` 维护;设计器靠它打开代码 |
|
|
29
|
+
| `节点/<名>/code.*` | 代码正文唯一位置 |
|
|
30
|
+
|
|
31
|
+
**禁止**:只改 `flow.json` 而不更新 meta(会导致打不开代码、`node push` 跳过)。
|
|
32
|
+
|
|
21
33
|
## 命令与环境约束(必须遵守)
|
|
22
34
|
|
|
23
|
-
- 默认在 **`dazi-work`
|
|
35
|
+
- 默认在 **`dazi-work` 根目录**执行,命令前缀统一:`dazi flow ...`
|
|
24
36
|
- 进入流程目录后可继续带 `--dir .`,不要省略关键参数
|
|
25
|
-
- `flow.
|
|
26
|
-
-
|
|
37
|
+
- 修改 `managed_file_id`、`output_variable_name`、连线、拓扑 → **`flow project push --dir . --canvas`**
|
|
38
|
+
- 修改 `code.py` / `code.sql` → **`flow node push --node <uuid> --dir .`**
|
|
39
|
+
- 新增代码节点 → **`flow node new`**,禁止手搓 uuid
|
|
40
|
+
- 目录不一致 → **`flow project doctor`** → **`repair-meta`**
|
|
27
41
|
- 禁止使用裸 `dazi-flow ...` 作为最终交付命令
|
|
28
42
|
|
|
29
43
|
## 常见节点类型(按业务类型 data.type)
|
|
30
44
|
|
|
31
|
-
> **完整节点清单与配置说明**见帮助文档 [flow/flows-guide §流程节点组件](../docs/flow/flows-guide.md#流程节点组件),或流程目录
|
|
45
|
+
> **完整节点清单与配置说明**见帮助文档 [flow/flows-guide §流程节点组件](../docs/flow/flows-guide.md#流程节点组件),或流程目录 **快速启动\_<流程名>.md §可用流程节点**。
|
|
32
46
|
|
|
33
|
-
| 节点类型
|
|
34
|
-
|
|
35
|
-
| `excel-import` / `excel-python`
|
|
36
|
-
| `database-source` / `dataspace-source`
|
|
37
|
-
| `sql-query`
|
|
38
|
-
| `python-script`
|
|
39
|
-
| `condition`
|
|
40
|
-
| `data-quality-check`
|
|
41
|
-
| `database-sink` / `dataspace-sink`
|
|
42
|
-
| `file-source` / `delay` / `folder-resource-*` | 文件输入、延时、文件夹资源
|
|
47
|
+
| 节点类型 | 说明 |
|
|
48
|
+
| --------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
|
|
49
|
+
| `excel-import` / `excel-python` | Excel:**有 `managed_file_id` 时优先 `excel-python`**(勿用 `file-source`);极简单单 Sheet 才用 `excel-import` |
|
|
50
|
+
| `database-source` / `dataspace-source` | 外部库 / 数据空间 SQL 读取,产出表变量 |
|
|
51
|
+
| `sql-query` | 消费上游变量(变量名即 SQL 表名) |
|
|
52
|
+
| `python-script` | Python 转换,输出 `result_df` |
|
|
53
|
+
| `condition` | 条件分支,出边使用 `true/false` |
|
|
54
|
+
| `data-quality-check` | 数据质量检查 |
|
|
55
|
+
| `database-sink` / `dataspace-sink` | 写出到外部库 / 数据空间(通常无 `code.*`) |
|
|
56
|
+
| `file-source` / `delay` / `folder-resource-*` | 文件输入、延时、文件夹资源 |
|
|
43
57
|
|
|
44
58
|
## 推荐开发流程(流程项目)
|
|
45
59
|
|
|
46
60
|
```powershell
|
|
47
61
|
# 1) 拉取/同步到本地流程目录
|
|
48
|
-
|
|
62
|
+
dazi flow project pull --flow <flow_id> --dir "项目\flow_xxx\流程\<流程名>"
|
|
49
63
|
|
|
50
64
|
# 2) 若需新增节点(不要伪造 uuid)
|
|
51
|
-
|
|
65
|
+
dazi flow node new --type <node_type> --dir . --label "<节点名>"
|
|
52
66
|
|
|
53
67
|
# 3) 修改 flow.json(节点配置与连线)+ 修改 节点/<名>/code.*
|
|
54
68
|
|
|
55
69
|
# 4) 单节点测试
|
|
56
|
-
|
|
70
|
+
dazi flow run node-exec --node <node_uuid> --dir .
|
|
57
71
|
|
|
58
72
|
# 5) 提交(代码可用 node push;拓扑/配置变更必须 canvas push)
|
|
59
|
-
|
|
60
|
-
|
|
73
|
+
dazi flow node push --node <node_uuid> --dir .
|
|
74
|
+
dazi flow project push --dir . --canvas
|
|
61
75
|
```
|
|
62
76
|
|
|
63
77
|
## 一致性检查(回答末尾必须自检)
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
|
|
30
30
|
## 命令约束(必须遵守)
|
|
31
31
|
|
|
32
|
-
-
|
|
32
|
+
- 命令前缀统一:`dazi flow ...`(在 `dazi-work` 根)
|
|
33
33
|
- 在流程目录执行时,命令建议显式带 `--dir .`
|
|
34
34
|
- 禁止输出裸 `dazi-flow ...` 作为最终交付命令
|
|
35
35
|
|
|
@@ -37,20 +37,20 @@
|
|
|
37
37
|
|
|
38
38
|
```powershell
|
|
39
39
|
# 查看当前状态
|
|
40
|
-
|
|
40
|
+
dazi flow project status --dir .
|
|
41
41
|
|
|
42
42
|
# 新增节点(若需要)
|
|
43
|
-
|
|
43
|
+
dazi flow node new --type <node_type> --dir . --label "<节点名>"
|
|
44
44
|
|
|
45
45
|
# 单节点验证
|
|
46
|
-
|
|
46
|
+
dazi flow run node-exec --node <node_uuid> --dir .
|
|
47
47
|
|
|
48
48
|
# 整流程验证
|
|
49
|
-
|
|
49
|
+
dazi flow run flow-exec --dir . --type debug
|
|
50
50
|
|
|
51
51
|
# 提交(改画布/配置时必须 canvas)
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
dazi flow node push --node <node_uuid> --dir .
|
|
53
|
+
dazi flow project push --dir . --canvas
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
## 回答格式要求
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
{{debug_output}}
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
> 若用户未粘贴输出:AI **应主动读取** `_run/*.last-error.md`、`_run/flow.last-run.md`(及 `变量/` 下 schema),必要时自行执行
|
|
17
|
+
> 若用户未粘贴输出:AI **应主动读取** `_run/*.last-error.md`、`_run/flow.last-run.md`(及 `变量/` 下 schema),必要时自行执行 `dazi flow run ...` 复现;Agent 模式见 `flow/run-fix-loop`。
|
|
18
18
|
|
|
19
19
|
## 分析要求
|
|
20
20
|
|
|
@@ -26,18 +26,18 @@
|
|
|
26
26
|
|
|
27
27
|
## 常见问题类型
|
|
28
28
|
|
|
29
|
-
| 症状
|
|
30
|
-
|
|
31
|
-
| `KeyError`
|
|
32
|
-
| `TypeError`
|
|
33
|
-
| `ConnectionError` | 数据源连接失败,检查数据源配置
|
|
34
|
-
| `PermissionError` | 缺少权限,检查登录状态与权限
|
|
35
|
-
| 节点超时
|
|
36
|
-
| 上游变量缺失
|
|
29
|
+
| 症状 | 可能原因 |
|
|
30
|
+
| ----------------- | ------------------------------------------------------- |
|
|
31
|
+
| `KeyError` | 字段名不一致,检查上游变量 schema(`变量/<name>.json`) |
|
|
32
|
+
| `TypeError` | 数据类型不符,检查字段类型 |
|
|
33
|
+
| `ConnectionError` | 数据源连接失败,检查数据源配置 |
|
|
34
|
+
| `PermissionError` | 缺少权限,检查登录状态与权限 |
|
|
35
|
+
| 节点超时 | 数据量过大或查询未优化 |
|
|
36
|
+
| 上游变量缺失 | 未先运行上游节点或整流程 |
|
|
37
37
|
|
|
38
38
|
## 命令约束(必须遵守)
|
|
39
39
|
|
|
40
|
-
-
|
|
40
|
+
- 命令前缀统一:`dazi flow ...`(在 `dazi-work` 根)
|
|
41
41
|
- 在流程目录执行时,保留 `--dir .`,避免误跑到其他流程
|
|
42
42
|
- 禁止输出裸 `dazi-flow ...` 作为最终命令
|
|
43
43
|
|
|
@@ -47,13 +47,13 @@
|
|
|
47
47
|
|
|
48
48
|
```powershell
|
|
49
49
|
# 仅重测失败节点(优先)
|
|
50
|
-
|
|
50
|
+
dazi flow run node-exec --node <node_uuid> --dir .
|
|
51
51
|
|
|
52
52
|
# 整流程回归(必要时)
|
|
53
|
-
|
|
53
|
+
dazi flow run flow-exec --dir . --type debug
|
|
54
54
|
|
|
55
55
|
# 拉取变量确认修复效果
|
|
56
|
-
|
|
56
|
+
dazi flow variable pull --name <output_variable_name> --dir .
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
## 回答格式要求
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
2. **修复动作**:改 `flow.json` 还是改 `节点/<名>/code.*`
|
|
63
63
|
3. **执行命令**:按顺序给出可直接复制的命令
|
|
64
64
|
4. **提交动作**:
|
|
65
|
-
-
|
|
66
|
-
-
|
|
65
|
+
- 只改代码:`dazi flow node push --node <node_uuid> --dir .`
|
|
66
|
+
- 改了拓扑或节点配置:`dazi flow project push --dir . --canvas`
|
|
@@ -11,20 +11,23 @@
|
|
|
11
11
|
|
|
12
12
|
1. **扩展不会自动改代码**;你必须在终端**亲自执行** CLI 并读取 `_run/` 错误文件。
|
|
13
13
|
2. **改 → 跑 → 读错 → 再改 → 再跑** 是默认工作方式,不是可选项。
|
|
14
|
-
3.
|
|
14
|
+
3. 命令前缀统一:`dazi flow ...`(在 `dazi-work` 根;流程目录用 `--dir .`)。
|
|
15
15
|
|
|
16
16
|
## 命令约束(必须遵守)
|
|
17
17
|
|
|
18
|
-
-
|
|
18
|
+
- 命令前缀统一:`dazi flow ...`(在 `dazi-work` 根)
|
|
19
19
|
- 在流程目录执行时,保留 `--dir .`,避免误跑到其他流程
|
|
20
|
+
- 配置变更必须 `project push --dir . --canvas`(无 `--canvas` 不会更新平台画布)
|
|
21
|
+
- push 前先 `project doctor`;不一致则 `repair-meta`
|
|
20
22
|
- 禁止输出裸 `dazi-flow ...` 作为最终命令
|
|
23
|
+
- 必读:`flow/local-files-spec`
|
|
21
24
|
|
|
22
25
|
## 错误发现(跑完必做)
|
|
23
26
|
|
|
24
|
-
| 运行
|
|
25
|
-
|
|
26
|
-
|
|
|
27
|
-
|
|
|
27
|
+
| 运行 | 失败时必读 | 步骤/日志 |
|
|
28
|
+
| ---------------------------------------------------- | ----------------------------- | ----------------------- |
|
|
29
|
+
| `dazi flow run node-exec --node <node_uuid> --dir .` | `_run/<节点名>.last-error.md` | — |
|
|
30
|
+
| `dazi flow run flow-exec --dir . --type debug` | `_run/flow.last-error.md` | `_run/flow.last-run.md` |
|
|
28
31
|
|
|
29
32
|
带 `--json` 时同时检查:`success: false`、`errorFile` 路径。
|
|
30
33
|
|
|
@@ -38,9 +41,9 @@ FOR round = 1..3:
|
|
|
38
41
|
2. 修改 code.* 和/或 flow.json(遵守画布锚点规范)
|
|
39
42
|
3. 运行验证:
|
|
40
43
|
- 优先单节点:
|
|
41
|
-
|
|
44
|
+
dazi flow run node-exec --node <node_uuid> --dir .
|
|
42
45
|
- 需要全链路时:
|
|
43
|
-
|
|
46
|
+
dazi flow run flow-exec --dir . --type debug
|
|
44
47
|
4. IF 成功 → push(见下)→ 结束
|
|
45
48
|
ELSE → 读新生成的 last-error.md → 下一轮
|
|
46
49
|
5. IF round==3 仍失败 → 输出:失败节点、3 轮尝试摘要、剩余疑点、需用户提供的资料
|
|
@@ -48,18 +51,18 @@ FOR round = 1..3:
|
|
|
48
51
|
|
|
49
52
|
## 修复决策树
|
|
50
53
|
|
|
51
|
-
| 错误分类
|
|
52
|
-
|
|
53
|
-
| 缺上游变量
|
|
54
|
-
| 配置缺失
|
|
55
|
-
| 代码错误
|
|
56
|
-
| 连接/数据源 | connectionId / spaceId
|
|
54
|
+
| 错误分类 | 改哪里 | 验证命令 |
|
|
55
|
+
| ----------- | ------------------------ | ------------------------------------------------------------------------------------------------------- |
|
|
56
|
+
| 缺上游变量 | 先跑上游或整流程 | `dazi flow run flow-exec --dir . --type debug`,再 `dazi flow run node-exec --node <node_uuid> --dir .` |
|
|
57
|
+
| 配置缺失 | `flow.json` 节点 `data` | `dazi flow run node-exec --node <node_uuid> --dir .` → `dazi flow project push --dir . --canvas` |
|
|
58
|
+
| 代码错误 | `节点/<名>/code.sql\|py` | `dazi flow run node-exec --node <node_uuid> --dir .` → `dazi flow node push --node <node_uuid> --dir .` |
|
|
59
|
+
| 连接/数据源 | connectionId / spaceId | 改配置后 `dazi flow project push --dir . --canvas` |
|
|
57
60
|
|
|
58
61
|
## 提交规则
|
|
59
62
|
|
|
60
|
-
-
|
|
61
|
-
-
|
|
62
|
-
- 确认变量 schema
|
|
63
|
+
- 只改代码:`dazi flow node push --node <node_uuid> --dir .`
|
|
64
|
+
- 改连线/配置/增删节点:`dazi flow project push --dir . --canvas`
|
|
65
|
+
- 确认变量 schema:`dazi flow variable pull --name <output_variable_name> --dir .`
|
|
63
66
|
- **禁止**未验证通过就 push
|
|
64
67
|
|
|
65
68
|
## 回答格式(每轮结束后)
|
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
|
|
8
8
|
你是一名搭子(Dazi)平台专家,熟悉以下所有模块:
|
|
9
9
|
|
|
10
|
-
-
|
|
11
|
-
-
|
|
10
|
+
- **`dazi onto`**:本体管理(函数、动作、规则、脚本)
|
|
11
|
+
- **`dazi flow`**:数据流程(Flow 创建、运行、调试)
|
|
12
12
|
- **`pnpm run dazi-app --`**(`runtime-apps`):前端应用(Vue 3 应用开发、发布)
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
13
|
+
- **`dazi data`**:数据资源(数据空间、数据表、数据集)
|
|
14
|
+
- **`dazi auth`**:认证管理
|
|
15
|
+
- **`dazi migrate`**:迁移工具
|
|
16
16
|
|
|
17
17
|
## 用户问题
|
|
18
18
|
|
|
@@ -27,4 +27,4 @@
|
|
|
27
27
|
|
|
28
28
|
## 平台文档索引
|
|
29
29
|
|
|
30
|
-
可通过
|
|
30
|
+
可通过 `dazi docs list` 查看所有文档,`dazi docs open <id>` 打开。
|
|
@@ -18,12 +18,13 @@
|
|
|
18
18
|
```powershell
|
|
19
19
|
# 在 dazi-work 根目录运行
|
|
20
20
|
.\scripts\doctor-cli.ps1
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
dazi doctor
|
|
22
|
+
dazi env
|
|
23
|
+
dazi auth whoami
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
环境输出:
|
|
27
|
+
|
|
27
28
|
```
|
|
28
29
|
{{env_output}}
|
|
29
30
|
```
|
package/dist/prompts/index.json
CHANGED
|
@@ -1,20 +1,99 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "3.0.
|
|
2
|
+
"version": "3.0.2",
|
|
3
3
|
"updatedAt": "2026-05-26T00:00:00.000Z",
|
|
4
4
|
"prompts": [
|
|
5
|
-
{
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
{
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
{
|
|
18
|
-
|
|
5
|
+
{
|
|
6
|
+
"id": "onto/script-publish-run",
|
|
7
|
+
"title": "本体脚本发布与运行(TRAE/智能体)",
|
|
8
|
+
"category": "onto",
|
|
9
|
+
"file": "onto/script-publish-run.md"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"id": "onto/function-design",
|
|
13
|
+
"title": "本体函数设计",
|
|
14
|
+
"category": "onto",
|
|
15
|
+
"file": "onto/function-design.md"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"id": "onto/action-design",
|
|
19
|
+
"title": "本体动作(Action)设计",
|
|
20
|
+
"category": "onto",
|
|
21
|
+
"file": "onto/action-design.md"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"id": "onto/rule-seed",
|
|
25
|
+
"title": "规则种子脚本",
|
|
26
|
+
"category": "onto",
|
|
27
|
+
"file": "onto/rule-seed.md"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"id": "flow/flow-design",
|
|
31
|
+
"title": "Flow 设计",
|
|
32
|
+
"category": "flow",
|
|
33
|
+
"file": "flow/flow-design.md",
|
|
34
|
+
"featured": true
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"id": "flow/ai-workflow-playbook",
|
|
38
|
+
"title": "流程 AI 工作手册",
|
|
39
|
+
"category": "flow",
|
|
40
|
+
"file": "flow/ai-workflow-playbook.md",
|
|
41
|
+
"featured": true
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"id": "flow/run-debug",
|
|
45
|
+
"title": "Run 调试分析",
|
|
46
|
+
"category": "flow",
|
|
47
|
+
"file": "flow/run-debug.md"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"id": "flow/run-fix-loop",
|
|
51
|
+
"title": "Flow 自主运行改错",
|
|
52
|
+
"category": "flow",
|
|
53
|
+
"file": "flow/run-fix-loop.md",
|
|
54
|
+
"featured": true
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"id": "flow/plan-generate",
|
|
58
|
+
"title": "执行计划生成",
|
|
59
|
+
"category": "flow",
|
|
60
|
+
"file": "flow/plan-generate.md"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"id": "app/ui-design",
|
|
64
|
+
"title": "搭子 App UI 设计",
|
|
65
|
+
"category": "app",
|
|
66
|
+
"file": "app/ui-design.md"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"id": "data/data-analysis",
|
|
70
|
+
"title": "数据分析",
|
|
71
|
+
"category": "data",
|
|
72
|
+
"file": "data/data-analysis.md"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"id": "data/sql-query",
|
|
76
|
+
"title": "SQL 查询生成",
|
|
77
|
+
"category": "data",
|
|
78
|
+
"file": "data/sql-query.md"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"id": "general/ask-dazi",
|
|
82
|
+
"title": "询问搭子平台",
|
|
83
|
+
"category": "general",
|
|
84
|
+
"file": "general/ask-dazi.md"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"id": "general/troubleshoot",
|
|
88
|
+
"title": "问题排查",
|
|
89
|
+
"category": "general",
|
|
90
|
+
"file": "general/troubleshoot.md"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"id": "general/code-review",
|
|
94
|
+
"title": "搭子脚本代码审查",
|
|
95
|
+
"category": "general",
|
|
96
|
+
"file": "general/code-review.md"
|
|
97
|
+
}
|
|
19
98
|
]
|
|
20
99
|
}
|
|
@@ -23,25 +23,27 @@
|
|
|
23
23
|
def main(params: dict, context: dict, s=None) -> dict:
|
|
24
24
|
"""
|
|
25
25
|
[动作说明]
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
Args:
|
|
28
28
|
params: 动作参数
|
|
29
29
|
context: 触发上下文(user_id, org_id, permission_tags 等)
|
|
30
|
-
|
|
30
|
+
|
|
31
31
|
Returns:
|
|
32
32
|
{"status": "ok", ...}
|
|
33
33
|
"""
|
|
34
34
|
# 权限检查(可选)
|
|
35
35
|
if "finance.write" not in context.get("permission_tags", []):
|
|
36
36
|
raise PermissionError("缺少 finance.write 权限")
|
|
37
|
-
|
|
37
|
+
|
|
38
38
|
# 执行写操作
|
|
39
|
-
|
|
39
|
+
|
|
40
40
|
return {"status": "ok"}
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
发布命令(v3;**勿用** `dazi-onto`):
|
|
44
|
+
|
|
44
45
|
```powershell
|
|
45
|
-
|
|
46
|
+
dazi onto script publish 项目/onto_<名>/脚本/<file>.py --space <space-id> --register-action-id <action_code> --register-action-permission-tag "finance.write"
|
|
46
47
|
```
|
|
48
|
+
|
|
47
49
|
详见提示词 `onto/script-publish-run`。
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
def main(params: dict, s=None) -> dict:
|
|
27
27
|
"""
|
|
28
28
|
[函数说明]
|
|
29
|
-
|
|
29
|
+
|
|
30
30
|
Args:
|
|
31
31
|
params: 包含 xxx(说明)
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
Returns:
|
|
34
34
|
包含 xxx(说明)
|
|
35
35
|
"""
|
|
@@ -37,8 +37,10 @@ def main(params: dict, s=None) -> dict:
|
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
发布与运行(v3,工作区根目录;**勿用** `dazi-onto`):
|
|
40
|
+
|
|
40
41
|
```powershell
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
dazi onto script publish 项目/onto_<名>/脚本/functions/<file>.py --space <space-id> --register-function-id <id>
|
|
43
|
+
dazi onto function run <id> --space <space-id>
|
|
43
44
|
```
|
|
45
|
+
|
|
44
46
|
详见提示词 `onto/script-publish-run`(侧栏 帮助 → 提示词)。
|
|
@@ -29,13 +29,15 @@ def main(params: dict, s=None) -> dict:
|
|
|
29
29
|
"metadata": {}
|
|
30
30
|
},
|
|
31
31
|
]
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
result = s.ontology_rules.upsert(rules)
|
|
34
34
|
return {"upserted": len(rules), "result": result}
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
执行命令(v3;**勿用** `dazi-onto`):
|
|
38
|
+
|
|
38
39
|
```powershell
|
|
39
|
-
|
|
40
|
+
dazi onto rule run-seed --space <space-id> --stem <seed_file_stem>
|
|
40
41
|
```
|
|
42
|
+
|
|
41
43
|
详见提示词 `onto/script-publish-run`。
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
1. **禁止**在终端使用独立命令 `dazi-onto`(v3 未安装到系统 PATH)。
|
|
14
14
|
2. **禁止**用旧版 `dazi-agent` / `dazi-agent.exe` 发布 v3 本体脚本(API 与路径不一致)。
|
|
15
15
|
3. **必须**使用下列之一调用 CLI:
|
|
16
|
-
- **推荐(工作区含 `scripts/dazi.ps1
|
|
16
|
+
- **推荐(工作区含 `scripts/dazi.ps1`)**:`dazi onto <子命令> ...`
|
|
17
17
|
- **仅开发仓库**:`node bundled/clis/dazi.js onto ...`(维护方打包用;客户环境用 `dazi.ps1`)
|
|
18
18
|
- **完整路径**:`node <搭子仓库>/dazi/dazi-vscode/bundled/clis/dazi.js onto <子命令> ...`,并设置环境变量 `DAZI_BUNDLED_DIR=<同目录 bundled/clis>`
|
|
19
19
|
4. **工作目录**必须是搭子工作区根(含 `项目/` 目录),例如 `dazi-work`。
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
脚本/
|
|
30
30
|
setup/ ← 初始化、灌数(先 init 后 seed)
|
|
31
31
|
functions/ ← 本体函数
|
|
32
|
-
资源/docs/ ←
|
|
32
|
+
资源/docs/ ← dazi docs sync 后的指南
|
|
33
33
|
scripts/ ← dazi.ps1 / dazi.cmd 包装(客户工作区模板应包含)
|
|
34
34
|
```
|
|
35
35
|
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
|
|
41
41
|
```powershell
|
|
42
42
|
cd <工作区根>
|
|
43
|
-
|
|
43
|
+
dazi auth whoami
|
|
44
44
|
# 未登录则:
|
|
45
|
-
|
|
45
|
+
dazi auth login
|
|
46
46
|
```
|
|
47
47
|
|
|
48
48
|
若提示找不到 `bundled/clis/dazi.js`,在搭子源码目录执行一次:`cd dazi/dazi-vscode && pnpm run bundle:clis`(实施方仓库维护,客户环境由交付包或 VSIX 提供)。
|
|
@@ -54,19 +54,19 @@ cd <工作区根>
|
|
|
54
54
|
### 1. 预检(可选)
|
|
55
55
|
|
|
56
56
|
```powershell
|
|
57
|
-
|
|
57
|
+
dazi onto script publish-preview <项目路径>/脚本/setup/xxx_ontology_init.py --space <空间> --type setup
|
|
58
58
|
```
|
|
59
59
|
|
|
60
60
|
### 2. 发布初始化脚本(setup)
|
|
61
61
|
|
|
62
62
|
```powershell
|
|
63
|
-
|
|
63
|
+
dazi onto script publish <项目路径>/脚本/setup/xxx_ontology_init.py --space <空间> --type setup
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
### 3. 发布灌数脚本(data)
|
|
67
67
|
|
|
68
68
|
```powershell
|
|
69
|
-
|
|
69
|
+
dazi onto script publish <项目路径>/脚本/setup/xxx_seed_data.py --space <空间> --type data
|
|
70
70
|
```
|
|
71
71
|
|
|
72
72
|
### 4. 发布本体函数(**必须** `--register-function-id`,否则函数列表看不到)
|
|
@@ -76,16 +76,16 @@ cd <工作区根>
|
|
|
76
76
|
发布后必须确认输出含 `functionId` / `function_registration.ok`,并执行 `function list` 能看到该 id。
|
|
77
77
|
|
|
78
78
|
```powershell
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
dazi onto script publish <项目路径>/脚本/functions/xxx_fn_yyy.py --space <空间> --register-function-id <domain>.fn.<name>
|
|
80
|
+
dazi onto function list --space <空间>
|
|
81
81
|
```
|
|
82
82
|
|
|
83
83
|
### 5. 执行脚本
|
|
84
84
|
|
|
85
85
|
```powershell
|
|
86
86
|
# 按 publish 返回的 scriptId,或:
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
dazi onto script run --file <项目路径>/脚本/setup/xxx_ontology_init.py --space <空间>
|
|
88
|
+
dazi onto script run --file <项目路径>/脚本/setup/xxx_seed_data.py --space <空间>
|
|
89
89
|
```
|
|
90
90
|
|
|
91
91
|
**顺序**:先 run init,再 run seed,再发布/运行函数。
|
|
@@ -93,23 +93,23 @@ cd <工作区根>
|
|
|
93
93
|
### 6. 运行本体函数
|
|
94
94
|
|
|
95
95
|
```powershell
|
|
96
|
-
|
|
96
|
+
dazi onto function run <function_id> --space <空间>
|
|
97
97
|
```
|
|
98
98
|
|
|
99
99
|
PowerShell 传 JSON 参数易丢引号;可省略 `--params` 使用函数默认,或:
|
|
100
100
|
|
|
101
101
|
```powershell
|
|
102
102
|
$env:DAZI_PARAMS='{"start_date":"2025-01-01","end_date":"2026-12-31"}'
|
|
103
|
-
|
|
103
|
+
dazi onto function run <function_id> --space <空间> --params $env:DAZI_PARAMS
|
|
104
104
|
```
|
|
105
105
|
|
|
106
106
|
## 脚本类型与路径推断
|
|
107
107
|
|
|
108
|
-
| 本地路径特征
|
|
109
|
-
|
|
110
|
-
| `脚本/setup/*init*.py` | `setup`
|
|
111
|
-
| `脚本/setup/*seed*.py` | `data`
|
|
112
|
-
| `脚本/functions/*.py`
|
|
108
|
+
| 本地路径特征 | `--type` | 平台目录 |
|
|
109
|
+
| ---------------------- | -------------------------- | --------------------- |
|
|
110
|
+
| `脚本/setup/*init*.py` | `setup` | `setup/` |
|
|
111
|
+
| `脚本/setup/*seed*.py` | `data` | `data/` |
|
|
112
|
+
| `脚本/functions/*.py` | (默认 ontology_function) | `ontology_functions/` |
|
|
113
113
|
|
|
114
114
|
## 编写脚本时注意
|
|
115
115
|
|
|
@@ -131,7 +131,7 @@ VS Code 用户也可在侧栏 **搭子 → Onto 本体** 使用「发布脚本
|
|
|
131
131
|
|
|
132
132
|
命令失败时向用户报告:**完整 stderr**、使用的**完整命令行**、`space_id`、是否已 `auth whoami`。不要改用 `dazi-agent` 重试。
|
|
133
133
|
|
|
134
|
-
##
|
|
134
|
+
## 相关同步文档(`dazi docs sync` → `资源/docs/onto/`)
|
|
135
135
|
|
|
136
136
|
- `本体规划指南.md`、`本体脚本编写指南.md`
|
|
137
137
|
- `dazi_script_sdk_reference.md`、`dazi_script_seed_data_guide.md`
|