@intentius/chant 0.124.87 → 0.124.89

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 (483) hide show
  1. package/dist/action-pins.d.ts +1 -0
  2. package/dist/action-pins.d.ts.map +1 -1
  3. package/dist/action-pins.js +2 -0
  4. package/dist/actor.d.ts +47 -0
  5. package/dist/actor.d.ts.map +1 -0
  6. package/dist/actor.js +56 -0
  7. package/dist/bundle-check.d.ts +20 -5
  8. package/dist/bundle-check.d.ts.map +1 -1
  9. package/dist/bundle-check.js +20 -5
  10. package/dist/chant-install.d.ts +98 -0
  11. package/dist/chant-install.d.ts.map +1 -1
  12. package/dist/chant-install.js +203 -2
  13. package/dist/ci-base.d.ts +30 -0
  14. package/dist/ci-base.d.ts.map +1 -0
  15. package/dist/ci-base.js +33 -0
  16. package/dist/ci-comment-commands.d.ts +177 -0
  17. package/dist/ci-comment-commands.d.ts.map +1 -0
  18. package/dist/ci-comment-commands.js +325 -0
  19. package/dist/ci-comment-replies.d.ts +40 -0
  20. package/dist/ci-comment-replies.d.ts.map +1 -0
  21. package/dist/ci-comment-replies.js +59 -0
  22. package/dist/ci-commit.d.ts +1 -1
  23. package/dist/ci-commit.d.ts.map +1 -1
  24. package/dist/ci-commit.js +1 -2
  25. package/dist/ci-control.d.ts +1 -1
  26. package/dist/ci-control.d.ts.map +1 -1
  27. package/dist/ci-control.js +1 -1
  28. package/dist/ci-evidence-claims.d.ts +59 -0
  29. package/dist/ci-evidence-claims.d.ts.map +1 -0
  30. package/dist/ci-evidence-claims.js +87 -0
  31. package/dist/ci-evidence-from-job.d.ts +128 -0
  32. package/dist/ci-evidence-from-job.d.ts.map +1 -0
  33. package/dist/ci-evidence-from-job.js +203 -0
  34. package/dist/ci-evidence-jobs.d.ts +68 -4
  35. package/dist/ci-evidence-jobs.d.ts.map +1 -1
  36. package/dist/ci-evidence-jobs.js +82 -5
  37. package/dist/ci-handover.d.ts +12 -0
  38. package/dist/ci-handover.d.ts.map +1 -1
  39. package/dist/ci-handover.js +15 -3
  40. package/dist/ci-identity.d.ts +32 -6
  41. package/dist/ci-identity.d.ts.map +1 -1
  42. package/dist/ci-identity.js +40 -8
  43. package/dist/ci-image.d.ts +65 -10
  44. package/dist/ci-image.d.ts.map +1 -1
  45. package/dist/ci-image.js +101 -22
  46. package/dist/ci-jobs.d.ts +1 -1
  47. package/dist/ci-jobs.d.ts.map +1 -1
  48. package/dist/ci-jobs.js +7 -2
  49. package/dist/ci-login.d.ts +75 -13
  50. package/dist/ci-login.d.ts.map +1 -1
  51. package/dist/ci-login.js +89 -37
  52. package/dist/ci-note-commands.d.ts +63 -3
  53. package/dist/ci-note-commands.d.ts.map +1 -1
  54. package/dist/ci-note-commands.js +69 -35
  55. package/dist/ci-product-words.d.ts +62 -1
  56. package/dist/ci-product-words.d.ts.map +1 -1
  57. package/dist/ci-product-words.js +52 -1
  58. package/dist/ci-product.d.ts +52 -2
  59. package/dist/ci-product.d.ts.map +1 -1
  60. package/dist/ci-product.js +51 -2
  61. package/dist/cli/commands/build.d.ts.map +1 -1
  62. package/dist/cli/commands/build.js +29 -2
  63. package/dist/cli/handlers/approve-confirm.d.ts +14 -0
  64. package/dist/cli/handlers/approve-confirm.d.ts.map +1 -1
  65. package/dist/cli/handlers/approve-confirm.js +46 -0
  66. package/dist/cli/handlers/approve.d.ts.map +1 -1
  67. package/dist/cli/handlers/approve.js +2 -1
  68. package/dist/cli/handlers/build.d.ts +1 -1
  69. package/dist/cli/handlers/build.d.ts.map +1 -1
  70. package/dist/cli/handlers/build.js +22 -1
  71. package/dist/cli/handlers/ci-check.d.ts +1 -1
  72. package/dist/cli/handlers/ci-check.d.ts.map +1 -1
  73. package/dist/cli/handlers/ci-check.js +37 -7
  74. package/dist/cli/handlers/ci-evidence.d.ts.map +1 -1
  75. package/dist/cli/handlers/ci-evidence.js +255 -20
  76. package/dist/cli/handlers/ci-forge-check.d.ts.map +1 -1
  77. package/dist/cli/handlers/ci-forge-check.js +34 -17
  78. package/dist/cli/handlers/components.d.ts.map +1 -1
  79. package/dist/cli/handlers/components.js +3 -1
  80. package/dist/cli/handlers/generated-check.d.ts +11 -0
  81. package/dist/cli/handlers/generated-check.d.ts.map +1 -0
  82. package/dist/cli/handlers/generated-check.js +71 -0
  83. package/dist/cli/handlers/lifecycle.d.ts.map +1 -1
  84. package/dist/cli/handlers/lifecycle.js +3 -0
  85. package/dist/cli/handlers/local-chant.d.ts +13 -0
  86. package/dist/cli/handlers/local-chant.d.ts.map +1 -1
  87. package/dist/cli/handlers/local-chant.js +42 -1
  88. package/dist/cli/handlers/lock.d.ts.map +1 -1
  89. package/dist/cli/handlers/lock.js +121 -4
  90. package/dist/cli/handlers/pr-comment.d.ts +21 -0
  91. package/dist/cli/handlers/pr-comment.d.ts.map +1 -0
  92. package/dist/cli/handlers/pr-comment.js +112 -0
  93. package/dist/cli/handlers/pr-env.d.ts.map +1 -1
  94. package/dist/cli/handlers/pr-env.js +6 -3
  95. package/dist/cli/handlers/pr.d.ts +23 -1
  96. package/dist/cli/handlers/pr.d.ts.map +1 -1
  97. package/dist/cli/handlers/pr.js +97 -14
  98. package/dist/cli/handlers/promote.d.ts.map +1 -1
  99. package/dist/cli/handlers/promote.js +2 -1
  100. package/dist/cli/handlers/release.d.ts.map +1 -1
  101. package/dist/cli/handlers/release.js +11 -2
  102. package/dist/cli/handlers/run-wave.d.ts.map +1 -1
  103. package/dist/cli/handlers/run-wave.js +36 -2
  104. package/dist/cli/handlers/run.d.ts.map +1 -1
  105. package/dist/cli/handlers/run.js +2 -1
  106. package/dist/cli/main.d.ts.map +1 -1
  107. package/dist/cli/main.js +60 -4
  108. package/dist/cli/parse-args.d.ts.map +1 -1
  109. package/dist/cli/parse-args.js +82 -0
  110. package/dist/cli/registry.d.ts +35 -0
  111. package/dist/cli/registry.d.ts.map +1 -1
  112. package/dist/components/auto-release.d.ts.map +1 -1
  113. package/dist/components/auto-release.js +2 -1
  114. package/dist/components/check-hooks.d.ts +10 -0
  115. package/dist/components/check-hooks.d.ts.map +1 -1
  116. package/dist/components/check-hooks.js +18 -0
  117. package/dist/components/pr-checks.d.ts +169 -0
  118. package/dist/components/pr-checks.d.ts.map +1 -0
  119. package/dist/components/pr-checks.js +180 -0
  120. package/dist/components/pr-pipeline.d.ts +38 -0
  121. package/dist/components/pr-pipeline.d.ts.map +1 -1
  122. package/dist/components/pr-pipeline.js +6 -1
  123. package/dist/components/product-pipeline.d.ts +58 -2
  124. package/dist/components/product-pipeline.d.ts.map +1 -1
  125. package/dist/components/product-pipeline.js +76 -9
  126. package/dist/components/product-plan.d.ts +445 -7
  127. package/dist/components/product-plan.d.ts.map +1 -1
  128. package/dist/components/product-plan.js +426 -15
  129. package/dist/config.d.ts +10 -6
  130. package/dist/config.d.ts.map +1 -1
  131. package/dist/config.js +11 -6
  132. package/dist/control/consumers.d.ts +6 -0
  133. package/dist/control/consumers.d.ts.map +1 -1
  134. package/dist/control/consumers.js +6 -0
  135. package/dist/dead-guards.d.ts.map +1 -1
  136. package/dist/dead-guards.js +9 -6
  137. package/dist/discovery/files.d.ts +1 -1
  138. package/dist/discovery/files.js +1 -1
  139. package/dist/drift-issue.d.ts +20 -3
  140. package/dist/drift-issue.d.ts.map +1 -1
  141. package/dist/drift-issue.js +16 -0
  142. package/dist/drift-record.d.ts +52 -5
  143. package/dist/drift-record.d.ts.map +1 -1
  144. package/dist/drift-record.js +46 -6
  145. package/dist/floor-table.d.ts +6 -6
  146. package/dist/floor-table.d.ts.map +1 -1
  147. package/dist/floor-table.data.d.ts.map +1 -1
  148. package/dist/floor-table.data.js +81 -21
  149. package/dist/floor-table.js +10 -7
  150. package/dist/forge-check/contract.d.ts +19 -1
  151. package/dist/forge-check/contract.d.ts.map +1 -1
  152. package/dist/forge-check/contract.js +8 -2
  153. package/dist/forge-check/index.d.ts +4 -0
  154. package/dist/forge-check/index.d.ts.map +1 -1
  155. package/dist/forge-check/index.js +4 -0
  156. package/dist/forge-flags.d.ts +10 -0
  157. package/dist/forge-flags.d.ts.map +1 -1
  158. package/dist/forge-flags.js +31 -0
  159. package/dist/forge-remote.d.ts +47 -0
  160. package/dist/forge-remote.d.ts.map +1 -0
  161. package/dist/forge-remote.js +69 -0
  162. package/dist/gate-resume-run.d.ts +9 -1
  163. package/dist/gate-resume-run.d.ts.map +1 -1
  164. package/dist/gate-resume-run.js +26 -3
  165. package/dist/generated-check.d.ts +88 -0
  166. package/dist/generated-check.d.ts.map +1 -0
  167. package/dist/generated-check.js +248 -0
  168. package/dist/image-pins.d.ts +26 -0
  169. package/dist/image-pins.d.ts.map +1 -0
  170. package/dist/image-pins.js +19 -0
  171. package/dist/lexicon.d.ts +27 -0
  172. package/dist/lexicon.d.ts.map +1 -1
  173. package/dist/lifecycle/git.d.ts +11 -0
  174. package/dist/lifecycle/git.d.ts.map +1 -1
  175. package/dist/lifecycle/git.js +30 -3
  176. package/dist/lifecycle/publish-npm.d.ts +26 -0
  177. package/dist/lifecycle/publish-npm.d.ts.map +1 -1
  178. package/dist/lifecycle/publish-npm.js +76 -4
  179. package/dist/lifecycle/reach-locks.d.ts +131 -0
  180. package/dist/lifecycle/reach-locks.d.ts.map +1 -0
  181. package/dist/lifecycle/reach-locks.js +118 -0
  182. package/dist/lifecycle/release-cut.d.ts +3 -1
  183. package/dist/lifecycle/release-cut.d.ts.map +1 -1
  184. package/dist/lifecycle/release-cut.js +15 -0
  185. package/dist/lifecycle/release-images.d.ts +22 -1
  186. package/dist/lifecycle/release-images.d.ts.map +1 -1
  187. package/dist/lifecycle/release-images.js +26 -3
  188. package/dist/lifecycle/release-ledger.d.ts +4 -3
  189. package/dist/lifecycle/release-ledger.d.ts.map +1 -1
  190. package/dist/lifecycle/release-ledger.js +3 -2
  191. package/dist/local-chant.d.ts +57 -3
  192. package/dist/local-chant.d.ts.map +1 -1
  193. package/dist/local-chant.js +122 -13
  194. package/dist/notify-product.d.ts +12 -3
  195. package/dist/notify-product.d.ts.map +1 -1
  196. package/dist/notify-product.js +10 -6
  197. package/dist/op/activities/source-release.d.ts.map +1 -1
  198. package/dist/op/activities/source-release.js +2 -1
  199. package/dist/op/activities/source-rollback.d.ts.map +1 -1
  200. package/dist/op/activities/source-rollback.js +2 -1
  201. package/dist/op/index.d.ts +2 -0
  202. package/dist/op/index.d.ts.map +1 -1
  203. package/dist/op/index.js +1 -0
  204. package/dist/op/op-waves-evidence-jobs.d.ts +97 -0
  205. package/dist/op/op-waves-evidence-jobs.d.ts.map +1 -0
  206. package/dist/op/op-waves-evidence-jobs.js +118 -0
  207. package/dist/op/op-waves-evidence.d.ts +12 -1
  208. package/dist/op/op-waves-evidence.d.ts.map +1 -1
  209. package/dist/op/op-waves-evidence.js +23 -2
  210. package/dist/op/op-waves-render-spec.d.ts +100 -0
  211. package/dist/op/op-waves-render-spec.d.ts.map +1 -0
  212. package/dist/op/op-waves-render-spec.js +162 -0
  213. package/dist/op/op-waves-run.d.ts +14 -1
  214. package/dist/op/op-waves-run.d.ts.map +1 -1
  215. package/dist/op/op-waves-run.js +56 -4
  216. package/dist/op/op-waves.d.ts +12 -0
  217. package/dist/op/op-waves.d.ts.map +1 -1
  218. package/dist/op/op-waves.js +14 -1
  219. package/dist/op/schedule-overdue.d.ts +39 -2
  220. package/dist/op/schedule-overdue.d.ts.map +1 -1
  221. package/dist/op/schedule-overdue.js +148 -10
  222. package/dist/op/wave-stop.d.ts +64 -0
  223. package/dist/op/wave-stop.d.ts.map +1 -0
  224. package/dist/op/wave-stop.js +127 -0
  225. package/dist/planned-files.d.ts +76 -0
  226. package/dist/planned-files.d.ts.map +1 -0
  227. package/dist/planned-files.js +108 -0
  228. package/dist/pr-forge-job.d.ts +22 -0
  229. package/dist/pr-forge-job.d.ts.map +1 -0
  230. package/dist/pr-forge-job.js +46 -0
  231. package/dist/pr-forge-reads.d.ts +21 -1
  232. package/dist/pr-forge-reads.d.ts.map +1 -1
  233. package/dist/pr-forge-reads.js +19 -1
  234. package/dist/pr-forge.d.ts +7 -1
  235. package/dist/pr-forge.d.ts.map +1 -1
  236. package/dist/pr-forge.js +7 -2
  237. package/dist/pr-loop.d.ts +3 -6
  238. package/dist/pr-loop.d.ts.map +1 -1
  239. package/dist/pr-loop.js +4 -81
  240. package/dist/pr-plan-note.d.ts +121 -0
  241. package/dist/pr-plan-note.d.ts.map +1 -1
  242. package/dist/pr-plan-note.js +104 -1
  243. package/dist/pr-plan-record.d.ts +47 -0
  244. package/dist/pr-plan-record.d.ts.map +1 -0
  245. package/dist/pr-plan-record.js +89 -0
  246. package/dist/pr-post.d.ts +68 -3
  247. package/dist/pr-post.d.ts.map +1 -1
  248. package/dist/pr-post.js +218 -13
  249. package/dist/pr-requires.d.ts +8 -0
  250. package/dist/pr-requires.d.ts.map +1 -1
  251. package/dist/pr-requires.js +3 -1
  252. package/dist/pr-status.d.ts +16 -0
  253. package/dist/pr-status.d.ts.map +1 -0
  254. package/dist/pr-status.js +90 -0
  255. package/dist/ref-gate-init.d.ts +90 -0
  256. package/dist/ref-gate-init.d.ts.map +1 -0
  257. package/dist/ref-gate-init.js +155 -0
  258. package/dist/ref-gate-rules.d.ts +19 -0
  259. package/dist/ref-gate-rules.d.ts.map +1 -0
  260. package/dist/ref-gate-rules.js +17 -0
  261. package/dist/release-floors.d.ts +100 -16
  262. package/dist/release-floors.d.ts.map +1 -1
  263. package/dist/release-floors.js +101 -17
  264. package/dist/render-module.d.ts +15 -0
  265. package/dist/render-module.d.ts.map +1 -0
  266. package/dist/render-module.js +73 -0
  267. package/dist/state-migration.d.ts +24 -1
  268. package/dist/state-migration.d.ts.map +1 -1
  269. package/dist/state-migration.js +39 -4
  270. package/dist/state-unlock.d.ts +32 -1
  271. package/dist/state-unlock.d.ts.map +1 -1
  272. package/dist/state-unlock.js +31 -0
  273. package/dist/wave-runtime.mjs +307 -297
  274. package/dist/workspace/ci-green-cli.d.ts.map +1 -1
  275. package/dist/workspace/ci-green-cli.js +15 -8
  276. package/dist/workspace/drift-cli.d.ts +1 -1
  277. package/dist/workspace/drift-cli.d.ts.map +1 -1
  278. package/dist/workspace/drift-cli.js +5 -12
  279. package/dist/workspace/forge-work.d.ts +3 -2
  280. package/dist/workspace/forge-work.d.ts.map +1 -1
  281. package/dist/workspace/forge-work.js +7 -17
  282. package/dist/workspace/lexicon-outputs.js +2 -2
  283. package/dist/workspace/release-train.d.ts.map +1 -1
  284. package/dist/workspace/release-train.js +2 -1
  285. package/dist/workspace/release-workflow.d.ts +27 -3
  286. package/dist/workspace/release-workflow.d.ts.map +1 -1
  287. package/dist/workspace/release-workflow.js +52 -7
  288. package/dist/workspace/trust/check-evidence-report.d.ts +25 -2
  289. package/dist/workspace/trust/check-evidence-report.d.ts.map +1 -1
  290. package/dist/workspace/trust/check-evidence-report.js +28 -8
  291. package/dist/workspace/trust/check-evidence.d.ts +13 -1
  292. package/dist/workspace/trust/check-evidence.d.ts.map +1 -1
  293. package/dist/workspace/trust/check-evidence.js +8 -3
  294. package/dist/workspace/trust/evidence.d.ts +5 -0
  295. package/dist/workspace/trust/evidence.d.ts.map +1 -1
  296. package/dist/workspace/trust/evidence.js +5 -0
  297. package/dist/workspace/trust/open-evidence.d.ts +67 -0
  298. package/dist/workspace/trust/open-evidence.d.ts.map +1 -0
  299. package/dist/workspace/trust/open-evidence.js +92 -0
  300. package/dist/workspace/trust/ref-gate-cli.d.ts +10 -1
  301. package/dist/workspace/trust/ref-gate-cli.d.ts.map +1 -1
  302. package/dist/workspace/trust/ref-gate-cli.js +93 -11
  303. package/dist/workspace/trust/ref-gate.d.ts +61 -2
  304. package/dist/workspace/trust/ref-gate.d.ts.map +1 -1
  305. package/dist/workspace/trust/ref-gate.js +72 -7
  306. package/dist/workspace/workspace-run.d.ts.map +1 -1
  307. package/dist/workspace/workspace-run.js +2 -1
  308. package/package.json +1 -1
  309. package/src/action-pins.ts +2 -0
  310. package/src/actor.test.ts +78 -0
  311. package/src/actor.ts +79 -0
  312. package/src/bundle-check.test.ts +22 -0
  313. package/src/bundle-check.ts +33 -5
  314. package/src/chant-install.test.ts +108 -1
  315. package/src/chant-install.ts +242 -2
  316. package/src/ci-base.test.ts +41 -0
  317. package/src/ci-base.ts +43 -0
  318. package/src/ci-comment-commands.test.ts +376 -0
  319. package/src/ci-comment-commands.ts +389 -0
  320. package/src/ci-comment-replies.ts +78 -0
  321. package/src/ci-commit.test.ts +51 -6
  322. package/src/ci-commit.ts +1 -2
  323. package/src/ci-control.ts +1 -0
  324. package/src/ci-evidence-claims.ts +102 -0
  325. package/src/ci-evidence-from-job.test.ts +165 -0
  326. package/src/ci-evidence-from-job.ts +251 -0
  327. package/src/ci-evidence-jobs.ts +88 -6
  328. package/src/ci-handover.ts +16 -3
  329. package/src/ci-identity.test.ts +3 -3
  330. package/src/ci-identity.ts +51 -11
  331. package/src/ci-image.test.ts +187 -16
  332. package/src/ci-image.ts +157 -25
  333. package/src/ci-jobs.ts +7 -2
  334. package/src/ci-login.test.ts +131 -3
  335. package/src/ci-login.token-drop.test.ts +204 -0
  336. package/src/ci-login.ts +137 -39
  337. package/src/ci-note-commands.ts +104 -41
  338. package/src/ci-product-words.ts +89 -0
  339. package/src/ci-product.ts +62 -1
  340. package/src/cli/commands/__fixtures__/source-dir-root/migrations/0001-init/backfill.ts +3 -0
  341. package/src/cli/commands/build.test.ts +41 -0
  342. package/src/cli/commands/build.ts +27 -2
  343. package/src/cli/handlers/approve-confirm.test.ts +35 -0
  344. package/src/cli/handlers/approve-confirm.ts +44 -0
  345. package/src/cli/handlers/approve.ts +2 -1
  346. package/src/cli/handlers/build-source-dir.test.ts +4 -0
  347. package/src/cli/handlers/build.ts +20 -2
  348. package/src/cli/handlers/ci-check.ts +37 -7
  349. package/src/cli/handlers/ci-evidence-open.test.ts +164 -0
  350. package/src/cli/handlers/ci-evidence.ts +233 -18
  351. package/src/cli/handlers/ci-forge-check.ts +22 -9
  352. package/src/cli/handlers/components.ts +3 -1
  353. package/src/cli/handlers/generated-check.ts +69 -0
  354. package/src/cli/handlers/lifecycle.test.ts +20 -0
  355. package/src/cli/handlers/lifecycle.ts +4 -0
  356. package/src/cli/handlers/local-chant.ts +39 -1
  357. package/src/cli/handlers/lock-reach.test.ts +103 -0
  358. package/src/cli/handlers/lock.ts +100 -4
  359. package/src/cli/handlers/pr-comment.ts +104 -0
  360. package/src/cli/handlers/pr-env.ts +6 -3
  361. package/src/cli/handlers/pr-record.test.ts +1 -1
  362. package/src/cli/handlers/pr.ts +93 -15
  363. package/src/cli/handlers/promote.ts +2 -1
  364. package/src/cli/handlers/release.e2e.test.ts +35 -0
  365. package/src/cli/handlers/release.ts +14 -2
  366. package/src/cli/handlers/run-wave.ts +35 -2
  367. package/src/cli/handlers/run.ts +2 -1
  368. package/src/cli/main.ts +60 -4
  369. package/src/cli/parse-args.ts +58 -0
  370. package/src/cli/registry.ts +35 -0
  371. package/src/components/auto-release.ts +2 -1
  372. package/src/components/check-hooks.ts +22 -0
  373. package/src/components/check-report-summary.test.ts +78 -0
  374. package/src/components/pr-checks.ts +254 -0
  375. package/src/components/pr-pipeline.ts +43 -1
  376. package/src/components/product-pipeline.ts +113 -9
  377. package/src/components/product-plan.test.ts +140 -1
  378. package/src/components/product-plan.ts +707 -20
  379. package/src/config.ts +13 -8
  380. package/src/control/consumers.ts +7 -0
  381. package/src/dead-guards.test.ts +27 -5
  382. package/src/dead-guards.ts +9 -6
  383. package/src/discovery/files.ts +1 -1
  384. package/src/drift-issue.test.ts +29 -1
  385. package/src/drift-issue.ts +28 -3
  386. package/src/drift-record.test.ts +45 -0
  387. package/src/drift-record.ts +71 -6
  388. package/src/floor-table.data.ts +81 -21
  389. package/src/floor-table.ts +12 -9
  390. package/src/forge-check/contract.ts +23 -2
  391. package/src/forge-check/forge-check.test.ts +25 -0
  392. package/src/forge-check/index.ts +4 -0
  393. package/src/forge-flags.test.ts +25 -1
  394. package/src/forge-flags.ts +34 -0
  395. package/src/forge-remote.test.ts +37 -0
  396. package/src/forge-remote.ts +79 -0
  397. package/src/gate-resume-run.ts +27 -3
  398. package/src/generated-check.e2e.test.ts +118 -0
  399. package/src/generated-check.test.ts +170 -0
  400. package/src/generated-check.ts +310 -0
  401. package/src/image-pins.ts +31 -0
  402. package/src/lexicon.ts +28 -0
  403. package/src/lifecycle/git.test.ts +48 -0
  404. package/src/lifecycle/git.ts +27 -4
  405. package/src/lifecycle/publish-npm.ts +87 -4
  406. package/src/lifecycle/reach-locks.test.ts +87 -0
  407. package/src/lifecycle/reach-locks.ts +169 -0
  408. package/src/lifecycle/release-catalog.test.ts +2 -2
  409. package/src/lifecycle/release-cut.ts +17 -1
  410. package/src/lifecycle/release-images-dockerfile.test.ts +20 -0
  411. package/src/lifecycle/release-images.test.ts +100 -0
  412. package/src/lifecycle/release-images.ts +38 -3
  413. package/src/lifecycle/release-ledger.ts +4 -3
  414. package/src/local-chant.e2e.test.ts +81 -6
  415. package/src/local-chant.test.ts +22 -3
  416. package/src/local-chant.ts +130 -13
  417. package/src/notify-product.ts +19 -8
  418. package/src/op/activities/source-release.ts +2 -1
  419. package/src/op/activities/source-rollback.ts +2 -1
  420. package/src/op/gate-resume.test.ts +27 -0
  421. package/src/op/index.ts +10 -0
  422. package/src/op/op-waves-evidence-jobs.ts +140 -0
  423. package/src/op/op-waves-evidence.test.ts +36 -3
  424. package/src/op/op-waves-evidence.ts +23 -3
  425. package/src/op/op-waves-notify-words.test.ts +18 -0
  426. package/src/op/op-waves-render-spec.test.ts +160 -0
  427. package/src/op/op-waves-render-spec.ts +171 -0
  428. package/src/op/op-waves-run.ts +59 -3
  429. package/src/op/op-waves.ts +16 -2
  430. package/src/op/schedule-overdue.test.ts +126 -1
  431. package/src/op/schedule-overdue.ts +164 -12
  432. package/src/op/wave-stop.test.ts +72 -0
  433. package/src/op/wave-stop.ts +137 -0
  434. package/src/planned-files.test.ts +80 -0
  435. package/src/planned-files.ts +134 -0
  436. package/src/pr-forge-job.test.ts +53 -0
  437. package/src/pr-forge-job.ts +46 -0
  438. package/src/pr-forge-reads-compare.test.ts +2 -1
  439. package/src/pr-forge-reads.ts +37 -1
  440. package/src/pr-forge.ts +14 -3
  441. package/src/pr-loop-narrowed.test.ts +2 -1
  442. package/src/pr-loop-words.test.ts +2 -1
  443. package/src/pr-loop.test.ts +1 -2
  444. package/src/pr-loop.ts +4 -80
  445. package/src/pr-plan-note.ts +184 -3
  446. package/src/pr-plan-record.test.ts +75 -0
  447. package/src/pr-plan-record.ts +101 -0
  448. package/src/pr-post-plan-note.test.ts +60 -0
  449. package/src/pr-post-replan.test.ts +144 -0
  450. package/src/pr-post-subject.test.ts +230 -0
  451. package/src/pr-post.test.ts +32 -1
  452. package/src/pr-post.ts +254 -15
  453. package/src/pr-requires.test.ts +20 -0
  454. package/src/pr-requires.ts +10 -1
  455. package/src/pr-status.ts +91 -0
  456. package/src/ref-gate-init.ts +208 -0
  457. package/src/ref-gate-rules.ts +26 -0
  458. package/src/release-floors.ts +139 -17
  459. package/src/render-module.ts +73 -0
  460. package/src/state-migration-record.test.ts +89 -0
  461. package/src/state-migration.test.ts +1 -1
  462. package/src/state-migration.ts +52 -4
  463. package/src/state-unlock.test.ts +33 -1
  464. package/src/state-unlock.ts +49 -1
  465. package/src/workspace/ci-green-cli.ts +14 -7
  466. package/src/workspace/ci-green-workflow.test.ts +32 -1
  467. package/src/workspace/drift-cli.ts +6 -18
  468. package/src/workspace/forge-work.ts +7 -14
  469. package/src/workspace/lexicon-outputs.ts +2 -2
  470. package/src/workspace/release-train.ts +2 -1
  471. package/src/workspace/release-workflow.test.ts +104 -3
  472. package/src/workspace/release-workflow.ts +60 -9
  473. package/src/workspace/trust/check-evidence-report.ts +39 -8
  474. package/src/workspace/trust/check-evidence.test.ts +5 -0
  475. package/src/workspace/trust/check-evidence.ts +17 -5
  476. package/src/workspace/trust/evidence.ts +5 -0
  477. package/src/workspace/trust/open-evidence.ts +129 -0
  478. package/src/workspace/trust/ref-gate-cli.ts +88 -10
  479. package/src/workspace/trust/ref-gate-pieces.test.ts +220 -0
  480. package/src/workspace/trust/ref-gate.e2e.test.ts +17 -0
  481. package/src/workspace/trust/ref-gate.test.ts +10 -0
  482. package/src/workspace/trust/ref-gate.ts +87 -6
  483. package/src/workspace/workspace-run.ts +2 -1
@@ -14,7 +14,29 @@
14
14
  * `<dir>`, and `policy` when the policy evaluated inside that plan did not
15
15
  * deny it (a `pr-plan.json`'s `policy`, a plan note hand-off's overrides).
16
16
  * It writes `evidence.json` in `<dir>`, which `pr-post` reads to say in the
17
- * note which checks were signed.
17
+ * note which checks were signed. With `--member <name>` (#4964), a
18
+ * workspace member's plan report or (#4978) a product plan target's, the
19
+ * two are `plan:<name>` and `policy:<name>`.
20
+ * - `sign --from-report <dir>` on a check job's report (#4935), a
21
+ * `check-hooks.json` from `chant ci check`, is the `check-evidence` job's
22
+ * form: it signs each hook that passed, by name, with the runs as its
23
+ * claim, as `ci check` with a runner identity signs them. A hook skipped on
24
+ * local evidence did not pass here and is not signed. With `--result`, a
25
+ * check job that neither succeeded nor failed signs nothing.
26
+ * - `sign --open --job <job> --from-report <dir> -o <out>` (#4914) is the
27
+ * GitLab signing job's form, in a pipeline of the target branch: for each
28
+ * open merge request it reads the report from the newest pipeline's
29
+ * `<job>` artifact, fetches the head and signs it as `--from-report`
30
+ * does, skipping a check already signed for the head's tree, and keeps
31
+ * `<out>/<iid>/evidence.json` for the note job. No job of a merge request
32
+ * pipeline, which the change's own files build, holds the key.
33
+ * - `sign --from-job <job> --check-id <id>[,<id>...] [--claims <dir>]`
34
+ * (#4926) is a wave's evidence job's form: it reads the job of that name
35
+ * in this run through the forge, refuses one of another run or commit,
36
+ * and signs each check whose step (named in `CHANT_EVIDENCE_SOURCES`; on
37
+ * GitLab, whose jobs have no steps, the job) the forge reports passed and
38
+ * whose claim file in `<dir>` says so. Each statement names the run, job
39
+ * and step it relied on (`source`).
18
40
  * - `verify --check-id <id>[,<id>...]` reads the evidence for `--at`'s tree
19
41
  * and verifies it against the runner keys at `--base`; exits 1 when one
20
42
  * is not current.
@@ -27,8 +49,10 @@
27
49
  * `local.keys` at base lists, and pushes `refs/notes/chant/local-evidence`;
28
50
  * `verify --local` says whether CI would skip each check on that evidence.
29
51
  */
30
- import { readFileSync, writeFileSync } from "node:fs";
52
+ import { execFileSync, spawnSync } from "node:child_process";
53
+ import { existsSync, readFileSync, writeFileSync } from "node:fs";
31
54
  import { join } from "node:path";
55
+ import { EVIDENCE_MEMBER_NAME } from "../../ci-evidence-jobs";
32
56
  import { CHANT_EXIT } from "../../exit-codes";
33
57
  import { formatError } from "../format";
34
58
  import type { CommandContext } from "../registry";
@@ -47,7 +71,9 @@ import {
47
71
  import { CHECK_EVIDENCE_FILE, LOCAL_EVIDENCE_KEY_ENV, planReportChecks, type CheckEvidenceNote } from "../../workspace/trust/check-evidence-report";
48
72
 
49
73
  const USAGE =
50
- "chant ci evidence sign (--check-id <id>[,<id>...] | --from-report <dir> --result <result>) [--at <rev>] [--base <rev>] [--key <file>] [--claim <file>] [--no-push] [--json]\n" +
74
+ "chant ci evidence sign (--check-id <id>[,<id>...] | --from-report <dir> [--member <name>] --result <result>) [--at <rev>] [--base <rev>] [--key <file>] [--claim <file>] [--no-push] [--json]\n" +
75
+ " chant ci evidence sign --open --job <job> --from-report <dir> [--member <name>] -o <out> [--branch <branch>] [--base <rev>] [--key <file>] [--no-push] [--json]\n" +
76
+ " chant ci evidence sign --from-job <job> --check-id <id>[,<id>...] [--claims <dir>] [--at <rev>] [--base <rev>] [--key <file>] [--no-push] [--json]\n" +
51
77
  " chant ci evidence sign --local --check-id <id>[,<id>...] [--at <rev>] [--base <rev>] [--key <file>] [--claim <file>] [--no-push] [--json]\n" +
52
78
  " chant ci evidence verify [--local] --check-id <id>[,<id>...] [--at <rev>] [--base <rev>] [--json]";
53
79
 
@@ -110,49 +136,238 @@ async function verifyLocal(ctx: CommandContext, repo: string, base: string, at:
110
136
  return verdicts.every((v) => v.status === "accepted") ? CHANT_EXIT.done : CHANT_EXIT.failed;
111
137
  }
112
138
 
139
+ /**
140
+ * `sign --from-job <job>` (#4926): the wave's evidence job, signing each
141
+ * named check whose step in that job of this run and commit the forge
142
+ * reports as passed (../../ci-evidence-from-job.ts). Exits 1 when the job is
143
+ * another run's or commit's.
144
+ */
145
+ async function signFromJobCommand(ctx: CommandContext, repo: string, base: string): Promise<number> {
146
+ const { args } = ctx;
147
+ const checks = idsOf(args.checkId);
148
+ if (checks.length === 0) return usage("sign --from-job needs --check-id <id>[,<id>...], the checks the job ran");
149
+ if (args.fromReport) return usage("--from-job and --from-report are two ways to sign; pass one");
150
+ const pem = args.key ? readFileSync(args.key, "utf-8") : undefined;
151
+ try {
152
+ const { forgeTargetFromEnv } = await import("../../pr-forge");
153
+ const { forgeReadsFor } = await import("../../pr-forge-reads");
154
+ const { signFromJob } = await import("../../ci-evidence-from-job");
155
+ const reads = forgeReadsFor(forgeTargetFromEnv(process.env));
156
+ const done = await signFromJob({ repo, base, fromJob: args.fromJob!, checks, ...(args.claims ? { claims: args.claims } : {}), ...(args.at ? { at: args.at } : {}), reads, ...(pem ? { key: pem } : {}), push: !args.noPush });
157
+ if ("refused" in done) {
158
+ console.error(formatError({ message: `ci evidence: ${done.refused}`, hint: USAGE }));
159
+ return CHANT_EXIT.failed;
160
+ }
161
+ if (args.json) console.log(JSON.stringify({ signed: done.signed, skipped: done.skipped }, null, 2));
162
+ return CHANT_EXIT.done;
163
+ } catch (err) {
164
+ console.error(formatError({ message: err instanceof Error ? err.message : String(err), hint: USAGE }));
165
+ return CHANT_EXIT.failed;
166
+ }
167
+ }
168
+
113
169
  async function sign(ctx: CommandContext, repo: string, base: string, at: string): Promise<number> {
114
170
  const { args } = ctx;
171
+ if (args.open && args.fromJob) return usage("--open and --from-job are two ways to sign; pass one");
172
+ if (args.open) return signOpen(ctx, repo, base);
173
+ if (args.fromJob) return signFromJobCommand(ctx, repo, base);
115
174
  const fromReport = args.fromReport;
116
175
  if (!fromReport && idsOf(args.checkId).length === 0) return usage("sign needs --check-id <id>, or --from-report <dir> in a plan note job");
176
+ const member = memberOf(args.members, Boolean(fromReport));
177
+ if (typeof member === "object") return usage(member.usage);
117
178
  const pem = args.key ? readFileSync(args.key, "utf-8") : process.env[CHECK_EVIDENCE_KEY_ENV];
179
+ let wanted: Array<{ check: string; claim?: Buffer | string }> | undefined;
180
+ if (!fromReport) {
181
+ const claim = args.claim ? readFileSync(args.claim) : undefined;
182
+ wanted = idsOf(args.checkId).map((check) => ({ check, ...(claim ? { claim } : {}) }));
183
+ }
184
+ const done = await signChecksOf(repo, base, at, { ...(fromReport ? { fromReport } : {}), ...(wanted ? { wanted } : {}), ...(args.planResult ? { result: args.planResult } : {}), ...(member ? { member } : {}), pem, push: !args.noPush });
185
+ if ("usage" in done) return usage(done.usage);
186
+ if (fromReport) writeFileSync(join(fromReport, CHECK_EVIDENCE_FILE), JSON.stringify(done.note, null, 2) + "\n");
187
+ if (args.json) console.log(JSON.stringify(done.note, null, 2));
188
+ return done.code;
189
+ }
190
+
191
+ /**
192
+ * `--member <name>` (#4964): the workspace member whose plan report this is,
193
+ * or (#4978) the product plan target whose plan job wrote it, so `plan` and
194
+ * `policy` are signed as `plan:<name>` and `policy:<name>`. One name, and
195
+ * only with a plan report.
196
+ */
197
+ function memberOf(members: string[] | undefined, fromReport: boolean): string | undefined | { usage: string } {
198
+ if (!members || members.length === 0) return undefined;
199
+ if (!fromReport) return { usage: "--member names the member whose plan report --from-report signs; --check-id names its checks in full" };
200
+ if (members.length > 1 || !EVIDENCE_MEMBER_NAME.test(members[0]!)) return { usage: `--member takes one member or target name, letters, digits, - and _, not ${members.join(",")}` };
201
+ return members[0];
202
+ }
203
+
204
+ /**
205
+ * Sign the checks of a report directory (`fromReport`) or the named ones
206
+ * (`wanted`) at `at`, against the runner identities at `base`. With
207
+ * `skipCurrent` (#4914), a check whose current evidence the notes already
208
+ * hold is not signed again and is listed as signed by that runner, so a
209
+ * pipeline that runs on every schedule signs each head once.
210
+ */
211
+ async function signChecksOf(
212
+ repo: string,
213
+ base: string,
214
+ at: string,
215
+ opts: { fromReport?: string; wanted?: Array<{ check: string; claim?: Buffer | string }>; result?: string; member?: string; pem?: string; push: boolean; skipCurrent?: boolean },
216
+ ): Promise<{ note: CheckEvidenceNote; code: number } | { usage: string }> {
217
+ const { fromReport, pem } = opts;
118
218
  const identity = pem !== undefined && pem !== "" ? "key" : process.env[RUNNER_IDENTITY_ENV] ? "oidc" : undefined;
119
219
  const note: CheckEvidenceNote = { signed: [], skipped: [] };
120
220
  let wanted: Array<{ check: string; claim?: Buffer | string }>;
121
- if (fromReport) {
122
- const decided = planReportChecks(fromReport, args.planResult);
221
+ if (fromReport && isCheckReportDir(fromReport)) {
222
+ // #4935: a check job's report, each passed hook signed by name; #4964: a hook is the workspace's or the member's by its own name.
223
+ if (opts.member) return { usage: `--member names a plan report's member, and ${fromReport} is a check job's report, whose hooks are signed by their own names` };
224
+ const decided = await checkReportChecks(fromReport, opts.result);
225
+ if ("error" in decided) return { usage: decided.error };
226
+ wanted = decided.sign;
227
+ note.skipped.push(...decided.skipped);
228
+ } else if (fromReport) {
229
+ const decided = planReportChecks(fromReport, opts.result, opts.member);
123
230
  wanted = decided.sign;
124
231
  note.skipped.push(...decided.skipped);
125
232
  } else {
126
- const claim = args.claim ? readFileSync(args.claim) : undefined;
127
- wanted = idsOf(args.checkId).map((check) => ({ check, ...(claim ? { claim } : {}) }));
233
+ wanted = opts.wanted ?? [];
128
234
  }
129
- const finish = (code: number): number => {
130
- if (fromReport) writeFileSync(join(fromReport, CHECK_EVIDENCE_FILE), JSON.stringify(note, null, 2) + "\n");
131
- if (args.json) console.log(JSON.stringify(note, null, 2));
132
- return code;
133
- };
134
235
  if (!identity) {
135
236
  note.skipped.push(...wanted.map((w) => ({ check: w.check, reason: noRunnerIdentity() })));
136
237
  console.error(`ci evidence: ${noRunnerIdentity()}, so no check was signed`);
137
- return finish(CHANT_EXIT.done);
238
+ return { note, code: CHANT_EXIT.done };
138
239
  }
139
240
  let signer: EvidenceSigner;
140
241
  try {
141
242
  signer = (await runnerEvidenceSigner(repo, base, pem ? { key: pem } : {}))!;
142
243
  } catch (err) {
143
244
  console.error(formatError({ message: err instanceof Error ? err.message : String(err), hint: USAGE }));
144
- return finish(CHANT_EXIT.failed);
245
+ return { note, code: CHANT_EXIT.failed };
145
246
  }
146
247
  for (const s of note.skipped) console.error(`ci evidence: ${s.check} not signed: ${s.reason}`);
147
- if (wanted.length === 0) return finish(CHANT_EXIT.done);
248
+ if (opts.skipCurrent && wanted.length > 0) {
249
+ const { tree } = commitTree(repo, at);
250
+ const current = (await readCheckEvidence(repo, at, base, wanted.map((w) => w.check))).filter((v) => v.status === "current");
251
+ for (const v of current) {
252
+ note.signed.push({ check: v.check, runner: v.runner, commit: v.commit, tree });
253
+ console.error(`ci evidence: ${v.check} at ${at.slice(0, 12)} is already signed by ${v.runner}`);
254
+ }
255
+ const kept = new Set(current.map((v) => v.check));
256
+ wanted = wanted.filter((w) => !kept.has(w.check));
257
+ }
258
+ if (wanted.length === 0) return { note, code: CHANT_EXIT.done };
148
259
  const signed = await signChecks(repo, at, wanted, signer);
149
- const pushed = await recordChecks(repo, signed, { push: !args.noPush });
260
+ const pushed = await recordChecks(repo, signed, { push: opts.push });
150
261
  for (const s of signed) {
151
262
  note.signed.push({ check: s.check, runner: s.runner, commit: s.commit, tree: s.tree });
152
263
  console.error(`ci evidence: signed ${s.check} at ${s.commit.slice(0, 12)} as ${s.runner}`);
153
264
  }
154
- if (!args.noPush && !pushed.pushed && pushed.pushWarning) console.error(`ci evidence: the evidence is attached here, and the push did not land: ${pushed.pushWarning}`);
155
- return finish(CHANT_EXIT.done);
265
+ if (opts.push && !pushed.pushed && pushed.pushWarning) console.error(`ci evidence: the evidence is attached here, and the push did not land: ${pushed.pushWarning}`);
266
+ return { note, code: CHANT_EXIT.done };
267
+ }
268
+
269
+ /** A commit's full sha and tree, read with git. */
270
+ function commitTree(repo: string, rev: string): { commit: string; tree: string } {
271
+ const read = (spec: string) => execFileSync("git", ["rev-parse", "--verify", spec], { cwd: repo, encoding: "utf-8", stdio: ["ignore", "pipe", "pipe"] }).trim();
272
+ return { commit: read(`${rev}^{commit}`), tree: read(`${rev}^{tree}`) };
273
+ }
274
+
275
+ /**
276
+ * `sign --open --job <job> --from-report <dir> -o <out>` (#4914): in a
277
+ * GitLab pipeline of the target branch, sign each open merge request's
278
+ * settled `job` from its artifact (../../workspace/trust/open-evidence.ts),
279
+ * against the policy at `--base` (the generated job passes the branch's
280
+ * commit). The branch is `--branch`, else the pipeline's own. Exits 0 once
281
+ * each merge request is signed or said, and 1 when the job's runner
282
+ * identity is not one the policy at base lists.
283
+ */
284
+ async function signOpen(ctx: CommandContext, repo: string, base: string): Promise<number> {
285
+ const { args } = ctx;
286
+ if (!args.ciJob || !/^[A-Za-z0-9][A-Za-z0-9_.-]*$/.test(args.ciJob)) return usage("sign --open needs the job to sign for, by name: --job plan");
287
+ if (!args.fromReport) return usage("sign --open needs the job's report directory as its artifact keeps it: --from-report .chant/pr");
288
+ if (!args.output) return usage("sign --open needs where to keep each merge request's evidence.json: -o .chant/evidence/<job>");
289
+ if (args.checkId || args.at || args.planResult) return usage("sign --open finds each merge request's head and its job's result itself, so it takes no --check-id, --at or --result");
290
+ const member = memberOf(args.members, true);
291
+ if (typeof member === "object") return usage(member.usage);
292
+ const branch = args.branch ?? process.env.CI_COMMIT_BRANCH;
293
+ if (!branch) return usage("sign --open signs for the merge requests into a branch: run it in a branch pipeline, or pass --branch <branch>");
294
+ const pem = args.key ? readFileSync(args.key, "utf-8") : process.env[CHECK_EVIDENCE_KEY_ENV];
295
+ const { forgeFromEnv } = await import("../../pr-forge");
296
+ const { signOpenReports } = await import("../../workspace/trust/open-evidence");
297
+ // The notes there are the ones to skip a head already signed by, and to add to.
298
+ spawnSync("git", ["fetch", "--quiet", "--no-tags", "origin", "+refs/notes/chant/evidence:refs/notes/chant/evidence"], { cwd: repo, encoding: "utf-8" });
299
+ let failed = false;
300
+ let done: Awaited<ReturnType<typeof signOpenReports>>;
301
+ try {
302
+ done = await signOpenReports({
303
+ forge: forgeFromEnv("gitlab"),
304
+ branch,
305
+ job: args.ciJob,
306
+ artifactDir: args.fromReport,
307
+ out: args.output,
308
+ ...(args.noForks ? { noForks: true } : {}),
309
+ fetchHead: (pr, head) => fetchMergeRequestHead(repo, pr, head),
310
+ sign: async (dir, head, result) => {
311
+ const r = await signChecksOf(repo, base, head, { fromReport: dir, result, ...(member ? { member } : {}), ...(pem ? { pem } : {}), push: !args.noPush, skipCurrent: true });
312
+ if ("usage" in r) throw new Error(r.usage);
313
+ if (r.code !== CHANT_EXIT.done) failed = true;
314
+ return r.note;
315
+ },
316
+ });
317
+ } catch (err) {
318
+ console.error(formatError({ message: err instanceof Error ? err.message : String(err), hint: USAGE }));
319
+ return CHANT_EXIT.failed;
320
+ }
321
+ for (const w of done.warnings) console.error(`ci evidence: ${w}`);
322
+ for (const d of done.done) {
323
+ if (d.skipped) console.error(`ci evidence: !${d.pr}: ${d.skipped}`);
324
+ else console.error(`ci evidence: !${d.pr} at ${d.head.slice(0, 12)}: signed ${d.note!.signed.map((s) => s.check).join(", ") || "nothing"}`);
325
+ }
326
+ if (done.done.length === 0) console.error(`ci evidence: no open merge request into ${branch} has a ${args.ciJob} job`);
327
+ if (args.json) console.log(JSON.stringify(done.done, null, 2));
328
+ return failed ? CHANT_EXIT.failed : CHANT_EXIT.done;
329
+ }
330
+
331
+ /** Fetch merge request `pr`'s head (`refs/merge-requests/<iid>/head`, a fork's too), else the commit itself; true once it is here. */
332
+ function fetchMergeRequestHead(repo: string, pr: number, head: string): boolean {
333
+ const here = () => spawnSync("git", ["cat-file", "-e", `${head}^{commit}`], { cwd: repo }).status === 0;
334
+ if (here()) return true;
335
+ spawnSync("git", ["fetch", "--quiet", "--no-tags", "origin", `refs/merge-requests/${pr}/head`], { cwd: repo, encoding: "utf-8" });
336
+ if (here()) return true;
337
+ spawnSync("git", ["fetch", "--quiet", "--no-tags", "origin", head], { cwd: repo, encoding: "utf-8" });
338
+ return here();
339
+ }
340
+
341
+ /** Whether `dir` holds a check job's report and no plan report (#4935). */
342
+ function isCheckReportDir(dir: string): boolean {
343
+ return existsSync(join(dir, "check-hooks.json")) && !existsSync(join(dir, "pr-plan.json")) && !existsSync(join(dir, "pr-plan-note.json"));
344
+ }
345
+
346
+ /**
347
+ * The hooks to sign from a check job's report (#4935): each hook whose every
348
+ * run passed, with its runs as the claim, as the check runner signs them
349
+ * (../../components/check-steps.ts). The report is the check job's, which ran
350
+ * the change's code, so it is read as data: a hook with no name or outcome is
351
+ * left out. A job `result` other than success or failure signs none.
352
+ */
353
+ async function checkReportChecks(dir: string, result: string | undefined): Promise<{ sign: Array<{ check: string; claim: string }>; skipped: CheckEvidenceNote["skipped"] } | { error: string }> {
354
+ const { CHECK_HOOKS_REPORT_FILE, passedCheckHooks } = await import("../../components/check-hooks");
355
+ let doc: unknown;
356
+ try {
357
+ doc = JSON.parse(readFileSync(join(dir, CHECK_HOOKS_REPORT_FILE), "utf-8"));
358
+ } catch (err) {
359
+ return { error: `--from-report ${dir}: ${CHECK_HOOKS_REPORT_FILE} does not read: ${err instanceof Error ? err.message : String(err)}` };
360
+ }
361
+ const hooks = doc && typeof doc === "object" && Array.isArray((doc as { hooks?: unknown }).hooks) ? ((doc as { hooks: unknown[] }).hooks as Array<Record<string, unknown>>) : undefined;
362
+ if (!hooks) return { error: `--from-report ${dir}: ${CHECK_HOOKS_REPORT_FILE} lists no hooks` };
363
+ const runs = hooks.filter((h) => h && typeof h.name === "string" && h.name.length > 0 && h.name.length <= 200 && (h.outcome === "passed" || h.outcome === "failed" || h.outcome === "skipped"));
364
+ const passed = passedCheckHooks(runs as unknown as Parameters<typeof passedCheckHooks>[0]);
365
+ if (result !== undefined && result !== "success" && result !== "failure") {
366
+ return { sign: [], skipped: passed.map((p) => ({ check: p.check, reason: `the check job's result is ${result}` })) };
367
+ }
368
+ const signed = new Set(passed.map((p) => p.check));
369
+ const skipped = [...new Set(runs.map((h) => h.name as string))].filter((n) => !signed.has(n)).map((check) => ({ check, reason: "the hook did not pass in the check job" }));
370
+ return { sign: passed.map((p) => ({ check: p.check, claim: JSON.stringify(p.runs) })), skipped };
156
371
  }
157
372
 
158
373
  async function verify(ctx: CommandContext, repo: string, base: string, at: string): Promise<number> {
@@ -1,9 +1,12 @@
1
1
  /**
2
2
  * `chant ci forge-check [--env <env>] [--member <name>] [--forge <forge>]
3
- * [--repo <owner/name>] [--branch <default>] [--require-clouds] [--json]`
4
- * (#4608): read the live forge, the clouds and Pulumi Cloud against the
5
- * pull-request pipelines `ci.identity.cloud` gives the workspace, one row
6
- * per expected setting. Read-only. Exits chant's `failed` (1) on a
3
+ * [--repo <owner/name>] [--branch <default>] [--require-clouds]
4
+ * [--ref-gate-status] [--json]` (#4608): read the live forge, the clouds and
5
+ * Pulumi Cloud against the pull-request pipelines `ci.identity.cloud` gives
6
+ * the workspace, one row per expected setting. With `--ref-gate-status`
7
+ * (#4913), for pipelines built with it, the default branch also requires
8
+ * the ref gate's status, named as the policy at `origin/<default>` (else
9
+ * `HEAD`) names it. Read-only. Exits chant's `failed` (1) on a
7
10
  * mismatch, or with --require-clouds on a cloud left unchecked; `done` (0)
8
11
  * otherwise. See ../../forge-check/index.ts.
9
12
  */
@@ -12,7 +15,7 @@ import type { CloudIdentityDeclaration } from "../../ci-identity";
12
15
  import type { ForgeFetch } from "../../pr-forge";
13
16
  import type { CommandContext } from "../registry";
14
17
 
15
- const USAGE = "chant ci forge-check [--env <env>] [--member <name>] [--forge github|gitlab|forgejo] [--repo <owner/name>] [--branch <default>] [--require-clouds] [--json]";
18
+ const USAGE = "chant ci forge-check [--env <env>] [--member <name>] [--forge github|gitlab|forgejo] [--repo <owner/name>] [--branch <default>] [--require-clouds] [--ref-gate-status] [--json]";
16
19
 
17
20
  /** The environment chant's generated pull-request pipelines default to. */
18
21
  const DEFAULT_ENV = "production";
@@ -62,29 +65,39 @@ export async function runCiForgeCheck(ctx: CommandContext): Promise<number> {
62
65
  });
63
66
  const words = activeProductWords();
64
67
  const host = target.host;
68
+ // #4913: with --ref-gate-status the default branch requires the ref gate's status too, named as the policy names it.
69
+ let gate: { status?: string; note?: string; problem?: string } = {};
70
+ const statusFor = args.refGateStatus ? (await import("../../ref-gate-rules")).refGateStatusFor : undefined;
65
71
  const result = await forgeCheck(
66
72
  {
67
73
  target,
68
74
  words,
69
75
  ...(args.requireClouds ? { requireClouds: true } : {}),
70
- contract: (live) =>
71
- pipelineContract({
76
+ contract: (live) => {
77
+ const defaultBranch = args.branch ?? live.defaultBranch ?? "main";
78
+ if (statusFor) gate = statusFor(found?.dir ?? process.cwd(), defaultBranch);
79
+ const status = gate.status;
80
+ return pipelineContract({
72
81
  forge: target.kind,
73
82
  repository: {
74
83
  host,
75
84
  path: live.path ?? target.repo,
76
- defaultBranch: args.branch ?? live.defaultBranch ?? "main",
85
+ defaultBranch,
77
86
  ...(live.ownerId ? { ownerId: live.ownerId } : {}),
78
87
  ...(live.repoId ? { repoId: live.repoId } : {}),
79
88
  },
80
89
  pipelines,
81
90
  words,
82
- }),
91
+ ...(status ? { refGateStatus: status } : {}),
92
+ });
93
+ },
83
94
  },
84
95
  { fetch: globalThis.fetch as unknown as ForgeFetch, env: process.env },
85
96
  );
97
+ if (gate.problem) return fail(`--ref-gate-status: ${gate.problem}`);
86
98
  if (args.json) console.log(JSON.stringify(result, null, 2));
87
99
  else console.log(describeForgeCheck(result));
100
+ if (gate.note) console.error(`ci forge-check: ${gate.note}`);
88
101
  if (!decl) console.error("ci forge-check: no ci.identity.cloud in the workspace declaration, so no trust was checked");
89
102
  else if (pipelines.length === 0) console.error(`ci forge-check: no rule of ci.identity.cloud covers environment ${env}, so no trust was checked`);
90
103
  return forgeCheckExit(result);
@@ -60,6 +60,7 @@ import type { Phase, Component } from "../../components/component";
60
60
  import { deployUnits } from "../../components/deploy-units";
61
61
  import { sortedJsonReplacer } from "../../utils";
62
62
  import { withoutReadFlags } from "../../lifecycle/legacy-digest";
63
+ import { actorFromEnv } from "../../actor";
63
64
 
64
65
  /**
65
66
  * chant components release <env> --component <name> --digest <sha256:...>
@@ -141,7 +142,8 @@ export async function runComponentsReleaseRecord(ctx: CommandContext): Promise<n
141
142
  // Id + origin resolved together from the same environment (#2045), so the
142
143
  // recorded runId always says which id space it lives in and how to reach it.
143
144
  const { runId, runOrigin } = resolveRunId(args.runId);
144
- const actor = args.actor ?? process.env.GITHUB_ACTOR ?? process.env.GITLAB_USER_LOGIN ?? process.env.USER;
145
+ // #4952: the fallback is actorFromEnv's; an empty answer is no actor, refused below.
146
+ const actor = args.actor ?? (actorFromEnv(process.env, "") || undefined);
145
147
  // Who approved a gated change (#1035). Optional — omitted for an ungated
146
148
  // change, and never defaulted to `actor`, since recording the approver as the
147
149
  // triggerer would defeat the separation-of-duties the field exists to attest.
@@ -0,0 +1,69 @@
1
+ /**
2
+ * `chant dev generated-check [<render>...] [--json]` (#4909): render the
3
+ * product's declared generated files (`chantGenerated` in its root
4
+ * package.json) into a directory under the OS temp directory, compare each
5
+ * with the committed file, and exit 1 naming every one that drifted. The
6
+ * directory is left in place and printed. Exit 2 when the product declares
7
+ * no `chantGenerated`. Also `chant dev render` (#4950), which writes a
8
+ * module's file-text export in place.
9
+ */
10
+ import { checkGenerated, readGeneratedCheckConfig } from "../../generated-check";
11
+ import { formatError } from "../format";
12
+ import type { CommandContext } from "../registry";
13
+
14
+ const USAGE = "chant dev generated-check [<render>...] [--json]";
15
+
16
+ export async function runDevGeneratedCheck(ctx: CommandContext): Promise<number> {
17
+ const productDir = process.cwd();
18
+ let config;
19
+ try {
20
+ config = readGeneratedCheckConfig(productDir);
21
+ } catch (err) {
22
+ console.error(formatError({ message: err instanceof Error ? err.message : String(err), hint: USAGE }));
23
+ return 2;
24
+ }
25
+ if (!config) {
26
+ console.error(formatError({ message: "package.json here declares no chantGenerated", hint: USAGE }));
27
+ return 2;
28
+ }
29
+ const only = (ctx.args.positionals ?? []).slice(1);
30
+ const result = await checkGenerated(productDir, config, { only });
31
+ if (ctx.args.json) {
32
+ console.log(JSON.stringify(result, null, 2));
33
+ } else {
34
+ for (const f of result.matched) console.error(` generated-check: ${f} matches its render`);
35
+ for (const p of result.problems) console.error(`generated-check: ${p}`);
36
+ console.error(`generated-check: the renders are in ${result.out}`);
37
+ if (result.ok) console.error(`generated-check: ${result.matched.length} files match ${result.renders.length} renders`);
38
+ }
39
+ return result.ok ? 0 : 1;
40
+ }
41
+
42
+ const RENDER_USAGE = "chant dev render <module> <export> [--output <root>]";
43
+
44
+ /**
45
+ * `chant dev render <module> <export> [--output <root>]` (#4950): import the
46
+ * module, call its export (a `{ path: text }` object, or a function that
47
+ * returns one) and write each file at its path below the root, the working
48
+ * directory unless `--output` names one. Under `chant dev generated-check`
49
+ * a path inside the product goes to the render tree instead.
50
+ */
51
+ export async function runDevRender(ctx: CommandContext): Promise<number> {
52
+ const [, modulePath, exportName] = ctx.args.positionals ?? [];
53
+ if (!modulePath || !exportName) {
54
+ console.error(formatError({ message: "name the module and its export that returns the files", hint: RENDER_USAGE }));
55
+ return 2;
56
+ }
57
+ const { resolve } = await import("node:path");
58
+ const { renderPathOf } = await import("../../generated-check");
59
+ const { renderModuleFiles, writeRenderedFiles } = await import("../../render-module");
60
+ try {
61
+ const files = await renderModuleFiles(modulePath, exportName);
62
+ const root = resolve(ctx.args.output ?? ".");
63
+ for (const path of writeRenderedFiles(root, files, renderPathOf)) console.error(` wrote ${path}`);
64
+ return 0;
65
+ } catch (err) {
66
+ console.error(formatError({ message: `chant dev render: ${err instanceof Error ? err.message : String(err)}`, hint: RENDER_USAGE }));
67
+ return 1;
68
+ }
69
+ }
@@ -517,6 +517,26 @@ describe("runLifecycleDiff --live", () => {
517
517
  expect(seen?.attributes?.chart).toBe("web-1.2.3");
518
518
  });
519
519
 
520
+ test("--live --json writes a lexicon's liveAbsentStatus as its section's absent, and nothing for one that sets none (#4896)", async () => {
521
+ buildMock.mockResolvedValue(makeBuildResult({ sql: ["events"], aws: ["bucket"] }));
522
+ fetchLifecycleMock.mockResolvedValue(undefined);
523
+ readSnapshotMock.mockResolvedValue(null);
524
+ const plugins: LexiconPlugin[] = [
525
+ { ...createMockPlugin({ name: "sql", describeResources: staticObservation({}) }), liveAbsentStatus: "missing" },
526
+ createMockPlugin({ name: "aws", describeResources: staticObservation({}) }),
527
+ ];
528
+ await runLifecycleDiff({
529
+ args: makeArgs({ command: "state", path: "diff", extraPositional: "prod", live: true, json: true }),
530
+ plugins,
531
+ serializers: plugins.map((p) => p.serializer),
532
+ } as never);
533
+ const payload = JSON.parse(stdoutBuf.join("\n")) as { lexicons: Record<string, { absent?: string; resources?: { missing: string[] } }> };
534
+ expect(payload.lexicons.sql.resources?.missing).toEqual(["events"]);
535
+ expect(payload.lexicons.sql.absent).toBe("missing");
536
+ expect(payload.lexicons.aws.resources?.missing).toEqual(["bucket"]);
537
+ expect("absent" in payload.lexicons.aws).toBe(false);
538
+ });
539
+
520
540
  test("--live lists artifacts for a configured lexicon with NO built entities — the deploy-step estate shape", async () => {
521
541
  // kubemicrovm-ops: helm is a configured lexicon whose releases exist only
522
542
  // as component helm-upgrade steps, so the built manifest carries no helm
@@ -811,6 +811,8 @@ interface LiveDiffOutcome {
811
811
  string,
812
812
  {
813
813
  resources?: LiveDiffResult;
814
+ /** The lexicon's `liveAbsentStatus` (#4896): what an entity in `resources.missing` is. Present only when the lexicon sets it. */
815
+ absent?: "pending" | "missing";
814
816
  observed?: Record<string, ResourceMetadata>;
815
817
  /** Declared entities the lexicon could not read (#1089), keyed by name. */
816
818
  unobserved?: Record<string, UnobservedEntity>;
@@ -997,6 +999,8 @@ async function runLifecycleDiffLive(args: LiveDiffArgs): Promise<LiveDiffOutcome
997
999
  if (args.json) {
998
1000
  const entry = (byLexicon[lexiconName] ??= {});
999
1001
  entry.resources = diff;
1002
+ // What a confirmed-absent entity is, when the lexicon says (#4896); left out for every other lexicon.
1003
+ if (plugin.liveAbsentStatus) entry.absent = plugin.liveAbsentStatus;
1000
1004
  entry.observed = observedNow; // live state (#862) — status/attributes per resource
1001
1005
  if (Object.keys(observed.unobserved).length > 0) entry.unobserved = observed.unobserved;
1002
1006
  } else renderLiveDiff(lexiconName, args.environment, diff);
@@ -7,12 +7,13 @@
7
7
  import { spawnSync } from "node:child_process";
8
8
  import { join, resolve } from "node:path";
9
9
  import { checkBundle, readBundleCheckConfig, type BundleCheckResult } from "../../bundle-check";
10
- import { installLocalChant, LocalChantError, productManifests, resetLocalChant, type LocalChantResult } from "../../local-chant";
10
+ import { installLocalChant, LocalChantError, localChantImage, productManifests, resetLocalChant, type LocalChantResult } from "../../local-chant";
11
11
  import { formatError } from "../format";
12
12
  import type { CommandContext } from "../registry";
13
13
 
14
14
  const LOCAL_USAGE = "chant dev local <chant-dir> [--with <package>]... [--build '<command>'] [--json] | chant dev local --reset [--build '<command>']";
15
15
  const CHECK_USAGE = "chant dev bundle-check [<package-dir>] [--json]";
16
+ const IMAGE_USAGE = "chant dev local-image [--with <package>]... [--json] [-- <docker build arguments>...]";
16
17
 
17
18
  /** The product packages that declare `chantBundleCheck`, as directories. */
18
19
  function checkedPackages(productDir: string): string[] {
@@ -75,6 +76,7 @@ export async function runDevLocal(ctx: CommandContext): Promise<number> {
75
76
  console.log(JSON.stringify({ reset, local: installed ? { commit: installed.mark.commit, dir: installed.mark.dir, packed: installed.packed.map((p) => ({ name: p.name, version: p.version })), marked: installed.marked } : undefined, checks: results }, null, 2));
76
77
  } else if (installed) {
77
78
  console.log(`chant commit: ${installed.mark.commit}`);
79
+ console.log(`chant version: ${installed.packed[0]?.version ?? "none"} (local build)`);
78
80
  }
79
81
  return ok ? 0 : 1;
80
82
  }
@@ -104,3 +106,39 @@ export async function runDevBundleCheck(ctx: CommandContext): Promise<number> {
104
106
  if (ctx.args.json) console.log(JSON.stringify(results, null, 2));
105
107
  return ok ? 0 : 1;
106
108
  }
109
+
110
+ /**
111
+ * `chant dev local-image [--with <package>]... [-- <docker build arguments>]`
112
+ * (#4909): build a product's image with the chant the product has installed.
113
+ * With no docker arguments it prints the chant version the image would
114
+ * install (the pin, or `local-<commit>`), for a label that rebuilds the image
115
+ * when it changes; `--json` prints the version, the mark and the arguments.
116
+ * With them it runs `docker build` with `--build-arg CHANT_VERSION=<version>`
117
+ * and, for a `chant dev local` build, `--build-context
118
+ * chant-local=<product>/.chant-local` first. `--with` names a package the
119
+ * image installs from the tarballs besides core. Exit 1 when the local build's
120
+ * tarballs are missing or docker fails, 2 for a usage error.
121
+ */
122
+ export async function runDevLocalImage(ctx: CommandContext): Promise<number> {
123
+ const docker = (ctx.args.positionals ?? []).slice(1);
124
+ let image;
125
+ try {
126
+ image = localChantImage(process.cwd(), { with: ctx.args.withPackages });
127
+ } catch (err) {
128
+ if (!(err instanceof LocalChantError)) throw err;
129
+ console.error(formatError({ message: err.message, hint: IMAGE_USAGE }));
130
+ return 1;
131
+ }
132
+ if (docker.length === 0) {
133
+ if (ctx.args.json) console.log(JSON.stringify(image, null, 2));
134
+ else console.log(image.version);
135
+ return 0;
136
+ }
137
+ console.error(`chant dev local-image: docker build with chant ${image.version}`);
138
+ const r = spawnSync("docker", ["build", ...image.args, ...docker], { cwd: process.cwd(), stdio: "inherit" });
139
+ if (r.error) {
140
+ console.error(formatError({ message: `docker build: ${r.error.message}` }));
141
+ return 1;
142
+ }
143
+ return r.status === 0 ? 0 : 1;
144
+ }