@intentius/chant 0.124.86 → 0.124.88

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 (384) 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 +12 -0
  5. package/dist/actor.d.ts.map +1 -0
  6. package/dist/actor.js +18 -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 +204 -2
  13. package/dist/ci-commit.d.ts.map +1 -1
  14. package/dist/ci-commit.js +1 -2
  15. package/dist/ci-control.d.ts +1 -1
  16. package/dist/ci-control.d.ts.map +1 -1
  17. package/dist/ci-control.js +1 -1
  18. package/dist/ci-evidence-claims.d.ts +59 -0
  19. package/dist/ci-evidence-claims.d.ts.map +1 -0
  20. package/dist/ci-evidence-claims.js +87 -0
  21. package/dist/ci-evidence-from-job.d.ts +103 -0
  22. package/dist/ci-evidence-from-job.d.ts.map +1 -0
  23. package/dist/ci-evidence-from-job.js +162 -0
  24. package/dist/ci-evidence-jobs.d.ts +69 -10
  25. package/dist/ci-evidence-jobs.d.ts.map +1 -1
  26. package/dist/ci-evidence-jobs.js +72 -8
  27. package/dist/ci-handover.d.ts +12 -0
  28. package/dist/ci-handover.d.ts.map +1 -1
  29. package/dist/ci-handover.js +15 -3
  30. package/dist/ci-identity.d.ts +32 -6
  31. package/dist/ci-identity.d.ts.map +1 -1
  32. package/dist/ci-identity.js +40 -8
  33. package/dist/ci-image.d.ts +47 -9
  34. package/dist/ci-image.d.ts.map +1 -1
  35. package/dist/ci-image.js +45 -18
  36. package/dist/ci-jobs.d.ts +1 -1
  37. package/dist/ci-jobs.d.ts.map +1 -1
  38. package/dist/ci-jobs.js +7 -2
  39. package/dist/ci-login.d.ts +75 -13
  40. package/dist/ci-login.d.ts.map +1 -1
  41. package/dist/ci-login.js +89 -37
  42. package/dist/ci-product-words.d.ts +20 -1
  43. package/dist/ci-product-words.d.ts.map +1 -1
  44. package/dist/ci-product-words.js +27 -1
  45. package/dist/ci-product.d.ts +20 -1
  46. package/dist/ci-product.d.ts.map +1 -1
  47. package/dist/ci-product.js +21 -2
  48. package/dist/cli/handlers/approve-confirm.d.ts +14 -0
  49. package/dist/cli/handlers/approve-confirm.d.ts.map +1 -1
  50. package/dist/cli/handlers/approve-confirm.js +46 -0
  51. package/dist/cli/handlers/build.d.ts +1 -1
  52. package/dist/cli/handlers/build.d.ts.map +1 -1
  53. package/dist/cli/handlers/build.js +22 -1
  54. package/dist/cli/handlers/ci-check.d.ts.map +1 -1
  55. package/dist/cli/handlers/ci-check.js +38 -14
  56. package/dist/cli/handlers/ci-evidence.d.ts.map +1 -1
  57. package/dist/cli/handlers/ci-evidence.js +238 -26
  58. package/dist/cli/handlers/ci-forge-check.d.ts.map +1 -1
  59. package/dist/cli/handlers/ci-forge-check.js +34 -17
  60. package/dist/cli/handlers/generated-check.d.ts +3 -0
  61. package/dist/cli/handlers/generated-check.d.ts.map +1 -0
  62. package/dist/cli/handlers/generated-check.js +41 -0
  63. package/dist/cli/handlers/lifecycle.d.ts.map +1 -1
  64. package/dist/cli/handlers/lifecycle.js +3 -0
  65. package/dist/cli/handlers/local-chant.d.ts +13 -0
  66. package/dist/cli/handlers/local-chant.d.ts.map +1 -1
  67. package/dist/cli/handlers/local-chant.js +42 -1
  68. package/dist/cli/handlers/pr.d.ts.map +1 -1
  69. package/dist/cli/handlers/pr.js +42 -5
  70. package/dist/cli/handlers/run-wave.js +8 -0
  71. package/dist/cli/main.d.ts.map +1 -1
  72. package/dist/cli/main.js +38 -4
  73. package/dist/cli/parse-args.d.ts.map +1 -1
  74. package/dist/cli/parse-args.js +66 -0
  75. package/dist/cli/registry.d.ts +24 -0
  76. package/dist/cli/registry.d.ts.map +1 -1
  77. package/dist/components/check-hooks.d.ts +10 -0
  78. package/dist/components/check-hooks.d.ts.map +1 -1
  79. package/dist/components/check-hooks.js +21 -3
  80. package/dist/components/check-steps.js +1 -1
  81. package/dist/components/pr-checks.d.ts +105 -0
  82. package/dist/components/pr-checks.d.ts.map +1 -0
  83. package/dist/components/pr-checks.js +119 -0
  84. package/dist/components/pr-pipeline.d.ts +34 -0
  85. package/dist/components/pr-pipeline.d.ts.map +1 -1
  86. package/dist/components/pr-pipeline.js +14 -1
  87. package/dist/components/product-pipeline.d.ts +16 -1
  88. package/dist/components/product-pipeline.d.ts.map +1 -1
  89. package/dist/components/product-pipeline.js +17 -2
  90. package/dist/components/product-plan.d.ts +262 -3
  91. package/dist/components/product-plan.d.ts.map +1 -1
  92. package/dist/components/product-plan.js +243 -11
  93. package/dist/config.d.ts +10 -6
  94. package/dist/config.d.ts.map +1 -1
  95. package/dist/config.js +11 -6
  96. package/dist/control/consumers.d.ts +6 -0
  97. package/dist/control/consumers.d.ts.map +1 -1
  98. package/dist/control/consumers.js +6 -0
  99. package/dist/dead-guards.d.ts.map +1 -1
  100. package/dist/dead-guards.js +9 -6
  101. package/dist/discovery/files.d.ts +1 -1
  102. package/dist/discovery/files.js +1 -1
  103. package/dist/drift-issue.d.ts +20 -3
  104. package/dist/drift-issue.d.ts.map +1 -1
  105. package/dist/drift-issue.js +16 -0
  106. package/dist/drift-record.d.ts +45 -5
  107. package/dist/drift-record.d.ts.map +1 -1
  108. package/dist/drift-record.js +27 -6
  109. package/dist/floor-table.d.ts +6 -6
  110. package/dist/floor-table.d.ts.map +1 -1
  111. package/dist/floor-table.data.d.ts.map +1 -1
  112. package/dist/floor-table.data.js +58 -20
  113. package/dist/floor-table.js +10 -7
  114. package/dist/forge-check/contract.d.ts +8 -0
  115. package/dist/forge-check/contract.d.ts.map +1 -1
  116. package/dist/forge-check/contract.js +4 -1
  117. package/dist/forge-check/index.d.ts +2 -0
  118. package/dist/forge-check/index.d.ts.map +1 -1
  119. package/dist/forge-check/index.js +2 -0
  120. package/dist/forge-flags.d.ts +10 -0
  121. package/dist/forge-flags.d.ts.map +1 -1
  122. package/dist/forge-flags.js +31 -0
  123. package/dist/forge-remote.d.ts +47 -0
  124. package/dist/forge-remote.d.ts.map +1 -0
  125. package/dist/forge-remote.js +69 -0
  126. package/dist/generated-check.d.ts +74 -0
  127. package/dist/generated-check.d.ts.map +1 -0
  128. package/dist/generated-check.js +216 -0
  129. package/dist/lexicon.d.ts +16 -0
  130. package/dist/lexicon.d.ts.map +1 -1
  131. package/dist/lifecycle/publish-npm.d.ts +15 -0
  132. package/dist/lifecycle/publish-npm.d.ts.map +1 -1
  133. package/dist/lifecycle/publish-npm.js +49 -3
  134. package/dist/lifecycle/release-images.d.ts +22 -1
  135. package/dist/lifecycle/release-images.d.ts.map +1 -1
  136. package/dist/lifecycle/release-images.js +27 -3
  137. package/dist/lifecycle/release-ledger.d.ts +4 -3
  138. package/dist/lifecycle/release-ledger.d.ts.map +1 -1
  139. package/dist/lifecycle/release-ledger.js +3 -2
  140. package/dist/local-chant.d.ts +57 -3
  141. package/dist/local-chant.d.ts.map +1 -1
  142. package/dist/local-chant.js +122 -13
  143. package/dist/op/op-waves-evidence-jobs.d.ts +92 -0
  144. package/dist/op/op-waves-evidence-jobs.d.ts.map +1 -0
  145. package/dist/op/op-waves-evidence-jobs.js +112 -0
  146. package/dist/op/op-waves-evidence.d.ts +17 -4
  147. package/dist/op/op-waves-evidence.d.ts.map +1 -1
  148. package/dist/op/op-waves-evidence.js +32 -10
  149. package/dist/op/op-waves-run.d.ts +12 -1
  150. package/dist/op/op-waves-run.d.ts.map +1 -1
  151. package/dist/op/op-waves-run.js +54 -3
  152. package/dist/op/op-waves.d.ts +8 -0
  153. package/dist/op/op-waves.d.ts.map +1 -1
  154. package/dist/op/op-waves.js +10 -0
  155. package/dist/op/schedule-overdue.d.ts +39 -2
  156. package/dist/op/schedule-overdue.d.ts.map +1 -1
  157. package/dist/op/schedule-overdue.js +89 -7
  158. package/dist/pr-forge-reads.d.ts +21 -1
  159. package/dist/pr-forge-reads.d.ts.map +1 -1
  160. package/dist/pr-forge-reads.js +19 -1
  161. package/dist/pr-forge.d.ts +7 -1
  162. package/dist/pr-forge.d.ts.map +1 -1
  163. package/dist/pr-forge.js +7 -2
  164. package/dist/pr-plan-note.d.ts +24 -0
  165. package/dist/pr-plan-note.d.ts.map +1 -1
  166. package/dist/pr-plan-note.js +11 -1
  167. package/dist/pr-plan-record.d.ts +47 -0
  168. package/dist/pr-plan-record.d.ts.map +1 -0
  169. package/dist/pr-plan-record.js +89 -0
  170. package/dist/pr-post.d.ts +40 -0
  171. package/dist/pr-post.d.ts.map +1 -1
  172. package/dist/pr-post.js +79 -6
  173. package/dist/pr-requires.d.ts +8 -0
  174. package/dist/pr-requires.d.ts.map +1 -1
  175. package/dist/pr-requires.js +3 -1
  176. package/dist/ref-gate-init.d.ts +76 -0
  177. package/dist/ref-gate-init.d.ts.map +1 -0
  178. package/dist/ref-gate-init.js +144 -0
  179. package/dist/ref-gate-rules.d.ts +19 -0
  180. package/dist/ref-gate-rules.d.ts.map +1 -0
  181. package/dist/ref-gate-rules.js +17 -0
  182. package/dist/release-floors.d.ts +51 -1
  183. package/dist/release-floors.d.ts.map +1 -1
  184. package/dist/release-floors.js +66 -16
  185. package/dist/state-migration.d.ts +23 -0
  186. package/dist/state-migration.d.ts.map +1 -1
  187. package/dist/state-migration.js +39 -3
  188. package/dist/state-unlock.d.ts +32 -1
  189. package/dist/state-unlock.d.ts.map +1 -1
  190. package/dist/state-unlock.js +31 -0
  191. package/dist/wave-runtime.mjs +310 -303
  192. package/dist/workspace/ci-green-cli.d.ts.map +1 -1
  193. package/dist/workspace/ci-green-cli.js +13 -7
  194. package/dist/workspace/ci-green.d.ts.map +1 -1
  195. package/dist/workspace/ci-green.js +4 -3
  196. package/dist/workspace/drift-cli.d.ts +1 -1
  197. package/dist/workspace/drift-cli.d.ts.map +1 -1
  198. package/dist/workspace/drift-cli.js +5 -12
  199. package/dist/workspace/forge-work.d.ts +3 -2
  200. package/dist/workspace/forge-work.d.ts.map +1 -1
  201. package/dist/workspace/forge-work.js +7 -17
  202. package/dist/workspace/lexicon-outputs.js +2 -2
  203. package/dist/workspace/release-workflow.d.ts +26 -3
  204. package/dist/workspace/release-workflow.d.ts.map +1 -1
  205. package/dist/workspace/release-workflow.js +48 -6
  206. package/dist/workspace/trust/check-evidence-report.d.ts +25 -0
  207. package/dist/workspace/trust/check-evidence-report.d.ts.map +1 -1
  208. package/dist/workspace/trust/check-evidence-report.js +20 -0
  209. package/dist/workspace/trust/check-evidence.d.ts +59 -13
  210. package/dist/workspace/trust/check-evidence.d.ts.map +1 -1
  211. package/dist/workspace/trust/check-evidence.js +101 -24
  212. package/dist/workspace/trust/ci-tag-statement.d.ts +2 -2
  213. package/dist/workspace/trust/ci-tag-statement.d.ts.map +1 -1
  214. package/dist/workspace/trust/dsse.d.ts +40 -2
  215. package/dist/workspace/trust/dsse.d.ts.map +1 -1
  216. package/dist/workspace/trust/dsse.js +34 -2
  217. package/dist/workspace/trust/evidence.d.ts +7 -2
  218. package/dist/workspace/trust/evidence.d.ts.map +1 -1
  219. package/dist/workspace/trust/evidence.js +5 -0
  220. package/dist/workspace/trust/keyless-fixture.d.ts +41 -0
  221. package/dist/workspace/trust/keyless-fixture.d.ts.map +1 -0
  222. package/dist/workspace/trust/keyless-fixture.js +161 -0
  223. package/dist/workspace/trust/keyless.d.ts +202 -0
  224. package/dist/workspace/trust/keyless.d.ts.map +1 -0
  225. package/dist/workspace/trust/keyless.js +488 -0
  226. package/dist/workspace/trust/local-evidence.d.ts +3 -0
  227. package/dist/workspace/trust/local-evidence.d.ts.map +1 -1
  228. package/dist/workspace/trust/op-run-statement.d.ts +2 -2
  229. package/dist/workspace/trust/op-run-statement.d.ts.map +1 -1
  230. package/dist/workspace/trust/open-evidence.d.ts +67 -0
  231. package/dist/workspace/trust/open-evidence.d.ts.map +1 -0
  232. package/dist/workspace/trust/open-evidence.js +92 -0
  233. package/dist/workspace/trust/policy.d.ts +56 -1
  234. package/dist/workspace/trust/policy.d.ts.map +1 -1
  235. package/dist/workspace/trust/policy.js +103 -2
  236. package/dist/workspace/trust/ref-gate-cli.d.ts.map +1 -1
  237. package/dist/workspace/trust/ref-gate-cli.js +65 -3
  238. package/dist/workspace/trust/ref-gate.d.ts +62 -3
  239. package/dist/workspace/trust/ref-gate.d.ts.map +1 -1
  240. package/dist/workspace/trust/ref-gate.js +75 -8
  241. package/dist/workspace/trust/run-statement.d.ts +3 -3
  242. package/dist/workspace/trust/run-statement.d.ts.map +1 -1
  243. package/dist/workspace/trust/runner-identity.d.ts +56 -0
  244. package/dist/workspace/trust/runner-identity.d.ts.map +1 -0
  245. package/dist/workspace/trust/runner-identity.js +65 -0
  246. package/dist/workspace/trust/trust-files.d.ts.map +1 -1
  247. package/dist/workspace/trust/trust-files.js +8 -1
  248. package/package.json +1 -1
  249. package/src/action-pins.ts +2 -0
  250. package/src/actor.test.ts +12 -0
  251. package/src/actor.ts +19 -0
  252. package/src/bundle-check.test.ts +22 -0
  253. package/src/bundle-check.ts +33 -5
  254. package/src/chant-install.test.ts +109 -1
  255. package/src/chant-install.ts +243 -2
  256. package/src/ci-commit.test.ts +51 -5
  257. package/src/ci-commit.ts +1 -2
  258. package/src/ci-control.ts +1 -0
  259. package/src/ci-evidence-claims.ts +102 -0
  260. package/src/ci-evidence-from-job.test.ts +147 -0
  261. package/src/ci-evidence-from-job.ts +195 -0
  262. package/src/ci-evidence-jobs.ts +85 -10
  263. package/src/ci-handover.ts +16 -3
  264. package/src/ci-identity.test.ts +3 -3
  265. package/src/ci-identity.ts +51 -11
  266. package/src/ci-image.test.ts +60 -10
  267. package/src/ci-image.ts +78 -19
  268. package/src/ci-jobs.ts +7 -2
  269. package/src/ci-login.test.ts +131 -3
  270. package/src/ci-login.token-drop.test.ts +204 -0
  271. package/src/ci-login.ts +137 -39
  272. package/src/ci-product-words.ts +30 -0
  273. package/src/ci-product.ts +26 -1
  274. package/src/cli/commands/__fixtures__/source-dir-root/migrations/0001-init/backfill.ts +3 -0
  275. package/src/cli/handlers/approve-confirm.test.ts +35 -0
  276. package/src/cli/handlers/approve-confirm.ts +44 -0
  277. package/src/cli/handlers/build-source-dir.test.ts +4 -0
  278. package/src/cli/handlers/build.ts +20 -2
  279. package/src/cli/handlers/ci-check.ts +35 -13
  280. package/src/cli/handlers/ci-evidence-open.test.ts +164 -0
  281. package/src/cli/handlers/ci-evidence.ts +223 -24
  282. package/src/cli/handlers/ci-forge-check.ts +22 -9
  283. package/src/cli/handlers/generated-check.ts +39 -0
  284. package/src/cli/handlers/lifecycle.test.ts +20 -0
  285. package/src/cli/handlers/lifecycle.ts +4 -0
  286. package/src/cli/handlers/local-chant.ts +39 -1
  287. package/src/cli/handlers/pr.ts +43 -5
  288. package/src/cli/handlers/run-wave.ts +7 -0
  289. package/src/cli/main.ts +38 -4
  290. package/src/cli/parse-args.ts +46 -0
  291. package/src/cli/registry.ts +24 -0
  292. package/src/components/check-hooks.ts +25 -3
  293. package/src/components/check-report-summary.test.ts +78 -0
  294. package/src/components/check-steps.ts +1 -1
  295. package/src/components/pr-checks.ts +159 -0
  296. package/src/components/pr-pipeline.ts +41 -1
  297. package/src/components/product-pipeline.ts +25 -3
  298. package/src/components/product-plan.test.ts +102 -1
  299. package/src/components/product-plan.ts +419 -14
  300. package/src/config.ts +13 -8
  301. package/src/control/consumers.ts +7 -0
  302. package/src/dead-guards.test.ts +27 -5
  303. package/src/dead-guards.ts +9 -6
  304. package/src/discovery/files.ts +1 -1
  305. package/src/drift-issue.test.ts +29 -1
  306. package/src/drift-issue.ts +28 -3
  307. package/src/drift-record.test.ts +25 -0
  308. package/src/drift-record.ts +55 -6
  309. package/src/floor-table.data.ts +58 -20
  310. package/src/floor-table.ts +12 -9
  311. package/src/forge-check/contract.ts +11 -1
  312. package/src/forge-check/forge-check.test.ts +8 -0
  313. package/src/forge-check/index.ts +2 -0
  314. package/src/forge-flags.test.ts +25 -1
  315. package/src/forge-flags.ts +34 -0
  316. package/src/forge-remote.test.ts +37 -0
  317. package/src/forge-remote.ts +79 -0
  318. package/src/generated-check.e2e.test.ts +98 -0
  319. package/src/generated-check.test.ts +104 -0
  320. package/src/generated-check.ts +269 -0
  321. package/src/lexicon.ts +17 -0
  322. package/src/lifecycle/publish-npm.ts +56 -3
  323. package/src/lifecycle/release-catalog.test.ts +2 -2
  324. package/src/lifecycle/release-images-dockerfile.test.ts +20 -0
  325. package/src/lifecycle/release-images.test.ts +44 -0
  326. package/src/lifecycle/release-images.ts +39 -3
  327. package/src/lifecycle/release-ledger.ts +4 -3
  328. package/src/local-chant.e2e.test.ts +81 -6
  329. package/src/local-chant.test.ts +22 -3
  330. package/src/local-chant.ts +130 -13
  331. package/src/op/op-waves-evidence-jobs.ts +134 -0
  332. package/src/op/op-waves-evidence.test.ts +37 -4
  333. package/src/op/op-waves-evidence.ts +32 -11
  334. package/src/op/op-waves-run.ts +57 -2
  335. package/src/op/op-waves.ts +11 -0
  336. package/src/op/schedule-overdue.test.ts +83 -1
  337. package/src/op/schedule-overdue.ts +107 -9
  338. package/src/pr-forge-reads-compare.test.ts +2 -1
  339. package/src/pr-forge-reads.ts +37 -1
  340. package/src/pr-forge.ts +14 -3
  341. package/src/pr-plan-note.ts +32 -3
  342. package/src/pr-plan-record.test.ts +75 -0
  343. package/src/pr-plan-record.ts +101 -0
  344. package/src/pr-post-plan-note.test.ts +60 -0
  345. package/src/pr-post.test.ts +30 -0
  346. package/src/pr-post.ts +110 -6
  347. package/src/pr-requires.test.ts +20 -0
  348. package/src/pr-requires.ts +10 -1
  349. package/src/ref-gate-init.ts +189 -0
  350. package/src/ref-gate-rules.ts +26 -0
  351. package/src/release-floors.ts +88 -16
  352. package/src/state-migration-record.test.ts +90 -0
  353. package/src/state-migration.test.ts +1 -1
  354. package/src/state-migration.ts +52 -3
  355. package/src/state-unlock.test.ts +33 -1
  356. package/src/state-unlock.ts +49 -1
  357. package/src/workspace/ci-green-cli.ts +12 -6
  358. package/src/workspace/ci-green.ts +4 -3
  359. package/src/workspace/drift-cli.ts +6 -18
  360. package/src/workspace/forge-work.ts +7 -14
  361. package/src/workspace/lexicon-outputs.ts +2 -2
  362. package/src/workspace/release-workflow.test.ts +70 -0
  363. package/src/workspace/release-workflow.ts +56 -8
  364. package/src/workspace/trust/check-evidence-report.ts +33 -0
  365. package/src/workspace/trust/check-evidence.test.ts +3 -3
  366. package/src/workspace/trust/check-evidence.ts +110 -28
  367. package/src/workspace/trust/ci-tag-statement.ts +2 -2
  368. package/src/workspace/trust/dsse.ts +48 -4
  369. package/src/workspace/trust/evidence.ts +7 -2
  370. package/src/workspace/trust/keyless-fixture.ts +214 -0
  371. package/src/workspace/trust/keyless.test.ts +220 -0
  372. package/src/workspace/trust/keyless.ts +557 -0
  373. package/src/workspace/trust/local-evidence.ts +3 -1
  374. package/src/workspace/trust/op-run-statement.ts +2 -2
  375. package/src/workspace/trust/open-evidence.ts +129 -0
  376. package/src/workspace/trust/policy.ts +129 -2
  377. package/src/workspace/trust/ref-gate-cli.ts +59 -3
  378. package/src/workspace/trust/ref-gate-pieces.test.ts +175 -0
  379. package/src/workspace/trust/ref-gate.e2e.test.ts +17 -0
  380. package/src/workspace/trust/ref-gate.ts +90 -8
  381. package/src/workspace/trust/run-statement.ts +3 -3
  382. package/src/workspace/trust/runner-identity.ts +92 -0
  383. package/src/workspace/trust/trust-files.test.ts +6 -0
  384. package/src/workspace/trust/trust-files.ts +14 -1
@@ -26,7 +26,8 @@
26
26
  import { CHANT_EXIT } from "./exit-codes";
27
27
  import { gatedOp, type GatedRequestLedger } from "./lifecycle/gated-op";
28
28
  import type { GatedRequestRules } from "./lifecycle/gated-request";
29
- import type { ForgeFetch, ForgeKind } from "./pr-forge";
29
+ import type { ForgeOverrides } from "./forge-flags";
30
+ import type { ForgeFetch, ForgeKind, ForgeTarget, ForgeTargetOptions } from "./pr-forge";
30
31
 
31
32
  /** The first chant with the engine-neutral lock release and {@link forgeLiveRuns} (#4762). */
32
33
  export const STATE_UNLOCK_FLOOR = "0.124.77";
@@ -108,6 +109,53 @@ export async function forgeLiveRuns(t: LiveRunsTarget): Promise<LiveRun[]> {
108
109
  return [...out.values()];
109
110
  }
110
111
 
112
+ /**
113
+ * The live runs of a {@link ForgeTarget} (#4911), from `forgeTargetFromEnv`,
114
+ * `forgeTargetWith` or `forgeTargetFromFlags`: {@link forgeLiveRuns} with
115
+ * the target's forge, REST base, repository, token and GitLab token header.
116
+ */
117
+ export function forgeTargetLiveRuns(target: Pick<ForgeTarget, "kind" | "apiBase" | "repo" | "token" | "tokenHeader">, fetch?: ForgeFetch): Promise<LiveRun[]> {
118
+ return forgeLiveRuns({ kind: target.kind, apiBase: target.apiBase, repo: target.repo, token: target.token, ...(target.tokenHeader ? { tokenHeader: target.tokenHeader } : {}), ...(fetch ? { fetch } : {}) });
119
+ }
120
+
121
+ /** What {@link forgeLiveRunsOf} reads the forge from besides the environment. */
122
+ export interface ForgeLiveRunsOptions {
123
+ /**
124
+ * A checkout whose origin remote names the forge (#4920) when the
125
+ * environment names no CI forge and `forge` no repository: its kind, web
126
+ * origin and repository, each under what `forge` gives.
127
+ */
128
+ cwd?: string;
129
+ /** The remote in `cwd`. Default `origin`. */
130
+ remote?: string;
131
+ fetch?: ForgeFetch;
132
+ /** Reads a remote's URL. Default `git remote get-url`. For tests. */
133
+ remoteUrl?: (cwd: string, remote: string) => string | undefined;
134
+ }
135
+
136
+ /**
137
+ * The `liveRuns` reader of the forge `forge` names over `env` (#4911),
138
+ * read each time it is called: `forgeTargetWith`'s target (a product's
139
+ * `--forge`, `--repo` and `--url` over the job's environment), and its runs.
140
+ * On a laptop, with no CI variables and no repository given, the origin
141
+ * remote of `opts.cwd` names the forge and the repository (#4920), so a
142
+ * release run there needs only a token. A forge that cannot be named, or a
143
+ * missing token, throws, and the release it guards is refused.
144
+ */
145
+ export function forgeLiveRunsOf(env: Record<string, string | undefined>, forge: ForgeTargetOptions & ForgeOverrides = {}, opts: ForgeLiveRunsOptions = {}): () => Promise<LiveRun[]> {
146
+ return async () => {
147
+ const [{ forgeTargetWith }, { detectForge }] = await Promise.all([import("./forge-flags"), import("./pr-forge")]);
148
+ let given = forge;
149
+ if (opts.cwd && !detectForge(env) && !forge.repo?.trim()) {
150
+ const { forgeOfCheckout } = await import("./forge-remote");
151
+ const at = forgeOfCheckout(opts.cwd, { ...(opts.remote ? { remote: opts.remote } : {}), ...(forge.kind ? { kind: forge.kind } : {}), ...(opts.remoteUrl ? { remoteUrl: opts.remoteUrl } : {}) });
152
+ const set = Object.fromEntries(Object.entries(forge).filter(([, v]) => v !== undefined && v !== "")) as typeof forge;
153
+ if (at) given = { kind: at.kind, repo: at.repo, url: at.url, ...set };
154
+ }
155
+ return forgeTargetLiveRuns(forgeTargetWith(env, given), opts.fetch);
156
+ };
157
+ }
158
+
111
159
  /** How far a run's start may be after the lock's and still count as a run that could hold it: the clocks of the job and the forge differ. */
112
160
  export const CLOCK_SKEW_MS = 2 * 60 * 1000;
113
161
 
@@ -233,7 +233,12 @@ export async function runCiWorkflow(ctx: CommandContext): Promise<number> {
233
233
  const repoRoot = gitTop(root) ?? root;
234
234
  const member = resolveMemberContext(cwd, found);
235
235
  const target = ctx.args.output ? resolve(realpathSync(cwd), ctx.args.output) : join(repoRoot, CI_GREEN_WORKFLOW_FILE);
236
- const fromRepo = relative(repoRoot, target).split(sep).join("/");
236
+ // #4909: under `chant dev generated-check` the file goes to the render
237
+ // tree; it is read and named as the committed file it stands for.
238
+ const { committedPathOf, isRenderPath, renderPathOf } = await import("../generated-check");
239
+ const rendering = isRenderPath(target);
240
+ const asCommitted = committedPathOf(target);
241
+ const fromRepo = relative(repoRoot, asCommitted).split(sep).join("/");
237
242
 
238
243
  // The merge queue's verdict (#4644) is ours too, and holds no phase.
239
244
  const sources = readWorkflowSources(repoRoot, fromRepo).filter((s) => s.path !== MERGE_QUEUE_WORKFLOW_FILE);
@@ -252,7 +257,7 @@ export async function runCiWorkflow(ctx: CommandContext): Promise<number> {
252
257
 
253
258
  const base = member ? member.memberRoot : root;
254
259
  const parts = ["chant", "ci", "workflow", ...extra.flatMap((w) => ["--workflow", w])];
255
- if (ctx.args.output) parts.push("--output", relative(base, target).split(sep).join("/"));
260
+ if (ctx.args.output && !(rendering && asCommitted === join(repoRoot, CI_GREEN_WORKFLOW_FILE))) parts.push("--output", relative(base, asCommitted).split(sep).join("/"));
256
261
  if (ctx.args.ciChant) parts.push("--chant", ctx.args.ciChant);
257
262
  if (ctx.args.ciInstall) parts.push("--install", ctx.args.ciInstall);
258
263
  if (push && "secret" in push) parts.push("--token-secret", push.secret);
@@ -269,19 +274,20 @@ export async function runCiWorkflow(ctx: CommandContext): Promise<number> {
269
274
  const npmLock = ctx.args.ciInstall && existsSync(join(root, "package-lock.json")) ? (workspaceRoot === "." ? "package-lock.json" : `${workspaceRoot}/package-lock.json`) : undefined;
270
275
  const yaml = renderCiGreenWorkflow({ green, workflows, chantVersion: readerVersion(), workspaceRoot, chant: ctx.args.ciChant, install: ctx.args.ciInstall, npmLock, push, ...(runnerKeySecret ? { runnerKeySecret } : {}), ...(compose ? { compose } : {}) });
271
276
  const written = writeWorkflowFile(target, ciGreenHeader(command, member ? "member" : "root") + yaml);
272
- if (member) recordGeneratedFiles(member.memberRoot, [{ path: fromRepo, command }]);
277
+ if (member && !rendering) recordGeneratedFiles(member.memberRoot, [{ path: fromRepo, command }]);
273
278
  console.log(`Wrote ${written}: ticks when ${workflows.join(", ")} complete${workflows.length === 1 ? "s" : ""} on ${greenBranches(green).join(", ")}${compose ? " or a chant/compose/ branch" : ""}, and every 15 minutes.`);
274
279
  // #4644: the merge queue's verdict, beside the tick and from the same command.
275
280
  if (green.mergeQueue && !member) {
276
281
  const queue = renderMergeQueueWorkflow({ green, chantVersion: readerVersion(), workspaceRoot, chant: ctx.args.ciChant, install: ctx.args.ciInstall, npmLock });
277
- const at = writeWorkflowFile(join(repoRoot, MERGE_QUEUE_WORKFLOW_FILE), ciGreenHeader(command, "root") + queue);
282
+ const at = writeWorkflowFile(rendering ? renderPathOf(join(repoRoot, MERGE_QUEUE_WORKFLOW_FILE)) : join(repoRoot, MERGE_QUEUE_WORKFLOW_FILE), ciGreenHeader(command, "root") + queue);
278
283
  const retries = green.mergeQueue.retries;
279
284
  const again = retries > 0 ? `, re-running a failed job's workflow run up to ${retries} time${retries === 1 ? "" : "s"} first` : "";
280
285
  console.log(`Wrote ${at}: on each merge group, ${MERGE_QUEUE_VERDICT_JOB} passes when every required phase passed on the group's commit${again}. Require ${MERGE_QUEUE_VERDICT_JOB} in the branch's ruleset.`);
281
286
  }
282
287
  for (const e of edits) {
283
- if (!e.changed) continue;
284
- const path = writeWorkflowFile(join(repoRoot, e.path), e.text);
288
+ // A check renders every edited workflow, changed or not, so each has its twin in the render tree.
289
+ if (!e.changed && !rendering) continue;
290
+ const path = writeWorkflowFile(rendering ? renderPathOf(join(repoRoot, e.path)) : join(repoRoot, e.path), e.text);
285
291
  console.log(
286
292
  e.build === "newest"
287
293
  ? `Wrote ${path}'s triggers and concurrency: ${e.phases.join(", ")} build${e.phases.length === 1 ? "s" : ""} the newest commit on ${greenBranches(green).join(", ")} when a run ends, and a ci/build/<sha> tag by hand.`
@@ -70,7 +70,7 @@ import type { ReasonCode } from "./reason-codes";
70
70
  import { gitTop } from "./tree";
71
71
  import { locateWorkspace } from "./which-chant";
72
72
  import { gitRevisionSource } from "./record-source";
73
- import { emptyPolicy, readTrustPolicy } from "./trust/policy";
73
+ import { emptyPolicy, readTrustPolicy, runnersAt } from "./trust/policy";
74
74
  import { loadRunnerKey } from "./trust/dsse";
75
75
  import { signCiTagRecord, verifyCiTagStatement, CI_TAG_SIGNER_ROLE, type CiTagFailure, type CiTagRecord, type CiTagSigner } from "./trust/ci-tag-statement";
76
76
  import { COMPOSE_BRANCH_PREFIX, composedIncluding, isComposeBranch, remoteComposeBranches } from "../lifecycle/compose-refs";
@@ -513,7 +513,7 @@ export function readCiTags(top: string, green: CiGreen | null = null, base: stri
513
513
  const p = policyAtBase();
514
514
  // A tag the tick made walking a compose branch (#4168 4.3) is checked against that branch.
515
515
  const walked = isComposeBranch(t.record?.branch) ? (t.record!.branch as string) : green!.branch;
516
- const v = verifyCiTagStatement(t.record, { sha: t.sha, kind: t.kind, branch: walked, ...(lane !== undefined ? { lane } : {}) }, p.runners, p.roles);
516
+ const v = verifyCiTagStatement(t.record, { sha: t.sha, kind: t.kind, branch: walked, ...(lane !== undefined ? { lane } : {}) }, runnersAt(p, { repo: top, commit: t.sha }), p.roles);
517
517
  if (v.status === "signed") counted(v.signer);
518
518
  else ignore(v.status, `${v.reason}; ci.green.signedSince is ${green!.signedSince}, so a tag on a commit that is not a strict first-parent ancestor of it needs one`);
519
519
  }
@@ -1313,7 +1313,8 @@ export async function readOpRunSource(cwd: string, top: string, base: string, si
1313
1313
  if (!record.gitSha) continue;
1314
1314
  // #4161: a job `ci run --local` ran stays on the machine that ran it, and is never CI's verdict.
1315
1315
  if (record.runOrigin?.forge === "local") continue;
1316
- const v = verifyOpRunStatement(record, policy.runners, policy.roles);
1316
+ // #4869: a keyless identity's statement counts too; under keyless.since, a key's only for a commit before it.
1317
+ const v = verifyOpRunStatement(record, runnersAt(policy, { repo: top, commit: record.gitSha }), policy.roles);
1317
1318
  const counts = v.status === "signed" || (v.status === "unsigned" && (before === null || before.has(record.gitSha)));
1318
1319
  if (counts) byCommit.set(record.gitSha, [...(byCommit.get(record.gitSha) ?? []), opRunCheckRun(record, v.status === "signed" ? v.signer : null)]);
1319
1320
  else {
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * | kind | default read | how |
10
10
  * |---|---|---|
11
- * | `chant` | `live-read` | the member's `chant lifecycle diff <env> --live --json`, through `liveDiffDriftRecords` and, when a lexicon has a deep reader, `mergeDeepDrift`. `--components` adds `chant components status <env> --live --json` through `componentStatusDriftRecords`. Needs `--env` |
11
+ * | `chant` | `live-read` | the member's `chant lifecycle diff <env> --live --json`, each lexicon's section through `lexiconDriftRecords` (`liveDiffDriftRecords`, with `mergeDeepDrift` when a lexicon has a deep reader, and the section's `absent`, #4896). `--components` adds `chant components status <env> --live --json` through `componentStatusDriftRecords`. Needs `--env` |
12
12
  * | `terraform` | `state` | `chant lifecycle drift` in the member's reader project: the terraform lexicon's `readDrift`, `terraform show -json` over state, or `--read plan` for a saved plan's `show -json` |
13
13
  * | `choudoufu` | `ownership` | the same, through `choudoufu live-plan -json` (and `live-ls`), or `--read plan` for live-plan with a plan beside it; `--resource <addr>` passes `choudoufu live-plan -resource=<addr>`'s stream through |
14
14
  * | `pulumi` | `refresh` | `chant lifecycle drift` in the member's reader project: the pulumi lexicon's `readDrift`, `pulumi refresh --preview-only --json --target <urn>` per resource in the checked-in export, or `plunge drift --resource <urn> --stream` for a member on plunge; `--resource <urn>` reads that URN alone (#4455) |
@@ -50,7 +50,6 @@ import {
50
50
  componentStatusDriftRecords,
51
51
  countDriftStatuses,
52
52
  decodeDriftLines,
53
- deepDiffDriftRecords,
54
53
  DRIFT_READS,
55
54
  DRIFT_SCHEMA_ID,
56
55
  DRIFT_VERSION,
@@ -61,15 +60,13 @@ import {
61
60
  driftStart,
62
61
  encodeDriftLines,
63
62
  foldDriftLines,
64
- liveDiffDriftRecords,
65
- mergeDeepDrift,
63
+ lexiconDriftRecords,
66
64
  type DriftDocument,
67
65
  type DriftLine,
68
66
  type DriftRead,
69
67
  type DriftRecord,
68
+ type LiveDiffLexiconSection,
70
69
  } from "../drift-record";
71
- import type { DeepDiffResult } from "../lifecycle/deep-diff";
72
- import type { LiveDiffResult } from "../lifecycle/live-diff";
73
70
  import type { ComponentStatusRow } from "../lifecycle/status";
74
71
  import { readDeclaration, readerVersion, WORKSPACE_ERROR_CODES, WorkspaceReadError } from "./declaration";
75
72
  import { prepareKindReaders } from "./kind-readers";
@@ -214,13 +211,8 @@ function chantRecords(member: string, diffOut: string, componentsOut: string | u
214
211
  const lexicons: LexiconDiff[] = [...Object.values(doc.lexicons ?? {}), ...Object.values(doc.stacks ?? {}).flatMap((s) => Object.values(s))];
215
212
  const base = { member, observedAt, ...(version ? { version } : {}) };
216
213
  const out: DriftRecord[] = [];
217
- for (const lex of lexicons) {
218
- if (!lex.resources) continue;
219
- const types: Record<string, string> = {};
220
- for (const [name, meta] of Object.entries(lex.observed ?? {})) if (typeof meta?.type === "string") types[name] = meta.type;
221
- const thin = liveDiffDriftRecords({ ...base, diff: lex.resources, types });
222
- out.push(...(lex.deep ? mergeDeepDrift(thin, deepDiffDriftRecords({ ...base, diff: lex.deep })) : thin));
223
- }
214
+ // The section's own `absent` (#4896): the sql lexicon's confirmed-absent objects are missing, not pending.
215
+ for (const section of lexicons) out.push(...lexiconDriftRecords({ ...base, section }));
224
216
  if (componentsOut !== undefined) {
225
217
  let rows: ComponentStatusRow[];
226
218
  try {
@@ -233,11 +225,7 @@ function chantRecords(member: string, diffOut: string, componentsOut: string | u
233
225
  return out;
234
226
  }
235
227
 
236
- interface LexiconDiff {
237
- resources?: LiveDiffResult;
238
- observed?: Record<string, { type?: unknown }>;
239
- deep?: DeepDiffResult;
240
- }
228
+ type LexiconDiff = LiveDiffLexiconSection;
241
229
 
242
230
  /** The command line the member runs. */
243
231
  function memberArgv(kind: string, query: DriftQuery, read: DriftRead): string[] {
@@ -23,8 +23,7 @@
23
23
  */
24
24
 
25
25
  import { execFileSync } from "node:child_process";
26
- import { remoteRepoPath } from "../op/activities/forge-pull-request";
27
- import { remoteHost } from "../op/activities/gh-host";
26
+ import { forgeKindOfHost, forgeOfRemote } from "../forge-remote";
28
27
  import { detectForge, FORGE_TOKEN_ORDER, ForgeApiError, forgeClient, forgeTargetFromEnv, type ForgeFetch, type ForgeKind, type ForgeTarget, type PrForge } from "../pr-forge";
29
28
 
30
29
  /** What the forge says one pull request closes. */
@@ -85,14 +84,8 @@ function ghAuthToken(host: string): string | undefined {
85
84
  }
86
85
  }
87
86
 
88
- /** The forge kind a remote host is: github.com and hosts named for GitHub, GitLab, or Forgejo and Gitea (codeberg.org too). Null for any other. */
89
- export function forgeKindOfHost(host: string): ForgeKind | null {
90
- const h = host.toLowerCase().replace(/:\d+$/, "");
91
- if (h === "github.com" || /(^|[.-])github([.-]|$)/.test(h)) return "github";
92
- if (h === "gitlab.com" || /(^|[.-])gitlab([.-]|$)/.test(h)) return "gitlab";
93
- if (h === "codeberg.org" || /(^|[.-])(forgejo|gitea)([.-]|$)/.test(h)) return "forgejo";
94
- return null;
95
- }
87
+ /** The forge kind a remote host is, as `@intentius/chant/forge-remote` reads it (#4920). */
88
+ export { forgeKindOfHost };
96
89
 
97
90
  /** The REST base of a forge at `host`, as the clients take it. */
98
91
  export function forgeApiBase(kind: ForgeKind, host: string): string {
@@ -113,10 +106,10 @@ function locate(top: string, opts: ForgeWorkOptions): { target: ForgeTarget } |
113
106
  }
114
107
  const url = opts.remoteUrl !== undefined ? opts.remoteUrl : gitRemote(top);
115
108
  if (!url) return { source: null, reason: "there is no origin remote to name the forge" };
116
- const host = remoteHost(url);
117
- const repo = remoteRepoPath(url);
118
- const kind = host ? forgeKindOfHost(host) : null;
119
- if (!host || !repo || !kind) return { source: null, reason: `origin (${url}) is not on a forge chant reads issues from: GitHub, GitLab or Forgejo` };
109
+ // #4920: the origin remote's forge, as `@intentius/chant/forge-remote` reads it.
110
+ const at = forgeOfRemote(url);
111
+ if (!at) return { source: null, reason: `origin (${url}) is not on a forge chant reads issues from: GitHub, GitLab or Forgejo` };
112
+ const { kind, host, repo } = at;
120
113
  const source = { kind, host, repo };
121
114
  const names = ["CHANT_FORGE_TOKEN", ...FORGE_TOKEN_ORDER[kind]];
122
115
  const tokenSource = names.find((n) => env[n]?.trim());
@@ -95,8 +95,8 @@ function staticInclude(read: StaticFieldsRead): string[] {
95
95
  /**
96
96
  * Only the files under the member's `sourceDir`, when its config sets one, as
97
97
  * a build reads them (#3941). Without one, every source file of the member
98
- * but its top-level `scripts/`, which a root build leaves out (#4794,
99
- * `ROOT_SOURCE_EXCLUDES`) unless `include` brings it back.
98
+ * but its top-level `scripts/` and `migrations/`, which a root build leaves
99
+ * out (#4794, #4921, `ROOT_SOURCE_EXCLUDES`) unless `include` brings one back.
100
100
  */
101
101
  function withinSourceDir(files: string[], member: string, sourceDir: string | undefined, include: string[] = []): string[] {
102
102
  if (!sourceDir) {
@@ -213,6 +213,17 @@ describe("the release workflow's permissions, env and setup (#4751)", () => {
213
213
  expect(() => renderReleaseWorkflow({ forge: "gitlab", groups: new Set(), pipeline: { ...pipeline, permissions: undefined } })).toThrow(/give it as \{ run \}/);
214
214
  });
215
215
 
216
+ test("a named setup step renders with its name on GitHub, and as its line on GitLab (#4932)", () => {
217
+ const named = { trigger: "dispatch" as const, setup: [{ name: "QEMU for arm64", uses: "docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392", with: { platforms: "arm64" } }, { name: "npm 11", run: "npm install -g npm@11.19.0" }] };
218
+ const doc = parseYAML(renderReleaseWorkflow({ forge: "github", groups: new Set(), images: true, pipeline: named })) as GhDoc;
219
+ const i = doc.jobs.cut!.steps.findIndex((s) => s.run === "npm ci");
220
+ expect(doc.jobs.cut!.steps[i + 1]).toEqual({ name: "QEMU for arm64", uses: "docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392", with: { platforms: "arm64" } });
221
+ expect(doc.jobs.cut!.steps[i + 2]).toEqual({ name: "npm 11", run: "npm install -g npm@11.19.0" });
222
+ const gl = parseYAML(renderReleaseWorkflow({ forge: "gitlab", groups: new Set(), pipeline: { trigger: "dispatch", setup: [{ name: "npm 11", run: "npm install -g npm@11.19.0" }] } })) as Record<string, { script: string[] }>;
223
+ expect(gl["chant-release-cut"]!.script).toContain("npm install -g npm@11.19.0");
224
+ expect(() => renderReleaseWorkflow({ forge: "github", groups: new Set(), pipeline: { setup: [{ name: "", run: "x" }] } })).toThrow(/name is blank/);
225
+ });
226
+
216
227
  test("a scope already granted and a bad variable name are refused", () => {
217
228
  expect(() => renderReleaseWorkflow({ forge: "github", groups: new Set(), pipeline: { permissions: { contents: "read" } } })).toThrow(/already granted/);
218
229
  expect(() => renderReleaseWorkflow({ forge: "github", groups: new Set(), pipeline: { env: { "BAD-NAME": "x" } } })).toThrow(/not a variable name/);
@@ -465,3 +476,62 @@ describe("GHCR credentials and npm trusted publishing from the targets (#4786)",
465
476
  expect(runs(tagged.jobs.publish!)).toContain(NPM_TRUSTED_PUBLISHING_SETUP);
466
477
  });
467
478
  });
479
+
480
+ describe("QEMU for the platforms release.images builds (#4876)", () => {
481
+ type Step = { uses?: string; run?: string; with?: Record<string, unknown> };
482
+ const TWO = ["linux/amd64", "linux/arm64"];
483
+ const render = (forge: (typeof FORGES)[number], imagePlatforms: string[], pipeline: ReleaseWorkflowInput["pipeline"] = {}, trigger: "dispatch" | "tag" = "dispatch") =>
484
+ renderReleaseWorkflow({ forge, groups: new Set(), images: true, imageArchives: ["dist/images/app.tar"], imagePlatforms, pipeline: { ...(trigger === "dispatch" ? { trigger } : {}), ...pipeline } });
485
+ const ghSteps = (yaml: string, job: string): Step[] => (parseYAML(yaml) as { jobs: Record<string, { steps: Step[] }> }).jobs[job]!.steps;
486
+
487
+ test("a two-platform release.images: the cut and the publish set up QEMU for arm64 after the install, before the config's setup, on GitHub and Forgejo", () => {
488
+ for (const forge of ["github", "forgejo"] as const) {
489
+ const yaml = render(forge, TWO, { setup: [{ run: "echo own" }] });
490
+ for (const job of ["cut", "publish"]) {
491
+ const steps = ghSteps(yaml, job);
492
+ const at = steps.findIndex((s) => s.uses?.startsWith("docker/setup-qemu-action@"));
493
+ expect(steps[at], `${forge} ${job}`).toEqual({ uses: `docker/setup-qemu-action@${ACTION_PINS.dockerSetupQemu4.sha}`, with: { platforms: "arm64" } });
494
+ expect(steps[at - 1]!.run, `${forge} ${job}`).toBe("npm ci");
495
+ expect(steps[at + 1]!.run, `${forge} ${job}`).toBe("echo own");
496
+ }
497
+ expect(yaml).toContain(`docker/setup-qemu-action@${ACTION_PINS.dockerSetupQemu4.sha} # v4.4.0`);
498
+ // The tag-triggered publish job builds the images too.
499
+ expect(ghSteps(render(forge, TWO, {}, "tag"), "publish").some((s) => s.uses?.startsWith("docker/setup-qemu-action@")), forge).toBe(true);
500
+ }
501
+ });
502
+
503
+ test("on GitLab, a binfmt run line in the cut and the publish", () => {
504
+ const doc = parseYAML(render("gitlab", TWO)) as Record<string, { script: string[] }>;
505
+ for (const job of ["chant-release-cut", "chant-release-publish"]) {
506
+ const script = doc[job]!.script;
507
+ expect(script[script.indexOf("npm ci") + 1], job).toBe("docker run --privileged --rm tonistiigi/binfmt --install arm64");
508
+ }
509
+ });
510
+
511
+ test("a one-platform release.images, or none, renders no QEMU on any forge", () => {
512
+ for (const forge of FORGES) {
513
+ for (const platforms of [["linux/amd64"], []]) {
514
+ const yaml = render(forge, platforms);
515
+ expect(yaml, forge).not.toContain("setup-qemu-action");
516
+ expect(yaml, forge).not.toContain("binfmt");
517
+ }
518
+ }
519
+ // A config with no release.images builds nothing, whatever the platforms.
520
+ expect(renderReleaseWorkflow({ forge: "github", groups: new Set(), imagePlatforms: TWO, pipeline: { trigger: "dispatch" } })).not.toContain("setup-qemu-action");
521
+ });
522
+
523
+ test("a config that names the step itself renders as today, and drops it to the same file", () => {
524
+ const qemu = { uses: `docker/setup-qemu-action@${ACTION_PINS.dockerSetupQemu4.sha} # v4.4.0`, with: { platforms: "arm64" } };
525
+ const own = { run: 'echo "npm"' };
526
+ const byHand = render("github", TWO, { setup: [qemu, own] });
527
+ expect(byHand).toBe(render("github", [], { setup: [qemu, own] }));
528
+ expect(render("github", TWO, { setup: [own] })).toBe(byHand);
529
+ const binfmt = { run: "docker run --privileged --rm tonistiigi/binfmt --install arm64" };
530
+ expect(render("gitlab", TWO, { setup: [binfmt] })).toBe(render("gitlab", [], { setup: [binfmt] }));
531
+ });
532
+
533
+ test("other architectures go in as QEMU names them", () => {
534
+ const steps = ghSteps(render("github", ["linux/amd64", "linux/arm/v7", "linux/riscv64", "linux/arm64"]), "cut");
535
+ expect(steps.find((s) => s.uses?.startsWith("docker/setup-qemu-action@"))!.with).toEqual({ platforms: "arm,arm64,riscv64" });
536
+ });
537
+ });
@@ -28,7 +28,7 @@
28
28
  * renders the tag-triggered file it always did.
29
29
  */
30
30
  import { ACTION_PINS, tagComments, usesRef } from "../action-pins";
31
- import { resolveReleaseImages } from "../lifecycle/release-images";
31
+ import { releaseImagePlatforms, resolveReleaseImages } from "../lifecycle/release-images";
32
32
  import { GENERATED_MARKER } from "../discovery/files";
33
33
  import type { SecurityGroup } from "./security";
34
34
  import type { OpSetupStep } from "../lexicon";
@@ -74,9 +74,9 @@ export interface ReleasePipelineConfig {
74
74
  env?: Record<string, string>;
75
75
  /**
76
76
  * Steps the cut and publish jobs run after the install (#4751): `{ run }`,
77
- * or `{ uses, with }` on GitHub and Forgejo, such as QEMU's binfmt handlers
78
- * for a two-platform image build, or a newer npm. GitLab takes `run` steps
79
- * as script lines and refuses `uses` by name.
77
+ * or `{ uses, with }` on GitHub and Forgejo, such as a newer npm. GitLab
78
+ * takes `run` steps as script lines and refuses `uses` by name. QEMU for
79
+ * the platforms `release.images` builds is set up without one (#4876).
80
80
  */
81
81
  setup?: OpSetupStep[];
82
82
  /** Where the workflow is written, from the repository root, such as `.github/workflows/publish.yml` for an npm trusted publisher that names that file. Default {@link RELEASE_WORKFLOW_FILES}. */
@@ -107,6 +107,12 @@ export interface ReleaseWorkflowInput {
107
107
  * two jobs cannot change what is published.
108
108
  */
109
109
  imageArchives?: string[];
110
+ /**
111
+ * The platforms `release.images` builds (#4876). Those the runner can't run
112
+ * ({@link RELEASE_RUNNER_PLATFORM}) get QEMU's binfmt handlers in the cut
113
+ * and publish jobs, before `release.workflow.setup`.
114
+ */
115
+ imagePlatforms?: string[];
110
116
  /** `release.lane` (#4692): the gate's green lane. */
111
117
  lane?: string;
112
118
  /**
@@ -174,6 +180,35 @@ export function targetExtras(forge: ReleaseWorkflowForge, targets: ReadonlyArray
174
180
  return { ...(permissions ? { permissions } : {}), ...(Object.keys(env).length > 0 ? { env } : {}), ...(setup.length > 0 ? { setup } : {}) };
175
181
  }
176
182
 
183
+ /** The platform the jobs `chant release workflow` writes run on: GitHub's and Forgejo's `ubuntu-latest`, and a GitLab runner's default (#4876). */
184
+ export const RELEASE_RUNNER_PLATFORM = "linux/amd64";
185
+
186
+ /** The binfmt image a GitLab job installs QEMU's handlers with (#4876). */
187
+ export const RELEASE_BINFMT_IMAGE = "tonistiigi/binfmt";
188
+
189
+ /** The architectures among `platforms` the runner can't run, as QEMU names them (`linux/arm/v7` is `arm`), each once. */
190
+ export function qemuArchitectures(platforms: readonly string[]): string[] {
191
+ return [...new Set(platforms.filter((p) => p.split("/").slice(0, 2).join("/") !== RELEASE_RUNNER_PLATFORM).map((p) => p.split("/")[1] ?? p))].sort();
192
+ }
193
+
194
+ /**
195
+ * QEMU's binfmt setup for the platforms `release.images` builds that the
196
+ * runner can't, such as `linux/arm64` on an amd64 runner (#4876), so no
197
+ * product names it in `release.workflow.setup`. GitHub and Forgejo get
198
+ * `docker/setup-qemu-action` at its pin; GitLab a `docker run --privileged`
199
+ * of {@link RELEASE_BINFMT_IMAGE}, which `chant release workflow` notes needs
200
+ * an executor that runs privileged containers. A config whose `setup` names
201
+ * the action or the binfmt image already gets nothing more, so its file
202
+ * renders as it did.
203
+ */
204
+ export function qemuSetup(forge: ReleaseWorkflowForge, platforms: readonly string[], p: ReleasePipelineConfig): OpSetupStep[] {
205
+ const archs = qemuArchitectures(platforms);
206
+ if (archs.length === 0) return [];
207
+ const named = (p.setup ?? []).some((s) => ("uses" in s ? /^docker\/setup-qemu-action@/.test(s.uses) : s.run.includes(RELEASE_BINFMT_IMAGE)));
208
+ if (named) return [];
209
+ return forge === "gitlab" ? [{ run: `docker run --privileged --rm ${RELEASE_BINFMT_IMAGE} --install ${archs.join(",")}` }] : [{ uses: usesRef(ACTION_PINS.dockerSetupQemu4), with: { platforms: archs.join(",") } }];
210
+ }
211
+
177
212
  /** The flags `chant release publish` gets under the groups. */
178
213
  export function publishFlags(groups: ReadonlySet<SecurityGroup>): string[] {
179
214
  return [...(groups.has("supply-chain") ? ["--require-provenance"] : []), "--yes"];
@@ -214,12 +249,14 @@ export function renderReleaseWorkflow(input: ReleaseWorkflowInput): string {
214
249
  const version = input.version === true;
215
250
  // #4786: the targets' own needs first, then the config's, so a config that set them by hand renders the same file without them.
216
251
  const derived = targetExtras(input.forge, input.publish ?? [], p);
252
+ // #4876: QEMU before the config's setup, where the products named it.
253
+ const qemu = images ? qemuSetup(input.forge, input.imagePlatforms ?? [], p) : [];
217
254
  const extra = jobExtras(
218
255
  {
219
256
  ...p,
220
257
  ...(derived.permissions ? { permissions: { ...p.permissions, ...derived.permissions } } : {}),
221
258
  ...(derived.env ? { env: { ...p.env, ...derived.env } } : {}),
222
- ...(derived.setup ? { setup: [...(p.setup ?? []), ...derived.setup] } : {}),
259
+ ...(derived.setup || qemu.length > 0 ? { setup: [...qemu, ...(p.setup ?? []), ...(derived.setup ?? [])] } : {}),
223
260
  },
224
261
  input.forge,
225
262
  );
@@ -347,11 +384,14 @@ function jobExtras(p: ReleasePipelineConfig, forge: ReleaseWorkflowForge): JobEx
347
384
  if (!/^[a-z][a-z-]*$/.test(k) || (v !== "read" && v !== "write")) throw new Error(`${where}.permissions: ${k}: ${String(v)} is not a scope and read or write`);
348
385
  }
349
386
  for (const s of setup) if (!("uses" in s) && s.run.trim() === "") throw new Error(`${where}.setup: a run step is empty`);
387
+ for (const s of setup) if (s.name !== undefined && (s.name.trim() === "" || /[\r\n]/.test(s.name))) throw new Error(`${where}.setup: a step's name is blank or more than one line`);
350
388
  }
351
389
  const q = (v: string | number | boolean): string => JSON.stringify(v);
352
390
  const map = (indent: string, entries: Array<[string, string | number | boolean]>): string[] => entries.map(([k, v]) => `${indent}${k}: ${q(v)}`);
391
+ // #4932: a named step opens with its name.
353
392
  const githubSteps = setup.flatMap((s) => [
354
- "uses" in s ? ` - uses: ${s.uses}` : ` - run: ${q(s.run)}`,
393
+ ...(s.name !== undefined ? [` - name: ${q(s.name)}`] : []),
394
+ ` ${s.name !== undefined ? " " : "-"} ${"uses" in s ? `uses: ${s.uses}` : `run: ${q(s.run)}`}`,
355
395
  ...("uses" in s && s.with && Object.keys(s.with).length > 0 ? [" with:", ...map(" ", Object.entries(s.with))] : []),
356
396
  ...(s.env && Object.keys(s.env).length > 0 ? [" env:", ...map(" ", Object.entries(s.env))] : []),
357
397
  ]);
@@ -664,7 +704,7 @@ export async function runReleaseWorkflow(ctx: import("../cli/registry").CommandC
664
704
  groups,
665
705
  workspaceRoot,
666
706
  ...(release?.workflow ? { pipeline: release.workflow } : {}),
667
- ...((release?.images?.length ?? 0) > 0 ? { images: true, imageArchives: resolveReleaseImages(release!.images!).map((i) => i.archive) } : {}),
707
+ ...((release?.images?.length ?? 0) > 0 ? { images: true, imageArchives: resolveReleaseImages(release!.images!).map((i) => i.archive), imagePlatforms: releaseImagePlatforms(release!.images!) } : {}),
668
708
  ...(release?.lane ? { lane: release.lane } : {}),
669
709
  ...(release?.version ? { version: true } : {}),
670
710
  ...(release?.publish ? { publish: release.publish } : {}),
@@ -673,11 +713,15 @@ export async function runReleaseWorkflow(ctx: import("../cli/registry").CommandC
673
713
  ...(args.ciChant ? { chant: args.ciChant } : {}),
674
714
  });
675
715
  const target = args.output ? resolve(process.cwd(), args.output) : join(repoRoot, release?.workflow?.file ?? RELEASE_WORKFLOW_FILES[forge]);
716
+ // #4909: under `chant dev generated-check` the header names the committed file the render stands for.
717
+ const { committedPathOf, isRenderPath } = await import("../generated-check");
718
+ const asCommitted = committedPathOf(target);
719
+ const defaultTarget = join(repoRoot, release?.workflow?.file ?? RELEASE_WORKFLOW_FILES[forge]);
676
720
  const parts = ["chant", "release", "workflow", "--forge", forge];
677
721
  if (args.ciInstall) parts.push("--install", args.ciInstall);
678
722
  if (args.buildCommand) parts.push("--build", args.buildCommand);
679
723
  if (args.ciChant) parts.push("--chant", args.ciChant);
680
- if (args.output) parts.push("--output", relative(root, target).split(sep).join("/"));
724
+ if (args.output && !(isRenderPath(target) && asCommitted === defaultTarget)) parts.push("--output", relative(root, asCommitted).split(sep).join("/"));
681
725
  mkdirSync(dirname(target), { recursive: true });
682
726
  writeFileSync(target, releaseWorkflowHeader(parts.map(shellArg).join(" ")) + text);
683
727
  const shown = relative(process.cwd(), target).split(sep).join("/") || target;
@@ -685,6 +729,10 @@ export async function runReleaseWorkflow(ctx: import("../cli/registry").CommandC
685
729
  const what = release?.workflow?.trigger === "dispatch" ? "cuts and publishes a release started by hand with its label, from a green commit" : "publishes the release a release/** tag names";
686
730
  console.log(formatSuccess(`Wrote ${shown}: ${what}${extras.length > 0 ? `, and ${extras.join(" and ")}` : ""}.`));
687
731
  if (forge === "gitlab") console.log(`Include it from .gitlab-ci.yml: include: [{ local: ${release?.workflow?.file ?? RELEASE_WORKFLOW_FILES.gitlab} }]`);
732
+ // #4876: a GitLab executor that refuses privileged containers can't install the handlers from the job.
733
+ const archs = (release?.images?.length ?? 0) > 0 ? qemuArchitectures(releaseImagePlatforms(release!.images!)) : [];
734
+ if (forge === "gitlab" && archs.length > 0 && text.includes(`${RELEASE_BINFMT_IMAGE} --install`))
735
+ console.log(`The cut and publish jobs install QEMU's binfmt handlers for ${archs.join(", ")} with docker run --privileged ${RELEASE_BINFMT_IMAGE}: the runner's executor must run privileged containers, or have the handlers installed on its host.`);
688
736
  if (forge === "gitlab" && release?.workflow?.trigger === "dispatch") console.log("The cut and publish jobs push with CHANT_RELEASE_TOKEN: a project access token with write_repository, as a masked CI/CD variable.");
689
737
  return 0;
690
738
  }
@@ -26,6 +26,15 @@ export const CHECK_EVIDENCE_KEY_ENV = "CHANT_RUNNER_KEY";
26
26
  /** The variable a developer's or an agent's local evidence key is read from, as PEM (#4868). A check hook never sees it. */
27
27
  export const LOCAL_EVIDENCE_KEY_ENV = "CHANT_LOCAL_EVIDENCE_KEY";
28
28
 
29
+ /**
30
+ * The variable a generated job sets to `oidc` when it signs keyless from
31
+ * its OIDC identity (#4869) instead of with a runner key.
32
+ */
33
+ export const RUNNER_IDENTITY_ENV = "CHANT_RUNNER_IDENTITY";
34
+
35
+ /** The GitLab `id_tokens` variable a keyless signing job's token comes in (#4869), with the signing audience. */
36
+ export const SIGNING_ID_TOKEN_VAR = "CHANT_ID_TOKEN_SIGSTORE";
37
+
29
38
  /** The file the signing step writes beside the plan report, which `pr-post` reads. */
30
39
  export const CHECK_EVIDENCE_FILE = "evidence.json";
31
40
 
@@ -88,6 +97,30 @@ export function planReportChecks(dir: string, result: string | undefined): { sig
88
97
  return { sign, skipped };
89
98
  }
90
99
 
100
+ /**
101
+ * What a GitLab signing job in the target branch's pipeline keeps for one
102
+ * merge request (#4914), `<out>/<iid>/evidence.json`: the note, with the
103
+ * merge request and the head it was signed for, so the note job uses it
104
+ * only for that head.
105
+ */
106
+ export interface OpenEvidenceFile extends CheckEvidenceNote {
107
+ pr: number;
108
+ head: string;
109
+ }
110
+
111
+ /**
112
+ * The `evidence.json` the signing job kept for merge request `pr` at
113
+ * `head` under `dir` (#4914), as text for the note job's report directory,
114
+ * or undefined when it kept none for that head. The file comes from a job
115
+ * of the same target-branch pipeline, which ran none of the change's code;
116
+ * it is read as data all the same.
117
+ */
118
+ export function openEvidenceFor(dir: string, pr: number, head: string): string | undefined {
119
+ const doc = readJson(join(dir, String(pr), CHECK_EVIDENCE_FILE)) as Partial<OpenEvidenceFile> | undefined;
120
+ if (!doc || doc.pr !== pr || doc.head !== head || !Array.isArray(doc.signed) || !Array.isArray(doc.skipped)) return undefined;
121
+ return JSON.stringify({ signed: doc.signed, skipped: doc.skipped }, null, 2) + "\n";
122
+ }
123
+
91
124
  /**
92
125
  * The line the plan note ends with when the signing step wrote
93
126
  * {@link CHECK_EVIDENCE_FILE} in `dir`, or undefined when it did not.
@@ -50,7 +50,7 @@ describe("check evidence (#4870)", () => {
50
50
  test("a signed check is current for its commit, and for another commit with the same tree", async () => {
51
51
  const r = repo();
52
52
  const signer = runnerKeyEvidenceSigner(r.dir, r.base, r.ci.pem);
53
- const signed = signChecks(r.dir, r.head, [{ check: "plan", claim: "{}" }, { check: "policy" }], signer);
53
+ const signed = await signChecks(r.dir, r.head, [{ check: "plan", claim: "{}" }, { check: "policy" }], signer);
54
54
  expect(signed.map((s) => s.check)).toEqual(["plan", "policy"]);
55
55
  await recordChecks(r.dir, signed, { push: false });
56
56
  expect(await readCheckEvidence(r.dir, r.head, r.base, ["plan", "policy"])).toEqual([
@@ -68,7 +68,7 @@ describe("check evidence (#4870)", () => {
68
68
 
69
69
  test("a commit whose tree differs has none, and the refusal names each missing check and its command", async () => {
70
70
  const r = repo();
71
- await recordChecks(r.dir, signChecks(r.dir, r.head, [{ check: "plan" }], runnerKeyEvidenceSigner(r.dir, r.base, r.ci.pem)), { push: false });
71
+ await recordChecks(r.dir, await signChecks(r.dir, r.head, [{ check: "plan" }], runnerKeyEvidenceSigner(r.dir, r.base, r.ci.pem)), { push: false });
72
72
  expect((await readCheckEvidence(r.dir, r.base, r.base, ["plan"]))[0]!.status).toBe("missing");
73
73
  const refused = await missingCheckEvidence(r.dir, r.head, r.base, ["plan", "policy"]);
74
74
  expect(refused).toContain("policy");
@@ -85,7 +85,7 @@ describe("check evidence (#4870)", () => {
85
85
  const head = git(r.dir, "rev-parse", "HEAD");
86
86
  expect(() => runnerKeyEvidenceSigner(r.dir, r.base, added.pem)).toThrow(/lists no runner with this key/);
87
87
  // Signed against the change's own policy, and kept: the base still does not trust it.
88
- await recordChecks(r.dir, signChecks(r.dir, head, [{ check: "plan" }], runnerKeyEvidenceSigner(r.dir, head, added.pem)), { push: false });
88
+ await recordChecks(r.dir, await signChecks(r.dir, head, [{ check: "plan" }], runnerKeyEvidenceSigner(r.dir, head, added.pem)), { push: false });
89
89
  expect((await readCheckEvidence(r.dir, head, r.base, ["plan"]))[0]).toMatchObject({ status: "untrusted" });
90
90
  expect(await readCheckEvidence(r.dir, head, head, ["plan"])).toEqual([{ check: "plan", status: "current", runner: "mine", commit: head }]);
91
91
  });