@intentius/chant 0.124.52 → 0.124.55

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 (1337) hide show
  1. package/dist/__fixtures__/estate-ledger.d.ts +13 -0
  2. package/dist/__fixtures__/estate-ledger.d.ts.map +1 -0
  3. package/dist/__fixtures__/estate-ledger.js +67 -0
  4. package/dist/__fixtures__/oidc-emulator.d.ts +11 -1
  5. package/dist/__fixtures__/oidc-emulator.d.ts.map +1 -1
  6. package/dist/__fixtures__/oidc-emulator.js +26 -2
  7. package/dist/__fixtures__/product-words.d.ts +78 -0
  8. package/dist/__fixtures__/product-words.d.ts.map +1 -0
  9. package/dist/__fixtures__/product-words.js +43 -0
  10. package/dist/__golden__/wave-loop/op-by-apply-after-fails.json +10 -2
  11. package/dist/__golden__/wave-loop/op-by-apply-hold.json +20 -4
  12. package/dist/__golden__/wave-loop/op-by-apply-ignored.json +10 -2
  13. package/dist/__golden__/wave-loop/op-by-apply-pass.json +10 -2
  14. package/dist/__golden__/wave-loop/op-by-apply-skip.json +10 -2
  15. package/dist/__golden__/wave-loop/op-discover-rest-stops.json +22 -6
  16. package/dist/__golden__/wave-loop/op-discover-rest.json +44 -12
  17. package/dist/__golden__/wave-loop/op-discover-wide.json +12 -3
  18. package/dist/__golden__/wave-loop/op-held-on.json +28 -7
  19. package/dist/__golden__/wave-loop/op-hooks-apply-fails.json +22 -6
  20. package/dist/__golden__/wave-loop/op-hooks-fail-after-apply.json +22 -6
  21. package/dist/__golden__/wave-loop/op-hooks-fail-before-apply.json +4 -2
  22. package/dist/__golden__/wave-loop/op-hooks-held.json +26 -8
  23. package/dist/__golden__/wave-loop/op-hooks-hold-before-apply.json +18 -4
  24. package/dist/__golden__/wave-loop/op-hooks-pass.json +22 -6
  25. package/dist/__golden__/wave-loop/op-hooks-share.json +20 -7
  26. package/dist/__golden__/wave-loop/op-outcome-held.json +12 -3
  27. package/dist/__golden__/wave-loop/op-outcome-replan-approved.json +16 -5
  28. package/dist/__golden__/wave-loop/op-outcome-replan-forever.json +48 -21
  29. package/dist/__golden__/wave-loop/op-outcome-replan.json +16 -5
  30. package/dist/__golden__/wave-loop/op-outcome-stood-down.json +12 -3
  31. package/dist/__golden__/wave-loop/op-outcome-unreadable.json +12 -3
  32. package/dist/__golden__/wave-loop/op-overridden.json +28 -7
  33. package/dist/__golden__/wave-loop/op-per-run.json +20 -4
  34. package/dist/__golden__/wave-loop/op-point.json +18 -4
  35. package/dist/__golden__/wave-loop/op-pr-review.json +10 -2
  36. package/dist/__golden__/wave-loop/op-spend-change-only.json +10 -2
  37. package/dist/__golden__/wave-loop/op-spend.json +10 -2
  38. package/dist/__golden__/wave-loop/op-wave-commands.json +56 -13
  39. package/dist/__golden__/wave-loop/op-wide.json +20 -4
  40. package/dist/audit/discover.d.ts.map +1 -1
  41. package/dist/audit/discover.js +3 -1
  42. package/dist/behaviour.d.ts +1 -1
  43. package/dist/behaviour.d.ts.map +1 -1
  44. package/dist/bucket-check/azure.d.ts +108 -0
  45. package/dist/bucket-check/azure.d.ts.map +1 -0
  46. package/dist/bucket-check/azure.js +258 -0
  47. package/dist/bucket-check/fixtures/azure.json +153 -0
  48. package/dist/bucket-check/fixtures/gcs.json +148 -0
  49. package/dist/bucket-check/fixtures/s3.json +277 -0
  50. package/dist/bucket-check/gcs.d.ts +77 -0
  51. package/dist/bucket-check/gcs.d.ts.map +1 -0
  52. package/dist/bucket-check/gcs.js +202 -0
  53. package/dist/bucket-check/index.d.ts +48 -0
  54. package/dist/bucket-check/index.d.ts.map +1 -0
  55. package/dist/bucket-check/index.js +44 -0
  56. package/dist/bucket-check/s3.d.ts +116 -0
  57. package/dist/bucket-check/s3.d.ts.map +1 -0
  58. package/dist/bucket-check/s3.js +362 -0
  59. package/dist/bucket-check/types.d.ts +66 -0
  60. package/dist/bucket-check/types.d.ts.map +1 -0
  61. package/dist/bucket-check/types.js +31 -0
  62. package/dist/bucket-check/wire.d.ts +27 -0
  63. package/dist/bucket-check/wire.d.ts.map +1 -0
  64. package/dist/bucket-check/wire.js +32 -0
  65. package/dist/bucket-check.d.ts +6 -0
  66. package/dist/bucket-check.d.ts.map +1 -0
  67. package/dist/bucket-check.js +5 -0
  68. package/dist/capabilities/templates.d.ts +65 -0
  69. package/dist/capabilities/templates.d.ts.map +1 -0
  70. package/dist/capabilities/templates.js +192 -0
  71. package/dist/capabilities/templates.json +145 -0
  72. package/dist/change-set-graph.d.ts +35 -3
  73. package/dist/change-set-graph.d.ts.map +1 -1
  74. package/dist/change-set-graph.js +60 -9
  75. package/dist/change-set.d.ts +65 -7
  76. package/dist/change-set.d.ts.map +1 -1
  77. package/dist/change-set.js +22 -12
  78. package/dist/ci-agent.d.ts +381 -0
  79. package/dist/ci-agent.d.ts.map +1 -0
  80. package/dist/ci-agent.js +833 -0
  81. package/dist/ci-control.d.ts +42 -0
  82. package/dist/ci-control.d.ts.map +1 -0
  83. package/dist/ci-control.js +42 -0
  84. package/dist/ci-estate/delivery.d.ts +137 -0
  85. package/dist/ci-estate/delivery.d.ts.map +1 -0
  86. package/dist/ci-estate/delivery.js +311 -0
  87. package/dist/ci-estate/overdue.d.ts +34 -0
  88. package/dist/ci-estate/overdue.d.ts.map +1 -0
  89. package/dist/ci-estate/overdue.js +58 -0
  90. package/dist/ci-estate/page.d.ts +134 -0
  91. package/dist/ci-estate/page.d.ts.map +1 -0
  92. package/dist/ci-estate/page.js +233 -0
  93. package/dist/ci-estate/rows.d.ts +118 -0
  94. package/dist/ci-estate/rows.d.ts.map +1 -0
  95. package/dist/ci-estate/rows.js +126 -0
  96. package/dist/ci-estate.d.ts +68 -0
  97. package/dist/ci-estate.d.ts.map +1 -0
  98. package/dist/ci-estate.js +83 -0
  99. package/dist/ci-handover.d.ts +29 -5
  100. package/dist/ci-handover.d.ts.map +1 -1
  101. package/dist/ci-handover.js +50 -16
  102. package/dist/ci-identity.d.ts +89 -9
  103. package/dist/ci-identity.d.ts.map +1 -1
  104. package/dist/ci-identity.js +91 -16
  105. package/dist/ci-product-words.d.ts +290 -0
  106. package/dist/ci-product-words.d.ts.map +1 -0
  107. package/dist/ci-product-words.js +373 -0
  108. package/dist/ci-product.d.ts +82 -0
  109. package/dist/ci-product.d.ts.map +1 -0
  110. package/dist/ci-product.js +78 -0
  111. package/dist/cli/commands/audit.d.ts +2 -2
  112. package/dist/cli/commands/audit.d.ts.map +1 -1
  113. package/dist/cli/commands/audit.js +3 -2
  114. package/dist/cli/commands/carve.js +2 -2
  115. package/dist/cli/commands/import-index.d.ts +52 -0
  116. package/dist/cli/commands/import-index.d.ts.map +1 -0
  117. package/dist/cli/commands/import-index.js +226 -0
  118. package/dist/cli/commands/init.d.ts +2 -0
  119. package/dist/cli/commands/init.d.ts.map +1 -1
  120. package/dist/cli/commands/init.js +1 -1
  121. package/dist/cli/commands/lint.d.ts.map +1 -1
  122. package/dist/cli/commands/lint.js +4 -2
  123. package/dist/cli/handlers/agent.d.ts +17 -0
  124. package/dist/cli/handlers/agent.d.ts.map +1 -0
  125. package/dist/cli/handlers/agent.js +114 -0
  126. package/dist/cli/handlers/approve-confirm.d.ts +84 -0
  127. package/dist/cli/handlers/approve-confirm.d.ts.map +1 -0
  128. package/dist/cli/handlers/approve-confirm.js +142 -0
  129. package/dist/cli/handlers/approve.d.ts.map +1 -1
  130. package/dist/cli/handlers/approve.js +19 -1
  131. package/dist/cli/handlers/build.d.ts.map +1 -1
  132. package/dist/cli/handlers/build.js +43 -1
  133. package/dist/cli/handlers/ci-check.d.ts +3 -0
  134. package/dist/cli/handlers/ci-check.d.ts.map +1 -0
  135. package/dist/cli/handlers/ci-check.js +34 -0
  136. package/dist/cli/handlers/ci-forge-check.d.ts +3 -0
  137. package/dist/cli/handlers/ci-forge-check.d.ts.map +1 -0
  138. package/dist/cli/handlers/ci-forge-check.js +89 -0
  139. package/dist/cli/handlers/components.d.ts.map +1 -1
  140. package/dist/cli/handlers/components.js +11 -2
  141. package/dist/cli/handlers/fan-out.d.ts.map +1 -1
  142. package/dist/cli/handlers/fan-out.js +20 -3
  143. package/dist/cli/handlers/gate-pending.d.ts +11 -0
  144. package/dist/cli/handlers/gate-pending.d.ts.map +1 -0
  145. package/dist/cli/handlers/gate-pending.js +44 -0
  146. package/dist/cli/handlers/graph.d.ts.map +1 -1
  147. package/dist/cli/handlers/graph.js +22 -4
  148. package/dist/cli/handlers/index-cloud.d.ts +14 -0
  149. package/dist/cli/handlers/index-cloud.d.ts.map +1 -0
  150. package/dist/cli/handlers/index-cloud.js +22 -0
  151. package/dist/cli/handlers/index-diff.d.ts +18 -0
  152. package/dist/cli/handlers/index-diff.d.ts.map +1 -0
  153. package/dist/cli/handlers/index-diff.js +142 -0
  154. package/dist/cli/handlers/init.d.ts.map +1 -1
  155. package/dist/cli/handlers/init.js +1 -0
  156. package/dist/cli/handlers/ledger.js +1 -1
  157. package/dist/cli/handlers/lifecycle-drift.d.ts +29 -0
  158. package/dist/cli/handlers/lifecycle-drift.d.ts.map +1 -0
  159. package/dist/cli/handlers/lifecycle-drift.js +69 -0
  160. package/dist/cli/handlers/lifecycle.d.ts.map +1 -1
  161. package/dist/cli/handlers/lifecycle.js +188 -28
  162. package/dist/cli/handlers/lock.d.ts.map +1 -1
  163. package/dist/cli/handlers/lock.js +64 -5
  164. package/dist/cli/handlers/misc.d.ts +9 -0
  165. package/dist/cli/handlers/misc.d.ts.map +1 -1
  166. package/dist/cli/handlers/misc.js +77 -0
  167. package/dist/cli/handlers/notify-relay.d.ts +15 -0
  168. package/dist/cli/handlers/notify-relay.d.ts.map +1 -0
  169. package/dist/cli/handlers/notify-relay.js +130 -0
  170. package/dist/cli/handlers/pr-env.d.ts.map +1 -1
  171. package/dist/cli/handlers/pr-env.js +42 -11
  172. package/dist/cli/handlers/pr.d.ts +38 -3
  173. package/dist/cli/handlers/pr.d.ts.map +1 -1
  174. package/dist/cli/handlers/pr.js +668 -207
  175. package/dist/cli/handlers/promote.d.ts.map +1 -1
  176. package/dist/cli/handlers/promote.js +110 -17
  177. package/dist/cli/handlers/query.d.ts.map +1 -1
  178. package/dist/cli/handlers/query.js +28 -4
  179. package/dist/cli/handlers/release.d.ts.map +1 -1
  180. package/dist/cli/handlers/release.js +3 -0
  181. package/dist/cli/handlers/run-wave.d.ts +8 -0
  182. package/dist/cli/handlers/run-wave.d.ts.map +1 -1
  183. package/dist/cli/handlers/run-wave.js +71 -1
  184. package/dist/cli/handlers/run.d.ts +6 -1
  185. package/dist/cli/handlers/run.d.ts.map +1 -1
  186. package/dist/cli/handlers/run.js +86 -1
  187. package/dist/cli/handlers/scenario.d.ts.map +1 -1
  188. package/dist/cli/handlers/scenario.js +8 -7
  189. package/dist/cli/handlers/search.d.ts +34 -4
  190. package/dist/cli/handlers/search.d.ts.map +1 -1
  191. package/dist/cli/handlers/search.js +216 -36
  192. package/dist/cli/handlers/serve.d.ts.map +1 -1
  193. package/dist/cli/handlers/serve.js +10 -1
  194. package/dist/cli/main.d.ts +11 -1
  195. package/dist/cli/main.d.ts.map +1 -1
  196. package/dist/cli/main.js +179 -14
  197. package/dist/cli/mcp/ledger-tools.d.ts +36 -0
  198. package/dist/cli/mcp/ledger-tools.d.ts.map +1 -0
  199. package/dist/cli/mcp/ledger-tools.js +122 -0
  200. package/dist/cli/mcp/lifecycle-tools.d.ts.map +1 -1
  201. package/dist/cli/mcp/lifecycle-tools.js +3 -2
  202. package/dist/cli/mcp/product-tools.d.ts +78 -0
  203. package/dist/cli/mcp/product-tools.d.ts.map +1 -0
  204. package/dist/cli/mcp/product-tools.js +93 -0
  205. package/dist/cli/mcp/read-only.d.ts +34 -0
  206. package/dist/cli/mcp/read-only.d.ts.map +1 -0
  207. package/dist/cli/mcp/read-only.js +61 -0
  208. package/dist/cli/mcp/report-tools.d.ts +48 -0
  209. package/dist/cli/mcp/report-tools.d.ts.map +1 -0
  210. package/dist/cli/mcp/report-tools.js +128 -0
  211. package/dist/cli/mcp/resource-handlers.d.ts.map +1 -1
  212. package/dist/cli/mcp/resource-handlers.js +4 -3
  213. package/dist/cli/mcp/server.d.ts +28 -1
  214. package/dist/cli/mcp/server.d.ts.map +1 -1
  215. package/dist/cli/mcp/server.js +86 -15
  216. package/dist/cli/mcp/workspace-tools.js +1 -1
  217. package/dist/cli/mcp-config.d.ts +9 -2
  218. package/dist/cli/mcp-config.d.ts.map +1 -1
  219. package/dist/cli/mcp-config.js +8 -3
  220. package/dist/cli/parse-args.d.ts.map +1 -1
  221. package/dist/cli/parse-args.js +112 -5
  222. package/dist/cli/registry.d.ts +54 -1
  223. package/dist/cli/registry.d.ts.map +1 -1
  224. package/dist/cloud-lister/aws.d.ts +35 -0
  225. package/dist/cloud-lister/aws.d.ts.map +1 -0
  226. package/dist/cloud-lister/aws.js +203 -0
  227. package/dist/cloud-lister/azure.d.ts +34 -0
  228. package/dist/cloud-lister/azure.d.ts.map +1 -0
  229. package/dist/cloud-lister/azure.js +129 -0
  230. package/dist/cloud-lister/common.d.ts +40 -0
  231. package/dist/cloud-lister/common.d.ts.map +1 -0
  232. package/dist/cloud-lister/common.js +83 -0
  233. package/dist/cloud-lister/credentials.d.ts +50 -0
  234. package/dist/cloud-lister/credentials.d.ts.map +1 -0
  235. package/dist/cloud-lister/credentials.js +86 -0
  236. package/dist/cloud-lister/fakes.d.ts +27 -0
  237. package/dist/cloud-lister/fakes.d.ts.map +1 -0
  238. package/dist/cloud-lister/fakes.js +50 -0
  239. package/dist/cloud-lister/gcp.d.ts +42 -0
  240. package/dist/cloud-lister/gcp.d.ts.map +1 -0
  241. package/dist/cloud-lister/gcp.js +143 -0
  242. package/dist/cloud-lister/guard.d.ts +49 -0
  243. package/dist/cloud-lister/guard.d.ts.map +1 -0
  244. package/dist/cloud-lister/guard.js +103 -0
  245. package/dist/cloud-lister/ids.d.ts +23 -0
  246. package/dist/cloud-lister/ids.d.ts.map +1 -0
  247. package/dist/cloud-lister/ids.js +42 -0
  248. package/dist/cloud-lister/index.d.ts +67 -0
  249. package/dist/cloud-lister/index.d.ts.map +1 -0
  250. package/dist/cloud-lister/index.js +102 -0
  251. package/dist/cloud-lister/kubernetes.d.ts +64 -0
  252. package/dist/cloud-lister/kubernetes.d.ts.map +1 -0
  253. package/dist/cloud-lister/kubernetes.js +276 -0
  254. package/dist/cloud-lister/markers.d.ts +31 -0
  255. package/dist/cloud-lister/markers.d.ts.map +1 -0
  256. package/dist/cloud-lister/markers.js +73 -0
  257. package/dist/cloud-lister/mask.d.ts +31 -0
  258. package/dist/cloud-lister/mask.d.ts.map +1 -0
  259. package/dist/cloud-lister/mask.js +74 -0
  260. package/dist/cloud-lister/sigv4.d.ts +64 -0
  261. package/dist/cloud-lister/sigv4.d.ts.map +1 -0
  262. package/dist/cloud-lister/sigv4.js +104 -0
  263. package/dist/cloud-lister/transport.d.ts +55 -0
  264. package/dist/cloud-lister/transport.d.ts.map +1 -0
  265. package/dist/cloud-lister/transport.js +86 -0
  266. package/dist/cloud-lister/types.d.ts +121 -0
  267. package/dist/cloud-lister/types.d.ts.map +1 -0
  268. package/dist/cloud-lister/types.js +24 -0
  269. package/dist/components/adoption.d.ts +69 -0
  270. package/dist/components/adoption.d.ts.map +1 -0
  271. package/dist/components/adoption.js +93 -0
  272. package/dist/components/apply-lease.d.ts +19 -0
  273. package/dist/components/apply-lease.d.ts.map +1 -0
  274. package/dist/components/apply-lease.js +41 -0
  275. package/dist/components/capability-plugin-loader.d.ts.map +1 -1
  276. package/dist/components/capability-plugin-loader.js +6 -0
  277. package/dist/components/capability-plugin.d.ts +9 -0
  278. package/dist/components/capability-plugin.d.ts.map +1 -1
  279. package/dist/components/capability.d.ts +337 -5
  280. package/dist/components/capability.d.ts.map +1 -1
  281. package/dist/components/capability.js +14 -6
  282. package/dist/components/check-hooks.d.ts +113 -0
  283. package/dist/components/check-hooks.d.ts.map +1 -0
  284. package/dist/components/check-hooks.js +192 -0
  285. package/dist/components/ci-services.d.ts +57 -0
  286. package/dist/components/ci-services.d.ts.map +1 -0
  287. package/dist/components/ci-services.js +61 -0
  288. package/dist/components/cli-support.d.ts +34 -0
  289. package/dist/components/cli-support.d.ts.map +1 -1
  290. package/dist/components/cli-support.js +67 -15
  291. package/dist/components/declared-reads.d.ts +38 -0
  292. package/dist/components/declared-reads.d.ts.map +1 -0
  293. package/dist/components/declared-reads.js +131 -0
  294. package/dist/components/deploy-units.d.ts.map +1 -1
  295. package/dist/components/deploy-units.js +4 -0
  296. package/dist/components/driver.d.ts +54 -4
  297. package/dist/components/driver.d.ts.map +1 -1
  298. package/dist/components/driver.js +90 -7
  299. package/dist/components/fan-out-run.d.ts +35 -1
  300. package/dist/components/fan-out-run.d.ts.map +1 -1
  301. package/dist/components/fan-out-run.js +138 -30
  302. package/dist/components/fan-out-support.d.ts +6 -0
  303. package/dist/components/fan-out-support.d.ts.map +1 -1
  304. package/dist/components/fan-out-support.js +4 -1
  305. package/dist/components/fan-out.d.ts +28 -0
  306. package/dist/components/fan-out.d.ts.map +1 -1
  307. package/dist/components/groups.d.ts +229 -0
  308. package/dist/components/groups.d.ts.map +1 -0
  309. package/dist/components/groups.js +777 -0
  310. package/dist/components/index.d.ts +6 -2
  311. package/dist/components/index.d.ts.map +1 -1
  312. package/dist/components/index.js +4 -0
  313. package/dist/components/plan-shape-conformance.d.ts +48 -0
  314. package/dist/components/plan-shape-conformance.d.ts.map +1 -0
  315. package/dist/components/plan-shape-conformance.js +122 -0
  316. package/dist/components/pr-env-ledger.d.ts +32 -0
  317. package/dist/components/pr-env-ledger.d.ts.map +1 -0
  318. package/dist/components/pr-env-ledger.js +39 -0
  319. package/dist/components/pr-env-ports.d.ts +12 -0
  320. package/dist/components/pr-env-ports.d.ts.map +1 -1
  321. package/dist/components/pr-env-ports.js +13 -3
  322. package/dist/components/pr-env-run.d.ts +6 -0
  323. package/dist/components/pr-env-run.d.ts.map +1 -1
  324. package/dist/components/pr-env-run.js +3 -2
  325. package/dist/components/pr-environment.d.ts +31 -3
  326. package/dist/components/pr-environment.d.ts.map +1 -1
  327. package/dist/components/pr-environment.js +25 -7
  328. package/dist/components/pr-pipeline.d.ts +169 -3
  329. package/dist/components/pr-pipeline.d.ts.map +1 -1
  330. package/dist/components/pr-pipeline.js +184 -9
  331. package/dist/components/pr-policy.d.ts +26 -2
  332. package/dist/components/pr-policy.d.ts.map +1 -1
  333. package/dist/components/pr-policy.js +41 -7
  334. package/dist/components/pr-run.d.ts +104 -4
  335. package/dist/components/pr-run.d.ts.map +1 -1
  336. package/dist/components/pr-run.js +290 -41
  337. package/dist/components/pr-targets.d.ts +24 -0
  338. package/dist/components/pr-targets.d.ts.map +1 -0
  339. package/dist/components/pr-targets.js +48 -0
  340. package/dist/components/product-pipeline.d.ts +217 -0
  341. package/dist/components/product-pipeline.d.ts.map +1 -0
  342. package/dist/components/product-pipeline.js +193 -0
  343. package/dist/components/promote-rounds.d.ts +9 -0
  344. package/dist/components/promote-rounds.d.ts.map +1 -1
  345. package/dist/components/promote-rounds.js +23 -2
  346. package/dist/components/promote.d.ts +23 -0
  347. package/dist/components/promote.d.ts.map +1 -1
  348. package/dist/components/promote.js +39 -6
  349. package/dist/components/release-compile.d.ts +22 -1
  350. package/dist/components/release-compile.d.ts.map +1 -1
  351. package/dist/components/release-compile.js +85 -0
  352. package/dist/components/release-gate.d.ts +23 -1
  353. package/dist/components/release-gate.d.ts.map +1 -1
  354. package/dist/components/release-gate.js +97 -33
  355. package/dist/components/release-promote.d.ts +15 -1
  356. package/dist/components/release-promote.d.ts.map +1 -1
  357. package/dist/components/release-promote.js +67 -2
  358. package/dist/components/repo-lock.d.ts +27 -0
  359. package/dist/components/repo-lock.d.ts.map +1 -0
  360. package/dist/components/repo-lock.js +49 -0
  361. package/dist/components/row-lease.d.ts +84 -0
  362. package/dist/components/row-lease.d.ts.map +1 -0
  363. package/dist/components/row-lease.js +110 -0
  364. package/dist/components/run-groups.d.ts +58 -0
  365. package/dist/components/run-groups.d.ts.map +1 -0
  366. package/dist/components/run-groups.js +78 -0
  367. package/dist/components/starter-plugin.d.ts +1 -0
  368. package/dist/components/starter-plugin.d.ts.map +1 -1
  369. package/dist/components/starter-plugin.js +6 -1
  370. package/dist/components/verbs/index.d.ts +1 -0
  371. package/dist/components/verbs/index.d.ts.map +1 -1
  372. package/dist/components/verbs/index.js +1 -0
  373. package/dist/components/verbs/member-outputs.d.ts +187 -0
  374. package/dist/components/verbs/member-outputs.d.ts.map +1 -0
  375. package/dist/components/verbs/member-outputs.js +218 -0
  376. package/dist/components/wave-plan.d.ts +34 -0
  377. package/dist/components/wave-plan.d.ts.map +1 -1
  378. package/dist/components/wave-plan.js +54 -2
  379. package/dist/config.d.ts +60 -0
  380. package/dist/config.d.ts.map +1 -1
  381. package/dist/config.js +27 -0
  382. package/dist/control/applied.d.ts +89 -0
  383. package/dist/control/applied.d.ts.map +1 -0
  384. package/dist/control/applied.js +175 -0
  385. package/dist/control/consumers.d.ts +78 -0
  386. package/dist/control/consumers.d.ts.map +1 -0
  387. package/dist/control/consumers.js +172 -0
  388. package/dist/control/dispatch.d.ts +334 -0
  389. package/dist/control/dispatch.d.ts.map +1 -0
  390. package/dist/control/dispatch.js +519 -0
  391. package/dist/control/edges.d.ts +75 -0
  392. package/dist/control/edges.d.ts.map +1 -0
  393. package/dist/control/edges.js +133 -0
  394. package/dist/control/reconcile.d.ts +120 -0
  395. package/dist/control/reconcile.d.ts.map +1 -0
  396. package/dist/control/reconcile.js +178 -0
  397. package/dist/control/records.d.ts +187 -0
  398. package/dist/control/records.d.ts.map +1 -0
  399. package/dist/control/records.js +307 -0
  400. package/dist/deep-observation.d.ts +1 -13
  401. package/dist/deep-observation.d.ts.map +1 -1
  402. package/dist/deep-observation.js +5 -22
  403. package/dist/discovery/sandbox/bundle.d.ts.map +1 -1
  404. package/dist/discovery/sandbox/bundle.js +25 -1
  405. package/dist/drift-record.d.ts +542 -0
  406. package/dist/drift-record.d.ts.map +1 -0
  407. package/dist/drift-record.js +886 -0
  408. package/dist/engine-facts.d.ts +144 -0
  409. package/dist/engine-facts.d.ts.map +1 -0
  410. package/dist/engine-facts.js +13 -0
  411. package/dist/exit-codes.d.ts +48 -0
  412. package/dist/exit-codes.d.ts.map +1 -0
  413. package/dist/exit-codes.js +49 -0
  414. package/dist/forge-check/check.d.ts +63 -0
  415. package/dist/forge-check/check.d.ts.map +1 -0
  416. package/dist/forge-check/check.js +139 -0
  417. package/dist/forge-check/contract.d.ts +152 -0
  418. package/dist/forge-check/contract.d.ts.map +1 -0
  419. package/dist/forge-check/contract.js +118 -0
  420. package/dist/forge-check/forge.d.ts +42 -0
  421. package/dist/forge-check/forge.d.ts.map +1 -0
  422. package/dist/forge-check/forge.js +338 -0
  423. package/dist/forge-check/index.d.ts +24 -0
  424. package/dist/forge-check/index.d.ts.map +1 -0
  425. package/dist/forge-check/index.js +23 -0
  426. package/dist/forge-check/pulumi.d.ts +44 -0
  427. package/dist/forge-check/pulumi.d.ts.map +1 -0
  428. package/dist/forge-check/pulumi.js +184 -0
  429. package/dist/forge-check/read-only.d.ts +26 -0
  430. package/dist/forge-check/read-only.d.ts.map +1 -0
  431. package/dist/forge-check/read-only.js +53 -0
  432. package/dist/forge-check/trust.d.ts +94 -0
  433. package/dist/forge-check/trust.d.ts.map +1 -0
  434. package/dist/forge-check/trust.js +532 -0
  435. package/dist/forge-check/types.d.ts +80 -0
  436. package/dist/forge-check/types.d.ts.map +1 -0
  437. package/dist/forge-check/types.js +18 -0
  438. package/dist/forge-check.d.ts +6 -0
  439. package/dist/forge-check.d.ts.map +1 -0
  440. package/dist/forge-check.js +5 -0
  441. package/dist/gate-decision.d.ts +1 -0
  442. package/dist/gate-decision.d.ts.map +1 -1
  443. package/dist/gate-decision.js +2 -0
  444. package/dist/gate-policy.d.ts +47 -1
  445. package/dist/gate-policy.d.ts.map +1 -1
  446. package/dist/gate-policy.js +50 -2
  447. package/dist/graph-ir.d.ts +153 -2
  448. package/dist/graph-ir.d.ts.map +1 -1
  449. package/dist/graph-ir.js +224 -6
  450. package/dist/graph-refs.d.ts +145 -0
  451. package/dist/graph-refs.d.ts.map +1 -1
  452. package/dist/graph-refs.js +305 -0
  453. package/dist/graph-schema/fixtures/adopt.json +15 -0
  454. package/dist/graph-schema/fixtures/choudoufu.engine-graph.json +169 -0
  455. package/dist/graph-schema/fixtures/index.json +68 -0
  456. package/dist/graph-schema/fixtures/plunge.engine-graph.json +158 -0
  457. package/dist/graph-schema/fixtures.d.ts +23 -0
  458. package/dist/graph-schema/fixtures.d.ts.map +1 -0
  459. package/dist/graph-schema/fixtures.js +246 -0
  460. package/dist/graph-schema/generate.d.ts +15 -0
  461. package/dist/graph-schema/generate.d.ts.map +1 -0
  462. package/dist/graph-schema/generate.js +267 -0
  463. package/dist/graph-schema/graph.schema.json +1387 -0
  464. package/dist/health.schema.json +2 -1
  465. package/dist/identity.d.ts.map +1 -1
  466. package/dist/identity.js +2 -0
  467. package/dist/index.d.ts +2 -0
  468. package/dist/index.d.ts.map +1 -1
  469. package/dist/index.js +4 -0
  470. package/dist/instance-nodes.d.ts +159 -0
  471. package/dist/instance-nodes.d.ts.map +1 -0
  472. package/dist/instance-nodes.js +231 -0
  473. package/dist/lexicon.d.ts +178 -6
  474. package/dist/lexicon.d.ts.map +1 -1
  475. package/dist/lifecycle/adoption-file.d.ts +80 -0
  476. package/dist/lifecycle/adoption-file.d.ts.map +1 -0
  477. package/dist/lifecycle/adoption-file.js +122 -0
  478. package/dist/lifecycle/cloud-index.d.ts +186 -0
  479. package/dist/lifecycle/cloud-index.d.ts.map +1 -0
  480. package/dist/lifecycle/cloud-index.js +617 -0
  481. package/dist/lifecycle/derive-edges.d.ts +59 -0
  482. package/dist/lifecycle/derive-edges.d.ts.map +1 -0
  483. package/dist/lifecycle/derive-edges.js +126 -0
  484. package/dist/lifecycle/gate-applied.d.ts +6 -0
  485. package/dist/lifecycle/gate-applied.d.ts.map +1 -1
  486. package/dist/lifecycle/gate-ledger.d.ts +29 -0
  487. package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
  488. package/dist/lifecycle/gate-ledger.js +11 -1
  489. package/dist/lifecycle/gate-pending-by-plan.d.ts +75 -0
  490. package/dist/lifecycle/gate-pending-by-plan.d.ts.map +1 -0
  491. package/dist/lifecycle/gate-pending-by-plan.js +96 -0
  492. package/dist/lifecycle/gated-request-digest.d.ts +28 -0
  493. package/dist/lifecycle/gated-request-digest.d.ts.map +1 -0
  494. package/dist/lifecycle/gated-request-digest.js +35 -0
  495. package/dist/lifecycle/gated-request.d.ts +126 -0
  496. package/dist/lifecycle/gated-request.d.ts.map +1 -0
  497. package/dist/lifecycle/gated-request.js +205 -0
  498. package/dist/lifecycle/git.d.ts +10 -9
  499. package/dist/lifecycle/git.d.ts.map +1 -1
  500. package/dist/lifecycle/git.js +7 -1
  501. package/dist/lifecycle/identity-match.d.ts +148 -0
  502. package/dist/lifecycle/identity-match.d.ts.map +1 -0
  503. package/dist/lifecycle/identity-match.js +152 -0
  504. package/dist/lifecycle/index-diff.d.ts +264 -0
  505. package/dist/lifecycle/index-diff.d.ts.map +1 -0
  506. package/dist/lifecycle/index-diff.js +326 -0
  507. package/dist/lifecycle/index-document.d.ts +130 -0
  508. package/dist/lifecycle/index-document.d.ts.map +1 -0
  509. package/dist/lifecycle/index-document.js +188 -0
  510. package/dist/lifecycle/index-drift.d.ts +121 -0
  511. package/dist/lifecycle/index-drift.d.ts.map +1 -0
  512. package/dist/lifecycle/index-drift.js +178 -0
  513. package/dist/lifecycle/index-import.d.ts +171 -0
  514. package/dist/lifecycle/index-import.d.ts.map +1 -0
  515. package/dist/lifecycle/index-import.js +512 -0
  516. package/dist/lifecycle/index-join.d.ts +129 -0
  517. package/dist/lifecycle/index-join.d.ts.map +1 -0
  518. package/dist/lifecycle/index-join.js +248 -0
  519. package/dist/lifecycle/index.d.ts +4 -0
  520. package/dist/lifecycle/index.d.ts.map +1 -1
  521. package/dist/lifecycle/index.js +4 -0
  522. package/dist/lifecycle/ledger-read.d.ts.map +1 -1
  523. package/dist/lifecycle/ledger-read.js +7 -3
  524. package/dist/lifecycle/lock-rows.d.ts +76 -0
  525. package/dist/lifecycle/lock-rows.d.ts.map +1 -0
  526. package/dist/lifecycle/lock-rows.js +140 -0
  527. package/dist/lifecycle/observation-baseline.d.ts +61 -21
  528. package/dist/lifecycle/observation-baseline.d.ts.map +1 -1
  529. package/dist/lifecycle/observation-baseline.js +144 -19
  530. package/dist/lifecycle/observe.d.ts.map +1 -1
  531. package/dist/lifecycle/observe.js +6 -1
  532. package/dist/lifecycle/query.d.ts +94 -6
  533. package/dist/lifecycle/query.d.ts.map +1 -1
  534. package/dist/lifecycle/query.js +182 -9
  535. package/dist/lifecycle/release-catalog-site.d.ts +66 -0
  536. package/dist/lifecycle/release-catalog-site.d.ts.map +1 -0
  537. package/dist/lifecycle/release-catalog-site.js +232 -0
  538. package/dist/lifecycle/release-catalog.d.ts +201 -0
  539. package/dist/lifecycle/release-catalog.d.ts.map +1 -0
  540. package/dist/lifecycle/release-catalog.js +198 -0
  541. package/dist/lifecycle/release-changelog.d.ts +41 -0
  542. package/dist/lifecycle/release-changelog.d.ts.map +1 -0
  543. package/dist/lifecycle/release-changelog.js +38 -0
  544. package/dist/lifecycle/release-cut.d.ts +1 -0
  545. package/dist/lifecycle/release-cut.d.ts.map +1 -1
  546. package/dist/lifecycle/release-cut.js +1 -1
  547. package/dist/lifecycle/release-ledger.d.ts +16 -0
  548. package/dist/lifecycle/release-ledger.d.ts.map +1 -1
  549. package/dist/lifecycle/release-ledger.js +10 -0
  550. package/dist/lifecycle/release-publish.d.ts +43 -22
  551. package/dist/lifecycle/release-publish.d.ts.map +1 -1
  552. package/dist/lifecycle/release-read.d.ts.map +1 -1
  553. package/dist/lifecycle/release-read.js +3 -0
  554. package/dist/lifecycle/release-status.d.ts +86 -0
  555. package/dist/lifecycle/release-status.d.ts.map +1 -0
  556. package/dist/lifecycle/release-status.js +136 -0
  557. package/dist/lifecycle/replay.d.ts +10 -3
  558. package/dist/lifecycle/replay.d.ts.map +1 -1
  559. package/dist/lifecycle/replay.js +10 -6
  560. package/dist/lifecycle/resource-lock.d.ts +120 -0
  561. package/dist/lifecycle/resource-lock.d.ts.map +1 -0
  562. package/dist/lifecycle/resource-lock.js +317 -0
  563. package/dist/lifecycle/retention.d.ts.map +1 -1
  564. package/dist/lifecycle/retention.js +3 -0
  565. package/dist/lifecycle/run-ledger.d.ts.map +1 -1
  566. package/dist/lifecycle/run-ledger.js +9 -1
  567. package/dist/lifecycle/scenario.d.ts +4 -3
  568. package/dist/lifecycle/scenario.d.ts.map +1 -1
  569. package/dist/lifecycle/snapshot-store-fake.d.ts +9 -0
  570. package/dist/lifecycle/snapshot-store-fake.d.ts.map +1 -0
  571. package/dist/lifecycle/snapshot-store-fake.js +21 -0
  572. package/dist/lifecycle/snapshot-store-s3.d.ts +135 -0
  573. package/dist/lifecycle/snapshot-store-s3.d.ts.map +1 -0
  574. package/dist/lifecycle/snapshot-store-s3.js +219 -0
  575. package/dist/lifecycle/snapshot-store.d.ts +170 -0
  576. package/dist/lifecycle/snapshot-store.d.ts.map +1 -0
  577. package/dist/lifecycle/snapshot-store.js +831 -0
  578. package/dist/lifecycle/snapshot.d.ts +11 -0
  579. package/dist/lifecycle/snapshot.d.ts.map +1 -1
  580. package/dist/lifecycle/snapshot.js +18 -5
  581. package/dist/lifecycle/target-lock.d.ts +15 -0
  582. package/dist/lifecycle/target-lock.d.ts.map +1 -1
  583. package/dist/lifecycle/target-lock.js +25 -10
  584. package/dist/lifecycle/type-listing.d.ts +148 -0
  585. package/dist/lifecycle/type-listing.d.ts.map +1 -0
  586. package/dist/lifecycle/type-listing.js +166 -0
  587. package/dist/lint/component-checks.d.ts +15 -1
  588. package/dist/lint/component-checks.d.ts.map +1 -1
  589. package/dist/lint/component-checks.js +1 -0
  590. package/dist/lint/presets/relaxed.json +2 -1
  591. package/dist/lint/presets/strict.json +2 -1
  592. package/dist/lint/rules/__fixtures__/comp/comp008/fail/dns.component.d.ts +4 -0
  593. package/dist/lint/rules/__fixtures__/comp/comp008/fail/dns.component.d.ts.map +1 -0
  594. package/dist/lint/rules/__fixtures__/comp/comp008/fail/dns.component.js +13 -0
  595. package/dist/lint/rules/__fixtures__/comp/comp008/pass/dns.component.d.ts +4 -0
  596. package/dist/lint/rules/__fixtures__/comp/comp008/pass/dns.component.d.ts.map +1 -0
  597. package/dist/lint/rules/__fixtures__/comp/comp008/pass/dns.component.js +8 -0
  598. package/dist/lint/rules/comp/comp008-applies-signal-only-root.d.ts +33 -0
  599. package/dist/lint/rules/comp/comp008-applies-signal-only-root.d.ts.map +1 -0
  600. package/dist/lint/rules/comp/comp008-applies-signal-only-root.js +123 -0
  601. package/dist/lint/rules/comp/index.d.ts +2 -1
  602. package/dist/lint/rules/comp/index.d.ts.map +1 -1
  603. package/dist/lint/rules/comp/index.js +4 -1
  604. package/dist/mcp/types.d.ts +7 -0
  605. package/dist/mcp/types.d.ts.map +1 -1
  606. package/dist/notify-product.d.ts +43 -0
  607. package/dist/notify-product.d.ts.map +1 -0
  608. package/dist/notify-product.js +58 -0
  609. package/dist/notify-relay.d.ts +197 -0
  610. package/dist/notify-relay.d.ts.map +1 -0
  611. package/dist/notify-relay.js +321 -0
  612. package/dist/notify.d.ts +44 -4
  613. package/dist/notify.d.ts.map +1 -1
  614. package/dist/notify.js +77 -14
  615. package/dist/object-store/azure-blob.d.ts +129 -0
  616. package/dist/object-store/azure-blob.d.ts.map +1 -0
  617. package/dist/object-store/azure-blob.js +341 -0
  618. package/dist/object-store/common.d.ts +108 -0
  619. package/dist/object-store/common.d.ts.map +1 -0
  620. package/dist/object-store/common.js +80 -0
  621. package/dist/object-store/errors.d.ts +28 -0
  622. package/dist/object-store/errors.d.ts.map +1 -0
  623. package/dist/object-store/errors.js +21 -0
  624. package/dist/object-store/from-env.d.ts +18 -0
  625. package/dist/object-store/from-env.d.ts.map +1 -0
  626. package/dist/object-store/from-env.js +22 -0
  627. package/dist/object-store/gcs.d.ts +106 -0
  628. package/dist/object-store/gcs.d.ts.map +1 -0
  629. package/dist/object-store/gcs.js +393 -0
  630. package/dist/object-store/index.d.ts +9 -0
  631. package/dist/object-store/index.d.ts.map +1 -0
  632. package/dist/object-store/index.js +8 -0
  633. package/dist/object-store/s3.d.ts +146 -0
  634. package/dist/object-store/s3.d.ts.map +1 -0
  635. package/dist/object-store/s3.js +306 -0
  636. package/dist/observation.d.ts +19 -2
  637. package/dist/observation.d.ts.map +1 -1
  638. package/dist/observation.js +18 -1
  639. package/dist/op/activities/activity-contracts.d.ts +1 -1
  640. package/dist/op/activities/activity-contracts.js +1 -1
  641. package/dist/op/activities/change-set.d.ts +6 -4
  642. package/dist/op/activities/change-set.d.ts.map +1 -1
  643. package/dist/op/activities/change-set.js +4 -2
  644. package/dist/op/activities/converge.d.ts.map +1 -1
  645. package/dist/op/activities/converge.js +2 -1
  646. package/dist/op/activities/index.d.ts +1 -1
  647. package/dist/op/activities/index.d.ts.map +1 -1
  648. package/dist/op/activities/index.js +1 -1
  649. package/dist/op/activities/review-agent.d.ts +55 -2
  650. package/dist/op/activities/review-agent.d.ts.map +1 -1
  651. package/dist/op/activities/review-agent.js +65 -5
  652. package/dist/op/activity-failure.d.ts +27 -0
  653. package/dist/op/activity-failure.d.ts.map +1 -1
  654. package/dist/op/activity-failure.js +31 -0
  655. package/dist/op/gate.d.ts +29 -1
  656. package/dist/op/gate.d.ts.map +1 -1
  657. package/dist/op/gate.js +59 -23
  658. package/dist/op/generate-pipeline.d.ts.map +1 -1
  659. package/dist/op/generate-pipeline.js +7 -1
  660. package/dist/op/index.d.ts +14 -2
  661. package/dist/op/index.d.ts.map +1 -1
  662. package/dist/op/index.js +8 -2
  663. package/dist/op/local-executor.d.ts +5 -1
  664. package/dist/op/local-executor.d.ts.map +1 -1
  665. package/dist/op/local-executor.js +22 -8
  666. package/dist/op/op-waves-after-plan.d.ts +137 -0
  667. package/dist/op/op-waves-after-plan.d.ts.map +1 -0
  668. package/dist/op/op-waves-after-plan.js +163 -0
  669. package/dist/op/op-waves-capability-spec.d.ts +55 -0
  670. package/dist/op/op-waves-capability-spec.d.ts.map +1 -0
  671. package/dist/op/op-waves-capability-spec.js +94 -0
  672. package/dist/op/op-waves-capability.d.ts +197 -0
  673. package/dist/op/op-waves-capability.d.ts.map +1 -0
  674. package/dist/op/op-waves-capability.js +311 -0
  675. package/dist/op/op-waves-events.d.ts +54 -0
  676. package/dist/op/op-waves-events.d.ts.map +1 -0
  677. package/dist/op/op-waves-events.js +122 -0
  678. package/dist/op/op-waves-notify.d.ts +7 -1
  679. package/dist/op/op-waves-notify.d.ts.map +1 -1
  680. package/dist/op/op-waves-notify.js +35 -16
  681. package/dist/op/op-waves-release-port.d.ts +18 -0
  682. package/dist/op/op-waves-release-port.d.ts.map +1 -0
  683. package/dist/op/op-waves-release-port.js +61 -0
  684. package/dist/op/op-waves-release.d.ts +92 -0
  685. package/dist/op/op-waves-release.d.ts.map +1 -0
  686. package/dist/op/op-waves-release.js +97 -0
  687. package/dist/op/op-waves-run.d.ts +175 -4
  688. package/dist/op/op-waves-run.d.ts.map +1 -1
  689. package/dist/op/op-waves-run.js +981 -41
  690. package/dist/op/op-waves-stand-down.d.ts +60 -0
  691. package/dist/op/op-waves-stand-down.d.ts.map +1 -0
  692. package/dist/op/op-waves-stand-down.js +97 -0
  693. package/dist/op/op-waves.d.ts +152 -8
  694. package/dist/op/op-waves.d.ts.map +1 -1
  695. package/dist/op/op-waves.js +161 -17
  696. package/dist/op/runtime.d.ts +91 -0
  697. package/dist/op/runtime.d.ts.map +1 -1
  698. package/dist/op/runtime.js +19 -0
  699. package/dist/op/stage-hooks.d.ts +45 -7
  700. package/dist/op/stage-hooks.d.ts.map +1 -1
  701. package/dist/op/stage-hooks.js +61 -3
  702. package/dist/op/steward-beside.d.ts.map +1 -1
  703. package/dist/op/steward-beside.js +2 -1
  704. package/dist/op/types.d.ts +2 -2
  705. package/dist/op/types.d.ts.map +1 -1
  706. package/dist/op/types.js +3 -2
  707. package/dist/otlp-metrics.d.ts +38 -0
  708. package/dist/otlp-metrics.d.ts.map +1 -0
  709. package/dist/otlp-metrics.js +82 -0
  710. package/dist/otlp.d.ts +249 -0
  711. package/dist/otlp.d.ts.map +1 -0
  712. package/dist/otlp.js +426 -0
  713. package/dist/override-gate.d.ts.map +1 -1
  714. package/dist/override-gate.js +5 -0
  715. package/dist/policy-packs.d.ts +69 -0
  716. package/dist/policy-packs.d.ts.map +1 -0
  717. package/dist/policy-packs.js +205 -0
  718. package/dist/policy-source.d.ts +51 -0
  719. package/dist/policy-source.d.ts.map +1 -0
  720. package/dist/policy-source.js +103 -0
  721. package/dist/pr-forge.d.ts +40 -0
  722. package/dist/pr-forge.d.ts.map +1 -1
  723. package/dist/pr-forge.js +92 -0
  724. package/dist/pr-loop.d.ts +205 -12
  725. package/dist/pr-loop.d.ts.map +1 -1
  726. package/dist/pr-loop.js +330 -41
  727. package/dist/pr-post.d.ts +16 -0
  728. package/dist/pr-post.d.ts.map +1 -1
  729. package/dist/pr-post.js +26 -1
  730. package/dist/pr-report-url.d.ts +32 -4
  731. package/dist/pr-report-url.d.ts.map +1 -1
  732. package/dist/pr-report-url.js +46 -5
  733. package/dist/pr-requires.d.ts +13 -2
  734. package/dist/pr-requires.d.ts.map +1 -1
  735. package/dist/pr-requires.js +14 -0
  736. package/dist/pulumi-urn.d.ts +101 -0
  737. package/dist/pulumi-urn.d.ts.map +1 -0
  738. package/dist/pulumi-urn.js +131 -0
  739. package/dist/release-floors.d.ts +23 -0
  740. package/dist/release-floors.d.ts.map +1 -0
  741. package/dist/release-floors.js +22 -0
  742. package/dist/run-event.d.ts +26 -1
  743. package/dist/run-event.d.ts.map +1 -1
  744. package/dist/run-event.js +4 -1
  745. package/dist/sensitive-key.d.ts +23 -0
  746. package/dist/sensitive-key.d.ts.map +1 -0
  747. package/dist/sensitive-key.js +31 -0
  748. package/dist/sorted-json.d.ts +10 -0
  749. package/dist/sorted-json.d.ts.map +1 -0
  750. package/dist/sorted-json.js +14 -0
  751. package/dist/terraform/credentials.d.ts +59 -0
  752. package/dist/terraform/credentials.d.ts.map +1 -0
  753. package/dist/terraform/credentials.js +149 -0
  754. package/dist/utils.d.ts +1 -4
  755. package/dist/utils.d.ts.map +1 -1
  756. package/dist/utils.js +1 -9
  757. package/dist/wave-runtime.d.ts +1 -1
  758. package/dist/wave-runtime.js +2 -2
  759. package/dist/wave-runtime.mjs +390 -285
  760. package/dist/workspace/adoption-report.d.ts +53 -0
  761. package/dist/workspace/adoption-report.d.ts.map +1 -0
  762. package/dist/workspace/adoption-report.js +76 -0
  763. package/dist/workspace/capabilities-contract.d.ts +7 -0
  764. package/dist/workspace/capabilities-contract.d.ts.map +1 -1
  765. package/dist/workspace/capabilities-contract.js +2 -1
  766. package/dist/workspace/capabilities.schema.json +98 -0
  767. package/dist/workspace/change-set.schema.json +42 -3
  768. package/dist/workspace/chant-migrations/chud-lexicon-exit.d.ts.map +1 -1
  769. package/dist/workspace/chant-migrations/chud-lexicon-exit.js +4 -1
  770. package/dist/workspace/ci-cloud-identity.d.ts +13 -1
  771. package/dist/workspace/ci-cloud-identity.d.ts.map +1 -1
  772. package/dist/workspace/ci-cloud-identity.js +30 -1
  773. package/dist/workspace/ci-lock-grain.d.ts +12 -0
  774. package/dist/workspace/ci-lock-grain.d.ts.map +1 -0
  775. package/dist/workspace/ci-lock-grain.js +27 -0
  776. package/dist/workspace/ci-run.d.ts +2 -1
  777. package/dist/workspace/ci-run.d.ts.map +1 -1
  778. package/dist/workspace/ci-run.js +6 -3
  779. package/dist/workspace/compose-graph.d.ts +10 -1
  780. package/dist/workspace/compose-graph.d.ts.map +1 -1
  781. package/dist/workspace/compose-graph.js +6 -1
  782. package/dist/workspace/conformance/index.d.ts +1 -1
  783. package/dist/workspace/conformance/index.d.ts.map +1 -1
  784. package/dist/workspace/conformance/index.js +6 -1
  785. package/dist/workspace/declaration.d.ts +16 -4
  786. package/dist/workspace/declaration.d.ts.map +1 -1
  787. package/dist/workspace/declaration.js +5 -2
  788. package/dist/workspace/declaration.schema.json +27 -3
  789. package/dist/workspace/drift-cli.d.ts +81 -0
  790. package/dist/workspace/drift-cli.d.ts.map +1 -0
  791. package/dist/workspace/drift-cli.js +322 -0
  792. package/dist/workspace/drift.schema.json +672 -0
  793. package/dist/workspace/exit-cli.d.ts +1 -1
  794. package/dist/workspace/exit-cli.d.ts.map +1 -1
  795. package/dist/workspace/exit-cli.js +2 -1
  796. package/dist/workspace/graph-cli.d.ts +2 -0
  797. package/dist/workspace/graph-cli.d.ts.map +1 -1
  798. package/dist/workspace/graph-cli.js +3 -0
  799. package/dist/workspace/graph.schema.json +72 -0
  800. package/dist/workspace/import-fetch.d.ts +4 -2
  801. package/dist/workspace/import-fetch.d.ts.map +1 -1
  802. package/dist/workspace/import-fetch.js +4 -2
  803. package/dist/workspace/import-init.d.ts.map +1 -1
  804. package/dist/workspace/import-init.js +4 -2
  805. package/dist/workspace/init.d.ts +5 -1
  806. package/dist/workspace/init.d.ts.map +1 -1
  807. package/dist/workspace/init.js +55 -9
  808. package/dist/workspace/ledger.schema.json +7 -3
  809. package/dist/workspace/lineage-upgrade-cli.d.ts +1 -1
  810. package/dist/workspace/lineage-upgrade-cli.d.ts.map +1 -1
  811. package/dist/workspace/lineage-upgrade-cli.js +2 -1
  812. package/dist/workspace/nested-graph.d.ts.map +1 -1
  813. package/dist/workspace/nested-graph.js +2 -0
  814. package/dist/workspace/pr-report.schema.json +125 -5
  815. package/dist/workspace/promote-waves.d.ts +112 -0
  816. package/dist/workspace/promote-waves.d.ts.map +1 -0
  817. package/dist/workspace/promote-waves.js +290 -0
  818. package/dist/workspace/promote.d.ts +85 -3
  819. package/dist/workspace/promote.d.ts.map +1 -1
  820. package/dist/workspace/promote.js +349 -62
  821. package/dist/workspace/reason-codes.d.ts +12 -0
  822. package/dist/workspace/reason-codes.d.ts.map +1 -1
  823. package/dist/workspace/reason-codes.js +14 -0
  824. package/dist/workspace/records-cli.d.ts +2 -2
  825. package/dist/workspace/records-cli.d.ts.map +1 -1
  826. package/dist/workspace/records-cli.js +3 -2
  827. package/dist/workspace/release-catalog.schema.json +277 -0
  828. package/dist/workspace/run-event.schema.json +18 -1
  829. package/dist/workspace/search-contract.d.ts +3 -3
  830. package/dist/workspace/search-contract.d.ts.map +1 -1
  831. package/dist/workspace/search-contract.js +2 -0
  832. package/dist/workspace/search.schema.json +103 -5
  833. package/dist/workspace/work-cli.d.ts +3 -1
  834. package/dist/workspace/work-cli.d.ts.map +1 -1
  835. package/dist/workspace/work-cli.js +7 -2
  836. package/dist/workspace/workspace-run.d.ts.map +1 -1
  837. package/dist/workspace/workspace-run.js +2 -1
  838. package/package.json +34 -1
  839. package/src/__fixtures__/drift-record/README.md +58 -0
  840. package/src/__fixtures__/drift-record/choudoufu-cone.ndjson +4 -0
  841. package/src/__fixtures__/drift-record/choudoufu-resource.ndjson +3 -0
  842. package/src/__fixtures__/drift-record/component-status-ledger.json +65 -0
  843. package/src/__fixtures__/drift-record/component-status.json +91 -0
  844. package/src/__fixtures__/drift-record/deep-diff.json +259 -0
  845. package/src/__fixtures__/drift-record/lifecycle-diff-live.json +825 -0
  846. package/src/__fixtures__/drift-record/live-diff.json +125 -0
  847. package/src/__fixtures__/estate-ledger.ts +101 -0
  848. package/src/__fixtures__/oidc-emulator.ts +31 -2
  849. package/src/__fixtures__/product-words.ts +44 -0
  850. package/src/__golden__/wave-loop/op-by-apply-after-fails.json +10 -2
  851. package/src/__golden__/wave-loop/op-by-apply-hold.json +20 -4
  852. package/src/__golden__/wave-loop/op-by-apply-ignored.json +10 -2
  853. package/src/__golden__/wave-loop/op-by-apply-pass.json +10 -2
  854. package/src/__golden__/wave-loop/op-by-apply-skip.json +10 -2
  855. package/src/__golden__/wave-loop/op-discover-rest-stops.json +22 -6
  856. package/src/__golden__/wave-loop/op-discover-rest.json +44 -12
  857. package/src/__golden__/wave-loop/op-discover-wide.json +12 -3
  858. package/src/__golden__/wave-loop/op-held-on.json +28 -7
  859. package/src/__golden__/wave-loop/op-hooks-apply-fails.json +22 -6
  860. package/src/__golden__/wave-loop/op-hooks-fail-after-apply.json +22 -6
  861. package/src/__golden__/wave-loop/op-hooks-fail-before-apply.json +4 -2
  862. package/src/__golden__/wave-loop/op-hooks-held.json +26 -8
  863. package/src/__golden__/wave-loop/op-hooks-hold-before-apply.json +18 -4
  864. package/src/__golden__/wave-loop/op-hooks-pass.json +22 -6
  865. package/src/__golden__/wave-loop/op-hooks-share.json +20 -7
  866. package/src/__golden__/wave-loop/op-outcome-held.json +12 -3
  867. package/src/__golden__/wave-loop/op-outcome-replan-approved.json +16 -5
  868. package/src/__golden__/wave-loop/op-outcome-replan-forever.json +48 -21
  869. package/src/__golden__/wave-loop/op-outcome-replan.json +16 -5
  870. package/src/__golden__/wave-loop/op-outcome-stood-down.json +12 -3
  871. package/src/__golden__/wave-loop/op-outcome-unreadable.json +12 -3
  872. package/src/__golden__/wave-loop/op-overridden.json +28 -7
  873. package/src/__golden__/wave-loop/op-per-run.json +20 -4
  874. package/src/__golden__/wave-loop/op-point.json +18 -4
  875. package/src/__golden__/wave-loop/op-pr-review.json +10 -2
  876. package/src/__golden__/wave-loop/op-spend-change-only.json +10 -2
  877. package/src/__golden__/wave-loop/op-spend.json +10 -2
  878. package/src/__golden__/wave-loop/op-wave-commands.json +56 -13
  879. package/src/__golden__/wave-loop/op-wide.json +20 -4
  880. package/src/audit/discover.e2e.test.ts +14 -0
  881. package/src/audit/discover.ts +3 -1
  882. package/src/behaviour.ts +1 -1
  883. package/src/bucket-check/azure.ts +307 -0
  884. package/src/bucket-check/bucket-check.test.ts +210 -0
  885. package/src/bucket-check/fixtures/azure.json +153 -0
  886. package/src/bucket-check/fixtures/gcs.json +148 -0
  887. package/src/bucket-check/fixtures/s3.json +277 -0
  888. package/src/bucket-check/gcs.ts +257 -0
  889. package/src/bucket-check/index.ts +61 -0
  890. package/src/bucket-check/s3.ts +433 -0
  891. package/src/bucket-check/types.ts +75 -0
  892. package/src/bucket-check/wire.ts +50 -0
  893. package/src/bucket-check.ts +5 -0
  894. package/src/capabilities/templates.json +145 -0
  895. package/src/capabilities/templates.test.ts +211 -0
  896. package/src/capabilities/templates.ts +203 -0
  897. package/src/cdk/advise.test.ts +1 -1
  898. package/src/change-set-bundle.test.ts +82 -0
  899. package/src/change-set-graph.ts +80 -9
  900. package/src/change-set.test.ts +24 -0
  901. package/src/change-set.ts +76 -14
  902. package/src/ci-agent.test.ts +348 -0
  903. package/src/ci-agent.ts +1026 -0
  904. package/src/ci-control.ts +174 -0
  905. package/src/ci-estate/delivery.ts +433 -0
  906. package/src/ci-estate/overdue.ts +81 -0
  907. package/src/ci-estate/page.ts +343 -0
  908. package/src/ci-estate/rows.ts +251 -0
  909. package/src/ci-estate.test.ts +281 -0
  910. package/src/ci-estate.ts +176 -0
  911. package/src/ci-handover.ts +67 -16
  912. package/src/ci-identity-database.test.ts +55 -0
  913. package/src/ci-identity-pulumi.test.ts +163 -0
  914. package/src/ci-identity-targets.test.ts +29 -2
  915. package/src/ci-identity.ts +134 -26
  916. package/src/ci-product-words.test.ts +101 -0
  917. package/src/ci-product-words.ts +536 -0
  918. package/src/ci-product.ts +174 -0
  919. package/src/ci-shared-reads.test.ts +145 -0
  920. package/src/cli/commands/audit.test.ts +1 -1
  921. package/src/cli/commands/audit.ts +3 -2
  922. package/src/cli/commands/carve.test.ts +1 -1
  923. package/src/cli/commands/carve.ts +2 -2
  924. package/src/cli/commands/import-index.test.ts +117 -0
  925. package/src/cli/commands/import-index.ts +265 -0
  926. package/src/cli/commands/init.ts +3 -1
  927. package/src/cli/commands/lint.ts +4 -2
  928. package/src/cli/component-wave-args.test.ts +16 -0
  929. package/src/cli/handlers/agent.ts +126 -0
  930. package/src/cli/handlers/approve-confirm.test.ts +276 -0
  931. package/src/cli/handlers/approve-confirm.ts +200 -0
  932. package/src/cli/handlers/approve.ts +18 -1
  933. package/src/cli/handlers/build.test.ts +7 -0
  934. package/src/cli/handlers/build.ts +44 -1
  935. package/src/cli/handlers/ci-check.ts +33 -0
  936. package/src/cli/handlers/ci-forge-check.ts +91 -0
  937. package/src/cli/handlers/components.test.ts +9 -0
  938. package/src/cli/handlers/components.ts +12 -2
  939. package/src/cli/handlers/fan-out.test.ts +10 -10
  940. package/src/cli/handlers/fan-out.ts +22 -3
  941. package/src/cli/handlers/gate-pending.ts +46 -0
  942. package/src/cli/handlers/graph.test.ts +42 -0
  943. package/src/cli/handlers/graph.ts +26 -4
  944. package/src/cli/handlers/index-cloud.ts +32 -0
  945. package/src/cli/handlers/index-diff.test.ts +68 -0
  946. package/src/cli/handlers/index-diff.ts +146 -0
  947. package/src/cli/handlers/init.ts +1 -0
  948. package/src/cli/handlers/ledger-root-member.test.ts +161 -0
  949. package/src/cli/handlers/ledger.ts +1 -1
  950. package/src/cli/handlers/lifecycle-drift.ts +73 -0
  951. package/src/cli/handlers/lifecycle.test.ts +33 -11
  952. package/src/cli/handlers/lifecycle.ts +205 -30
  953. package/src/cli/handlers/lock.test.ts +29 -2
  954. package/src/cli/handlers/lock.ts +66 -6
  955. package/src/cli/handlers/misc.ts +73 -0
  956. package/src/cli/handlers/notify-relay.ts +130 -0
  957. package/src/cli/handlers/pr-before-merge.test.ts +2 -1
  958. package/src/cli/handlers/pr-deploy-inputs.test.ts +7 -7
  959. package/src/cli/handlers/pr-env.ts +48 -11
  960. package/src/cli/handlers/pr-plan-targets.test.ts +155 -0
  961. package/src/cli/handlers/pr-waves-blocked.test.ts +42 -2
  962. package/src/cli/handlers/pr-waves.test.ts +8 -2
  963. package/src/cli/handlers/pr.test.ts +8 -8
  964. package/src/cli/handlers/pr.ts +669 -207
  965. package/src/cli/handlers/promote.test.ts +69 -5
  966. package/src/cli/handlers/promote.ts +103 -8
  967. package/src/cli/handlers/query.ts +27 -4
  968. package/src/cli/handlers/release.ts +2 -0
  969. package/src/cli/handlers/run-components-exit.test.ts +7 -7
  970. package/src/cli/handlers/run-declared-reads-cli.test.ts +187 -0
  971. package/src/cli/handlers/run-groups-cli.test.ts +229 -0
  972. package/src/cli/handlers/run-wave.ts +65 -1
  973. package/src/cli/handlers/run.test.ts +6 -4
  974. package/src/cli/handlers/run.ts +86 -1
  975. package/src/cli/handlers/scenario.test.ts +13 -0
  976. package/src/cli/handlers/scenario.ts +8 -7
  977. package/src/cli/handlers/search-index.test.ts +255 -0
  978. package/src/cli/handlers/search-json.test.ts +1 -1
  979. package/src/cli/handlers/search-ownership.test.ts +194 -0
  980. package/src/cli/handlers/search.ts +271 -38
  981. package/src/cli/handlers/serve.ts +10 -1
  982. package/src/cli/main.test.ts +7 -0
  983. package/src/cli/main.ts +182 -14
  984. package/src/cli/mcp/ledger-tools.ts +126 -0
  985. package/src/cli/mcp/lifecycle-tools.ts +3 -2
  986. package/src/cli/mcp/product-tools.test.ts +123 -0
  987. package/src/cli/mcp/product-tools.ts +129 -0
  988. package/src/cli/mcp/read-only.test.ts +134 -0
  989. package/src/cli/mcp/read-only.ts +68 -0
  990. package/src/cli/mcp/report-tools.ts +135 -0
  991. package/src/cli/mcp/resource-handlers.ts +4 -3
  992. package/src/cli/mcp/server.test.ts +5 -4
  993. package/src/cli/mcp/server.ts +90 -16
  994. package/src/cli/mcp/workspace-tools.ts +1 -1
  995. package/src/cli/mcp-config.ts +8 -3
  996. package/src/cli/parse-args.ts +82 -4
  997. package/src/cli/registry.ts +54 -1
  998. package/src/cloud-lister/aws.test.ts +202 -0
  999. package/src/cloud-lister/aws.ts +226 -0
  1000. package/src/cloud-lister/azure.test.ts +132 -0
  1001. package/src/cloud-lister/azure.ts +142 -0
  1002. package/src/cloud-lister/common.ts +115 -0
  1003. package/src/cloud-lister/credentials.ts +110 -0
  1004. package/src/cloud-lister/fakes.ts +66 -0
  1005. package/src/cloud-lister/gcp.test.ts +121 -0
  1006. package/src/cloud-lister/gcp.ts +159 -0
  1007. package/src/cloud-lister/guard.test.ts +198 -0
  1008. package/src/cloud-lister/guard.ts +111 -0
  1009. package/src/cloud-lister/ids.ts +54 -0
  1010. package/src/cloud-lister/index.ts +134 -0
  1011. package/src/cloud-lister/kubernetes.test.ts +160 -0
  1012. package/src/cloud-lister/kubernetes.ts +284 -0
  1013. package/src/cloud-lister/markers.ts +74 -0
  1014. package/src/cloud-lister/mask.ts +77 -0
  1015. package/src/cloud-lister/shape.test.ts +81 -0
  1016. package/src/cloud-lister/sigv4.ts +127 -0
  1017. package/src/cloud-lister/transport.ts +118 -0
  1018. package/src/cloud-lister/types.ts +135 -0
  1019. package/src/components/adoption.test.ts +140 -0
  1020. package/src/components/adoption.ts +141 -0
  1021. package/src/components/apply-lease.ts +49 -0
  1022. package/src/components/capability-plugin-loader.ts +4 -0
  1023. package/src/components/capability-plugin.ts +10 -0
  1024. package/src/components/capability.ts +359 -6
  1025. package/src/components/check-hooks.test.ts +66 -0
  1026. package/src/components/check-hooks.ts +252 -0
  1027. package/src/components/ci-services.test.ts +51 -0
  1028. package/src/components/ci-services.ts +83 -0
  1029. package/src/components/cli-support.ts +92 -15
  1030. package/src/components/declared-reads.test.ts +103 -0
  1031. package/src/components/declared-reads.ts +134 -0
  1032. package/src/components/deploy-units.ts +4 -0
  1033. package/src/components/driver.test.ts +3 -3
  1034. package/src/components/driver.ts +127 -9
  1035. package/src/components/fan-out-run.ts +163 -33
  1036. package/src/components/fan-out-support.ts +10 -1
  1037. package/src/components/fan-out.ts +30 -0
  1038. package/src/components/groups.test.ts +320 -0
  1039. package/src/components/groups.ts +895 -0
  1040. package/src/components/index.ts +42 -0
  1041. package/src/components/plan-shape-conformance.ts +130 -0
  1042. package/src/components/pr-comment-preview.test.ts +54 -0
  1043. package/src/components/pr-env-ledger.test.ts +9 -0
  1044. package/src/components/pr-env-ledger.ts +43 -0
  1045. package/src/components/pr-env-ports.ts +29 -4
  1046. package/src/components/pr-env-run-bundle.test.ts +10 -0
  1047. package/src/components/pr-env-run.test.ts +19 -0
  1048. package/src/components/pr-env-run.ts +12 -2
  1049. package/src/components/pr-environment.test.ts +29 -0
  1050. package/src/components/pr-environment.ts +39 -7
  1051. package/src/components/pr-pipeline.test.ts +15 -0
  1052. package/src/components/pr-pipeline.ts +274 -9
  1053. package/src/components/pr-policy.ts +45 -7
  1054. package/src/components/pr-run.test.ts +516 -3
  1055. package/src/components/pr-run.ts +350 -44
  1056. package/src/components/pr-targets.test.ts +35 -0
  1057. package/src/components/pr-targets.ts +45 -0
  1058. package/src/components/product-pipeline.test.ts +200 -0
  1059. package/src/components/product-pipeline.ts +341 -0
  1060. package/src/components/promote-rounds.ts +25 -2
  1061. package/src/components/promote.ts +64 -5
  1062. package/src/components/registry.test.ts +1 -1
  1063. package/src/components/release-compile.ts +87 -1
  1064. package/src/components/release-gate.ts +115 -30
  1065. package/src/components/release-groups.test.ts +362 -0
  1066. package/src/components/release-promote.ts +65 -1
  1067. package/src/components/repo-lock.ts +52 -0
  1068. package/src/components/row-lease.test.ts +490 -0
  1069. package/src/components/row-lease.ts +167 -0
  1070. package/src/components/run-groups.ts +113 -0
  1071. package/src/components/starter-plugin.ts +6 -0
  1072. package/src/components/verbs/index.ts +1 -0
  1073. package/src/components/verbs/member-outputs.test.ts +205 -0
  1074. package/src/components/verbs/member-outputs.ts +308 -0
  1075. package/src/components/wave-plan-policy.test.ts +19 -0
  1076. package/src/components/wave-plan.ts +78 -4
  1077. package/src/config.ts +44 -0
  1078. package/src/control/__fixtures__/consumers/apps/consumers.json +15 -0
  1079. package/src/control/__fixtures__/consumers/infra/consumers.json +23 -0
  1080. package/src/control/applied.test.ts +148 -0
  1081. package/src/control/applied.ts +191 -0
  1082. package/src/control/consumers.test.ts +129 -0
  1083. package/src/control/consumers.ts +192 -0
  1084. package/src/control/control.test.ts +302 -0
  1085. package/src/control/dispatch.ts +699 -0
  1086. package/src/control/edges.test.ts +112 -0
  1087. package/src/control/edges.ts +164 -0
  1088. package/src/control/note-checkout.test.ts +91 -0
  1089. package/src/control/reconcile.ts +250 -0
  1090. package/src/control/records.ts +395 -0
  1091. package/src/deep-observation.ts +5 -23
  1092. package/src/discovery/sandbox/bundle.ts +25 -1
  1093. package/src/drift-record.test.ts +596 -0
  1094. package/src/drift-record.ts +1206 -0
  1095. package/src/engine-facts.guard.test.ts +111 -0
  1096. package/src/engine-facts.test.ts +177 -0
  1097. package/src/engine-facts.ts +153 -0
  1098. package/src/exit-codes.test.ts +31 -0
  1099. package/src/exit-codes.ts +55 -0
  1100. package/src/forge-check/check.ts +155 -0
  1101. package/src/forge-check/contract.ts +215 -0
  1102. package/src/forge-check/forge-check.test.ts +427 -0
  1103. package/src/forge-check/forge.ts +318 -0
  1104. package/src/forge-check/index.ts +43 -0
  1105. package/src/forge-check/pulumi.ts +192 -0
  1106. package/src/forge-check/read-only.ts +56 -0
  1107. package/src/forge-check/trust.ts +527 -0
  1108. package/src/forge-check/types.ts +78 -0
  1109. package/src/forge-check.ts +5 -0
  1110. package/src/gate-decision-bundle.test.ts +13 -0
  1111. package/src/gate-decision.ts +3 -0
  1112. package/src/gate-policy.ts +92 -3
  1113. package/src/gated-waves-bundle.test.ts +1 -0
  1114. package/src/graph-ir-live.test.ts +92 -0
  1115. package/src/graph-ir.ts +317 -7
  1116. package/src/graph-refs.ts +416 -0
  1117. package/src/graph-schema/fixtures/adopt.json +15 -0
  1118. package/src/graph-schema/fixtures/choudoufu.engine-graph.json +169 -0
  1119. package/src/graph-schema/fixtures/index.json +68 -0
  1120. package/src/graph-schema/fixtures/plunge.engine-graph.json +158 -0
  1121. package/src/graph-schema/fixtures.ts +267 -0
  1122. package/src/graph-schema/generate.ts +263 -0
  1123. package/src/graph-schema/graph-schema.test.ts +153 -0
  1124. package/src/graph-schema/graph.schema.json +1387 -0
  1125. package/src/health.schema.json +2 -1
  1126. package/src/identity.ts +2 -0
  1127. package/src/index.ts +4 -0
  1128. package/src/instance-nodes.ts +288 -0
  1129. package/src/lexicon.ts +171 -6
  1130. package/src/lifecycle/__fixtures__/index-diff/20261026T120000Z-aaaaaaaaaaaa.json +149 -0
  1131. package/src/lifecycle/__fixtures__/index-diff/20261026T130000Z-bbbbbbbbbbbb.json +127 -0
  1132. package/src/lifecycle/adoption-file.test.ts +100 -0
  1133. package/src/lifecycle/adoption-file.ts +153 -0
  1134. package/src/lifecycle/cloud-index.test.ts +516 -0
  1135. package/src/lifecycle/cloud-index.ts +735 -0
  1136. package/src/lifecycle/control-entries-ledger.test.ts +70 -0
  1137. package/src/lifecycle/derive-edges.test.ts +193 -0
  1138. package/src/lifecycle/derive-edges.ts +182 -0
  1139. package/src/lifecycle/gate-applied.ts +6 -0
  1140. package/src/lifecycle/gate-ledger.ts +36 -1
  1141. package/src/lifecycle/gate-pending-by-plan.test.ts +69 -0
  1142. package/src/lifecycle/gate-pending-by-plan.ts +133 -0
  1143. package/src/lifecycle/gated-request-digest.ts +49 -0
  1144. package/src/lifecycle/gated-request-ledger.test.ts +53 -0
  1145. package/src/lifecycle/gated-request.ts +280 -0
  1146. package/src/lifecycle/git.ts +10 -4
  1147. package/src/lifecycle/identity-match.test.ts +308 -0
  1148. package/src/lifecycle/identity-match.ts +276 -0
  1149. package/src/lifecycle/index-diff.test.ts +198 -0
  1150. package/src/lifecycle/index-diff.ts +475 -0
  1151. package/src/lifecycle/index-document.test.ts +64 -0
  1152. package/src/lifecycle/index-document.ts +298 -0
  1153. package/src/lifecycle/index-drift.test.ts +191 -0
  1154. package/src/lifecycle/index-drift.ts +304 -0
  1155. package/src/lifecycle/index-import.test.ts +269 -0
  1156. package/src/lifecycle/index-import.ts +654 -0
  1157. package/src/lifecycle/index-join.test.ts +250 -0
  1158. package/src/lifecycle/index-join.ts +304 -0
  1159. package/src/lifecycle/index-store-load-bearing.test.ts +187 -0
  1160. package/src/lifecycle/index.ts +4 -0
  1161. package/src/lifecycle/ledger-read.ts +7 -3
  1162. package/src/lifecycle/lock-rows.test.ts +109 -0
  1163. package/src/lifecycle/lock-rows.ts +167 -0
  1164. package/src/lifecycle/member-ledger.test.ts +25 -7
  1165. package/src/lifecycle/observation-baseline.test.ts +72 -1
  1166. package/src/lifecycle/observation-baseline.ts +190 -27
  1167. package/src/lifecycle/observe.ts +6 -1
  1168. package/src/lifecycle/publish-target-context.test.ts +108 -0
  1169. package/src/lifecycle/query.test.ts +68 -1
  1170. package/src/lifecycle/query.ts +208 -13
  1171. package/src/lifecycle/release-catalog-site.test.ts +142 -0
  1172. package/src/lifecycle/release-catalog-site.ts +291 -0
  1173. package/src/lifecycle/release-catalog.test.ts +193 -0
  1174. package/src/lifecycle/release-catalog.ts +353 -0
  1175. package/src/lifecycle/release-changelog.test.ts +70 -0
  1176. package/src/lifecycle/release-changelog.ts +71 -0
  1177. package/src/lifecycle/release-cut.ts +2 -2
  1178. package/src/lifecycle/release-ledger.ts +20 -0
  1179. package/src/lifecycle/release-publish.ts +45 -22
  1180. package/src/lifecycle/release-read.ts +2 -0
  1181. package/src/lifecycle/release-status.test.ts +186 -0
  1182. package/src/lifecycle/release-status.ts +176 -0
  1183. package/src/lifecycle/replay.test.ts +9 -5
  1184. package/src/lifecycle/replay.ts +9 -5
  1185. package/src/lifecycle/resource-lock.test.ts +175 -0
  1186. package/src/lifecycle/resource-lock.ts +354 -0
  1187. package/src/lifecycle/retention.ts +2 -0
  1188. package/src/lifecycle/run-ledger.ts +7 -1
  1189. package/src/lifecycle/scenario.ts +4 -3
  1190. package/src/lifecycle/snapshot-store-fake.ts +29 -0
  1191. package/src/lifecycle/snapshot-store-s3.ts +280 -0
  1192. package/src/lifecycle/snapshot-store.test.ts +385 -0
  1193. package/src/lifecycle/snapshot-store.ts +980 -0
  1194. package/src/lifecycle/snapshot.test.ts +13 -0
  1195. package/src/lifecycle/snapshot.ts +23 -6
  1196. package/src/lifecycle/target-lock.ts +24 -9
  1197. package/src/lifecycle/type-listing.test.ts +166 -0
  1198. package/src/lifecycle/type-listing.ts +309 -0
  1199. package/src/lint/component-checks.ts +17 -1
  1200. package/src/lint/config.test.ts +3 -0
  1201. package/src/lint/presets/relaxed.json +2 -1
  1202. package/src/lint/presets/strict.json +2 -1
  1203. package/src/lint/rules/__fixtures__/comp/comp008/fail/dns.component.ts +15 -0
  1204. package/src/lint/rules/__fixtures__/comp/comp008/pass/dns.component.ts +10 -0
  1205. package/src/lint/rules/comp/comp.test.ts +2 -1
  1206. package/src/lint/rules/comp/comp008-applies-signal-only-root.ts +121 -0
  1207. package/src/lint/rules/comp/comp008.test.ts +77 -0
  1208. package/src/lint/rules/comp/index.ts +4 -1
  1209. package/src/mcp/types.ts +7 -0
  1210. package/src/notify-product.ts +76 -0
  1211. package/src/notify-relay.test.ts +213 -0
  1212. package/src/notify-relay.ts +407 -0
  1213. package/src/notify.ts +95 -14
  1214. package/src/object-store/azure-blob.ts +374 -0
  1215. package/src/object-store/common.ts +133 -0
  1216. package/src/object-store/errors.ts +26 -0
  1217. package/src/object-store/from-env.ts +36 -0
  1218. package/src/object-store/gcs.ts +436 -0
  1219. package/src/object-store/index.ts +8 -0
  1220. package/src/object-store/object-store.test.ts +130 -0
  1221. package/src/object-store/s3.ts +350 -0
  1222. package/src/observation-edges.test.ts +33 -0
  1223. package/src/observation.ts +36 -1
  1224. package/src/op/activities/activity-contracts.ts +1 -1
  1225. package/src/op/activities/change-set.ts +8 -5
  1226. package/src/op/activities/converge.ts +2 -1
  1227. package/src/op/activities/index.ts +1 -1
  1228. package/src/op/activities/review-agent.open.test.ts +78 -0
  1229. package/src/op/activities/review-agent.test.ts +13 -0
  1230. package/src/op/activities/review-agent.ts +89 -5
  1231. package/src/op/activity-failure.ts +36 -0
  1232. package/src/op/gate.ts +81 -22
  1233. package/src/op/generate-pipeline.ts +7 -1
  1234. package/src/op/index.ts +23 -1
  1235. package/src/op/local-executor.test.ts +80 -0
  1236. package/src/op/local-executor.ts +27 -9
  1237. package/src/op/op-waves-after-plan.test.ts +276 -0
  1238. package/src/op/op-waves-after-plan.ts +238 -0
  1239. package/src/op/op-waves-capability-spec.ts +113 -0
  1240. package/src/op/op-waves-capability.test.ts +217 -0
  1241. package/src/op/op-waves-capability.ts +370 -0
  1242. package/src/op/op-waves-events.ts +135 -0
  1243. package/src/op/op-waves-notify-words.test.ts +149 -0
  1244. package/src/op/op-waves-notify.ts +41 -16
  1245. package/src/op/op-waves-pull-request.test.ts +142 -0
  1246. package/src/op/op-waves-release-port.ts +64 -0
  1247. package/src/op/op-waves-release.test.ts +209 -0
  1248. package/src/op/op-waves-release.ts +133 -0
  1249. package/src/op/op-waves-run-record.test.ts +32 -0
  1250. package/src/op/op-waves-run.ts +1142 -49
  1251. package/src/op/op-waves-stand-down.test.ts +240 -0
  1252. package/src/op/op-waves-stand-down.ts +108 -0
  1253. package/src/op/op-waves-trace.test.ts +205 -0
  1254. package/src/op/op-waves.test.ts +112 -0
  1255. package/src/op/op-waves.ts +261 -20
  1256. package/src/op/runtime.ts +104 -0
  1257. package/src/op/stage-hooks-hold-record.test.ts +41 -0
  1258. package/src/op/stage-hooks.ts +91 -12
  1259. package/src/op/steward-beside.ts +2 -1
  1260. package/src/op/types.ts +3 -2
  1261. package/src/otlp-metrics.ts +96 -0
  1262. package/src/otlp.test.ts +243 -0
  1263. package/src/otlp.ts +544 -0
  1264. package/src/override-gate-bundle.test.ts +2 -0
  1265. package/src/override-gate.ts +4 -0
  1266. package/src/policy-packs.ts +230 -0
  1267. package/src/policy-source.test.ts +256 -0
  1268. package/src/policy-source.ts +112 -0
  1269. package/src/pr-forge.ts +123 -0
  1270. package/src/pr-loop-bundle.test.ts +9 -2
  1271. package/src/pr-loop-words.test.ts +155 -0
  1272. package/src/pr-loop.test.ts +43 -0
  1273. package/src/pr-loop.ts +478 -50
  1274. package/src/pr-post.ts +32 -1
  1275. package/src/pr-report-url.ts +62 -6
  1276. package/src/pr-requires.test.ts +37 -1
  1277. package/src/pr-requires.ts +16 -2
  1278. package/src/product-subpaths-plain-node.e2e.test.ts +211 -0
  1279. package/src/pulumi-urn.ts +151 -0
  1280. package/src/release-floors.ts +22 -0
  1281. package/src/run-event.ts +29 -1
  1282. package/src/sensitive-key.ts +34 -0
  1283. package/src/sorted-json.ts +17 -0
  1284. package/src/stage-hooks-bundle.test.ts +8 -0
  1285. package/src/terraform/credentials.test.ts +77 -0
  1286. package/src/terraform/credentials.ts +162 -0
  1287. package/src/utils.ts +2 -11
  1288. package/src/wave-loop-golden.test.ts +2 -1
  1289. package/src/wave-runtime.ts +2 -2
  1290. package/src/workspace/adoption-report.test.ts +61 -0
  1291. package/src/workspace/adoption-report.ts +103 -0
  1292. package/src/workspace/capabilities-contract.test.ts +4 -0
  1293. package/src/workspace/capabilities-contract.ts +9 -1
  1294. package/src/workspace/capabilities.schema.json +98 -0
  1295. package/src/workspace/change-set.schema.json +42 -3
  1296. package/src/workspace/chant-migrations/chud-lexicon-exit.ts +4 -1
  1297. package/src/workspace/ci-cloud-identity.ts +31 -1
  1298. package/src/workspace/ci-lock-grain.test.ts +31 -0
  1299. package/src/workspace/ci-lock-grain.ts +30 -0
  1300. package/src/workspace/ci-report-url.test.ts +1 -1
  1301. package/src/workspace/ci-run.test.ts +1 -1
  1302. package/src/workspace/ci-run.ts +6 -3
  1303. package/src/workspace/compose-graph.test.ts +12 -0
  1304. package/src/workspace/compose-graph.ts +12 -1
  1305. package/src/workspace/conformance/conformance.e2e.test.ts +2 -1
  1306. package/src/workspace/conformance/index.ts +6 -1
  1307. package/src/workspace/declaration.schema.json +27 -3
  1308. package/src/workspace/declaration.test.ts +1 -1
  1309. package/src/workspace/declaration.ts +26 -10
  1310. package/src/workspace/drift-cli.test.ts +65 -0
  1311. package/src/workspace/drift-cli.ts +370 -0
  1312. package/src/workspace/drift.schema.json +672 -0
  1313. package/src/workspace/exit-cli.ts +2 -1
  1314. package/src/workspace/graph-cli.ts +5 -0
  1315. package/src/workspace/graph.schema.json +72 -0
  1316. package/src/workspace/import-fetch.ts +4 -2
  1317. package/src/workspace/import-init.ts +4 -2
  1318. package/src/workspace/init.test.ts +38 -1
  1319. package/src/workspace/init.ts +50 -8
  1320. package/src/workspace/intent-gaps.test.ts +18 -2
  1321. package/src/workspace/ledger.schema.json +7 -3
  1322. package/src/workspace/lineage-upgrade-cli.ts +2 -1
  1323. package/src/workspace/nested-graph.ts +1 -0
  1324. package/src/workspace/pr-report.schema.json +125 -5
  1325. package/src/workspace/promote-waves.test.ts +296 -0
  1326. package/src/workspace/promote-waves.ts +340 -0
  1327. package/src/workspace/promote.test.ts +158 -4
  1328. package/src/workspace/promote.ts +400 -58
  1329. package/src/workspace/reason-codes.test.ts +4 -1
  1330. package/src/workspace/reason-codes.ts +14 -0
  1331. package/src/workspace/records-cli.ts +3 -2
  1332. package/src/workspace/release-catalog.schema.json +277 -0
  1333. package/src/workspace/run-event.schema.json +18 -1
  1334. package/src/workspace/search-contract.ts +2 -0
  1335. package/src/workspace/search.schema.json +103 -5
  1336. package/src/workspace/work-cli.ts +8 -2
  1337. package/src/workspace/workspace-run.ts +2 -1
@@ -65,11 +65,14 @@
65
65
  */
66
66
 
67
67
  import { spawnSync } from "node:child_process";
68
- import { mkdirSync, readFileSync, realpathSync, writeFileSync } from "node:fs";
69
- import { join, relative, resolve, sep } from "node:path";
68
+ import { CHANT_EXIT } from "../../exit-codes";
69
+ import { anyResourceGrain, leaseRowsOf as leaseRowsOfLocks, lockTargetsOf, type LockGrain } from "../../lifecycle/lock-rows";
70
+ import { existsSync, mkdirSync, readFileSync, realpathSync, writeFileSync } from "node:fs";
71
+ import { dirname, join, relative, resolve, sep } from "node:path";
70
72
  import { loadChantConfig, resolveAutoReleaseDisabled, type ChantConfig } from "../../config";
71
73
  import { resolveCommit, resolveMergeBase } from "../../components/changed-files";
72
74
  import { deriveFanOut, fanOutRegistry } from "../../components/fan-out-support";
75
+ import { findComponentGroups, groupFanOut } from "../../components/groups";
73
76
  import {
74
77
  applyPrSet,
75
78
  approvalOf,
@@ -81,15 +84,14 @@ import {
81
84
  readOnlyLedger,
82
85
  prWavePlan,
83
86
  resumePrSet,
84
- waveNotCovered,
85
87
  type PrPlanSet,
86
88
  } from "../../components/pr-run";
87
89
  import { composeChangeSet, verifyChangeSetDigest } from "../../change-set";
88
- import { waveGateName } from "../../gated-waves";
89
90
  import { blockedMembers, blockedWords, settleEarlierWaves, type WaveMemberOutcome } from "../../wave-blocked";
90
91
  import { readFanOutAttempt, writeFanOutAttempt, type FanOutAttempt, type PrApplyRecord } from "../../components/fan-out-record";
91
92
  import { componentInputDigests, progressThatCarries } from "../../components/fan-out-inputs";
92
- import { samePlanDigest } from "../../lifecycle/plan-digest";
93
+ import { computePlanDigest, samePlanDigest } from "../../lifecycle/plan-digest";
94
+ import type { GateResolutionRecord } from "../../lifecycle/gate-ledger";
93
95
  import { evaluateGate, gateIsSealed, gitGateLedgerPort, type GateCheck, type GateLedgerPort } from "../../op/gate";
94
96
  import type { OtherGateHold } from "../../op/stage-hooks";
95
97
  import { emitGateStep, gateEventsOf, GATE_PHASE, type RunEventSink, type RunEventStream } from "../../run-event-stream";
@@ -100,6 +102,7 @@ import {
100
102
  describePlanChanged,
101
103
  PR_APPLY_GATE,
102
104
  prApproveCommand,
105
+ prApproveCommands,
103
106
  prNoteMarker,
104
107
  prOp,
105
108
  prStatusDescription,
@@ -109,6 +112,7 @@ import {
109
112
  type PrApproval,
110
113
  type PrBeforeMerge,
111
114
  type PrMember,
115
+ type PrMemberDetail,
112
116
  type PrPolicyReport,
113
117
  type PrReport,
114
118
  type PrWave,
@@ -117,6 +121,8 @@ import {
117
121
  } from "../../pr-loop";
118
122
  import { FORGE_KINDS, forgeFromEnv, forgePrincipalOf, type ForgeKind, type PrForge } from "../../pr-forge";
119
123
  import { GITHUB_COMMENT_LIMIT, GITLAB_NOTE_LIMIT } from "../../plan-summary";
124
+ import { upsertPlanNote } from "../../pr-post";
125
+ import { activeProductWords, productContext } from "../../ci-product-words";
120
126
  import { resolveCliBuildParams, parseParamFlags } from "../build-params-cli";
121
127
  import { formatError, formatInfo, formatSuccess, formatWarning } from "../format";
122
128
  import { reportUninstalledDependencies } from "../dependencies";
@@ -126,10 +132,12 @@ import { coverByMerges, greenOp, type GreenTarget } from "../../components/green
126
132
  import { GATED_EXIT_CODE, autoReleaseRun, recordAutoReleasesForRun } from "./run";
127
133
  import { appliedDigestOf } from "../../components/auto-release";
128
134
  import type { CommandContext } from "../registry";
135
+ import { parseArgs } from "../parse-args";
129
136
  import { withComponentEndpoint } from "../component-endpoint";
130
137
  import type { ComponentChangeSignal, FanOutPlan } from "../../components/fan-out";
131
- import { failedRunExitCode, type DriverComponent } from "../../components/driver";
132
- import type { CapabilityRegistry } from "../../components/capability";
138
+ import { assertTargetsAccepted, failedRunExitCode, type DriverComponent } from "../../components/driver";
139
+ import { TargetsRefusedError, type CapabilityRegistry } from "../../components/capability";
140
+ import { prPlanTargets } from "../../components/pr-targets";
133
141
  import type { ComponentEnvironmentDeclaration } from "../../components/component";
134
142
  import { prLoopHooksAt, runPrHooks, type PrHoldSettled, type PrHookPlace, type PrLoopHooks } from "../../components/pr-hooks";
135
143
  import { decidePrPolicyOverride, policyReviewOf, prLoopPolicyAt, prPolicyReport, runPrPolicy, spendPrPolicyOverride, type PrLoopPolicy } from "../../components/pr-policy";
@@ -171,6 +179,8 @@ export interface Prepared {
171
179
  hookFailed?: string;
172
180
  /** Where the stage's hooks run, once its op is known. */
173
181
  hookPlace?: PrHookPlace;
182
+ /** `pr-plan --target` (#4620): the addresses each planned member's capability plan narrows to. */
183
+ targets?: Record<string, string[]>;
174
184
  /**
175
185
  * Set when `ci.branches` or `ci.labels` (#4292) leave the member out of this
176
186
  * stage: why. The plan is then empty, so the stage reports `nothing`.
@@ -210,6 +220,10 @@ export async function prepare(ctx: CommandContext, stage: "plan" | "apply" | "re
210
220
  );
211
221
  }
212
222
  if (args.fromAffected) return fail(`pr-${stage} derives the change itself; drop --from-affected`);
223
+ // #4620: a target narrows the preview; an apply or a record covers what the approved plan covers.
224
+ if (stage !== "plan" && args.targets && args.targets.length > 0) {
225
+ return fail(`pr-${stage} applies or records what the pull request's approved plan covers, so it takes no --target`, "Narrow the plan with pr-plan --target, and approve that plan.");
226
+ }
213
227
  let member: string | undefined;
214
228
  if (args.members?.length) {
215
229
  const checked = await checkMember(projectPath, args.members);
@@ -241,6 +255,7 @@ export async function prepare(ctx: CommandContext, stage: "plan" | "apply" | "re
241
255
  const signal = await resolveChangedUnits(ctx, config, { base, stacksOnly: true });
242
256
  if ("error" in signal) return fail(signal.error, signal.hint);
243
257
 
258
+ const registry = await fanOutRegistry(projectPath, config);
244
259
  let derived;
245
260
  try {
246
261
  derived = await deriveFanOut({
@@ -249,6 +264,7 @@ export async function prepare(ctx: CommandContext, stage: "plan" | "apply" | "re
249
264
  sandbox: args.sandbox,
250
265
  buildParams: paramsResolution.provenance,
251
266
  config,
267
+ registry,
252
268
  });
253
269
  } catch (err) {
254
270
  const message = err instanceof Error ? err.message : String(err);
@@ -288,9 +304,17 @@ export async function prepare(ctx: CommandContext, stage: "plan" | "apply" | "re
288
304
  if (policy.note) console.error(formatInfo(policy.note));
289
305
 
290
306
  const env = args.env ?? "local";
291
- const registry = await fanOutRegistry(projectPath, config);
292
307
  const routedAway = member ? await routing(ctx, stage, projectPath, member, base, forge) : undefined;
293
308
  if (routedAway) console.error(formatInfo(routedAway));
309
+ // ws-107: the groups a capability plans and applies as one, placed in the waves every stage and wave job reads.
310
+ let plan = derived.plan;
311
+ if (!routedAway && plan.order.length > 0) {
312
+ try {
313
+ plan = groupFanOut(plan, derived.components, await findComponentGroups({ components: derived.components, plan, registry, env }));
314
+ } catch (err) {
315
+ return fail(err instanceof Error ? err.message : String(err));
316
+ }
317
+ }
294
318
  return {
295
319
  config,
296
320
  env,
@@ -300,7 +324,7 @@ export async function prepare(ctx: CommandContext, stage: "plan" | "apply" | "re
300
324
  gate: args.gate ?? PR_APPLY_GATE,
301
325
  ...(forge ? { forge } : {}),
302
326
  components: derived.components,
303
- plan: routedAway ? { ...derived.plan, order: [], waves: [], seeds: [], indeterminate: [] } : derived.plan,
327
+ plan: routedAway ? { ...derived.plan, order: [], waves: [], seeds: [], indeterminate: [] } : plan,
304
328
  signal: derived.signal,
305
329
  ...(derived.sites ? { sites: derived.sites } : {}),
306
330
  registry,
@@ -465,17 +489,94 @@ export function planAll(p: Prepared, onRunEvent?: RunEventSink): Promise<PrPlanS
465
489
  return hookedPlan(p, p.plan.order, () => planBare(p, onRunEvent));
466
490
  }
467
491
 
468
- export function planBare(p: Prepared, onRunEvent?: RunEventSink): Promise<PrPlanSet> {
492
+ export async function planBare(p: Prepared, onRunEvent?: RunEventSink): Promise<PrPlanSet> {
493
+ const lockGrain = await declaredLockGrainOf(p);
469
494
  return planPrSet({
470
495
  components: p.components,
471
496
  plan: p.plan,
472
497
  registry: p.registry,
473
498
  env: p.env,
474
499
  seededOutputs: p.seededOutputs,
500
+ ...(lockGrain ? { lockGrain } : {}),
501
+ // #4613: a step's own policy engine (CrossGuard) reads its packs at the base, as ci.policy is.
502
+ policyBase: p.base,
475
503
  ...(onRunEvent ? { onRunEvent } : {}),
504
+ ...(p.targets ? { targets: p.targets } : {}),
476
505
  });
477
506
  }
478
507
 
508
+ /**
509
+ * `pr-plan --target` (#4620): the addresses by member, set on `p`, or the
510
+ * exit code when a value is refused or a targeted member has a capability
511
+ * that cannot narrow, which is named before anything plans.
512
+ */
513
+ function narrowToTargets(p: Prepared, values: readonly string[] | undefined): number | undefined {
514
+ if (!values || values.length === 0) return undefined;
515
+ const resolved = prPlanTargets(values, p.plan.order, new Set(p.components.map((c) => c.name)));
516
+ if ("error" in resolved) return fail(resolved.error, "--target <address> narrows every member the pull request plans; --target <member>:<address> narrows one.");
517
+ const { targets } = resolved;
518
+ const byName = new Map(p.components.map((c) => [c.name, c]));
519
+ for (const [name, addresses] of Object.entries(targets)) {
520
+ try {
521
+ assertTargetsAccepted(byName.get(name)!, p.registry, { targets: addresses });
522
+ } catch (err) {
523
+ if (err instanceof TargetsRefusedError) return fail(`${err.message}, so nothing was planned`, "Drop --target, or name a member whose steps can narrow: --target <member>:<address>.");
524
+ throw err;
525
+ }
526
+ }
527
+ p.targets = targets;
528
+ console.error(formatInfo(`narrowed to ${Object.entries(targets).map(([name, a]) => `${name}: ${a.join(", ")}`).join("; ") || "nothing planned"}`));
529
+ return undefined;
530
+ }
531
+
532
+ /**
533
+ * `ci.lockGrain` of the stage's member (#4552), read from the declaration at
534
+ * base like `ci.locks`, so a change cannot pick its own grain. Undefined when
535
+ * none is declared: each member then takes its lexicon's default.
536
+ */
537
+ async function declaredLockGrainOf(p: Pick<Prepared, "base" | "member">): Promise<LockGrain | undefined> {
538
+ const { ciLockGrainAt } = await import("../../workspace/ci-lock-grain");
539
+ return ciLockGrainAt(process.cwd(), p.base, p.member) ?? undefined;
540
+ }
541
+
542
+ /**
543
+ * Lease the rows a set's members on the resource grain change (#4552),
544
+ * before anything applies: the refusal naming the run that holds one, the
545
+ * exit code when the rows file could not be written, or the lease to let go
546
+ * of once the apply ends (one that holds nothing when no member is on the
547
+ * resource grain).
548
+ */
549
+ async function leaseSetRows(p: Prepared, set: Pick<PrPlanSet, "locks">): Promise<{ release(): Promise<boolean> } | { held: string } | number> {
550
+ const leased = await leaseRowsOf(p, set);
551
+ return "failed" in leased ? fail(leased.failed) : leased;
552
+ }
553
+
554
+ /**
555
+ * {@link leaseSetRows} without printing a failure (#4594), for a later round
556
+ * of `applyPrSet` (`leaseRound`), which records it on the round, and for a
557
+ * pull request environment's apply, which reports it.
558
+ */
559
+ export async function leaseRowsOf(p: Pick<Prepared, "gate">, set: Pick<PrPlanSet, "locks">, label = "this apply"): Promise<{ release(): Promise<boolean> } | { held: string } | { failed: string }> {
560
+ const rows = leaseRowsOfLocks(set.locks);
561
+ if (rows.length === 0) return { release: () => Promise.resolve(true) };
562
+ const { leaseLockRows } = await import("../../lifecycle/resource-lock");
563
+ let leased;
564
+ try {
565
+ leased = await leaseLockRows(p.gate, rows);
566
+ } catch (err) {
567
+ return { failed: `could not hold the rows ${label} changes in ${p.gate}, so nothing of it was applied: ${err instanceof Error ? err.message : String(err)}` };
568
+ }
569
+ if (!leased.ok) return { held: `${leased.message}, so nothing of ${label} was applied. Apply again once that run ends; a run that is gone, or whose lease is older than CHANT_LOCK_STALE seconds, is taken over.` };
570
+ for (const h of leased.tookOver) console.error(formatInfo(`took over the rows of run ${h.run}, which is gone`));
571
+ console.error(formatInfo(`${label} holds ${leased.lease.keys.length} row${leased.lease.keys.length === 1 ? "" : "s"} of ${p.gate} while it applies`));
572
+ return leased.lease;
573
+ }
574
+
575
+ /** `applyPrSet`'s `leaseRound` (#4594): a round after the first leases the rows its own plan locks. */
576
+ export function leaseRoundRows(p: Pick<Prepared, "gate">): NonNullable<Parameters<typeof applyPrSet>[0]["leaseRound"]> {
577
+ return ({ round, set }) => leaseRowsOf(p, set, `round ${round}`);
578
+ }
579
+
479
580
  /**
480
581
  * How a stage's report settles its run's events (#4041): a refusal waits on
481
582
  * a person, as a gate does, and exits the same way.
@@ -529,7 +630,7 @@ async function publish(forge: PrForge | undefined, report: PrReport, note: strin
529
630
  // member would put a line on every pull request for each member it skips.
530
631
  if (report.member && report.status === "nothing" && !report.overdue?.length && !report.migrations?.length) return;
531
632
  try {
532
- await forge.upsertNote(report.pr, prNoteMarker(report.env, report.member), note);
633
+ await upsertPlanNote(forge, report.pr, prNoteMarker(report.env, report.member), note);
533
634
  } catch (err) {
534
635
  console.error(formatWarning({ message: `could not post the note on #${report.pr}: ${err instanceof Error ? err.message : String(err)}` }));
535
636
  }
@@ -556,6 +657,14 @@ async function finish(ctx: CommandContext, p: Prepared, report: PrReport, upload
556
657
  if (p.routedAway && report.status === "nothing" && !report.message) report = { ...report, message: p.routedAway };
557
658
  if (p.policyReport) report = { ...report, policy: p.policyReport };
558
659
  if (p.beforeMerge) report = { ...report, beforeMerge: p.beforeMerge };
660
+ // #4617: with a checkout of the control repo named, its entries and apply records mark the cross-stack edges.
661
+ if (report.crossStackEdges?.length && process.env.CHANT_CONTROL_DIR) {
662
+ const { controlEdgeFactsFromEnv, remarkCrossStackEdges } = await import("../../control/edges");
663
+ report = remarkCrossStackEdges(report, await controlEdgeFactsFromEnv());
664
+ }
665
+ // #4573: each member's section its lexicon renders from its own part of the change set.
666
+ const details = await memberDetails(p, report);
667
+ if (details.length > 0) report = { ...report, details };
559
668
  const note = noteFor(report, p.forge);
560
669
  writeOutputs(ctx, report, note, upload);
561
670
  if (!ctx.args.noStatus) await publish(p.forge, report, note);
@@ -657,9 +766,9 @@ async function judgePolicy(p: Prepared, at: { stage: "plan" | "apply"; op: strin
657
766
  const why = err instanceof Error ? err.message : String(err);
658
767
  if (at.stage === "plan") {
659
768
  console.error(formatWarning({ message: `could not read the override ledger, so no override reads as standing: ${why}` }));
660
- return { held, stop: { refusal: "policy-denied", code: 1, message: `The policy denied this plan: ${denied}.` } };
769
+ return { held, stop: { refusal: "policy-denied", code: CHANT_EXIT.denied, message: `The policy denied this plan: ${denied}.` } };
661
770
  }
662
- return { held, stop: { refusal: "policy-denied", code: GATED_EXIT_CODE, message: `The policy denied this plan (${denied}), and the override ledger could not be read or written: ${why}. Nothing was applied.` } };
771
+ return { held, stop: { refusal: "policy-denied", code: CHANT_EXIT.denied, message: `The policy denied this plan (${denied}), and the override ledger could not be read or written: ${why}. Nothing was applied.` } };
663
772
  }
664
773
  if (decided.status === "overridden") {
665
774
  report.override = decided.override;
@@ -674,7 +783,7 @@ async function judgePolicy(p: Prepared, at: { stage: "plan" | "apply"; op: strin
674
783
  held,
675
784
  stop: {
676
785
  refusal: "policy-denied",
677
- code: at.stage === "plan" ? 1 : GATED_EXIT_CODE,
786
+ code: CHANT_EXIT.denied,
678
787
  message: `The policy denied this plan: ${denied}.${moved} Nothing was applied. ${who} override it: ${decided.command}`,
679
788
  },
680
789
  };
@@ -704,6 +813,8 @@ async function prPlan(ctx: CommandContext, stage: StageEvents): Promise<number>
704
813
  }
705
814
  const p = await prepare(ctx, "plan");
706
815
  if (typeof p === "number") return p;
816
+ const narrowed = narrowToTargets(p, ctx.args.targets);
817
+ if (narrowed !== undefined) return narrowed;
707
818
  const op = prOp(ctx.args.pr, p.member);
708
819
  placeHooks(ctx, p, "plan", op);
709
820
  const upload = openUpload(stage, "plan", ctx.args.pr, p);
@@ -755,10 +866,41 @@ async function prPlan(ctx: CommandContext, stage: StageEvents): Promise<number>
755
866
  printMembers(report);
756
867
  if (status === "planned") {
757
868
  console.error(formatInfo(`plan : ${report.digest}`));
758
- console.error(formatInfo(approval.status === "approved" ? `approved by ${(approval.approvedBy ?? []).join(", ")}` : `approve : ${prApproveCommand(report)}`));
869
+ console.error(formatInfo(approval.status === "approved" ? `approved by ${(approval.approvedBy ?? []).join(", ")}` : `approve : ${prApproveCommands(report).join("; ")}`));
759
870
  }
760
871
  if (judged.stop) console.error(formatWarning({ message: judged.stop.message }));
761
- return status === "plan-failed" || judged.stop ? 1 : 0;
872
+ // #4550: a capability's policy denial (pulumi-up's CrossGuard) exits as a denial, 7, not as a failed plan.
873
+ if (status === "plan-failed" && set.policyDenied) return CHANT_EXIT.denied;
874
+ return status === "plan-failed" ? CHANT_EXIT.failed : judged.stop ? judged.stop.code : CHANT_EXIT.done;
875
+ }
876
+
877
+ /**
878
+ * The member detail sections (#4573): each lexicon the project lists that
879
+ * renders one (`prNoteDetail`) gets each member's part of the change set. A
880
+ * lexicon that cannot load, or throws, leaves the note as it was.
881
+ */
882
+ async function memberDetails(p: Prepared, report: PrReport): Promise<PrMemberDetail[]> {
883
+ if (report.changeSet.members.length === 0) return [];
884
+ const { loadPlugin } = await import("../plugins");
885
+ const out: PrMemberDetail[] = [];
886
+ for (const name of lexiconNames(p.config.lexicons ?? [])) {
887
+ let plugin: Awaited<ReturnType<typeof loadPlugin>>;
888
+ try {
889
+ plugin = await loadPlugin(name);
890
+ } catch {
891
+ continue;
892
+ }
893
+ if (!plugin.prNoteDetail) continue;
894
+ for (const member of report.changeSet.members) {
895
+ try {
896
+ const detail = await plugin.prNoteDetail({ member: member.member, changeSet: report.changeSet, stage: report.stage });
897
+ if (detail && detail.lines.length > 0) out.push({ member: member.member, ...(detail.title ? { title: detail.title } : {}), lines: detail.lines });
898
+ } catch (err) {
899
+ console.error(formatWarning({ message: `the ${name} lexicon could not render ${member.member}'s detail: ${err instanceof Error ? err.message : String(err)}` }));
900
+ }
901
+ }
902
+ }
903
+ return out;
762
904
  }
763
905
 
764
906
  /**
@@ -806,12 +948,13 @@ async function overdueOps(forge: PrForge | undefined, member: string | undefined
806
948
  return overdueOpsAt({ forge, cwd: resolve("."), ...(member ? { member } : {}), log: (line) => console.error(formatWarning({ message: line })) });
807
949
  }
808
950
 
809
- /** chant components pr-apply --base <ref> [--pr <n>] [--env <env>] [--gate <name>] [--forge <kind>] [--require-review] [--output <dir>] [--json] [--events-json] [--report-url <url>] */
951
+ /** chant components pr-apply --base <ref> [--pr <n>] [--env <env>] [--gate <name>] [--forge <kind>] [--require-review] [--before-merge [--requires <list>]] [--output <dir>] [--json] [--events-json] [--report-url <url>] */
810
952
  export function runComponentsPrApply(ctx: CommandContext): Promise<number> {
811
953
  if (refusesEventsWithJson(ctx.args, "the stage's report")) return Promise.resolve(1);
812
954
  return withStageEvents("pr-apply", ctx, async (events) => {
813
955
  // #4301: an apply before merge asks the forge its requires checks before any of the head's code loads, the config included.
814
956
  let beforeMerge: PrBeforeMerge | undefined;
957
+ if (ctx.args.requires && !ctx.args.beforeMerge) return fail("--requires names the checks of an apply before merge, so it needs --before-merge --pr <n>");
815
958
  if (ctx.args.beforeMerge) {
816
959
  const checked = await beforeMergeChecks(ctx);
817
960
  if (typeof checked === "number") return checked;
@@ -870,7 +1013,7 @@ async function prApply(ctx: CommandContext, stage: StageEvents, beforeMerge?: Pr
870
1013
  const set: PrPlanSet = { doc: composeChangeSet([]), members: [], plans: {}, outputs: {}, failed: false };
871
1014
  return stopper(ctx, p, events, upload)(
872
1015
  prReport({ stage: "apply", pr, env: p.env, ...(p.member ? { member: p.member } : {}), base: p.base, head: p.head, op, gate: p.gate, plan: p.plan, signal: p.signal, set, approval: { status: "pending" }, status: "refused", refusal: "locked", message: held }),
873
- GATED_EXIT_CODE,
1016
+ CHANT_EXIT.held,
874
1017
  );
875
1018
  }
876
1019
  }
@@ -930,12 +1073,22 @@ async function prApply(ctx: CommandContext, stage: StageEvents, beforeMerge?: Pr
930
1073
  ...base,
931
1074
  approval: { status: "pending" },
932
1075
  status: "plan-failed",
933
- message: "A member failed to plan, so there is no plan to compare with the approved one. Nothing was applied.",
1076
+ message: set.policyDenied
1077
+ ? "The policy denied a member's plan, so nothing was applied."
1078
+ : "A member failed to plan, so there is no plan to compare with the approved one. Nothing was applied.",
934
1079
  }),
935
- 1,
1080
+ set.policyDenied ? CHANT_EXIT.denied : 1,
936
1081
  );
937
1082
  }
938
1083
 
1084
+ // #4552, ruling D: on the resource grain a pull request's locks name row keys, which only the plan knows.
1085
+ const lockTargets = lockTargetsOf(p.plan.order, set.locks);
1086
+ if (locks && anyResourceGrain(set.locks)) {
1087
+ const held = await heldLocksOf(p, pr, lockTargets);
1088
+ if (typeof held === "number") return held;
1089
+ if (held) return stop(prReport({ ...base, approval: { status: "pending" }, status: "refused", refusal: "locked", message: held }), CHANT_EXIT.held);
1090
+ }
1091
+
939
1092
  // #4022: keep the change set the gate binds on chant/lifecycle under its
940
1093
  // digest before deciding the gate, so the plan an approval bound, or the
941
1094
  // one a pending fact waits on, can be read once this job is gone.
@@ -955,7 +1108,7 @@ async function prApply(ctx: CommandContext, stage: StageEvents, beforeMerge?: Pr
955
1108
  // #4323: the after-gate hooks hear the decision, a refusal too; only a failure that would have applied changes the outcome.
956
1109
  const afterGate = await runGateHook(p, { op, digest: set.doc.digest, satisfied: decided.satisfied }, p.plan.order);
957
1110
  if (afterGate && decided.satisfied) return stop(prReport({ ...base, approval, status: "failed", message: afterGate }), 1);
958
- if (!decided.satisfied) return stop(prReport({ ...base, approval, status: "refused", refusal: decided.refusal, message: decided.message }), GATED_EXIT_CODE);
1111
+ if (!decided.satisfied) return stop(prReport({ ...base, approval, status: "refused", refusal: decided.refusal, message: decided.message }), decided.refusal === "plan-changed" ? CHANT_EXIT.moved : CHANT_EXIT.waiting);
959
1112
  via = decided.via;
960
1113
  }
961
1114
 
@@ -970,10 +1123,14 @@ async function prApply(ctx: CommandContext, stage: StageEvents, beforeMerge?: Pr
970
1123
  if (unspent) return stop(prReport({ ...base, approval, status: "refused", refusal: "policy-denied", message: unspent }), 1);
971
1124
  // #4293, #4301: under ci.locks an apply before merge holds its targets until the pull request merges or closes.
972
1125
  if (locks && beforeMerge && pr !== null) {
973
- const taken = await takeApplyLocks(p, pr);
1126
+ const taken = await takeApplyLocks(p, pr, lockTargets);
974
1127
  if (typeof taken === "number") return taken;
975
- if (taken) return stop(prReport({ ...base, approval, status: "refused", refusal: "locked", message: taken }), GATED_EXIT_CODE);
1128
+ if (taken) return stop(prReport({ ...base, approval, status: "refused", refusal: "locked", message: taken }), CHANT_EXIT.held);
976
1129
  }
1130
+ // #4552: on the resource grain the apply leases the rows it changes, whatever ci.locks says, and lets go when it ends.
1131
+ const lease = await leaseSetRows(p, set);
1132
+ if (typeof lease === "number") return lease;
1133
+ if ("held" in lease) return stop(prReport({ ...base, approval, status: "refused", refusal: "locked", message: lease.held }), CHANT_EXIT.held);
977
1134
 
978
1135
  // The record is written before the first component runs and again as each
979
1136
  // one settles, so a run killed partway still knows what applied.
@@ -1010,7 +1167,10 @@ async function prApply(ctx: CommandContext, stage: StageEvents, beforeMerge?: Pr
1010
1167
  // #4288: the before-apply hooks, once the gate and the review let the apply through.
1011
1168
  const toApply = (resumed?.plan ?? p.plan).order.filter((name) => !completedSoFar.has(name));
1012
1169
  const beforeFailed = await runStageHook(p, "before-apply", toApply);
1013
- if (beforeFailed) return stop(prReport({ ...base, approval, status: "failed", message: beforeFailed }), 1);
1170
+ if (beforeFailed) {
1171
+ await lease.release();
1172
+ return stop(prReport({ ...base, approval, status: "failed", message: beforeFailed }), 1);
1173
+ }
1014
1174
 
1015
1175
  // #3999: a round planned after an upstream applied waits on a gate of its
1016
1176
  // own, under the same identity.gates rule and the same review checks.
@@ -1036,37 +1196,47 @@ async function prApply(ctx: CommandContext, stage: StageEvents, beforeMerge?: Pr
1036
1196
  return { satisfied: true, approval: roundApproval };
1037
1197
  };
1038
1198
 
1039
- const applied = await applyPrSet({
1040
- components: p.components,
1041
- plan: resumed?.plan ?? p.plan,
1042
- registry: p.registry,
1043
- env: p.env,
1044
- set,
1045
- gate: p.gate,
1046
- approval,
1047
- decideRound,
1048
- ...(resumed ? { resumed: prior } : {}),
1049
- // The apply is this run's waves, so the fan-out's own run framing is
1050
- // dropped. The log's lines go to stderr with or without --events-json.
1051
- onRunEvent: (body: RunEventBody) => {
1052
- events?.nested(body);
1053
- log(body);
1054
- },
1055
- ...(resumePath
1056
- ? {
1057
- onComponentSettled: (settled, outputs) => {
1058
- if (settled.status === "ok") {
1059
- completedSoFar.add(settled.component);
1060
- if (inputsNow[settled.component] !== undefined) inputsSoFar[settled.component] = inputsNow[settled.component]!;
1061
- if (outputs) outputsSoFar[settled.component] = outputs;
1062
- } else if (settled.status === "fail") {
1063
- failedSoFar.push(settled.component);
1064
- }
1065
- recordAttempt();
1066
- },
1067
- }
1068
- : {}),
1069
- });
1199
+ const lockGrain = await declaredLockGrainOf(p);
1200
+ let applied: Awaited<ReturnType<typeof applyPrSet>>;
1201
+ try {
1202
+ applied = await applyPrSet({
1203
+ components: p.components,
1204
+ plan: resumed?.plan ?? p.plan,
1205
+ registry: p.registry,
1206
+ env: p.env,
1207
+ set,
1208
+ ...(lockGrain ? { lockGrain } : {}),
1209
+ policyBase: p.base,
1210
+ gate: p.gate,
1211
+ approval,
1212
+ decideRound,
1213
+ // #4594: a later round's plan may change rows the first did not, so it leases its own.
1214
+ leaseRound: leaseRoundRows(p),
1215
+ ...(resumed ? { resumed: prior } : {}),
1216
+ // The apply is this run's waves, so the fan-out's own run framing is
1217
+ // dropped. The log's lines go to stderr with or without --events-json.
1218
+ onRunEvent: (body: RunEventBody) => {
1219
+ events?.nested(body);
1220
+ log(body);
1221
+ },
1222
+ ...(resumePath
1223
+ ? {
1224
+ onComponentSettled: (settled, outputs) => {
1225
+ if (settled.status === "ok") {
1226
+ completedSoFar.add(settled.component);
1227
+ if (inputsNow[settled.component] !== undefined) inputsSoFar[settled.component] = inputsNow[settled.component]!;
1228
+ if (outputs) outputsSoFar[settled.component] = outputs;
1229
+ } else if (settled.status === "fail") {
1230
+ failedSoFar.push(settled.component);
1231
+ }
1232
+ recordAttempt();
1233
+ },
1234
+ }
1235
+ : {}),
1236
+ });
1237
+ } finally {
1238
+ await lease.release();
1239
+ }
1070
1240
  recordAttempt();
1071
1241
  // #4288: the after-apply hooks, for the components that applied.
1072
1242
  const afterFailed = await runStageHook(p, "after-apply", toApply.filter((name) => applied.run.completed.includes(name)), undefined, "the apply counts as failed though its components applied");
@@ -1078,12 +1248,23 @@ async function prApply(ctx: CommandContext, stage: StageEvents, beforeMerge?: Pr
1078
1248
  members: applied.members,
1079
1249
  ...(resumed ? { resumed: resumed.completed } : {}),
1080
1250
  ...(applied.rounds ? { rounds: applied.rounds } : {}),
1081
- ...(applied.status === "waiting" ? { message: waitingMessage(op, applied.rounds) } : {}),
1251
+ ...(applied.held ? { message: applied.held } : applied.leaseFailed ? { message: applied.leaseFailed } : applied.status === "waiting" ? { message: waitingMessage(op, applied.rounds) } : {}),
1082
1252
  });
1083
1253
  // A component that stopped at a gate of its own leaves the apply waiting on
1084
1254
  // a person. A step that refused its plan because the target moved since
1085
- // the approval exits 3, as a moved digest does before anything applies (#3997).
1086
- const exit = afterFailed ? 1 : applied.status === "applied" ? 0 : applied.status === "waiting" ? GATED_EXIT_CODE : failedRunExitCode(applied.run.results);
1255
+ // the approval exits 4 (moved), as a moved digest does before anything applies (#3997, #4553).
1256
+ // A later round whose rows another run holds exits 5 (held, #4594).
1257
+ const exit = afterFailed
1258
+ ? 1
1259
+ : applied.held
1260
+ ? CHANT_EXIT.held
1261
+ : applied.status === "applied"
1262
+ ? 0
1263
+ : applied.status === "waiting"
1264
+ ? GATED_EXIT_CODE
1265
+ : applied.leaseFailed
1266
+ ? 1
1267
+ : failedRunExitCode(applied.run.results);
1087
1268
  if (green && applied.status === "applied") await recordGreenApplied(p, green, set.doc.digest, approval, via);
1088
1269
  const code = await stop(report, exit, applied.run.status === "gated" ? "gated" : undefined);
1089
1270
  if (applied.status === "applied" && !afterFailed) console.error(formatSuccess(`applied the plan ${report.digest} approved by ${(approval.approvedBy ?? []).join(", ")}`));
@@ -1098,12 +1279,12 @@ async function prApply(ctx: CommandContext, stage: StageEvents, beforeMerge?: Pr
1098
1279
  * `--forge` every lock counts. A lock file that cannot be read stops the
1099
1280
  * apply, since nothing then says the targets are free.
1100
1281
  */
1101
- async function heldLocksOf(p: Prepared, pr: number | null): Promise<string | null | number> {
1282
+ async function heldLocksOf(p: Prepared, pr: number | null, targets: readonly string[] = p.plan.order): Promise<string | null | number> {
1102
1283
  const { heldTargetLocks, describeHeldTargetLocks } = await import("../../lifecycle/target-lock");
1103
1284
  const isOpen = p.forge?.pullRequestOpen?.bind(p.forge);
1104
1285
  let held;
1105
1286
  try {
1106
- held = await heldTargetLocks(p.gate, p.plan.order, pr, { ...(isOpen ? { isOpen } : {}) });
1287
+ held = await heldTargetLocks(p.gate, targets, pr, { ...(isOpen ? { isOpen } : {}) });
1107
1288
  } catch (err) {
1108
1289
  return fail(`could not read the target locks of ${p.gate}, so nothing was applied: ${err instanceof Error ? err.message : String(err)}`);
1109
1290
  }
@@ -1127,6 +1308,10 @@ async function beforeMergeChecks(ctx: CommandContext): Promise<PrBeforeMerge | n
1127
1308
  if (args.pr === undefined) return fail("--before-merge applies an open pull request, so it needs --pr <n>");
1128
1309
  if (!args.forge || !(FORGE_KINDS as readonly string[]).includes(args.forge)) return fail("--before-merge asks the forge whether the pull request is ready, so it needs --forge github|gitlab|forgejo");
1129
1310
  if (!args.base) return fail("pr-apply needs the commit the change is measured from: --base <ref>", "Before merge, the target branch's commit.");
1311
+ const { checkPrRequires, unmetRequires, parseRequiresList } = await import("../../pr-requires");
1312
+ // #4607: a product's `apply.requires` names the checks to ask; absent, all four.
1313
+ const only = args.requires ? parseRequiresList(args.requires) : undefined;
1314
+ if (only && "error" in only) return fail(only.error);
1130
1315
  const cwd = resolve(".");
1131
1316
  let forge: PrForge;
1132
1317
  let head: string;
@@ -1142,7 +1327,6 @@ async function beforeMergeChecks(ctx: CommandContext): Promise<PrBeforeMerge | n
1142
1327
  const gate = args.gate ?? PR_APPLY_GATE;
1143
1328
  const { ciWorkflowAt } = await import("../../workspace/ci-workflow-at");
1144
1329
  const { appliesBeforeMerge } = await import("../../workspace/ci-workflow");
1145
- const { checkPrRequires, unmetRequires } = await import("../../pr-requires");
1146
1330
  const workflow = ciWorkflowAt(cwd, args.base, member);
1147
1331
  const early = earlyStop(ctx, forge, { pr: args.pr, base, head, gate, ...(member ? { member } : {}) });
1148
1332
  if (!appliesBeforeMerge(workflow)) {
@@ -1154,9 +1338,10 @@ async function beforeMergeChecks(ctx: CommandContext): Promise<PrBeforeMerge | n
1154
1338
  );
1155
1339
  }
1156
1340
  // The apply's own statuses never hold it back: chant ci run's, and the report's.
1157
- const ignore = [`chant/${gate}`, `chant/${PR_APPLY_GATE}`, prStatusContext("apply", member)];
1158
- // No `only`: ws-106 gives the declaration no way to leave a check out, so all four are asked (#4336).
1159
- const requires = await checkPrRequires(forge, args.pr, head, { ignore });
1341
+ // #4550: under a product's words its own prefix too.
1342
+ const ignore = [...new Set([productContext(activeProductWords(), gate), productContext(activeProductWords(), PR_APPLY_GATE), `chant/${gate}`, `chant/${PR_APPLY_GATE}`, prStatusContext("apply", member)])];
1343
+ // ws-106 gives the declaration no way to leave a check out, so with no --requires all four are asked (#4336, #4607).
1344
+ const requires = await checkPrRequires(forge, args.pr, head, { ignore, ...(only ? { only: only.checks } : {}) });
1160
1345
  for (const r of requires) console.error(formatInfo(`${r.name}: ${r.passed ? "passed" : r.pending ? "pending" : "unmet"}, ${r.reason}`));
1161
1346
  const unmet = unmetRequires(requires);
1162
1347
  if (unmet) {
@@ -1183,13 +1368,13 @@ function earlyStop(ctx: CommandContext, forge: PrForge, at: { pr: number; base:
1183
1368
  * refusal when another open pull request holds one, null once taken, or the
1184
1369
  * exit code when the locks could not be written.
1185
1370
  */
1186
- async function takeApplyLocks(p: Prepared, pr: number): Promise<string | null | number> {
1371
+ async function takeApplyLocks(p: Prepared, pr: number, targets: readonly string[] = p.plan.order): Promise<string | null | number> {
1187
1372
  const { takeTargetLocks, describeHeldTargetLocks } = await import("../../lifecycle/target-lock");
1188
1373
  const isOpen = p.forge?.pullRequestOpen?.bind(p.forge);
1189
1374
  const by = process.env.GITHUB_ACTOR ?? process.env.GITLAB_USER_LOGIN ?? process.env.USER ?? "unknown";
1190
1375
  let result;
1191
1376
  try {
1192
- result = await takeTargetLocks(p.gate, p.plan.order, { pr, by, at: new Date().toISOString(), stage: "apply", head: p.head }, { ...(isOpen ? { isOpen } : {}) });
1377
+ result = await takeTargetLocks(p.gate, targets, { pr, by, at: new Date().toISOString(), stage: "apply", head: p.head }, { ...(isOpen ? { isOpen } : {}) });
1193
1378
  } catch (err) {
1194
1379
  return fail(`could not take the target locks of ${p.gate}, so nothing was applied: ${err instanceof Error ? err.message : String(err)}`);
1195
1380
  }
@@ -1541,6 +1726,11 @@ function settleWords(body: RunEventComponentSettle): string {
1541
1726
  * pr-apply's job log (#4007): a line on stderr as each wave starts and as
1542
1727
  * each component settles, so the log shows the waves in order while they run.
1543
1728
  */
1729
+ /** One wave's fan-out numbers its wave 1; the events and the log carry the derivation's number (#4003). */
1730
+ function inWave(body: RunEventBody, wave: number): RunEventBody {
1731
+ return "wave" in body && typeof (body as { wave?: unknown }).wave === "number" ? ({ ...body, wave } as RunEventBody) : body;
1732
+ }
1733
+
1544
1734
  function applyLog(): (body: RunEventBody) => void {
1545
1735
  let waves = 0;
1546
1736
  return (body) => {
@@ -1646,8 +1836,10 @@ async function tryResume(p: Prepared, attempt: FanOutAttempt, file: string, op:
1646
1836
  registry: p.registry,
1647
1837
  env: p.env,
1648
1838
  seededOutputs: p.seededOutputs,
1839
+ policyBase: p.base,
1649
1840
  record,
1650
1841
  completed,
1842
+ applied: outputs,
1651
1843
  });
1652
1844
  if (!resumed.ok) return skip(`what is left is not what was approved. ${resumed.reasons.join("; ")}`);
1653
1845
  console.error(formatInfo(`resume : ${completed.join(", ")} applied in an earlier attempt; applying ${resumed.plan.order.join(", ") || "nothing more"} under the approval of ${record.digest}`));
@@ -1702,22 +1894,20 @@ async function carryWaves(p: Prepared, attempt: FanOutAttempt, file: string, op:
1702
1894
  return { record, check, approval: approvalOf(check), completed, outputs };
1703
1895
  }
1704
1896
 
1705
- /** A run event with its wave renumbered to `wave`: the fan-out that applies one wave numbers it 1. */
1706
- function inWave(body: RunEventBody, wave: number): RunEventBody {
1707
- return "wave" in body && typeof (body as { wave?: unknown }).wave === "number" ? ({ ...body, wave } as RunEventBody) : body;
1708
- }
1709
-
1710
1897
  /**
1711
1898
  * `pr-apply --wave-gate <gate>` (#4003): apply the pull request's approved
1712
1899
  * set a wave at a time, each wave planned after the one before it applied.
1713
1900
  *
1714
1901
  * The first job plans every member, as pr-apply does, and decides the pull
1715
- * request's gate against that digest. Approved, wave 1 applies with those
1716
- * plans. Each later wave is planned again against the outputs the waves
1717
- * before it left. When the approved change set covers its plan
1718
- * (`planCoveredBy`, as on a resume) it applies under the pull request's
1719
- * approval; when it does not, it waits at `<gate>-wave-<k>` under the pull
1720
- * request's op for an approval of its new plan, and exits 3.
1902
+ * request's gate against that digest. The waves then run on op waves
1903
+ * (#4588): the component waves spec (`componentWavesSpec`), each run a
1904
+ * component, planned and applied through the component plan-wave and
1905
+ * apply-wave steps (`chant components plan-wave|apply-wave`). Each wave is
1906
+ * planned against the outputs the waves before it left. When the approved
1907
+ * change set covers its plan (`planCoveredBy`, the op waves' `pull-request`
1908
+ * approval) it applies under the pull request's approval; when it does not,
1909
+ * it waits at `<gate>-wave-<k>` under the pull request's op for an approval
1910
+ * of its new plan, and exits 3.
1721
1911
  *
1722
1912
  * With `--wave <k>` the job runs wave k and no other, reading the approved
1723
1913
  * set and the progress from the `--resume` record the job before it left.
@@ -1838,7 +2028,6 @@ async function prApplyWaves(
1838
2028
  );
1839
2029
  }
1840
2030
 
1841
- let planned: PrPlanSet | undefined;
1842
2031
  let judged: PolicyJudged = { held: false };
1843
2032
  if (carry) {
1844
2033
  // What the earlier waves applied settles first (#4007), each in its own wave, as a resumed apply's does.
@@ -1854,6 +2043,7 @@ async function prApplyWaves(
1854
2043
  const set = await planAll(p, events?.emit);
1855
2044
  approved = set;
1856
2045
  if (set.failed) {
2046
+ if (set.policyDenied) return stop(report({ status: "plan-failed", message: "The policy denied a member's plan, so nothing was applied." }), CHANT_EXIT.denied);
1857
2047
  return stop(report({ status: "plan-failed", message: "A member failed to plan, so there is no plan to compare with the approved one. Nothing was applied." }), 1);
1858
2048
  }
1859
2049
  await storeChangeSetForGate(ctx, p, set.doc);
@@ -1865,9 +2055,8 @@ async function prApplyWaves(
1865
2055
  // #4323: the after-gate hooks hear the decision, a refusal too.
1866
2056
  const afterGate = await runGateHook(p, { op, digest: set.doc.digest, satisfied: decided.satisfied }, p.plan.order);
1867
2057
  if (afterGate && decided.satisfied) return stop(report({ status: "failed", message: afterGate }), 1);
1868
- if (!decided.satisfied) return stop(report({ status: "refused", refusal: decided.refusal, message: decided.message }), GATED_EXIT_CODE);
2058
+ if (!decided.satisfied) return stop(report({ status: "refused", refusal: decided.refusal, message: decided.message }), decided.refusal === "plan-changed" ? CHANT_EXIT.moved : CHANT_EXIT.waiting);
1869
2059
  via = decided.via;
1870
- planned = set;
1871
2060
  }
1872
2061
  const approvedSet = approved!;
1873
2062
 
@@ -1911,8 +2100,11 @@ async function prApplyWaves(
1911
2100
  const from = only ?? (left || total + 1);
1912
2101
  const to = only ?? total;
1913
2102
  /** The last apply in this job that failed (#4291): its results give the exit code once every wave ran. */
1914
- let lastFailure: { results: Parameters<typeof failedRunExitCode>[0]; gated: boolean } | undefined;
2103
+ let lastFailure: { exitCode: number } | undefined;
1915
2104
  let planFailedIn: number | undefined;
2105
+ // #4588: the outputs file the waves' plan-wave and apply-wave steps hand outputs on in.
2106
+ const { componentWaveOutputsFile } = await import("../../components/product-pipeline");
2107
+ const outputsFile = componentWaveOutputsFile(op);
1916
2108
  for (let k = from; k <= to; k++) {
1917
2109
  // #4291: a component of this wave whose upstream failed, or was blocked by a failure, is blocked; the rest of the wave runs.
1918
2110
  const before = new Set(p.plan.waves.slice(0, k - 1).flat());
@@ -1931,138 +2123,59 @@ async function prApplyWaves(
1931
2123
  if (blockedNow.size > 0) recordAttempt();
1932
2124
  continue;
1933
2125
  }
1934
- const inThisWave = new Set(wavePlan.order);
1935
-
1936
- // Wave 1 of the apply that just planned every member applies those plans:
1937
- // they are the approved set's. Every other wave is planned again, against
1938
- // the outputs the waves before it left.
1939
- let set: PrPlanSet;
1940
- let entry: PrWave;
1941
- if (planned && k === 1) {
1942
- set = {
1943
- ...planned,
1944
- members: planned.members.filter((m) => inThisWave.has(m.component)),
1945
- plans: Object.fromEntries(Object.entries(planned.plans).filter(([name]) => inThisWave.has(name))),
1946
- };
1947
- entry = { wave: k, components: wavePlan.order, status: "applied", approval: "pull-request", gate: p.gate, digest: approvedSet.doc.digest, ...(approval.approvedBy ? { approvedBy: approval.approvedBy } : {}) };
1948
- } else {
1949
- const notApplied = Object.fromEntries(Object.entries(approvedSet.outputs).filter(([name]) => !completed.has(name)));
1950
- const fresh = await hookedPlan(p, wavePlan.order, () =>
1951
- planPrSet({
1952
- components: p.components,
1953
- plan: wavePlan,
1954
- registry: p.registry,
1955
- env: p.env,
1956
- seededOutputs: { ...p.seededOutputs, ...notApplied, ...outputsSoFar },
1957
- ...(events ? { onRunEvent: (body: RunEventBody) => events.emit(body) } : {}),
1958
- }),
1959
- );
1960
- if (fresh.failed) {
1961
- for (const m of fresh.members) {
1962
- after.set(m.member, m);
1963
- if (m.status === "plan-failed") failedSoFar.add(m.component);
1964
- }
1965
- setWave({ wave: k, components: wavePlan.order, status: "plan-failed", approval: "pull-request", gate: p.gate, digest: approvedSet.doc.digest });
1966
- // #4291: the later waves still run what does not depend on this wave.
1967
- console.error(formatWarning({ message: `A member of wave ${k} failed to plan, so nothing in wave ${k} was applied.`, hint: "The waves after it apply what does not depend on wave " + k + "." }));
1968
- planFailedIn ??= k;
1969
- continue;
1970
- }
1971
- const moved = waveNotCovered(approvedSet.doc, fresh.doc, approvedSet.members, { approved: approvedSet.shapes, fresh: fresh.shapes });
1972
- set = fresh;
1973
- if (moved.length === 0) {
1974
- console.error(formatInfo(`wave ${k}: the approved plan covers what it plans now, so it applies under the pull request's approval`));
1975
- entry = { wave: k, components: wavePlan.order, status: "applied", approval: "pull-request", gate: p.gate, digest: approvedSet.doc.digest, ...(approval.approvedBy ? { approvedBy: approval.approvedBy } : {}) };
1976
- } else {
1977
- const gate = waveGateName(waveGate, k);
1978
- const digest = fresh.doc.digest;
1979
- console.error(formatInfo(`wave ${k}: its plan moved since the pull request's (${moved.join("; ")}), so it needs an approval of ${gate}`));
1980
- await storeChangeSetForGate(ctx, p, fresh.doc);
1981
- writeWaveChangeSet(ctx, k, fresh.doc, upload);
1982
- const approveLine = prApproveCommand({ op, gate, digest });
1983
- const check = await emitGateStep(
1984
- events?.emit,
1985
- { op, gate },
1986
- () => decidePrGate(gitGateLedgerPort(), { op, gate, digest, description: `${changeLabel(pr, green)}, wave ${k} of ${total}: ${wavePlan.order.join(", ")}` }),
1987
- (unapproved) =>
1988
- unapproved.mismatch
1989
- ? `wave ${k}'s plan changed after its approval. Approve the plan now: ${approveLine}`
1990
- : `wave ${k}'s plan is not the one the pull request approved. Approve it: ${approveLine}`,
1991
- );
1992
- const waveApproval = approvalOf(check);
1993
- const waiting: PrWave = {
1994
- wave: k,
1995
- components: wavePlan.order,
1996
- status: "waiting",
1997
- approval: "wave",
1998
- gate,
1999
- digest,
2000
- moved,
2001
- ...(waveApproval.approved ? { approved: waveApproval.approved } : {}),
2002
- };
2003
- if (!check.satisfied) {
2004
- setWave(waiting);
2005
- const message =
2006
- waveApproval.status === "changed"
2007
- ? `Wave ${k}'s plan changed after its approval, so nothing in it was applied. approved: ${waveApproval.approved ?? "(none)"}; planned now: ${digest}. ` +
2008
- `Read the new plan, and if it is right, approve it: ${approveLine}; then run the wave's apply again.`
2009
- : `Wave ${k} was planned after the waves before it applied, and the pull request's approved plan does not cover it: ${moved.join("; ")}. ` +
2010
- `Nothing in wave ${k} was applied. Read its plan, and if it is right, approve it: ${approveLine}; then run the wave's apply again.`;
2011
- return stop(report({ status: "refused", refusal: waveApproval.status === "changed" ? "wave-plan-changed" : "wave-not-approved", message }), GATED_EXIT_CODE);
2012
- }
2013
- const waveReview = await review(waveApproval.approvedBy ?? [], `Wave ${k}'s plan`);
2014
- if (waveReview && "error" in waveReview) return fail(waveReview.error);
2015
- if (waveReview) {
2016
- setWave(waiting);
2017
- emitReviewStop(events, waveReview.message);
2018
- return stop(report({ status: "refused", refusal: waveReview.refusal, message: waveReview.message }), GATED_EXIT_CODE);
2019
- }
2020
- entry = { wave: k, components: wavePlan.order, status: "applied", approval: "wave", gate, digest, moved, ...(waveApproval.approvedBy ? { approvedBy: waveApproval.approvedBy } : {}) };
2021
- }
2022
- }
2023
-
2126
+ // #4588: the wave plans, waits or passes its gate, and applies on op waves: the component waves spec,
2127
+ // each run a component, through the component plan-wave and apply-wave steps.
2128
+ const pending: PrWave = { wave: k, components: wavePlan.order, status: "applied", approval: "pull-request", gate: p.gate, digest: approvedSet.doc.digest };
2024
2129
  // #4288: the wave's apply-side hooks, around its apply.
2025
2130
  const waveBefore = await runStageHook(p, "before-apply", wavePlan.order, undefined, `nothing in wave ${k} was applied`);
2026
2131
  if (waveBefore) {
2027
- setWave({ ...entry, status: "failed" });
2132
+ setWave({ ...pending, status: "failed" });
2028
2133
  return stop(report({ status: "failed", message: waveBefore }), 1);
2029
2134
  }
2030
- const applied = await applyPrSet({
2031
- components: p.components,
2032
- plan: wavePlan,
2033
- registry: p.registry,
2034
- env: p.env,
2035
- set,
2036
- // One wave's fan-out numbers its wave 1; the events and the log carry the derivation's number.
2037
- onRunEvent: (body: RunEventBody) => {
2038
- const numbered = inWave(body, k);
2039
- events?.nested(numbered);
2040
- if (numbered.type !== "run-start") log(numbered);
2041
- },
2042
- onComponentSettled: (settled, outputs) => {
2043
- if (settled.status === "ok") {
2044
- completed.add(settled.component);
2045
- failedSoFar.delete(settled.component);
2046
- if (inputsNow[settled.component] !== undefined) inputsSoFar[settled.component] = inputsNow[settled.component]!;
2047
- if (outputs) outputsSoFar[settled.component] = outputs;
2048
- } else if (settled.status === "fail") {
2049
- failedSoFar.add(settled.component);
2050
- }
2051
- recordAttempt();
2052
- },
2053
- });
2054
- for (const m of applied.members) after.set(m.member, m);
2055
- for (const name of applied.run.completed) {
2135
+ // The outputs the waves before this one left, and the approved set's for what has not applied yet, seed its plans.
2136
+ const notApplied = Object.fromEntries(Object.entries(approvedSet.outputs).filter(([name]) => !completed.has(name)));
2137
+ mkdirSync(dirname(resolve(outputsFile)), { recursive: true });
2138
+ writeFileSync(resolve(outputsFile), JSON.stringify({ ...p.seededOutputs, ...notApplied, ...outputsSoFar }, null, 2) + "\n");
2139
+ const ran = await runComponentWave(p, { op, waveGate, k, runs: wavePlan.order, approved: approvedSet.doc, approvedBy: approval.approvedBy ?? [], outputsFile, ...(args.noReleaseRecord ? { noReleaseRecord: true } : {}), review, ...(events ? { events } : {}), log });
2140
+ const entry = ran.entry;
2141
+ if (ran.review && "error" in ran.review) return fail(ran.review.error);
2142
+ if (ran.review && ran.exitCode === CHANT_EXIT.waiting) {
2143
+ setWave(entry);
2144
+ emitReviewStop(events, ran.review.message);
2145
+ return stop(report({ status: "refused", refusal: ran.review.refusal, message: ran.review.message }), GATED_EXIT_CODE);
2146
+ }
2147
+ for (const name of ran.applied) {
2056
2148
  completed.add(name);
2057
- const outputs = applied.run.componentOutputs[name];
2058
- if (outputs) outputsSoFar[name] = outputs;
2149
+ failedSoFar.delete(name);
2150
+ if (inputsNow[name] !== undefined) inputsSoFar[name] = inputsNow[name]!;
2151
+ if (ran.outputs[name]) outputsSoFar[name] = ran.outputs[name]!;
2152
+ }
2153
+ for (const name of ran.failed) failedSoFar.add(name);
2154
+ if (ran.exitCode === CHANT_EXIT.waiting || ran.exitCode === CHANT_EXIT.moved) {
2155
+ setWave(entry);
2156
+ // #4003: the wave's new plan beside the report, for whoever approves its gate.
2157
+ if (ran.changeSet) writeWaveChangeSet(ctx, k, ran.changeSet, upload);
2158
+ const approveLine = prApproveCommand({ op, gate: entry.gate, digest: entry.digest });
2159
+ const message =
2160
+ ran.exitCode === CHANT_EXIT.moved
2161
+ ? `Wave ${k}'s plan changed after its approval, so nothing in it was applied.${entry.approved ? ` approved: ${entry.approved}; planned now: ${entry.digest}.` : ""} Read the new plan, and if it is right, approve it: ${approveLine}; then run the wave's apply again.`
2162
+ : `Wave ${k} was planned after the waves before it applied, and the pull request's approved plan does not cover it${entry.moved?.length ? `: ${entry.moved.join("; ")}` : ""}. ` +
2163
+ `Nothing in wave ${k} was applied. Read its plan, and if it is right, approve it: ${approveLine}; then run the wave's apply again.`;
2164
+ return stop(report({ status: "refused", refusal: ran.exitCode === CHANT_EXIT.moved ? "wave-plan-changed" : "wave-not-approved", message }), ran.exitCode);
2059
2165
  }
2060
- const waveAfter = await runStageHook(p, "after-apply", wavePlan.order.filter((name) => applied.run.completed.includes(name)), undefined, `wave ${k} counts as failed though its components applied`);
2061
- setWave({ ...entry, status: applied.status === "applied" && !waveAfter ? "applied" : "failed" });
2062
- await recordAutoReleasesForRun(applied.run.results, p.env, at.release.runId, resolveAutoReleaseDisabled(p.config, args.noReleaseRecord), at.release.runOrigin, undefined, undefined, prAppliedDigests(p, applied.members));
2063
- if (applied.status !== "applied") {
2166
+ if (ran.exitCode === CHANT_EXIT.held) {
2167
+ setWave({ ...entry, status: "waiting" });
2168
+ return stop(report({ status: "refused", refusal: "locked", message: `Wave ${k}: another run holds what it changes, so nothing in it was applied.` }), CHANT_EXIT.held);
2169
+ }
2170
+ if (ran.exitCode === CHANT_EXIT.denied || ran.exitCode === CHANT_EXIT.declined || ran.exitCode === CHANT_EXIT.superseded) {
2171
+ setWave({ ...entry, status: "failed" });
2172
+ return stop(report({ status: "failed", message: `Wave ${k} stopped on op waves with exit ${ran.exitCode}; nothing more was applied.` }), ran.exitCode);
2173
+ }
2174
+ const waveAfter = await runStageHook(p, "after-apply", wavePlan.order.filter((name) => ran.applied.includes(name)), undefined, `wave ${k} counts as failed though its components applied`);
2175
+ setWave({ ...entry, status: ran.exitCode === CHANT_EXIT.done && !waveAfter ? "applied" : "failed" });
2176
+ if (ran.exitCode !== CHANT_EXIT.done) {
2064
2177
  // #4291: a failed member blocks only its dependents, so the later waves still run.
2065
- lastFailure = { results: applied.run.results, gated: applied.run.status === "gated" };
2178
+ lastFailure = { exitCode: ran.exitCode };
2066
2179
  recordAttempt();
2067
2180
  continue;
2068
2181
  }
@@ -2079,8 +2192,7 @@ async function prApplyWaves(
2079
2192
  : blockedLine ? blockedLine.trim() : undefined;
2080
2193
  return stop(
2081
2194
  report({ status: "failed", ...(message ? { message } : {}) }),
2082
- lastFailure ? failedRunExitCode(lastFailure.results) : 1,
2083
- lastFailure?.gated ? "gated" : undefined,
2195
+ lastFailure ? lastFailure.exitCode : 1,
2084
2196
  );
2085
2197
  }
2086
2198
 
@@ -2089,6 +2201,356 @@ async function prApplyWaves(
2089
2201
  return stop(report({ status: done ? "applied" : "wave-applied" }), 0);
2090
2202
  }
2091
2203
 
2204
+ // ── The component plan-wave and apply-wave steps (#4588) ─────────────────────
2205
+
2206
+ /** The outputs earlier waves' components left, from `--wave-outputs`; empty when the file is not there yet. */
2207
+ function readWaveOutputs(file: string | undefined): { outputs: Record<string, Record<string, unknown>> } | { error: string } {
2208
+ if (!file || !existsSync(resolve(file))) return { outputs: {} };
2209
+ try {
2210
+ const parsed = JSON.parse(readFileSync(resolve(file), "utf8")) as unknown;
2211
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return { error: `--wave-outputs ${file} must hold { "<component>": { ...outputs } }` };
2212
+ return { outputs: parsed as Record<string, Record<string, unknown>> };
2213
+ } catch (err) {
2214
+ return { error: `--wave-outputs: could not read "${file}": ${err instanceof Error ? err.message : String(err)}` };
2215
+ }
2216
+ }
2217
+
2218
+ /** The runs `chant run wave` wrote to `{runs}`: their targets, each a component, and on apply-wave the digest each was approved at. */
2219
+ function readWaveRuns(file: string | undefined): Array<{ target: string; planDigest?: string }> | { error: string } {
2220
+ if (!file) return { error: "the step needs --runs <file>, which chant run wave fills in as {runs}" };
2221
+ try {
2222
+ const parsed = JSON.parse(readFileSync(resolve(file), "utf8")) as { runs?: unknown };
2223
+ if (!Array.isArray(parsed?.runs)) return { error: `--runs ${file} has no runs` };
2224
+ return (parsed.runs as Array<{ target?: unknown; planDigest?: unknown }>).flatMap((r) =>
2225
+ typeof r?.target === "string" ? [{ target: r.target, ...(typeof r.planDigest === "string" ? { planDigest: r.planDigest } : {}) }] : [],
2226
+ );
2227
+ } catch (err) {
2228
+ return { error: `--runs: could not read "${file}": ${err instanceof Error ? err.message : String(err)}` };
2229
+ }
2230
+ }
2231
+
2232
+ /** The fan-out plan of `names`, one wave of the derivation, with the rest of that wave counted as done. */
2233
+ function namedWavePlan(p: Prepared, names: readonly string[]): FanOutPlan | { error: string } {
2234
+ const unknown = names.filter((n) => !p.plan.order.includes(n));
2235
+ if (unknown.length > 0) return { error: `${unknown.join(", ")} ${unknown.length === 1 ? "is" : "are"} not in the change between ${p.base.slice(0, 12)} and ${p.head.slice(0, 12)}, so the wave cannot plan ${unknown.length === 1 ? "it" : "them"}` };
2236
+ const k = p.plan.waves.findIndex((w) => w.includes(names[0]!)) + 1;
2237
+ const wave = p.plan.waves[k - 1] ?? [];
2238
+ const across = names.filter((n) => !wave.includes(n));
2239
+ if (across.length > 0) return { error: `${names[0]} and ${across.join(", ")} are in different waves of the derivation, so one wave step cannot plan them together` };
2240
+ return prWavePlan(p.plan, p.components, k, wave.filter((n) => !names.includes(n)));
2241
+ }
2242
+
2243
+ /** One component's entry in the op-waves plans file: the digest over its members' plans, and whether it changes or destroys anything. */
2244
+ function componentPlanEntry(set: PrPlanSet, component: string): { target: string; planDigest: string; empty?: true; destructive?: true } {
2245
+ const members = set.members.filter((m) => m.component === component).sort((a, b) => a.member.localeCompare(b.member));
2246
+ const names = new Set(members.map((m) => m.member));
2247
+ const entries = set.doc.entries.filter((e) => names.has(e.member));
2248
+ const changes = entries.filter((e) => e.action !== "no-op" && e.action !== "read");
2249
+ const destructive = changes.some((e) => e.action === "delete" || e.action === "replace");
2250
+ return {
2251
+ target: component,
2252
+ planDigest: computePlanDigest("component-wave", members.map((m) => ({ member: m.member, planDigest: m.planDigest }))),
2253
+ ...(changes.length === 0 ? { empty: true as const } : {}),
2254
+ ...(destructive ? { destructive: true as const } : {}),
2255
+ };
2256
+ }
2257
+
2258
+ /** The files a component wave step names: `{runs}`, `{plans}` and the outputs file. */
2259
+ interface WaveStepFiles {
2260
+ runs: Array<{ target: string; planDigest?: string }>;
2261
+ plansFile: string;
2262
+ outputsFile?: string;
2263
+ outputs: Record<string, Record<string, unknown>>;
2264
+ }
2265
+
2266
+ /** Read the step's runs and outputs files from its flags. */
2267
+ function waveStepFiles(args: Pick<CommandContext["args"], "runsFile" | "plansFile" | "waveOutputs">): WaveStepFiles | { error: string } {
2268
+ const runs = readWaveRuns(args.runsFile);
2269
+ if ("error" in runs) return runs;
2270
+ if (!args.plansFile) return { error: "the step needs --plans <file>, which chant run wave fills in as {plans}" };
2271
+ const read = readWaveOutputs(args.waveOutputs);
2272
+ if ("error" in read) return read;
2273
+ return { runs, plansFile: args.plansFile, ...(args.waveOutputs ? { outputsFile: args.waveOutputs } : {}), outputs: read.outputs };
2274
+ }
2275
+
2276
+ /** Plan the step's runs, each a component, against the outputs the earlier waves left. */
2277
+ async function planComponentRuns(p: Prepared, files: WaveStepFiles): Promise<{ set: PrPlanSet; plan: FanOutPlan } | { error: string }> {
2278
+ const names = files.runs.map((r) => r.target);
2279
+ const plan = names.length > 0 ? namedWavePlan(p, names) : { ...p.plan, order: [], waves: [] };
2280
+ if ("error" in plan) return plan;
2281
+ const lockGrain = await declaredLockGrainOf(p);
2282
+ const set = await planPrSet({ components: p.components, plan, registry: p.registry, env: p.env, seededOutputs: { ...p.seededOutputs, ...files.outputs }, ...(lockGrain ? { lockGrain } : {}), policyBase: p.base });
2283
+ return { set, plan };
2284
+ }
2285
+
2286
+ /** The plan step over `p`: write `{plans}`, one digest per component and the wave's change set. */
2287
+ async function planComponentWave(p: Prepared, files: WaveStepFiles): Promise<number> {
2288
+ const planned = await planComponentRuns(p, files);
2289
+ if ("error" in planned) return fail(planned.error);
2290
+ const { set } = planned;
2291
+ if (set.failed) {
2292
+ for (const m of set.members.filter((x) => x.status === "plan-failed")) console.error(formatError({ message: `${m.member} (${m.component}) failed to plan${m.error ? `: ${m.error}` : ""}` }));
2293
+ return set.policyDenied ? CHANT_EXIT.denied : 1;
2294
+ }
2295
+ const file = { runs: files.runs.map((r) => componentPlanEntry(set, r.target)), changeSet: set.doc };
2296
+ mkdirSync(dirname(resolve(files.plansFile)), { recursive: true });
2297
+ writeFileSync(resolve(files.plansFile), JSON.stringify(file, null, 2) + "\n");
2298
+ console.error(formatInfo(`planned ${files.runs.length} component${files.runs.length === 1 ? "" : "s"}: ${files.runs.map((r) => r.target).join(", ") || "(none)"}; change set ${set.doc.digest}`));
2299
+ return 0;
2300
+ }
2301
+
2302
+ /** The apply step over `p`: plan the approved runs again, refuse a moved one with 4, else lease, apply, record, and hand the outputs on. */
2303
+ async function applyComponentWave(p: Prepared, files: WaveStepFiles, opts: { noReleaseRecord?: boolean; onRunEvent?: RunEventSink; runsResult?: string } = {}): Promise<number> {
2304
+ if (files.runs.length === 0) return 0;
2305
+ const planned = await planComponentRuns(p, files);
2306
+ if ("error" in planned) return fail(planned.error);
2307
+ const { set, plan } = planned;
2308
+ if (set.failed) return fail("A component of the wave failed to plan again, so nothing in it was applied.");
2309
+ const moved = files.runs.filter((r) => r.planDigest !== undefined && !samePlanDigest(componentPlanEntry(set, r.target).planDigest, r.planDigest));
2310
+ if (moved.length > 0) {
2311
+ console.error(formatError({ message: `${moved.map((r) => r.target).join(", ")} now plan${moved.length === 1 ? "s" : ""} something other than the approved plan, so nothing in the wave was applied.`, hint: "Run the wave's job again to plan it afresh and decide its gate." }));
2312
+ return CHANT_EXIT.moved;
2313
+ }
2314
+ const lease = await leaseSetRows(p, set);
2315
+ if (typeof lease === "number") return lease;
2316
+ if ("held" in lease) {
2317
+ console.error(formatError({ message: lease.held }));
2318
+ return CHANT_EXIT.held;
2319
+ }
2320
+ const lockGrain = await declaredLockGrainOf(p);
2321
+ const release = autoReleaseRun(`wave-${Date.now()}`);
2322
+ let applied: Awaited<ReturnType<typeof applyPrSet>>;
2323
+ try {
2324
+ applied = await applyPrSet({ components: p.components, plan, registry: p.registry, env: p.env, set, gate: p.gate, ...(lockGrain ? { lockGrain } : {}), policyBase: p.base, ...(opts.onRunEvent ? { onRunEvent: opts.onRunEvent } : {}) });
2325
+ } finally {
2326
+ await lease.release();
2327
+ }
2328
+ await recordAutoReleasesForRun(applied.run.results, p.env, release.runId, resolveAutoReleaseDisabled(p.config, opts.noReleaseRecord), release.runOrigin, undefined, undefined, prAppliedDigests(p, applied.members));
2329
+ if (files.outputsFile) {
2330
+ const next = { ...files.outputs };
2331
+ for (const name of applied.run.completed) next[name] = applied.run.componentOutputs[name] ?? {};
2332
+ mkdirSync(dirname(resolve(files.outputsFile)), { recursive: true });
2333
+ writeFileSync(resolve(files.outputsFile), JSON.stringify(next, null, 2) + "\n");
2334
+ }
2335
+ for (const m of applied.members) console.error(m.status === "applied" ? formatSuccess(`applied ${m.member} (${m.component})`) : formatWarning({ message: `${m.member} (${m.component}): ${m.status}${m.error ? `, ${m.error}` : ""}` }));
2336
+ // #4291: the components that applied, so op waves fails only the others and blocks only what depends on them.
2337
+ const runsResult = opts.runsResult ?? (process.env.CHANT_APPLY_RUNS_RESULT ? resolve(process.env.CHANT_APPLY_RUNS_RESULT) : undefined);
2338
+ if (runsResult && applied.status !== "applied") {
2339
+ mkdirSync(dirname(runsResult), { recursive: true });
2340
+ writeFileSync(runsResult, JSON.stringify({ applied: [...applied.run.completed].sort() }, null, 2) + "\n");
2341
+ }
2342
+ return applied.status === "applied" ? 0 : applied.status === "waiting" ? CHANT_EXIT.waiting : 1;
2343
+ }
2344
+
2345
+ /**
2346
+ * `chant components plan-wave --runs <file> --plans <file> --base <ref>
2347
+ * --env <env> [--member <m>] [--wave-outputs <file>]` (#4588): the
2348
+ * component plan step of a component waves spec. Plans each run, a
2349
+ * component, through the project's capabilities against the outputs the
2350
+ * waves before it left, and writes `{plans}`: one digest per component over
2351
+ * its members' plans, and the wave's change set, which a `pull-request`
2352
+ * wave checks the pull request's approval against.
2353
+ */
2354
+ export async function runComponentsPlanWave(ctx: CommandContext): Promise<number> {
2355
+ const files = waveStepFiles(ctx.args);
2356
+ if ("error" in files) return fail(files.error);
2357
+ const p = await prepare(ctx, "apply");
2358
+ if (typeof p === "number") return p;
2359
+ return planComponentWave(p, files);
2360
+ }
2361
+
2362
+ /**
2363
+ * `chant components apply-wave --runs <file> --plans <file> --base <ref>
2364
+ * --env <env> [--member <m>] [--wave-outputs <file>]` (#4588): the
2365
+ * component apply step. Plans the approved runs again and exits 4 when a
2366
+ * component's plan is not the one approved; else leases its rows on the
2367
+ * resource grain, applies, records the releases, and adds each applied
2368
+ * component's outputs to `--wave-outputs` for the next wave.
2369
+ */
2370
+ export async function runComponentsApplyWave(ctx: CommandContext): Promise<number> {
2371
+ const files = waveStepFiles(ctx.args);
2372
+ if ("error" in files) return fail(files.error);
2373
+ const p = await prepare(ctx, "apply");
2374
+ if (typeof p === "number") return p;
2375
+ return applyComponentWave(p, files, { noReleaseRecord: ctx.args.noReleaseRecord });
2376
+ }
2377
+
2378
+ /**
2379
+ * The component steps in this process (#4588): `pr-apply --wave-gate`
2380
+ * already holds the prepared project, so the plan-wave and apply-wave lines
2381
+ * of its spec run here against it, rather than in a process that would
2382
+ * derive the change again.
2383
+ */
2384
+ function componentWaveExec(p: Prepared, noReleaseRecord?: boolean, onRunEvent?: RunEventSink): (argv: string[], cwd: string, env?: Record<string, string>) => Promise<number> {
2385
+ return async (argv, cwd, env) => {
2386
+ const at = argv.findIndex((a, i) => a === "components" && (argv[i + 1] === "plan-wave" || argv[i + 1] === "apply-wave"));
2387
+ if (at < 0) return fail(`not a component wave step: ${argv.join(" ")}`);
2388
+ let args: CommandContext["args"];
2389
+ try {
2390
+ args = parseArgs(argv.slice(at));
2391
+ } catch (err) {
2392
+ return fail(err instanceof Error ? err.message : String(err));
2393
+ }
2394
+ const files = waveStepFiles(args);
2395
+ if ("error" in files) return fail(files.error);
2396
+ const runsResult = env?.CHANT_APPLY_RUNS_RESULT ? resolve(cwd, env.CHANT_APPLY_RUNS_RESULT) : undefined;
2397
+ return argv[at + 1] === "plan-wave" ? planComponentWave(p, files) : applyComponentWave(p, files, { noReleaseRecord, ...(onRunEvent ? { onRunEvent } : {}), ...(runsResult ? { runsResult } : {}) });
2398
+ };
2399
+ }
2400
+
2401
+ /**
2402
+ * A gate ledger that holds the approval `pr-apply` already decided (#4588):
2403
+ * an approval of the pull request's gate under its op, for the approved
2404
+ * change set, so an op wave of the component waves spec finds the approval
2405
+ * a pull request (or a green commit's merges) gave and checks its own plan
2406
+ * against it. Everything else is the real ledger's.
2407
+ */
2408
+ function withDecidedApproval(port: GateLedgerPort, at: { op: string; gate: string; digest: string; approvedBy: string[]; timestamp: string }): GateLedgerPort {
2409
+ return {
2410
+ ...port,
2411
+ appendPending: (input) => port.appendPending(input),
2412
+ async read(op) {
2413
+ const got = await port.read(op);
2414
+ if (op !== at.op) return got;
2415
+ const decided: GateResolutionRecord = { version: 1, kind: "resolution", op: at.op, gate: at.gate, resolvedBy: at.approvedBy.join(", ") || "pr-apply", timestamp: at.timestamp, planDigest: at.digest, changeSet: at.digest };
2416
+ return { ...got, resolutions: [...got.resolutions, decided] };
2417
+ },
2418
+ };
2419
+ }
2420
+
2421
+ /**
2422
+ * The review rule on a wave's own gate (#4000, #4588): `--require-review`
2423
+ * judges an approval of the wave's gate as it judges the pull request's, so
2424
+ * an approval it refuses never reaches the op wave, which then waits. The
2425
+ * refusal is kept in `refused` for pr-apply's report. The pull request's gate
2426
+ * was judged before the waves ran, so its approvals pass as they are.
2427
+ */
2428
+ function withWaveReview(port: GateLedgerPort, at: { prGate: string; what: string; review: (approvedBy: readonly string[], what: string) => Promise<ReviewStop>; refused: { stop?: ReviewStop } }): GateLedgerPort {
2429
+ return {
2430
+ ...port,
2431
+ async read(op) {
2432
+ const got = await port.read(op);
2433
+ const resolutions: GateResolutionRecord[] = [];
2434
+ for (const r of got.resolutions) {
2435
+ const stop = r.gate === at.prGate ? undefined : await at.review([r.resolvedBy], at.what);
2436
+ if (stop) at.refused.stop ??= stop;
2437
+ else resolutions.push(r);
2438
+ }
2439
+ return { ...got, resolutions };
2440
+ },
2441
+ };
2442
+ }
2443
+
2444
+ /** What one wave of `pr-apply --wave-gate` on op waves came to (#4588). */
2445
+ interface ComponentWaveOutcome {
2446
+ exitCode: number;
2447
+ applied: string[];
2448
+ failed: string[];
2449
+ entry: PrWave;
2450
+ /** The wave's outputs file after it ran. */
2451
+ outputs: Record<string, Record<string, unknown>>;
2452
+ /** The wave's new plan, when it planned: what an approval of its own gate is asked for. */
2453
+ changeSet?: PrPlanSet["doc"];
2454
+ /** Why `--require-review` refused an approval of the wave's own gate (#4000). */
2455
+ review?: ReviewStop;
2456
+ }
2457
+
2458
+ /**
2459
+ * Run wave `k` of `pr-apply --wave-gate` on op waves (#4588): the component
2460
+ * waves spec with the wave's runs left to apply, read at base as chant
2461
+ * wrote it (the spec is chant's, never the change's), decided under the
2462
+ * approval pr-apply holds, planned and applied through the component
2463
+ * plan-wave and apply-wave steps.
2464
+ */
2465
+ async function runComponentWave(
2466
+ p: Prepared,
2467
+ at: {
2468
+ op: string;
2469
+ waveGate: string;
2470
+ k: number;
2471
+ runs: string[];
2472
+ approved: PrPlanSet["doc"];
2473
+ approvedBy: string[];
2474
+ outputsFile: string;
2475
+ noReleaseRecord?: boolean;
2476
+ review: (approvedBy: readonly string[], what: string) => Promise<ReviewStop>;
2477
+ events?: RunEventStream;
2478
+ log: (body: RunEventBody) => void;
2479
+ },
2480
+ ): Promise<ComponentWaveOutcome> {
2481
+ const { componentWavesSpec, componentWaveSteps, PRODUCT_WAVES_SPEC_DIR: PRODUCT_WAVES_DIR } = await import("../../components/product-pipeline");
2482
+ const { runOpWave, opWavePlansPath } = await import("../../op/op-waves-run");
2483
+ const words = activeProductWords();
2484
+ const cwd = resolve(".");
2485
+ const steps = componentWaveSteps({ ...(words.bin ? { bin: words.bin } : {}), env: p.env, base: p.base, head: p.head, ...(p.member ? { member: p.member } : {}), op: at.op, gate: p.gate, outputs: at.outputsFile });
2486
+ const waves = p.plan.waves.map((w, i) => (i === at.k - 1 ? at.runs : w));
2487
+ const spec = componentWavesSpec(p.components, words, steps, { op: at.op, gate: at.waveGate, prGate: p.gate, waves });
2488
+ const specFile = `${PRODUCT_WAVES_DIR}/${at.op}.spec.json`;
2489
+ const refused: { stop?: ReviewStop } = {};
2490
+ const result = await runOpWave({
2491
+ spec,
2492
+ specFile,
2493
+ wave: at.k,
2494
+ base: p.base,
2495
+ head: p.head,
2496
+ cwd,
2497
+ show: () => ({ sha: p.base, text: JSON.stringify(spec) }),
2498
+ gates: withWaveReview(withDecidedApproval(gitGateLedgerPort(), { op: at.op, gate: p.gate, digest: at.approved.digest, approvedBy: at.approvedBy, timestamp: new Date().toISOString() }), {
2499
+ prGate: p.gate,
2500
+ what: `Wave ${at.k}'s plan`,
2501
+ review: at.review,
2502
+ refused,
2503
+ }),
2504
+ // pr-apply's report and the `chant ci run` record stand for the job, so the wave writes no op-wave run record beside them.
2505
+ runs: { append: async () => {} },
2506
+ changeSets: async (digest) => {
2507
+ if (samePlanDigest(digest, at.approved.digest)) return at.approved;
2508
+ const { readStoredChangeSet } = await import("../../lifecycle/change-set-store");
2509
+ const got = await readStoredChangeSet(digest, { cwd });
2510
+ return got.status === "found" ? got.document : undefined;
2511
+ },
2512
+ lockGate: p.gate,
2513
+ // The apply's run events nest in pr-apply's stream with the derivation's wave number, as its log does.
2514
+ waveExec: componentWaveExec(p, at.noReleaseRecord, (body) => {
2515
+ const numbered = inWave(body, at.k);
2516
+ at.events?.nested(numbered);
2517
+ if (numbered.type !== "run-start") at.log(numbered);
2518
+ }),
2519
+ // The outcome files of this commit's waves alone, so a run of another commit on the same checkout blocks nothing here.
2520
+ outcomeDir: `${PRODUCT_WAVES_DIR}/${at.op}/outcomes-${p.head.slice(0, 12)}`,
2521
+ });
2522
+ const d = result.decision;
2523
+ const byPullRequest = d?.via === "pull-request";
2524
+ // #4553: an approval of the wave's own gate stands, but for another plan: the plan moved after its approval.
2525
+ const exitCode = result.exitCode === CHANT_EXIT.waiting && !byPullRequest && d?.mismatch && !refused.stop ? CHANT_EXIT.moved : result.exitCode;
2526
+ const entry: PrWave = {
2527
+ wave: at.k,
2528
+ components: at.runs,
2529
+ status: exitCode === CHANT_EXIT.done ? "applied" : exitCode === CHANT_EXIT.waiting || exitCode === CHANT_EXIT.moved ? "waiting" : "failed",
2530
+ approval: byPullRequest || !d ? "pull-request" : "wave",
2531
+ gate: byPullRequest || !d ? p.gate : d.gate,
2532
+ digest: byPullRequest || !d ? at.approved.digest : d.digest,
2533
+ ...(byPullRequest ? (at.approvedBy.length > 0 ? { approvedBy: at.approvedBy } : {}) : d?.approvedBy ? { approvedBy: [d.approvedBy] } : {}),
2534
+ ...(!byPullRequest && d?.coveredBy?.reason ? { moved: [d.coveredBy.reason] } : {}),
2535
+ ...(!byPullRequest && d?.mismatch?.approved ? { approved: d.mismatch.approved } : {}),
2536
+ };
2537
+ // A wave that waits at its own gate is the stream's gate step there, as before op waves (#4003).
2538
+ if (d && !byPullRequest && (exitCode === CHANT_EXIT.waiting || exitCode === CHANT_EXIT.moved)) {
2539
+ const waiting = { satisfied: false, pending: { op: at.op }, ...(d.mismatch ? { mismatch: d.mismatch } : {}) } as unknown as GateCheck;
2540
+ await emitGateStep(at.events?.emit, { op: at.op, gate: d.gate }, async () => waiting, () =>
2541
+ d.mismatch ? `wave ${at.k}'s plan changed after its approval. Approve the plan now: ${prApproveCommand({ op: at.op, gate: d.gate, digest: d.digest })}` : `wave ${at.k}'s plan is not the one the pull request approved. Approve it: ${prApproveCommand({ op: at.op, gate: d.gate, digest: d.digest })}`,
2542
+ );
2543
+ }
2544
+ const read = readWaveOutputs(at.outputsFile);
2545
+ let changeSet: PrPlanSet["doc"] | undefined;
2546
+ try {
2547
+ changeSet = (JSON.parse(readFileSync(join(cwd, opWavePlansPath(spec, at.k)), "utf8")) as { changeSet?: PrPlanSet["doc"] }).changeSet;
2548
+ } catch {
2549
+ // The wave stopped before it planned.
2550
+ }
2551
+ return { exitCode, applied: result.applied, failed: result.failed, entry, outputs: "error" in read ? {} : read.outputs, ...(changeSet ? { changeSet } : {}), ...(refused.stop ? { review: refused.stop } : {}) };
2552
+ }
2553
+
2092
2554
  /** A wave's new plan (#4003), beside the report as `change-set-wave-<k>.json`, for whoever approves its gate. */
2093
2555
  function writeWaveChangeSet(ctx: CommandContext, wave: number, doc: PrPlanSet["doc"], upload?: PrReportUpload): void {
2094
2556
  const dir = resolve(ctx.args.output ?? PR_REPORT_DIR);