@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
@@ -77,10 +77,23 @@ export const NO_FORGE_TOKEN_MARKER = "CHANT_NO_FORGE_TOKEN";
77
77
  * `$0` is that file. terragucci's `restartWithout` (render.ts:1826).
78
78
  */
79
79
  export function dropForgeTokens(shell: "sh" | "bash" = "sh", extra: readonly string[] = []): string {
80
- const again = shell === "bash" ? 'bash --noprofile --norc -e -o pipefail "$0"' : 'sh -e "$0"';
81
- const marker = NO_FORGE_TOKEN_MARKER;
82
80
  // #4296: a plan job that traded its OIDC token drops the variables a token is requested with too.
83
- const vars = [...FORGE_TOKEN_VARS, ...extra];
81
+ return restartWithout(shell, [...FORGE_TOKEN_VARS, ...extra], NO_FORGE_TOKEN_MARKER);
82
+ }
83
+
84
+ /**
85
+ * The line that restarts the step's shell once without `vars` in its
86
+ * process environment, setting `marker` so the restarted shell does not
87
+ * restart again, or, when it cannot restart, unsets them (#4912). The
88
+ * restart runs the step's script file (`$0`) again from its first line,
89
+ * with every exported variable but `vars`, so the line goes at the top of
90
+ * the step. It needs that file, `env` and the shell on the PATH; without
91
+ * them (a script given to `sh -c`, GitLab's piped script) the shell unsets
92
+ * `vars` and runs on. {@link dropForgeTokens} and ci-login's `restart` use
93
+ * it. terragucci's `restartWithout` (render.ts:2101).
94
+ */
95
+ export function restartWithout(shell: "sh" | "bash", vars: readonly string[], marker: string): string {
96
+ const again = shell === "bash" ? 'bash --noprofile --norc -e -o pipefail "$0"' : 'sh -e "$0"';
84
97
  const can = `[ -z "\${${marker}:-}" ] && [ "\${0#*/}" != "$0" ] && [ -f "$0" ] && ! { [ "\${0##*/}" = sh ] || [ "\${0##*/}" = bash ] || [ "\${0##*/}" = dash ]; } && command -v env >/dev/null 2>&1 && command -v ${shell} >/dev/null 2>&1`;
85
98
  return `if ${can}; then exec env ${vars.map((v) => `-u ${v}`).join(" ")} ${marker}=1 ${again}; fi; unset ${vars.join(" ")}`;
86
99
  }
@@ -84,11 +84,11 @@ describe("the trade script stays inside one shell word", () => {
84
84
  test("it holds no single quote, so tradeLine can quote it", () => {
85
85
  expect(TRADE_JS).not.toContain("'");
86
86
  });
87
- test("GitLab's lines trade, unset the token variables and the extra ones, then source the credentials", () => {
87
+ test("GitLab's lines trade into a shell variable, unset the token variables and the extra ones, then evaluate the credentials (#4912)", () => {
88
88
  const [trade, unset, source] = gitlabTradeLines(["CHANT_FORGE_TOKEN"]);
89
- expect(trade).toContain("node -e");
89
+ expect(trade).toMatch(/^CHANT_CLOUD_TRADE_VARS="\$\(cd \/ && node -e '.*' "-" sh\)"$/);
90
90
  expect(unset).toBe(`unset CHANT_FORGE_TOKEN ${OIDC_REQUEST_VARS.join(" ")}`);
91
- expect(source).toMatch(/^\. "\$\{TMPDIR:-\/tmp\}\/chant-cloud-\$CI_JOB_ID\.sh" && rm -f /);
91
+ expect(source).toBe('eval "$CHANT_CLOUD_TRADE_VARS"; unset CHANT_CLOUD_TRADE_VARS');
92
92
  expect(gitlabTradeIdTokens(resolveCloudIdentity(DECL, "prod", "app")!.plan)).toEqual({
93
93
  CHANT_ID_TOKEN_AWS: { aud: "sts.amazonaws.com" },
94
94
  CHANT_ID_TOKEN_GCP: { aud: "https://iam.googleapis.com/projects/123/locations/global/workloadIdentityPools/ci/providers/forge" },
@@ -124,7 +124,12 @@ export interface GcpCloudIdentity {
124
124
  provider: string;
125
125
  /** The OIDC token's audience. Default `https://iam.googleapis.com/<provider>`. */
126
126
  audience?: string;
127
- /** Google's STS, for an emulator. Default `https://sts.googleapis.com`. */
127
+ /**
128
+ * Google's STS, for a regional endpoint or an emulator: its base URL, to
129
+ * which `/v1/token` is added, or its full token URL, one that ends in
130
+ * `/token` (#4912, terragucci's `token_url`). Default
131
+ * `https://sts.googleapis.com`.
132
+ */
128
133
  stsEndpoint?: string;
129
134
  /** IAM credentials, for an emulator. Default `https://iamcredentials.googleapis.com`. */
130
135
  iamEndpoint?: string;
@@ -569,8 +574,9 @@ export const TRADED_VARS: Record<IdentityCloud, readonly string[]> = {
569
574
  /**
570
575
  * How the trade leaves what it got. `github-env`: `NAME=value` lines
571
576
  * appended to the file argv 1 names (`$GITHUB_ENV`), and an `::add-mask::`
572
- * line for each secret, so every later step of the job has them. `sh`: a
573
- * file of `export` lines a GitLab script sources, mode 0600.
577
+ * line for each secret, so every later step of the job has them. `sh`:
578
+ * `export` lines, printed when argv 1 is `-` (GitLab's script captures and
579
+ * evaluates them, #4912), else written to that file, mode 0600.
574
580
  */
575
581
  export type TradeFormat = "github-env" | "sh";
576
582
 
@@ -582,6 +588,22 @@ export type TradeFormat = "github-env" | "sh";
582
588
  */
583
589
  export const CLOUD_TARGETS_ENV = "CHANT_CLOUD_TARGETS";
584
590
 
591
+ /**
592
+ * The variable the trade sets (#4930): the clouds it traded the job's
593
+ * token for, comma-separated (`aws,gcp`). The trade and ci-login's login
594
+ * both write a {@link CLOUD_TARGETS_ENV} file, so a product that hands a
595
+ * target traded credentials (terragucci's re-plan) reads this, not the
596
+ * file, to know the job traded. The login never sets it.
597
+ */
598
+ export const CLOUD_TRADED_ENV = "CHANT_CLOUD_TRADED";
599
+
600
+ /** The clouds the job's trade traded for, from {@link CLOUD_TRADED_ENV}: none when the job did not trade, such as after ci-login's login (#4930). */
601
+ export function cloudsTraded(env: Readonly<Record<string, string | undefined>>): IdentityCloud[] {
602
+ const v = env[CLOUD_TRADED_ENV];
603
+ if (!v) return [];
604
+ return v.split(",").filter((c): c is IdentityCloud => (IDENTITY_CLOUDS as readonly string[]).includes(c));
605
+ }
606
+
585
607
  /** The file {@link CLOUD_TARGETS_ENV} names: per cloud, the job's own identity, the targets that take another, and each identity's variables. */
586
608
  export interface CloudTargetsFile {
587
609
  version: 1;
@@ -633,7 +655,8 @@ export const TRADE_JS = [
633
655
  "if(a.role)Object.assign(vars,by.aws[a.role])}",
634
656
  'if(spec.gcp){const c=spec.gcp;const tok=await idToken("gcp",c.audience);by.gcp={};',
635
657
  'const sts=trim(c.stsEndpoint||"https://sts.googleapis.com"),iam=trim(c.iamEndpoint||"https://iamcredentials.googleapis.com");',
636
- 'const fed=json(await post(sts+"/v1/token",{"content-type":"application/json"},JSON.stringify({grantType:"urn:ietf:params:oauth:grant-type:token-exchange",audience:"//iam.googleapis.com/"+c.provider,scope:"https://www.googleapis.com/auth/cloud-platform",requestedTokenType:"urn:ietf:params:oauth:token-type:access_token",subjectToken:tok,subjectTokenType:"urn:ietf:params:oauth:token-type:jwt"})),"Google STS").access_token;',
658
+ // #4912: stsEndpoint is Google's STS, or its full token URL (terragucci's `token_url`).
659
+ 'const fed=json(await post(/\\/token$/.test(sts)?sts:sts+"/v1/token",{"content-type":"application/json"},JSON.stringify({grantType:"urn:ietf:params:oauth:grant-type:token-exchange",audience:"//iam.googleapis.com/"+c.provider,scope:"https://www.googleapis.com/auth/cloud-platform",requestedTokenType:"urn:ietf:params:oauth:token-type:access_token",subjectToken:tok,subjectTokenType:"urn:ietf:params:oauth:token-type:jwt"})),"Google STS").access_token;',
637
660
  'if(!clean(fed))throw new Error("Google STS gave no token");',
638
661
  'for(const sa of ids("gcp")){',
639
662
  'const at=json(await post(iam+"/v1/projects/-/serviceAccounts/"+encodeURIComponent(sa)+":generateAccessToken",{"content-type":"application/json",authorization:"Bearer "+fed},JSON.stringify({scope:["https://www.googleapis.com/auth/cloud-platform"]})),"IAM credentials").accessToken;',
@@ -665,9 +688,11 @@ export const TRADE_JS = [
665
688
  'const doc={version:1,clouds:{}};for(const c of clouds){const s=spec[c];doc.clouds[c]={...(s[KEY[c]]?{default:s[KEY[c]]}:{}),targets:(s.targets||[]).map((t)=>({targets:t.targets,identity:t[KEY[c]]})),vars:by[c]}}',
666
689
  'const tf=trim(process.env.RUNNER_TEMP||process.env.TMPDIR||"/tmp")+"/chant-cloud-targets-"+require("crypto").randomBytes(8).toString("hex")+".json";',
667
690
  `fs.writeFileSync(tf,JSON.stringify(doc),{mode:0o600,flag:"wx"});vars.${CLOUD_TARGETS_ENV}=tf}`,
691
+ // #4930: which clouds this job traded, so a product tells the trade's targets file from a login's.
692
+ `if(clouds.length)vars.${CLOUD_TRADED_ENV}=clouds.join(",");`,
668
693
  'for(const [k,v] of Object.entries(vars))if(!clean(v))throw new Error(k+" is not a value the job can hold");',
669
694
  'if(format==="github-env"){for(const s of secrets)console.log("::add-mask::"+s);fs.appendFileSync(out,Object.entries(vars).map(([k,v])=>k+"="+v+"\\n").join(""))}',
670
- 'else fs.writeFileSync(out,Object.entries(vars).map(([k,v])=>"export "+k+"="+Q+v.split(Q).join(Q+"\\\\"+Q+Q)+Q+"\\n").join(""),{mode:0o600});',
695
+ 'else{const sh=Object.entries(vars).map(([k,v])=>"export "+k+"="+Q+v.split(Q).join(Q+"\\\\"+Q+Q)+Q+"\\n").join("");if(out==="-")process.stdout.write(sh);else fs.writeFileSync(out,sh,{mode:0o600})}',
671
696
  'for(const s of said)console.error("chant: traded the job\\u0027s OIDC token for "+s)};',
672
697
  "run().catch((e)=>fail(e&&e.message?e.message:String(e)));",
673
698
  ].join("");
@@ -681,19 +706,30 @@ export function tradeLine(out: string, format: TradeFormat): string {
681
706
  return `(cd / && node -e '${TRADE_JS}' "${out}" ${format})`;
682
707
  }
683
708
 
684
- /** The GitLab file the trade writes and the plan script sources, outside the project directory. */
709
+ /**
710
+ * The file GitLab's trade wrote and sourced before #4912. `gitlabTradeLines`
711
+ * writes none now; kept for a product that names it.
712
+ * @deprecated `gitlabTradeLines` captures the trade's `export` lines in {@link GITLAB_TRADE_VARS}.
713
+ */
685
714
  export const GITLAB_TRADE_FILE = "${TMPDIR:-/tmp}/chant-cloud-$CI_JOB_ID.sh";
686
715
 
716
+ /** The shell variable GitLab's script holds the trade's `export` lines in until it evaluates them (#4912), as ci-login's `CHANT_CLOUD_LOGIN_VARS`. Not exported, so no child sees it. */
717
+ export const GITLAB_TRADE_VARS = "CHANT_CLOUD_TRADE_VARS";
718
+
687
719
  /**
688
720
  * The lines a GitLab job's script starts with when it trades: the trade,
689
- * the unset of the token variables (and, with `extraUnset`, the forge
690
- * tokens'), and the source of what the trade wrote, which it then deletes.
721
+ * its `export` lines captured in {@link GITLAB_TRADE_VARS}, the unset of
722
+ * the token variables (and, with `extraUnset`, the forge tokens'), and the
723
+ * evaluation of what the trade printed, then the unset of the variable
724
+ * that held it. No file of credentials is written (#4912), as ci-login's
725
+ * `gitlabCloudLogin`. An assignment's status is its command substitution's,
726
+ * so a failed trade stops the script.
691
727
  */
692
728
  export function gitlabTradeLines(extraUnset: readonly string[] = []): string[] {
693
729
  return [
694
- tradeLine(GITLAB_TRADE_FILE, "sh"),
730
+ `${GITLAB_TRADE_VARS}="$${tradeLine("-", "sh")}"`,
695
731
  `unset ${[...extraUnset, ...OIDC_REQUEST_VARS].join(" ")}`,
696
- `. "${GITLAB_TRADE_FILE}" && rm -f "${GITLAB_TRADE_FILE}"`,
732
+ `eval "$${GITLAB_TRADE_VARS}"; unset ${GITLAB_TRADE_VARS}`,
697
733
  ];
698
734
  }
699
735
 
@@ -702,6 +738,9 @@ export function gitlabTradeIdTokens(spec: CloudTradeSpec): Record<string, { aud:
702
738
  return Object.fromEntries(tradedClouds(spec).map((c) => [idTokenVar(c), { aud: spec[c]!.audience }]));
703
739
  }
704
740
 
741
+ /** The AWS region variables, which {@link targetCloudEnv} replaces only when the target's identity sets them. */
742
+ const JOB_REGION_VARS: ReadonlySet<string> = new Set(["AWS_REGION", "AWS_DEFAULT_REGION"]);
743
+
705
744
  /**
706
745
  * `env` for one target's tool (#4332): the job's environment with each
707
746
  * cloud's credentials replaced by those of the identity `target` takes, as
@@ -722,7 +761,8 @@ export function targetCloudEnv(env: Readonly<Record<string, string | undefined>>
722
761
  if (id === undefined || id === c.default) continue;
723
762
  const vars = c.vars[id];
724
763
  if (!vars) throw new Error(`${CLOUD_TARGETS_ENV} (${path}) holds no ${cloud} credentials for ${id}`);
725
- for (const k of TRADED_VARS[cloud]) delete out[k];
764
+ // The region is the job's, not the identity's: a login that names none (#4930) leaves the job's in place, and a trade's identity sets its own.
765
+ for (const k of TRADED_VARS[cloud]) if (!JOB_REGION_VARS.has(k)) delete out[k];
726
766
  Object.assign(out, vars);
727
767
  }
728
768
  return out;
@@ -7,7 +7,10 @@ import { crc32, deflateRawSync, gzipSync } from "node:zlib";
7
7
  import { describe, expect, test } from "vitest";
8
8
  import {
9
9
  CI_BASE_IMAGES,
10
+ CI_IMAGE_DOCKER_STAGES_FLOOR,
10
11
  CI_IMAGE_FLOOR,
12
+ CI_IMAGE_NON_ROOT_FLOOR,
13
+ CI_TOOL_NODE_DOWNLOAD_FLOOR,
11
14
  CI_TOOL_DOCKER_ARCH,
12
15
  CI_TOOL_SHA256,
13
16
  CI_TOOLS,
@@ -55,8 +58,8 @@ function tarGz(files: Record<string, string>): Uint8Array {
55
58
  return gzipSync(Buffer.concat(blocks));
56
59
  }
57
60
 
58
- /** A zip of `files`, deflated, with a central directory, as a release's `.zip` holds them. */
59
- function zip(files: Record<string, string>): Uint8Array {
61
+ /** A zip of `files`, deflated, with a central directory, as a release's `.zip` holds them; `modes` gives an entry its Unix mode, as the AWS CLI's installer has. */
62
+ function zip(files: Record<string, string>, modes: Record<string, number> = {}): Uint8Array {
60
63
  const locals: Buffer[] = [];
61
64
  const centrals: Buffer[] = [];
62
65
  let offset = 0;
@@ -81,6 +84,11 @@ function zip(files: Record<string, string>): Uint8Array {
81
84
  central.writeUInt32LE(data.length, 20);
82
85
  central.writeUInt32LE(raw.length, 24);
83
86
  central.writeUInt16LE(n.length, 28);
87
+ if (modes[name] !== undefined) {
88
+ // Made by Unix (3), with the mode in the external attributes' high half.
89
+ central.writeUInt16LE((3 << 8) | 20, 4);
90
+ central.writeUInt32LE(((0o100000 | modes[name]!) << 16) >>> 0, 38);
91
+ }
84
92
  central.writeUInt32LE(offset, 42);
85
93
  locals.push(local, n, data);
86
94
  centrals.push(central, n);
@@ -132,6 +140,40 @@ function runShell(script: string, fixtures: Record<string, Uint8Array | string>,
132
140
  return { status: r.status ?? -1, stderr: r.stderr, urls: existsSync(log) ? readFileSync(log, "utf-8").trim().split("\n") : [] };
133
141
  }
134
142
 
143
+ /**
144
+ * Runs a fetch script as a job with no curl and no unzip would (#4952):
145
+ * both are on PATH as commands that fail, and node's `fetch` is replaced,
146
+ * through `NODE_OPTIONS=--import`, by one that serves the fixtures by the
147
+ * URL's last segment.
148
+ */
149
+ function runNodeShell(script: string, fixtures: Record<string, Uint8Array | string>, env: Record<string, string> = {}): { status: number; stderr: string; urls: string[] } {
150
+ const dir = tmp();
151
+ const serve = join(dir, "serve");
152
+ const bin = join(dir, "bin");
153
+ mkdirSync(serve);
154
+ mkdirSync(bin);
155
+ for (const [name, body] of Object.entries(fixtures)) writeFileSync(join(serve, name), body);
156
+ const log = join(dir, "urls");
157
+ for (const missing of ["curl", "unzip"]) {
158
+ writeFileSync(join(bin, missing), `#!/bin/sh\necho "${missing}: not in this image" >&2\nexit 127\n`);
159
+ chmodSync(join(bin, missing), 0o755);
160
+ }
161
+ const preload = join(dir, "fetch.mjs");
162
+ writeFileSync(
163
+ preload,
164
+ [
165
+ 'import { appendFileSync, existsSync, readFileSync } from "node:fs";',
166
+ "globalThis.fetch = async (url) => {",
167
+ ` appendFileSync(${JSON.stringify(log)}, String(url) + "\\n");`,
168
+ ` const f = ${JSON.stringify(serve)} + "/" + String(url).split("/").pop();`,
169
+ ' return existsSync(f) ? new Response(readFileSync(f)) : new Response("not found", { status: 404 });',
170
+ "};",
171
+ ].join("\n"),
172
+ );
173
+ const r = spawnSync("sh", ["-c", `set -e; ${script}`], { env: { ...process.env, PATH: `${bin}:${process.env.PATH}`, NODE_OPTIONS: `--import ${preload}`, ...env }, encoding: "utf-8" });
174
+ return { status: r.status ?? -1, stderr: r.stderr, urls: existsSync(log) ? readFileSync(log, "utf-8").trim().split("\n") : [] };
175
+ }
176
+
135
177
  describe("ciToolRelease", () => {
136
178
  test("names each release file and its checksums file per architecture", () => {
137
179
  expect(ciToolRelease("tofu", "1.13.1", "arm64")).toMatchObject({
@@ -163,8 +205,11 @@ describe("ciToolRelease", () => {
163
205
  expect(() => ciToolSha256("tofu", "1.13.1", { amd64: "nothex" })).toThrow(/64 lower-case hex/);
164
206
  });
165
207
 
166
- test("CI_IMAGE_FLOOR is the next release", () => {
167
- expect(CI_IMAGE_FLOOR).toBe(NEXT_RELEASE);
208
+ test("CI_IMAGE_FLOOR is the release that shipped it, and #4908's and #4932's floors theirs", () => {
209
+ expect(CI_IMAGE_FLOOR).toBe("0.124.86");
210
+ expect(CI_IMAGE_NON_ROOT_FLOOR).toBe("0.124.88");
211
+ expect(CI_IMAGE_DOCKER_STAGES_FLOOR).toBe("0.124.88");
212
+ expect(CI_TOOL_NODE_DOWNLOAD_FLOOR).toBe(NEXT_RELEASE);
168
213
  });
169
214
  });
170
215
 
@@ -227,24 +272,25 @@ describe("ciToolFetchScript against local fixtures", () => {
227
272
  const binary = Buffer.from("#!/bin/sh\necho just\n");
228
273
  const archiveJust = tarGz({ just: binary.toString() });
229
274
  const out = tmp();
230
- const script = ciToolFetchScript("just", "1.36.0", { dir: `${out}/d`, arch: CI_TOOL_DOCKER_ARCH, sha256: { amd64: sha(archiveJust), arm64: "2".repeat(64) } });
275
+ // just publishes a checksums file from 1.35.0 (#4952), so an older release is checked on its recorded sha256.
276
+ const script = ciToolFetchScript("just", "1.34.0", { dir: `${out}/d`, arch: CI_TOOL_DOCKER_ARCH, sha256: { amd64: sha(archiveJust), arm64: "2".repeat(64) } });
231
277
  expect(script).not.toContain("sums");
232
- expect(runShell(script, { "just-1.36.0-x86_64-unknown-linux-musl.tar.gz": archiveJust }, { TARGETARCH: "amd64" }).status).toBe(0);
278
+ expect(runShell(script, { "just-1.34.0-x86_64-unknown-linux-musl.tar.gz": archiveJust }, { TARGETARCH: "amd64" }).status).toBe(0);
233
279
  expect(readFileSync(`${out}/d/just`, "utf-8")).toContain("echo just");
234
- const r = runShell(script, { "just-1.36.0-aarch64-unknown-linux-musl.tar.gz": archiveJust }, { TARGETARCH: "arm64" });
280
+ const r = runShell(script, { "just-1.34.0-aarch64-unknown-linux-musl.tar.gz": archiveJust }, { TARGETARCH: "arm64" });
235
281
  expect(r.status).not.toBe(0);
236
282
  });
237
283
 
238
284
  test("a bare binary, and a zip's member, install as the command", () => {
239
285
  const tg = Buffer.from("#!/bin/sh\necho terragrunt\n");
240
286
  const out = tmp();
241
- const s1 = ciToolFetchScript("terragrunt", "1.2.0", { dir: `${out}/tg`, arch: CI_TOOL_DOCKER_ARCH });
287
+ const s1 = ciToolFetchScript("terragrunt", "1.1.0", { dir: `${out}/tg`, arch: CI_TOOL_DOCKER_ARCH });
242
288
  expect(runShell(s1, { terragrunt_linux_arm64: tg, SHA256SUMS: `${sha(tg)} *terragrunt_linux_arm64\n` }, { TARGETARCH: "arm64" }).status).toBe(0);
243
289
  expect(readFileSync(`${out}/tg/terragrunt`, "utf-8")).toContain("echo terragrunt");
244
290
 
245
291
  const z = zip({ terraform: "#!/bin/sh\necho terraform\n", "LICENSE.txt": "x" });
246
- const s2 = ciToolFetchScript("terraform", "1.14.9", { dir: `${out}/tf`, arch: CI_TOOL_DOCKER_ARCH });
247
- const r = runShell(s2, { "terraform_1.14.9_linux_amd64.zip": z, "terraform_1.14.9_SHA256SUMS": `${sha(z)} terraform_1.14.9_linux_amd64.zip\n` }, { TARGETARCH: "amd64" });
292
+ const s2 = ciToolFetchScript("terraform", "1.14.8", { dir: `${out}/tf`, arch: CI_TOOL_DOCKER_ARCH });
293
+ const r = runShell(s2, { "terraform_1.14.8_linux_amd64.zip": z, "terraform_1.14.8_SHA256SUMS": `${sha(z)} terraform_1.14.8_linux_amd64.zip\n` }, { TARGETARCH: "amd64" });
248
294
  expect(r.stderr).toBe("");
249
295
  expect(readFileSync(`${out}/tf/terraform`, "utf-8")).toContain("echo terraform");
250
296
  });
@@ -257,8 +303,8 @@ describe("ciToolFetchScript against local fixtures", () => {
257
303
  });
258
304
 
259
305
  test("refuses, before any shell, a release that needs a recorded sha256 it lacks", () => {
260
- expect(() => ciToolFetchScript("act", "0.2.89", { dir: "/out/act" })).toThrow(/no recorded sha256 for act 0.2.89 on amd64 and arm64; act's release publishes no checksums file/);
261
- expect(() => ciToolFetchScript("terragrunt", "1.2.0", { dir: "/out/tg", requirePin: true })).toThrow(/no recorded sha256 for terragrunt 1.2.0/);
306
+ expect(() => ciToolFetchScript("just", "1.34.0", { dir: "/out/just" })).toThrow(/no recorded sha256 for just 1.34.0 on amd64 and arm64; just's release publishes no checksums file/);
307
+ expect(() => ciToolFetchScript("terragrunt", "1.1.0", { dir: "/out/tg", requirePin: true })).toThrow(/no recorded sha256 for terragrunt 1.1.0/);
262
308
  expect(() => ciToolFetchScript("tofu", "1.13.1", { dir: "/out/x y" })).toThrow(/absolute path/);
263
309
  });
264
310
  });
@@ -285,6 +331,131 @@ describe("ciToolInstallLine", () => {
285
331
  });
286
332
  });
287
333
 
334
+ describe("non-root job lines (#4908)", () => {
335
+ test("sudo writes the tool root and the link, and leaves the download and the check to the job's user", () => {
336
+ const line = ciToolInstallLine("tofu", "1.13.1", { sudo: true });
337
+ expect(line).toContain('sudo mkdir -p "/opt/chant/tofu-1.13.1"');
338
+ expect(line).toContain('sudo install -m 0755 "$t/tofu" "/opt/chant/tofu-1.13.1/tofu"');
339
+ expect(line.endsWith('sudo ln -sf "/opt/chant/tofu-1.13.1/tofu" /usr/local/bin/tofu')).toBe(true);
340
+ expect(line).not.toContain("sudo curl");
341
+ expect(line).not.toContain("sudo sha256sum");
342
+ expect(ciToolFetchScript("pulumi", "3.272.0", { dir: "/opt/p/pulumi-3.272.0", sudo: true })).toContain('sudo tar -xzf "$t/$f" -C "/opt/p/pulumi-3.272.0" --strip-components=1');
343
+ expect(ciToolInstallLine("aws-cli", "2.37.9", { sudo: true })).toContain('sudo "$t/aws/install" -i "/opt/chant/aws-cli-2.37.9" -b "/opt/chant/aws-cli-2.37.9/bin"');
344
+ expect(ciToolInstallLine("tofu", "1.13.1")).not.toContain("sudo");
345
+ });
346
+
347
+ test("a root and a binDir under a variable the job expands, quoted", () => {
348
+ const line = ciToolInstallLine("aws-cli", "2.37.9", { root: "$RUNNER_TEMP/chant-tools", binDir: "${HOME}/.local/bin/" });
349
+ expect(line.startsWith('{ [ -x "$RUNNER_TEMP/chant-tools/aws-cli-2.37.9/v2/current/bin/aws" ] || (set -e;')).toBe(true);
350
+ expect(line.endsWith('mkdir -p "${HOME}/.local/bin" && ln -sf "$RUNNER_TEMP/chant-tools/aws-cli-2.37.9/v2/current/bin/aws" "${HOME}/.local/bin/aws"')).toBe(true);
351
+ expect(ciToolBin("tofu", "1.13.1", "$RUNNER_TEMP/t")).toBe("$RUNNER_TEMP/t/tofu-1.13.1/tofu");
352
+ expect(() => ciToolInstallLine("tofu", "1.13.1", { root: "$(id)/x" })).toThrow(/tool root/);
353
+ expect(() => ciToolInstallLine("tofu", "1.13.1", { root: "relative/x" })).toThrow(/tool root/);
354
+ expect(() => ciToolInstallLine("tofu", "1.13.1", { binDir: "$HOME x" })).toThrow(/binDir/);
355
+ // An image's COPY expands no shell variable.
356
+ expect(() => productImageStages({ name: "p", product: "p", description: "d", source: "s", toolRoot: "$HOME/t", tools: [{ tool: "tofu", version: "1.13.1" }], bundle: { file: "a", bin: "a" } })).toThrow(/toolRoot/);
357
+ });
358
+
359
+ test("runs as a user: installs under a variable root and links into a variable binDir", () => {
360
+ const a = tarGz({ tofu: "#!/bin/sh\necho user-install\n" });
361
+ const home = tmp();
362
+ const line = ciToolInstallLine("tofu", "1.13.1", { root: "$TOOLS/t", binDir: "$TOOLS/bin", sha256: { amd64: sha(a), arm64: sha(a) } });
363
+ const files = { "tofu_1.13.1_linux_amd64.tar.gz": a, "tofu_1.13.1_linux_arm64.tar.gz": a, "tofu_1.13.1_SHA256SUMS": `${sha(a)} tofu_1.13.1_linux_amd64.tar.gz\n${sha(a)} tofu_1.13.1_linux_arm64.tar.gz\n` };
364
+ const r = runShell(line, files, { TOOLS: home });
365
+ expect(r.stderr).toBe("");
366
+ expect(r.status).toBe(0);
367
+ expect(readFileSync(`${home}/bin/tofu`, "utf-8")).toContain("echo user-install");
368
+ });
369
+
370
+ test("chant records terragucci's terraform and terragrunt pins and its drift job's AWS CLI", () => {
371
+ expect(ciToolSha256("terraform", "1.14.9")).toEqual({ amd64: "2e5cffc20a0b48a67a76268723bd5a10b8666f69b2aa4f04906e206726bedd63", arm64: "863002085b886453795d9ff4b8989b8468784478150b70ba8a1df3e3ad66da99" });
372
+ expect(ciToolSha256("terragrunt", "1.2.0")).toEqual({ amd64: "45b6df8a8494c8cfe34b4abf919e894709557163e4d3b5704d11083002ab787a", arm64: "b069ce4310572bc46ee6f057057acc4bc6a9077ef8687e157a64b0551290a371" });
373
+ expect(ciToolSha256("aws-cli", "2.37.9")).toEqual({ amd64: "6b3a6a3d7bb3997928f0bdf7b866914224abf242c2e54e1dcebbe84bee64f356", arm64: "e7d2cca3622af4765871fe9ce7eeed03acd09dca10a99ebc46e92f79d78765c0" });
374
+ // So an image carries them with no sums of the product's, and a job line can require the pin.
375
+ expect(() => productImageStages({ name: "t", product: "t", description: "d", source: "s", tools: [{ tool: "terraform", version: "1.14.9" }, { tool: "terragrunt", version: "1.2.0" }], bundle: { file: "a", bin: "a" } })).not.toThrow();
376
+ expect(ciToolInstallLine("terragrunt", "1.2.0", { requirePin: true, sudo: true, link: false })).toContain("want=45b6df8a");
377
+ });
378
+ });
379
+
380
+ describe("a job with no curl or unzip (#4952)", () => {
381
+ test("download: node fetches and checks a release with node, and the line names neither tool", () => {
382
+ const a = tarGz({ tofu: "#!/bin/sh\necho node-fetched\n" });
383
+ const root = tmp();
384
+ const line = ciToolInstallLine("tofu", "1.13.1", { root, link: false, download: "node", sha256: { amd64: sha(a), arm64: sha(a) } });
385
+ expect(line).not.toMatch(/\bcurl\b|\bunzip\b/);
386
+ const files = { "tofu_1.13.1_linux_amd64.tar.gz": a, "tofu_1.13.1_linux_arm64.tar.gz": a, "tofu_1.13.1_SHA256SUMS": `${sha(a)} tofu_1.13.1_linux_amd64.tar.gz\n${sha(a)} tofu_1.13.1_linux_arm64.tar.gz\n` };
387
+ const r = runNodeShell(line, files);
388
+ expect(r.stderr).toBe("");
389
+ expect(r.status).toBe(0);
390
+ expect(readFileSync(`${root}/tofu-1.13.1/tofu`, "utf-8")).toContain("echo node-fetched");
391
+ expect(r.urls).toHaveLength(2);
392
+ });
393
+
394
+ test("download: node fails a tampered archive and a missing file, and installs nothing", () => {
395
+ const a = tarGz({ tofu: "#!/bin/sh\n" });
396
+ const out = tmp();
397
+ const script = ciToolFetchScript("tofu", "1.13.1", { dir: `${out}/d`, arch: CI_TOOL_DOCKER_ARCH, download: "node", sha256: { amd64: sha(a), arm64: sha(a) } });
398
+ const sums = `${sha(a)} tofu_1.13.1_linux_amd64.tar.gz\n`;
399
+ expect(runNodeShell(script, { "tofu_1.13.1_linux_amd64.tar.gz": tarGz({ tofu: "evil" }), "tofu_1.13.1_SHA256SUMS": sums }, { TARGETARCH: "amd64" }).status).not.toBe(0);
400
+ const missing = runNodeShell(script, { "tofu_1.13.1_SHA256SUMS": sums }, { TARGETARCH: "amd64" });
401
+ expect(missing.status).not.toBe(0);
402
+ expect(missing.stderr).toContain("tofu_1.13.1_linux_amd64.tar.gz: HTTP 404");
403
+ expect(existsSync(`${out}/d/tofu`)).toBe(false);
404
+ });
405
+
406
+ test("download: node unpacks a zip's member, and the AWS CLI's whole zip for its installer", () => {
407
+ const out = tmp();
408
+ const z = zip({ terraform: "#!/bin/sh\necho terraform\n", "LICENSE.txt": "x" });
409
+ const s1 = ciToolFetchScript("terraform", "1.14.8", { dir: `${out}/tf`, arch: CI_TOOL_DOCKER_ARCH, download: "node" });
410
+ const r1 = runNodeShell(s1, { "terraform_1.14.8_linux_amd64.zip": z, "terraform_1.14.8_SHA256SUMS": `${sha(z)} terraform_1.14.8_linux_amd64.zip\n` }, { TARGETARCH: "amd64" });
411
+ expect(r1.stderr).toBe("");
412
+ expect(readFileSync(`${out}/tf/terraform`, "utf-8")).toContain("echo terraform");
413
+
414
+ // The installer writes the binary where `-i` points, as the AWS CLI's does.
415
+ const installer = '#!/bin/sh\nmkdir -p "$2/v2/current/bin"\ncp "$(dirname "$0")/dist/aws" "$2/v2/current/bin/aws"\n';
416
+ const aws = zip({ "aws/": "", "aws/install": installer, "aws/dist/aws": "#!/bin/sh\necho aws-cli\n" }, { "aws/install": 0o755, "aws/dist/aws": 0o755 });
417
+ const root = tmp();
418
+ const line = ciToolInstallLine("aws-cli", "2.37.9", { root, link: false, download: "node", sha256: { amd64: sha(aws), arm64: sha(aws) } });
419
+ expect(line).not.toMatch(/\bcurl\b|\bunzip\b/);
420
+ const r2 = runNodeShell(line, { "awscli-exe-linux-x86_64-2.37.9.zip": aws, "awscli-exe-linux-aarch64-2.37.9.zip": aws });
421
+ expect(r2.stderr).toBe("");
422
+ expect(r2.status).toBe(0);
423
+ expect(spawnSync(`${root}/aws-cli-2.37.9/v2/current/bin/aws`, { encoding: "utf-8" }).stdout).toBe("aws-cli\n");
424
+ });
425
+
426
+ test("curl stays the default, and download names curl or node only", () => {
427
+ expect(ciToolInstallLine("tofu", "1.13.1")).toContain("curl -fsSLo");
428
+ expect(() => ciToolFetchScript("tofu", "1.13.1", { dir: "/out/t", download: "wget" as never })).toThrow(/download is curl or node/);
429
+ });
430
+ });
431
+
432
+ describe("just's and act's checksums files and recorded sums (#4952)", () => {
433
+ test("just 1.36.0 and act 0.2.89 are recorded, copied from the releases' checksums files", () => {
434
+ expect(ciToolSha256("just", "1.36.0")).toEqual({ amd64: "bc7c9f377944f8de9cd0418b11d2955adebfa25a488c0b5e3dd2d2c0e9d732da", arm64: "bb3886b15e2cbcb9c0eb19956297d36de4eaef45b89d3f5fa5d1fc4ed3b5b51d" });
435
+ expect(ciToolSha256("act", "0.2.89")).toEqual({ amd64: "0191d6f1f3b716b5c55820032605d05fc3c1cdbf581ebeff655019e5dd1524c0", arm64: "daa8679ba9615a74d2d0cec321dc593f21948a2a11bb65862b063d8b930f4bcb" });
436
+ expect(() => ciToolInstallLine("just", "1.36.0", { requirePin: true })).not.toThrow();
437
+ expect(() => ciToolInstallLine("act", "0.2.89", { requirePin: true })).not.toThrow();
438
+ });
439
+
440
+ test("each is checked against its release's checksums file: just's per file to 1.36.0, SHA256SUMS from 1.37.0, act's checksums.txt", () => {
441
+ expect(ciToolRelease("just", "1.36.0", "amd64").checksumsUrl).toBe("https://github.com/casey/just/releases/download/1.36.0/just-1.36.0-x86_64-unknown-linux-musl.tar.gz.sha256sum");
442
+ expect(ciToolRelease("just", "1.35.0", "arm64").checksums).toBe("just-1.35.0-aarch64-unknown-linux-musl.tar.gz.sha256sum");
443
+ expect(ciToolRelease("just", "1.37.0", "amd64").checksumsUrl).toBe("https://github.com/casey/just/releases/download/1.37.0/SHA256SUMS");
444
+ expect(ciToolRelease("just", "1.34.0", "amd64").checksumsUrl).toBeUndefined();
445
+ expect(ciToolRelease("act", "0.2.89", "arm64").checksumsUrl).toBe("https://github.com/nektos/act/releases/download/v0.2.89/checksums.txt");
446
+ });
447
+
448
+ test("the shell reads just's per-file checksums file", () => {
449
+ const a = tarGz({ just: "#!/bin/sh\necho just\n" });
450
+ const out = tmp();
451
+ const s = ciToolFetchScript("just", "1.36.0", { dir: `${out}/j`, arch: CI_TOOL_DOCKER_ARCH, sha256: { amd64: sha(a), arm64: sha(a) } });
452
+ const r = runShell(s, { "just-1.36.0-x86_64-unknown-linux-musl.tar.gz": a, "just-1.36.0-x86_64-unknown-linux-musl.tar.gz.sha256sum": `${sha(a)} just-1.36.0-x86_64-unknown-linux-musl.tar.gz\n` }, { TARGETARCH: "amd64" });
453
+ expect(r.stderr).toBe("");
454
+ expect(r.urls[1]).toBe("https://github.com/casey/just/releases/download/1.36.0/just-1.36.0-x86_64-unknown-linux-musl.tar.gz.sha256sum");
455
+ expect(readFileSync(`${out}/j/just`, "utf-8")).toContain("echo just");
456
+ });
457
+ });
458
+
288
459
  describe("installCiTool", () => {
289
460
  const a = tarGz({ tofu: "#!/bin/sh\necho node-install\n" });
290
461
  const base = "https://github.com/opentofu/opentofu/releases/download/v1.13.1";
@@ -332,9 +503,9 @@ describe("installCiTool", () => {
332
503
  test("unpacks a zip's member, a bare binary and a tree", async () => {
333
504
  const root = tmp();
334
505
  const z = zip({ terraform: "tf" });
335
- const tf = "https://releases.hashicorp.com/terraform/1.14.9";
336
- await installCiTool("terraform", "1.14.9", { ...opts, root, download: served({ [`${tf}/terraform_1.14.9_linux_amd64.zip`]: z, [`${tf}/terraform_1.14.9_SHA256SUMS`]: `${sha(z)} terraform_1.14.9_linux_amd64.zip\n` }).download });
337
- expect(readFileSync(join(root, "terraform-1.14.9", "terraform"), "utf-8")).toBe("tf");
506
+ const tf = "https://releases.hashicorp.com/terraform/1.14.8";
507
+ await installCiTool("terraform", "1.14.8", { ...opts, root, download: served({ [`${tf}/terraform_1.14.8_linux_amd64.zip`]: z, [`${tf}/terraform_1.14.8_SHA256SUMS`]: `${sha(z)} terraform_1.14.8_linux_amd64.zip\n` }).download });
508
+ expect(readFileSync(join(root, "terraform-1.14.8", "terraform"), "utf-8")).toBe("tf");
338
509
 
339
510
  const cosign = Buffer.from("cosign");
340
511
  const cb = "https://github.com/sigstore/cosign/releases/download/v2.6.5";
@@ -407,7 +578,7 @@ describe("productImageStages", () => {
407
578
  });
408
579
 
409
580
  test("an image refuses an engine with no recorded sha256", () => {
410
- expect(() => productImageStages({ ...terragucci, tools: [{ tool: "terragrunt", version: "1.2.0" }] })).toThrow(/no recorded sha256 for terragrunt 1.2.0 on amd64 and arm64/);
581
+ expect(() => productImageStages({ ...terragucci, tools: [{ tool: "terragrunt", version: "1.1.0" }] })).toThrow(/no recorded sha256 for terragrunt 1.1.0 on amd64 and arm64/);
411
582
  expect(() => productImageStages({ ...terragucci, tools: [{ tool: "tofu", version: "1.13.1" }, { tool: "tofu", version: "1.13.1" }] })).toThrow(/listed twice/);
412
583
  });
413
584