openyida 2026.7.19 → 2026.7.21

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 (139) hide show
  1. package/README.md +14 -0
  2. package/bin/yida.js +107 -18
  3. package/lib/app/create-app.js +12 -1
  4. package/lib/app/create-form/args.js +13 -0
  5. package/lib/app/create-form.js +154 -67
  6. package/lib/app/create-page.js +45 -9
  7. package/lib/app/get-schema.js +65 -14
  8. package/lib/app/import-app.js +92 -41
  9. package/lib/app/publish.js +289 -556
  10. package/lib/app/schema-field-resolution.js +370 -0
  11. package/lib/app/services/app-reader.js +85 -0
  12. package/lib/app/services/app-service.js +235 -0
  13. package/lib/app/services/canvas-page-compiler.js +91 -0
  14. package/lib/app/services/canvas-page-schema-builder.js +149 -0
  15. package/lib/app/services/field-bindings.js +68 -0
  16. package/lib/app/services/form-compiler.js +1922 -0
  17. package/lib/app/services/form-mode-service.js +182 -0
  18. package/lib/app/services/form-schema-patcher.js +333 -0
  19. package/lib/app/services/form-schema-reader.js +59 -0
  20. package/lib/app/services/form-service.js +379 -0
  21. package/lib/app/services/form-validation.js +562 -0
  22. package/lib/app/services/native-page-compiler.js +92 -0
  23. package/lib/app/services/native-page-schema-builder.js +428 -0
  24. package/lib/app/services/page-resource-service.js +185 -0
  25. package/lib/app/update-app.js +18 -6
  26. package/lib/auth/token-auth.js +34 -3
  27. package/lib/auth/token-store.js +22 -4
  28. package/lib/bridge/bridge.js +37 -5
  29. package/lib/core/agent-capabilities.js +5 -3
  30. package/lib/core/command-manifest.js +40 -0
  31. package/lib/core/doctor.js +15 -4
  32. package/lib/core/env-cmd.js +1 -1
  33. package/lib/core/env.js +7 -6
  34. package/lib/core/legacy-schema-guard.js +408 -0
  35. package/lib/core/locales/en.js +8 -46
  36. package/lib/core/locales/zh.js +8 -46
  37. package/lib/core/sample.js +1 -1
  38. package/lib/core/utils.js +334 -66
  39. package/lib/core/yida-client.js +104 -3
  40. package/lib/formula/evaluate.js +8 -66
  41. package/lib/formula/field-refs.js +83 -0
  42. package/lib/process/configure-process.js +44 -1992
  43. package/lib/process/create-process.js +54 -87
  44. package/lib/process/services/process-compiler.js +2056 -0
  45. package/lib/process/services/process-reader.js +232 -0
  46. package/lib/process/services/process-resource-service.js +571 -0
  47. package/lib/process/services/process-service.js +122 -0
  48. package/lib/process/services/process-stage-checkpoint.js +246 -0
  49. package/lib/report/append.js +7 -26
  50. package/lib/report/http.js +31 -5
  51. package/lib/report/index.js +10 -2
  52. package/lib/samples/yida-canvas-custom-page/business-list.canvas.jsx +63 -14
  53. package/lib/samples/yida-canvas-custom-page/dashboard-overview.canvas.jsx +176 -32
  54. package/lib/samples/yida-canvas-custom-page/data-management.canvas.jsx +228 -14
  55. package/lib/samples/yida-canvas-custom-page/split-pane-detail.canvas.jsx +204 -8
  56. package/lib/schema/adapters/app-adapter.js +210 -0
  57. package/lib/schema/adapters/form-adapter.js +1362 -0
  58. package/lib/schema/adapters/keys.js +19 -0
  59. package/lib/schema/adapters/page-adapter.js +566 -0
  60. package/lib/schema/adapters/process-adapter.js +519 -0
  61. package/lib/schema/applier.js +1878 -0
  62. package/lib/schema/apply-store.js +1083 -0
  63. package/lib/schema/command.js +645 -0
  64. package/lib/schema/dependency-graph.js +83 -0
  65. package/lib/schema/errors.js +481 -0
  66. package/lib/schema/hash.js +9 -0
  67. package/lib/schema/manifest-limits.js +177 -0
  68. package/lib/schema/manifest-loader.js +309 -0
  69. package/lib/schema/manifest-schema-v1.json +193 -0
  70. package/lib/schema/normalize-manifest.js +281 -0
  71. package/lib/schema/page-canvas-foundation.js +447 -0
  72. package/lib/schema/page-data-source-builder.js +561 -0
  73. package/lib/schema/page-foundation.js +556 -0
  74. package/lib/schema/page-source-loader.js +314 -0
  75. package/lib/schema/planner.js +691 -0
  76. package/lib/schema/remote-dispatch-boundary.js +39 -0
  77. package/lib/schema/remote-missing.js +21 -0
  78. package/lib/schema/remote-reader.js +189 -0
  79. package/lib/schema/resource-registry.js +157 -0
  80. package/lib/schema/server-revision.js +71 -0
  81. package/lib/schema/sort.js +28 -0
  82. package/lib/schema/state-store.js +589 -0
  83. package/package.json +2 -2
  84. package/scripts/postinstall.js +8 -12
  85. package/scripts/validate-package-size.js +1 -1
  86. package/yida-skills/SKILL.md +114 -29
  87. package/yida-skills/references/schema-as-code-phase1.md +99 -0
  88. package/yida-skills/references/setup-and-env.md +59 -59
  89. package/yida-skills/references/task-retrospective.md +6 -6
  90. package/yida-skills/skills/yida-app/SKILL.md +60 -14
  91. package/yida-skills/skills/yida-canvas-custom-page/SKILL.md +18 -7
  92. package/yida-skills/skills/yida-canvas-custom-page/references/data-bridge-guide.md +3 -3
  93. package/yida-skills/skills/yida-canvas-custom-page/references/page-generation-guide.md +7 -1
  94. package/yida-skills/skills/yida-create-app/SKILL.md +21 -3
  95. package/yida-skills/skills/yida-create-form-page/SKILL.md +19 -1
  96. package/yida-skills/skills/yida-create-page/SKILL.md +16 -3
  97. package/yida-skills/skills/yida-create-process/SKILL.md +100 -4
  98. package/yida-skills/skills/yida-custom-page/SKILL.md +19 -4
  99. package/yida-skills/skills/yida-dashboard/SKILL.md +1 -1
  100. package/yida-skills/skills/yida-dashboard/references/pitfalls.md +1 -1
  101. package/yida-skills/skills/yida-get-schema/SKILL.md +49 -5
  102. package/yida-skills/skills/yida-i18n/SKILL.md +1 -1
  103. package/yida-skills/skills/yida-integration/SKILL.md +7 -1
  104. package/yida-skills/skills/yida-login/SKILL.md +50 -99
  105. package/yida-skills/skills/yida-page-config/SKILL.md +7 -1
  106. package/yida-skills/skills/yida-page-uiux/references/app/blueprint.md +0 -1
  107. package/yida-skills/skills/yida-page-uiux/references/app/navigation-patterns.md +0 -1
  108. package/yida-skills/skills/yida-page-uiux/references/app/role-journey.md +0 -1
  109. package/yida-skills/skills/yida-page-uiux/references/dashboard/app-blueprint.md +0 -1
  110. package/yida-skills/skills/yida-page-uiux/references/dashboard/chart-contracts.md +0 -1
  111. package/yida-skills/skills/yida-page-uiux/references/dashboard/component-contracts.md +0 -1
  112. package/yida-skills/skills/yida-page-uiux/references/dashboard/layout-patterns.md +0 -1
  113. package/yida-skills/skills/yida-page-uiux/references/dashboard/theme-recipes.md +0 -1
  114. package/yida-skills/skills/yida-page-uiux/references/detail/object-narrative.md +0 -1
  115. package/yida-skills/skills/yida-page-uiux/references/detail/section-patterns.md +0 -1
  116. package/yida-skills/skills/yida-page-uiux/references/detail/timeline-and-related.md +0 -1
  117. package/yida-skills/skills/yida-page-uiux/references/landing/assets-workflow.md +0 -1
  118. package/yida-skills/skills/yida-page-uiux/references/landing/industry-playbooks.md +0 -1
  119. package/yida-skills/skills/yida-page-uiux/references/landing/research-levels.md +0 -1
  120. package/yida-skills/skills/yida-page-uiux/references/landing/section-patterns.md +0 -1
  121. package/yida-skills/skills/yida-page-uiux/references/list/drawer-detail.md +0 -1
  122. package/yida-skills/skills/yida-page-uiux/references/list/empty-loading-error.md +0 -1
  123. package/yida-skills/skills/yida-page-uiux/references/list/filter-patterns.md +0 -1
  124. package/yida-skills/skills/yida-page-uiux/references/list/table-patterns.md +0 -1
  125. package/yida-skills/skills/yida-page-uiux/references/scenes/screen.md +0 -1
  126. package/yida-skills/skills/yida-page-uiux/references/workbench/entry-patterns.md +0 -1
  127. package/yida-skills/skills/yida-page-uiux/references/workbench/portal-layouts.md +0 -1
  128. package/yida-skills/skills/yida-page-uiux/references/workbench/task-feed.md +0 -1
  129. package/yida-skills/skills/yida-page-uiux/workflow/output-decision-block.md +1 -1
  130. package/yida-skills/skills/yida-process-rule/SKILL.md +35 -1
  131. package/yida-skills/skills/yida-publish-page/SKILL.md +46 -4
  132. package/yida-skills/skills/yida-report/SKILL.md +7 -1
  133. package/yida-skills/skills-index.json +14 -46
  134. package/yida-skills/skills/large-file-write/SKILL.md +0 -93
  135. package/yida-skills/skills/large-file-write/references/write-patterns.md +0 -147
  136. package/yida-skills/skills/large-file-write/scripts/write.js +0 -157
  137. package/yida-skills/skills/sls-log-workbench/SKILL.md +0 -134
  138. package/yida-skills/skills/sls-log-workbench/references/workbench-reference.md +0 -130
  139. package/yida-skills/skills/sls-log-workbench/sls-query.js +0 -295
@@ -15,32 +15,43 @@
15
15
 
16
16
  const fs = require('fs');
17
17
  const path = require('path');
18
- const { execSync } = require('child_process');
19
18
  const { CliError } = require('../core/cli-error');
20
- const { createAuthRef, createYidaClient, isAuthRefReady } = require('../core/yida-client');
19
+ const { createAuthRef, isAuthRefReady } = require('../core/yida-client');
21
20
  const { t } = require('../core/i18n');
22
21
  const { warn } = require('../core/chalk');
22
+ const { createFormForLegacyProcess } = require('../app/create-form');
23
+ const {
24
+ assertLegacyDirectWriteAllowed,
25
+ extractLegacyGuardArgs,
26
+ } = require('../core/legacy-schema-guard');
27
+ const {
28
+ getProcessCodeFromAppParam,
29
+ getProcessCodeFromSchema,
30
+ switchFormType,
31
+ } = require('./services/process-service');
23
32
 
24
33
  // ── 参数解析 ─────────────────────────────────────────
25
34
 
26
35
  function parseArgs(args) {
27
- const formUuidIndex = args.indexOf('--formUuid');
36
+ const guardSplit = extractLegacyGuardArgs(args || []);
37
+ const directArgs = guardSplit.args;
38
+ const formUuidIndex = directArgs.indexOf('--formUuid');
28
39
 
29
40
  // 用法 2: <appType> --formUuid <formUuid> <processDefinitionFile>
30
41
  if (formUuidIndex !== -1) {
31
- if (formUuidIndex + 2 >= args.length) {
42
+ if (formUuidIndex + 2 >= directArgs.length) {
32
43
  warn(t('create_process.usage2'));
33
44
  throw new CliError(t('create_process.usage2'), {
34
45
  code: 'CREATE_PROCESS_INVALID_ARGUMENTS',
35
46
  });
36
47
  }
37
48
  let appType = null;
38
- const existingFormUuid = args[formUuidIndex + 1];
39
- const processDefFile = args[formUuidIndex + 2];
49
+ const existingFormUuid = directArgs[formUuidIndex + 1];
50
+ const processDefFile = directArgs[formUuidIndex + 2];
40
51
 
41
- for (let i = 0; i < args.length; i++) {
42
- if (args[i] !== '--formUuid' && args[i] !== existingFormUuid && args[i] !== processDefFile) {
43
- appType = args[i];
52
+ for (let i = 0; i < directArgs.length; i++) {
53
+ if (directArgs[i] !== '--formUuid' && directArgs[i] !== existingFormUuid && directArgs[i] !== processDefFile) {
54
+ appType = directArgs[i];
44
55
  break;
45
56
  }
46
57
  }
@@ -51,81 +62,27 @@ function parseArgs(args) {
51
62
  fieldsJsonFile: null,
52
63
  processDefinitionFile: processDefFile,
53
64
  existingFormUuid,
65
+ legacyGuardOptions: guardSplit.guardOptions,
54
66
  };
55
67
  }
56
68
 
57
69
  // 用法 1: <appType> <formTitle> <fieldsJsonFile> <processDefinitionFile>
58
- if (args.length < 4) {
70
+ if (directArgs.length < 4) {
59
71
  warn(t('create_process.usage'));
60
72
  throw new CliError(t('create_process.usage'), {
61
73
  code: 'CREATE_PROCESS_INVALID_ARGUMENTS',
62
74
  });
63
75
  }
64
76
  return {
65
- appType: args[0],
66
- formTitle: args[1],
67
- fieldsJsonFile: args[2],
68
- processDefinitionFile: args[3],
77
+ appType: directArgs[0],
78
+ formTitle: directArgs[1],
79
+ fieldsJsonFile: directArgs[2],
80
+ processDefinitionFile: directArgs[3],
69
81
  existingFormUuid: null,
82
+ legacyGuardOptions: guardSplit.guardOptions,
70
83
  };
71
84
  }
72
85
 
73
- // ── API 调用函数 ─────────────────────────────────────
74
-
75
- function switchFormType(authRef, appType, formUuid) {
76
- const requestPath = '/' + appType + '/query/formdesign/switchFormType.json'
77
- + '?_api=Nav.transformForm&_mock=false&_stamp=' + Date.now();
78
- return createYidaClient({ authRef }).postForm(requestPath, {
79
- _locale_time_zone_offset: '28800000',
80
- toFormType: 'process',
81
- formUuid: formUuid,
82
- });
83
- }
84
-
85
- function getProcessCodeFromAppParam(authRef, appType, formUuid) {
86
- const requestPath = '/' + appType + '/query/app/getAppPlatFormParam.json';
87
- return createYidaClient({ authRef }).get(requestPath, {
88
- _api: 'nattyFetch',
89
- _mock: 'false',
90
- _locale_time_zone_offset: '28800000',
91
- pageIndex: 1,
92
- pageSize: 50,
93
- _stamp: Date.now(),
94
- }).then(function (result) {
95
- if (result.success && result.content && result.content.formNavigationList) {
96
- const navList = result.content.formNavigationList;
97
- for (let i = 0; i < navList.length; i++) {
98
- if (navList[i].formUuid === formUuid && navList[i].processCode) {
99
- return navList[i].processCode;
100
- }
101
- }
102
- }
103
- return null;
104
- });
105
- }
106
-
107
- function getProcessCodeFromSchema(authRef, appType, formUuid) {
108
- const requestPath = '/dingtalk/web/' + appType + '/query/formdesign/getFormSchema.json';
109
- return createYidaClient({ authRef }).get(requestPath, {
110
- formUuid,
111
- schemaVersion: 'V5',
112
- }).then(function (result) {
113
- if (result.success && result.content) {
114
- const schemaStr = typeof result.content === 'string' ? result.content : JSON.stringify(result.content);
115
- const matches = schemaStr.match(/TPROC[A-Za-z0-9_-]+/g);
116
- if (matches && matches.length > 0) {
117
- const unique = [];
118
- const seen = {};
119
- matches.forEach(function (m) {
120
- if (!seen[m]) { seen[m] = true; unique.push(m); }
121
- });
122
- return unique[0];
123
- }
124
- }
125
- return null;
126
- });
127
- }
128
-
129
86
  // ── 主流程 ───────────────────────────────────────────
130
87
 
131
88
  async function run(args) {
@@ -136,6 +93,13 @@ async function run(args) {
136
93
  const useExistingForm = !!existingFormUuid;
137
94
  const fieldsJsonFile = parsed.fieldsJsonFile ? path.resolve(parsed.fieldsJsonFile) : null;
138
95
  const processDefinitionFile = path.resolve(parsed.processDefinitionFile);
96
+ assertLegacyDirectWriteAllowed({
97
+ command: 'create-process',
98
+ resourceType: 'process',
99
+ action: 'create',
100
+ appType,
101
+ formUuid: existingFormUuid,
102
+ }, { guardOptions: parsed.legacyGuardOptions });
139
103
 
140
104
  warn('═'.repeat(60));
141
105
  warn(' 🔧 ' + t('create_process.title'));
@@ -189,17 +153,11 @@ async function run(args) {
189
153
  } else {
190
154
  warn('\n📋 Step 1: ' + t('create_process.creating_form') + '...');
191
155
  try {
192
- // 调用 openyida create-form create 命令
193
- const createFormOutput = execSync(
194
- 'node ' + JSON.stringify(path.resolve(__dirname, '..', '..', 'bin', 'yida.js')) +
195
- ' create-form create ' +
196
- JSON.stringify(appType) + ' ' +
197
- JSON.stringify(formTitle) + ' ' +
198
- JSON.stringify(fieldsJsonFile),
199
- { timeout: 60000, encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'] }
200
- );
201
- const outputLines = createFormOutput.trim().split('\n');
202
- const createFormResult = JSON.parse(outputLines[outputLines.length - 1]);
156
+ const createFormResult = await createFormForLegacyProcess(authRef, {
157
+ appType,
158
+ formTitle,
159
+ fieldsJsonFile,
160
+ });
203
161
 
204
162
  if (!createFormResult || !createFormResult.success || !createFormResult.formUuid) {
205
163
  warn(' ❌ ' + t('create_process.create_form_failed') + ': ' + JSON.stringify(createFormResult));
@@ -212,12 +170,12 @@ async function run(args) {
212
170
  formUuid = createFormResult.formUuid;
213
171
  fieldCount = createFormResult.fieldCount || 0;
214
172
  warn(' ✅ ' + t('create_process.form_created') + ': ' + formUuid);
215
- } catch (execError) {
216
- warn(' ❌ ' + t('create_process.create_form_failed') + ': ' + execError.message);
217
- if (execError.stderr) {
218
- warn(' ' + execError.stderr.substring(0, 1000));
173
+ } catch (createError) {
174
+ warn(' ❌ ' + t('create_process.create_form_failed') + ': ' + createError.message);
175
+ if (createError.stderr) {
176
+ warn(' ' + createError.stderr.substring(0, 1000));
219
177
  }
220
- throw new CliError(t('create_process.create_form_failed') + ': ' + execError.message, {
178
+ throw new CliError(t('create_process.create_form_failed') + ': ' + createError.message, {
221
179
  code: 'CREATE_PROCESS_CREATE_FORM_FAILED',
222
180
  });
223
181
  }
@@ -245,7 +203,7 @@ async function run(args) {
245
203
  warn('\n🔍 Step 3: ' + t('create_process.getting_process_code') + '...');
246
204
  let processCode = null;
247
205
 
248
- // 方法 1: 从 getAppPlatFormParam 接口提取
206
+ // 方法 1: 从精确表单流程绑定接口提取
249
207
  warn(' ' + t('create_process.method1') + '...');
250
208
  processCode = await getProcessCodeFromAppParam(authRef, appType, formUuid);
251
209
  if (processCode) {
@@ -278,6 +236,15 @@ async function run(args) {
278
236
  });
279
237
  }
280
238
 
239
+ assertLegacyDirectWriteAllowed({
240
+ command: 'configure-process',
241
+ resourceType: 'process',
242
+ action: 'update',
243
+ appType,
244
+ formUuid,
245
+ processCode,
246
+ }, { guardOptions: parsed.legacyGuardOptions });
247
+
281
248
  // Step 4: 配置并发布流程
282
249
  warn('\n⚙️ Step 4: ' + t('create_process.configuring_process') + '...');
283
250
  try {