@lesliechan721/aw 0.1.0-beta.8 → 0.1.0-beta.9

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 (275) hide show
  1. package/dist/authoring/scripts/add-skill.mjs +4 -4
  2. package/dist/authoring/scripts/add-skill.mjs.map +1 -1
  3. package/dist/authoring/scripts/init-plugin.mjs +4 -4
  4. package/dist/authoring/scripts/init-plugin.mjs.map +1 -1
  5. package/dist/authoring/scripts/lib/plugin-version-check.mjs +1 -1
  6. package/dist/authoring/scripts/lib/skill-scaffold.d.mts +77 -90
  7. package/dist/authoring/scripts/lib/skill-scaffold.mjs +99 -120
  8. package/dist/authoring/scripts/lib/skill-scaffold.mjs.map +1 -1
  9. package/dist/authoring/scripts/remove-plugin.mjs +1 -1
  10. package/dist/authoring/scripts/remove-plugin.mjs.map +1 -1
  11. package/dist/authoring/scripts/validate-plugin.mjs +34 -778
  12. package/dist/authoring/scripts/validate-plugin.mjs.map +1 -1
  13. package/dist/scripts/aw-skill-eval-materializer.d.ts +24 -0
  14. package/dist/scripts/{plugin-eval-materializer.js → aw-skill-eval-materializer.js} +34 -145
  15. package/dist/scripts/aw-skill-eval-materializer.js.map +1 -0
  16. package/dist/scripts/bundle-plugins.d.ts +1 -0
  17. package/dist/scripts/bundle-plugins.js +2 -1
  18. package/dist/scripts/bundle-plugins.js.map +1 -1
  19. package/dist/scripts/plugin-staging.d.ts +5 -6
  20. package/dist/scripts/plugin-staging.js +12 -13
  21. package/dist/scripts/plugin-staging.js.map +1 -1
  22. package/dist/src/authoring/workspace-commands.d.ts +2 -1
  23. package/dist/src/authoring/workspace-commands.js.map +1 -1
  24. package/dist/src/commands/aw-capabilities.d.ts +2 -2
  25. package/dist/src/commands/aw-capabilities.js +6 -11
  26. package/dist/src/commands/aw-capabilities.js.map +1 -1
  27. package/dist/src/commands/catalog-dev-source.d.ts +18 -12
  28. package/dist/src/commands/catalog-dev-source.js +241 -305
  29. package/dist/src/commands/catalog-dev-source.js.map +1 -1
  30. package/dist/src/commands/catalog-generation.d.ts +6 -19
  31. package/dist/src/commands/catalog-generation.js +10 -11
  32. package/dist/src/commands/catalog-generation.js.map +1 -1
  33. package/dist/src/commands/catalog-publication-inspection.d.ts +28 -27
  34. package/dist/src/commands/catalog-publication-inspection.js +139 -50
  35. package/dist/src/commands/catalog-publication-inspection.js.map +1 -1
  36. package/dist/src/commands/catalog-publication-journal.d.ts +49 -0
  37. package/dist/src/commands/catalog-publication-journal.js +147 -0
  38. package/dist/src/commands/catalog-publication-journal.js.map +1 -0
  39. package/dist/src/commands/catalog-publication-target.d.ts +2 -1
  40. package/dist/src/commands/catalog-publication-target.js +37 -2
  41. package/dist/src/commands/catalog-publication-target.js.map +1 -1
  42. package/dist/src/commands/catalog-publish.d.ts +51 -15
  43. package/dist/src/commands/catalog-publish.js +576 -219
  44. package/dist/src/commands/catalog-publish.js.map +1 -1
  45. package/dist/src/commands/catalog-source.d.ts +3 -28
  46. package/dist/src/commands/catalog-source.js +29 -140
  47. package/dist/src/commands/catalog-source.js.map +1 -1
  48. package/dist/src/commands/catalog-status.d.ts +6 -26
  49. package/dist/src/commands/catalog-status.js +8 -146
  50. package/dist/src/commands/catalog-status.js.map +1 -1
  51. package/dist/src/commands/catalog-workspace-resolution.d.ts +13 -0
  52. package/dist/src/commands/catalog-workspace-resolution.js +42 -0
  53. package/dist/src/commands/catalog-workspace-resolution.js.map +1 -0
  54. package/dist/src/commands/dependency-operation-plan.d.ts +88 -9
  55. package/dist/src/commands/dependency-operation-plan.js +331 -6
  56. package/dist/src/commands/dependency-operation-plan.js.map +1 -1
  57. package/dist/src/commands/init.d.ts +5 -11
  58. package/dist/src/commands/init.js +30 -51
  59. package/dist/src/commands/init.js.map +1 -1
  60. package/dist/src/commands/offline-cleanup-evidence.d.ts +20 -0
  61. package/dist/src/commands/offline-cleanup-evidence.js +87 -9
  62. package/dist/src/commands/offline-cleanup-evidence.js.map +1 -1
  63. package/dist/src/commands/options.d.ts +6 -1
  64. package/dist/src/commands/options.js +64 -6
  65. package/dist/src/commands/options.js.map +1 -1
  66. package/dist/src/commands/plugin-capabilities.js +4 -0
  67. package/dist/src/commands/plugin-capabilities.js.map +1 -1
  68. package/dist/src/commands/rebuild-command.d.ts +10 -8
  69. package/dist/src/commands/rebuild-command.js +1217 -426
  70. package/dist/src/commands/rebuild-command.js.map +1 -1
  71. package/dist/src/commands/rebuild-integration.d.ts +54 -6
  72. package/dist/src/commands/rebuild-integration.js +691 -364
  73. package/dist/src/commands/rebuild-integration.js.map +1 -1
  74. package/dist/src/commands/rebuild-operations.d.ts +2 -0
  75. package/dist/src/commands/rebuild-operations.js +31 -17
  76. package/dist/src/commands/rebuild-operations.js.map +1 -1
  77. package/dist/src/commands/skill-eval.d.ts +33 -0
  78. package/dist/src/commands/skill-eval.js +363 -0
  79. package/dist/src/commands/skill-eval.js.map +1 -0
  80. package/dist/src/commands/{status-v5.d.ts → status-v6.d.ts} +59 -26
  81. package/dist/src/commands/{status-v5.js → status-v6.js} +882 -79
  82. package/dist/src/commands/status-v6.js.map +1 -0
  83. package/dist/src/commands/sync-command.d.ts +21 -0
  84. package/dist/src/commands/sync-command.js +206 -0
  85. package/dist/src/commands/sync-command.js.map +1 -0
  86. package/dist/src/commands/wizard.d.ts +2 -2
  87. package/dist/src/commands/write-commands.js +1 -43
  88. package/dist/src/commands/write-commands.js.map +1 -1
  89. package/dist/src/constants.d.ts +5 -4
  90. package/dist/src/constants.js +5 -4
  91. package/dist/src/constants.js.map +1 -1
  92. package/dist/src/eval/manifest-v1.d.ts +66 -0
  93. package/dist/src/eval/manifest-v1.js +326 -0
  94. package/dist/src/eval/manifest-v1.js.map +1 -0
  95. package/dist/src/generators/local-plugin.d.ts +3 -0
  96. package/dist/src/generators/local-plugin.js +123 -55
  97. package/dist/src/generators/local-plugin.js.map +1 -1
  98. package/dist/src/index.d.ts +2 -0
  99. package/dist/src/index.js +412 -152
  100. package/dist/src/index.js.map +1 -1
  101. package/dist/src/output/command-receipt.d.ts +58 -8
  102. package/dist/src/output/command-receipt.js +141 -11
  103. package/dist/src/output/command-receipt.js.map +1 -1
  104. package/dist/src/output/model.d.ts +3 -11
  105. package/dist/src/portable/commands.d.ts +2 -2
  106. package/dist/src/portable/commands.js +2 -8
  107. package/dist/src/portable/commands.js.map +1 -1
  108. package/dist/src/portable/materializer.d.ts +1 -4
  109. package/dist/src/portable/materializer.js +0 -2
  110. package/dist/src/portable/materializer.js.map +1 -1
  111. package/dist/src/tui/catalog-generation.d.ts +20 -41
  112. package/dist/src/tui/catalog-generation.js +65 -224
  113. package/dist/src/tui/catalog-generation.js.map +1 -1
  114. package/dist/src/tui/components.js +1 -2
  115. package/dist/src/tui/components.js.map +1 -1
  116. package/dist/src/tui/console-app-v4.js +461 -330
  117. package/dist/src/tui/console-app-v4.js.map +1 -1
  118. package/dist/src/tui/controller-runtime.d.ts +3 -5
  119. package/dist/src/tui/controller-runtime.js +182 -187
  120. package/dist/src/tui/controller-runtime.js.map +1 -1
  121. package/dist/src/tui/controller.d.ts +42 -45
  122. package/dist/src/tui/controller.js +454 -407
  123. package/dist/src/tui/controller.js.map +1 -1
  124. package/dist/src/tui/diagnostics.d.ts +1 -2
  125. package/dist/src/tui/diagnostics.js.map +1 -1
  126. package/dist/src/tui/index.d.ts +1 -1
  127. package/dist/src/tui/index.js +1 -1
  128. package/dist/src/tui/index.js.map +1 -1
  129. package/dist/src/tui/model.d.ts +81 -13
  130. package/dist/src/tui/model.js +378 -95
  131. package/dist/src/tui/model.js.map +1 -1
  132. package/dist/src/tui/router.d.ts +9 -0
  133. package/dist/src/tui/router.js.map +1 -1
  134. package/dist/src/types.d.ts +54 -47
  135. package/dist/src/types.js.map +1 -1
  136. package/dist/src/utils/agent-version.d.ts +4 -1
  137. package/dist/src/utils/agent-version.js +28 -3
  138. package/dist/src/utils/agent-version.js.map +1 -1
  139. package/dist/src/utils/catalog-digests.d.ts +7 -0
  140. package/dist/src/utils/catalog-digests.js +27 -0
  141. package/dist/src/utils/catalog-digests.js.map +1 -1
  142. package/dist/src/utils/catalog-generation-control-snapshot.d.ts +11 -0
  143. package/dist/src/utils/catalog-generation-control-snapshot.js +45 -0
  144. package/dist/src/utils/catalog-generation-control-snapshot.js.map +1 -0
  145. package/dist/src/utils/catalog-generation-error.d.ts +2 -1
  146. package/dist/src/utils/catalog-generation-error.js +12 -0
  147. package/dist/src/utils/catalog-generation-error.js.map +1 -1
  148. package/dist/src/utils/catalog-generation-resolver.d.ts +10 -3
  149. package/dist/src/utils/catalog-generation-resolver.js +90 -76
  150. package/dist/src/utils/catalog-generation-resolver.js.map +1 -1
  151. package/dist/src/utils/catalog-generation-service.d.ts +24 -33
  152. package/dist/src/utils/catalog-generation-service.js +253 -567
  153. package/dist/src/utils/catalog-generation-service.js.map +1 -1
  154. package/dist/src/utils/catalog-generation-state.d.ts +4 -0
  155. package/dist/src/utils/catalog-generation-state.js +73 -106
  156. package/dist/src/utils/catalog-generation-state.js.map +1 -1
  157. package/dist/src/utils/catalog-generation-store.d.ts +16 -26
  158. package/dist/src/utils/catalog-generation-store.js +154 -290
  159. package/dist/src/utils/catalog-generation-store.js.map +1 -1
  160. package/dist/src/utils/catalog-manifest-v6.d.ts +5 -0
  161. package/dist/src/utils/{catalog-manifest-v5.js → catalog-manifest-v6.js} +23 -35
  162. package/dist/src/utils/catalog-manifest-v6.js.map +1 -0
  163. package/dist/src/utils/catalog-operation-context.d.ts +6 -14
  164. package/dist/src/utils/catalog-operation-context.js +68 -169
  165. package/dist/src/utils/catalog-operation-context.js.map +1 -1
  166. package/dist/src/utils/catalog-public-error.js +1 -4
  167. package/dist/src/utils/catalog-public-error.js.map +1 -1
  168. package/dist/src/utils/catalog-runtime-projection.d.ts +3 -0
  169. package/dist/src/utils/catalog-runtime-projection.js +5 -40
  170. package/dist/src/utils/catalog-runtime-projection.js.map +1 -1
  171. package/dist/src/utils/catalog-snapshot.d.ts +2 -2
  172. package/dist/src/utils/catalog-source-references.d.ts +7 -0
  173. package/dist/src/utils/catalog-source-references.js +44 -55
  174. package/dist/src/utils/catalog-source-references.js.map +1 -1
  175. package/dist/src/utils/catalog-sources.js +25 -9
  176. package/dist/src/utils/catalog-sources.js.map +1 -1
  177. package/dist/src/utils/codex-config.d.ts +2 -0
  178. package/dist/src/utils/codex-config.js +22 -1
  179. package/dist/src/utils/codex-config.js.map +1 -1
  180. package/dist/src/utils/codex-manager.d.ts +50 -2
  181. package/dist/src/utils/codex-manager.js +160 -6
  182. package/dist/src/utils/codex-manager.js.map +1 -1
  183. package/dist/src/utils/codex-reconciler.d.ts +131 -0
  184. package/dist/src/utils/codex-reconciler.js +327 -0
  185. package/dist/src/utils/codex-reconciler.js.map +1 -0
  186. package/dist/src/utils/codex-shared-native.d.ts +56 -0
  187. package/dist/src/utils/codex-shared-native.js +87 -0
  188. package/dist/src/utils/codex-shared-native.js.map +1 -0
  189. package/dist/src/utils/codex-surface-analysis.d.ts +44 -0
  190. package/dist/src/utils/codex-surface-analysis.js +247 -0
  191. package/dist/src/utils/codex-surface-analysis.js.map +1 -0
  192. package/dist/src/utils/git-catalog-provider.js +56 -115
  193. package/dist/src/utils/git-catalog-provider.js.map +1 -1
  194. package/dist/src/utils/manifest.d.ts +1 -3
  195. package/dist/src/utils/manifest.js +1 -3
  196. package/dist/src/utils/manifest.js.map +1 -1
  197. package/dist/src/utils/multi-source-catalog.d.ts +1 -10
  198. package/dist/src/utils/multi-source-catalog.js +8 -175
  199. package/dist/src/utils/multi-source-catalog.js.map +1 -1
  200. package/dist/src/utils/native-cli.d.ts +34 -0
  201. package/dist/src/utils/native-cli.js +91 -0
  202. package/dist/src/utils/native-cli.js.map +1 -1
  203. package/dist/src/utils/orphan-marketplace-cleanup.js +1 -0
  204. package/dist/src/utils/orphan-marketplace-cleanup.js.map +1 -1
  205. package/dist/src/utils/ownership.d.ts +0 -10
  206. package/dist/src/utils/ownership.js +3 -88
  207. package/dist/src/utils/ownership.js.map +1 -1
  208. package/dist/src/utils/path-catalog-provider.d.ts +1 -1
  209. package/dist/src/utils/path-catalog-provider.js +45 -62
  210. package/dist/src/utils/path-catalog-provider.js.map +1 -1
  211. package/dist/src/utils/paths.d.ts +0 -1
  212. package/dist/src/utils/paths.js +0 -1
  213. package/dist/src/utils/paths.js.map +1 -1
  214. package/dist/src/utils/plugin-config-write.js +0 -5
  215. package/dist/src/utils/plugin-config-write.js.map +1 -1
  216. package/dist/src/utils/plugin-intent-state.d.ts +39 -0
  217. package/dist/src/utils/plugin-intent-state.js +325 -0
  218. package/dist/src/utils/plugin-intent-state.js.map +1 -0
  219. package/dist/src/utils/target-eligibility.d.ts +3 -2
  220. package/dist/src/utils/target-eligibility.js +4 -3
  221. package/dist/src/utils/target-eligibility.js.map +1 -1
  222. package/package.json +5 -4
  223. package/dist/scripts/aw-skill-eval-engine.d.ts +0 -13
  224. package/dist/scripts/aw-skill-eval-engine.js +0 -31
  225. package/dist/scripts/aw-skill-eval-engine.js.map +0 -1
  226. package/dist/scripts/codex-eval-app-server.d.ts +0 -91
  227. package/dist/scripts/codex-eval-app-server.js +0 -1334
  228. package/dist/scripts/codex-eval-app-server.js.map +0 -1
  229. package/dist/scripts/codex-eval-isolation.d.ts +0 -61
  230. package/dist/scripts/codex-eval-isolation.js +0 -318
  231. package/dist/scripts/codex-eval-isolation.js.map +0 -1
  232. package/dist/scripts/codex-eval-process-management.d.ts +0 -8
  233. package/dist/scripts/codex-eval-process-management.js +0 -69
  234. package/dist/scripts/codex-eval-process-management.js.map +0 -1
  235. package/dist/scripts/codex-eval-process-tree.d.ts +0 -38
  236. package/dist/scripts/codex-eval-process-tree.js +0 -803
  237. package/dist/scripts/codex-eval-process-tree.js.map +0 -1
  238. package/dist/scripts/codex-eval-runtime-config.d.ts +0 -62
  239. package/dist/scripts/codex-eval-runtime-config.js +0 -843
  240. package/dist/scripts/codex-eval-runtime-config.js.map +0 -1
  241. package/dist/scripts/codex-trigger-eval.d.ts +0 -84
  242. package/dist/scripts/codex-trigger-eval.js +0 -968
  243. package/dist/scripts/codex-trigger-eval.js.map +0 -1
  244. package/dist/scripts/eval-plugin-skills-audited.d.ts +0 -6
  245. package/dist/scripts/eval-plugin-skills-audited.js +0 -261
  246. package/dist/scripts/eval-plugin-skills-audited.js.map +0 -1
  247. package/dist/scripts/eval-plugin-skills.d.ts +0 -45
  248. package/dist/scripts/eval-plugin-skills.js +0 -1589
  249. package/dist/scripts/eval-plugin-skills.js.map +0 -1
  250. package/dist/scripts/eval-run-layout.d.ts +0 -17
  251. package/dist/scripts/eval-run-layout.js +0 -26
  252. package/dist/scripts/eval-run-layout.js.map +0 -1
  253. package/dist/scripts/plugin-eval-contract.d.ts +0 -189
  254. package/dist/scripts/plugin-eval-contract.js +0 -745
  255. package/dist/scripts/plugin-eval-contract.js.map +0 -1
  256. package/dist/scripts/plugin-eval-materializer.d.ts +0 -13
  257. package/dist/scripts/plugin-eval-materializer.js.map +0 -1
  258. package/dist/scripts/skill-reporting.d.ts +0 -212
  259. package/dist/scripts/skill-reporting.js +0 -922
  260. package/dist/scripts/skill-reporting.js.map +0 -1
  261. package/dist/src/commands/catalog-context.d.ts +0 -52
  262. package/dist/src/commands/catalog-context.js +0 -156
  263. package/dist/src/commands/catalog-context.js.map +0 -1
  264. package/dist/src/commands/status-v5.js.map +0 -1
  265. package/dist/src/utils/catalog-manifest-v5.d.ts +0 -5
  266. package/dist/src/utils/catalog-manifest-v5.js.map +0 -1
  267. package/dist/src/utils/catalog-source-cache.d.ts +0 -62
  268. package/dist/src/utils/catalog-source-cache.js +0 -321
  269. package/dist/src/utils/catalog-source-cache.js.map +0 -1
  270. package/dist/src/utils/codex-project-surface.d.ts +0 -3
  271. package/dist/src/utils/codex-project-surface.js +0 -49
  272. package/dist/src/utils/codex-project-surface.js.map +0 -1
  273. package/dist/src/utils/plugin-release.d.ts +0 -2
  274. package/dist/src/utils/plugin-release.js +0 -2
  275. package/dist/src/utils/plugin-release.js.map +0 -1
package/dist/src/index.js CHANGED
@@ -4,15 +4,17 @@ import path from 'node:path';
4
4
  import { spawn } from 'node:child_process';
5
5
  import { fileURLToPath } from 'node:url';
6
6
  import { Command, CommanderError, Option } from 'commander';
7
- import { resolveCatalogWorkspaceRoot } from '@lesliechan721/aw-plugin-core';
7
+ import { doctorEvalProviders } from '@lesliechan721/agent-skill-eval';
8
8
  import { initCommand } from './commands/init.js';
9
+ import { resolveCatalogWorkspaceRoot } from './commands/catalog-workspace-resolution.js';
9
10
  import { addCatalogSourceCommand, explicitRefPolicy, listCatalogSources, removeCatalogSourceCommand, setPrimaryCatalogSourceCommand, updateCatalogSourceCommand, } from './commands/catalog-source.js';
10
- import { activateCatalogSourceCandidateCommand, catalogGenerationStatusCommand, refreshCatalogSourceGenerationCommand, setCatalogSourceRefreshPolicyCommand, } from './commands/catalog-generation.js';
11
+ import { catalogSourceStatusCommand, syncCatalogSourceCommand, } from './commands/catalog-generation.js';
11
12
  import { cleanupWriteCommand as cleanupCommand, installWriteCommand as installCommand, reinstallWriteCommand as reinstallCommand, uninstallWriteCommand as uninstallCommand, upgradeWriteCommand as upgradeCommand, } from './commands/write-commands.js';
13
+ import { syncCommand } from './commands/sync-command.js';
12
14
  import { formatInteractiveConsoleUnavailableMessage, runConsoleController, } from './commands/console.js';
13
15
  import { runCommandWizard, toWizardCandidates, WizardExecutionError, } from './commands/wizard.js';
14
16
  import { createCliExecutionContext, emitCommandEvent, } from './commands/runtime.js';
15
- import { loadConsoleItemsResult, statusCommandV5 } from './commands/status-v5.js';
17
+ import { loadConsoleItemsResult, statusCommandV6 } from './commands/status-v6.js';
16
18
  import { normalizeUninstallCommandOptions, normalizeCleanupCommandOptions, resolveConfigReadResolution, resolveConfigProjectLayer, resolveConfigWriteScope, normalizeInstallCommandOptions, normalizeReinstallCommandOptions, normalizeUpgradeCommandOptions, } from './commands/options.js';
17
19
  import { isCommandWarningError, } from './types.js';
18
20
  import { formatWarnings } from './output/reporter.js';
@@ -28,7 +30,7 @@ import { assertCatalogSourceReferencesSupported, inventoryLegacyConfigReferences
28
30
  import { parsePluginId, withResolvedCatalogPlugin, withResolvedMultiSourceCatalog, } from './utils/multi-source-catalog.js';
29
31
  import { sanitizeCatalogSourceError } from './utils/catalog-public-error.js';
30
32
  import { catalogGenerationErrorCode } from './utils/catalog-generation-error.js';
31
- import { bootstrapCatalogOperationSources, resolveCatalogOperationContext, } from './utils/catalog-operation-context.js';
33
+ import { resolveCatalogOperationContext, } from './utils/catalog-operation-context.js';
32
34
  import { formatConfigCommandValue, parseConfigValue, } from './utils/config-value.js';
33
35
  import { withAwHomeMutationLock, } from './utils/aw-home-mutation-lock.js';
34
36
  import { installPortableSkills, materializePortableSkillsToDirectory, PortableCommandError, renderPortableReview, } from './portable/commands.js';
@@ -36,12 +38,12 @@ import { SkillsCliError } from './portable/skills-cli.js';
36
38
  import { computeReviewComponentDigest, listReviewRecords, parseReviewAttachment, publishReviewRecord, showReviewRecord, verifyReviewRecord, } from './commands/review-publication.js';
37
39
  import { resolveRepoRoot } from './utils/state-paths.js';
38
40
  import { runCatalogBuildCommand, runCatalogInitCommand, runCatalogValidateCommand, runCatalogVersionCommand, runPluginBuildCommand, runPluginTestCommand, } from './authoring/workspace-commands.js';
39
- import { runCatalogPublishCommand } from './commands/catalog-publish.js';
41
+ import { runCatalogPublishApplyCommand, runCatalogPublishPlanCommand, } from './commands/catalog-publish.js';
40
42
  import { getCatalogStatus, renderCatalogStatus } from './commands/catalog-status.js';
41
- import { getCatalogContext } from './commands/catalog-context.js';
42
43
  import { activateCatalogDevSource, catalogDevSourceError, createCatalogDevFailureReceipt, deactivateCatalogDevSource, getCatalogDevSourceStatus, } from './commands/catalog-dev-source.js';
43
44
  import { getPluginCapabilitiesResult, parsePluginCapabilitySurface, renderPluginCapabilities, } from './commands/plugin-capabilities.js';
44
- import { AwCapabilityUnsupportedError, checkCurrentAw, describeCurrentAw, inspectPluginRequirements, IMPLEMENTED_AW_CAPABILITIES, } from './commands/aw-capabilities.js';
45
+ import { AwCapabilityUnsupportedError, checkCurrentAw, describeCurrentAw, inspectPluginRequirements, } from './commands/aw-capabilities.js';
46
+ import { prepareSkillEval } from './commands/skill-eval.js';
45
47
  function createDefaultIo() {
46
48
  return {
47
49
  stdout: (text) => process.stdout.write(text),
@@ -67,6 +69,148 @@ function resolveCommandReceiptExitCode(result) {
67
69
  }
68
70
  return 0;
69
71
  }
72
+ class WriteCommandRequestError extends Error {
73
+ code = 'invalidArguments';
74
+ }
75
+ function normalizeWriteRequest(normalize) {
76
+ try {
77
+ return normalize();
78
+ }
79
+ catch (error) {
80
+ throw new WriteCommandRequestError(error instanceof Error ? error.message : String(error));
81
+ }
82
+ }
83
+ function writeCommandFailure(error) {
84
+ const message = redactString(error instanceof Error ? error.message : String(error));
85
+ if (error instanceof CommanderError || error instanceof WriteCommandRequestError) {
86
+ return { code: 'invalidArguments', message };
87
+ }
88
+ const explicitCode = error?.code;
89
+ if (typeof explicitCode === 'string' && /^[A-Za-z][A-Za-z0-9]*$/u.test(explicitCode)) {
90
+ return { code: explicitCode, message };
91
+ }
92
+ const separator = message.indexOf(':');
93
+ const prefix = separator > 0 ? message.slice(0, separator) : '';
94
+ return {
95
+ code: /^[A-Za-z][A-Za-z0-9]*$/u.test(prefix) ? prefix : 'writeCommandFailed',
96
+ message,
97
+ };
98
+ }
99
+ function preparseWriteReceiptRequest(argv) {
100
+ const request = { json: false, plugins: [] };
101
+ let positionalOnly = false;
102
+ for (let index = 1; index < argv.length; index += 1) {
103
+ const token = argv[index];
104
+ if (positionalOnly) {
105
+ request.plugins.push(token);
106
+ continue;
107
+ }
108
+ if (token === '--') {
109
+ positionalOnly = true;
110
+ continue;
111
+ }
112
+ if (token === '--json') {
113
+ request.json = true;
114
+ continue;
115
+ }
116
+ if (token === '--platform' || token === '--scope') {
117
+ const value = argv[index + 1];
118
+ if (token === '--platform')
119
+ request.platform = value;
120
+ else
121
+ request.scope = value;
122
+ index += 1;
123
+ continue;
124
+ }
125
+ if (token.startsWith('--platform=')) {
126
+ request.platform = token.slice('--platform='.length);
127
+ continue;
128
+ }
129
+ if (token.startsWith('--scope=')) {
130
+ request.scope = token.slice('--scope='.length);
131
+ continue;
132
+ }
133
+ if (token === '--dependency-scope' || token === '--script-timeout' || token === '--log-file') {
134
+ index += 1;
135
+ continue;
136
+ }
137
+ if (token.startsWith('--'))
138
+ continue;
139
+ if (token.startsWith('-') && token !== '-') {
140
+ const shortOptions = token.slice(1);
141
+ for (let offset = 0; offset < shortOptions.length; offset += 1) {
142
+ const option = shortOptions[offset];
143
+ if (option === 'j') {
144
+ request.json = true;
145
+ continue;
146
+ }
147
+ if (option === 'p' || option === 's') {
148
+ const value = shortOptions.slice(offset + 1) || argv[index + 1];
149
+ if (option === 'p')
150
+ request.platform = value;
151
+ else
152
+ request.scope = value;
153
+ if (shortOptions.length === offset + 1)
154
+ index += 1;
155
+ break;
156
+ }
157
+ }
158
+ continue;
159
+ }
160
+ request.plugins.push(token);
161
+ }
162
+ return request;
163
+ }
164
+ function jsonWriteCommandRequest(argv) {
165
+ const command = argv[0];
166
+ if (!['install', 'upgrade', 'reinstall', 'uninstall', 'cleanup', 'sync'].includes(command ?? '')) {
167
+ return null;
168
+ }
169
+ const request = preparseWriteReceiptRequest(argv);
170
+ if (!request.json)
171
+ return null;
172
+ const rawPlatform = request.platform;
173
+ const platform = rawPlatform === 'codex' || rawPlatform === 'claude' || rawPlatform === 'both'
174
+ ? rawPlatform
175
+ : 'codex';
176
+ return {
177
+ command: command,
178
+ plugins: request.plugins,
179
+ platform,
180
+ scope: request.scope === 'project' ? 'project' : 'user',
181
+ };
182
+ }
183
+ function writeCommandFailureReceipt(write, request, error) {
184
+ const platforms = request.platform === 'both'
185
+ ? ['codex', 'claude']
186
+ : [request.platform];
187
+ writeJsonReceipt(write, buildRebuildReceiptJson(request.command, {
188
+ platforms,
189
+ plugins: request.plugins,
190
+ warnings: [],
191
+ overallState: 'failed',
192
+ errors: [writeCommandFailure(error)],
193
+ receiptTargets: request.plugins.flatMap((selector) => platforms.map((platform) => {
194
+ let pluginName = selector;
195
+ let sourceId;
196
+ try {
197
+ const parsed = parsePluginId(selector);
198
+ pluginName = parsed.pluginName;
199
+ sourceId = parsed.sourceId;
200
+ }
201
+ catch {
202
+ // Keep the raw selector in the failed receipt.
203
+ }
204
+ return {
205
+ pluginName,
206
+ pluginId: selector,
207
+ ...(sourceId ? { sourceId } : {}),
208
+ platform,
209
+ scope: request.scope,
210
+ };
211
+ })),
212
+ }));
213
+ }
70
214
  async function runAuthoringScript(options) {
71
215
  const scriptPath = path.join(resolveCliPackageRoot(), 'dist', 'authoring', 'scripts', options.scriptName);
72
216
  return new Promise((resolve, reject) => {
@@ -150,6 +294,9 @@ export function buildEquivalentWriteCommandTokens(command, selection, rawOptions
150
294
  ...(rawOptions.allowManagedCodexInstall === true
151
295
  ? ['--allow-managed-codex-install']
152
296
  : []),
297
+ ...(command === 'install'
298
+ ? (rawOptions.dependencyScope ?? []).flatMap((value) => ['--dependency-scope', value])
299
+ : []),
153
300
  ...(command === 'cleanup' ? [] : optionTokens('--script-timeout', rawOptions.scriptTimeout)),
154
301
  ...(!all && selection.plugins.length > 0 ? ['--', ...selection.plugins] : []),
155
302
  ];
@@ -309,7 +456,6 @@ async function resolveStoredOnlyConfigIdentity(options) {
309
456
  const sourceIdentity = [...identities][0];
310
457
  await withResolvedMultiSourceCatalog({
311
458
  cliVersion: resolveCliVersion(),
312
- freshnessPolicy: 'cacheFirst',
313
459
  sourceIds: [parsed.sourceId],
314
460
  env: options.context.env,
315
461
  consume: async (catalog) => {
@@ -338,7 +484,6 @@ async function resolveMultiSourceConfigRead(options) {
338
484
  return withResolvedCatalogPlugin({
339
485
  selector: options.selector,
340
486
  cliVersion: resolveCliVersion(),
341
- freshnessPolicy: 'cacheFirst',
342
487
  env: options.context.env,
343
488
  consume: async ({ pluginId, source, plugin }) => {
344
489
  const result = await resolveConfigRead({
@@ -411,9 +556,9 @@ export function createManagedCodexAuthorizer(rawOptions, context) {
411
556
  return !response.cancelled && response.value === true;
412
557
  };
413
558
  }
414
- async function executeWriteCommand(command, pluginNames, rawOptions, context) {
559
+ async function executeWriteCommand(command, pluginNames, rawOptions, context, directCli = false) {
415
560
  const raw = { cwd: context.cwd, ...rawOptions };
416
- const commandOptions = command === 'install'
561
+ const commandOptions = normalizeWriteRequest(() => command === 'install'
417
562
  ? normalizeInstallCommandOptions(raw)
418
563
  : command === 'upgrade'
419
564
  ? normalizeUpgradeCommandOptions(raw)
@@ -421,7 +566,7 @@ async function executeWriteCommand(command, pluginNames, rawOptions, context) {
421
566
  ? normalizeUninstallCommandOptions(raw)
422
567
  : command === 'cleanup'
423
568
  ? normalizeCleanupCommandOptions(raw)
424
- : normalizeReinstallCommandOptions(raw);
569
+ : normalizeReinstallCommandOptions(raw));
425
570
  await emitCommandEvent(context, {
426
571
  type: 'options:normalized',
427
572
  data: { plugins: pluginNames, options: commandOptions },
@@ -429,6 +574,7 @@ async function executeWriteCommand(command, pluginNames, rawOptions, context) {
429
574
  const managedCodexAuthorizer = createManagedCodexAuthorizer(rawOptions, context);
430
575
  const runtime = {
431
576
  ...context,
577
+ directCli,
432
578
  ...(managedCodexAuthorizer ? { managedCodexAuthorizer } : {}),
433
579
  };
434
580
  switch (command) {
@@ -441,10 +587,11 @@ async function executeWriteCommand(command, pluginNames, rawOptions, context) {
441
587
  }
442
588
  async function runWriteCommandAction(command, pluginNames, rawOptions, context) {
443
589
  if ((command === 'cleanup' || command === 'reinstall') && pluginNames.length > 1) {
444
- throw new Error(`${command} 命令当前只支持单个插件目标。`);
590
+ throw new WriteCommandRequestError(`${command} 命令当前只支持单个插件目标。`);
591
+ }
592
+ if (command === 'upgrade') {
593
+ normalizeWriteRequest(() => assertUpgradeAllConflict(pluginNames, rawOptions.all === true));
445
594
  }
446
- if (command === 'upgrade')
447
- assertUpgradeAllConflict(pluginNames, rawOptions.all === true);
448
595
  const missingPlugin = pluginNames.length === 0 && !(command === 'upgrade' && rawOptions.all === true);
449
596
  const missingPlatform = rawOptions.platform === undefined;
450
597
  const missingScope = command === 'cleanup' && rawOptions.scope === undefined;
@@ -460,11 +607,11 @@ async function runWriteCommandAction(command, pluginNames, rawOptions, context)
460
607
  if (!missing) {
461
608
  return {
462
609
  cancelled: false,
463
- result: await executeWriteCommand(command, pluginNames, rawOptions, context),
610
+ result: await executeWriteCommand(command, pluginNames, rawOptions, context, true),
464
611
  };
465
612
  }
466
613
  if (!isWizardAvailable(context, rawOptions)) {
467
- throw new Error(writeCommandUsage(command));
614
+ throw new WriteCommandRequestError(writeCommandUsage(command));
468
615
  }
469
616
  const loaded = await loadConsoleItemsResult({
470
617
  cwd: context.cwd,
@@ -785,6 +932,93 @@ export function buildProgram(options = {}) {
785
932
  const skill = program
786
933
  .command('skill')
787
934
  .description('Install, materialize, or validate Agent Skills');
935
+ const skillEval = skill
936
+ .command('eval')
937
+ .description('Prepare or diagnose deterministic Agent Skill Eval inputs');
938
+ skillEval
939
+ .command('doctor')
940
+ .description('Inspect Agent Skill Eval provider readiness without model execution')
941
+ .requiredOption('--json', 'emit one provider doctor JSON object')
942
+ .action(async () => {
943
+ try {
944
+ writeJsonReceipt(io.stdout, await doctorEvalProviders({ sourceEnv: env }));
945
+ }
946
+ catch (error) {
947
+ writeJsonReceipt(io.stdout, {
948
+ ok: false,
949
+ error: redactString(error instanceof Error ? error.message : String(error)),
950
+ });
951
+ commandExitState.exitCode = 1;
952
+ }
953
+ });
954
+ skillEval
955
+ .command('prepare')
956
+ .description('Prepare one complete Agent Skill Eval input directory')
957
+ .argument('<plugin>', 'canonical Workspace plugin name')
958
+ .argument('<skill>', 'owner Skill name')
959
+ .option('--suite <suite>', 'Eval suite ID')
960
+ .option('--profile <profile>', 'Eval profile ID')
961
+ .option('--workspace-root <root>', 'Catalog Workspace root')
962
+ .option('--split <split>', 'case split filter')
963
+ .option('--case <id>', 'case ID filter')
964
+ .option('--runs <count>', 'runs per selected case')
965
+ .option('--timeout-ms <milliseconds>', 'timeout for each provider attempt')
966
+ .option('--baseline <mode>', 'append without-skill comparison')
967
+ .option('--previous-version <runtime-skill-root>', 'append a previous-version comparison')
968
+ .option('--keep-workspace', 'retain the preparation materialization workspace', false)
969
+ .requiredOption('--output <spec-directory>', 'new EvalSpec directory')
970
+ .requiredOption('--json', 'emit one preparation receipt JSON object')
971
+ .action(async (pluginName, skillName, rawOptions) => {
972
+ try {
973
+ const workspace = await resolveCatalogWorkspaceRoot({
974
+ cwd,
975
+ ...(rawOptions.workspaceRoot === undefined ? {} : { explicitRoot: rawOptions.workspaceRoot }),
976
+ mode: 'existing',
977
+ env,
978
+ });
979
+ const runs = rawOptions.runs === undefined
980
+ ? undefined
981
+ : (/^[1-9][0-9]*$/u.test(rawOptions.runs) ? Number(rawOptions.runs) : Number.NaN);
982
+ const timeoutMs = rawOptions.timeoutMs === undefined
983
+ ? undefined
984
+ : (/^[1-9][0-9]*$/u.test(rawOptions.timeoutMs) ? Number(rawOptions.timeoutMs) : Number.NaN);
985
+ const receipt = await prepareSkillEval({
986
+ workspaceRoot: workspace.workspaceRoot,
987
+ workspaceRootResolvedFrom: workspace.workspaceRootResolvedFrom,
988
+ pluginName,
989
+ skillName,
990
+ ...(rawOptions.suite === undefined ? {} : { suiteId: rawOptions.suite }),
991
+ ...(rawOptions.profile === undefined ? {} : { profileId: rawOptions.profile }),
992
+ output: rawOptions.output,
993
+ cwd,
994
+ env,
995
+ ...(rawOptions.split === undefined ? {} : { split: rawOptions.split }),
996
+ ...(rawOptions.case === undefined ? {} : { caseId: rawOptions.case }),
997
+ ...(runs === undefined ? {} : { runs }),
998
+ ...(timeoutMs === undefined ? {} : { timeoutMs }),
999
+ ...(rawOptions.baseline === undefined ? {} : {
1000
+ baseline: rawOptions.baseline,
1001
+ }),
1002
+ ...(rawOptions.previousVersion === undefined ? {} : {
1003
+ previousVersion: rawOptions.previousVersion,
1004
+ }),
1005
+ ...(rawOptions.keepWorkspace === true ? { keepWorkspace: true } : {}),
1006
+ });
1007
+ writeJsonReceipt(io.stdout, receipt);
1008
+ }
1009
+ catch (error) {
1010
+ writeJsonReceipt(io.stdout, {
1011
+ schemaVersion: 1,
1012
+ command: 'skill:eval:prepare',
1013
+ ok: false,
1014
+ errors: [{
1015
+ code: 'evalPreparationFailed',
1016
+ message: redactString(error instanceof Error ? error.message : String(error)),
1017
+ }],
1018
+ });
1019
+ commandExitState.exitCode = 1;
1020
+ }
1021
+ });
788
1022
  const review = program
789
1023
  .command('review')
790
1024
  .description('Publish and inspect immutable review records');
@@ -945,7 +1179,7 @@ export function buildProgram(options = {}) {
945
1179
  .option('--skill <name...>', 'install only selected Skill names')
946
1180
  .option('--agent <id...>', 'install to explicit Agent IDs')
947
1181
  .option('-y, --yes', 'confirm the reviewed install', false)
948
- .option('-j, --json', 'emit one receipt v4 JSON object', false)
1182
+ .option('-j, --json', 'emit one receipt v5 JSON object', false)
949
1183
  .action(async (selector, rawOptions) => {
950
1184
  const context = createActionContext('skill:install', {});
951
1185
  const writeFailure = (error) => {
@@ -955,7 +1189,7 @@ export function buildProgram(options = {}) {
955
1189
  ? error.code
956
1190
  : 'portableInstallFailed');
957
1191
  writeJsonReceipt(io.stdout, {
958
- receiptSchemaVersion: 4,
1192
+ receiptSchemaVersion: 5,
959
1193
  command: 'skill:install',
960
1194
  ok: false,
961
1195
  status: 'failed',
@@ -1049,7 +1283,7 @@ export function buildProgram(options = {}) {
1049
1283
  .requiredOption('-s, --scope <scope>', 'project or user')
1050
1284
  .requiredOption('--out <dir>', 'output directory')
1051
1285
  .option('--skill <name...>', 'write only selected Skill names')
1052
- .option('-j, --json', 'emit one receipt v4 JSON object', false)
1286
+ .option('-j, --json', 'emit one receipt v5 JSON object', false)
1053
1287
  .action(async (selector, rawOptions) => {
1054
1288
  const context = createActionContext('skill:materialize', {});
1055
1289
  try {
@@ -1076,7 +1310,7 @@ export function buildProgram(options = {}) {
1076
1310
  ? error.code
1077
1311
  : 'portableMaterializeFailed');
1078
1312
  writeJsonReceipt(io.stdout, {
1079
- receiptSchemaVersion: 4,
1313
+ receiptSchemaVersion: 5,
1080
1314
  command: 'skill:materialize',
1081
1315
  ok: false,
1082
1316
  plugin: { id: selector },
@@ -1108,7 +1342,7 @@ export function buildProgram(options = {}) {
1108
1342
  '',
1109
1343
  'During development, keep the current stable target when production content changes.',
1110
1344
  'Next, run `aw plugin validate`, `aw plugin test`, `aw plugin build`, and `aw catalog build`.',
1111
- 'Publish only as an explicit later step; inspect `aw catalog publish --help` first.',
1345
+ 'Publish only as an explicit later step; inspect `aw catalog publish plan --help` first.',
1112
1346
  '',
1113
1347
  ].join('\n'))
1114
1348
  .argument('<plugin-name>', 'lowercase hyphen-case plugin name')
@@ -1133,7 +1367,7 @@ export function buildProgram(options = {}) {
1133
1367
  '',
1134
1368
  'During development, keep the current stable target when production content changes.',
1135
1369
  'Next, run `aw plugin validate`, `aw plugin test`, `aw plugin build`, and `aw catalog build`.',
1136
- 'Publish only as an explicit later step; inspect `aw catalog publish --help` first.',
1370
+ 'Publish only as an explicit later step; inspect `aw catalog publish plan --help` first.',
1137
1371
  '',
1138
1372
  ].join('\n'))
1139
1373
  .argument('<plugin-name>', 'existing lowercase hyphen-case plugin name')
@@ -1252,6 +1486,7 @@ export function buildProgram(options = {}) {
1252
1486
  cwd,
1253
1487
  ...(rawOptions.workspaceRoot === undefined ? {} : { explicitRoot: rawOptions.workspaceRoot }),
1254
1488
  mode: 'initialize',
1489
+ env,
1255
1490
  });
1256
1491
  await runCatalogInitCommand({
1257
1492
  ...rawOptions,
@@ -1267,27 +1502,6 @@ export function buildProgram(options = {}) {
1267
1502
  commandExitState.exitCode = 1;
1268
1503
  }
1269
1504
  });
1270
- catalog
1271
- .command('context')
1272
- .description('Inspect resolved Catalog Workspace and publication context without network access')
1273
- .option('--workspace-root <path>', 'explicit Catalog Workspace root')
1274
- .option('--remote <name>', 'Git remote (default: origin, otherwise sole remote; explicit if ambiguous)')
1275
- .option('--branch <name>', 'explicit Catalog publication branch')
1276
- .requiredOption('--json', 'emit one schema 1 JSON object')
1277
- .action(async (rawOptions) => {
1278
- const receipt = await getCatalogContext({
1279
- cwd,
1280
- workspaceRoot: rawOptions.workspaceRoot,
1281
- remote: rawOptions.remote,
1282
- branch: rawOptions.branch,
1283
- env,
1284
- awVersion: resolveCliVersion(),
1285
- capabilities: IMPLEMENTED_AW_CAPABILITIES,
1286
- });
1287
- writeJsonReceipt(io.stdout, receipt);
1288
- if (receipt.issues.some((issue) => issue.blocking))
1289
- commandExitState.exitCode = 1;
1290
- });
1291
1505
  catalog
1292
1506
  .command('version')
1293
1507
  .description('Read or set the Catalog version')
@@ -1350,7 +1564,7 @@ export function buildProgram(options = {}) {
1350
1564
  });
1351
1565
  catalog
1352
1566
  .command('validate')
1353
- .description('Validate a schema 5 Catalog snapshot')
1567
+ .description('Validate a schema 6 Catalog snapshot')
1354
1568
  .argument('<snapshot-directory>', 'Catalog snapshot directory')
1355
1569
  .option('--json', 'emit one machine-readable JSON result', false)
1356
1570
  .action(async (snapshotDirectory, rawOptions) => {
@@ -1371,19 +1585,13 @@ export function buildProgram(options = {}) {
1371
1585
  });
1372
1586
  catalog
1373
1587
  .command('status')
1374
- .description('Inspect a Catalog Workspace; --preflight executes plugin validation and build code')
1588
+ .description('Inspect static Catalog Workspace, snapshot, and Git facts')
1375
1589
  .option('--workspace-root <path>', 'Catalog Workspace root (default: nearest ancestor from current directory)')
1376
- .option('--remote <name>', 'Git remote for preflight (default: origin, otherwise sole remote; explicit if ambiguous)')
1377
- .option('--branch <name>', 'dedicated Catalog branch for preflight (default: catalog)')
1378
- .option('--preflight', 'run publication validation and temporary plugin builds (executes plugin code)', false)
1379
1590
  .option('--json', 'emit one machine-readable JSON status object', false)
1380
1591
  .action(async (rawOptions) => {
1381
1592
  const receipt = await getCatalogStatus({
1382
1593
  cwd,
1383
1594
  workspaceRoot: rawOptions.workspaceRoot,
1384
- remote: rawOptions.remote,
1385
- branch: rawOptions.branch,
1386
- preflight: rawOptions.preflight,
1387
1595
  env,
1388
1596
  });
1389
1597
  if (rawOptions.json)
@@ -1392,24 +1600,70 @@ export function buildProgram(options = {}) {
1392
1600
  io.stdout(renderCatalogStatus(receipt));
1393
1601
  commandExitState.exitCode = receipt.ok ? 0 : 1;
1394
1602
  });
1395
- catalog
1603
+ const catalogPublish = catalog
1396
1604
  .command('publish')
1397
- .description('Publish a versioned Catalog snapshot to a configured Git remote')
1605
+ .description('Plan or apply a versioned Catalog publication');
1606
+ catalogPublish
1607
+ .command('plan')
1608
+ .description('Prepare and inspect the exact Catalog publication plan')
1609
+ .option('--workspace-root <path>', 'Catalog Workspace root (default: nearest ancestor from current directory)')
1610
+ .option('--remote <name>', 'Git remote (default: origin, otherwise sole remote; explicit if ambiguous)')
1611
+ .option('--branch <name>', 'dedicated Catalog branch (default: catalog)')
1612
+ .option('--json', 'emit one machine-readable JSON result', false)
1613
+ .action(async (rawOptions) => {
1614
+ try {
1615
+ const result = await runCatalogPublishPlanCommand({
1616
+ cwd,
1617
+ workspaceRoot: rawOptions.workspaceRoot,
1618
+ remote: rawOptions.remote,
1619
+ branch: rawOptions.branch,
1620
+ env,
1621
+ io,
1622
+ });
1623
+ if (rawOptions.json)
1624
+ writeJsonReceipt(io.stdout, result);
1625
+ else {
1626
+ writeLine(io.stdout, `Workspace identity: ${result.workspaceIdentity}`);
1627
+ writeLine(io.stdout, `Source HEAD: ${result.sourceHead}`);
1628
+ writeLine(io.stdout, `Remote identity: ${result.descriptor.remote.identityDigest}`);
1629
+ writeLine(io.stdout, `Remote: ${result.remote} (${result.remoteUrl})`);
1630
+ writeLine(io.stdout, `Branch: refs/heads/${result.branch}`);
1631
+ writeLine(io.stdout, `Parent: ${result.parent ?? '<root>'}`);
1632
+ writeLine(io.stdout, `Tag: refs/tags/${result.tag}`);
1633
+ writeLine(io.stdout, `Snapshot digest: ${result.snapshotDigest}`);
1634
+ writeLine(io.stdout, `Plan digest: ${result.planDigest}`);
1635
+ }
1636
+ }
1637
+ catch (error) {
1638
+ const message = error instanceof Error ? error.message : String(error);
1639
+ if (rawOptions.json)
1640
+ writeJsonReceipt(io.stdout, {
1641
+ command: 'catalog:publish:plan',
1642
+ ok: false,
1643
+ errors: [{ message }],
1644
+ });
1645
+ writeLine(io.stderr, message);
1646
+ commandExitState.exitCode = 1;
1647
+ }
1648
+ });
1649
+ catalogPublish
1650
+ .command('apply')
1651
+ .description('Apply an authorized Catalog publication plan')
1398
1652
  .option('--workspace-root <path>', 'Catalog Workspace root (default: nearest ancestor from current directory)')
1399
1653
  .option('--remote <name>', 'Git remote (default: origin, otherwise sole remote; explicit if ambiguous)')
1400
1654
  .option('--branch <name>', 'dedicated Catalog branch (default: catalog)')
1401
- .option('--expected-descriptor-digest <digest>', 'required exact descriptor returned by publication preflight')
1655
+ .requiredOption('--expected-plan-digest <sha256>', 'exact plan digest returned by catalog publish plan')
1402
1656
  .option('-y, --yes', 'confirm publication without a prompt', false)
1403
1657
  .option('--json', 'emit one machine-readable JSON result', false)
1404
1658
  .action(async (rawOptions) => {
1405
1659
  try {
1406
- const context = createActionContext('catalog:publish', {});
1407
- const result = await runCatalogPublishCommand({
1660
+ const context = createActionContext('catalog:publish:apply', {});
1661
+ const result = await runCatalogPublishApplyCommand({
1408
1662
  cwd,
1409
1663
  workspaceRoot: rawOptions.workspaceRoot,
1410
1664
  remote: rawOptions.remote,
1411
1665
  branch: rawOptions.branch,
1412
- expectedDescriptorDigest: rawOptions.expectedDescriptorDigest,
1666
+ expectedPlanDigest: rawOptions.expectedPlanDigest,
1413
1667
  yes: rawOptions.yes,
1414
1668
  json: rawOptions.json,
1415
1669
  env,
@@ -1438,7 +1692,7 @@ export function buildProgram(options = {}) {
1438
1692
  const message = error instanceof Error ? error.message : String(error);
1439
1693
  if (rawOptions.json)
1440
1694
  writeJsonReceipt(io.stdout, {
1441
- command: 'catalog:publish',
1695
+ command: 'catalog:publish:apply',
1442
1696
  ok: false,
1443
1697
  errors: [{ message }],
1444
1698
  });
@@ -1455,7 +1709,7 @@ export function buildProgram(options = {}) {
1455
1709
  .option('--source-id <id>', 'explicit managed source ID')
1456
1710
  .option('--primary', 'make the development source primary', false)
1457
1711
  .option('--force-build', 'rebuild a current snapshot', false)
1458
- .requiredOption('--json', 'emit one schema 1 JSON receipt')
1712
+ .requiredOption('--json', 'emit one schema 2 JSON receipt')
1459
1713
  .action(async (rawOptions) => {
1460
1714
  try {
1461
1715
  const receipt = await activateCatalogDevSource({
@@ -1482,7 +1736,7 @@ export function buildProgram(options = {}) {
1482
1736
  catalogDev
1483
1737
  .command('status')
1484
1738
  .option('--workspace-root <path>', 'explicit Catalog Workspace root')
1485
- .requiredOption('--json', 'emit one schema 1 JSON receipt')
1739
+ .requiredOption('--json', 'emit one schema 3 JSON receipt')
1486
1740
  .action(async (rawOptions) => {
1487
1741
  const receipt = await getCatalogDevSourceStatus({
1488
1742
  cwd,
@@ -1496,12 +1750,18 @@ export function buildProgram(options = {}) {
1496
1750
  catalogDev
1497
1751
  .command('deactivate')
1498
1752
  .option('--workspace-root <path>', 'explicit Catalog Workspace root')
1499
- .requiredOption('--json', 'emit one schema 1 JSON receipt')
1753
+ .option('--source-id <id>', 'recover one managed source by exact ID')
1754
+ .option('--replacement-primary <id>', 'replacement when the target source is primary')
1755
+ .option('-y, --yes', 'confirm recovery by source ID', false)
1756
+ .requiredOption('--json', 'emit one schema 2 JSON receipt')
1500
1757
  .action(async (rawOptions) => {
1501
1758
  try {
1502
1759
  const receipt = await deactivateCatalogDevSource({
1503
1760
  cwd,
1504
1761
  workspaceRoot: rawOptions.workspaceRoot,
1762
+ sourceId: rawOptions.sourceId,
1763
+ replacementPrimary: rawOptions.replacementPrimary,
1764
+ yes: rawOptions.yes,
1505
1765
  env,
1506
1766
  });
1507
1767
  writeJsonReceipt(io.stdout, receipt);
@@ -1510,7 +1770,8 @@ export function buildProgram(options = {}) {
1510
1770
  catch (error) {
1511
1771
  const failure = catalogDevSourceError(error);
1512
1772
  writeJsonReceipt(io.stdout, createCatalogDevFailureReceipt({
1513
- command: 'deactivate', cwd, workspaceRoot: rawOptions.workspaceRoot, ...failure,
1773
+ command: 'deactivate', cwd, workspaceRoot: rawOptions.workspaceRoot,
1774
+ sourceId: rawOptions.sourceId, ...failure,
1514
1775
  }));
1515
1776
  commandExitState.exitCode = 1;
1516
1777
  }
@@ -1523,7 +1784,7 @@ export function buildProgram(options = {}) {
1523
1784
  const message = failure instanceof Error ? failure.message : String(error);
1524
1785
  if (json) {
1525
1786
  writeJsonReceipt(io.stdout, {
1526
- receiptSchemaVersion: 4,
1787
+ receiptSchemaVersion: 5,
1527
1788
  command,
1528
1789
  ok: false,
1529
1790
  changed: false,
@@ -1540,7 +1801,9 @@ export function buildProgram(options = {}) {
1540
1801
  const message = redactString(failure.message);
1541
1802
  if (json) {
1542
1803
  writeJsonReceipt(io.stdout, {
1543
- catalogGenerationSchemaVersion: 1,
1804
+ ...(command === 'catalog:source:sync'
1805
+ ? { catalogGenerationSchemaVersion: 1 }
1806
+ : { catalogGenerationStatusSchemaVersion: 1 }),
1544
1807
  command,
1545
1808
  ok: false,
1546
1809
  ...(sourceId ? { sourceId } : {}),
@@ -1569,7 +1832,7 @@ export function buildProgram(options = {}) {
1569
1832
  : message.split(':', 1)[0] || 'configMutationFailed';
1570
1833
  if (json && !message.includes('Usage:')) {
1571
1834
  writeJsonReceipt(io.stdout, {
1572
- receiptSchemaVersion: 4,
1835
+ receiptSchemaVersion: 5,
1573
1836
  command,
1574
1837
  ok: false,
1575
1838
  overallState: 'failed',
@@ -1582,24 +1845,16 @@ export function buildProgram(options = {}) {
1582
1845
  };
1583
1846
  const withResolvedConfigMutationPlugin = (context, selector, consume) => (async () => {
1584
1847
  const parsed = parsePluginId(selector);
1585
- await bootstrapCatalogOperationSources({
1586
- cliVersion: resolveCliVersion(),
1587
- ...(parsed.sourceId ? { sourceIds: [parsed.sourceId] } : {}),
1588
- env: context.env,
1589
- });
1590
1848
  return withAwHomeMutationLock({
1591
1849
  env: context.env,
1592
1850
  action: async (awHomeMutationToken) => {
1593
1851
  const catalogOperationContext = await resolveCatalogOperationContext({
1594
- cliVersion: resolveCliVersion(),
1595
1852
  ...(parsed.sourceId ? { sourceIds: [parsed.sourceId] } : {}),
1596
1853
  env: context.env,
1597
- bootstrapMissingActive: false,
1598
1854
  });
1599
1855
  return withResolvedCatalogPlugin({
1600
1856
  selector,
1601
1857
  cliVersion: resolveCliVersion(),
1602
- freshnessPolicy: 'cacheFirst',
1603
1858
  operationContext: catalogOperationContext,
1604
1859
  env: context.env,
1605
1860
  consume: (resolution) => consume(resolution, awHomeMutationToken, catalogOperationContext),
@@ -1622,106 +1877,57 @@ export function buildProgram(options = {}) {
1622
1877
  }
1623
1878
  });
1624
1879
  catalogSource
1625
- .command('refresh')
1880
+ .command('sync')
1626
1881
  .argument('<id>')
1627
- .option('-j, --json', 'print the generation refresh result as JSON', false)
1882
+ .option('--check', 'fetch and validate without changing the Catalog store or Active state', false)
1883
+ .option('-j, --json', 'print the source sync result as JSON', false)
1628
1884
  .action(async (id, rawOptions) => {
1629
1885
  try {
1630
- const result = await refreshCatalogSourceGenerationCommand({
1886
+ const result = await syncCatalogSourceCommand({
1631
1887
  sourceId: id,
1632
1888
  cliVersion: resolveCliVersion(),
1889
+ check: rawOptions.check === true,
1633
1890
  env,
1634
1891
  });
1635
1892
  if (rawOptions.json) {
1636
1893
  writeJsonReceipt(io.stdout, {
1637
1894
  ...result,
1638
- command: 'catalog:source:refresh',
1639
- ok: true,
1640
- });
1641
- }
1642
- else {
1643
- writeLine(io.stdout, `Catalog source ${id}: ${result.outcome}.`);
1644
- }
1645
- }
1646
- catch (error) {
1647
- writeCatalogGenerationFailure('catalog:source:refresh', id, rawOptions.json === true, error);
1648
- }
1649
- });
1650
- catalogSource
1651
- .command('activate-candidate')
1652
- .argument('<id>')
1653
- .option('-j, --json', 'print the generation activation result as JSON', false)
1654
- .action(async (id, rawOptions) => {
1655
- try {
1656
- const result = await activateCatalogSourceCandidateCommand({ sourceId: id, env });
1657
- if (rawOptions.json) {
1658
- writeJsonReceipt(io.stdout, {
1659
- ...result,
1660
- command: 'catalog:source:activate-candidate',
1895
+ command: 'catalog:source:sync',
1661
1896
  ok: true,
1662
1897
  });
1663
1898
  }
1664
1899
  else {
1665
- writeLine(io.stdout, `Catalog source ${id} Candidate activated.`);
1900
+ writeLine(io.stdout, rawOptions.check
1901
+ ? `Catalog source ${id} is valid.`
1902
+ : `Catalog source ${id}: ${result.outcome}.`);
1666
1903
  }
1667
1904
  }
1668
1905
  catch (error) {
1669
- writeCatalogGenerationFailure('catalog:source:activate-candidate', id, rawOptions.json === true, error);
1906
+ writeCatalogGenerationFailure('catalog:source:sync', id, rawOptions.json === true, error);
1670
1907
  }
1671
1908
  });
1672
1909
  catalogSource
1673
- .command('generation-status')
1910
+ .command('status')
1674
1911
  .argument('[id]')
1675
- .option('-j, --json', 'print Catalog generation status as JSON', false)
1912
+ .option('-j, --json', 'print offline Catalog source status as JSON', false)
1676
1913
  .action(async (id, rawOptions) => {
1677
1914
  try {
1678
- const result = await catalogGenerationStatusCommand({ sourceId: id, env });
1915
+ const result = await catalogSourceStatusCommand({ sourceId: id, env });
1679
1916
  if (rawOptions.json) {
1680
1917
  writeJsonReceipt(io.stdout, result);
1681
1918
  }
1682
1919
  else {
1683
1920
  for (const source of result.sources) {
1684
- const active = source.active ? `Active ${source.active.catalogVersion}` : 'no Active';
1685
- const candidate = source.candidate
1686
- ? `, Candidate ${source.candidate.catalogVersion}`
1687
- : '';
1688
- writeLine(io.stdout, `${source.sourceId}: ${active}${candidate} (${source.refreshPolicy})`);
1921
+ const active = source.active
1922
+ ? `Active ${source.active.snapshotDigest}`
1923
+ : 'no Active';
1924
+ const readiness = source.activeReady ? 'ready' : 'not ready';
1925
+ writeLine(io.stdout, `${source.sourceId}: ${active}, ${readiness}`);
1689
1926
  }
1690
1927
  }
1691
1928
  }
1692
1929
  catch (error) {
1693
- writeCatalogGenerationFailure('catalog:source:generation-status', id, rawOptions.json === true, error);
1694
- }
1695
- });
1696
- catalogSource
1697
- .command('refresh-policy')
1698
- .argument('<id>')
1699
- .argument('<policy>', 'startup or manual')
1700
- .option('-j, --json', 'print Catalog refresh policy result as JSON', false)
1701
- .action(async (id, policy, rawOptions) => {
1702
- try {
1703
- if (policy !== 'startup' && policy !== 'manual') {
1704
- throw new Error('Catalog refresh policy must be startup or manual.');
1705
- }
1706
- const result = await setCatalogSourceRefreshPolicyCommand({
1707
- sourceId: id,
1708
- refreshPolicy: policy,
1709
- env,
1710
- });
1711
- if (rawOptions.json) {
1712
- writeJsonReceipt(io.stdout, {
1713
- catalogGenerationSchemaVersion: 1,
1714
- command: 'catalog:source:refresh-policy',
1715
- ok: true,
1716
- ...result,
1717
- });
1718
- }
1719
- else {
1720
- writeLine(io.stdout, `Catalog source ${id} refresh policy: ${result.refreshPolicy}.`);
1721
- }
1722
- }
1723
- catch (error) {
1724
- writeCatalogGenerationFailure('catalog:source:refresh-policy', id, rawOptions.json === true, error);
1930
+ writeCatalogGenerationFailure('catalog:source:status', id, rawOptions.json === true, error);
1725
1931
  }
1726
1932
  });
1727
1933
  catalogSource
@@ -1868,7 +2074,6 @@ export function buildProgram(options = {}) {
1868
2074
  });
1869
2075
  program
1870
2076
  .command('init')
1871
- .option('-f, --force', 're-fetch and rebuild the current catalog cache entry', false)
1872
2077
  .option('-j, --json', 'print receipt as JSON', false)
1873
2078
  .option('-v, --verbose', 'show command diagnostics', false)
1874
2079
  .option('-D, --debug', 'write debug diagnostics to a log file', false)
@@ -1876,8 +2081,6 @@ export function buildProgram(options = {}) {
1876
2081
  .action(async (rawOptions) => {
1877
2082
  const context = createActionContext('init', rawOptions);
1878
2083
  const result = await runActionWithContext(context, () => initCommand({
1879
- force: rawOptions.force,
1880
- cliVersion: resolveCliVersion(),
1881
2084
  env: context.env,
1882
2085
  }));
1883
2086
  if (rawOptions.json) {
@@ -1888,20 +2091,68 @@ export function buildProgram(options = {}) {
1888
2091
  writeLine(io.stdout, line);
1889
2092
  }
1890
2093
  }
1891
- writeWarnings(io.stderr, result.warnings, { actionableOnly: true });
1892
2094
  for (const source of result.sources) {
1893
2095
  if (!source.ok && source.error)
1894
2096
  writeLine(io.stderr, `${source.id}: ${source.error}`);
1895
2097
  }
1896
2098
  commandExitState.exitCode = result.ok ? 0 : 1;
1897
2099
  });
2100
+ program
2101
+ .command('sync')
2102
+ .description('Reconcile Codex actual state from existing desired intent')
2103
+ .argument('[plugins...]')
2104
+ .requiredOption('-s, --scope <scope>', 'project or user')
2105
+ .requiredOption('-p, --platform <platform>', 'codex')
2106
+ .option('-a, --all', 'reconcile every desired plugin in the selected scope', false)
2107
+ .option('-y, --yes', 'authorize shared native replacement or forced repair', false)
2108
+ .option('--allow-managed-codex-install', 'allow this command to acquire or rebuild the pinned AW-managed Codex runtime', false)
2109
+ .option('-j, --json', 'print sync receipt as JSON', false)
2110
+ .option('-v, --verbose', 'show command diagnostics', false)
2111
+ .option('-D, --debug', 'write debug diagnostics to a log file', false)
2112
+ .option('--log-file <path>', 'write debug diagnostics to the specified file')
2113
+ .action(async (plugins, rawOptions) => {
2114
+ const context = createActionContext('sync', rawOptions);
2115
+ const normalized = normalizeWriteRequest(() => normalizeInstallCommandOptions({
2116
+ cwd: context.cwd,
2117
+ scope: rawOptions.scope,
2118
+ platform: rawOptions.platform,
2119
+ allowManagedCodexInstall: rawOptions.allowManagedCodexInstall,
2120
+ }));
2121
+ if (normalized.platform !== 'codex') {
2122
+ throw new Error('syncPlatformUnsupported: sync requires --platform codex.');
2123
+ }
2124
+ const syncPlatform = normalized.platform;
2125
+ const result = await runActionWithContext(context, () => syncCommand(plugins ?? [], {
2126
+ cwd: context.cwd,
2127
+ env: context.env,
2128
+ platform: syncPlatform,
2129
+ scope: normalized.scope,
2130
+ all: rawOptions.all,
2131
+ yes: rawOptions.yes,
2132
+ json: rawOptions.json,
2133
+ interactive: context.interactive && context.isTty && !context.isCi,
2134
+ prompt: context.prompt,
2135
+ allowManagedCodexInstall: rawOptions.allowManagedCodexInstall,
2136
+ }, context));
2137
+ if (rawOptions.json) {
2138
+ writeJsonReceipt(io.stdout, buildRebuildReceiptJson('sync', result));
2139
+ }
2140
+ else {
2141
+ for (const line of renderRebuildReceipt('sync', result))
2142
+ writeLine(io.stdout, line);
2143
+ }
2144
+ writeWarnings(io.stderr, result.warnings, { actionableOnly: true });
2145
+ commandExitState.exitCode = resolveCommandReceiptExitCode(result);
2146
+ });
1898
2147
  program
1899
2148
  .command('install')
1900
2149
  .argument('[plugins...]')
1901
2150
  .option('-s, --scope <scope>', 'project or user')
1902
2151
  .option('-p, --platform <platform>', 'codex | claude | both')
2152
+ .option('--dependency-scope <pluginId[#platform]=scope>', 'place one dependency at project or user scope; repeat for more dependencies', (value, previous) => [...previous, value], [])
1903
2153
  .option('--script-timeout <ms>', 'override plugin lifecycle script timeout in milliseconds')
1904
2154
  .option('--allow-managed-codex-install', 'allow this command to acquire or rebuild the pinned AW-managed Codex runtime', false)
2155
+ .option('-y, --yes', 'authorize shared Codex native replacement', false)
1905
2156
  .option('-j, --json', 'print receipt as JSON', false)
1906
2157
  .option('-v, --verbose', 'show command diagnostics', false)
1907
2158
  .option('-D, --debug', 'write debug diagnostics to a log file', false)
@@ -1959,6 +2210,7 @@ export function buildProgram(options = {}) {
1959
2210
  .option('-p, --platform <platform>', 'codex | claude | both')
1960
2211
  .option('--script-timeout <ms>', 'override plugin lifecycle script timeout in milliseconds')
1961
2212
  .option('--allow-managed-codex-install', 'allow this command to acquire or rebuild the pinned AW-managed Codex runtime', false)
2213
+ .option('-y, --yes', 'authorize shared Codex native replacement', false)
1962
2214
  .option('-j, --json', 'print receipt as JSON', false)
1963
2215
  .option('-v, --verbose', 'show command diagnostics', false)
1964
2216
  .option('-D, --debug', 'write debug diagnostics to a log file', false)
@@ -2015,6 +2267,7 @@ export function buildProgram(options = {}) {
2015
2267
  .option('-p, --platform <platform>', 'codex | claude | both')
2016
2268
  .option('--script-timeout <ms>', 'override plugin lifecycle script timeout in milliseconds')
2017
2269
  .option('--allow-managed-codex-install', 'allow this command to acquire or rebuild the pinned AW-managed Codex runtime', false)
2270
+ .option('-y, --yes', 'authorize shared Codex native replacement or forced reinstall', false)
2018
2271
  .option('-j, --json', 'print receipt as JSON', false)
2019
2272
  .option('-v, --verbose', 'show command diagnostics', false)
2020
2273
  .option('-D, --debug', 'write debug diagnostics to a log file', false)
@@ -2233,7 +2486,7 @@ export function buildProgram(options = {}) {
2233
2486
  });
2234
2487
  return {
2235
2488
  ok: writeReceipt.overallState === 'succeeded',
2236
- receiptSchemaVersion: 4,
2489
+ receiptSchemaVersion: 5,
2237
2490
  command: 'config:set',
2238
2491
  ...writeReceipt,
2239
2492
  plugin: plugin.manifest.name,
@@ -2388,7 +2641,7 @@ export function buildProgram(options = {}) {
2388
2641
  });
2389
2642
  return {
2390
2643
  ok: writeReceipt.overallState === 'succeeded',
2391
- receiptSchemaVersion: 4,
2644
+ receiptSchemaVersion: 5,
2392
2645
  command: 'config:unset',
2393
2646
  ...writeReceipt,
2394
2647
  plugin: plugin.manifest.name,
@@ -2512,7 +2765,7 @@ export function buildProgram(options = {}) {
2512
2765
  });
2513
2766
  return {
2514
2767
  ok: resetReceipt.overallState === 'succeeded',
2515
- receiptSchemaVersion: 4,
2768
+ receiptSchemaVersion: 5,
2516
2769
  command: 'config:reset',
2517
2770
  ...resetReceipt,
2518
2771
  plugin: plugin.manifest.name,
@@ -2620,7 +2873,7 @@ export function buildProgram(options = {}) {
2620
2873
  .option('-j, --json', 'print status as JSON', false)
2621
2874
  .action(async (plugins, rawOptions) => {
2622
2875
  const context = createActionContext('status', rawOptions);
2623
- const result = await runActionWithContext(context, () => statusCommandV5({
2876
+ const result = await runActionWithContext(context, () => statusCommandV6({
2624
2877
  plugins: plugins ?? [],
2625
2878
  cwd,
2626
2879
  env: context.env,
@@ -2673,6 +2926,7 @@ export async function runCli(argv, options = {}) {
2673
2926
  && ['activate', 'status', 'deactivate'].includes(argv[2] ?? '')
2674
2927
  ? argv[2]
2675
2928
  : null;
2929
+ const jsonWriteRequest = jsonWriteCommandRequest(argv);
2676
2930
  try {
2677
2931
  const authoringScriptByCommand = {
2678
2932
  init: 'init-plugin.mjs',
@@ -2742,7 +2996,7 @@ export async function runCli(argv, options = {}) {
2742
2996
  const message = 'option --subdir cannot be used with option --no-subdir';
2743
2997
  if (argv.includes('--json') && argv[0] === 'catalog' && argv[1] === 'source' && argv[2] === 'update') {
2744
2998
  writeJsonReceipt(io.stdout, {
2745
- receiptSchemaVersion: 4,
2999
+ receiptSchemaVersion: 5,
2746
3000
  command: 'catalog:source:update',
2747
3001
  ok: false,
2748
3002
  changed: false,
@@ -2776,7 +3030,9 @@ export async function runCli(argv, options = {}) {
2776
3030
  }
2777
3031
  const program = buildProgram({
2778
3032
  ...options,
2779
- io: jsonCatalogDevCommand ? { ...io, stderr: () => undefined } : io,
3033
+ io: jsonCatalogDevCommand || jsonWriteRequest
3034
+ ? { ...io, stderr: () => undefined }
3035
+ : io,
2780
3036
  diagnostics: {
2781
3037
  ...options.diagnostics,
2782
3038
  metadata: {
@@ -2810,6 +3066,10 @@ export async function runCli(argv, options = {}) {
2810
3066
  }));
2811
3067
  return 1;
2812
3068
  }
3069
+ if (jsonWriteRequest) {
3070
+ writeCommandFailureReceipt(io.stdout, jsonWriteRequest, error);
3071
+ return 1;
3072
+ }
2813
3073
  if (jsonAuthoringCommand && !(error instanceof CommanderError)) {
2814
3074
  const message = error instanceof Error ? error.message : String(error);
2815
3075
  if (jsonAuthoringCommand === 'plugin:validate') {