@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
@@ -21,7 +21,10 @@ const BOOLEAN_FLAGS = new Set([
21
21
  "--help",
22
22
  "--open",
23
23
  "--note-commands",
24
+ "--check-job",
25
+ "--ref-gate-status",
24
26
  "--locks",
27
+ "--reach",
25
28
  "--version",
26
29
  "--agents",
27
30
  "--agent",
@@ -80,6 +83,7 @@ const BOOLEAN_FLAGS = new Set([
80
83
  "--require-runner-start",
81
84
  "--require-clouds",
82
85
  "--no-push",
86
+ "--no-forks",
83
87
  "--list",
84
88
  "--no-require-review",
85
89
  "--expire",
@@ -102,6 +106,8 @@ const BOOLEAN_FLAGS = new Set([
102
106
  "--root-only",
103
107
  "--generated",
104
108
  "--decide",
109
+ "--policy-only",
110
+ "--render-spec",
105
111
  "--record-plans",
106
112
  "--approval-status",
107
113
  "--waves-outcome",
@@ -425,6 +431,9 @@ export function parseArgs(args: string[]): ParsedArgs {
425
431
  } else if (arg === "--keep") {
426
432
  // `chant lock --keep --pr <n>` (#4588): keep the locks the pull request's plan took, as `/<product> lock` asks.
427
433
  result.keepLocks = true;
434
+ } else if (arg === "--reach") {
435
+ // `chant lock --reach --pr <n> --head <sha> --base <sha>` (#4979): lock what the reach line in CHANT_LOCK_REACH prints.
436
+ result.lockReach = true;
428
437
  } else if (arg === "--runs" || arg === "--plans" || arg === "--wave-outputs") {
429
438
  // `chant components plan-wave|apply-wave` (#4588): the op-waves runs and plans files, and the outputs the waves hand on.
430
439
  const value = args[++i];
@@ -483,6 +492,12 @@ export function parseArgs(args: string[]): ParsedArgs {
483
492
  result.wave = wave;
484
493
  } else if (arg === "--decide") {
485
494
  result.decide = true;
495
+ } else if (arg === "--policy-only") {
496
+ // `chant run wave --policy-only` (#4926): plan the wave and run its policy hold, as a step of its own.
497
+ result.policyOnly = true;
498
+ } else if (arg === "--render-spec") {
499
+ // `chant run wave --render-spec` (#4982): the product's command prints the spec at base.
500
+ result.renderSpec = true;
486
501
  } else if (arg === "--record-plans") {
487
502
  result.recordPlans = true;
488
503
  } else if (arg === "--approval-status") {
@@ -570,6 +585,12 @@ export function parseArgs(args: string[]): ParsedArgs {
570
585
  // `chant lock --from-report <pr-plan.json>` (#4293): lock the components a pull-request report lists.
571
586
  result.fromReport = args[++i];
572
587
  if (!result.fromReport || result.fromReport.startsWith("-")) throw new Error("--from-report needs a report file: --from-report <pr-plan.json>");
588
+ } else if (arg === "--from-job" || arg === "--claims") {
589
+ // `chant ci evidence sign --from-job <job> [--claims <dir>]` (#4926): sign from another job's step results.
590
+ const value = args[++i];
591
+ if (value === undefined || value.startsWith("-")) throw new Error(arg === "--from-job" ? "--from-job needs the job's name: --from-job <job>" : "--claims needs a directory: --claims <dir>");
592
+ if (arg === "--from-job") result.fromJob = value;
593
+ else result.claims = value;
573
594
  } else if (arg === "--report-url") {
574
595
  // `chant components pr-plan|pr-apply --report-url <url>` (#4007).
575
596
  const url = args[++i];
@@ -579,6 +600,9 @@ export function parseArgs(args: string[]): ParsedArgs {
579
600
  // `chant components pr-post --result <result>` (#4295): the plan job's own result, which fails the status when it failed.
580
601
  result.planResult = args[++i];
581
602
  if (!result.planResult || result.planResult.startsWith("-")) throw new Error("--result needs the plan job's result: --result success|failure|cancelled");
603
+ } else if (arg === "--no-forks") {
604
+ // `chant ci evidence sign --open --no-forks` (#4914): sign for no merge request from a fork.
605
+ result.noForks = true;
582
606
  } else if (arg === "--no-status") {
583
607
  // `chant ci run|serve --no-status` (#4097): post no commit status for the job.
584
608
  result.noStatus = true;
@@ -926,6 +950,40 @@ export function parseArgs(args: string[]): ParsedArgs {
926
950
  } else if (arg === "--note-commands") {
927
951
  // `chant build --pr-loop --note-commands` (#4785).
928
952
  result.noteCommands = true;
953
+ } else if (arg === "--check-job") {
954
+ // `chant build --pr-loop --check-job` (#4935): the check job, chant ci check on the pull request's commit.
955
+ result.checkJob = true;
956
+ } else if (arg === "--ref-gate-status") {
957
+ // `chant build --pr-loop --ref-gate-status` (#4935): the job that sets the ref gate's status; on `ci forge-check` (#4913), require it.
958
+ result.refGateStatus = true;
959
+ } else if (arg === "--evidence-runner-key-secret") {
960
+ // `chant build --pr-loop --evidence-runner-key-secret <NAME>` (#4935): the secret holding the runner key the note job signs with.
961
+ result.evidenceRunnerKeySecret = args[++i];
962
+ if (!result.evidenceRunnerKeySecret || result.evidenceRunnerKeySecret.startsWith("-")) throw new Error("--evidence-runner-key-secret needs the secret holding the runner key: --evidence-runner-key-secret <NAME>");
963
+ } else if (arg === "--evidence-identity") {
964
+ // `chant build --pr-loop --evidence-identity oidc` (#4935, #4869): sign keyless from the job's OIDC identity.
965
+ result.evidenceIdentity = args[++i];
966
+ if (result.evidenceIdentity !== "oidc") throw new Error(`--evidence-identity takes oidc, the one identity chant signs keyless with: got "${result.evidenceIdentity ?? ""}"`);
967
+ } else if (arg === "--evidence-audience") {
968
+ // `chant build --pr-loop --evidence-identity oidc --evidence-audience <aud>` (#4935, #4869).
969
+ result.evidenceAudience = args[++i];
970
+ if (!result.evidenceAudience || result.evidenceAudience.startsWith("-")) throw new Error("--evidence-audience needs the OIDC token's audience: --evidence-audience <aud>");
971
+ } else if (arg === "--record-run") {
972
+ // `chant components pr-post --record-run <plan job>` (#4899): keep the product plan job's run record on chant/lifecycle.
973
+ result.recordRun = args[++i];
974
+ if (!result.recordRun || !/^[A-Za-z0-9][A-Za-z0-9_.-]*$/.test(result.recordRun)) throw new Error(`--record-run needs the plan job's name: got "${result.recordRun ?? ""}"`);
975
+ } else if (arg === "--not-affected") {
976
+ // `chant components pr-post --not-affected <argument>` (#4963): the re-plan's argument, which may be empty; pr-post checks it.
977
+ if (i + 1 >= args.length) throw new Error('--not-affected needs the re-plan\'s argument, empty for none: --not-affected "$CHANT_PLAN_ARGUMENT"');
978
+ result.notAffected = args[++i];
979
+ } else if (arg === "--evidence-dir") {
980
+ // `chant components pr-post --open --evidence-dir <dir>` (#4914): each merge request's evidence.json, from the GitLab signing job.
981
+ result.evidenceDir = args[++i];
982
+ if (!result.evidenceDir || result.evidenceDir.startsWith("-")) throw new Error("--evidence-dir needs the directory the signing job kept: --evidence-dir .chant/evidence/plan");
983
+ } else if (arg === "--summary") {
984
+ // `chant ci check --summary <file>` (#4914): the check report's markdown section, appended to the file.
985
+ result.checkSummary = args[++i];
986
+ if (!result.checkSummary || result.checkSummary.startsWith("-")) throw new Error("--summary needs a file to append the check report's section to: --summary <file>");
929
987
  } else if (arg === "--locks") {
930
988
  // `chant components pr-notes --locks` (#4785).
931
989
  result.locks = true;
@@ -334,6 +334,10 @@ export interface ParsedArgs {
334
334
  wave?: number;
335
335
  /** `chant run wave --decide` (#3679) — plan a wide wave and decide its gate, applying nothing. */
336
336
  decide?: boolean;
337
+ /** `chant run wave --policy-only` (#4926) — plan the wave and run its policy hold, applying nothing: the wave job's policy step. */
338
+ policyOnly?: boolean;
339
+ /** `chant run wave --render-spec` (#4982) — run the command `CHANT_WAVES_SPEC_COMMAND` names to print the spec at base, and run the wave on it. */
340
+ renderSpec?: boolean;
337
341
  /** `chant run wave --record-plans` (#3684) — plan every wave at a pull request's head and record the digests for a `pr-review` gate. */
338
342
  recordPlans?: boolean;
339
343
  /** `chant run wave --approval-status` (#4630) — post `<product>/approval` on an open pull request's head under `pr-review` or `pull-request`. */
@@ -375,6 +379,10 @@ export interface ParsedArgs {
375
379
  lockStage?: string;
376
380
  /** `chant lock --from-report <file>` (#4293): lock the components a `pr-plan.json` lists. */
377
381
  fromReport?: string;
382
+ /** `chant ci evidence sign --from-job <job>` (#4926): sign the checks whose steps in that job of this run passed. */
383
+ fromJob?: string;
384
+ /** `chant ci evidence sign --from-job <job> --claims <dir>` (#4926): the directory of the checks' claim files. */
385
+ claims?: string;
378
386
  /** `chant lock --alive <run>` (#4552): print `alive` or `dead` for a run that holds rows or the repo lock tag. */
379
387
  aliveRun?: string;
380
388
  /** `chant lock --beat <run>` (#4660): the heartbeat side process of the rows a run holds. Not for people. */
@@ -589,6 +597,26 @@ export interface ParsedArgs {
589
597
  staleNotes?: boolean;
590
598
  /** `chant build --pr-loop --note-commands` (#4785): on GitLab, the scheduled job that answers the product's comment commands by polling merge request notes. */
591
599
  noteCommands?: boolean;
600
+ /** `chant build --pr-loop --check-job` (#4935): the check job, `chant ci check` on the pull request's commit. */
601
+ checkJob?: boolean;
602
+ /** `chant build --pr-loop --ref-gate-status` (#4935): the job that runs `chant workspace ref-gate status` for the pull request's commit. `chant ci forge-check --ref-gate-status` (#4913): the default branch requires its status. */
603
+ refGateStatus?: boolean;
604
+ /** `chant build --pr-loop --evidence-runner-key-secret <NAME>` (#4935): the secret holding the runner key the note job signs `plan` and `policy` with. */
605
+ evidenceRunnerKeySecret?: string;
606
+ /** `chant build --pr-loop --evidence-identity oidc` (#4935, #4869): sign keyless from the job's OIDC identity. */
607
+ evidenceIdentity?: string;
608
+ /** `chant build --pr-loop --evidence-audience <aud>` (#4935, #4869): the keyless signing token's audience. */
609
+ evidenceAudience?: string;
610
+ /** `chant components pr-post --record-run <plan job>` (#4899): keep the product plan job's run record on chant/lifecycle. */
611
+ recordRun?: string;
612
+ /** `chant components pr-post --not-affected <argument>` (#4963): the argument a re-plan was narrowed to, which gets a "not affected" reply when the change reaches nothing. */
613
+ notAffected?: string;
614
+ /** `chant components pr-post --open --evidence-dir <dir>` (#4914): where the GitLab signing job kept each merge request's `evidence.json`, for the note's checks line. */
615
+ evidenceDir?: string;
616
+ /** `chant ci evidence sign --open --no-forks` (#4914): sign for no merge request from a fork. */
617
+ noForks?: boolean;
618
+ /** `chant ci check --summary <file>` (#4914): append the check report's markdown section to the file. */
619
+ checkSummary?: string;
592
620
  /** `chant components pr-notes --locks` (#4785): the pipeline has the lock and unlock jobs, so a lock or unlock note starts them. */
593
621
  locks?: boolean;
594
622
  /** `chant components pr-post --stale` (#4628): mark the open pull requests' notes stale after the target branch moved. */
@@ -890,6 +918,13 @@ export interface ParsedArgs {
890
918
  * until it closes or `chant unlock`. What `/<product> lock` runs.
891
919
  */
892
920
  keepLocks?: boolean;
921
+ /**
922
+ * `chant lock --reach` (#4979): lock the targets the reach line in
923
+ * `CHANT_LOCK_REACH` prints for the change from `--base` to `--head`,
924
+ * after fetching the pull request's head; with `--open`, every open merge
925
+ * request's (GitLab's plan notes pipeline).
926
+ */
927
+ lockReach?: boolean;
893
928
  /** `chant components plan-wave|apply-wave --runs <file>` (#4588): the runs file `chant run wave` writes, `{runs}`. */
894
929
  runsFile?: string;
895
930
  /** `chant components plan-wave|apply-wave --plans <file>` (#4588): the wave's plans file, `{plans}`. */
@@ -30,6 +30,7 @@ import { appendReleaseRecord, InvalidReleaseRecordError, type ReleaseAdmission,
30
30
  import { changeSetDigest } from "../change-set";
31
31
  import type { DriverComponent, DriverStepRecord } from "./driver";
32
32
  import { componentInputDigests } from "./fan-out-inputs";
33
+ import { actorFromEnv } from "../actor";
33
34
 
34
35
  /**
35
36
  * A step output that represents a *promoted* artifact — a publish-family result
@@ -165,7 +166,7 @@ export interface AutoReleaseOptions {
165
166
  }
166
167
 
167
168
  function resolveActor(override?: string): string | undefined {
168
- return override ?? process.env.GITHUB_ACTOR ?? process.env.GITLAB_USER_LOGIN ?? process.env.USER;
169
+ return override ?? (actorFromEnv(process.env, "") || undefined);
169
170
  }
170
171
 
171
172
  /**
@@ -35,6 +35,7 @@ import { CHECK_EVIDENCE_KEY_ENV, LOCAL_EVIDENCE_KEY_ENV, SIGNING_ID_TOKEN_VAR }
35
35
  import { acceptedLocalEvidence, acceptsLocalEvidence, fetchLocalEvidence } from "../workspace/trust/local-evidence";
36
36
 
37
37
  export { CI_CHECK_HOOK_FLOOR } from "../op/op-waves";
38
+ export { CHECK_SUMMARY_FLOOR } from "../release-floors";
38
39
 
39
40
  /** The check hooks a job runs, and where they were read. */
40
41
  export interface CheckHooksRead {
@@ -161,6 +162,27 @@ export function passedCheckHooks(outcomes: readonly CheckHookOutcome[]): Array<{
161
162
  return [...byName].filter(([, runs]) => runs.every((r) => r.outcome === "passed")).map(([check, runs]) => ({ check, runs }));
162
163
  }
163
164
 
165
+ /**
166
+ * The check report's markdown section (#4914): a heading naming the base
167
+ * the hooks were read at, a line per hook run and per lexicon check step,
168
+ * the failure, and the checks whose evidence was signed. A product's check
169
+ * step keeps it in its own report or job summary (`chant ci check
170
+ * --summary <file>`) instead of rendering `check-hooks.json` itself. Empty
171
+ * when no hook is declared and no step ran.
172
+ */
173
+ export function checkReportSummary(report: Pick<CheckHooksReport, "status" | "base" | "hooks" | "steps" | "failed" | "evidence">): string[] {
174
+ if (report.status === "none") return [];
175
+ const at = report.base === "HEAD" ? "" : ` (read at ${/^[0-9a-f]{40}$/.test(report.base) ? report.base.slice(0, 12) : report.base})`;
176
+ const hooks = report.hooks.map(
177
+ (h) => `- ${h.outcome}: \`${h.name}\`${h.target ? ` for \`${h.target}\`` : ""}${h.outcome === "failed" ? `, exit ${h.exit}` : ""}${h.reason ? ` (${h.reason})` : ""}`,
178
+ );
179
+ const steps = (report.steps ?? []).map(
180
+ (s) => `- ${s.outcome}: \`${s.lexicon} ${s.step}\` for \`${s.member}\`${s.stack ? ` (stack \`${s.stack}\`)` : ""}${s.outcome === "failed" ? `, exit ${s.exit}` : ""}${s.reason && s.outcome !== "failed" ? ` (${s.reason})` : ""}`,
181
+ );
182
+ const signed = report.evidence ? [`- signed: ${report.evidence.signed.map((c) => `\`${c}\``).join(", ")} as ${report.evidence.runner}`] : [];
183
+ return [`### Check hooks${at}`, "", ...hooks, ...steps, ...(report.failed ? [`- ${report.failed}`] : []), ...signed, ""];
184
+ }
185
+
164
186
  /** Where {@link runCheckHooks} writes its runs file and report unless told: `.chant/check`. */
165
187
  export const CHECK_HOOKS_DIR = ".chant/check";
166
188
 
@@ -0,0 +1,78 @@
1
+ /**
2
+ * #4914: the check report's markdown section, which `chant ci check
3
+ * --summary <file>` appends to a product's own report, so a product's check
4
+ * step runs chant's check stage (hooks, lexicon steps, signing) and renders
5
+ * nothing of its own.
6
+ */
7
+
8
+ import { execFileSync } from "node:child_process";
9
+ import { mkdtempSync, readFileSync, writeFileSync } from "node:fs";
10
+ import { tmpdir } from "node:os";
11
+ import { join } from "node:path";
12
+ import { afterEach, describe, expect, test, vi } from "vitest";
13
+ import { checkReportSummary } from "./check-hooks";
14
+ import { parseArgs } from "../cli/parse-args";
15
+ import type { CommandContext } from "../cli/registry";
16
+
17
+ const BASE = "0123456789abcdef0123456789abcdef01234567";
18
+
19
+ describe("checkReportSummary (#4914)", () => {
20
+ test("names the base, each hook run and step, the failure and the evidence signed", () => {
21
+ const lines = checkReportSummary({
22
+ status: "failed",
23
+ base: BASE,
24
+ hooks: [
25
+ { name: "fmt", exit: 0, outcome: "passed" },
26
+ { name: "tflint", target: "roots/a", exit: 2, outcome: "failed" },
27
+ { name: "checkov", exit: 0, outcome: "skipped", reason: "current local evidence from person alice" },
28
+ ],
29
+ steps: [{ lexicon: "pulumi", step: "pulumi-about", member: "app", stack: "dev", exit: 0, outcome: "passed" }],
30
+ failed: "a check hook failed: tflint",
31
+ evidence: { signed: ["fmt"], runner: "ci", commit: BASE },
32
+ });
33
+ expect(lines).toEqual([
34
+ "### Check hooks (read at 0123456789ab)",
35
+ "",
36
+ "- passed: `fmt`",
37
+ "- failed: `tflint` for `roots/a`, exit 2",
38
+ "- skipped: `checkov` (current local evidence from person alice)",
39
+ "- passed: `pulumi pulumi-about` for `app` (stack `dev`)",
40
+ "- a check hook failed: tflint",
41
+ "- signed: `fmt` as ci",
42
+ "",
43
+ ]);
44
+ });
45
+
46
+ test("nothing when no hook is declared and no step ran", () => {
47
+ expect(checkReportSummary({ status: "none", base: "HEAD", hooks: [] })).toEqual([]);
48
+ });
49
+ });
50
+
51
+ describe("chant ci check --summary (#4914)", () => {
52
+ afterEach(() => vi.restoreAllMocks());
53
+
54
+ test("the flag parses", () => {
55
+ expect(parseArgs(["ci", "check", "--base", "HEAD", "--summary", ".terragucci/check/report.md"])).toMatchObject({ checkSummary: ".terragucci/check/report.md" });
56
+ expect(() => parseArgs(["ci", "check", "--summary"])).toThrow(/--summary needs a file/);
57
+ });
58
+
59
+ test("appends the section to the file after the check hooks ran", async () => {
60
+ const cwd = mkdtempSync(join(tmpdir(), "chant-4914-summary-"));
61
+ const git = (...args: string[]) => execFileSync("git", ["-c", "user.name=t", "-c", "user.email=t@example.invalid", "-c", "init.defaultBranch=main", ...args], { cwd, encoding: "utf-8", stdio: ["ignore", "pipe", "pipe"] }).trim();
62
+ git("init", "--quiet");
63
+ writeFileSync(join(cwd, "chant.workspace.json"), JSON.stringify({ name: "acme", schema: 1, members: [], ci: { hooks: { check: [{ name: "ok", command: ["true"] }] } } }, null, 2) + "\n");
64
+ git("add", ".");
65
+ git("commit", "--quiet", "-m", "base");
66
+ const file = join(cwd, "out", "report.md");
67
+ vi.spyOn(process, "cwd").mockReturnValue(cwd);
68
+ const said: string[] = [];
69
+ vi.spyOn(console, "error").mockImplementation((l: string) => void said.push(String(l)));
70
+ vi.stubEnv("GITHUB_STEP_SUMMARY", "");
71
+ const { runCiCheck } = await import("../cli/handlers/ci-check");
72
+ const code = await runCiCheck({ args: parseArgs(["ci", "check", "--base", "HEAD", "--output", join(cwd, ".chant/check"), "--summary", file]), plugins: [{} as never] } as unknown as CommandContext);
73
+ vi.unstubAllEnvs();
74
+ expect(code, said.join("\n")).toBe(0);
75
+ expect(said.join("\n")).toContain("1 passed");
76
+ expect(readFileSync(file, "utf-8")).toContain("- passed: `ok`");
77
+ });
78
+ });
@@ -0,0 +1,254 @@
1
+ /**
2
+ * The pull request's check job and the ref gate's status job (#4935), for
3
+ * the forge lexicons to render beside the plan jobs: the pull request loop
4
+ * (`chant build --pr-loop --check-job --ref-gate-status`) and the product
5
+ * pipeline (`productPipelineJobs({ checkJob, refGateStatus })`).
6
+ *
7
+ * - The check job runs `chant ci check --base <base>` on the pull request's
8
+ * commit: the `ci.hooks.check` hooks the declaration at base names and the
9
+ * lexicons' check steps. A hook whose current local evidence the policy at
10
+ * base accepts is skipped (#4868). The job runs the change's code, so it
11
+ * follows the plan job's handover (#4295): the checkout script alone sees
12
+ * the forge token, every later step starts without it, and the check is
13
+ * the job's last step, handing `.chant/check` on as the job's outputs.
14
+ * It holds no runner key and no OIDC token for signing either (#4328).
15
+ * - With `evidence` (#4870, #4869) the `check-evidence` job signs each hook
16
+ * that passed, by name, from the check job's report, in a job that checks
17
+ * out the target branch's commit and runs none of the change's code, as
18
+ * the plan note job signs `plan` and `policy` from the plan job's report.
19
+ * It pushes `refs/notes/chant/evidence`. On GitLab it runs in the target
20
+ * branch's plan notes pipeline (#4914), as the plan's `<plan job>-evidence`
21
+ * job does: `ci evidence sign --open` signs every open merge request's
22
+ * settled check job from its artifact, so no job of the merge request's
23
+ * own pipeline holds the key.
24
+ * - The `ref-gate` job runs `chant workspace ref-gate status` (#4867) for
25
+ * the pull request's commit once the plan note and the check evidence are
26
+ * in: it reads the evidence notes, decides the update a merge into the
27
+ * target branch would make under the policy at base, and sets the
28
+ * `chant/ref-gate` status (or the policy's own status name), which a
29
+ * project can then make a required status. GitLab sets a status only with
30
+ * the protected token a target-branch pipeline holds (#4328), so there the
31
+ * job runs in the plan notes pipeline and posts for every open merge
32
+ * request into the branch (`ref-gate status --open`).
33
+ *
34
+ * The commit is the one the plan job checked out and every other status of
35
+ * the loop names: `github.sha` on GitHub and Forgejo, `CI_COMMIT_SHA` in a
36
+ * GitLab merge request pipeline. On a GitHub `pull_request` run that is the
37
+ * merge preview, and the status goes on the pull request's head, where the
38
+ * forge shows and requires it (#4964, ../pr-forge-job.ts).
39
+ *
40
+ * #4964: a workspace member's pipeline takes all three. The check job runs
41
+ * in the member's directory, the product's own service containers,
42
+ * variables, lines and report directory come with `PrCheckJobOptions`, and
43
+ * a product's own workflow renders the jobs through the lexicons'
44
+ * `productCheckJobs`.
45
+ */
46
+
47
+ import type { ForgeKind } from "../pr-forge";
48
+ import { GITHUB_JOB_TOKEN } from "../ci-jobs";
49
+ import { assertPipelineEvidence, evidenceIdTokens, evidenceKeyEnv, evidenceKeyless, gitlabOpenEvidenceDir, openEvidenceLines, planEvidenceLines, type PipelineEvidence } from "../ci-evidence-jobs";
50
+ import { withProductBin } from "./pr-pipeline";
51
+
52
+ /** The check job's name (#4935). */
53
+ export const PR_CHECK_JOB = "check";
54
+
55
+ /** The job that signs the check job's hooks (#4935). */
56
+ export const PR_CHECK_EVIDENCE_JOB = "check-evidence";
57
+
58
+ /** The job that sets the ref gate's status (#4935). */
59
+ export const PR_REF_GATE_JOB = "ref-gate";
60
+
61
+ /** Where `chant ci check` writes its report: `CHECK_HOOKS_DIR` in ./check-hooks.ts, kept here so a generator does not load the check runner. */
62
+ export const PR_CHECK_REPORT_DIR = ".chant/check";
63
+
64
+ /** The artifact the check report is kept as. */
65
+ export const PR_CHECK_ARTIFACT = "chant-pr-check";
66
+
67
+ /**
68
+ * A service container the check job starts beside it (#4964), such as a
69
+ * throwaway database its hooks replay into. The job reaches it by `name`.
70
+ * GitHub and Forgejo hold the job's steps until `health` passes; GitLab
71
+ * does not wait, so a check job there waits in its `before` lines.
72
+ */
73
+ export interface PrCheckService {
74
+ /** The service's host name on the job's network: lower-case letters, digits, `.`, `_` and `-`. */
75
+ name: string;
76
+ image: string;
77
+ /** The service container's environment. */
78
+ env?: Record<string, string>;
79
+ /** A command the forge runs in the service container until it passes (GitHub's and Forgejo's `--health-cmd`). */
80
+ health?: string;
81
+ }
82
+
83
+ /**
84
+ * The check job's own settings (#4964), as a product passes them in
85
+ * `checkJob: { ... }`. `true` is all of them left out.
86
+ */
87
+ export interface PrCheckJobOptions {
88
+ /** Service containers beside the job. */
89
+ services?: PrCheckService[];
90
+ /** Variables of the check step, such as a service's URL. No forge token, runner key or `BASE_SHA`. */
91
+ env?: Record<string, string>;
92
+ /** Lines the check step runs before `chant ci check`, after the tokens are dropped, such as a wait for a service. */
93
+ before?: string[];
94
+ /** The report directory, repository-relative from the job's directory: `chant ci check --output <dir>`. Default `.chant/check`. */
95
+ dir?: string;
96
+ /** Arguments after `--base` (and `--output`), each one word, quoted where the shell needs it: `--summary <file>` and the targets a `perRun` hook runs for. */
97
+ args?: string[];
98
+ }
99
+
100
+ /** One shell word: as it is when it needs no quoting, else in single quotes. */
101
+ function shellWord(word: string): string {
102
+ return /^[A-Za-z0-9._\/=:@+,-]+$/.test(word) ? word : `'${word.replace(/'/g, `'\\''`)}'`;
103
+ }
104
+
105
+ /** The check job (#4935): its command and the values it reads. */
106
+ export interface PrCheckJob {
107
+ jobName: string;
108
+ /** `chant ci check --base "$BASE_SHA"`, through the words' bin, with `--output <dir>` for a directory of the product's own. */
109
+ command: string;
110
+ /** `BASE_SHA`, as the forge spells it, and the product's own variables (#4964). */
111
+ env: Record<string, string>;
112
+ /** The report directory it writes and hands on. */
113
+ dir: string;
114
+ /** The service containers beside it (#4964). */
115
+ services?: PrCheckService[];
116
+ /** The lines before the command (#4964). */
117
+ before?: string[];
118
+ /**
119
+ * With `evidence`: the signing job's lines and variables. GitHub and
120
+ * Forgejo run them in `check-evidence` after taking the report back;
121
+ * GitLab in `check-evidence` in the target branch's plan notes pipeline
122
+ * (#4914), for every open merge request's check job, keeping `dir`.
123
+ * Signing keyless, the job asks for an OIDC token: `idToken` (GitHub's
124
+ * `id-token: write`, Forgejo's `enable-openid-connect`) or GitLab's
125
+ * `idTokens`.
126
+ */
127
+ evidence?: { jobName: string; lines: string[]; env: Record<string, string>; dir?: string; idToken?: true; idTokens?: Record<string, { aud: string }> };
128
+ }
129
+
130
+ /** The variables a check job's own `env` may not set: the ones the job and its handover read, and the credentials it drops. */
131
+ const CHECK_RESERVED_ENV = /^(BASE_SHA|HEAD_SHA|CHECK_RESULT|CHANT_RUNNER_KEY|CHANT_RUNNER_IDENTITY|CHANT_LOCAL_EVIDENCE_KEY|CHANT_CHECKOUT_TOKEN|GITHUB_TOKEN|GH_TOKEN|FORGEJO_TOKEN|GITLAB_TOKEN|CI_JOB_TOKEN|CHANT_FORGE_TOKEN|ACTIONS_ID_TOKEN_REQUEST_(URL|TOKEN))$/;
132
+
133
+ /** Refuse check job settings no job could hold (#4964). */
134
+ function assertCheckJobOptions(opts: PrCheckJobOptions): void {
135
+ if (opts.dir !== undefined && (!/^[A-Za-z0-9._][A-Za-z0-9._\/-]*$/.test(opts.dir) || opts.dir.split("/").includes(".."))) {
136
+ throw new Error(`the check job's report directory ${JSON.stringify(opts.dir)} is not a relative path inside the checkout`);
137
+ }
138
+ for (const a of opts.args ?? []) {
139
+ if (a === "" || /[\0\n]/.test(a) || a === "--base" || a === "--output" || a === "-o") throw new Error(`the check job's argument ${JSON.stringify(a)} is not one it takes: --base and --output are its own`);
140
+ }
141
+ const names = new Set<string>();
142
+ for (const s of opts.services ?? []) {
143
+ if (!/^[a-z0-9][a-z0-9._-]*$/.test(s.name)) throw new Error(`the check job's service name ${JSON.stringify(s.name)} is not a host name: lower-case letters, digits, . _ -`);
144
+ if (names.has(s.name)) throw new Error(`the check job names service ${s.name} twice`);
145
+ names.add(s.name);
146
+ if (!s.image.trim() || /\s/.test(s.image)) throw new Error(`the check job's service ${s.name} needs an image reference`);
147
+ }
148
+ for (const name of Object.keys(opts.env ?? {})) {
149
+ if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(name)) throw new Error(`the check job's variable ${JSON.stringify(name)} is not a variable name`);
150
+ if (CHECK_RESERVED_ENV.test(name)) throw new Error(`the check job sets ${name} itself, or drops it before the hooks run, so checkJob.env cannot name it`);
151
+ }
152
+ }
153
+
154
+ /**
155
+ * The check job for `forge` (#4935), with the check evidence job when
156
+ * `evidence` names a runner identity. #4964: the product's services,
157
+ * variables, lines and report directory (`PrCheckJobOptions`), and for a
158
+ * workspace member's GitLab file (`member`) the jobs named
159
+ * `<member>-check` and `<member>-check-evidence`, with the report read from
160
+ * the artifact at the member's `reportPath`, as GitLab includes every
161
+ * member's file in one pipeline. On GitHub and Forgejo a member's workflow
162
+ * is a file of its own, and the jobs keep their names.
163
+ */
164
+ export function prCheckJob(forge: ForgeKind, opts: { bin?: string; evidence?: PipelineEvidence; noForks?: boolean; member?: { name: string; reportPath: string } } & PrCheckJobOptions = {}): PrCheckJob {
165
+ assertPipelineEvidence(opts.evidence);
166
+ assertCheckJobOptions(opts);
167
+ const gitlab = forge === "gitlab";
168
+ const base = gitlab ? "$CI_MERGE_REQUEST_DIFF_BASE_SHA" : "${{ github.event.pull_request.base.sha }}";
169
+ const dir = opts.dir ?? PR_CHECK_REPORT_DIR;
170
+ const named = (job: string) => (gitlab && opts.member ? `${opts.member.name}-${job}` : job);
171
+ const job: PrCheckJob = {
172
+ jobName: named(PR_CHECK_JOB),
173
+ command: withProductBin(`chant ci check --base "$BASE_SHA"${dir === PR_CHECK_REPORT_DIR ? "" : ` --output ${dir}`}${(opts.args ?? []).map((a) => ` ${shellWord(a)}`).join("")}`, opts.bin),
174
+ env: { BASE_SHA: base, ...opts.env },
175
+ dir,
176
+ ...(opts.services?.length ? { services: opts.services } : {}),
177
+ ...(opts.before?.length ? { before: opts.before } : {}),
178
+ };
179
+ const evidence = opts.evidence;
180
+ if (!evidence) return job;
181
+ const key = evidenceKeyEnv(forge, evidence);
182
+ const bin = opts.bin ? { bin: opts.bin } : {};
183
+ if (gitlab) {
184
+ // #4914: the job runs in the target branch's plan notes pipeline and signs every open merge request's
185
+ // settled check job from its artifact; no job of a merge request pipeline holds the key.
186
+ const out = gitlabOpenEvidenceDir(job.jobName);
187
+ return {
188
+ ...job,
189
+ evidence: {
190
+ jobName: named(PR_CHECK_EVIDENCE_JOB),
191
+ // A fork's check job runs too, as it holds nothing; with noForks (a product plan's forks: "skip") its hooks are not signed for.
192
+ lines: openEvidenceLines({ job: job.jobName, dir: opts.member?.reportPath ?? dir, out, ...bin, ...(opts.noForks ? { noForks: true } : {}) }),
193
+ env: key,
194
+ dir: out,
195
+ ...(evidenceKeyless(evidence) ? { idTokens: evidenceIdTokens(evidence) } : {}),
196
+ },
197
+ };
198
+ }
199
+ return {
200
+ ...job,
201
+ evidence: {
202
+ jobName: PR_CHECK_EVIDENCE_JOB,
203
+ lines: planEvidenceLines({ dir, at: '"$HEAD_SHA"', base: '"$BASE_SHA"', result: '"$CHECK_RESULT"', ...bin }),
204
+ env: { HEAD_SHA: "${{ github.sha }}", BASE_SHA: base, CHECK_RESULT: `\${{ needs.${PR_CHECK_JOB}.result }}`, ...key },
205
+ ...(evidenceKeyless(evidence) ? { idToken: true as const } : {}),
206
+ },
207
+ };
208
+ }
209
+
210
+ /** The ref gate's status job (#4935): its lines and the values they read. */
211
+ export interface PrRefGateJob {
212
+ jobName: string;
213
+ /** The fetches of the pull request's commit and the evidence notes, before the command. */
214
+ setup: string[];
215
+ /** `chant workspace ref-gate status`, through the words' bin. */
216
+ command: string;
217
+ /** The values the lines read, as the forge spells them, the token included on GitHub and Forgejo. */
218
+ env: Record<string, string>;
219
+ }
220
+
221
+ /**
222
+ * The ref gate's status job for `forge` (#4935). `branch` is the target
223
+ * branch on GitHub and Forgejo (default `main`); GitLab's job runs in a
224
+ * pipeline of the target branch and names it from `CI_COMMIT_BRANCH`.
225
+ *
226
+ * #4964: in a workspace member's GitLab file (`member`) the job is
227
+ * `<member>-ref-gate`. Each member's pipeline decides the whole update
228
+ * against the one rule and sets the one status, so the last job to run
229
+ * after the evidence it needs is in sets success; one that ran before
230
+ * another member's evidence was in set failure, and a re-run settles it.
231
+ * None sets success while a required check lacks evidence.
232
+ */
233
+ export function prRefGateJob(forge: ForgeKind, opts: { bin?: string; branch?: string; member?: string } = {}): PrRefGateJob {
234
+ const notes = "'+refs/notes/chant/evidence:refs/notes/chant/evidence'";
235
+ if (forge === "gitlab") {
236
+ return {
237
+ jobName: opts.member ? `${opts.member}-${PR_REF_GATE_JOB}` : PR_REF_GATE_JOB,
238
+ // The heads are fetched by the command, one merge request at a time.
239
+ setup: [`git fetch --quiet --no-tags origin ${notes} || true`],
240
+ command: withProductBin('chant workspace ref-gate status --open --ref "refs/heads/$CI_COMMIT_BRANCH" --base "$CI_COMMIT_SHA"', opts.bin),
241
+ env: {},
242
+ };
243
+ }
244
+ const branch = opts.branch ?? "main";
245
+ if (!/^[A-Za-z0-9._\/-]+$/.test(branch)) throw new Error(`the ref gate's branch ${JSON.stringify(branch)} is not a branch name`);
246
+ return {
247
+ jobName: PR_REF_GATE_JOB,
248
+ setup: [`git fetch --quiet --no-tags origin "$HEAD_SHA" ${notes} || git fetch --quiet --no-tags origin "$HEAD_SHA" || true`],
249
+ command: withProductBin(`chant workspace ref-gate status --ref refs/heads/${branch} --at "$HEAD_SHA" --base "$BASE_SHA"`, opts.bin),
250
+ env: { HEAD_SHA: "${{ github.sha }}", BASE_SHA: "${{ github.event.pull_request.base.sha }}", GITHUB_TOKEN: GITHUB_JOB_TOKEN },
251
+ };
252
+ }
253
+
254
+ export { CHECK_JOB_FLOOR, GITLAB_OPEN_EVIDENCE_FLOOR, MEMBER_SIGNED_CHECKS_FLOOR, PR_LOOP_EVIDENCE_FLOOR, PRODUCT_CHECK_JOBS_FLOOR, REF_GATE_STATUS_JOB_FLOOR } from "../release-floors";
@@ -101,6 +101,8 @@ import { commandWord, commentLine, PRODUCT_ACTION_ENV, PRODUCT_ACTION_EVENT_FLAG
101
101
  import { CHANT_EXIT } from "../exit-codes";
102
102
  import type { ControlTarget } from "../control/dispatch";
103
103
  import { CI_RESPOND_ENV, respondList, type CiResponses } from "../ci-respond";
104
+ import type { PipelineEvidence } from "../ci-evidence-jobs";
105
+ import type { PrCheckJobOptions } from "./pr-checks";
104
106
 
105
107
  /** The variable `chant ci run` reads its runner key from (`RUNNER_KEY_ENV` in ../workspace/ci-green.ts). */
106
108
  const RUNNER_KEY_ENV = "CHANT_RUNNER_KEY";
@@ -391,6 +393,45 @@ export interface PrLoopPipelineOptions {
391
393
  * to `pr-post`. Needed with `respond.description: "check"`.
392
394
  */
393
395
  decide?: { backend: string; model: string };
396
+ /**
397
+ * The pipeline's runner identity (#4935, as #4870's `PipelineEvidence`):
398
+ * the plan-note job signs the plan job's `plan` and `policy` checks from
399
+ * its report before it posts, with the runner key from the named secret or
400
+ * (#4869) keyless from the job's OIDC identity. On GitLab a
401
+ * `<plan job>-evidence` job after the plan job signs from its artifact.
402
+ * With `checkJob`, the `check-evidence` job signs each passed hook. Set
403
+ * from `--evidence-runner-key-secret`, or `--evidence-identity oidc` with
404
+ * an optional `--evidence-audience`. Absent: nothing is signed, and every
405
+ * job is as before. #4964: a workspace member's pipeline plans that member
406
+ * alone, so it signs `plan:<member>` and `policy:<member>`
407
+ * (`memberEvidenceCheck`), which the `refs` rule names for each member.
408
+ */
409
+ evidence?: PipelineEvidence;
410
+ /**
411
+ * The check job (#4935, ./pr-checks.ts): `chant ci check --base <base>` on
412
+ * the pull request's commit, with no forge token, runner key or OIDC token
413
+ * while the hooks run. Set from `--check-job`. #4964: an object gives the
414
+ * job service containers, variables, lines before the check and its own
415
+ * report directory (`PrCheckJobOptions`). In a workspace member's pipeline
416
+ * it runs in the member's directory: the top level's hooks and the
417
+ * member's, each signed by its own name, the same for every member that
418
+ * runs it.
419
+ */
420
+ checkJob?: boolean | PrCheckJobOptions;
421
+ /**
422
+ * The ref gate's status job (#4935, ./pr-checks.ts): `chant workspace
423
+ * ref-gate status` for the pull request's commit, after the note and the
424
+ * check evidence, so `chant/ref-gate` can be a required status. Set from
425
+ * `--ref-gate-status`. #4964: in a member's pipeline it decides the whole
426
+ * update against the one rule, as the root's does, and sets the one
427
+ * status (`prRefGateJob`).
428
+ */
429
+ refGateStatus?: boolean;
430
+ }
431
+
432
+ /** The check job's own settings from `checkJob` (#4964): undefined when there is no check job, `{}` for `true`. */
433
+ export function checkJobOptions(checkJob: boolean | PrCheckJobOptions | undefined): PrCheckJobOptions | undefined {
434
+ return checkJob === true ? {} : checkJob ? checkJob : undefined;
394
435
  }
395
436
 
396
437
  /** The `CHANT_RESPOND` value of `respond` (#4629), or undefined when every event is at its default. Throws on a description check with no decide service. */
@@ -427,7 +468,8 @@ export function prLoopRunner(options: Pick<PrLoopPipelineOptions, "runners">, st
427
468
  */
428
469
  export function prLoopJobStage(name: string, member?: string): PrLoopRunnerStage {
429
470
  const bare = member && name.startsWith(`${member}-`) ? name.slice(member.length + 1) : name;
430
- if (bare === "plan" || bare === PR_COMMENT_PREVIEW_JOB) return "plan";
471
+ // #4935: the check job runs the change's code, as the plan does.
472
+ if (bare === "plan" || bare === PR_COMMENT_PREVIEW_JOB || bare === "check") return "plan";
431
473
  if (bare === "apply" || bare === "record" || bare === PR_ACTION_JOB || /^apply-wave-\d+$/.test(bare) || bare === "env-up" || bare === "env-down" || bare === "env-sweep") return "apply";
432
474
  return "default";
433
475
  }