openyida 2026.7.18 → 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 (200) hide show
  1. package/README.md +37 -2
  2. package/bin/yida.js +113 -18
  3. package/docs/capabilities.md +202 -0
  4. package/lib/agent-center/agent-center.js +2 -3
  5. package/lib/app/app-list.js +3 -4
  6. package/lib/app/build-page.js +13 -6
  7. package/lib/app/check-page.js +16 -6
  8. package/lib/app/compile.js +17 -7
  9. package/lib/app/create-app.js +14 -2
  10. package/lib/app/create-form/api-path.js +25 -0
  11. package/lib/app/create-form/args.js +13 -0
  12. package/lib/app/create-form/commands.js +4 -0
  13. package/lib/app/create-form/definition-reader.js +23 -23
  14. package/lib/app/create-form/field-normalizers.js +26 -7
  15. package/lib/app/create-form/schema-patch.js +4 -1
  16. package/lib/app/create-form.js +155 -68
  17. package/lib/app/create-page.js +47 -10
  18. package/lib/app/generate-page.js +20 -1
  19. package/lib/app/get-form-config.js +2 -1
  20. package/lib/app/get-schema.js +67 -15
  21. package/lib/app/import-app.js +94 -42
  22. package/lib/app/list-forms.js +4 -8
  23. package/lib/app/page-ir.js +140 -0
  24. package/lib/app/publish.js +289 -556
  25. package/lib/app/schema-field-resolution.js +370 -0
  26. package/lib/app/services/app-reader.js +85 -0
  27. package/lib/app/services/app-service.js +235 -0
  28. package/lib/app/services/canvas-page-compiler.js +91 -0
  29. package/lib/app/services/canvas-page-schema-builder.js +149 -0
  30. package/lib/app/services/field-bindings.js +68 -0
  31. package/lib/app/services/form-compiler.js +1922 -0
  32. package/lib/app/services/form-mode-service.js +182 -0
  33. package/lib/app/services/form-schema-patcher.js +333 -0
  34. package/lib/app/services/form-schema-reader.js +59 -0
  35. package/lib/app/services/form-service.js +379 -0
  36. package/lib/app/services/form-validation.js +562 -0
  37. package/lib/app/services/native-page-compiler.js +92 -0
  38. package/lib/app/services/native-page-schema-builder.js +428 -0
  39. package/lib/app/services/page-resource-service.js +185 -0
  40. package/lib/app/update-app.js +22 -9
  41. package/lib/app/update-form-config.js +4 -2
  42. package/lib/asset/asset-cmd.js +19 -6
  43. package/lib/auth/oauth-loopback.js +376 -15
  44. package/lib/auth/token-auth.js +34 -3
  45. package/lib/auth/token-store.js +22 -4
  46. package/lib/basic-info/basic-info.js +2 -1
  47. package/lib/bridge/bridge.js +43 -18
  48. package/lib/core/agent-capabilities.js +5 -3
  49. package/lib/core/command-errors.js +38 -0
  50. package/lib/core/command-manifest.js +59 -1
  51. package/lib/core/copy.js +12 -0
  52. package/lib/core/doctor.js +15 -4
  53. package/lib/core/env-cmd.js +1 -1
  54. package/lib/core/env.js +7 -6
  55. package/lib/core/i18n.js +66 -8
  56. package/lib/core/legacy-schema-guard.js +408 -0
  57. package/lib/core/locales/en.js +38 -46
  58. package/lib/core/locales/zh.js +30 -46
  59. package/lib/core/sample.js +12 -2
  60. package/lib/core/utils.js +334 -66
  61. package/lib/core/yida-client.js +108 -5
  62. package/lib/corp-efficiency/corp-efficiency.js +2 -2
  63. package/lib/corp-manager/corp-manager.js +3 -3
  64. package/lib/formula/evaluate.js +11 -68
  65. package/lib/formula/field-refs.js +83 -0
  66. package/lib/i18n-management/i18n-management.js +2 -3
  67. package/lib/process/configure-process.js +44 -1992
  68. package/lib/process/create-process.js +54 -87
  69. package/lib/process/preview-process.js +20 -8
  70. package/lib/process/services/process-compiler.js +2056 -0
  71. package/lib/process/services/process-reader.js +232 -0
  72. package/lib/process/services/process-resource-service.js +571 -0
  73. package/lib/process/services/process-service.js +122 -0
  74. package/lib/process/services/process-stage-checkpoint.js +246 -0
  75. package/lib/report/append.js +7 -26
  76. package/lib/report/http.js +31 -5
  77. package/lib/report/index.js +10 -2
  78. package/lib/samples/yida-canvas-custom-page/business-list.canvas.jsx +63 -14
  79. package/lib/samples/yida-canvas-custom-page/dashboard-overview.canvas.jsx +176 -32
  80. package/lib/samples/yida-canvas-custom-page/dashboard-starter.canvas.jsx +5 -2
  81. package/lib/samples/yida-canvas-custom-page/data-management.canvas.jsx +228 -14
  82. package/lib/samples/yida-canvas-custom-page/portal-shell-home.canvas.jsx +2 -2
  83. package/lib/samples/yida-canvas-custom-page/split-pane-detail.canvas.jsx +206 -10
  84. package/lib/samples/yida-custom-page/data-management.oyd.jsx +14 -3
  85. package/lib/samples/yida-custom-page/design-tokens.js +2 -2
  86. package/lib/samples/yida-custom-page/detail-profile.oyd.jsx +1 -1
  87. package/lib/samples/yida-custom-page/portal-shell-home.oyd.jsx +7 -2
  88. package/lib/samples/yida-custom-page/split-pane-detail.oyd.jsx +2 -1
  89. package/lib/schema/adapters/app-adapter.js +210 -0
  90. package/lib/schema/adapters/form-adapter.js +1362 -0
  91. package/lib/schema/adapters/keys.js +19 -0
  92. package/lib/schema/adapters/page-adapter.js +566 -0
  93. package/lib/schema/adapters/process-adapter.js +519 -0
  94. package/lib/schema/applier.js +1878 -0
  95. package/lib/schema/apply-store.js +1083 -0
  96. package/lib/schema/command.js +645 -0
  97. package/lib/schema/dependency-graph.js +83 -0
  98. package/lib/schema/errors.js +481 -0
  99. package/lib/schema/hash.js +9 -0
  100. package/lib/schema/manifest-limits.js +177 -0
  101. package/lib/schema/manifest-loader.js +309 -0
  102. package/lib/schema/manifest-schema-v1.json +193 -0
  103. package/lib/schema/normalize-manifest.js +281 -0
  104. package/lib/schema/page-canvas-foundation.js +447 -0
  105. package/lib/schema/page-data-source-builder.js +561 -0
  106. package/lib/schema/page-foundation.js +556 -0
  107. package/lib/schema/page-source-loader.js +314 -0
  108. package/lib/schema/planner.js +691 -0
  109. package/lib/schema/remote-dispatch-boundary.js +39 -0
  110. package/lib/schema/remote-missing.js +21 -0
  111. package/lib/schema/remote-reader.js +189 -0
  112. package/lib/schema/resource-registry.js +157 -0
  113. package/lib/schema/server-revision.js +71 -0
  114. package/lib/schema/sort.js +28 -0
  115. package/lib/schema/state-store.js +589 -0
  116. package/package.json +10 -8
  117. package/scripts/check-release-risks.js +254 -0
  118. package/scripts/generate-command-docs.js +6 -1
  119. package/scripts/i18n-baseline.json +11 -11
  120. package/scripts/postinstall.js +8 -12
  121. package/scripts/validate-ci.sh +15 -11
  122. package/scripts/validate-i18n.js +30 -9
  123. package/scripts/validate-package-size.js +5 -2
  124. package/scripts/validate-skills.js +4 -0
  125. package/scripts/validate-structure.js +15 -0
  126. package/yida-skills/SKILL.md +117 -30
  127. package/yida-skills/references/schema-as-code-phase1.md +99 -0
  128. package/yida-skills/references/setup-and-env.md +59 -59
  129. package/yida-skills/references/task-retrospective.md +6 -6
  130. package/yida-skills/skills/yida-app/SKILL.md +78 -17
  131. package/yida-skills/skills/yida-canvas-custom-page/SKILL.md +18 -7
  132. package/yida-skills/skills/yida-canvas-custom-page/references/data-bridge-guide.md +3 -3
  133. package/yida-skills/skills/yida-canvas-custom-page/references/page-generation-guide.md +15 -0
  134. package/yida-skills/skills/yida-create-app/SKILL.md +21 -3
  135. package/yida-skills/skills/yida-create-form-page/SKILL.md +19 -1
  136. package/yida-skills/skills/yida-create-page/SKILL.md +16 -3
  137. package/yida-skills/skills/yida-create-process/SKILL.md +100 -4
  138. package/yida-skills/skills/yida-custom-page/SKILL.md +19 -4
  139. package/yida-skills/skills/yida-dashboard/SKILL.md +1 -1
  140. package/yida-skills/skills/yida-dashboard/references/pitfalls.md +1 -1
  141. package/yida-skills/skills/yida-get-schema/SKILL.md +49 -5
  142. package/yida-skills/skills/yida-i18n/SKILL.md +1 -1
  143. package/yida-skills/skills/yida-integration/SKILL.md +7 -1
  144. package/yida-skills/skills/yida-login/SKILL.md +50 -99
  145. package/yida-skills/skills/yida-page-config/SKILL.md +7 -1
  146. package/yida-skills/skills/yida-page-uiux/references/app/blueprint.md +0 -1
  147. package/yida-skills/skills/yida-page-uiux/references/app/navigation-patterns.md +0 -1
  148. package/yida-skills/skills/yida-page-uiux/references/app/role-journey.md +0 -1
  149. package/yida-skills/skills/yida-page-uiux/references/dashboard/app-blueprint.md +0 -1
  150. package/yida-skills/skills/yida-page-uiux/references/dashboard/chart-contracts.md +0 -1
  151. package/yida-skills/skills/yida-page-uiux/references/dashboard/component-contracts.md +0 -1
  152. package/yida-skills/skills/yida-page-uiux/references/dashboard/layout-patterns.md +0 -1
  153. package/yida-skills/skills/yida-page-uiux/references/dashboard/theme-recipes.md +0 -1
  154. package/yida-skills/skills/yida-page-uiux/references/detail/object-narrative.md +0 -1
  155. package/yida-skills/skills/yida-page-uiux/references/detail/section-patterns.md +0 -1
  156. package/yida-skills/skills/yida-page-uiux/references/detail/timeline-and-related.md +0 -1
  157. package/yida-skills/skills/yida-page-uiux/references/landing/assets-workflow.md +0 -1
  158. package/yida-skills/skills/yida-page-uiux/references/landing/industry-playbooks.md +0 -1
  159. package/yida-skills/skills/yida-page-uiux/references/landing/research-levels.md +0 -1
  160. package/yida-skills/skills/yida-page-uiux/references/landing/section-patterns.md +0 -1
  161. package/yida-skills/skills/yida-page-uiux/references/list/drawer-detail.md +0 -1
  162. package/yida-skills/skills/yida-page-uiux/references/list/empty-loading-error.md +0 -1
  163. package/yida-skills/skills/yida-page-uiux/references/list/filter-patterns.md +0 -1
  164. package/yida-skills/skills/yida-page-uiux/references/list/table-patterns.md +0 -1
  165. package/yida-skills/skills/yida-page-uiux/references/scenes/screen.md +0 -1
  166. package/yida-skills/skills/yida-page-uiux/references/workbench/entry-patterns.md +0 -1
  167. package/yida-skills/skills/yida-page-uiux/references/workbench/portal-layouts.md +0 -1
  168. package/yida-skills/skills/yida-page-uiux/references/workbench/task-feed.md +0 -1
  169. package/yida-skills/skills/yida-page-uiux/workflow/output-decision-block.md +1 -1
  170. package/yida-skills/skills/yida-process-rule/SKILL.md +35 -1
  171. package/yida-skills/skills/yida-publish-page/SKILL.md +46 -4
  172. package/yida-skills/skills/yida-report/SKILL.md +9 -235
  173. package/yida-skills/skills/yida-report/references/schema-builder-details.md +239 -0
  174. package/yida-skills/skills/yida-skill-evaluator/SKILL.md +170 -0
  175. package/yida-skills/skills-index.json +238 -54
  176. package/lib/core/locales/ar.js +0 -834
  177. package/lib/core/locales/de.js +0 -834
  178. package/lib/core/locales/es.js +0 -834
  179. package/lib/core/locales/fr.js +0 -834
  180. package/lib/core/locales/hi.js +0 -834
  181. package/lib/core/locales/ja.js +0 -1227
  182. package/lib/core/locales/ko.js +0 -836
  183. package/lib/core/locales/pt.js +0 -834
  184. package/lib/core/locales/vi.js +0 -834
  185. package/lib/core/locales/zh-HK.js +0 -1263
  186. package/project/pages/src/demo-birthday-game.oyd.jsx +0 -832
  187. package/project/pages/src/demo-chip-insight.oyd.jsx +0 -983
  188. package/project/pages/src/demo-compat-smoke.oyd.jsx +0 -58
  189. package/project/pages/src/demo-crm-batch-entry.oyd.jsx +0 -805
  190. package/project/pages/src/demo-crm-dashboard.oyd.jsx +0 -677
  191. package/project/pages/src/demo-future-vision-2026.oyd.jsx +0 -1102
  192. package/project/pages/src/demo-ppt.oyd.jsx +0 -1192
  193. package/project/pages/src/demo-salary-calculator.oyd.jsx +0 -904
  194. package/project/pages/src/openyida-knowledge-doc.oyd.jsx +0 -1714
  195. package/yida-skills/skills/large-file-write/SKILL.md +0 -93
  196. package/yida-skills/skills/large-file-write/references/write-patterns.md +0 -147
  197. package/yida-skills/skills/large-file-write/scripts/write.js +0 -157
  198. package/yida-skills/skills/sls-log-workbench/SKILL.md +0 -134
  199. package/yida-skills/skills/sls-log-workbench/references/workbench-reference.md +0 -130
  200. package/yida-skills/skills/sls-log-workbench/sls-query.js +0 -295
package/README.md CHANGED
@@ -149,7 +149,7 @@ openyida/
149
149
  ├── bin/yida.js # CLI entry and command routing
150
150
  ├── lib/
151
151
  │ ├── app/ # Application, form, page, import/export commands
152
- │ ├── auth/ # Login, QR login, browser handoff, organization switch
152
+ │ ├── auth/ # OAuth token login, token session storage, organization switch
153
153
  │ ├── connector/ # HTTP connector lifecycle and smart creation
154
154
  │ ├── core/ # Environment detection, i18n, diagnostics, data commands
155
155
  │ ├── process/ # Process form creation, configuration, preview
@@ -174,6 +174,7 @@ openyida corp-efficiency
174
174
  openyida create-form create APP_XXX "Customer" .cache/openyida/forms/customer-fields.json
175
175
  openyida create-form update APP_XXX FORM_XXX .cache/openyida/forms/customer-changes.json
176
176
  openyida get-schema APP_XXX FORM_XXX
177
+ openyida get-schema APP_XXX FORM_XXX --compact --resolve-fields "Customer Name,Status"
177
178
  openyida get-schema APP_XXX --all --output-dir .cache/schemas
178
179
  ```
179
180
 
@@ -240,6 +241,7 @@ Most checks should stay offline, but OpenYida also includes an explicit real-env
240
241
  OPENYIDA_E2E=1 npm run test:e2e:real
241
242
  OPENYIDA_E2E=1 npm run test:e2e:real:full
242
243
  OPENYIDA_E2E=1 OPENYIDA_E2E_FULL_STAGES=auth,app,form,process npm run test:e2e:real:full
244
+ npm run test:e2e:real:schema-source
243
245
  npm run test:e2e:real:skills
244
246
  ```
245
247
 
@@ -249,6 +251,8 @@ The runner creates a disposable app, form, and custom page with an `OY_E2E_*` pr
249
251
 
250
252
  `test:e2e:real:skills` enforces coverage for every directory under `yida-skills/skills/`. Each skill must be classified as real E2E, offline/unit, opt-in, or deprecated with an explicit reason. This prevents new skills from quietly bypassing the real-environment test plan.
251
253
 
254
+ `test:e2e:real:schema-source` is a local process-level Schema-as-Code E2E for agent/source checkout validation. It reads `yida-skills/` in place, creates a temporary `openyida` launcher that executes the current checkout `bin/yida.js`, and runs CRM app/form/page/process create, managed-update, and noop scenarios through `schema validate -> plan -> apply -> noop` against a mock Yida service, including customer field updates and approval-flow/page changes. Report and integration automation manifests remain compatibility-boundary scenarios and must return unsupported.
255
+
252
256
  Each successful full run leaves a human-inspectable result app in the target organization. The final step publishes a dedicated `Full E2E Dashboard` custom page, renames the app to `OY_E2E_*_PASSED` by default, and prints direct links for the app, form, dashboard page, and report; the same links are saved under `resultApp` in the registry JSON.
253
257
 
254
258
  Useful options:
@@ -277,6 +281,20 @@ The E2E paths above prove the *CLI* works. The eval harness under `scripts/eval/
277
281
  # the selected sub-skill against the golden set.
278
282
  npm run eval:routing
279
283
 
284
+ # Doc quality — static analysis of all SKILL.md files (standards + maintainability).
285
+ npm run eval:doc-quality
286
+
287
+ # Safety — credential leak detection, command whitelist, corpId consistency.
288
+ npm run eval:safety
289
+
290
+ # Coverage — how much of the skill/category/reference space is covered by scenarios.
291
+ npm run eval:coverage
292
+
293
+ # Comprehensive — 10-dimension scorecard for a single skill (doc quality, routing,
294
+ # safety, step completeness, output validity, efficiency, stability, coverage).
295
+ # Outputs a JSON scorecard, SVG radar chart, and trend analysis.
296
+ npm run eval:comprehensive -- --skill yida-dashboard
297
+
280
298
  # Tool-pipeline baseline (end-to-end) — wraps the real-environment runner for one
281
299
  # sub-skill, adds guardrail assertions, screenshots the published page, and writes a
282
300
  # human scoring template. Runs deterministic CLI commands (no agent) so it serves as
@@ -302,15 +320,19 @@ OPENYIDA_E2E=1 npm run eval:all -- --skill yida-dashboard --screenshot
302
320
  # that runs the tasks above on click. Binds to 127.0.0.1 only; tasks are a fixed
303
321
  # whitelist. Use the Node version you start it with, so run `nvm use 20` first.
304
322
  npm run eval:dashboard # http://127.0.0.1:4500
323
+
324
+ # You can also run eval directly via the CLI:
325
+ openyida eval --mode comprehensive --skill yida-dashboard
305
326
  ```
306
327
 
307
328
  Configuration precedence is `CLI flag > env (OPENYIDA_EVAL_*) > scripts/eval/eval.config.json > defaults`.
308
329
 
309
330
  | Flag | Purpose |
310
331
  |------|---------|
311
- | `--mode e2e\|routing\|generate\|all` | Which evals to run (default `e2e`; `all` = routing + tool-pipeline baseline + real generation) |
332
+ | `--mode e2e\|routing\|generate\|doc-quality\|safety\|coverage\|comprehensive\|all` | Which evals to run (default `e2e`) |
312
333
  | `--skill <name>` | Restrict the e2e run to one sub-skill; stages are reverse-looked-up from the `SKILL_COVERAGE` matrix |
313
334
  | `--stages a,b` | Explicit stage list, overriding the skill reverse-lookup |
335
+ | `--runs N` | Multi-run stability: repeat routing N times, report consistency rate |
314
336
  | `--screenshot` / `--no-screenshot` | Capture the published page (default on; skipped gracefully if Playwright is absent) |
315
337
  | `--auto-score` / `--no-auto-score` | Score screenshots with the local `claude -p` agent (default off → human template only) |
316
338
  | `--scenarios <dir>` | Routing golden-set directory (default `scripts/eval/scenarios`) |
@@ -336,6 +358,8 @@ openyida append-chart APP_XXX REPORT_XXX .cache/openyida/reports/chart.json
336
358
 
337
359
  Run `openyida --help` or `openyida <command> --help` for detailed usage.
338
360
 
361
+ Schema-as-Code Phase 1 manages app, form, process, and native/default display page resources. Use the single [Phase 1 Manifest guide](yida-skills/references/schema-as-code-phase1.md): create any referenced page source first, run `validate`, run the read-only `plan`, review its current `planId`, then explicitly approve and run `apply`. Error `nextAction`/`ask_human` never grants the first write; `stale_replanned` only returns a replacement plan for another explicit review. State is the only persisted bindings authority; report, automation, and page config/delete/pull remain outside Phase 1.
362
+
339
363
  <!-- OPENYIDA_COMMANDS_START -->
340
364
  <!-- This section is generated by `npm run docs:commands`. Do not edit command rows by hand. -->
341
365
 
@@ -388,6 +412,14 @@ Run `openyida --help` or `openyida <command> --help` for detailed usage.
388
412
  | `openyida update-form-config <appType> ...` | Update form configuration |
389
413
  | `openyida get-form-config <appType> <formUuid> [--json]` | Query form configuration |
390
414
 
415
+ ### Schema-as-Code
416
+
417
+ | Command | Description |
418
+ |---------|-------------|
419
+ | `openyida schema validate <manifest> --json --quiet` | Validate Schema-as-Code manifest locally |
420
+ | `openyida schema plan <manifest> --state <path> --json --quiet` | Plan Schema-as-Code changes with read-only remote observation |
421
+ | `openyida schema apply <manifest> --state <path> --plan-id <planId> --json --quiet` | Apply a reviewed Schema-as-Code plan with checkpoints and recovery guards |
422
+
391
423
  ### Data & Permissions
392
424
 
393
425
  | Command | Description |
@@ -468,6 +500,7 @@ Run `openyida --help` or `openyida <command> --help` for detailed usage.
468
500
  | `openyida copy [--force]` | Copy project working directory |
469
501
  | `openyida sample [--list]` | Output code samples/templates |
470
502
  | `openyida doctor [--fix]` | Environment diagnostics & auto-fix |
503
+ | `openyida eval --mode <mode> [--skill <name>] [--runs N]` | Multi-dimensional skill evaluation (doc quality, routing accuracy, safety, etc.) |
471
504
  | `openyida db-seq-fix [--fix]` | Detect and repair PostgreSQL sequence drift |
472
505
  | `openyida formula evaluate <formula\|file> [--schema file]` | Static-check Yida formula syntax and field refs |
473
506
  | `openyida update` | Check and update to latest version |
@@ -493,6 +526,8 @@ Environment selectors such as `--env intl`, `--intl`, `--overseas`, `--global`,
493
526
 
494
527
  For overseas apps, pass `--locale en_US` or `--locale ja_JP` on creation commands, or set `OPENYIDA_CONTENT_LOCALE`. OpenYida writes YiDA resource names with `zh_CN`, `en_US`, and `ja_JP` values so Global YiDA does not fall back to Chinese-only metadata.
495
528
 
529
+ The CLI package ships the core UI languages `zh` and `en` by default. Other CLI UI language packs are optional: keep or install files such as `ja.js` / `fr.js` in an external directory and point `OPENYIDA_LOCALE_DIR` to that directory, then set `OPENYIDA_LANG=ja`. If an optional language pack is unavailable, OpenYida falls back through `en -> zh`.
530
+
496
531
  #### Forms and Pages
497
532
 
498
533
  Form field definitions can include `alias` or `componentAlias` to populate Yida designer component aliases, stored as `pages[0].componentAlias.items`. Yida runtime resolves these aliases in page JS, so `this.$('phone')` can be used instead of `this.$('textField_xxx')`; OpenYida form rules, validations, and `openyida data ... --resolve-aliases` JSON inputs also accept aliases as field references. For server-side DingTalk OpenAPI calls, use `GET /v2.0/yida/forms/component/alias/{appType}/{formUuid}` to read the `{ fieldId, alias }` mapping, then translate aliases before sending form data/search JSON. That endpoint requires `systemToken`, `userId`, an access token, and the Yida form data read permission; grant that permission in DingTalk developer console API permissions and publish the DingTalk app. Yida app code and app secret are available under app settings > deployment/maintenance.
package/bin/yida.js CHANGED
@@ -18,6 +18,7 @@ const { COMMAND_GROUPS, buildCommandManifest } = require('../lib/core/command-ma
18
18
 
19
19
  const command = process.argv[2];
20
20
  const args = process.argv.slice(3);
21
+ const rawArgs = process.argv.slice(3);
21
22
 
22
23
  function isAgentEnvironment(env) {
23
24
  return !!(
@@ -55,6 +56,9 @@ function shouldRunUpdateCheck() {
55
56
  if (!command || command === '--help' || command === '-h' || command === '--version' || command === '-v') {
56
57
  return false;
57
58
  }
59
+ if (args.includes('--help') || args.includes('-h')) {
60
+ return false;
61
+ }
58
62
  if (command === 'commands' || command === 'agent-capabilities' || command === 'mcp') {
59
63
  return false;
60
64
  }
@@ -250,12 +254,15 @@ function printLoginResult(result) {
250
254
  return;
251
255
  }
252
256
 
253
- const tokenUsable = result.can_auto_use !== false && !!result.access_token;
257
+ const tokenUsable = result.ok !== undefined
258
+ ? !!result.ok
259
+ : (result.can_auto_use !== false && !!result.access_token);
254
260
  const summary = {
255
261
  ok: tokenUsable,
256
262
  status: result.status || (tokenUsable ? 'ok' : 'token_not_issued'),
257
263
  auth_mode: 'token',
258
- can_auto_use: tokenUsable,
264
+ auth_source: result.auth_source || result.authSource,
265
+ can_auto_use: result.can_auto_use !== undefined ? !!result.can_auto_use : tokenUsable,
259
266
  token_type: result.token_type || 'Bearer',
260
267
  access_token: maskSensitiveAuthOutput({ access_token: result.access_token }).access_token,
261
268
  expires_at: result.expires_at ? new Date(result.expires_at).toISOString() : undefined,
@@ -263,6 +270,7 @@ function printLoginResult(result) {
263
270
  corp_id: result.corp_id,
264
271
  user_id: result.user_id,
265
272
  user_name: result.user_name,
273
+ failure_reason: result.failure_reason,
266
274
  message: result.message,
267
275
  raw: tokenUsable ? undefined : result.raw,
268
276
  };
@@ -308,6 +316,30 @@ function getArgValue(cliArgs, name) {
308
316
  return cliArgs[index + 1];
309
317
  }
310
318
 
319
+ const UNSUPPORTED_LEGACY_LOGIN_FLAGS = new Set([
320
+ '--qr',
321
+ '--qr-code',
322
+ '--agent-qr',
323
+ '--codex-qr',
324
+ '--agent-poll',
325
+ '--codex-poll',
326
+ '--browser',
327
+ '--codex',
328
+ '--qoder',
329
+ '--wukong',
330
+ ]);
331
+
332
+ function findUnsupportedLegacyLoginFlag(...argLists) {
333
+ for (const argList of argLists) {
334
+ for (const arg of argList || []) {
335
+ if (UNSUPPORTED_LEGACY_LOGIN_FLAGS.has(arg)) {
336
+ return arg;
337
+ }
338
+ }
339
+ }
340
+ return null;
341
+ }
342
+
311
343
  function parseLoginTargetArg(value) {
312
344
  const raw = String(value || '').trim();
313
345
  if (!raw) {return null;}
@@ -445,6 +477,34 @@ function throwCliUsage(...lines) {
445
477
  });
446
478
  }
447
479
 
480
+ function hasHelpFlag(cliArgs = []) {
481
+ return cliArgs.includes('--help') || cliArgs.includes('-h');
482
+ }
483
+
484
+ function printCommandUsage(...lines) {
485
+ console.log(lines.filter(Boolean).join('\n'));
486
+ }
487
+
488
+ function printLoginHelp() {
489
+ printCommandUsage(t('cli.login_usage'), t('cli.login_example'));
490
+ }
491
+
492
+ function printAuthHelp() {
493
+ printCommandUsage(t('cli.auth_usage'), t('cli.auth_example'));
494
+ }
495
+
496
+ function assertNoUnsupportedLegacyLoginFlags(...argLists) {
497
+ const flag = findUnsupportedLegacyLoginFlag(...argLists);
498
+ if (!flag) {
499
+ return;
500
+ }
501
+ throwCliUsage(
502
+ t('cli.login_unsupported_option', flag),
503
+ t('cli.login_usage'),
504
+ t('cli.login_example')
505
+ );
506
+ }
507
+
448
508
  async function main() {
449
509
  applyQuietFlag();
450
510
  applyGlobalEnvironmentFlags();
@@ -516,15 +576,23 @@ async function main() {
516
576
 
517
577
  case 'login': {
518
578
  const loginArgs = applyLoginEnvironmentFlags(args, { inferTargetUrl: true });
519
- const { tokenLogin, tokenStatus } = require('../lib/auth/token-auth');
520
- if (loginArgs.includes('--check-only')) {
521
- console.log(JSON.stringify(tokenStatus(), null, 2));
579
+ const { getAuthStatus, isEnvAuthMode } = require('../lib/core/utils');
580
+ if (hasHelpFlag(loginArgs)) {
581
+ printLoginHelp();
522
582
  } else {
523
- const result = await tokenLogin({
524
- clientId: getArgValue(loginArgs, '--client-id'),
525
- quiet: loginArgs.includes('--quiet'),
526
- });
527
- printLoginResult(result);
583
+ assertNoUnsupportedLegacyLoginFlags(rawArgs, loginArgs);
584
+ if (loginArgs.includes('--check-only')) {
585
+ console.log(JSON.stringify(getAuthStatus(), null, 2));
586
+ } else if (isEnvAuthMode()) {
587
+ printLoginResult(getAuthStatus());
588
+ } else {
589
+ const { tokenLogin } = require('../lib/auth/token-auth');
590
+ const result = await tokenLogin({
591
+ clientId: getArgValue(loginArgs, '--client-id'),
592
+ quiet: loginArgs.includes('--quiet'),
593
+ });
594
+ printLoginResult(result);
595
+ }
528
596
  }
529
597
  break;
530
598
  }
@@ -538,15 +606,25 @@ async function main() {
538
606
  case 'auth': {
539
607
  const subCommand = args[0];
540
608
  const authArgs = applyLoginEnvironmentFlags(args.slice(1), { inferTargetUrl: true });
541
- const { tokenLogin, tokenLogout, tokenRefresh, tokenStatus } = require('../lib/auth/token-auth');
542
- if (subCommand === 'status') {
543
- console.log(JSON.stringify(tokenStatus(), null, 2));
609
+ const { getAuthStatus, isEnvAuthMode } = require('../lib/core/utils');
610
+ const { tokenLogin, tokenLogout, tokenRefresh } = require('../lib/auth/token-auth');
611
+ if (!subCommand || subCommand === '--help' || subCommand === '-h') {
612
+ printAuthHelp();
613
+ } else if (subCommand === 'status') {
614
+ console.log(JSON.stringify(getAuthStatus(), null, 2));
544
615
  } else if (subCommand === 'login') {
545
- const result = await tokenLogin({
546
- clientId: getArgValue(authArgs, '--client-id'),
547
- quiet: authArgs.includes('--quiet'),
548
- });
549
- printLoginResult(result);
616
+ if (hasHelpFlag(authArgs)) {
617
+ printLoginHelp();
618
+ } else {
619
+ assertNoUnsupportedLegacyLoginFlags(rawArgs.slice(1), authArgs);
620
+ const result = isEnvAuthMode()
621
+ ? getAuthStatus()
622
+ : await tokenLogin({
623
+ clientId: getArgValue(authArgs, '--client-id'),
624
+ quiet: authArgs.includes('--quiet'),
625
+ });
626
+ printLoginResult(result);
627
+ }
550
628
  } else if (subCommand === 'refresh') {
551
629
  console.log(JSON.stringify(maskSensitiveAuthOutput(await tokenRefresh()), null, 2));
552
630
  } else if (subCommand === 'logout') {
@@ -624,6 +702,12 @@ async function main() {
624
702
  break;
625
703
  }
626
704
 
705
+ case 'schema': {
706
+ const { run } = require('../lib/schema/command');
707
+ await run(args);
708
+ break;
709
+ }
710
+
627
711
  case 'formula': {
628
712
  const subCommand = args[0];
629
713
  const subArgs = args.slice(1);
@@ -664,6 +748,11 @@ async function main() {
664
748
  }
665
749
 
666
750
  case 'publish': {
751
+ if (args.includes('--help') || args.includes('-h')) {
752
+ const publishMain = require('../lib/app/publish');
753
+ await publishMain(args);
754
+ break;
755
+ }
667
756
  const passThroughFlags = new Set(['--skip-lint', '--health-check', '--check', '--open', '--no-open', '--compat', '--modern', '--force', '--canvas']);
668
757
  const filteredArgs = args.filter(arg => !passThroughFlags.has(arg));
669
758
  if (filteredArgs.length < 3) {
@@ -1051,6 +1140,12 @@ async function main() {
1051
1140
  break;
1052
1141
  }
1053
1142
 
1143
+ case 'eval': {
1144
+ const { main: evalMain } = require('../scripts/eval/runner');
1145
+ await evalMain(args);
1146
+ break;
1147
+ }
1148
+
1054
1149
  default: {
1055
1150
  throwCliUsage(t('cli.unknown_command', command), t('cli.run_help'));
1056
1151
  }
@@ -0,0 +1,202 @@
1
+ # OpenYida 功能完整列表
2
+
3
+ 这份清单面向宜搭使用者,说明 OpenYida 支持的功能,以及对应可以执行的 `openyida` 命令。参数细节可以继续查看 `openyida --help`、`openyida <command> --help` 或 `openyida commands --json`。
4
+
5
+ ## 基础操作
6
+
7
+ | 功能 | 执行操作 |
8
+ |---|---|
9
+ | 查看当前环境和登录态 | `openyida env` / `openyida env --json` |
10
+ | 登录宜搭 | `openyida login` |
11
+ | 指定入口登录 | `openyida login <target-url>` |
12
+ | 只检查是否已登录 | `openyida login --check-only --json` |
13
+ | 查看可切换组织 | `openyida org list` |
14
+ | 交互式切换组织 | `openyida org switch` |
15
+ | 切换到指定组织 | `openyida org switch --corp-id <corpId>` |
16
+ | 退出登录 | `openyida logout` |
17
+ | 管理 token 登录态 | `openyida auth <status\|login\|refresh\|logout>` |
18
+ | 查看全部命令清单 | `openyida commands --json` |
19
+ | 查看 Agent 一次性能力快照 | `openyida agent-capabilities --json` / `openyida agent-capabilities --summary-json` |
20
+
21
+ ## 应用与组织管理
22
+
23
+ | 功能 | 执行操作 |
24
+ |---|---|
25
+ | 查询我的应用 | `openyida app-list [--size N]` |
26
+ | 创建应用 | `openyida create-app "<应用名称>"` |
27
+ | 更新应用名称、布局、主题 | `openyida update-app <appType> [--name "..."] [--layout slide\|ver] [--theme deepBlue]` |
28
+ | 导出应用迁移包 | `openyida export <appType> [output]` |
29
+ | 导入应用迁移包 | `openyida import <file> [name]` |
30
+ | 管理左侧导航分组 | `openyida nav-group <list\|create\|rename\|delete\|move\|order\|hide\|show> <appType> ...` |
31
+ | 管理应用管理员 | `openyida app-permission <get\|set\|add\|remove\|search-user> ...` |
32
+ | 管理应用多语言 | `openyida i18n <overview\|config\|languages\|list\|upsert\|delete\|translate\|translate-all\|upgrade> <appType> ...` |
33
+ | 查询组织基础信息、容量、额度、域名 | `openyida basic-info <overview\|commodity\|grant\|capacity\|quota\|abs-path\|dataflow\|i18n\|domain>` |
34
+ | 查询企业效能 | `openyida corp-efficiency [overview\|details\|detail\|groups\|notify] [options]` |
35
+ | 管理平台管理员和通讯录权限 | `openyida corp-manager <search-user\|list\|add\|remove\|address-book> ...` |
36
+
37
+ 说明:CLI 界面语言默认内置 `zh` / `en`。其他语言包可通过 `OPENYIDA_LOCALE_DIR` 按需加载;应用内多语言仍使用 `openyida i18n` 管理宜搭应用文案。
38
+
39
+ ## 表单与数据模型
40
+
41
+ | 功能 | 执行操作 |
42
+ |---|---|
43
+ | 创建表单 | `openyida create-form create <appType> ...` |
44
+ | 更新表单字段 | `openyida create-form update <appType> ...` |
45
+ | 用 patch 更新表单 | `openyida create-form patch <appType> <formUuid> <patchJsonOrFile>` |
46
+ | 配置表单联动规则 | `openyida create-form rule <appType> <formUuid> <rulesJsonOrFile>` |
47
+ | 配置字段校验 | `openyida create-form validation <appType> <formUuid> <validationsJsonOrFile>` |
48
+ | 快速新增字段校验 | `openyida add-validation <appType> <formUuid> --field <labelOrId> --type <phone\|regex\|idCard\|email\|...>` |
49
+ | 绑定字段远程数据源 | `openyida create-form bind-datasource <appType> <formUuid> <fieldLabelOrId> <dataSourceJsonOrFile>` |
50
+ | 给选项字段追加选项 | `openyida create-form add-option <appType> <formUuid> <fieldLabel> <option1> [option2] ...` |
51
+ | 查询应用内表单/页面 | `openyida list-forms <appType> [--keyword <text>]` |
52
+ | 获取表单 Schema | `openyida get-schema <appType> <formUuid>` |
53
+ | 获取应用全部 Schema | `openyida get-schema <appType> --all` |
54
+ | 导出 ER 关系图 | `openyida er <appType> [--format mermaid\|json] [--output file]` |
55
+ | 管理聚合表 virtualView | `openyida aggregate-table <list\|create-empty\|inspect\|preview\|save\|publish\|status> <appType> ...` |
56
+
57
+ ## 自定义页面与发布
58
+
59
+ | 功能 | 执行操作 |
60
+ |---|---|
61
+ | 创建自定义页面 | `openyida create-page <appType> "<页面名称>"` |
62
+ | 创建看板页 | `openyida create-page <appType> "<页面名称>" --mode dashboard` |
63
+ | 从模板生成页面源码 | `openyida generate-page <template>` |
64
+ | 构建宜搭兼容页面源码 | `openyida build-page <sourceFile> [--output file\|--write]` |
65
+ | 检查普通自定义页面 JSX 规范 | `openyida check-page <src> [--compat]` |
66
+ | 本地编译普通自定义页面 JSX | `openyida compile <src>` |
67
+ | 发布普通自定义页面 JSX | `openyida publish project/pages/src/home.oyd.jsx <appType> <formUuid>` |
68
+ | 发布 Code Canvas 页面 | `openyida publish project/pages/src/home.canvas.jsx <appType> <formUuid>`(`.canvas.jsx` / `.canvas.tsx` 自动启用 Canvas 编译,生成 `runtimeCode` + `importedModules` 并保存为 `YidaCodeCanvas` Schema) |
69
+ | 显式按 Code Canvas 链路发布 | `openyida publish <src> <appType> <formUuid> --canvas` |
70
+ | 发布并做健康检查 | `openyida publish <src> <appType> <formUuid> --health-check` |
71
+ | 更新页面/表单配置 | `openyida update-form-config <appType> ...` |
72
+ | 查询页面/表单配置 | `openyida get-form-config <appType> <formUuid> [--json]` |
73
+ | 开发高级自定义页面、看板、图表或幻灯片 | 默认优先使用 Code Canvas 链路;明确要求普通自定义页面 JSX/Jsx,或强依赖普通自定义页实例桥时使用 `.oyd.jsx` + `check-page` / `compile` / `publish` |
74
+ | Code Canvas 页面使用成员/部门/上传等宜搭运行态组件 | `openyida sample yida-canvas-custom-page native-components-smoke --output pages/src/native-components-smoke.canvas.jsx`;再参考 `yida-canvas-custom-page/references/native-components-bridge.md` |
75
+ | Code Canvas 门户 + 成员/部门/上传组件示例 | `openyida sample yida-canvas-custom-page portal-native-components --output pages/src/portal-native-components.canvas.jsx` |
76
+ | 普通自定义页面 JSX/Jsx 使用成员/部门组件 | 使用 `.oyd.jsx`,参考 `yida-custom-page/references/component-jsx-guide.md` |
77
+ | 普通自定义页面 JSX/Jsx 使用附件/图片上传 | 使用 `.oyd.jsx`,参考 `yida-custom-page/references/attachment-upload-guide.md` |
78
+
79
+ ### 自定义页面链路选择
80
+
81
+ | 需求 | 推荐链路 |
82
+ |---|---|
83
+ | 现代 React、hooks、官网、工作台、看板、列表、详情、可视化、AI 首次生成页面 | Code Canvas:`.canvas.jsx` / `YidaCodeCanvas` |
84
+ | 需要成员、部门、附件上传、图片上传等宜搭运行态组件,且希望页面保持现代 React 体验 | Code Canvas + 原生组件桥;先跑 smoke 示例验证运行态组件,再做 fallback 和值归一化 |
85
+ | 用户明确要求普通自定义页面 JSX/Jsx 组件链路 | 普通自定义页面:`.oyd.jsx` / `Jsx` |
86
+ | 强依赖 `this.$(fieldId)`、`this.utils.yida.*`、`this.dataSourceMap`、表单提交或字段双向绑定 | 普通自定义页面:`.oyd.jsx` / `Jsx` |
87
+ | 已有普通 `.oyd.jsx` 页面要迁移到 Code Canvas | 参考 `yida-canvas-upgrade` 技能 |
88
+
89
+ ## 流程、审批与任务
90
+
91
+ | 功能 | 执行操作 |
92
+ |---|---|
93
+ | 创建流程表单并配置流程 | `openyida create-process <appType> ...` |
94
+ | 配置并发布流程规则 | `openyida configure-process <appType> ...` |
95
+ | 预览流程实例 | `openyida process preview <appType> <processInstanceId> [--output <path>]` |
96
+ | 查询 AI 审批提示配置 | `openyida ai-form-setting get <appType> <formUuid>` |
97
+ | 查询 AI 审批可用字段 | `openyida ai-form-setting fields <appType> <formUuid>` |
98
+ | 查询 AI 审批模型 | `openyida ai-form-setting models <appType>` |
99
+ | 开启或关闭 AI 审批提示 | `openyida ai-form-setting <enable\|disable> <appType> <formUuid>` |
100
+ | 保存 AI 审批提示配置 | `openyida ai-form-setting save <appType> <formUuid> <config.json>` |
101
+ | 查询任务中心 | `openyida task-center <type> [options]` |
102
+ | 管理流程代理/离职代理 | `openyida agent-center <list\|create\|update\|cancel\|range\|search-user> ...` |
103
+
104
+ ## 数据、权限与分享
105
+
106
+ | 功能 | 执行操作 |
107
+ |---|---|
108
+ | 查询表单数据 | `openyida data query form <appType> <formUuid> [options]` |
109
+ | 新增表单数据 | `openyida data create form <appType> <formUuid> --data-file <file>` |
110
+ | 更新表单数据 | `openyida data update form <appType> <formUuid> <formInstId> --data-file <file>` |
111
+ | 查询流程/任务/子表数据 | `openyida data <action> <resource> [args]` |
112
+ | 查询表单权限 | `openyida get-permission <appType> <formUuid>` |
113
+ | 保存表单权限 | `openyida save-permission <appType> <formUuid> ...` |
114
+ | 验证短链接 | `openyida verify-short-url <appType> ...` |
115
+ | 保存公开访问/分享配置 | `openyida save-share-config <appType> ...` |
116
+ | 查询页面分享配置 | `openyida get-page-config <appType> <formUuid>` |
117
+ | 规划公开表单镜像字段 | `openyida externalize-form <appType> <formUuid> [--schema-file file]` |
118
+
119
+ ## 报表、看板与可视化
120
+
121
+ | 功能 | 执行操作 |
122
+ |---|---|
123
+ | 创建宜搭原生报表 | `openyida create-report <appType> "<报表名称>" ...` |
124
+ | 向已有报表追加图表 | `openyida append-chart <appType> <reportId> ...` |
125
+ | 创建 ECharts 高级报表 | 使用自定义页面开发链路,并执行 `openyida publish ...` |
126
+ | 创建经营看板/管理驾驶舱/数据大屏 | 使用 `create-page`、数据源配置、报表命令和 `publish` 组合完成 |
127
+
128
+ ## 连接器、集成与钉钉
129
+
130
+ | 功能 | 执行操作 |
131
+ |---|---|
132
+ | 查询 HTTP 连接器 | `openyida connector list` |
133
+ | 创建 HTTP 连接器 | `openyida connector create "name" "domain" ...` |
134
+ | 查看连接器详情 | `openyida connector detail <id>` |
135
+ | 删除连接器 | `openyida connector delete <id>` |
136
+ | 添加连接器动作 | `openyida connector add-action --operations <file> --connector-id <id>` |
137
+ | 查询连接器动作 | `openyida connector list-actions <id>` |
138
+ | 删除连接器动作 | `openyida connector delete-action <id> <operation-id>` |
139
+ | 测试连接器动作 | `openyida connector test --connector-id <id> --action <actionId>` |
140
+ | 查询连接器鉴权账号 | `openyida connector list-connections <id>` |
141
+ | 创建连接器鉴权账号 | `openyida connector create-connection <id> <name>` |
142
+ | 从 cURL 智能创建连接器 | `openyida connector smart-create --curl "..."` |
143
+ | 解析 API 文档/接口信息 | `openyida connector parse-api [options]` |
144
+ | 生成 API 文档模板 | `openyida connector gen-template [output]` |
145
+ | 创建集成自动化 | `openyida integration create <appType> ... [--spec file.json]` |
146
+ | 查询集成自动化 | `openyida integration list <appType> [--form-uuid <uuid>]` |
147
+ | 启用集成自动化 | `openyida integration enable <appType> <formUuid> <processCode>` |
148
+ | 停用集成自动化 | `openyida integration disable <appType> <formUuid> <processCode>` |
149
+ | 检查集成异常日志 | `openyida integration check <appType...>` |
150
+ | 诊断集成配置问题 | `openyida integration diagnose (--text <text>\|--file <path>\|--rules)` |
151
+ | 调用钉钉 CLI | `openyida dws <command> [args]` |
152
+ | 搜索钉钉联系人 | `openyida dws contact user search --keyword <text>` |
153
+ | 生成钉钉 AppLink | `openyida dingtalk-link <url> [--target fullScreen]` |
154
+
155
+ ## AI、公式与知识整理
156
+
157
+ | 功能 | 执行操作 |
158
+ |---|---|
159
+ | 宜搭 AI 文生文 | `openyida ai text [options]` |
160
+ | 宜搭 AI 识图 | `openyida ai image [options]` |
161
+ | 检测素材能力 | `openyida asset status [options]` |
162
+ | 校验图片 URL | `openyida asset verify-url <url> [options]` |
163
+ | 解析并回填页面素材 | `openyida asset resolve [options]` |
164
+ | 生成 AI 图片素材 | `openyida asset generate [options]` |
165
+ | 检查宜搭公式 | `openyida formula evaluate <formula\|file> [--schema file]` |
166
+ | 闪记/会议纪要转 PRD | `openyida flash-to-prd --file <path> --name "<project>"` |
167
+ | 导出 AI 对话记录 | `openyida export-conversation [options]` |
168
+ | 整理 VOC 反馈材料 | 按故障、需求或性能问题整理成可提交材料 |
169
+ | 配置体验反馈入口 | `openyida feedback <setup\|url\|dismiss\|status> [options]` |
170
+
171
+ ## 本地开发、诊断与运维
172
+
173
+ | 功能 | 执行操作 |
174
+ |---|---|
175
+ | 初始化 project 工作目录 | `openyida copy [--force]` |
176
+ | 查看/输出示例模板 | `openyida sample [--list]` |
177
+ | 环境诊断与自动修复 | `openyida doctor [--fix]` |
178
+ | 批量执行命令文件 | `openyida batch <file> [--stop-on-error] [--json]` |
179
+ | 批量执行内联命令 | `openyida batch --commands "cmd1 ; cmd2" [--stop-on-error] [--json]` |
180
+ | 检查并更新 OpenYida | `openyida update` |
181
+ | 配置 CDN/OSS 上传 | `openyida cdn-config [options]` |
182
+ | 上传图片到 CDN | `openyida cdn-upload <image-path>` |
183
+ | 刷新 CDN 缓存 | `openyida cdn-refresh [options]` |
184
+ | 检测/修复 PostgreSQL Sequence 漂移 | `openyida db-seq-fix [--fix]` |
185
+ | 启动 MCP 服务 | `openyida mcp` |
186
+ | 启动 A2A adapter 或输出 Agent Card | `openyida a2a <serve\|agent-card> [options]` |
187
+ | 启动本地 Web bridge | `openyida bridge start [--token <pair-token>] [--port 6736]` |
188
+ | 输出机器可读命令清单 | `openyida commands --json` |
189
+ | 输出 Agent 能力快照 | `openyida agent-capabilities --json` |
190
+ | 运行技能评测 | `openyida eval --mode <mode> [--skill <name>] [--runs N]` |
191
+
192
+ ## Agent 能力、评测与安全提示
193
+
194
+ | 功能 | 执行操作 |
195
+ |---|---|
196
+ | 快速判断当前工作区、登录态、组织和命令能力 | `openyida agent-capabilities --summary-json` |
197
+ | 获取完整命令 Manifest、副作用和权限元数据 | `openyida commands --json` |
198
+ | 运行无副作用路由评测 | `openyida eval --mode routing [--skill <name>]` |
199
+ | 运行文档质量 / 安全 / 覆盖率评测 | `openyida eval --mode <doc-quality\|safety\|coverage\|comprehensive>` |
200
+ | 运行真实端到端评测 | `OPENYIDA_E2E=1 openyida eval --mode <e2e\|generate>` |
201
+
202
+ `commands --json` 中的 `sideEffect` 和 `permission` 是 Agent 执行前的重要依据。`mixed` 命令需要继续查看具体子命令或参数:例如 `data query` 是读操作,`data delete` 是删除;`nav-group list` 是读操作,`nav-group delete` 需要确认。
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const fs = require('fs');
4
+ const { throwUsage } = require('../core/command-errors');
4
5
 
5
6
  const {
6
7
  listAgentTasks,
@@ -44,9 +45,7 @@ Examples:
44
45
  `;
45
46
 
46
47
  function fail(message) {
47
- console.error(message);
48
- console.error(USAGE);
49
- process.exit(1);
48
+ throwUsage(message, USAGE);
50
49
  }
51
50
 
52
51
  function parseCliOptions(tokens) {
@@ -12,6 +12,7 @@
12
12
  'use strict';
13
13
 
14
14
  const { createAuthRef, createYidaClient } = require('../core/yida-client');
15
+ const { throwCommandError } = require('../core/command-errors');
15
16
 
16
17
  const API_PATH = '/query/app/getAppList.json';
17
18
 
@@ -115,14 +116,12 @@ async function run(args) {
115
116
  try {
116
117
  apps = await fetchAllApps(authRef, pageSize);
117
118
  } catch (err) {
118
- console.error(`查询应用列表失败:${err.message}`);
119
- process.exit(1);
119
+ throwCommandError(`查询应用列表失败:${err.message}`);
120
120
  }
121
121
 
122
122
  // 如果重试后仍然返回登录失效标记,说明登录态确实不可用
123
123
  if (apps && apps.__needLogin) {
124
- console.error('登录态已失效,请重新登录');
125
- process.exit(1);
124
+ throwCommandError('登录态已失效,请重新登录', { code: 'CLI_AUTH_REQUIRED' });
126
125
  }
127
126
 
128
127
  if (!apps || apps.length === 0) {
@@ -4,8 +4,9 @@ const fs = require('fs');
4
4
  const path = require('path');
5
5
  const { buildPageFile } = require('./page-compat');
6
6
  const { printLintResult } = require('./page-linter');
7
- const { warn, error, success, result, label, hint } = require('../core/chalk');
7
+ const { warn, success, result, label, hint } = require('../core/chalk');
8
8
  const { t } = require('../core/i18n');
9
+ const { throwCommandError, throwUsage } = require('../core/command-errors');
9
10
 
10
11
  function parseArgs(args) {
11
12
  const options = {
@@ -45,14 +46,17 @@ function parseArgs(args) {
45
46
  async function run(args) {
46
47
  const options = parseArgs(args || []);
47
48
  if (!options.sourceFile) {
48
- warn(t('cli.build_page_usage'));
49
- warn(t('cli.build_page_example'));
50
- process.exit(1);
49
+ throwUsage(t('cli.build_page_usage'), t('cli.build_page_example'), {
50
+ code: 'BUILD_PAGE_INVALID_ARGUMENTS',
51
+ });
51
52
  }
52
53
 
53
54
  const sourcePath = path.resolve(options.sourceFile);
54
55
  if (!fs.existsSync(sourcePath)) {
55
- error(t('publish.source_not_found', sourcePath));
56
+ throwCommandError(t('publish.source_not_found', sourcePath), {
57
+ code: 'BUILD_PAGE_SOURCE_NOT_FOUND',
58
+ details: { sourcePath },
59
+ });
56
60
  }
57
61
 
58
62
  const buildResult = buildPageFile(sourcePath, {
@@ -88,7 +92,10 @@ async function run(args) {
88
92
  }
89
93
 
90
94
  if (!buildResult.ok) {
91
- process.exit(1);
95
+ throwCommandError(t('build_page.failed'), {
96
+ code: 'BUILD_PAGE_FAILED',
97
+ details: { errors: buildResult.errors },
98
+ });
92
99
  }
93
100
 
94
101
  if (!options.json) {