openyida 2026.9.11-3 → 2026.9.12
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 +1 -1
- package/lib/app/compile.js +39 -1
- package/lib/core/command-manifest.js +1 -1
- package/package.json +1 -1
- package/yida-skills/skills/yida-app/workflow/step-5-seed-records.md +11 -7
- package/yida-skills/skills/yida-canvas-custom-page/SKILL.md +5 -3
- package/yida-skills/skills/yida-canvas-custom-page/references/component-library-guide.md +1 -1
- package/yida-skills/skills/yida-canvas-table-form/SKILL.md +1 -1
- package/yida-skills/skills/yida-rechart/SKILL.md +1 -1
package/README.md
CHANGED
|
@@ -433,7 +433,7 @@ Run `openyida --help` or `openyida <command> --help` for detailed usage.
|
|
|
433
433
|
| `openyida create-page <appType> "<name>" [--mode dashboard] [--hide-nav] [--locale zh_CN\|en_US\|ja_JP] [--open\|--no-open]` | Create a custom display page |
|
|
434
434
|
| `openyida build-page <sourceFile> [--output file\|--write]` | Build Yida-compatible page source |
|
|
435
435
|
| `openyida check-page <src> [--compat]` | Check custom page standards |
|
|
436
|
-
| `openyida compile <src
|
|
436
|
+
| `openyida compile <src> [--canvas] [--json]` | Compile custom page locally |
|
|
437
437
|
| `openyida publish <src> <appType> <formUuid> [--health-check] [--force] [--canvas] [--auto-nav-order] [--open\|--no-open]` | Compile and publish custom page |
|
|
438
438
|
| `openyida update-form-config <appType> <formUuid> <true\|false\|keep> "<title>" [--locale zh_CN\|en_US\|ja_JP]` | Update form configuration |
|
|
439
439
|
| `openyida get-form-config <appType> <formUuid> [--json]` | Query form configuration |
|
package/lib/app/compile.js
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
const path = require('path');
|
|
5
5
|
const { compileSource } = require('./page-compiler');
|
|
6
|
+
const { compileCanvasPageSource } = require('./services/canvas-page-compiler');
|
|
7
|
+
const { loadPageSource } = require('./services/page-source-loader');
|
|
6
8
|
const { runLintCheck } = require('./page-linter');
|
|
7
9
|
const { buildPageFile, shouldBuildPageSource } = require('./page-compat');
|
|
8
10
|
const { warnLargePageSource } = require('./page-size-guard');
|
|
@@ -23,7 +25,20 @@ async function run(args) {
|
|
|
23
25
|
|
|
24
26
|
const skipLint = args.includes('--skip-lint');
|
|
25
27
|
const compat = args.includes('--compat') || args.includes('--modern');
|
|
26
|
-
const
|
|
28
|
+
const canvas = args.includes('--canvas');
|
|
29
|
+
const json = args.includes('--json');
|
|
30
|
+
const filteredArgs = args.filter(arg => ![
|
|
31
|
+
'--skip-lint',
|
|
32
|
+
'--compat',
|
|
33
|
+
'--modern',
|
|
34
|
+
'--canvas',
|
|
35
|
+
'--json',
|
|
36
|
+
].includes(arg));
|
|
37
|
+
if (filteredArgs.length < 1) {
|
|
38
|
+
throwUsage(t('cli.compile_usage'), t('cli.compile_example'), {
|
|
39
|
+
code: 'COMPILE_INVALID_ARGUMENTS',
|
|
40
|
+
});
|
|
41
|
+
}
|
|
27
42
|
let sourcePath = path.resolve(filteredArgs[0]);
|
|
28
43
|
if (!fs.existsSync(sourcePath)) {
|
|
29
44
|
throwCommandError(t('publish.source_not_found', sourcePath), {
|
|
@@ -32,6 +47,29 @@ async function run(args) {
|
|
|
32
47
|
});
|
|
33
48
|
}
|
|
34
49
|
|
|
50
|
+
if (canvas || /\.canvas\.(?:jsx?|tsx?)$/i.test(sourcePath)) {
|
|
51
|
+
const workspaceRoot = process.cwd();
|
|
52
|
+
const relativeSourcePath = path.relative(workspaceRoot, sourcePath);
|
|
53
|
+
const loadedSource = loadPageSource(relativeSourcePath, { workspaceRoot });
|
|
54
|
+
const compiled = compileCanvasPageSource(loadedSource);
|
|
55
|
+
const payload = {
|
|
56
|
+
ok: true,
|
|
57
|
+
pageType: 'canvas',
|
|
58
|
+
sourcePath: fs.realpathSync(sourcePath),
|
|
59
|
+
profile: compiled.profile,
|
|
60
|
+
inputHash: compiled.inputHash,
|
|
61
|
+
sourceHash: compiled.sourceHash,
|
|
62
|
+
compiledHash: compiled.compiledHash,
|
|
63
|
+
importedModules: JSON.parse(compiled.importedModules),
|
|
64
|
+
};
|
|
65
|
+
if (json) {
|
|
66
|
+
console.log(JSON.stringify(payload));
|
|
67
|
+
} else {
|
|
68
|
+
info(JSON.stringify(payload, null, 2));
|
|
69
|
+
}
|
|
70
|
+
return payload;
|
|
71
|
+
}
|
|
72
|
+
|
|
35
73
|
const initialSourceCode = fs.readFileSync(sourcePath, 'utf-8');
|
|
36
74
|
warnLargePageSource(initialSourceCode, sourcePath);
|
|
37
75
|
if (shouldBuildPageSource(initialSourceCode, sourcePath, { modern: compat })) {
|
|
@@ -1251,7 +1251,7 @@ const COMMAND_GROUPS = [
|
|
|
1251
1251
|
command('create-page', ['create-page'], 'create-page <appType> "<name>" [--mode dashboard] [--hide-nav] [--locale zh_CN|en_US|ja_JP] [--open|--no-open]', 'help.cmd_create_page'),
|
|
1252
1252
|
command('build-page', ['build-page'], 'build-page <sourceFile> [--output file|--write]', 'help.cmd_build_page', { requiresLogin: false }),
|
|
1253
1253
|
command('check-page', ['check-page'], 'check-page <src> [--compat]', 'help.cmd_check_page', { output: 'text|json' }),
|
|
1254
|
-
command('compile', ['compile'], 'compile <src>', 'help.cmd_compile', { requiresLogin: false }),
|
|
1254
|
+
command('compile', ['compile'], 'compile <src> [--canvas] [--json]', 'help.cmd_compile', { requiresLogin: false, output: 'text|json' }),
|
|
1255
1255
|
command('publish', ['publish'], 'publish <src> <appType> <formUuid> [--health-check] [--force] [--canvas] [--auto-nav-order] [--open|--no-open]', 'help.cmd_publish'),
|
|
1256
1256
|
command('update-form-config', ['update-form-config'], 'update-form-config <appType> <formUuid> <true|false|keep> "<title>" [--locale zh_CN|en_US|ja_JP]', 'help.cmd_update_form_config'),
|
|
1257
1257
|
command('get-form-config', ['get-form-config'], 'get-form-config <appType> <formUuid> [--json]', 'help.cmd_get_form_config', { output: 'json' }),
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
# Step 5:写入初始表单数据
|
|
2
2
|
|
|
3
|
-
完整应用默认给本轮新建或页面数据源依赖的核心普通表单写入 1-3 条业务化 seed records
|
|
3
|
+
完整应用默认给本轮新建或页面数据源依赖的核心普通表单写入 1-3 条业务化 seed records。流程表单仅在已确认真实 `processCode` 后按独立命令写入。
|
|
4
4
|
|
|
5
5
|
## 输入
|
|
6
6
|
|
|
7
7
|
- 真实 `appType`;
|
|
8
|
-
-
|
|
8
|
+
- 核心表单 `formUuid`、真实表单类型;
|
|
9
|
+
- 流程表单已确认的真实 `processCode`;
|
|
9
10
|
- `.cache/<项目名>-schema.json` 或字段 schema;
|
|
10
11
|
- PRD 中的业务对象和示例数据语义。
|
|
11
12
|
|
|
@@ -14,27 +15,30 @@
|
|
|
14
15
|
1. 执行 `use_skill("yida-data-management", "为核心业务表单写入 1-3 条示例记录")`。
|
|
15
16
|
2. 先执行 `openyida get-schema <appType> <formUuid> --field-map-json` 获取真实字段 ID。
|
|
16
17
|
3. 生成当前业务语义的字段值,不写“测试1 / demo / mock”。
|
|
17
|
-
4.
|
|
18
|
+
4. 每个核心表单 1-3 条即可;列表/工作台通常 2 条,看板/排行/状态分布通常 3 条。
|
|
18
19
|
5. `DateField` / `CascadeDateField` 使用 13 位毫秒时间戳。
|
|
19
|
-
6.
|
|
20
|
-
7.
|
|
20
|
+
6. 普通表单每条记录单独执行 `openyida data create form <appType> <formUuid> --expect-form-name <真实名称> --expect-form-type receipt --data-file ...` 或 `--data-json ...`;最后执行 `openyida data query form` 抽查至少 1 条。
|
|
21
|
+
7. 流程表单只有在已确认真实 `processCode` 后,才执行 `openyida data create process <appType> <formUuid> --process-code <真实 processCode> --expect-form-name <真实名称> --expect-form-type process --data-file ...` 或 `--data-json ...`;最后执行 `openyida data query process` 抽查至少 1 条。
|
|
22
|
+
8. 名称、UUID、类型或 `processCode` 不一致时停止,不得在 `form` 与 `process` 命令之间盲目重试。
|
|
21
23
|
|
|
22
24
|
以下情况可以跳过,并在 final 说明原因:
|
|
23
25
|
|
|
24
26
|
- 用户明确要求不要造数;
|
|
25
27
|
- 表单是配置字典、权限表、敏感个人数据表或纯附件表;
|
|
26
28
|
- 字段缺少可安全构造的有效值;
|
|
27
|
-
- 流程表单没有确认 `processCode
|
|
29
|
+
- 流程表单没有确认 `processCode` 时禁止写入实例;若页面依赖流程实例,先补齐真实 `processCode`,否则说明跳过原因并保留空态。
|
|
28
30
|
|
|
29
31
|
## 产出
|
|
30
32
|
|
|
31
|
-
- 1-3
|
|
33
|
+
- 1-3 条真实普通表单或流程表单记录;
|
|
32
34
|
- query 抽查结果;
|
|
33
35
|
- 或明确跳过原因和页面空态方案。
|
|
34
36
|
|
|
35
37
|
## Checklist
|
|
36
38
|
|
|
37
39
|
- [ ] seed records 使用真实 `fieldId`;
|
|
40
|
+
- [ ] 普通表单使用 `data create form`,流程表单使用 `data create process`;
|
|
41
|
+
- [ ] 流程实例创建前已确认真实 `processCode`;
|
|
38
42
|
- [ ] 每条记录单独创建;
|
|
39
43
|
- [ ] query 抽查已确认 `formData` 非空;
|
|
40
44
|
- [ ] 跳过时已写明原因和页面空态方案。
|
|
@@ -170,7 +170,7 @@ openyida create-page <appType> "<页面名>"
|
|
|
170
170
|
|
|
171
171
|
# 使用 Provider 标记时,先按主题脚本指南生成 <页面名>.themed.canvas.jsx;以下快检与发布都改用该生成文件。
|
|
172
172
|
# 4. 本地快检
|
|
173
|
-
|
|
173
|
+
openyida compile project/pages/src/<页面名>.canvas.jsx --json
|
|
174
174
|
|
|
175
175
|
# 5. 发布(本轮修改源码后的远端完成证据)
|
|
176
176
|
openyida publish project/pages/src/<页面名>.canvas.jsx <appType> <formUuid>
|
|
@@ -179,9 +179,11 @@ openyida publish project/pages/src/<页面名>.canvas.jsx <appType> <formUuid>
|
|
|
179
179
|
openyida get-schema <appType> <formUuid> --field-map-json
|
|
180
180
|
```
|
|
181
181
|
|
|
182
|
-
`openyida
|
|
182
|
+
`openyida compile` 会自动识别 `.canvas.jsx` / `.canvas.tsx` 并调用 Canvas 编译器;`--json` 返回可机器读取的 hash 和依赖清单。该命令只读、无需登录、不访问网络、不发布页面,也不写入构建产物。`openyida publish` 仍是远端写入证据。
|
|
183
183
|
|
|
184
|
-
|
|
184
|
+
云端与本地 Agent 都使用同一条 `openyida compile <页面源码.canvas.jsx> --json` 快检命令,不依赖仅云端 Builder 提供的 `run_workspace_script`。
|
|
185
|
+
|
|
186
|
+
其他确需保存的云端 workspace 脚本放在项目根 `.cache/yida-agent/scripts/...`,不要写 `project/.cache/...`,否则运行时会解析成重复的 `project/project/.cache/...`;Canvas 快检本身不需要创建脚本。
|
|
185
187
|
|
|
186
188
|
如需保存完整 Schema,使用 create_file / Write / file edit tool 创建 `<projectRoot>/.cache/openyida/<页面名或任务名>/<页面名>-schema.json`;从 workspace 根执行后续 Bash 命令时路径加 `project/` 前缀。
|
|
187
189
|
|
|
@@ -95,7 +95,7 @@ OpenYida 禁止页面源码和 page-spec 中出现 emoji。遇到 `contains emoj
|
|
|
95
95
|
可直接按推荐组合编写页面并执行本地快检:
|
|
96
96
|
|
|
97
97
|
```bash
|
|
98
|
-
|
|
98
|
+
openyida compile project/pages/src/dashboard-starter.canvas.jsx --json
|
|
99
99
|
```
|
|
100
100
|
|
|
101
101
|
## 自查清单
|
|
@@ -125,7 +125,7 @@ openyida get-schema <appType> <formUuid> --field-map-json
|
|
|
125
125
|
# 未验证前保持 writeBridge.verified !== true
|
|
126
126
|
|
|
127
127
|
# 4. 本地快检
|
|
128
|
-
|
|
128
|
+
openyida compile project/pages/src/table-form-batch-submit.canvas.jsx --json
|
|
129
129
|
|
|
130
130
|
# 5. 真实交付时发布
|
|
131
131
|
openyida publish project/pages/src/table-form-batch-submit.canvas.jsx <appType> <displayPageFormUuid>
|
|
@@ -107,7 +107,7 @@ export default YidaComp;
|
|
|
107
107
|
# yida-report 负责统计口径;yida-canvas-data-binding 负责接口接入
|
|
108
108
|
|
|
109
109
|
# 2. 本地快检
|
|
110
|
-
|
|
110
|
+
openyida compile project/pages/src/trend-combo.canvas.jsx --json
|
|
111
111
|
|
|
112
112
|
# 3. 真实交付时发布
|
|
113
113
|
openyida publish project/pages/src/trend-combo.canvas.jsx <appType> <displayPageFormUuid>
|