@lesliechan721/aw 0.1.0-beta.7 → 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 (341) 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 +8 -37
  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/plugin-status.mjs +8 -11
  10. package/dist/authoring/scripts/plugin-status.mjs.map +1 -1
  11. package/dist/authoring/scripts/remove-plugin.mjs +2 -1
  12. package/dist/authoring/scripts/remove-plugin.mjs.map +1 -1
  13. package/dist/authoring/scripts/validate-plugin.mjs +64 -758
  14. package/dist/authoring/scripts/validate-plugin.mjs.map +1 -1
  15. package/dist/scripts/aw-skill-eval-materializer.d.ts +24 -0
  16. package/dist/scripts/{plugin-eval-materializer.js → aw-skill-eval-materializer.js} +34 -145
  17. package/dist/scripts/aw-skill-eval-materializer.js.map +1 -0
  18. package/dist/scripts/bundle-plugins.d.ts +1 -0
  19. package/dist/scripts/bundle-plugins.js +2 -1
  20. package/dist/scripts/bundle-plugins.js.map +1 -1
  21. package/dist/scripts/plugin-staging.d.ts +6 -8
  22. package/dist/scripts/plugin-staging.js +15 -28
  23. package/dist/scripts/plugin-staging.js.map +1 -1
  24. package/dist/scripts/test-plugin-scripts.js +2 -33
  25. package/dist/scripts/test-plugin-scripts.js.map +1 -1
  26. package/dist/src/adapters/helpers.js +2 -2
  27. package/dist/src/adapters/helpers.js.map +1 -1
  28. package/dist/src/authoring/workspace-commands.d.ts +17 -1
  29. package/dist/src/authoring/workspace-commands.js +21 -4
  30. package/dist/src/authoring/workspace-commands.js.map +1 -1
  31. package/dist/src/commands/aw-capabilities.d.ts +78 -0
  32. package/dist/src/commands/aw-capabilities.js +254 -0
  33. package/dist/src/commands/aw-capabilities.js.map +1 -0
  34. package/dist/src/commands/catalog-dev-source.d.ts +118 -0
  35. package/dist/src/commands/catalog-dev-source.js +417 -0
  36. package/dist/src/commands/catalog-dev-source.js.map +1 -0
  37. package/dist/src/commands/catalog-generation.d.ts +13 -0
  38. package/dist/src/commands/catalog-generation.js +13 -0
  39. package/dist/src/commands/catalog-generation.js.map +1 -0
  40. package/dist/src/commands/catalog-publication-inspection.d.ts +29 -28
  41. package/dist/src/commands/catalog-publication-inspection.js +138 -50
  42. package/dist/src/commands/catalog-publication-inspection.js.map +1 -1
  43. package/dist/src/commands/catalog-publication-journal.d.ts +49 -0
  44. package/dist/src/commands/catalog-publication-journal.js +147 -0
  45. package/dist/src/commands/catalog-publication-journal.js.map +1 -0
  46. package/dist/src/commands/catalog-publication-target.d.ts +18 -0
  47. package/dist/src/commands/catalog-publication-target.js +95 -0
  48. package/dist/src/commands/catalog-publication-target.js.map +1 -0
  49. package/dist/src/commands/catalog-publish.d.ts +58 -15
  50. package/dist/src/commands/catalog-publish.js +590 -210
  51. package/dist/src/commands/catalog-publish.js.map +1 -1
  52. package/dist/src/commands/catalog-source.d.ts +12 -15
  53. package/dist/src/commands/catalog-source.js +61 -86
  54. package/dist/src/commands/catalog-source.js.map +1 -1
  55. package/dist/src/commands/catalog-status.d.ts +18 -22
  56. package/dist/src/commands/catalog-status.js +81 -115
  57. package/dist/src/commands/catalog-status.js.map +1 -1
  58. package/dist/src/commands/catalog-workspace-resolution.d.ts +13 -0
  59. package/dist/src/commands/catalog-workspace-resolution.js +42 -0
  60. package/dist/src/commands/catalog-workspace-resolution.js.map +1 -0
  61. package/dist/src/commands/dependency-operation-plan.d.ts +88 -9
  62. package/dist/src/commands/dependency-operation-plan.js +331 -6
  63. package/dist/src/commands/dependency-operation-plan.js.map +1 -1
  64. package/dist/src/commands/init.d.ts +5 -11
  65. package/dist/src/commands/init.js +30 -51
  66. package/dist/src/commands/init.js.map +1 -1
  67. package/dist/src/commands/offline-cleanup-evidence.d.ts +43 -0
  68. package/dist/src/commands/offline-cleanup-evidence.js +116 -0
  69. package/dist/src/commands/offline-cleanup-evidence.js.map +1 -0
  70. package/dist/src/commands/options.d.ts +7 -1
  71. package/dist/src/commands/options.js +65 -6
  72. package/dist/src/commands/options.js.map +1 -1
  73. package/dist/src/commands/plugin-capabilities.js +5 -1
  74. package/dist/src/commands/plugin-capabilities.js.map +1 -1
  75. package/dist/src/commands/rebuild-command.d.ts +27 -13
  76. package/dist/src/commands/rebuild-command.js +1472 -471
  77. package/dist/src/commands/rebuild-command.js.map +1 -1
  78. package/dist/src/commands/rebuild-integration.d.ts +63 -8
  79. package/dist/src/commands/rebuild-integration.js +761 -439
  80. package/dist/src/commands/rebuild-integration.js.map +1 -1
  81. package/dist/src/commands/rebuild-operations.d.ts +2 -8
  82. package/dist/src/commands/rebuild-operations.js +48 -132
  83. package/dist/src/commands/rebuild-operations.js.map +1 -1
  84. package/dist/src/commands/runtime.js +21 -34
  85. package/dist/src/commands/runtime.js.map +1 -1
  86. package/dist/src/commands/skill-eval.d.ts +33 -0
  87. package/dist/src/commands/skill-eval.js +363 -0
  88. package/dist/src/commands/skill-eval.js.map +1 -0
  89. package/dist/src/commands/status-v6.d.ts +202 -0
  90. package/dist/src/commands/status-v6.js +1938 -0
  91. package/dist/src/commands/status-v6.js.map +1 -0
  92. package/dist/src/commands/sync-command.d.ts +21 -0
  93. package/dist/src/commands/sync-command.js +206 -0
  94. package/dist/src/commands/sync-command.js.map +1 -0
  95. package/dist/src/commands/wizard.d.ts +2 -2
  96. package/dist/src/commands/wizard.js +2 -2
  97. package/dist/src/commands/wizard.js.map +1 -1
  98. package/dist/src/commands/write-commands.js +33 -19
  99. package/dist/src/commands/write-commands.js.map +1 -1
  100. package/dist/src/constants.d.ts +7 -1
  101. package/dist/src/constants.js +7 -1
  102. package/dist/src/constants.js.map +1 -1
  103. package/dist/src/eval/manifest-v1.d.ts +66 -0
  104. package/dist/src/eval/manifest-v1.js +326 -0
  105. package/dist/src/eval/manifest-v1.js.map +1 -0
  106. package/dist/src/generators/local-plugin.d.ts +3 -0
  107. package/dist/src/generators/local-plugin.js +167 -45
  108. package/dist/src/generators/local-plugin.js.map +1 -1
  109. package/dist/src/index.d.ts +6 -1
  110. package/dist/src/index.js +863 -126
  111. package/dist/src/index.js.map +1 -1
  112. package/dist/src/output/command-receipt.d.ts +58 -8
  113. package/dist/src/output/command-receipt.js +141 -11
  114. package/dist/src/output/command-receipt.js.map +1 -1
  115. package/dist/src/output/model.d.ts +3 -44
  116. package/dist/src/output/model.js +1 -144
  117. package/dist/src/output/model.js.map +1 -1
  118. package/dist/src/output/rebuild-progress.js +0 -3
  119. package/dist/src/output/rebuild-progress.js.map +1 -1
  120. package/dist/src/portable/commands.d.ts +6 -2
  121. package/dist/src/portable/commands.js +57 -6
  122. package/dist/src/portable/commands.js.map +1 -1
  123. package/dist/src/portable/materializer.d.ts +4 -4
  124. package/dist/src/portable/materializer.js +61 -12
  125. package/dist/src/portable/materializer.js.map +1 -1
  126. package/dist/src/tui/catalog-generation.d.ts +35 -0
  127. package/dist/src/tui/catalog-generation.js +85 -0
  128. package/dist/src/tui/catalog-generation.js.map +1 -0
  129. package/dist/src/tui/components.js +1 -2
  130. package/dist/src/tui/components.js.map +1 -1
  131. package/dist/src/tui/console-app-v4.d.ts +1 -1
  132. package/dist/src/tui/console-app-v4.js +647 -196
  133. package/dist/src/tui/console-app-v4.js.map +1 -1
  134. package/dist/src/tui/controller-runtime.d.ts +6 -2
  135. package/dist/src/tui/controller-runtime.js +646 -137
  136. package/dist/src/tui/controller-runtime.js.map +1 -1
  137. package/dist/src/tui/controller.d.ts +77 -15
  138. package/dist/src/tui/controller.js +647 -306
  139. package/dist/src/tui/controller.js.map +1 -1
  140. package/dist/src/tui/diagnostics.d.ts +1 -2
  141. package/dist/src/tui/diagnostics.js.map +1 -1
  142. package/dist/src/tui/index.d.ts +1 -0
  143. package/dist/src/tui/index.js +1 -0
  144. package/dist/src/tui/index.js.map +1 -1
  145. package/dist/src/tui/input-display.d.ts +8 -0
  146. package/dist/src/tui/input-display.js +36 -0
  147. package/dist/src/tui/input-display.js.map +1 -0
  148. package/dist/src/tui/model.d.ts +102 -14
  149. package/dist/src/tui/model.js +630 -139
  150. package/dist/src/tui/model.js.map +1 -1
  151. package/dist/src/tui/router.d.ts +35 -0
  152. package/dist/src/tui/router.js.map +1 -1
  153. package/dist/src/tui/source-ref-presets.d.ts +3 -0
  154. package/dist/src/tui/source-ref-presets.js +11 -0
  155. package/dist/src/tui/source-ref-presets.js.map +1 -0
  156. package/dist/src/tui/views.js +31 -3
  157. package/dist/src/tui/views.js.map +1 -1
  158. package/dist/src/types.d.ts +104 -13
  159. package/dist/src/types.js.map +1 -1
  160. package/dist/src/utils/agent-version.d.ts +7 -1
  161. package/dist/src/utils/agent-version.js +41 -8
  162. package/dist/src/utils/agent-version.js.map +1 -1
  163. package/dist/src/utils/aw-home-mutation-lock.d.ts +1 -0
  164. package/dist/src/utils/aw-home-mutation-lock.js +32 -4
  165. package/dist/src/utils/aw-home-mutation-lock.js.map +1 -1
  166. package/dist/src/utils/bundle-integrity.d.ts +0 -1
  167. package/dist/src/utils/bundle-integrity.js +0 -25
  168. package/dist/src/utils/bundle-integrity.js.map +1 -1
  169. package/dist/src/utils/bundle-layout.js +8 -6
  170. package/dist/src/utils/bundle-layout.js.map +1 -1
  171. package/dist/src/utils/catalog-digests.d.ts +7 -0
  172. package/dist/src/utils/catalog-digests.js +40 -2
  173. package/dist/src/utils/catalog-digests.js.map +1 -1
  174. package/dist/src/utils/catalog-generation-control-snapshot.d.ts +11 -0
  175. package/dist/src/utils/catalog-generation-control-snapshot.js +45 -0
  176. package/dist/src/utils/catalog-generation-control-snapshot.js.map +1 -0
  177. package/dist/src/utils/catalog-generation-error.d.ts +13 -0
  178. package/dist/src/utils/catalog-generation-error.js +28 -0
  179. package/dist/src/utils/catalog-generation-error.js.map +1 -0
  180. package/dist/src/utils/catalog-generation-resolver.d.ts +20 -0
  181. package/dist/src/utils/catalog-generation-resolver.js +143 -0
  182. package/dist/src/utils/catalog-generation-resolver.js.map +1 -0
  183. package/dist/src/utils/catalog-generation-service.d.ts +43 -0
  184. package/dist/src/utils/catalog-generation-service.js +306 -0
  185. package/dist/src/utils/catalog-generation-service.js.map +1 -0
  186. package/dist/src/utils/catalog-generation-state.d.ts +17 -0
  187. package/dist/src/utils/catalog-generation-state.js +168 -0
  188. package/dist/src/utils/catalog-generation-state.js.map +1 -0
  189. package/dist/src/utils/catalog-generation-store.d.ts +34 -0
  190. package/dist/src/utils/catalog-generation-store.js +251 -0
  191. package/dist/src/utils/catalog-generation-store.js.map +1 -0
  192. package/dist/src/utils/catalog-manifest-v6.d.ts +5 -0
  193. package/dist/src/utils/{catalog-manifest-v4.js → catalog-manifest-v6.js} +35 -43
  194. package/dist/src/utils/catalog-manifest-v6.js.map +1 -0
  195. package/dist/src/utils/catalog-operation-context.d.ts +20 -0
  196. package/dist/src/utils/catalog-operation-context.js +141 -0
  197. package/dist/src/utils/catalog-operation-context.js.map +1 -0
  198. package/dist/src/utils/catalog-public-error.d.ts +7 -3
  199. package/dist/src/utils/catalog-public-error.js +21 -8
  200. package/dist/src/utils/catalog-public-error.js.map +1 -1
  201. package/dist/src/utils/catalog-runtime-projection.d.ts +3 -0
  202. package/dist/src/utils/catalog-runtime-projection.js +5 -40
  203. package/dist/src/utils/catalog-runtime-projection.js.map +1 -1
  204. package/dist/src/utils/catalog-snapshot.d.ts +5 -3
  205. package/dist/src/utils/catalog-snapshot.js +11 -3
  206. package/dist/src/utils/catalog-snapshot.js.map +1 -1
  207. package/dist/src/utils/catalog-source-identity.d.ts +1 -0
  208. package/dist/src/utils/catalog-source-identity.js +21 -2
  209. package/dist/src/utils/catalog-source-identity.js.map +1 -1
  210. package/dist/src/utils/catalog-source-references.d.ts +7 -0
  211. package/dist/src/utils/catalog-source-references.js +44 -55
  212. package/dist/src/utils/catalog-source-references.js.map +1 -1
  213. package/dist/src/utils/catalog-sources.d.ts +1 -0
  214. package/dist/src/utils/catalog-sources.js +55 -20
  215. package/dist/src/utils/catalog-sources.js.map +1 -1
  216. package/dist/src/utils/codex-config.d.ts +2 -0
  217. package/dist/src/utils/codex-config.js +26 -5
  218. package/dist/src/utils/codex-config.js.map +1 -1
  219. package/dist/src/utils/codex-manager.d.ts +81 -0
  220. package/dist/src/utils/codex-manager.js +810 -0
  221. package/dist/src/utils/codex-manager.js.map +1 -0
  222. package/dist/src/utils/codex-reconciler.d.ts +131 -0
  223. package/dist/src/utils/codex-reconciler.js +327 -0
  224. package/dist/src/utils/codex-reconciler.js.map +1 -0
  225. package/dist/src/utils/codex-shared-native.d.ts +56 -0
  226. package/dist/src/utils/codex-shared-native.js +87 -0
  227. package/dist/src/utils/codex-shared-native.js.map +1 -0
  228. package/dist/src/utils/codex-skill-staging.d.ts +2 -0
  229. package/dist/src/utils/codex-skill-staging.js.map +1 -1
  230. package/dist/src/utils/codex-surface-analysis.d.ts +44 -0
  231. package/dist/src/utils/codex-surface-analysis.js +247 -0
  232. package/dist/src/utils/codex-surface-analysis.js.map +1 -0
  233. package/dist/src/utils/dynamic-skill-tree.d.ts +4 -0
  234. package/dist/src/utils/dynamic-skill-tree.js +35 -5
  235. package/dist/src/utils/dynamic-skill-tree.js.map +1 -1
  236. package/dist/src/utils/git-catalog-provider.js +66 -140
  237. package/dist/src/utils/git-catalog-provider.js.map +1 -1
  238. package/dist/src/utils/lifecycle-active-store.d.ts +0 -28
  239. package/dist/src/utils/lifecycle-active-store.js +35 -247
  240. package/dist/src/utils/lifecycle-active-store.js.map +1 -1
  241. package/dist/src/utils/manifest.d.ts +1 -3
  242. package/dist/src/utils/manifest.js +1 -3
  243. package/dist/src/utils/manifest.js.map +1 -1
  244. package/dist/src/utils/multi-source-catalog.d.ts +3 -9
  245. package/dist/src/utils/multi-source-catalog.js +53 -110
  246. package/dist/src/utils/multi-source-catalog.js.map +1 -1
  247. package/dist/src/utils/native-cli.d.ts +49 -6
  248. package/dist/src/utils/native-cli.js +116 -33
  249. package/dist/src/utils/native-cli.js.map +1 -1
  250. package/dist/src/utils/orphan-marketplace-cleanup.js +1 -3
  251. package/dist/src/utils/orphan-marketplace-cleanup.js.map +1 -1
  252. package/dist/src/utils/ownership.d.ts +10 -11
  253. package/dist/src/utils/ownership.js +55 -112
  254. package/dist/src/utils/ownership.js.map +1 -1
  255. package/dist/src/utils/path-catalog-provider.d.ts +1 -1
  256. package/dist/src/utils/path-catalog-provider.js +52 -65
  257. package/dist/src/utils/path-catalog-provider.js.map +1 -1
  258. package/dist/src/utils/paths.d.ts +0 -1
  259. package/dist/src/utils/paths.js +0 -1
  260. package/dist/src/utils/paths.js.map +1 -1
  261. package/dist/src/utils/plugin-config-write.js +18 -40
  262. package/dist/src/utils/plugin-config-write.js.map +1 -1
  263. package/dist/src/utils/plugin-config.d.ts +1 -12
  264. package/dist/src/utils/plugin-config.js +107 -226
  265. package/dist/src/utils/plugin-config.js.map +1 -1
  266. package/dist/src/utils/plugin-intent-state.d.ts +39 -0
  267. package/dist/src/utils/plugin-intent-state.js +325 -0
  268. package/dist/src/utils/plugin-intent-state.js.map +1 -0
  269. package/dist/src/utils/plugin-scripts.d.ts +1 -1
  270. package/dist/src/utils/plugin-scripts.js +1 -1
  271. package/dist/src/utils/plugin-scripts.js.map +1 -1
  272. package/dist/src/utils/state-paths.js +7 -2
  273. package/dist/src/utils/state-paths.js.map +1 -1
  274. package/dist/src/utils/target-eligibility.d.ts +8 -2
  275. package/dist/src/utils/target-eligibility.js +9 -5
  276. package/dist/src/utils/target-eligibility.js.map +1 -1
  277. package/package.json +6 -4
  278. package/dist/authoring/scripts/check-plugin-versions.d.mts +0 -2
  279. package/dist/authoring/scripts/check-plugin-versions.mjs +0 -5
  280. package/dist/authoring/scripts/check-plugin-versions.mjs.map +0 -1
  281. package/dist/scripts/aw-skill-eval-engine.d.ts +0 -13
  282. package/dist/scripts/aw-skill-eval-engine.js +0 -31
  283. package/dist/scripts/aw-skill-eval-engine.js.map +0 -1
  284. package/dist/scripts/codex-eval-app-server.d.ts +0 -89
  285. package/dist/scripts/codex-eval-app-server.js +0 -1228
  286. package/dist/scripts/codex-eval-app-server.js.map +0 -1
  287. package/dist/scripts/codex-eval-isolation.d.ts +0 -61
  288. package/dist/scripts/codex-eval-isolation.js +0 -318
  289. package/dist/scripts/codex-eval-isolation.js.map +0 -1
  290. package/dist/scripts/codex-eval-process-management.d.ts +0 -8
  291. package/dist/scripts/codex-eval-process-management.js +0 -69
  292. package/dist/scripts/codex-eval-process-management.js.map +0 -1
  293. package/dist/scripts/codex-eval-process-tree.d.ts +0 -38
  294. package/dist/scripts/codex-eval-process-tree.js +0 -803
  295. package/dist/scripts/codex-eval-process-tree.js.map +0 -1
  296. package/dist/scripts/codex-eval-runtime-config.d.ts +0 -62
  297. package/dist/scripts/codex-eval-runtime-config.js +0 -843
  298. package/dist/scripts/codex-eval-runtime-config.js.map +0 -1
  299. package/dist/scripts/codex-trigger-eval.d.ts +0 -84
  300. package/dist/scripts/codex-trigger-eval.js +0 -968
  301. package/dist/scripts/codex-trigger-eval.js.map +0 -1
  302. package/dist/scripts/eval-plugin-skills-audited.d.ts +0 -6
  303. package/dist/scripts/eval-plugin-skills-audited.js +0 -261
  304. package/dist/scripts/eval-plugin-skills-audited.js.map +0 -1
  305. package/dist/scripts/eval-plugin-skills.d.ts +0 -45
  306. package/dist/scripts/eval-plugin-skills.js +0 -1586
  307. package/dist/scripts/eval-plugin-skills.js.map +0 -1
  308. package/dist/scripts/eval-run-layout.d.ts +0 -17
  309. package/dist/scripts/eval-run-layout.js +0 -26
  310. package/dist/scripts/eval-run-layout.js.map +0 -1
  311. package/dist/scripts/plugin-eval-contract.d.ts +0 -185
  312. package/dist/scripts/plugin-eval-contract.js +0 -695
  313. package/dist/scripts/plugin-eval-contract.js.map +0 -1
  314. package/dist/scripts/plugin-eval-materializer.d.ts +0 -13
  315. package/dist/scripts/plugin-eval-materializer.js.map +0 -1
  316. package/dist/scripts/skill-reporting.d.ts +0 -212
  317. package/dist/scripts/skill-reporting.js +0 -922
  318. package/dist/scripts/skill-reporting.js.map +0 -1
  319. package/dist/src/commands/status-v4.d.ts +0 -123
  320. package/dist/src/commands/status-v4.js +0 -905
  321. package/dist/src/commands/status-v4.js.map +0 -1
  322. package/dist/src/commands/status.d.ts +0 -93
  323. package/dist/src/commands/status.js +0 -442
  324. package/dist/src/commands/status.js.map +0 -1
  325. package/dist/src/utils/active-marketplace-runtime-lock.d.ts +0 -12
  326. package/dist/src/utils/active-marketplace-runtime-lock.js +0 -133
  327. package/dist/src/utils/active-marketplace-runtime-lock.js.map +0 -1
  328. package/dist/src/utils/catalog-manifest-v3.d.ts +0 -2
  329. package/dist/src/utils/catalog-manifest-v3.js +0 -3
  330. package/dist/src/utils/catalog-manifest-v3.js.map +0 -1
  331. package/dist/src/utils/catalog-manifest-v4.d.ts +0 -5
  332. package/dist/src/utils/catalog-manifest-v4.js.map +0 -1
  333. package/dist/src/utils/catalog-source-cache.d.ts +0 -62
  334. package/dist/src/utils/catalog-source-cache.js +0 -296
  335. package/dist/src/utils/catalog-source-cache.js.map +0 -1
  336. package/dist/src/utils/codex-project-surface.d.ts +0 -3
  337. package/dist/src/utils/codex-project-surface.js +0 -49
  338. package/dist/src/utils/codex-project-surface.js.map +0 -1
  339. package/dist/src/utils/plugin-release.d.ts +0 -2
  340. package/dist/src/utils/plugin-release.js +0 -2
  341. package/dist/src/utils/plugin-release.js.map +0 -1
@@ -1,41 +1,29 @@
1
1
  import crypto from 'node:crypto';
2
+ import os from 'node:os';
2
3
  import path from 'node:path';
3
4
  import fs from 'fs-extra';
4
5
  import { validatePublishedCatalogSnapshot } from '@lesliechan721/aw-plugin-core';
5
- import { disposeCatalogPublicationInspection, parseRemoteRefs, prepareCatalogPublicationInspection, publicationGit, publicationGitExit, } from './catalog-publication-inspection.js';
6
+ import { disposeCatalogPublicationInspection, inspectCatalogPublicationLiveContext, parseRemoteRefs, prepareCatalogPublicationInspection, publicationGit, publicationGitExit, readCatalogPublicationBranchState, } from './catalog-publication-inspection.js';
7
+ import { catalogPublicationJournalPath, catalogPublicationPlanDigest, catalogPublicationRepositoryName, catalogPublicationRepositoryPath, readCatalogPublicationJournal, writeCatalogPublicationJournalAtomic, } from './catalog-publication-journal.js';
8
+ import { resolveCatalogPublicationTarget, } from './catalog-publication-target.js';
9
+ import { resolveCatalogWorkspaceRoot, } from './catalog-workspace-resolution.js';
10
+ export { catalogPublicationPlanDigest, parseCatalogPublicationJournal, } from './catalog-publication-journal.js';
6
11
  export { safeRemoteIdentity, sanitizedGitEnvironment } from './catalog-publication-inspection.js';
7
- function digest(value) {
8
- return `sha256:${crypto.createHash('sha256').update(value).digest('hex')}`;
9
- }
10
- function canonicalJson(value) {
11
- if (Array.isArray(value))
12
- return `[${value.map(canonicalJson).join(',')}]`;
13
- if (value !== null && typeof value === 'object') {
14
- const record = value;
15
- return `{${Object.keys(record).sort().map((key) => `${JSON.stringify(key)}:${canonicalJson(record[key])}`).join(',')}}`;
16
- }
17
- return JSON.stringify(value);
18
- }
19
- export function catalogPublicationDescriptorDigest(descriptor) {
20
- return digest(canonicalJson(descriptor));
21
- }
22
- async function writeJsonAtomic(filePath, value, exclusive) {
23
- await fs.ensureDir(path.dirname(filePath));
24
- const temporary = path.join(path.dirname(filePath), `.${path.basename(filePath)}.${crypto.randomUUID()}.tmp`);
25
- await fs.writeFile(temporary, `${JSON.stringify(value, null, 2)}\n`, { flag: 'wx', mode: 0o600 });
26
- try {
27
- if (exclusive) {
28
- await fs.link(temporary, filePath);
29
- await fs.remove(temporary);
30
- }
31
- else {
32
- await fs.rename(temporary, filePath);
12
+ async function assertPublicationStatePathSafe(workspaceRoot) {
13
+ for (const candidate of [
14
+ path.join(workspaceRoot, '.aw'),
15
+ path.join(workspaceRoot, '.aw', 'publish'),
16
+ ]) {
17
+ if (!(await fs.pathExists(candidate)))
18
+ continue;
19
+ const stats = await fs.lstat(candidate);
20
+ if (!stats.isDirectory() || stats.isSymbolicLink()) {
21
+ throw new Error('Catalog publication state path must contain only regular local directories.');
33
22
  }
34
23
  }
35
- catch (error) {
36
- await fs.remove(temporary);
37
- throw error;
38
- }
24
+ }
25
+ function sameDescriptor(left, right) {
26
+ return catalogPublicationPlanDigest(left) === catalogPublicationPlanDigest(right);
39
27
  }
40
28
  async function clearWorktree(repositoryRoot) {
41
29
  for (const name of await fs.readdir(repositoryRoot)) {
@@ -53,46 +41,45 @@ async function assertNoGitAttributes(root, relative = '') {
53
41
  await assertNoGitAttributes(root, child);
54
42
  }
55
43
  }
56
- async function assertSnapshotBinding(snapshotRoot, descriptor) {
57
- const [stats, validation, ledgerBytes] = await Promise.all([
44
+ async function assertSnapshotBinding(snapshotRoot, descriptor, display) {
45
+ const [stats, validation] = await Promise.all([
58
46
  fs.lstat(snapshotRoot),
59
47
  validatePublishedCatalogSnapshot(snapshotRoot),
60
- fs.readFile(path.join(snapshotRoot, 'plugin-release-ledger.json')),
61
48
  ]);
62
49
  if (!stats.isDirectory() || stats.isSymbolicLink()) {
63
50
  throw new Error('Prepared Catalog snapshot must be a regular local directory.');
64
51
  }
65
52
  const release = validation.manifest.release;
66
- if (validation.manifest.catalogVersion !== descriptor.catalogVersion
67
- || validation.manifest.channel !== descriptor.channel
53
+ if (validation.manifest.catalogVersion !== display.catalogVersion
54
+ || validation.manifest.channel !== display.channel
55
+ || validation.manifest.entries.length !== display.pluginCount
68
56
  || validation.snapshotDigest !== descriptor.snapshotDigest
69
57
  || release.state !== 'published'
70
- || release.sourceHead !== descriptor.sourceHead
71
- || release.contentDigest !== descriptor.contentDigest
72
- || release.planId !== descriptor.planId
73
- || digest(ledgerBytes) !== descriptor.ledgerDigest) {
74
- throw new Error('Prepared Catalog descriptor, snapshot, ledger, or plan identity changed.');
58
+ || release.sourceHead !== descriptor.sourceHead) {
59
+ throw new Error('Prepared Catalog descriptor, snapshot, or plan identity changed.');
75
60
  }
76
61
  await assertNoGitAttributes(snapshotRoot);
77
62
  }
78
- async function publishCatalogPublicationPreparation(options) {
79
- const { preparation: inspection, descriptor, snapshotRoot } = options;
80
- const { temporaryRoot, repositoryRoot, repoRoot, sourceHead, remote, branch, branchRef, tag, tagRef, fetchUrl, pushUrl, safeFetchUrl, safePushUrl, remoteIdentityDigest, parent, attemptPath, env, } = inspection;
81
- if (catalogPublicationDescriptorDigest(inspection.descriptor)
82
- !== catalogPublicationDescriptorDigest(descriptor)) {
83
- throw new Error('Catalog publication descriptor changed after preparation.');
84
- }
85
- if (!inspection.tagAvailable) {
86
- throw new Error(`Remote Catalog tag ${tag} already exists. Increase the Catalog version.`);
87
- }
88
- if (!inspection.attemptAvailable || await fs.pathExists(attemptPath)) {
89
- throw new Error(`Catalog ${descriptor.catalogVersion} already has an attempted publication record. `
90
- + 'Run aw catalog version <higher> before publishing again.');
91
- }
92
- if (!(await publicationGitExit(repoRoot, ['check-ignore', '-q', attemptPath], env))) {
93
- throw new Error('Catalog publish state under .aw/publish must be ignored by Git. Add .aw/ to .gitignore.');
63
+ function displayFromPreparation(preparation) {
64
+ return {
65
+ catalogVersion: preparation.prepared.catalogVersion,
66
+ channel: preparation.prepared.channel,
67
+ pluginCount: preparation.prepared.pluginNames.length,
68
+ };
69
+ }
70
+ function assertLiveContextMatchesDescriptor(context, descriptor) {
71
+ if (context.workspaceIdentity !== descriptor.workspaceIdentity
72
+ || context.sourceHead !== descriptor.sourceHead
73
+ || context.remoteName !== descriptor.remote.name
74
+ || context.remoteIdentityDigest !== descriptor.remote.identityDigest
75
+ || context.branch !== descriptor.branch
76
+ || context.tag !== descriptor.tag) {
77
+ throw new Error('Catalog publication identity changed. Increase the Catalog version and create a new plan.');
94
78
  }
95
- await assertSnapshotBinding(snapshotRoot, descriptor);
79
+ }
80
+ async function createPublicationCommit(preparation, descriptor, snapshotRoot, display) {
81
+ const { repositoryRoot, parent, tag, env } = preparation;
82
+ await assertSnapshotBinding(snapshotRoot, descriptor, display);
96
83
  if (parent) {
97
84
  await publicationGit(repositoryRoot, [
98
85
  'checkout', '--quiet', '--detach', 'refs/aw/catalog-parent',
@@ -105,11 +92,13 @@ async function publishCatalogPublicationPreparation(options) {
105
92
  }
106
93
  await clearWorktree(repositoryRoot);
107
94
  await fs.copy(snapshotRoot, repositoryRoot, { dereference: false });
108
- await publicationGit(repositoryRoot, ['add', '--force', '--all'], env, 'publicationCommitFailed', 'Could not stage the Catalog publication tree.');
95
+ await publicationGit(repositoryRoot, [
96
+ 'add', '--force', '--all',
97
+ ], env, 'publicationCommitFailed', 'Could not stage the Catalog publication tree.');
109
98
  await publicationGit(repositoryRoot, [
110
99
  '-c', 'user.name=AW Catalog Publisher',
111
100
  '-c', 'user.email=catalog-publisher@agent-workflows.invalid',
112
- 'commit', '--quiet', '-m', `Catalog ${descriptor.catalogVersion}`,
101
+ 'commit', '--quiet', '-m', `Catalog ${display.catalogVersion}`,
113
102
  ], env, 'publicationCommitFailed', 'Could not create the Catalog publication commit.');
114
103
  const commit = await publicationGit(repositoryRoot, [
115
104
  'rev-parse', 'HEAD',
@@ -122,198 +111,589 @@ async function publishCatalogPublicationPreparation(options) {
122
111
  if ((parent && (parents.length !== 1 || parents[0] !== parent)) || (!parent && parents.length !== 0)) {
123
112
  throw new Error('Catalog publication commit has an invalid parent.');
124
113
  }
125
- const verificationRoot = path.join(temporaryRoot, 'verification');
114
+ const verificationRoot = path.join(preparation.temporaryRoot, 'verification');
126
115
  await fs.ensureDir(verificationRoot);
127
116
  await publicationGit(repositoryRoot, [
128
117
  '--work-tree', verificationRoot, 'checkout', '--quiet', commit, '--', '.',
129
118
  ], env, 'publicationCommitFailed', 'Could not verify the Catalog publication commit tree.');
130
- await assertSnapshotBinding(verificationRoot, descriptor);
119
+ await assertSnapshotBinding(verificationRoot, descriptor, display);
131
120
  await publicationGit(repositoryRoot, [
132
121
  '-c', 'user.name=AW Catalog Publisher',
133
122
  '-c', 'user.email=catalog-publisher@agent-workflows.invalid',
134
- 'tag', '--annotate', tag, '--message', `Catalog ${descriptor.catalogVersion}`,
123
+ 'tag', '--annotate', tag, '--message', `Catalog ${display.catalogVersion}`,
135
124
  ], env, 'publicationCommitFailed', 'Could not create the annotated Catalog tag.');
136
- const liveHead = await publicationGit(repoRoot, [
137
- 'rev-parse', '--verify', 'HEAD',
138
- ], env, 'sourceDrift', 'Could not recheck the source Git HEAD.');
139
- const liveStatus = await publicationGit(repoRoot, [
140
- 'status', '--porcelain=v1', '--untracked-files=all', '--ignore-submodules=none',
141
- ], env, 'sourceDrift', 'Could not recheck the source worktree.');
142
- if (liveHead !== sourceHead || liveStatus !== '') {
143
- throw new Error('Source HEAD or worktree changed before Catalog publication.');
144
- }
145
- let liveFetchUrl;
146
- let livePushUrl;
147
- if (descriptor.remote.name === null) {
148
- liveFetchUrl = fetchUrl;
149
- livePushUrl = pushUrl;
125
+ return commit;
126
+ }
127
+ async function remoteRefState(cwd, remote, branchRef, tagRef, env) {
128
+ const refs = parseRemoteRefs(await publicationGit(cwd, [
129
+ 'ls-remote', remote, branchRef, tagRef, `${tagRef}^{}`,
130
+ ], env, 'remoteReadFailed', 'Could not inspect the Catalog publication remote.'));
131
+ const tagPresent = refs.has(tagRef) || refs.has(`${tagRef}^{}`);
132
+ return {
133
+ branchCommit: refs.get(branchRef) ?? null,
134
+ tagCommit: refs.get(`${tagRef}^{}`) ?? null,
135
+ tagPresent,
136
+ tagAnnotated: refs.has(tagRef) && refs.has(`${tagRef}^{}`),
137
+ };
138
+ }
139
+ function assertReconciliableRemoteState(state, journal) {
140
+ const branchAtExpected = state.branchCommit === journal.expectedCommit;
141
+ const branchAtParent = state.branchCommit === journal.descriptor.parent;
142
+ const tagAtExpected = state.tagAnnotated && state.tagCommit === journal.expectedCommit;
143
+ const tagAbsent = !state.tagPresent;
144
+ if ((branchAtExpected && tagAtExpected)
145
+ || (branchAtParent && tagAbsent)
146
+ || (branchAtExpected && tagAbsent)
147
+ || (branchAtParent && tagAtExpected))
148
+ return;
149
+ throw new Error(`Catalog ${journal.display.catalogVersion} remote refs conflict with the prepared plan. Increase the Catalog version.`);
150
+ }
151
+ const PERSISTED_REPOSITORY_CONFIG = new Map([
152
+ ['core.repositoryformatversion', new Set(['0'])],
153
+ ['core.filemode', new Set(['true', 'false'])],
154
+ ['core.bare', new Set(['false'])],
155
+ ['core.logallrefupdates', new Set(['true'])],
156
+ ['core.ignorecase', new Set(['true'])],
157
+ ['core.precomposeunicode', new Set(['true'])],
158
+ ['core.hookspath', new Set([os.devNull])],
159
+ ['core.symlinks', new Set(['true'])],
160
+ ]);
161
+ const REQUIRED_PERSISTED_REPOSITORY_CONFIG = [
162
+ 'core.repositoryformatversion',
163
+ 'core.filemode',
164
+ 'core.bare',
165
+ 'core.logallrefupdates',
166
+ 'core.hookspath',
167
+ 'core.symlinks',
168
+ ];
169
+ async function assertRegularGitDirectory(root) {
170
+ const stats = await fs.lstat(root);
171
+ if (!stats.isDirectory() || stats.isSymbolicLink()) {
172
+ throw new Error('Pending Catalog publication Git directory is unsafe.');
150
173
  }
151
- else {
152
- [liveFetchUrl, livePushUrl] = await Promise.all([
153
- publicationGit(repoRoot, ['remote', 'get-url', descriptor.remote.name], env, 'remoteDrift', 'Could not recheck the Catalog publication remote configuration.'),
154
- publicationGit(repoRoot, ['remote', 'get-url', '--push', descriptor.remote.name], env, 'remoteDrift', 'Could not recheck the Catalog publication remote configuration.'),
174
+ }
175
+ async function assertRegularGitFile(filePath) {
176
+ const stats = await fs.lstat(filePath);
177
+ if (!stats.isFile() || stats.isSymbolicLink()) {
178
+ throw new Error('Pending Catalog publication Git control file is unsafe.');
179
+ }
180
+ }
181
+ async function assertGitTreeContainsOnlyLocalFiles(root) {
182
+ for (const entry of await fs.readdir(root, { withFileTypes: true })) {
183
+ const child = path.join(root, entry.name);
184
+ const stats = await fs.lstat(child);
185
+ if (stats.isSymbolicLink()) {
186
+ throw new Error('Pending Catalog publication Git data must not contain symbolic links.');
187
+ }
188
+ if (stats.isDirectory()) {
189
+ await assertGitTreeContainsOnlyLocalFiles(child);
190
+ }
191
+ else if (!stats.isFile()) {
192
+ throw new Error('Pending Catalog publication Git data must contain only regular local files.');
193
+ }
194
+ }
195
+ }
196
+ async function assertPathMissing(filePath) {
197
+ try {
198
+ await fs.lstat(filePath);
199
+ }
200
+ catch (error) {
201
+ if (error.code === 'ENOENT')
202
+ return;
203
+ throw error;
204
+ }
205
+ throw new Error('Pending Catalog publication repository must not use alternate object stores.');
206
+ }
207
+ async function validatePersistentRepositoryControlState(repositoryRoot, env) {
208
+ const gitRoot = path.join(repositoryRoot, '.git');
209
+ const configPath = path.join(gitRoot, 'config');
210
+ await assertRegularGitDirectory(gitRoot);
211
+ await assertRegularGitFile(configPath);
212
+ await assertRegularGitFile(path.join(gitRoot, 'HEAD'));
213
+ await assertRegularGitFile(path.join(gitRoot, 'index'));
214
+ await assertRegularGitDirectory(path.join(gitRoot, 'objects'));
215
+ await assertRegularGitDirectory(path.join(gitRoot, 'refs'));
216
+ await assertPathMissing(path.join(gitRoot, 'objects', 'info', 'alternates'));
217
+ await assertPathMissing(path.join(gitRoot, 'objects', 'info', 'http-alternates'));
218
+ await assertGitTreeContainsOnlyLocalFiles(gitRoot);
219
+ const entries = (await publicationGit(repositoryRoot, [
220
+ 'config', '--file', configPath, '--no-includes', '--null', '--list',
221
+ ], env, 'pendingRepositoryInvalid', 'Pending Catalog publication config is damaged.'))
222
+ .split('\0')
223
+ .filter(Boolean);
224
+ const seen = new Set();
225
+ for (const entry of entries) {
226
+ const separator = entry.indexOf('\n');
227
+ if (separator <= 0)
228
+ throw new Error('Pending Catalog publication config is damaged.');
229
+ const key = entry.slice(0, separator).toLowerCase();
230
+ const value = entry.slice(separator + 1);
231
+ if (seen.has(key) || !PERSISTED_REPOSITORY_CONFIG.get(key)?.has(value)) {
232
+ throw new Error('Pending Catalog publication config contains unsafe local settings.');
233
+ }
234
+ seen.add(key);
235
+ }
236
+ if (REQUIRED_PERSISTED_REPOSITORY_CONFIG.some((key) => !seen.has(key))) {
237
+ throw new Error('Pending Catalog publication config is incomplete.');
238
+ }
239
+ }
240
+ async function validatePersistentRepository(repositoryRoot, journal, env) {
241
+ const version = journal.display.catalogVersion;
242
+ let stats;
243
+ try {
244
+ stats = await fs.lstat(repositoryRoot);
245
+ }
246
+ catch (error) {
247
+ throw new Error(`Catalog ${version} pending publication repository is missing or damaged. Increase the Catalog version.`, { cause: error });
248
+ }
249
+ if (!stats.isDirectory() || stats.isSymbolicLink()) {
250
+ throw new Error(`Catalog ${version} pending publication repository is missing or damaged. Increase the Catalog version.`);
251
+ }
252
+ try {
253
+ await validatePersistentRepositoryControlState(repositoryRoot, env);
254
+ const [head, tagCommit, tagType, remotes, parents] = await Promise.all([
255
+ publicationGit(repositoryRoot, ['rev-parse', '--verify', 'HEAD'], env, 'pendingRepositoryInvalid', 'Pending Catalog publication repository is damaged.'),
256
+ publicationGit(repositoryRoot, ['rev-parse', `${journal.descriptor.tag}^{commit}`], env, 'pendingRepositoryInvalid', 'Pending Catalog publication tag is damaged.'),
257
+ publicationGit(repositoryRoot, ['cat-file', '-t', `refs/tags/${journal.descriptor.tag}`], env, 'pendingRepositoryInvalid', 'Pending Catalog publication tag is damaged.'),
258
+ publicationGit(repositoryRoot, ['remote'], env, 'pendingRepositoryInvalid', 'Pending Catalog publication repository is damaged.'),
259
+ publicationGit(repositoryRoot, ['show', '-s', '--format=%P', journal.expectedCommit], env, 'pendingRepositoryInvalid', 'Pending Catalog publication commit is damaged.'),
155
260
  ]);
261
+ const parentList = parents.split(/\s+/u).filter(Boolean);
262
+ if (head !== journal.expectedCommit
263
+ || tagCommit !== journal.expectedCommit
264
+ || tagType !== 'tag'
265
+ || remotes !== ''
266
+ || (journal.descriptor.parent === null
267
+ ? parentList.length !== 0
268
+ : parentList.length !== 1 || parentList[0] !== journal.descriptor.parent))
269
+ throw new Error('Pending Catalog publication repository identity changed.');
270
+ const verificationRoot = path.join(path.dirname(repositoryRoot), `.${path.basename(repositoryRoot)}.${crypto.randomUUID()}.verify`);
271
+ try {
272
+ await fs.ensureDir(verificationRoot);
273
+ await publicationGit(repositoryRoot, [
274
+ '--work-tree', verificationRoot, 'checkout', '--quiet', journal.expectedCommit, '--', '.',
275
+ ], env, 'pendingRepositoryInvalid', 'Pending Catalog publication commit tree is damaged.');
276
+ await assertSnapshotBinding(verificationRoot, journal.descriptor, journal.display);
277
+ }
278
+ finally {
279
+ await fs.remove(verificationRoot);
280
+ }
281
+ }
282
+ catch (error) {
283
+ throw new Error(`Catalog ${version} pending publication repository is missing or damaged. Increase the Catalog version.`, { cause: error });
284
+ }
285
+ }
286
+ async function persistRepository(preparation, finalPath, journal) {
287
+ const parent = path.dirname(finalPath);
288
+ await fs.ensureDir(parent);
289
+ const staging = path.join(parent, `.${path.basename(finalPath)}.${crypto.randomUUID()}.tmp`);
290
+ try {
291
+ await publicationGit(preparation.repositoryRoot, [
292
+ 'remote', 'remove', 'publish',
293
+ ], preparation.env, 'temporaryRepositoryFailed', 'Could not seal the publication repository.');
294
+ await fs.copy(preparation.repositoryRoot, staging, { dereference: false, errorOnExist: true });
295
+ await validatePersistentRepository(staging, journal, preparation.env);
296
+ await fs.rename(staging, finalPath);
297
+ }
298
+ finally {
299
+ await fs.remove(staging);
300
+ }
301
+ }
302
+ function receiptBase(context, journal, resolution) {
303
+ const repositoryPath = journal.repository === null
304
+ ? null
305
+ : path.join(path.dirname(catalogPublicationJournalPath(context.catalogWorkspaceRoot, journal.display.catalogVersion)), journal.repository);
306
+ return {
307
+ ok: true,
308
+ workspaceRoot: context.catalogWorkspaceRoot,
309
+ workspaceRootResolvedFrom: resolution.workspaceRootResolvedFrom ?? 'explicit',
310
+ workspaceIdentity: journal.descriptor.workspaceIdentity,
311
+ catalogVersion: journal.display.catalogVersion,
312
+ channel: journal.display.channel,
313
+ remote: context.remote,
314
+ remoteResolvedFrom: resolution.remoteResolvedFrom ?? 'explicit',
315
+ remoteUrl: context.safeFetchUrl,
316
+ fetchUrl: context.safeFetchUrl,
317
+ pushUrl: context.safePushUrl,
318
+ branch: journal.descriptor.branch,
319
+ branchResolvedFrom: resolution.branchResolvedFrom ?? 'explicit',
320
+ parent: journal.descriptor.parent,
321
+ tag: journal.descriptor.tag,
322
+ expectedCommit: journal.expectedCommit,
323
+ sourceHead: journal.descriptor.sourceHead,
324
+ pluginCount: journal.display.pluginCount,
325
+ snapshotDigest: journal.descriptor.snapshotDigest,
326
+ planDigest: journal.planDigest,
327
+ descriptor: journal.descriptor,
328
+ journalPath: catalogPublicationJournalPath(context.catalogWorkspaceRoot, journal.display.catalogVersion),
329
+ repositoryPath,
330
+ };
331
+ }
332
+ async function readExistingPlan(context, resolution) {
333
+ await assertPublicationStatePathSafe(context.catalogWorkspaceRoot);
334
+ const journalPath = catalogPublicationJournalPath(context.catalogWorkspaceRoot, context.catalogVersion);
335
+ const repositoryPath = catalogPublicationRepositoryPath(context.catalogWorkspaceRoot, context.catalogVersion);
336
+ const journal = await readCatalogPublicationJournal(journalPath, context.catalogVersion);
337
+ if (!journal) {
338
+ if (await fs.pathExists(repositoryPath)) {
339
+ throw new Error(`Catalog ${context.catalogVersion} pending publication journal is missing. Increase the Catalog version.`);
340
+ }
341
+ return null;
342
+ }
343
+ assertLiveContextMatchesDescriptor(context, journal.descriptor);
344
+ if (journal.state !== 'published') {
345
+ await validatePersistentRepository(repositoryPath, journal, context.env);
346
+ }
347
+ const state = await remoteRefState(context.repoRoot, context.pushUrl, context.branchRef, context.tagRef, context.env);
348
+ if (journal.state === 'published'
349
+ && (state.branchCommit !== journal.expectedCommit
350
+ || !state.tagAnnotated
351
+ || state.tagCommit !== journal.expectedCommit)) {
352
+ throw new Error(`Catalog ${journal.display.catalogVersion} published journal conflicts with remote refs. Increase the Catalog version.`);
353
+ }
354
+ assertReconciliableRemoteState(state, journal);
355
+ return {
356
+ command: 'catalog:publish:plan',
357
+ state: journal.state,
358
+ ...receiptBase(context, journal, resolution),
359
+ };
360
+ }
361
+ async function persistNewPlan(options) {
362
+ const { preparation, descriptor, snapshotRoot, resolution } = options;
363
+ await assertPublicationStatePathSafe(preparation.catalogWorkspaceRoot);
364
+ if (!sameDescriptor(preparation.descriptor, descriptor)) {
365
+ throw new Error('Catalog publication descriptor changed during preparation.');
156
366
  }
157
- if (digest(JSON.stringify({ fetchUrl: liveFetchUrl, pushUrl: livePushUrl })) !== remoteIdentityDigest) {
158
- throw new Error('Catalog remote configuration changed during preparation.');
367
+ const display = displayFromPreparation(preparation);
368
+ const journalPath = catalogPublicationJournalPath(preparation.catalogWorkspaceRoot, display.catalogVersion);
369
+ const repositoryPath = catalogPublicationRepositoryPath(preparation.catalogWorkspaceRoot, display.catalogVersion);
370
+ if (!(await publicationGitExit(preparation.repoRoot, ['check-ignore', '-q', journalPath], preparation.env))) {
371
+ throw new Error('Catalog publish state under .aw/publish must be ignored by Git. Add .aw/ to .gitignore.');
159
372
  }
160
- const liveRefs = parseRemoteRefs(await publicationGit(repositoryRoot, [
161
- 'ls-remote', 'publish', branchRef, tagRef, `${tagRef}^{}`,
162
- ], env, 'remoteDrift', 'Could not recheck the Catalog publication remote.'));
163
- if ((liveRefs.get(branchRef) ?? null) !== parent || liveRefs.has(tagRef) || liveRefs.has(`${tagRef}^{}`)) {
164
- throw new Error('Catalog remote changed during preparation. Increase the Catalog version before publishing again.');
373
+ if (await fs.pathExists(journalPath) || await fs.pathExists(repositoryPath)) {
374
+ throw new Error(`Catalog ${display.catalogVersion} already has publication state. Use its existing plan or increase the Catalog version.`);
165
375
  }
166
- if (await fs.pathExists(attemptPath)) {
167
- throw new Error(`Catalog ${descriptor.catalogVersion} already has an attempted publication record. `
168
- + 'Run aw catalog version <higher> before publishing again.');
376
+ if (!preparation.tagAvailable) {
377
+ throw new Error(`Remote Catalog tag ${descriptor.tag} already exists. Increase the Catalog version.`);
169
378
  }
170
- await options.beforeRemoteWrite?.();
171
- const attempted = {
379
+ const expectedCommit = await createPublicationCommit(preparation, descriptor, snapshotRoot, display);
380
+ const context = await inspectCatalogPublicationLiveContext({
381
+ workspaceRoot: preparation.catalogWorkspaceRoot,
382
+ ...(descriptor.remote.name === null ? { remoteUrl: preparation.pushUrl } : { remote: descriptor.remote.name }),
383
+ branch: descriptor.branch,
384
+ env: preparation.env,
385
+ });
386
+ assertLiveContextMatchesDescriptor(context, descriptor);
387
+ const liveRefs = await remoteRefState(preparation.repositoryRoot, 'publish', preparation.branchRef, preparation.tagRef, preparation.env);
388
+ if (liveRefs.branchCommit !== descriptor.parent || liveRefs.tagPresent) {
389
+ throw new Error(`Catalog ${display.catalogVersion} remote changed during plan creation. Increase the Catalog version.`);
390
+ }
391
+ const journal = {
172
392
  schemaVersion: 1,
173
- state: 'attempted',
174
- workspaceIdentity: descriptor.workspaceIdentity,
175
- catalogVersion: descriptor.catalogVersion,
176
- sourceHead,
177
- remote: { name: descriptor.remote.name, identityDigest: remoteIdentityDigest },
178
- branch,
179
- parent,
180
- tag,
181
- snapshotDigest: descriptor.snapshotDigest,
182
- contentDigest: descriptor.contentDigest,
183
- planId: descriptor.planId,
184
- descriptorDigest: catalogPublicationDescriptorDigest(descriptor),
185
- attemptedAt: new Date().toISOString(),
393
+ state: 'prepared',
394
+ planDigest: catalogPublicationPlanDigest(descriptor),
395
+ descriptor,
396
+ expectedCommit,
397
+ repository: catalogPublicationRepositoryName(display.catalogVersion),
398
+ display,
399
+ preparedAt: new Date().toISOString(),
186
400
  };
401
+ await persistRepository(preparation, repositoryPath, journal);
187
402
  try {
188
- await writeJsonAtomic(attemptPath, attempted, true);
403
+ await writeCatalogPublicationJournalAtomic(journalPath, journal, true);
189
404
  }
190
405
  catch (error) {
191
406
  if (error.code === 'EEXIST') {
192
- throw new Error(`Catalog ${descriptor.catalogVersion} already has an attempted publication record. `
193
- + 'Run aw catalog version <higher> before publishing again.');
407
+ throw new Error(`Catalog ${display.catalogVersion} publication journal already exists. Use its plan or increase the Catalog version.`);
194
408
  }
195
409
  throw error;
196
410
  }
411
+ return {
412
+ command: 'catalog:publish:plan',
413
+ state: 'prepared',
414
+ ...receiptBase(context, journal, resolution),
415
+ };
416
+ }
417
+ export async function persistCatalogPublicationPlan(options) {
418
+ return persistNewPlan({
419
+ preparation: options.preparation,
420
+ descriptor: options.descriptor ?? options.preparation.descriptor,
421
+ snapshotRoot: options.snapshotRoot ?? options.preparation.prepared.outputRoot,
422
+ resolution: options,
423
+ });
424
+ }
425
+ export async function prepareCatalogPublicationPlan(options) {
426
+ const context = await inspectCatalogPublicationLiveContext(options);
427
+ const existing = await readExistingPlan(context, options);
428
+ if (existing)
429
+ return existing;
430
+ const initialState = await remoteRefState(context.repoRoot, context.pushUrl, context.branchRef, context.tagRef, context.env);
431
+ if (initialState.tagPresent) {
432
+ throw new Error(`Remote Catalog tag ${context.tag} already exists. Increase the Catalog version.`);
433
+ }
434
+ if (initialState.branchCommit !== null) {
435
+ const branchState = await readCatalogPublicationBranchState({
436
+ workspaceRoot: context.catalogWorkspaceRoot,
437
+ ...(options.remoteUrl === undefined ? { remote: options.remote } : { remoteUrl: options.remoteUrl }),
438
+ branch: context.branch,
439
+ env: options.env,
440
+ });
441
+ if (branchState?.version === context.catalogVersion) {
442
+ throw new Error(`Remote Catalog branch already contains version ${context.catalogVersion} without its journal. Increase the Catalog version.`);
443
+ }
444
+ }
445
+ const preparation = await prepareCatalogPublicationInspection(options);
197
446
  try {
198
- await publicationGit(repositoryRoot, [
199
- 'push', '--atomic', `--force-with-lease=${branchRef}:${parent ?? ''}`,
200
- 'publish', `${commit}:${branchRef}`, `${tagRef}:${tagRef}`,
201
- ], env, 'publicationUncertain', `Catalog atomic push failed or its result is uncertain. Do not retry ${descriptor.catalogVersion}; increase the Catalog version.`);
447
+ return await persistNewPlan({
448
+ preparation,
449
+ descriptor: preparation.descriptor,
450
+ snapshotRoot: preparation.prepared.outputRoot,
451
+ resolution: options,
452
+ });
202
453
  }
203
- catch {
204
- throw new Error(`Catalog atomic push failed or its result is uncertain. Do not retry ${descriptor.catalogVersion}; run aw catalog version <higher>.`);
454
+ finally {
455
+ await disposeCatalogPublicationInspection(preparation);
205
456
  }
206
- const publishedRefs = parseRemoteRefs(await publicationGit(repositoryRoot, [
207
- 'ls-remote', 'publish', branchRef, tagRef, `${tagRef}^{}`,
208
- ], env, 'publicationUncertain', `Catalog publication result is uncertain. Do not retry ${descriptor.catalogVersion}; increase the Catalog version.`));
209
- if (publishedRefs.get(branchRef) !== commit || publishedRefs.get(`${tagRef}^{}`) !== commit) {
210
- throw new Error(`Catalog publication result is uncertain. Do not retry ${descriptor.catalogVersion}; run aw catalog version <higher>.`);
457
+ }
458
+ async function markUncertain(journalPath, journal) {
459
+ const uncertain = {
460
+ schemaVersion: 1,
461
+ state: 'uncertain',
462
+ planDigest: journal.planDigest,
463
+ descriptor: journal.descriptor,
464
+ expectedCommit: journal.expectedCommit,
465
+ repository: journal.repository,
466
+ display: journal.display,
467
+ preparedAt: journal.preparedAt,
468
+ uncertainAt: new Date().toISOString(),
469
+ };
470
+ await writeCatalogPublicationJournalAtomic(journalPath, uncertain);
471
+ return uncertain;
472
+ }
473
+ export async function applyCatalogPublicationPlan(options) {
474
+ if (!/^sha256:[0-9a-f]{64}$/u.test(options.expectedPlanDigest)) {
475
+ throw new Error('Catalog publish apply requires --expected-plan-digest from catalog publish plan.');
476
+ }
477
+ const context = await inspectCatalogPublicationLiveContext(options);
478
+ await assertPublicationStatePathSafe(context.catalogWorkspaceRoot);
479
+ const journalPath = catalogPublicationJournalPath(context.catalogWorkspaceRoot, context.catalogVersion);
480
+ const repositoryPath = catalogPublicationRepositoryPath(context.catalogWorkspaceRoot, context.catalogVersion);
481
+ let journal = await readCatalogPublicationJournal(journalPath, context.catalogVersion);
482
+ if (!journal) {
483
+ const state = await remoteRefState(context.repoRoot, context.pushUrl, context.branchRef, context.tagRef, context.env);
484
+ const branchState = state.branchCommit === null
485
+ ? null
486
+ : await readCatalogPublicationBranchState({
487
+ workspaceRoot: context.catalogWorkspaceRoot,
488
+ ...(options.remoteUrl === undefined ? { remote: options.remote } : { remoteUrl: options.remoteUrl }),
489
+ branch: context.branch,
490
+ env: options.env,
491
+ });
492
+ if (state.tagPresent
493
+ || await fs.pathExists(repositoryPath)
494
+ || branchState?.version === context.catalogVersion) {
495
+ throw new Error(`Catalog ${context.catalogVersion} publication state is missing while the version is occupied. Increase the Catalog version.`);
496
+ }
497
+ throw new Error(`Catalog ${context.catalogVersion} has no prepared publication plan. Run catalog publish plan.`);
498
+ }
499
+ if (journal.planDigest !== options.expectedPlanDigest) {
500
+ throw new Error(`Catalog ${context.catalogVersion} plan does not match the authorized digest. Increase the Catalog version for a different plan.`);
501
+ }
502
+ assertLiveContextMatchesDescriptor(context, journal.descriptor);
503
+ if (journal.state === 'published') {
504
+ const state = await remoteRefState(context.repoRoot, context.pushUrl, context.branchRef, context.tagRef, context.env);
505
+ if (state.branchCommit !== journal.expectedCommit || !state.tagAnnotated || state.tagCommit !== journal.expectedCommit) {
506
+ throw new Error(`Catalog ${context.catalogVersion} published journal conflicts with remote refs. Increase the Catalog version.`);
507
+ }
508
+ if (await fs.pathExists(repositoryPath)) {
509
+ try {
510
+ await validatePersistentRepository(repositoryPath, {
511
+ schemaVersion: 1,
512
+ state: 'prepared',
513
+ planDigest: journal.planDigest,
514
+ descriptor: journal.descriptor,
515
+ expectedCommit: journal.expectedCommit,
516
+ repository: catalogPublicationRepositoryName(context.catalogVersion),
517
+ display: journal.display,
518
+ preparedAt: journal.preparedAt,
519
+ }, context.env);
520
+ await fs.remove(repositoryPath);
521
+ }
522
+ catch {
523
+ // Published remote refs are authoritative. Leave unrecognized local residue for safe manual cleanup.
524
+ }
525
+ }
526
+ return {
527
+ command: 'catalog:publish:apply',
528
+ state: 'published',
529
+ commit: journal.expectedCommit,
530
+ reconciliation: 'already-published',
531
+ ...receiptBase(context, journal, options),
532
+ };
533
+ }
534
+ await validatePersistentRepository(repositoryPath, journal, context.env);
535
+ let state = await remoteRefState(repositoryPath, context.pushUrl, context.branchRef, context.tagRef, context.env);
536
+ assertReconciliableRemoteState(state, journal);
537
+ let reconciliation;
538
+ const branchAtExpected = state.branchCommit === journal.expectedCommit;
539
+ const tagAtExpected = state.tagAnnotated && state.tagCommit === journal.expectedCommit;
540
+ if (branchAtExpected && tagAtExpected) {
541
+ reconciliation = 'already-remote';
542
+ }
543
+ else {
544
+ await options.beforeRemoteWrite?.();
545
+ const writeContext = await inspectCatalogPublicationLiveContext(options);
546
+ assertLiveContextMatchesDescriptor(writeContext, journal.descriptor);
547
+ await validatePersistentRepository(repositoryPath, journal, writeContext.env);
548
+ state = await remoteRefState(repositoryPath, writeContext.pushUrl, writeContext.branchRef, writeContext.tagRef, writeContext.env);
549
+ assertReconciliableRemoteState(state, journal);
550
+ try {
551
+ if (state.branchCommit === journal.expectedCommit
552
+ && state.tagAnnotated
553
+ && state.tagCommit === journal.expectedCommit) {
554
+ reconciliation = 'already-remote';
555
+ }
556
+ else if (state.branchCommit === journal.descriptor.parent && !state.tagPresent) {
557
+ reconciliation = 'atomic';
558
+ await publicationGit(repositoryPath, [
559
+ 'push', '--atomic',
560
+ `--force-with-lease=${writeContext.branchRef}:${journal.descriptor.parent ?? ''}`,
561
+ writeContext.pushUrl,
562
+ `${journal.expectedCommit}:${writeContext.branchRef}`,
563
+ `${writeContext.tagRef}:${writeContext.tagRef}`,
564
+ ], writeContext.env, 'publicationUncertain', 'Catalog atomic push failed or its result is uncertain.');
565
+ }
566
+ else if (state.branchCommit === journal.expectedCommit && !state.tagPresent) {
567
+ reconciliation = 'tag';
568
+ await publicationGit(repositoryPath, [
569
+ 'push', writeContext.pushUrl, `${writeContext.tagRef}:${writeContext.tagRef}`,
570
+ ], writeContext.env, 'publicationUncertain', 'Catalog tag push failed or its result is uncertain.');
571
+ }
572
+ else {
573
+ reconciliation = 'branch';
574
+ await publicationGit(repositoryPath, [
575
+ 'push', `--force-with-lease=${writeContext.branchRef}:${journal.descriptor.parent ?? ''}`,
576
+ writeContext.pushUrl, `${journal.expectedCommit}:${writeContext.branchRef}`,
577
+ ], writeContext.env, 'publicationUncertain', 'Catalog branch push failed or its result is uncertain.');
578
+ }
579
+ }
580
+ catch (error) {
581
+ journal = await markUncertain(journalPath, journal);
582
+ throw new Error(`Catalog ${context.catalogVersion} publication result is uncertain. Retry apply with the same plan digest.`, { cause: error });
583
+ }
584
+ try {
585
+ state = await remoteRefState(repositoryPath, context.pushUrl, context.branchRef, context.tagRef, context.env);
586
+ }
587
+ catch (error) {
588
+ journal = await markUncertain(journalPath, journal);
589
+ throw new Error(`Catalog ${context.catalogVersion} publication result is uncertain. Retry apply with the same plan digest.`, { cause: error });
590
+ }
591
+ if (state.branchCommit !== journal.expectedCommit || !state.tagAnnotated || state.tagCommit !== journal.expectedCommit) {
592
+ journal = await markUncertain(journalPath, journal);
593
+ throw new Error(`Catalog ${context.catalogVersion} publication result is uncertain. Retry apply with the same plan digest.`);
594
+ }
211
595
  }
212
- await writeJsonAtomic(attemptPath, {
213
- ...attempted,
596
+ const published = {
597
+ schemaVersion: 1,
214
598
  state: 'published',
215
- commit,
599
+ planDigest: journal.planDigest,
600
+ descriptor: journal.descriptor,
601
+ expectedCommit: journal.expectedCommit,
602
+ repository: null,
603
+ display: journal.display,
604
+ preparedAt: journal.preparedAt,
216
605
  publishedAt: new Date().toISOString(),
217
- }, false);
606
+ };
607
+ await writeCatalogPublicationJournalAtomic(journalPath, published);
608
+ await fs.remove(repositoryPath);
218
609
  return {
219
- command: 'catalog:publish',
220
- ok: true,
221
- workspaceIdentity: descriptor.workspaceIdentity,
222
- catalogVersion: descriptor.catalogVersion,
223
- channel: descriptor.channel,
224
- remote,
225
- remoteUrl: safeFetchUrl,
226
- fetchUrl: safeFetchUrl,
227
- pushUrl: safePushUrl,
228
- branch,
229
- parent,
230
- tag,
231
- commit,
232
- sourceHead,
233
- pluginCount: descriptor.pluginNames.length,
234
- snapshotDigest: descriptor.snapshotDigest,
235
- planId: descriptor.planId,
236
- descriptorDigest: catalogPublicationDescriptorDigest(descriptor),
610
+ command: 'catalog:publish:apply',
611
+ state: 'published',
612
+ commit: published.expectedCommit,
613
+ reconciliation,
614
+ ...receiptBase(context, published, options),
237
615
  };
238
616
  }
239
- export async function publishPreparedCatalogPublication(options) {
240
- const inspection = await prepareCatalogPublicationInspection({
241
- workspaceRoot: options.workspaceRoot,
617
+ export async function runCatalogPublishPlanCommand(options) {
618
+ const workspace = await resolveCatalogWorkspaceRoot({
619
+ cwd: options.cwd,
620
+ ...(options.workspaceRoot === undefined ? {} : { explicitRoot: options.workspaceRoot }),
621
+ mode: 'existing',
622
+ });
623
+ const target = await resolveCatalogPublicationTarget({
624
+ workspaceRoot: workspace.workspaceRoot,
242
625
  remote: options.remote,
243
- remoteUrl: options.remoteUrl,
244
626
  branch: options.branch,
245
627
  env: options.env,
246
- failOnUnavailable: true,
628
+ requireRemote: true,
629
+ });
630
+ return prepareCatalogPublicationPlan({
631
+ workspaceRoot: workspace.workspaceRoot,
632
+ remote: target.remote,
633
+ branch: target.branch,
634
+ env: options.env,
635
+ workspaceRootResolvedFrom: workspace.workspaceRootResolvedFrom,
636
+ remoteResolvedFrom: target.remoteResolvedFrom,
637
+ branchResolvedFrom: target.branchResolvedFrom,
247
638
  });
248
- try {
249
- return await publishCatalogPublicationPreparation({
250
- preparation: inspection,
251
- descriptor: options.descriptor,
252
- snapshotRoot: options.snapshotRoot,
253
- beforeRemoteWrite: options.beforeRemoteWrite,
254
- });
255
- }
256
- finally {
257
- await disposeCatalogPublicationInspection(inspection);
258
- }
259
639
  }
260
- export async function runCatalogPublishCommand(options) {
640
+ export async function runCatalogPublishApplyCommand(options) {
261
641
  if (options.json && !options.yes)
262
- throw new Error('Catalog publish with --json requires --yes.');
642
+ throw new Error('Catalog publish apply with --json requires --yes.');
263
643
  if (!options.interactive && !options.yes)
264
- throw new Error('Non-interactive Catalog publish requires --yes.');
265
- if (!/^sha256:[0-9a-f]{64}$/u.test(options.expectedDescriptorDigest ?? '')) {
266
- throw new Error('Catalog publish requires --expected-descriptor-digest from a successful publication preflight.');
644
+ throw new Error('Non-interactive Catalog publish apply requires --yes.');
645
+ if (!/^sha256:[0-9a-f]{64}$/u.test(options.expectedPlanDigest ?? '')) {
646
+ throw new Error('Catalog publish apply requires --expected-plan-digest from catalog publish plan.');
267
647
  }
268
- const inspection = await prepareCatalogPublicationInspection({
269
- ...options,
270
- failOnUnavailable: true,
648
+ const workspace = await resolveCatalogWorkspaceRoot({
649
+ cwd: options.cwd,
650
+ ...(options.workspaceRoot === undefined ? {} : { explicitRoot: options.workspaceRoot }),
651
+ mode: 'existing',
271
652
  });
272
- try {
273
- const preparedDescriptorDigest = catalogPublicationDescriptorDigest(inspection.descriptor);
274
- if (options.expectedDescriptorDigest !== preparedDescriptorDigest) {
275
- throw new Error('Catalog publication descriptor does not match the authorized preflight. Run preflight and authorize the current exact identity.');
276
- }
277
- if (!(await publicationGitExit(inspection.repoRoot, ['check-ignore', '-q', inspection.attemptPath], inspection.env))) {
278
- throw new Error('Catalog publish state under .aw/publish must be ignored by Git. Add .aw/ to .gitignore.');
279
- }
280
- if (!options.yes) {
281
- options.io.stderr([
282
- `Workspace identity: ${inspection.descriptor.workspaceIdentity}`,
283
- `Source HEAD: ${inspection.sourceHead}`,
284
- `Catalog: ${inspection.descriptor.catalogVersion} (${inspection.descriptor.channel})`,
285
- `Remote: ${inspection.remote}`,
286
- `Fetch URL: ${inspection.safeFetchUrl}`,
287
- `Push URL: ${inspection.safePushUrl}`,
288
- `Branch: ${inspection.branchRef}`,
289
- `Parent: ${inspection.parent ?? '<root>'}`,
290
- `Tag: ${inspection.tagRef}`,
291
- `Snapshot digest: ${inspection.descriptor.snapshotDigest}`,
292
- `Plan ID: ${inspection.descriptor.planId}`,
293
- `Descriptor digest: ${preparedDescriptorDigest}`,
294
- `Plugins: ${inspection.descriptor.pluginNames.length}`,
295
- 'One atomic push will publish the branch and annotated tag.',
296
- ].join('\n') + '\n');
297
- if (!options.confirm || !(await options.confirm('Publish this Catalog snapshot?'))) {
298
- options.io.stderr('Catalog publication cancelled.\n');
299
- return null;
300
- }
301
- }
302
- return await publishCatalogPublicationPreparation({
303
- preparation: inspection,
304
- descriptor: inspection.descriptor,
305
- snapshotRoot: inspection.prepared.outputRoot,
653
+ const target = await resolveCatalogPublicationTarget({
654
+ workspaceRoot: workspace.workspaceRoot,
655
+ remote: options.remote,
656
+ branch: options.branch,
657
+ env: options.env,
658
+ requireRemote: true,
659
+ });
660
+ if (!options.yes) {
661
+ const plan = await prepareCatalogPublicationPlan({
662
+ workspaceRoot: workspace.workspaceRoot,
663
+ remote: target.remote,
664
+ branch: target.branch,
665
+ env: options.env,
666
+ workspaceRootResolvedFrom: workspace.workspaceRootResolvedFrom,
667
+ remoteResolvedFrom: target.remoteResolvedFrom,
668
+ branchResolvedFrom: target.branchResolvedFrom,
306
669
  });
670
+ options.io.stderr([
671
+ `Workspace identity: ${plan.workspaceIdentity}`,
672
+ `Source HEAD: ${plan.sourceHead}`,
673
+ `Remote: ${plan.remote}`,
674
+ `Fetch URL: ${plan.fetchUrl}`,
675
+ `Push URL: ${plan.pushUrl}`,
676
+ `Branch: refs/heads/${plan.branch}`,
677
+ `Parent: ${plan.parent ?? '<root>'}`,
678
+ `Tag: refs/tags/${plan.tag}`,
679
+ `Snapshot digest: ${plan.snapshotDigest}`,
680
+ `Expected commit: ${plan.expectedCommit}`,
681
+ `Plan digest: ${plan.planDigest}`,
682
+ ].join('\n') + '\n');
683
+ if (!options.confirm || !(await options.confirm('Apply this Catalog publication plan?'))) {
684
+ options.io.stderr('Catalog publication cancelled.\n');
685
+ return null;
686
+ }
307
687
  }
308
- catch (error) {
309
- const message = (error instanceof Error ? error.message : String(error))
310
- .replaceAll(inspection.temporaryRoot, '<temporary Catalog state>')
311
- .replaceAll(inspection.fetchUrl, inspection.safeFetchUrl)
312
- .replaceAll(inspection.pushUrl, inspection.safePushUrl);
313
- throw new Error(message);
314
- }
315
- finally {
316
- await disposeCatalogPublicationInspection(inspection);
317
- }
688
+ return applyCatalogPublicationPlan({
689
+ workspaceRoot: workspace.workspaceRoot,
690
+ remote: target.remote,
691
+ branch: target.branch,
692
+ expectedPlanDigest: options.expectedPlanDigest,
693
+ env: options.env,
694
+ workspaceRootResolvedFrom: workspace.workspaceRootResolvedFrom,
695
+ remoteResolvedFrom: target.remoteResolvedFrom,
696
+ branchResolvedFrom: target.branchResolvedFrom,
697
+ });
318
698
  }
319
699
  //# sourceMappingURL=catalog-publish.js.map