openyida 2026.10.13 → 2026.10.14

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 (62) hide show
  1. package/README.md +76 -23
  2. package/bin/yida.js +32 -2
  3. package/lib/agent/PROTOCOL.md +201 -0
  4. package/lib/agent/ask-human-help.js +19 -0
  5. package/lib/agent/ask-human.js +222 -0
  6. package/lib/agent/cmd.js +405 -0
  7. package/lib/agent/command-receipt.js +84 -0
  8. package/lib/agent/connection-store.js +148 -0
  9. package/lib/agent/diagnostic-log.js +133 -0
  10. package/lib/agent/frozen-bundle.js +298 -0
  11. package/lib/agent/managed-command-map.js +47 -0
  12. package/lib/agent/managed-context.js +40 -0
  13. package/lib/agent/managed-run.js +84 -0
  14. package/lib/agent/mutation-receipt.js +82 -0
  15. package/lib/agent/private-directory.js +63 -0
  16. package/lib/agent/provider-preflight.js +257 -0
  17. package/lib/agent/providers.js +4 -0
  18. package/lib/agent/runtime-catalog.json +42 -0
  19. package/lib/agent/runtime-manifest.js +96 -0
  20. package/lib/agent/runtime-package.js +155 -0
  21. package/lib/agent/stdio.js +321 -0
  22. package/lib/app/check-prd-completeness.js +15 -4
  23. package/lib/app/create-form/batch.js +30 -9
  24. package/lib/app/create-form.js +7 -2
  25. package/lib/app/custom-theme.js +13 -3
  26. package/lib/app/get-schema.js +6 -1
  27. package/lib/app/update-app.js +13 -1
  28. package/lib/app/update-form-config.js +71 -80
  29. package/lib/asset/asset-plan.js +6 -4
  30. package/lib/auth/profile-lock.js +89 -0
  31. package/lib/auth/token-auth.js +57 -6
  32. package/lib/auth/token-store.js +26 -2
  33. package/lib/core/command-manifest.js +202 -118
  34. package/lib/core/locales/en.js +48 -4
  35. package/lib/core/locales/zh.js +48 -4
  36. package/lib/core/managed-policy.js +88 -0
  37. package/lib/core/query-data.js +22 -3
  38. package/lib/core/sample.js +1 -0
  39. package/lib/core/update.js +3 -1
  40. package/lib/core/utils.js +34 -1
  41. package/lib/design-plan/materialize.js +4 -21
  42. package/lib/design-plan/render-html.js +299 -0
  43. package/lib/page-config/save-share-config.js +16 -5
  44. package/lib/samples/yida-data-management/empty-query.js +69 -0
  45. package/package.json +10 -1
  46. package/scripts/postinstall.js +2 -2
  47. package/yida-skills/SKILL.md +32 -2
  48. package/yida-skills/references/local-agent-diagnostics.md +154 -0
  49. package/yida-skills/references/local-agent-preflight.md +56 -0
  50. package/yida-skills/references/query-condition-guide.md +223 -195
  51. package/yida-skills/skills/yida-app/workflow/plan/step-4-deliver.md +11 -3
  52. package/yida-skills/skills/yida-canvas-data-binding/SKILL.md +8 -5
  53. package/yida-skills/skills/yida-data-management/SKILL.md +64 -19
  54. package/yida-skills/skills/yida-data-management/references/data-format-guide.md +61 -25
  55. package/yida-skills/skills/yida-data-source-connectors/SKILL.md +6 -0
  56. package/yida-skills/skills/yida-design/SKILL.md +2 -0
  57. package/yida-skills/skills/yida-design/references/ask-human-interaction-contract.md +2 -0
  58. package/yida-skills/skills/yida-design/templates/design-themes/README.md +1 -1
  59. package/yida-skills/skills/yida-document-markdown/SKILL.md +6 -0
  60. package/yida-skills/skills/yida-image-assets/SKILL.md +1 -1
  61. package/yida-skills/skills/yida-tingji/SKILL.md +4 -0
  62. package/yida-skills/skills-index.json +52 -7
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const { getMaterialSourcingGuidance } = require('../asset/ai-image');
4
+ const { validateManagedPolicy, managedPolicySchema } = require('./managed-policy');
4
5
  const { getVisualDecisionPolicy } = require('../design-plan/visual-policy');
5
6
  const { getPageNavigationContract } = require('../design-plan/navigation-policy');
6
7
  const { ENTRY_MODES } = require('../design-plan/entry-navigation');
@@ -506,6 +507,13 @@ const COMMAND_SIDE_EFFECTS = new Map([
506
507
  read_actions: ['agent-card'],
507
508
  mutating_actions: ['serve'],
508
509
  })],
510
+ ['agent', sideEffect('mixed', {
511
+ mutates_yida: false,
512
+ mutates_local: true,
513
+ read_actions: ['doctor', 'status'],
514
+ mutating_actions: ['connect', 'run', 'disconnect', 'logout'],
515
+ note: 'Explicit local-agent control. Remote runs use only the current task grant and never read a personal OpenYida profile.',
516
+ })],
509
517
  ['aggregate-table', sideEffect('mixed', {
510
518
  mutates_yida: true,
511
519
  mutates_local: false,
@@ -780,6 +788,11 @@ const COMMAND_PERMISSIONS = new Map([
780
788
  ], actionDependentPermission({
781
789
  preauthorized_actions: ['serve'],
782
790
  })),
791
+ ...permissionEntries([
792
+ 'agent',
793
+ ], actionDependentPermission({
794
+ ask_actions: ['connect', 'run', 'disconnect', 'logout'],
795
+ })),
783
796
 
784
797
  ...permissionEntries([
785
798
  'aggregate-table',
@@ -1024,6 +1037,7 @@ function command(id, path, usage, descriptionKey, options = {}) {
1024
1037
  throw new Error('Missing permission metadata for command: ' + id);
1025
1038
  }
1026
1039
  const normalizedPermission = normalizePermission(commandPermission, commandSideEffect);
1040
+ validateManagedPolicy(options.managedRun, id);
1027
1041
 
1028
1042
  return {
1029
1043
  id,
@@ -1044,6 +1058,7 @@ function command(id, path, usage, descriptionKey, options = {}) {
1044
1058
  noteKeys: cloneJsonMetadata(options.noteKeys, []),
1045
1059
  ...(options.resultReuse ? { resultReuse: cloneJsonMetadata(options.resultReuse, null) } : {}),
1046
1060
  hidden: options.hidden === true,
1061
+ managedRun: cloneJsonMetadata(options.managedRun, null),
1047
1062
  sideEffect: cloneSideEffect(commandSideEffect),
1048
1063
  permission: clonePermission(normalizedPermission),
1049
1064
  };
@@ -1054,14 +1069,14 @@ const COMMAND_GROUPS = [
1054
1069
  id: 'auth',
1055
1070
  titleKey: 'help.group_auth',
1056
1071
  commands: [
1057
- command('login', ['login'], 'login [target-url] [--env <name>|--intl|--overseas|--global|--yidaapps|--alibaba] [--client-id <clientId>] [--endpoint <url>] [--no-browser]', 'help.cmd_login', {
1072
+ command('login', ['login'], 'login [target-url] [--env <name>|--intl|--overseas|--global|--yidaapps|--alibaba] [--client-id <clientId>] [--endpoint <url>] [--no-browser]', 'help.cmd_login', { managedRun: { scope: 'local', allowedFlags: ['--check-only', '--json', '--quiet'], requiredFlags: ['--check-only'] },
1058
1073
  requiresLogin: false,
1059
1074
  output: 'json',
1060
1075
  }),
1061
- command('logout', ['logout'], 'logout', 'help.cmd_logout', { requiresLogin: false }),
1062
- command('auth', ['auth'], 'auth <status|login|refresh|logout|profiles|profile switch>', 'help.cmd_auth', { requiresLogin: false }),
1063
- command('org', ['org'], 'org <list|switch> [--json] [--corp-id <corpId>]', 'help.cmd_org'),
1064
- command('env', ['env'], 'env [--json|setup|list|show|switch|add|remove] [options]', 'help.cmd_env', {
1076
+ command('logout', ['logout'], 'logout', 'help.cmd_logout', { managedRun: { scope: 'denied', reason: 'scope_not_audited' }, requiresLogin: false }),
1077
+ command('auth', ['auth'], 'auth <status|login|refresh|logout|profiles|profile switch>', 'help.cmd_auth', { managedRun: { scope: 'actions', actions: { status: { scope: 'local', allowedFlags: ['--json', '--quiet'] } } }, requiresLogin: false }),
1078
+ command('org', ['org'], 'org <list|switch> [--json] [--corp-id <corpId>]', 'help.cmd_org', { managedRun: { scope: 'denied', reason: 'scope_not_audited' } }),
1079
+ command('env', ['env'], 'env [--json|setup|list|show|switch|add|remove] [options]', 'help.cmd_env', { managedRun: { scope: 'local', allowedFlags: ['--json', '--quiet'] },
1065
1080
  requiresLogin: false,
1066
1081
  output: 'text|json',
1067
1082
  }),
@@ -1071,11 +1086,11 @@ const COMMAND_GROUPS = [
1071
1086
  id: 'app',
1072
1087
  titleKey: 'help.group_app',
1073
1088
  commands: [
1074
- command('app-entry.get', ['app-entry', 'get'], 'app-entry get <appType> [--json]', 'app_entry.desc_get', {
1089
+ command('app-entry.get', ['app-entry', 'get'], 'app-entry get <appType> [--json]', 'app_entry.desc_get', { managedRun: {'scope':'app','appPosition':1},
1075
1090
  args: [{ name: 'appType', type: 'string', source: 'positional', position: 0, required: true },
1076
1091
  { name: 'json', type: 'boolean', source: 'option', builder_options: ['--json'] }],
1077
1092
  }),
1078
- command('app-entry.set', ['app-entry', 'set'], 'app-entry set <appType> [--frontend <url>|--frontend-page <formUuid>] [--management <url>|--management-page <formUuid>] [--clear-frontend] [--clear-management] [--json]', 'app_entry.desc_set', {
1093
+ command('app-entry.set', ['app-entry', 'set'], 'app-entry set <appType> [--frontend <url>|--frontend-page <formUuid>] [--management <url>|--management-page <formUuid>] [--clear-frontend] [--clear-management] [--json]', 'app_entry.desc_set', { managedRun: {'scope':'app','appPosition':1,'mutation':{'operation':'update_app_entry'}},
1079
1094
  args: [
1080
1095
  { name: 'appType', type: 'string', source: 'positional', position: 0, required: true },
1081
1096
  { name: 'frontend', type: 'string', source: 'option', builder_options: ['--frontend'] },
@@ -1088,21 +1103,21 @@ const COMMAND_GROUPS = [
1088
1103
  ],
1089
1104
  notes: ['Complete URLs, including workbench page IDs, are preserved. --frontend-page requires a published display page. --management-page verifies ownership and builds /workbench/<formUuid>. Generated URLs need runtime verification; public entries require the verified complete URL. Omitted entries remain unchanged.'],
1090
1105
  }),
1091
- command('app-list', ['app-list'], 'app-list [--type managed|created] [--page N] [--size N]', 'help.cmd_app_list', {
1106
+ command('app-list', ['app-list'], 'app-list [--type managed|created] [--page N] [--size N]', 'help.cmd_app_list', { managedRun: {'scope':'denied','reason':'scope_not_audited'},
1092
1107
  notes: ['Successful results include appUrl/workbenchUrl for the business workspace and adminUrl for developer administration. Complete application delivery retains adminUrl regardless of auth runtime; route construction does not verify recipient access. Preserve the frontend URL from its own page result.'],
1093
1108
  }),
1094
- command('corp-efficiency', ['corp-efficiency'], 'corp-efficiency [overview|details|detail|groups|notify] [options] [--open|--no-open]', 'help.cmd_corp_efficiency', {
1109
+ command('corp-efficiency', ['corp-efficiency'], 'corp-efficiency [overview|details|detail|groups|notify] [options] [--open|--no-open]', 'help.cmd_corp_efficiency', { managedRun: { scope: 'denied', reason: 'scope_not_audited' },
1095
1110
  output: 'json',
1096
1111
  }),
1097
- command('create-app', ['create-app'], 'create-app "<name>"|--name <name> [options] [--locale zh_CN|en_US|ja_JP] [--open|--no-open]', 'help.cmd_create_app', {
1112
+ command('create-app', ['create-app'], 'create-app "<name>"|--name <name> [options] [--locale zh_CN|en_US|ja_JP] [--open|--no-open]', 'help.cmd_create_app', { managedRun: { scope: 'denied', reason: 'scope_not_audited' },
1098
1113
  notes: ['Successful results include appUrl/workbenchUrl for the business workspace and adminUrl for developer administration. Complete application delivery retains adminUrl regardless of auth runtime; route construction does not verify recipient access. Preserve the frontend URL from its own page result.'],
1099
1114
  }),
1100
- command('design-plan.catalog', ['design-plan', 'catalog'], 'design-plan catalog [--json]', 'help.cmd_design_plan_catalog', {
1115
+ command('design-plan.catalog', ['design-plan', 'catalog'], 'design-plan catalog [--json]', 'help.cmd_design_plan_catalog', { managedRun: { scope: 'local' },
1101
1116
  requiresLogin: false, output: 'json',
1102
1117
  args: [{ name: 'json', type: 'boolean', source: 'option', builder_options: ['--json'] }],
1103
1118
  notes: ['Read available theme IDs and page patterns before init when the theme mapping is unknown. Theme summaries describe deep/light navigation and deep/light content in natural language; they do not expose navTheme/contentTheme assignment syntax. Reuse this result for the current planning session.'],
1104
1119
  }),
1105
- command('design-plan.init', ['design-plan', 'init'], 'design-plan init <requirement-brief.json> [--theme-id <id>] [--output-dir <dir>] [--json]', 'help.cmd_design_plan_init', {
1120
+ command('design-plan.init', ['design-plan', 'init'], 'design-plan init <requirement-brief.json> [--theme-id <id>] [--output-dir <dir>] [--json]', 'help.cmd_design_plan_init', { managedRun: { scope: 'local' },
1106
1121
  requiresLogin: false,
1107
1122
  output: 'text|json',
1108
1123
  notes: ['Requires a selected theme from --theme-id or visualSelection.themeId. A recorded brief theme cannot be overridden by a conflicting --theme-id; reuse the recorded choice. Init disables comparison and style questions for the selected theme, even when design fields are pending. There is no navigation-tone argument: init reads navTheme from the selected theme template, overwrites stale navigationStyle.tone, and records toneSource=theme_derived. Free creative preserves an explicitly authored navigationStyle.tone and records toneSource=project_defined. Returns preserved business facts, authoring.pendingFields with file/path/message, typed examples in authoring-context.md, and materialize.command with materialize.shell (powershell on Windows, posix elsewhere). Execute the command in that shell. Complete the pending facts, review business coverage, then set ready=true. Author ordered page blocks as {name,purpose}; omitted contentPriority and contentRichness.contentLayers derive from these blocks, preserving explicit overrides. Author project-specific acceptanceCriteria; materialize merges them with resource-based checks. A string visualSelection.colorStrategy is preserved as usage text with primaryColor pending; invalid types fail before files are written. Init guidance is preliminary; materialize still validates the completed plan.'],
@@ -1113,7 +1128,7 @@ const COMMAND_GROUPS = [
1113
1128
  { name: 'json', type: 'boolean', required: false, source: 'option', builder_options: ['--json'] },
1114
1129
  ],
1115
1130
  }),
1116
- command('design-plan.preview', ['design-plan', 'preview'], 'design-plan preview <build-plan.json> --part-file <module.json> [--json]', 'help.cmd_design_plan_preview', {
1131
+ command('design-plan.preview', ['design-plan', 'preview'], 'design-plan preview <build-plan.json> --part-file <module.json> [--json]', 'help.cmd_design_plan_preview', { managedRun: { scope: 'local' },
1117
1132
  requiresLogin: false, output: 'json',
1118
1133
  args: [
1119
1134
  { name: 'buildPlan', type: 'file', required: true, source: 'positional', position: 0, builder_options: ['--build-plan'] },
@@ -1122,7 +1137,7 @@ const COMMAND_GROUPS = [
1122
1137
  ],
1123
1138
  notes: ['Updates completed fact modules in preview/ drafts. Modules share a source base; one writer updates changed sections and preserves custom CSS. Final materialize validates the complete plan and writes PRD, design, HTML and theme together.'],
1124
1139
  }),
1125
- command('design-plan.materialize', ['design-plan', 'materialize'], 'design-plan materialize <build-plan.json> [--from-preview | --business-file <json> --visual-file <json>] [--output-dir <dir>] [--rebase-parts] [--check] [--json]', 'help.cmd_design_plan_materialize', {
1140
+ command('design-plan.materialize', ['design-plan', 'materialize'], 'design-plan materialize <build-plan.json> [--from-preview | --business-file <json> --visual-file <json>] [--output-dir <dir>] [--rebase-parts] [--check] [--json]', 'help.cmd_design_plan_materialize', { managedRun: {'scope':'local'},
1126
1141
  notes: ['Local validation failures include repair.inputHash/errorHash. Do not retry unchanged inputs and arguments; stop after two repair attempts with the same error set. CLI reports diagnostics without persisting retry counters.', 'Validates readable text/surface pairs before materializing. Known low contrast returns DESIGN_THEME_CONTRAST_LOW and never silently recolors the project. Use check-design --json to inspect uncomputed pairs and review them in the browser.', 'Derives navigationStyle.tone and appConfig.navTheme from the selected theme template. Navigation appearance tokens come directly from that template plus explicit visualStyle.tokens; mode-independent tokens such as --pod-nav-menu-item-selected-shadow flow through the base token contract; materialize does not synthesize a light/dark replacement palette. Free creative uses project-authored navigation tone and tokens. Validates image slots before writing artifacts. JSON assetTasks lists taskKey/taskState, independent searches ordered by required/hero/design order, collection-wide concurrency, host-enforced time budgets, two-round limits, resume policy, output paths and resolve argv. After matching plan confirmation, executionContract requires checking background Agent and Bash separately, dispatching only verified nonblocking tools or doing authorized business work before synchronous asset batches; record real job IDs and continue app/form/page work; replace <appType> with the real ID for upload. Materialized PRD execution pages include navigationPolicy derived from app/page navigation: platform-shell is content-only; standalone without a planned menu renders no application menu. This command performs no search or upload. Local asset inputs resolve against the command cwd; absolute paths survive page-task directory changes.'],
1127
1142
  resultReuse: { mode: 'local_input_dependent', inputs: ['buildPlan', 'businessFile', 'visualFile', 'preview'], onInputChange: 'rerun_after_known_success', writes: 'local_artifacts_only' },
1128
1143
  requiresLogin: false,
@@ -1138,7 +1153,7 @@ const COMMAND_GROUPS = [
1138
1153
  { name: 'json', type: 'boolean', required: false, source: 'option', builder_options: ['--json'] },
1139
1154
  ],
1140
1155
  }),
1141
- command('design-plan.patch', ['design-plan', 'patch'], 'design-plan patch <build-plan.json> --set <path=value> [--set <path=value> ...] [--materialize] [--output-dir <dir>] [--json]', 'help.cmd_design_plan_patch', {
1156
+ command('design-plan.patch', ['design-plan', 'patch'], 'design-plan patch <build-plan.json> --set <path=value> [--set <path=value> ...] [--materialize] [--output-dir <dir>] [--json]', 'help.cmd_design_plan_patch', { managedRun: {'scope':'local'},
1142
1157
  notes: ['Local validation failures include repair.inputHash/errorHash. Do not retry unchanged inputs and arguments; stop after two repair attempts with the same error set. CLI reports diagnostics without persisting retry counters.', 'Edit the existing plan with one batch of --set assignments; do not restart init or rewrite business.json/visual.json. navigationStyle.tone, navigationStyle.toneSource and execution.appConfig.navTheme are derived and cannot be patched; change the selected theme instead. For free-creative only, navigationStyle.tone is authored and can be patched. With --materialize, update changed PRD/design/HTML sections and theme tokens, preserving unrelated local content and custom CSS. JSON updated lists artifact files actually written. The CLI maintains .build-plan-artifacts.json as the generated baseline; overlapping local edits fail before any writes. Without --materialize, validate and save source facts without rendering HTML or writing artifacts. Unpresented edits keep the draft revision; substantive edits to a presented version advance once and clear approval. Asset materialStatus/missingAssets updates preserve approval.'],
1143
1158
  requiresLogin: false,
1144
1159
  output: 'text|json',
@@ -1150,7 +1165,7 @@ const COMMAND_GROUPS = [
1150
1165
  { name: 'json', type: 'boolean', source: 'option', builder_options: ['--json'] },
1151
1166
  ],
1152
1167
  }),
1153
- command('update-app', ['update-app'], 'update-app <appType> [--name "..."] [--desc "..."] [--icon <name>] [--icon-color <color>] [--colour <key>] [--theme-color <color>] [--theme-file <css>] [--confirm-legacy-app-style] [--disable-custom-theme] [--nav-theme light|dark|white|gray] [--logo-source appIcon|customImage] [--layout side|top|l_shape] [--hide-app-nav|--show-app-nav]', 'help.cmd_update_app', {
1168
+ command('update-app', ['update-app'], 'update-app <appType> [--name "..."] [--desc "..."] [--icon <name>] [--icon-color <color>] [--colour <key>] [--theme-color <color>] [--theme-file <css>] [--confirm-legacy-app-style] [--disable-custom-theme] [--nav-theme light|dark|white|gray] [--logo-source appIcon|customImage] [--layout side|top|l_shape] [--hide-app-nav|--show-app-nav]', 'help.cmd_update_app', { managedRun: { scope: 'app', appPosition: 0, mutation: { operation: 'update_app_setting' } },
1154
1169
  args: [
1155
1170
  { name: 'appType', type: 'string', required: true, source: 'positional', position: 0 },
1156
1171
  { name: 'name', type: 'string', source: 'option', builder_options: ['--name', '-n'] },
@@ -1178,7 +1193,7 @@ const COMMAND_GROUPS = [
1178
1193
  'Platform preset keys are used independently of --theme-file and --theme-color. Choose --hide-app-nav or --show-app-nav to set navigation visibility.',
1179
1194
  ],
1180
1195
  }),
1181
- command('app-theme.snapshot', ['app-theme', 'snapshot'], 'app-theme snapshot <appType> --output-dir <new-dir> [--json]', 'help.cmd_app_theme_snapshot', {
1196
+ command('app-theme.snapshot', ['app-theme', 'snapshot'], 'app-theme snapshot <appType> --output-dir <new-dir> [--json]', 'help.cmd_app_theme_snapshot', { managedRun: { scope: 'app', appPosition: 1 },
1182
1197
  output: 'json',
1183
1198
  args: [
1184
1199
  { name: 'appType', type: 'string', required: true, source: 'positional', position: 0 },
@@ -1187,7 +1202,7 @@ const COMMAND_GROUPS = [
1187
1202
  ],
1188
1203
  notes: ['Read-only remote snapshot of application theme settings, runtime theme mode, and icon; archive original CSS bytes and checksums in a fresh local directory. Returns restorableKeys and cannotClearKeys. No page/source backup or icon/mode restore. Before beautification, ensure every planned changed key is restorable and no protected field changes; update-app theme upload may also change icon color. Missing or empty originals cannot be restored by the platform single-config endpoint. CSS fetch requires a direct HTTPS text/css response and sends no Yida credentials. Snapshot is not a server transaction; two matching reads detect changes during collection.'],
1189
1204
  }),
1190
- command('app-theme.restore', ['app-theme', 'restore'], 'app-theme restore <appType> --snapshot <before.json> --expected-current <after.json> [--check | --confirm --output-dir <new-dir>] [--json]', 'help.cmd_app_theme_restore', {
1205
+ command('app-theme.restore', ['app-theme', 'restore'], 'app-theme restore <appType> --snapshot <before.json> --expected-current <after.json> [--check | --confirm --output-dir <new-dir>] [--json]', 'help.cmd_app_theme_restore', { managedRun: { scope: 'app', appPosition: 1, mutation: { operation: 'update_app', requiredFlags: ['--confirm'] } },
1191
1206
  output: 'json',
1192
1207
  args: [
1193
1208
  { name: 'appType', type: 'string', required: true, source: 'positional', position: 0 },
@@ -1200,7 +1215,7 @@ const COMMAND_GROUPS = [
1200
1215
  ],
1201
1216
  notes: ['Default/--check performs no remote writes and returns canRestore plus blockers. --confirm attests to user-authorized rollback and requires a new journal directory. Validate both snapshots, CSS bytes and app/corp/base URL; current theme state must equal the snapshot captured immediately after this run, not a newly captured externally changed baseline. Refuse empty/absent target values, changed protected icon/theme mode, or unavailable/changed original CSS. Restore only allowlisted nonempty theme config values via updateSingleConfig; never update the whole app, reupload CSS, upgrade theme mode, or overwrite business settings. Check tracked state before each write and read it back afterwards. This is not atomic/CAS and cannot exclude all concurrent writes. Partial/unknown outcomes retain a journal and require inspection before retry; verified success covers configuration only, not page appearance.'],
1202
1217
  }),
1203
- command('upgrade-app-theme', ['upgrade-app-theme'], 'upgrade-app-theme <appType> --explicit-request [--confirm | --prepare --output-dir <dir>] [--json]', 'help.cmd_upgrade_app_theme', {
1218
+ command('upgrade-app-theme', ['upgrade-app-theme'], 'upgrade-app-theme <appType> --explicit-request [--confirm | --prepare --output-dir <dir>] [--json]', 'help.cmd_upgrade_app_theme', { managedRun: { scope: 'app', appPosition: 0, mutation: { operation: 'update_app', requiredFlags: ['--confirm'] } },
1204
1219
  output: 'json',
1205
1220
  args: [
1206
1221
  { name: 'appType', type: 'string', required: true, source: 'positional', position: 0 },
@@ -1212,9 +1227,9 @@ const COMMAND_GROUPS = [
1212
1227
  ],
1213
1228
  notes: ['--prepare reads remote schemas/source bundles into a new local backup directory and produces a per-resource migration plan without remote writes; it requires explicit upgrade intent but no mutation confirmation. Before --confirm, use the independent upgrade Skill to prepare/review sources, migrate legacy JSX to Canvas without business/layout changes, and remove verified form-detail style injection. Only mutate after an explicit user request to upgrade an existing app to the modern theme AND an affirmative ask_human reply for that app. These flags attest to both checks; they do not replace human confirmation. If ask_human is unavailable, stop before mutation. The CLI itself checks server-derived agentAppType and app/corp identity before offering any confirmation or preparing backups. agentAppType comes from FROM_BUILDER_AI=y plus BUILDER_AI_SOURCE; source alone or FROM_AI does not qualify. Only local/cloud/qwenwork qualifies. Reject non-AI or unverified apps without offering an upgrade or exposing source fields. Skill guidance and confirmation flags cannot bypass this gate. Do not check V4, appThemeEnable, organization theme gray or upgrade gray. After ask_human approval, migrate legacy navigation layout and colors before persisting CREATED_WITH_MODERN_THEME=y and APP_THEME_MODE=modern, then read all changed settings back. Already modern navigation colors stay unchanged. Report partial/unknown writes on failure. Success verifies configuration only, not page migration or runtime rendering. appUpgradeComplete remains false until the Skill verifies all page/form migrations.'],
1214
1229
  }),
1215
- command('app-online', ['app-online'], 'app-online <appType> [--to-ding-app-center] [--show-app-center]', 'help.cmd_app_online'),
1216
- command('app-offline', ['app-offline'], 'app-offline <appType> [--to-ding-app-center] [--show-app-center]', 'help.cmd_app_offline'),
1217
- command('nav-group', ['nav-group'], 'nav-group <list|create|rename|delete|move|order|auto-order|hide|show> <appType> ...', 'help.cmd_nav_group', {
1230
+ command('app-online', ['app-online'], 'app-online <appType> [--to-ding-app-center] [--show-app-center]', 'help.cmd_app_online', { managedRun: {'scope':'denied','reason':'scope_not_audited'} }),
1231
+ command('app-offline', ['app-offline'], 'app-offline <appType> [--to-ding-app-center] [--show-app-center]', 'help.cmd_app_offline', { managedRun: {'scope':'denied','reason':'scope_not_audited'} }),
1232
+ command('nav-group', ['nav-group'], 'nav-group <list|create|rename|delete|move|order|auto-order|hide|show> <appType> ...', 'help.cmd_nav_group', { managedRun: {'scope':'actions','actions':{'list':{'scope':'app','appPosition':1},'create':{'scope':'app','appPosition':1,'mutation':{'operation':'update_nav'}},'rename':{'scope':'app','appPosition':1,'mutation':{'operation':'update_nav'}},'delete':{'scope':'app','appPosition':1,'mutation':{'operation':'update_nav'}},'move':{'scope':'app','appPosition':1,'mutation':{'operation':'update_nav'}},'order':{'scope':'app','appPosition':1,'mutation':{'operation':'update_nav'}},'auto-order':{'scope':'app','appPosition':1,'mutation':{'operation':'update_nav'}},'hide':{'scope':'app','appPosition':1,'mutation':{'operation':'update_nav'}},'show':{'scope':'app','appPosition':1,'mutation':{'operation':'update_nav'}}}},
1218
1233
  output: 'json',
1219
1234
  aliases: ['group'],
1220
1235
  examples: [
@@ -1224,21 +1239,29 @@ const COMMAND_GROUPS = [
1224
1239
  ],
1225
1240
  notes: ['create accepts --icon auto|<iconName>. By default it selects a business icon from the group title using the page navigation icon catalog, preserves the created node when updating its icon, and verifies readback. list exposes icon. NAV_GROUP_CREATE_INCOMPLETE is not retry-safe: inspect nextStep before further changes. Existing group icons are not automatically changed.'],
1226
1241
  }),
1227
- command('app-permission', ['app-permission'], 'app-permission <get|set|add|remove|search-user> ...', 'help.cmd_app_permission', {
1228
- output: 'json',
1242
+ command('app-permission', ['app-permission'], 'app-permission <get|set|add|remove|search-user> ...', 'help.cmd_app_permission', { managedRun: {
1243
+ scope: 'actions',
1244
+ actions: {
1245
+ get: { scope: 'app', appPosition: 1 },
1246
+ set: { scope: 'app', appPosition: 1, mutation: { operation: 'update_app_permission' } },
1247
+ add: { scope: 'app', appPosition: 1, mutation: { operation: 'update_app_permission' } },
1248
+ remove: { scope: 'app', appPosition: 1, mutation: { operation: 'update_app_permission' } }
1249
+ }
1250
+ },
1251
+ output: 'json',
1229
1252
  }),
1230
- command('i18n', ['i18n'], 'i18n <overview|config|languages|list|upsert|delete|translate|translate-all|upgrade> <appType> ...', 'help.cmd_i18n', {
1253
+ command('i18n', ['i18n'], 'i18n <overview|config|languages|list|upsert|delete|translate|translate-all|upgrade> <appType> ...', 'help.cmd_i18n', { managedRun: { scope: 'actions', actions: { config: { scope: 'actions', actions: { get: { scope: 'app', appPosition: 2 }, set: { scope: 'app', appPosition: 2, mutation: { operation: 'update_app' } } } }, 'overview': { scope: 'app', appPosition: 1 }, 'languages': { scope: 'app', appPosition: 1 }, 'list': { scope: 'app', appPosition: 1 }, 'translate': { scope: 'app', appPosition: 1 }, 'upsert': { scope: 'app', appPosition: 1, mutation: { operation: 'update_app' } }, 'batch-upsert': { scope: 'app', appPosition: 1, mutation: { operation: 'update_app' } }, 'delete': { scope: 'app', appPosition: 1, mutation: { operation: 'update_app' } }, 'translate-all': { scope: 'app', appPosition: 1, mutation: { operation: 'update_app' } }, 'upgrade': { scope: 'app', appPosition: 1, mutation: { operation: 'update_app' } } } },
1231
1254
  output: 'json',
1232
1255
  }),
1233
- command('export', ['export'], 'export <appType> [output]', 'help.cmd_export'),
1234
- command('import', ['import'], 'import <file> [name]', 'help.cmd_import'),
1256
+ command('export', ['export'], 'export <appType> [output]', 'help.cmd_export', { managedRun: { scope: 'denied', reason: 'scope_not_audited' } }),
1257
+ command('import', ['import'], 'import <file> [name]', 'help.cmd_import', { managedRun: { scope: 'denied', reason: 'scope_not_audited' } }),
1235
1258
  ],
1236
1259
  },
1237
1260
  {
1238
1261
  id: 'form',
1239
1262
  titleKey: 'help.group_form',
1240
1263
  commands: [
1241
- command('create-form.batch', ['create-form', 'batch'], 'create-form batch <appType> <plan.json> [--concurrency 1..4] [--check] [--json]', 'help.cmd_create_form_batch', {
1264
+ command('create-form.batch', ['create-form', 'batch'], 'create-form batch <appType> <plan.json> [--concurrency 1..4] [--check] [--json]', 'help.cmd_create_form_batch', { managedRun: { scope: 'app', appPosition: 1, mutation: { operation: 'create_form', forbiddenFlags: ['--check'] } },
1242
1265
  output: 'json',
1243
1266
  args: [
1244
1267
  { name: 'appType', type: 'string', required: true, source: 'positional', position: 0, builder_options: ['--app-type'] },
@@ -1249,7 +1272,7 @@ const COMMAND_GROUPS = [
1249
1272
  ],
1250
1273
  notes: ['Creates independent normal forms concurrently after dependency validation. Each plan item accepts layout (single/double/card/section), theme (default/compact/comfortable), labelAlign (top/left/right), icon and locale, and forwards them to create-form create. References resolve from successful schema readbacks. Existing formUuid entries are read-only reuse. Saves IDs and status beside the plan; recoveryAction and nextAction are enum values: rerun_unchanged_plan reuses successful results and resumes known form IDs; inspect_unknown_write_then_reconcile requires checking uncertain writes before rerunning. Results expose appUrl and formUrl; url remains the compatible form entry. Navigation ordering and shared app configuration follow the batch.'],
1251
1274
  }),
1252
- command('create-form.create', ['create-form', 'create'], 'create-form create <appType> "<formTitle>" <fieldsJsonFile> [--layout single|double|card|section] [--theme default|compact|comfortable] [--label-align top|left|right] [--icon auto|<iconName>] [--locale zh_CN|en_US|ja_JP] [--open|--no-open]', 'help.cmd_create_form', {
1275
+ command('create-form.create', ['create-form', 'create'], 'create-form create <appType> "<formTitle>" <fieldsJsonFile> [--layout single|double|card|section] [--theme default|compact|comfortable] [--label-align top|left|right] [--icon auto|<iconName>] [--locale zh_CN|en_US|ja_JP] [--open|--no-open]', 'help.cmd_create_form', { managedRun: {'scope':'app','appPosition':1,'mutation':{'operation':'create_form'}},
1253
1276
  args: [
1254
1277
  {
1255
1278
  name: 'appType',
@@ -1375,7 +1398,7 @@ const COMMAND_GROUPS = [
1375
1398
  'Divider colorType defaults to theme. If default bindings are unsuitable for the current theme, use custom with backgroundColor, secondaryColor and titleColor designed together; explicit user color values are not required. These are field JSON properties, not CLI flags. Dark-content and composite-title guidance is advisory, not a new validation or upload/save gate.',
1376
1399
  ],
1377
1400
  }),
1378
- command('create-form.icons', ['create-form', 'icons'], 'create-form icons [--json]', 'help.cmd_list_form_icons', {
1401
+ command('create-form.icons', ['create-form', 'icons'], 'create-form icons [--json]', 'help.cmd_list_form_icons', { managedRun: { scope: 'local' },
1379
1402
  requiresLogin: false,
1380
1403
  output: 'json',
1381
1404
  args: [
@@ -1396,34 +1419,46 @@ const COMMAND_GROUPS = [
1396
1419
  display: 'openyida create-form icons [--json]',
1397
1420
  },
1398
1421
  examples: ['openyida create-form icons --json'],
1422
+ aliases: ['create-form list-icons'],
1399
1423
  }),
1400
- command('create-form.validate-fields', ['create-form', 'validate-fields'], 'create-form validate-fields <fieldsJsonOrFile> [--json]', 'help.cmd_validate_form', {
1424
+ command('create-form.validate-fields', ['create-form', 'validate-fields'], 'create-form validate-fields <fieldsJsonOrFile> [--json]', 'help.cmd_validate_form', { managedRun: { scope: 'local' },
1401
1425
  requiresLogin: false,
1402
1426
  }),
1403
- command('create-form.update', ['create-form', 'update'], 'create-form update <appType> <formUuid> (<changesJsonOrFile> | --data-file <changesJsonOrFile>) [--locale zh_CN|en_US|ja_JP] [--open|--no-open]', 'help.cmd_update_form'),
1404
- command('create-form.resume', ['create-form', 'resume'], 'create-form resume <appType> <formUuid> <fieldsJsonOrFile> [--json]', 'help.cmd_update_form', {
1427
+ command('create-form.update', ['create-form', 'update'], 'create-form update <appType> <formUuid> (<changesJsonOrFile> | --data-file <changesJsonOrFile>) [--locale zh_CN|en_US|ja_JP] [--open|--no-open]', 'help.cmd_update_form', { managedRun: { scope: 'app', appPosition: 1, mutation: { operation: 'update_form', formUuidPosition: 2 } } }),
1428
+ command('create-form.resume', ['create-form', 'resume'], 'create-form resume <appType> <formUuid> <fieldsJsonOrFile> [--json]', 'help.cmd_update_form', { managedRun: { scope: 'app', appPosition: 1, mutation: { operation: 'update_form', formUuidPosition: 2 } },
1405
1429
  notes: ['On save-schema HTTP 5xx, read back the latest schema. Accept already-applied fields or retry missing compatible fields once with the latest revision; conflicts and other failures stop. Success includes appUrl, formUrl and the compatible url field.'],
1406
1430
  }),
1407
- command('create-form.patch', ['create-form', 'patch'], 'create-form patch <appType> <formUuid> <patchJsonOrFile> [--open|--no-open]', 'help.cmd_update_form'),
1408
- command('create-form.rule', ['create-form', 'rule'], 'create-form rule <appType> <formUuid> <rulesJsonOrFile> [--open|--no-open]', 'help.cmd_update_form'),
1409
- command('create-form.validation', ['create-form', 'validation'], 'create-form validation <appType> <formUuid> <validationsJsonOrFile> [--open|--no-open]', 'help.cmd_update_form'),
1410
- command('add-validation', ['add-validation'], 'add-validation <appType> <formUuid> --field <labelOrId> --type <phone|regex|idCard|email|...> [--message <text>]', 'help.cmd_update_form'),
1411
- command('create-form.bind-datasource', ['create-form', 'bind-datasource'], 'create-form bind-datasource <appType> <formUuid> <fieldLabelOrId> <dataSourceJsonOrFile> [--open|--no-open]', 'help.cmd_update_form'),
1412
- command('create-form.add-option', ['create-form', 'add-option'], 'create-form add-option <appType> <formUuid> <fieldLabel> <option1> [option2] ...', 'help.cmd_update_form'),
1413
- command('list-forms', ['list-forms'], 'list-forms <appType> [--keyword <text>]', 'help.cmd_list_forms', {
1431
+ command('create-form.patch', ['create-form', 'patch'], 'create-form patch <appType> <formUuid> <patchJsonOrFile> [--open|--no-open]', 'help.cmd_update_form', { managedRun: { scope: 'app', appPosition: 1, mutation: { operation: 'update_form', formUuidPosition: 2 } } }),
1432
+ command('create-form.rule', ['create-form', 'rule'], 'create-form rule <appType> <formUuid> <rulesJsonOrFile> [--open|--no-open]', 'help.cmd_update_form', { managedRun: { scope: 'app', appPosition: 1, mutation: { operation: 'update_form', formUuidPosition: 2 } } }),
1433
+ command('create-form.validation', ['create-form', 'validation'], 'create-form validation <appType> <formUuid> <validationsJsonOrFile> [--open|--no-open]', 'help.cmd_update_form', { managedRun: { scope: 'app', appPosition: 1, mutation: { operation: 'update_form', formUuidPosition: 2 } } }),
1434
+ command('add-validation', ['add-validation'], 'add-validation <appType> <formUuid> --field <labelOrId> --type <phone|regex|idCard|email|...> [--message <text>]', 'help.cmd_update_form', { managedRun: { scope: 'denied', reason: 'scope_not_audited' } }),
1435
+ command('create-form.bind-datasource', ['create-form', 'bind-datasource'], 'create-form bind-datasource <appType> <formUuid> <fieldLabelOrId> <dataSourceJsonOrFile> [--open|--no-open]', 'help.cmd_update_form', { managedRun: { scope: 'app', appPosition: 1, mutation: { operation: 'update_form', formUuidPosition: 2 } } }),
1436
+ command('create-form.add-option', ['create-form', 'add-option'], 'create-form add-option <appType> <formUuid> <fieldLabel> <option1> [option2] ...', 'help.cmd_update_form', { managedRun: { scope: 'app', appPosition: 1, mutation: { operation: 'update_form', formUuidPosition: 2 } } }),
1437
+ command('list-forms', ['list-forms'], 'list-forms <appType> [--keyword <text>]', 'help.cmd_list_forms', { managedRun: { scope: 'app', appPosition: 0 },
1414
1438
  examples: ['openyida list-forms APP_XXX --keyword 客户'],
1415
1439
  }),
1416
- command('aggregate-table', ['aggregate-table'], 'aggregate-table <list|create-empty|inspect|preview|save|publish|status> <appType> ...', 'help.cmd_aggregate_table', {
1417
- output: 'json',
1440
+ command('aggregate-table', ['aggregate-table'], 'aggregate-table <list|create-empty|inspect|preview|save|publish|status> <appType> ...', 'help.cmd_aggregate_table', { managedRun: {
1441
+ scope: 'actions',
1442
+ actions: {
1443
+ list: { scope: 'app', appPosition: 1 },
1444
+ inspect: { scope: 'app', appPosition: 1 },
1445
+ preview: { scope: 'app', appPosition: 1 },
1446
+ status: { scope: 'app', appPosition: 1 },
1447
+ 'create-empty': { scope: 'app', appPosition: 1, mutation: { operation: 'create_report' } },
1448
+ save: { scope: 'app', appPosition: 1, mutation: { operation: 'create_report' } },
1449
+ publish: { scope: 'app', appPosition: 1, mutation: { operation: 'create_report' } }
1450
+ }
1451
+ },
1452
+ output: 'json',
1418
1453
  }),
1419
- command('get-schema', ['get-schema'], 'get-schema <appType> <formUuid|--all> [--summary-json|--field-map-json|--analysis-json]', 'help.cmd_get_schema', {
1454
+ command('get-schema', ['get-schema'], 'get-schema <appType> <formUuid|--all> [--summary-json|--field-map-json|--analysis-json]', 'help.cmd_get_schema', { managedRun: { scope: 'app', appPosition: 0 },
1420
1455
  examples: ['openyida get-schema APP_XXX FORM_XXX --field-map-json'],
1421
1456
  }),
1422
- command('check-prd-completeness', ['check-prd-completeness'], 'check-prd-completeness <prd.md> --app-type <appType> [--build-manifest <file>] [--json]', 'help.cmd_check_prd_completeness', {
1457
+ command('check-prd-completeness', ['check-prd-completeness'], 'check-prd-completeness <prd.md> --app-type <appType> [--build-manifest <file>] [--json]', 'help.cmd_check_prd_completeness', { managedRun: { scope: 'app', appParser: 'prd-completeness' },
1423
1458
  output: 'json',
1424
1459
  notes: ['Checks resource counts and optional build-manifest.assetExecution recorded intervals. Include materialize.assetTasks and taskState records plus businessWork startedAt/endedAt; missing dispatch proof, missing overlap or assets before business in synchronous fallback produces needs_review. This is record consistency, not independent verification of host events.'],
1425
1460
  }),
1426
- command('check-design', ['check-design'], 'check-design <design.md> [--prd <prd.md>] [--base-dir <dir>] [--json]', 'help.cmd_check_design', {
1461
+ command('check-design', ['check-design'], 'check-design <design.md> [--prd <prd.md>] [--base-dir <dir>] [--json]', 'help.cmd_check_design', { managedRun: { scope: 'local' },
1427
1462
  requiresLogin: false,
1428
1463
  output: 'text|json',
1429
1464
  notes: ['Checks 26 text/surface pairs with alpha compositing and a 4.5:1 minimum. Known failures return DESIGN_THEME_CONTRAST_LOW with token names and ratios; paletteContrast.unresolved requires browser review and is not a pass. Disabled colors and decorative swatches are excluded. Gradients, images and local component CSS need visual verification. Theme generation with a complete design document uses the same check and never silently recolors the project.', 'Local validation failures include repair.inputHash/errorHash. Do not retry unchanged inputs and arguments; stop after two repair attempts with the same error set. CLI reports diagnostics without persisting retry counters.', 'Checks declared iconSystem.colorPairs against resolved design tokens. Each pair has a unique name, foreground, background and an opaque surface when the background is translucent. Icon contrast must reach 3:1; JSON iconContrast reports the checked pairs. Unsupported colors and missing surfaces fail rather than count as verified. This does not inspect browser styles, inherited opacity, gradients or undeclared icon colors.'],
@@ -1434,10 +1469,10 @@ const COMMAND_GROUPS = [
1434
1469
  { name: 'json', type: 'boolean', source: 'option', builder_options: ['--json'] },
1435
1470
  ],
1436
1471
  }),
1437
- command('er', ['er'], 'er <appType> [--format mermaid|json] [--output file] [--include-system] [--include-pages]', 'help.cmd_er', {
1472
+ command('er', ['er'], 'er <appType> [--format mermaid|json] [--output file] [--include-system] [--include-pages]', 'help.cmd_er', { managedRun: { scope: 'denied', reason: 'scope_not_audited' },
1438
1473
  output: 'text|json',
1439
1474
  }),
1440
- 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', {
1475
+ 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', { managedRun: { scope: 'app', appPosition: 0, mutation: { operation: 'create_page' } },
1441
1476
  output: 'text|json',
1442
1477
  args: [
1443
1478
  { name: 'appType', type: 'string', source: 'positional', position: 0, required: true },
@@ -1456,8 +1491,8 @@ const COMMAND_GROUPS = [
1456
1491
  'Unverified hiding exits nonzero with success=false, pageCreated=true, pageId and CREATE_PAGE_NAVIGATION_NOT_VERIFIED. Use recovery.command/args and recovery.verifyCommand/verifyArgs on that existing page. Never repeat create-page to repair navigation.',
1457
1492
  ],
1458
1493
  }),
1459
- command('build-page', ['build-page'], 'build-page <sourceFile> [--output file|--write]', 'help.cmd_build_page', { requiresLogin: false }),
1460
- command('check-page', ['check-page'], 'check-page <src> [--compat] [--json]', 'help.cmd_check_page', {
1494
+ command('build-page', ['build-page'], 'build-page <sourceFile> [--output file|--write]', 'help.cmd_build_page', { managedRun: { scope: 'local' }, requiresLogin: false }),
1495
+ command('check-page', ['check-page'], 'check-page <src> [--compat] [--json]', 'help.cmd_check_page', { managedRun: { scope: 'local' },
1461
1496
  requiresLogin: false,
1462
1497
  output: 'text|json',
1463
1498
  args: [
@@ -1467,7 +1502,7 @@ const COMMAND_GROUPS = [
1467
1502
  ],
1468
1503
  notes: ['Local source validation, including form-open-container checks for recognized form links and drawer structure. Fails with CHECK_PAGE_FAILED and per-rule diagnostics. Dynamic interactions still require runtime verification.'],
1469
1504
  }),
1470
- command('compile', ['compile'], 'compile <src> [--canvas] [--compat] [--skip-lint] [--strict-theme|--allow-fixed-brand] [--json]', 'help.cmd_compile', {
1505
+ command('compile', ['compile'], 'compile <src> [--canvas] [--compat] [--skip-lint] [--strict-theme|--allow-fixed-brand] [--json]', 'help.cmd_compile', { managedRun: {'scope':'local'},
1471
1506
  requiresLogin: false,
1472
1507
  output: 'text|json',
1473
1508
  args: [
@@ -1481,7 +1516,7 @@ const COMMAND_GROUPS = [
1481
1516
  ],
1482
1517
  notes: ['Local validation failures include repair.inputHash/errorHash. Do not retry unchanged inputs and arguments; stop after two repair attempts with the same error set. CLI reports diagnostics without persisting retry counters.', 'Canvas compilation checks theme provider mounting, theme reads before the provider is active, module-level theme context declarations, fixed ConfigProvider brand colors, and known navigation destinations missing appType. Extract canvas-theme and canvas-navigation before coding. Form actions also require the maintained form-open-container fragment, hook and rendered container. Fixed brand colors remain in the source and are returned in warnings even with --json; --strict-theme blocks them and --allow-fixed-brand preserves them. These flags are Canvas-only and mutually exclusive. Dynamic colors, resource identity and runtime rendering still require verification.'],
1483
1518
  }),
1484
- command('publish', ['publish'], 'publish <src> <appType> <formUuid> [--health-check] [--force] [--canvas] [--compat] [--skip-lint] [--fix-theme] [--strict-theme] [--allow-fixed-brand] [--auto-nav-order] [--open|--no-open] [--json]', 'help.cmd_publish', {
1519
+ command('publish', ['publish'], 'publish <src> <appType> <formUuid> [--health-check] [--force] [--canvas] [--compat] [--skip-lint] [--fix-theme] [--strict-theme] [--allow-fixed-brand] [--auto-nav-order] [--open|--no-open] [--json]', 'help.cmd_publish', { managedRun: {'scope':'app','appPosition':1,'sourcePosition':0,'mutation':{'operation':'publish_page','formUuidPosition':2}},
1485
1520
  args: [
1486
1521
  { name: 'src', type: 'file', source: 'positional', position: 0, required: true },
1487
1522
  { name: 'appType', type: 'string', source: 'positional', position: 1, required: true },
@@ -1501,7 +1536,7 @@ const COMMAND_GROUPS = [
1501
1536
  ],
1502
1537
  notes: ['Canvas publishing runs the same theme and form-open-container structure checks as compile before login or remote writes. --force does not bypass Canvas compilation checks. --health-check verifies saved content; inspect the actual page for runtime behavior. Fixed brand overrides are preserved with structured warnings by default. --strict-theme blocks them; --allow-fixed-brand conflicts with --strict-theme and --fix-theme. --fix-theme requires the migrated controls to be inside a mounted CanvasThemeProvider and compiles before writing. Unproven dynamic render paths require manual migration. No stdin prompts.', 'Publishing reads persisted page navigation by default without a new flag. With renderNav=false, url and standaloneUrl use the clean /custom/<formUuid> route, with no navigation query parameters; workbenchUrl remains available. Unknown or visible navigation returns standaloneUrl=null; inspect navigationVerification and navigationWarning. A navigation read failure does not undo publication or prove standalone readiness. Configure scoped service frontend pages persistently before publishing; get-form-config can recover the verified URL without republishing.'],
1503
1538
  }),
1504
- 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', {
1539
+ 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', { managedRun: { scope: 'app', appPosition: 0, mutation: { operation: 'update_form_config', formUuidPosition: 1 } },
1505
1540
  args: [
1506
1541
  { name: 'appType', type: 'string', source: 'positional', position: 0, required: true },
1507
1542
  { name: 'formUuid', type: 'string', source: 'positional', position: 1, required: true },
@@ -1511,7 +1546,7 @@ const COMMAND_GROUPS = [
1511
1546
  ],
1512
1547
  notes: ['A successful write acknowledgement is not navigation readback. Follow with get-form-config <appType> <formUuid> --json; inspect renderNav, falling back to isRenderNav only when renderNav is absent.'],
1513
1548
  }),
1514
- command('get-form-config', ['get-form-config'], 'get-form-config <appType> <formUuid> [--json]', 'help.cmd_get_form_config', {
1549
+ command('get-form-config', ['get-form-config'], 'get-form-config <appType> <formUuid> [--json]', 'help.cmd_get_form_config', { managedRun: { scope: 'app', appPosition: 0 },
1515
1550
  output: 'json',
1516
1551
  args: [
1517
1552
  { name: 'appType', type: 'string', source: 'positional', position: 0, required: true },
@@ -1527,43 +1562,74 @@ const COMMAND_GROUPS = [
1527
1562
  titleKey: 'help.group_data',
1528
1563
  commands: [
1529
1564
  command('data', ['data'], 'data <query|get|create|update> <resource> ... | delete form <appType> <formUuid> --inst-id <id> --expect-form-name <name> --expect-form-type receipt --confirm [--json]', 'help.cmd_data', {
1565
+ managedRun: { scope: 'actions', actions: {
1566
+ query: { scope: 'actions', actions: {
1567
+ form: { scope: 'app', appPosition: 2 }, subform: { scope: 'app', appPosition: 2 },
1568
+ process: { scope: 'app', appPosition: 2 }, 'operation-records': { scope: 'app', appPosition: 2 },
1569
+ tasks: { scope: 'app', appPosition: 2 },
1570
+ } },
1571
+ get: { scope: 'actions', actions: {
1572
+ form: { scope: 'app', appPosition: 2 }, subform: { scope: 'app', appPosition: 2 },
1573
+ process: { scope: 'app', appPosition: 2 },
1574
+ } },
1575
+ create: { scope: 'actions', actions: {
1576
+ form: { scope: 'app', appPosition: 2, mutation: { operation: 'create_form_data', formUuidPosition: 3 } },
1577
+ process: { scope: 'app', appPosition: 2, mutation: { operation: 'create_form_data', formUuidPosition: 3 } },
1578
+ } },
1579
+ update: { scope: 'actions', actions: {
1580
+ form: { scope: 'app', appPosition: 2, mutation: { operation: 'update_form_data', formUuidOption: '--form-uuid' } },
1581
+ process: { scope: 'app', appPosition: 2, mutation: { operation: 'update_form_data', formUuidOption: '--form-uuid' } },
1582
+ } },
1583
+ delete: { scope: 'actions', actions: {
1584
+ form: { scope: 'app', appPosition: 2, mutation: { operation: 'delete_form_data', formUuidPosition: 3 } },
1585
+ } },
1586
+ execute: { scope: 'actions', actions: {
1587
+ task: { scope: 'app', appPosition: 2, mutation: { operation: 'execute_task', formUuidOption: '--form-uuid' } },
1588
+ } },
1589
+ } },
1530
1590
  output: 'json',
1531
1591
  noteKeys: ['help.data_notes'],
1592
+ notes: [
1593
+ 'Each condition uses key (field ID), componentName, type, operator and value. Query types: TextField/TextareaField/TableField TEXT; NumberField/RateField/DateField/CascadeDateField DOUBLE; RadioField/SelectField/CheckboxField/MultiSelectField/DepartmentSelectField ARRAY; EmployeeField/CascadeSelectField/CitySelectField STRING; ImageField/AttachmentField TEXT.',
1594
+ 'Ordinary form searchFormDatas accepts AND condition arrays via --search-json/--search-file. DateField: type DOUBLE, is/is_not, value ""; zero is filled. Query range endpoints as DateField with .start/.end: both empty means unfilled, both filled means complete.',
1595
+ 'Use synchronized NumberField counts (eq 0/gt 0) for any filled endpoint, multi-choice options or subform rows; maintain every write entry and backfill history. --resolve-aliases supports rangeAlias.start/.end and parentId aliases. Use server pagination and dynamicOrder. Guide: yida-skills/references/query-condition-guide.md; sample: yida-data-management empty-query.',
1596
+ ],
1532
1597
  examples: [
1598
+ 'openyida data query form APP_XXX FORM_XXX --page 1 --size 20 --search-json \'[{"key":"dateField_due","componentName":"DateField","type":"DOUBLE","operator":"is","value":""}]\'',
1533
1599
  'openyida data create form APP_XXX FORM_XXX --expect-form-name 客户 --expect-form-type receipt --data-json \'{"textField_name":"客户 A","dateField_followUp":1787932800000}\'',
1534
1600
  'openyida data delete form APP_XXX FORM_XXX --inst-id FINST_XXX --expect-form-name 客户 --expect-form-type receipt --confirm --json',
1535
1601
  ],
1536
1602
  }),
1537
- command('task-center', ['task-center'], 'task-center <type> [options]', 'help.cmd_task_center'),
1538
- command('basic-info', ['basic-info'], 'basic-info <overview|commodity|grant|capacity|quota|abs-path|dataflow|i18n|domain>', 'help.cmd_basic_info', {
1603
+ command('task-center', ['task-center'], 'task-center <type> [options]', 'help.cmd_task_center', { managedRun: { scope: 'denied', reason: 'scope_not_audited' } }),
1604
+ command('basic-info', ['basic-info'], 'basic-info <overview|commodity|grant|capacity|quota|abs-path|dataflow|i18n|domain>', 'help.cmd_basic_info', { managedRun: { scope: 'denied', reason: 'scope_not_audited' },
1539
1605
  output: 'json',
1540
1606
  }),
1541
- command('read-dingtalk-doc', ['read-dingtalk-doc'], 'read-dingtalk-doc <docUrl> [--output <file>] [--json]', 'help.cmd_read_dingtalk_doc', {
1607
+ command('read-dingtalk-doc', ['read-dingtalk-doc'], 'read-dingtalk-doc <docUrl> [--output <file>] [--json]', 'help.cmd_read_dingtalk_doc', { managedRun: { scope: 'selected_input', inputType: 'ding_doc', inputField: 'docUrl' },
1542
1608
  output: 'text|json',
1543
1609
  }),
1544
- command('read-dingtalk-tingji', ['read-dingtalk-tingji'], 'read-dingtalk-tingji <taskUuid> [--json]', 'help.cmd_read_dingtalk_tingji', {
1610
+ command('read-dingtalk-tingji', ['read-dingtalk-tingji'], 'read-dingtalk-tingji <taskUuid> [--json]', 'help.cmd_read_dingtalk_tingji', { managedRun: { scope: 'selected_input', inputType: 'tingji', inputField: 'taskUuid' },
1545
1611
  output: 'json',
1546
1612
  }),
1547
- command('get-permission', ['get-permission'], 'get-permission <appType> <formUuid> [--package-uuid <packageUuid>] [--json]', 'help.cmd_get_permission'),
1548
- command('save-permission', ['save-permission'], 'save-permission <appType> <formUuid> --package-uuid <packageUuid> [--data-permission <json>|--action-permission <json>|--field-permission <json>]', 'help.cmd_save_permission', {
1613
+ command('get-permission', ['get-permission'], 'get-permission <appType> <formUuid> [--package-uuid <packageUuid>] [--json]', 'help.cmd_get_permission', { managedRun: { scope: 'app', appPosition: 0 } }),
1614
+ command('save-permission', ['save-permission'], 'save-permission <appType> <formUuid> --package-uuid <packageUuid> [--data-permission <json>|--action-permission <json>|--field-permission <json>]', 'help.cmd_save_permission', { managedRun: { scope: 'app', appPosition: 0, mutation: { operation: 'update_form_permission', formUuidPosition: 1 } },
1549
1615
  examples: [
1550
1616
  'openyida get-permission APP_XXX FORM_XXX --json',
1551
1617
  'openyida save-permission APP_XXX FORM_XXX --package-uuid PACKAGE_XXX --data-permission \'{"dataRange":"ORIGINATOR"}\'',
1552
1618
  ],
1553
1619
  }),
1554
- command('corp-manager', ['corp-manager'], 'corp-manager <search-user|list|add|remove|address-book> ...', 'help.cmd_corp_manager', { output: 'json' }),
1555
- command('agent-center', ['agent-center'], 'agent-center <list|create|update|cancel|range|search-user> ...', 'help.cmd_agent_center', { output: 'json' }),
1620
+ command('corp-manager', ['corp-manager'], 'corp-manager <search-user|list|add|remove|address-book> ...', 'help.cmd_corp_manager', { managedRun: { scope: 'denied', reason: 'scope_not_audited' }, output: 'json' }),
1621
+ command('agent-center', ['agent-center'], 'agent-center <list|create|update|cancel|range|search-user> ...', 'help.cmd_agent_center', { managedRun: { scope: 'denied', reason: 'scope_not_audited' }, output: 'json' }),
1556
1622
  ],
1557
1623
  },
1558
1624
  {
1559
1625
  id: 'process',
1560
1626
  titleKey: 'help.group_process',
1561
1627
  commands: [
1562
- command('configure-process', ['configure-process'], 'configure-process <appType> <formUuid> <definition> [processCode] [--replace]', 'help.cmd_configure_process', {
1628
+ command('configure-process', ['configure-process'], 'configure-process <appType> <formUuid> <definition> [processCode] [--replace]', 'help.cmd_configure_process', { managedRun: {'scope':'app','appPosition':0,'mutation':{'operation':'update_process','formUuidPosition':1}},
1563
1629
  resultReuse: { mode: 'non_replayable_write', inputs: ['definition'], onInputChange: 'read_back_and_confirm_new_update', reason: 'May create and publish a new process version; --replace is not an idempotency key.' },
1564
1630
  examples: ['openyida configure-process APP_XXX FORM_XXX .cache/openyida/process/process-with-actions.json'],
1565
1631
  }),
1566
- command('create-process', ['create-process'], 'create-process <appType> <formTitle> <fieldsJsonFile> <processDefinitionFile> [--replace] | create-process <appType> --formUuid <formUuid> <processDefinitionFile> [--replace]', 'help.cmd_create_process', {
1632
+ command('create-process', ['create-process'], 'create-process <appType> <formTitle> <fieldsJsonFile> <processDefinitionFile> [--replace] | create-process <appType> --formUuid <formUuid> <processDefinitionFile> [--replace]', 'help.cmd_create_process', { managedRun: { scope: 'app', appPosition: 0, mutation: { operation: 'create_process' } },
1567
1633
  output: 'json',
1568
1634
  noteKeys: ['help.create_process_notes'],
1569
1635
  examples: [
@@ -1571,21 +1637,31 @@ const COMMAND_GROUPS = [
1571
1637
  'openyida create-process APP_XXX --formUuid FORM_XXX .cache/openyida/process/process-with-actions.json',
1572
1638
  ],
1573
1639
  }),
1574
- command('ai-form-setting', ['ai-form-setting'], 'ai-form-setting <get|fields|models|enable|disable|save> <appType> ...', 'help.cmd_ai_form_setting', {
1575
- output: 'json',
1576
- aliases: ['ai-approve', 'aiFormSetting'],
1640
+ command('ai-form-setting', ['ai-form-setting'], 'ai-form-setting <get|fields|models|enable|disable|save> <appType> ...', 'help.cmd_ai_form_setting', { managedRun: {
1641
+ scope: 'actions',
1642
+ actions: {
1643
+ get: { scope: 'app', appPosition: 1 },
1644
+ fields: { scope: 'app', appPosition: 1 },
1645
+ models: { scope: 'app', appPosition: 1 },
1646
+ enable: { scope: 'app', appPosition: 1, mutation: { operation: 'update_form_config' } },
1647
+ disable: { scope: 'app', appPosition: 1, mutation: { operation: 'update_form_config' } },
1648
+ save: { scope: 'app', appPosition: 1, mutation: { operation: 'update_form_config' } }
1649
+ }
1650
+ },
1651
+ output: 'json',
1652
+ aliases: ['ai-approve', 'aiFormSetting'],
1577
1653
  }),
1578
- command('process.preview', ['process', 'preview'], 'process preview <appType> ...', 'help.cmd_process_preview'),
1654
+ command('process.preview', ['process', 'preview'], 'process preview <appType> ...', 'help.cmd_process_preview', { managedRun: { scope: 'app', appPosition: 1 } }),
1579
1655
  ],
1580
1656
  },
1581
1657
  {
1582
1658
  id: 'share',
1583
1659
  titleKey: 'help.group_share',
1584
1660
  commands: [
1585
- command('verify-short-url', ['verify-short-url'], 'verify-short-url <appType> ...', 'help.cmd_verify_url'),
1586
- command('save-share-config', ['save-share-config'], 'save-share-config <appType> ...', 'help.cmd_save_share'),
1587
- command('get-page-config', ['get-page-config'], 'get-page-config <appType> <formUuid>', 'help.cmd_get_page_config'),
1588
- command('externalize-form', ['externalize-form'], 'externalize-form <appType> <formUuid> [--schema-file file]', 'help.cmd_externalize_form', {
1661
+ command('verify-short-url', ['verify-short-url'], 'verify-short-url <appType> ...', 'help.cmd_verify_url', { managedRun: { scope: 'app', appPosition: 0 } }),
1662
+ command('save-share-config', ['save-share-config'], 'save-share-config <appType> ...', 'help.cmd_save_share', { managedRun: { scope: 'app', appPosition: 0, mutation: { operation: 'update_share_config', formUuidPosition: 1 } } }),
1663
+ command('get-page-config', ['get-page-config'], 'get-page-config <appType> <formUuid>', 'help.cmd_get_page_config', { managedRun: { scope: 'app', appPosition: 0 } }),
1664
+ command('externalize-form', ['externalize-form'], 'externalize-form <appType> <formUuid> [--schema-file file]', 'help.cmd_externalize_form', { managedRun: { scope: 'denied', reason: 'scope_not_audited' },
1589
1665
  output: 'json|markdown',
1590
1666
  }),
1591
1667
  ],
@@ -1594,57 +1670,57 @@ const COMMAND_GROUPS = [
1594
1670
  id: 'report',
1595
1671
  titleKey: 'help.group_report',
1596
1672
  commands: [
1597
- command('create-report', ['create-report'], 'create-report <appType> "<name>" ... [--json] [--open|--no-open]', 'help.cmd_create_report'),
1598
- command('append-chart', ['append-chart'], 'append-chart <appType> <reportId> ... [--json] [--open|--no-open]', 'help.cmd_append_chart'),
1599
- command('report.inspect', ['report', 'inspect'], 'report inspect <appType> <reportId> --json', 'help.cmd_report_inspect', { output: 'json', resultReuse: { mode: 'read_only', invalidateAfter: 'observed_remote_mutation', source: 'current_server_schema_and_query_probes' } }),
1673
+ command('create-report', ['create-report'], 'create-report <appType> "<name>" ... [--json] [--open|--no-open]', 'help.cmd_create_report', { managedRun: {'scope':'app','appPosition':0,'mutation':{'operation':'create_report'}} }),
1674
+ command('append-chart', ['append-chart'], 'append-chart <appType> <reportId> ... [--json] [--open|--no-open]', 'help.cmd_append_chart', { managedRun: { scope: 'app', appPosition: 0, mutation: { operation: 'update_report', formUuidPosition: 1 } } }),
1675
+ command('report.inspect', ['report', 'inspect'], 'report inspect <appType> <reportId> --json', 'help.cmd_report_inspect', { managedRun: {'scope':'app','appPosition':1}, output: 'json', resultReuse: { mode: 'read_only', invalidateAfter: 'observed_remote_mutation', source: 'current_server_schema_and_query_probes' } }),
1600
1676
  ],
1601
1677
  },
1602
1678
  {
1603
1679
  id: 'connector',
1604
1680
  titleKey: 'help.group_connector',
1605
1681
  commands: [
1606
- command('connector.list', ['connector', 'list'], 'connector list', 'help.cmd_connector_list'),
1607
- command('connector.create', ['connector', 'create'], 'connector create "name" "domain" ...', 'help.cmd_connector_create'),
1608
- command('connector.detail', ['connector', 'detail'], 'connector detail <id>', 'help.cmd_connector_detail'),
1609
- command('connector.delete', ['connector', 'delete'], 'connector delete <id> [--force]', 'help.cmd_connector_delete'),
1610
- command('connector.add-action', ['connector', 'add-action'], 'connector add-action --operations <file> --connector-id <id>', 'help.cmd_connector_add_action'),
1611
- command('connector.update-action', ['connector', 'update-action'], 'connector update-action --connector-id <id> --action <operationId> --query-json JSON --confirm', 'help.cmd_connector_update_action'),
1612
- command('connector.list-actions', ['connector', 'list-actions'], 'connector list-actions <id>', 'help.cmd_connector_list_actions'),
1613
- command('connector.delete-action', ['connector', 'delete-action'], 'connector delete-action <id> <operation-id>', 'help.cmd_connector_delete_action'),
1614
- command('connector.test', ['connector', 'test'], 'connector test --connector-id <id> --action <actionId> [--path-json JSON] [--query-json JSON] [--header-json JSON] [--body-json JSON] [--account-id <id>] [--system-token-app <appType>] [--ignore-defaults]', 'help.cmd_connector_test'),
1615
- command('connector.list-connections', ['connector', 'list-connections'], 'connector list-connections <id>', 'help.cmd_connector_list_connections'),
1616
- command('connector.create-connection', ['connector', 'create-connection'], 'connector create-connection <id> <name> [--interactive]', 'help.cmd_connector_create_connection'),
1617
- command('connector.smart-create', ['connector', 'smart-create'], 'connector smart-create --curl "..."', 'help.cmd_connector_smart'),
1618
- command('connector.parse-api', ['connector', 'parse-api'], 'connector parse-api [options]', 'help.cmd_connector_parse_api'),
1619
- command('connector.gen-template', ['connector', 'gen-template'], 'connector gen-template [output]', 'help.cmd_connector_gen_template'),
1682
+ command('connector.list', ['connector', 'list'], 'connector list', 'help.cmd_connector_list', { managedRun: { scope: 'denied', reason: 'organization_scope_required' } }),
1683
+ command('connector.create', ['connector', 'create'], 'connector create "name" "domain" ...', 'help.cmd_connector_create', { managedRun: { scope: 'denied', reason: 'organization_scope_required' } }),
1684
+ command('connector.detail', ['connector', 'detail'], 'connector detail <id>', 'help.cmd_connector_detail', { managedRun: { scope: 'denied', reason: 'organization_scope_required' } }),
1685
+ command('connector.delete', ['connector', 'delete'], 'connector delete <id> [--force]', 'help.cmd_connector_delete', { managedRun: { scope: 'denied', reason: 'organization_scope_required' } }),
1686
+ command('connector.add-action', ['connector', 'add-action'], 'connector add-action --operations <file> --connector-id <id>', 'help.cmd_connector_add_action', { managedRun: { scope: 'denied', reason: 'organization_scope_required' } }),
1687
+ command('connector.update-action', ['connector', 'update-action'], 'connector update-action --connector-id <id> --action <operationId> --query-json JSON --confirm', 'help.cmd_connector_update_action', { managedRun: { scope: 'denied', reason: 'organization_scope_required' } }),
1688
+ command('connector.list-actions', ['connector', 'list-actions'], 'connector list-actions <id>', 'help.cmd_connector_list_actions', { managedRun: { scope: 'denied', reason: 'organization_scope_required' } }),
1689
+ command('connector.delete-action', ['connector', 'delete-action'], 'connector delete-action <id> <operation-id>', 'help.cmd_connector_delete_action', { managedRun: { scope: 'denied', reason: 'organization_scope_required' } }),
1690
+ command('connector.test', ['connector', 'test'], 'connector test --connector-id <id> --action <actionId> [--path-json JSON] [--query-json JSON] [--header-json JSON] [--body-json JSON] [--account-id <id>] [--system-token-app <appType>] [--ignore-defaults]', 'help.cmd_connector_test', { managedRun: { scope: 'denied', reason: 'organization_scope_required' } }),
1691
+ command('connector.list-connections', ['connector', 'list-connections'], 'connector list-connections <id>', 'help.cmd_connector_list_connections', { managedRun: { scope: 'denied', reason: 'organization_scope_required' } }),
1692
+ command('connector.create-connection', ['connector', 'create-connection'], 'connector create-connection <id> <name> [--interactive]', 'help.cmd_connector_create_connection', { managedRun: { scope: 'denied', reason: 'organization_scope_required' } }),
1693
+ command('connector.smart-create', ['connector', 'smart-create'], 'connector smart-create --curl "..."', 'help.cmd_connector_smart', { managedRun: { scope: 'denied', reason: 'organization_scope_required' } }),
1694
+ command('connector.parse-api', ['connector', 'parse-api'], 'connector parse-api [options]', 'help.cmd_connector_parse_api', { managedRun: { scope: 'local' } }),
1695
+ command('connector.gen-template', ['connector', 'gen-template'], 'connector gen-template [output]', 'help.cmd_connector_gen_template', { managedRun: { scope: 'local' } }),
1620
1696
  ],
1621
1697
  },
1622
1698
  {
1623
1699
  id: 'integration',
1624
1700
  titleKey: 'help.group_integration',
1625
1701
  commands: [
1626
- command('integration.create', ['integration', 'create'], 'integration create <appType> ... [--spec file.json] [--connector-system-token-app <appType>]', 'help.cmd_integration'),
1627
- command('integration.update', ['integration', 'update'], 'integration update <appType> <formUuid> <processCode> --spec <desired-spec.json> [--publish]', 'help.cmd_integration_update', {
1702
+ command('integration.create', ['integration', 'create'], 'integration create <appType> ... [--spec file.json] [--connector-system-token-app <appType>]', 'help.cmd_integration', { managedRun: { scope: 'app', appPosition: 1, mutation: { operation: 'create_process' } } }),
1703
+ command('integration.update', ['integration', 'update'], 'integration update <appType> <formUuid> <processCode> --spec <desired-spec.json> [--publish]', 'help.cmd_integration_update', { managedRun: { scope: 'app', appPosition: 1 },
1628
1704
  requiresLogin: false,
1629
1705
  output: 'json',
1630
1706
  }),
1631
- command('integration.list', ['integration', 'list'], 'integration list <appType> [--flow-types 1,2,3,5,6] [--form-uuid <uuid>] [--status y|n] [--json]', 'help.cmd_integration_list', {
1707
+ command('integration.list', ['integration', 'list'], 'integration list <appType> [--flow-types 1,2,3,5,6] [--form-uuid <uuid>] [--status y|n] [--json]', 'help.cmd_integration_list', { managedRun: { scope: 'app', appPosition: 1 },
1632
1708
  output: 'json',
1633
1709
  }),
1634
- command('integration.enable', ['integration', 'enable'], 'integration enable <appType> <formUuid> <processCode>', 'help.cmd_integration_enable', {
1710
+ command('integration.enable', ['integration', 'enable'], 'integration enable <appType> <formUuid> <processCode>', 'help.cmd_integration_enable', { managedRun: { scope: 'app', appPosition: 1, mutation: { operation: 'update_process', formUuidPosition: 2 } },
1635
1711
  output: 'json',
1636
1712
  }),
1637
- command('integration.disable', ['integration', 'disable'], 'integration disable <appType> <formUuid> <processCode>', 'help.cmd_integration_disable', {
1713
+ command('integration.disable', ['integration', 'disable'], 'integration disable <appType> <formUuid> <processCode>', 'help.cmd_integration_disable', { managedRun: { scope: 'app', appPosition: 1, mutation: { operation: 'update_process', formUuidPosition: 2 } },
1638
1714
  output: 'json',
1639
1715
  }),
1640
- command('integration.check', ['integration', 'check'], 'integration check <appType...>', 'help.cmd_integration_check'),
1641
- command('integration.diagnose', ['integration', 'diagnose'], 'integration diagnose (--text <text>|--file <path>|--rules) [--json]', 'help.cmd_integration_diagnose', {
1716
+ command('integration.check', ['integration', 'check'], 'integration check <appType...>', 'help.cmd_integration_check', { managedRun: { scope: 'app', appPosition: 1 } }),
1717
+ command('integration.diagnose', ['integration', 'diagnose'], 'integration diagnose (--text <text>|--file <path>|--rules) [--json]', 'help.cmd_integration_diagnose', { managedRun: { scope: 'local' },
1642
1718
  requiresLogin: false,
1643
1719
  output: 'text|json',
1644
1720
  }),
1645
- command('dws', ['dws'], 'dws <command> [args]', 'help.cmd_dws'),
1646
- command('dws.contact-user-search', ['dws', 'contact', 'user', 'search'], 'dws contact user search --keyword <text>', 'help.cmd_dws'),
1647
- command('dingtalk-link', ['dingtalk-link'], 'dingtalk-link <url> [--target fullScreen] [--legacy-scheme] [--json]', 'help.cmd_dingtalk_link', {
1721
+ command('dws', ['dws'], 'dws <command> [args]', 'help.cmd_dws', { managedRun: { scope: 'denied', reason: 'scope_not_audited' } }),
1722
+ command('dws.contact-user-search', ['dws', 'contact', 'user', 'search'], 'dws contact user search --keyword <text>', 'help.cmd_dws', { managedRun: { scope: 'denied', reason: 'scope_not_audited' } }),
1723
+ command('dingtalk-link', ['dingtalk-link'], 'dingtalk-link <url> [--target fullScreen] [--legacy-scheme] [--json]', 'help.cmd_dingtalk_link', { managedRun: { scope: 'local' },
1648
1724
  requiresLogin: false,
1649
1725
  output: 'text|json',
1650
1726
  }),
@@ -1654,32 +1730,38 @@ const COMMAND_GROUPS = [
1654
1730
  id: 'utility',
1655
1731
  titleKey: 'help.group_utility',
1656
1732
  commands: [
1657
- command('commands', ['commands'], 'commands [--json]', 'help.cmd_commands', {
1733
+ command('commands', ['commands'], 'commands [--json]', 'help.cmd_commands', { managedRun: { scope: 'local' },
1734
+ requiresLogin: false,
1735
+ output: 'json',
1736
+ }),
1737
+ command('agent-capabilities', ['agent-capabilities'], 'agent-capabilities [--json] [--summary-json|--compact]', 'help.cmd_agent_capabilities', { managedRun: { scope: 'local' },
1658
1738
  requiresLogin: false,
1659
1739
  output: 'json',
1660
1740
  }),
1661
- command('agent-capabilities', ['agent-capabilities'], 'agent-capabilities [--json] [--summary-json|--compact]', 'help.cmd_agent_capabilities', {
1741
+ command('agent', ['agent'], 'agent <doctor|diagnose|status|connect|run|disconnect|logout|logs> [options]', 'help.cmd_agent', { managedRun: { scope: 'actions', actions: { 'ask-human': { scope: 'local' } } },
1662
1742
  requiresLogin: false,
1663
1743
  output: 'json',
1744
+ examples: ['openyida agent diagnose --json', 'openyida agent diagnose --session "<Yida session URL>" --json', 'openyida agent run --help'],
1664
1745
  }),
1665
- command('mcp', ['mcp'], 'mcp', 'help.cmd_commands', {
1746
+ command('mcp', ['mcp'], 'mcp', 'help.cmd_commands', { managedRun: { scope: 'denied', reason: 'scope_not_audited' },
1666
1747
  requiresLogin: false,
1667
1748
  output: 'json',
1668
1749
  hidden: true,
1669
1750
  }),
1670
- command('a2a', ['a2a'], 'a2a <serve|agent-card> [options]', 'help.cmd_a2a', {
1751
+ command('a2a', ['a2a'], 'a2a <serve|agent-card> [options]', 'help.cmd_a2a', { managedRun: { scope: 'denied', reason: 'scope_not_audited' },
1671
1752
  requiresLogin: false,
1672
1753
  output: 'text|json',
1673
1754
  }),
1674
- command('bridge', ['bridge'], 'bridge start [--token <pair-token>] [--port 6736] [--origin https://demo.aliwork.com] [--open|--no-open]', 'help.cmd_bridge', {
1755
+ command('bridge', ['bridge'], 'bridge start [--token <pair-token>] [--port 6736] [--origin https://demo.aliwork.com] [--open|--no-open]', 'help.cmd_bridge', { managedRun: { scope: 'denied', reason: 'scope_not_audited' },
1675
1756
  requiresLogin: false,
1676
1757
  output: 'text|json',
1677
1758
  }),
1678
- command('copy', ['copy'], 'copy [--force]', 'help.cmd_copy', { requiresLogin: false }),
1679
- command('sample', ['sample'], 'sample [--list] [<skill> <name>] [--output <file-or-directory>] [--var KEY=VALUE ...] [--design-file <design.md>] [--style-id <themeId|free-creative>] [--theme-ids <id,...>] [--pop-art-context <explicit-request|showcase>]', 'help.cmd_sample', {
1759
+ command('copy', ['copy'], 'copy [--force]', 'help.cmd_copy', { managedRun: {'scope':'denied','reason':'scope_not_audited'}, requiresLogin: false }),
1760
+ command('sample', ['sample'], 'sample [--list] [<skill> <name>] [--output <file-or-directory>] [--var KEY=VALUE ...] [--design-file <design.md>] [--style-id <themeId|free-creative>] [--theme-ids <id,...>] [--pop-art-context <explicit-request|showcase>]', 'help.cmd_sample', { managedRun: { scope: 'local' },
1680
1761
  requiresLogin: false,
1681
1762
  output: 'text|json',
1682
1763
  notes: [
1764
+ 'openyida sample yida-data-management empty-query --output <file.js> emits buildEmptyConditions, buildCountConditions and countFilledRangeEndpoints. Use current schema field IDs and explicit range modes. Returned arrays work with --search-json or page searchFormDatas. The template performs no query, schema change or count maintenance.',
1683
1765
  'On explicit preview requests only: openyida sample yida-design theme-preview --theme-ids <comma-separated-ids> --output <preview.html> --json generates a standalone read-only HTML gallery on any host. Displays all requested eligible themes, titles and images only, four to six columns on desktop with responsive wrapping and unlimited rows; refuses existing files. No selection buttons. Use ask_human for selection. app-pop requires --pop-art-context explicit-request|showcase with actual task evidence; absent evidence, exclude it from recommendations, choices and previews.',
1684
1766
  'Optional read-only QwenWork preview, only on explicit user request: run openyida sample yida-design theme-selector --json to prepare only the preview HTML in the host skills directory. No bridge submission; selection always uses ask_human. Pass result.widget_path unchanged to qoder_show_widget; it is relative to result.skillsRoot, not result.outputPath or a repository path. This sample does not accept --output, --var, --design-file or --style-id.',
1685
1767
  'yida-design app-theme reads concrete tokens from --design-file and writes CSS plus a sibling <output>.tokens.md update snapshot. The same output path preserves project CSS and applies changed tokens. Without --design-file it resets the output to the public base template. Menu radius, normal/hover/selected borders and selected shadow apply to side, L-shaped and top navigation; only legacy/shared-skeleton CSS gains missing menu-shape rules. Named templates preserve paired CSS declarations and selectors, instantiate brand placeholders and apply project deltas without auto-adding navigation rules or color-group.',
@@ -1707,30 +1789,30 @@ const COMMAND_GROUPS = [
1707
1789
  { name: 'styleId', type: 'string', source: 'option', builder_options: ['--style-id'], description: 'Required only for yida-design application-style. Accepts any themeId from design-plan catalog, including shared themes and free-creative. Exports design.md, app_theme.css and form-layout.json with brand placeholders; accepts neither --design-file nor --var.' },
1708
1790
  ],
1709
1791
  }),
1710
- command('doctor', ['doctor'], 'doctor [--fix]', 'help.cmd_doctor', { requiresLogin: false }),
1711
- command('db-seq-fix', ['db-seq-fix'], 'db-seq-fix [--fix]', 'help.cmd_db_seq_fix'),
1712
- command('formula.evaluate', ['formula', 'evaluate'], 'formula evaluate <formula|file> [--schema file]', 'help.cmd_formula_evaluate', {
1792
+ command('doctor', ['doctor'], 'doctor [--fix]', 'help.cmd_doctor', { managedRun: { scope: 'denied', reason: 'scope_not_audited' }, requiresLogin: false }),
1793
+ command('db-seq-fix', ['db-seq-fix'], 'db-seq-fix [--fix]', 'help.cmd_db_seq_fix', { managedRun: { scope: 'denied', reason: 'scope_not_audited' } }),
1794
+ command('formula.evaluate', ['formula', 'evaluate'], 'formula evaluate <formula|file> [--schema file]', 'help.cmd_formula_evaluate', { managedRun: { scope: 'local' },
1713
1795
  requiresLogin: false,
1714
1796
  output: 'text|json',
1715
1797
  }),
1716
- command('update', ['update'], 'update', 'help.cmd_update', { requiresLogin: false }),
1717
- command('export-conversation', ['export-conversation'], 'export-conversation [options]', 'help.cmd_export_conversation', {
1798
+ command('update', ['update'], 'update', 'help.cmd_update', { managedRun: { scope: 'denied', reason: 'scope_not_audited' }, requiresLogin: false }),
1799
+ command('export-conversation', ['export-conversation'], 'export-conversation [options]', 'help.cmd_export_conversation', { managedRun: { scope: 'denied', reason: 'scope_not_audited' },
1718
1800
  requiresLogin: false,
1719
1801
  }),
1720
- command('feedback', ['feedback'], 'feedback <setup|url|dismiss|status> [options]', 'help.cmd_feedback', {
1802
+ command('feedback', ['feedback'], 'feedback <setup|url|dismiss|status> [options]', 'help.cmd_feedback', { managedRun: { scope: 'denied', reason: 'scope_not_audited' },
1721
1803
  requiresLogin: false,
1722
1804
  output: 'text|json',
1723
1805
  }),
1724
- command('batch', ['batch'], 'batch <file>|--commands "cmd1 ; cmd2" [--stop-on-error] [--json]', 'help.cmd_batch', {
1806
+ command('batch', ['batch'], 'batch <file>|--commands "cmd1 ; cmd2" [--stop-on-error] [--json]', 'help.cmd_batch', { managedRun: { scope: 'denied', reason: 'scope_not_audited' },
1725
1807
  output: 'text|json',
1726
1808
  }),
1727
- command('flash-to-prd', ['flash-to-prd'], 'flash-to-prd --file <path> --name "<project>"', 'help.cmd_flash_to_prd', {
1809
+ command('flash-to-prd', ['flash-to-prd'], 'flash-to-prd --file <path> --name "<project>"', 'help.cmd_flash_to_prd', { managedRun: { scope: 'denied', reason: 'scope_not_audited' },
1728
1810
  requiresLogin: false,
1729
1811
  }),
1730
- command('ai', ['ai'], 'ai <text|image> [options]', 'help.cmd_ai', {
1812
+ command('ai', ['ai'], 'ai <text|image> [options]', 'help.cmd_ai', { managedRun: { scope: 'denied', reason: 'scope_not_audited' },
1731
1813
  output: 'text|json',
1732
1814
  }),
1733
- command('asset', ['asset'], 'asset <status|resolve|sources> [options]', 'help.cmd_asset', {
1815
+ command('asset', ['asset'], 'asset <status|resolve|sources> [options]', 'help.cmd_asset', { managedRun: { scope: 'actions', actions: { status: { scope: 'local' }, sources: { scope: 'local' }, resolve: { scope: 'app', appOption: '--app-type' } } },
1734
1816
  noteKeys: ['asset.sourceRecords'],
1735
1817
  notes: ['resolve --page-id <pageId> selects a page from --design or input assetStrategy; output contains only that page. Use distinct --manifest paths for concurrent page jobs. Host search follows collection_policy; resolve performs one attempt per supplied candidate. Verified hotlink-allowed URLs are delivered directly without login or appType. Draft assets accept hotlinkAllowed/rehostAllowed booleans and deliveryMode=auto|upload. Stock CDN URLs allow hotlinking by default; Unsplash requires hotlinking unless separate rehosting permission is recorded. --upload-assets requests permitted hosting; upload failure keeps only a verified hotlink-allowed original URL.'],
1736
1818
  args: [
@@ -1741,9 +1823,9 @@ const COMMAND_GROUPS = [
1741
1823
  requiresLogin: false,
1742
1824
  output: 'text|json',
1743
1825
  }),
1744
- command('cdn-config', ['cdn-config'], 'cdn-config [options]', 'help.cmd_cdn_config'),
1745
- command('cdn-upload', ['cdn-upload'], 'cdn-upload <image-path>', 'help.cmd_cdn_upload'),
1746
- command('cdn-refresh', ['cdn-refresh'], 'cdn-refresh [options]', 'help.cmd_cdn_refresh'),
1826
+ command('cdn-config', ['cdn-config'], 'cdn-config [options]', 'help.cmd_cdn_config', { managedRun: { scope: 'denied', reason: 'scope_not_audited' } }),
1827
+ command('cdn-upload', ['cdn-upload'], 'cdn-upload <image-path>', 'help.cmd_cdn_upload', { managedRun: { scope: 'denied', reason: 'scope_not_audited' } }),
1828
+ command('cdn-refresh', ['cdn-refresh'], 'cdn-refresh [options]', 'help.cmd_cdn_refresh', { managedRun: { scope: 'denied', reason: 'scope_not_audited' } }),
1747
1829
  ],
1748
1830
  },
1749
1831
  ];
@@ -1774,6 +1856,7 @@ function localizeCommand(entry, translate) {
1774
1856
  notes: [...cloneJsonMetadata(entry.notes, []), ...(entry.noteKeys || []).map(key => translate(key))],
1775
1857
  ...(entry.resultReuse ? { result_reuse: cloneJsonMetadata(entry.resultReuse, null) } : {}),
1776
1858
  hidden: entry.hidden,
1859
+ managed_run: cloneJsonMetadata(entry.managedRun, null),
1777
1860
  side_effect: cloneSideEffect(entry.sideEffect),
1778
1861
  permission: clonePermission(entry.permission),
1779
1862
  };
@@ -2060,6 +2143,7 @@ function buildCommandManifest(options = {}) {
2060
2143
  title_key: group.titleKey,
2061
2144
  commands: group.commands.map(entry => entry.id),
2062
2145
  })),
2146
+ managed_run_schema: managedPolicySchema(),
2063
2147
  side_effect_schema: cloneSideEffectSchema(),
2064
2148
  permission_schema: clonePermissionSchema(),
2065
2149
  forbidden_alias_schema: cloneForbiddenAliasSchema(),