@intentius/chant 0.124.88 → 0.124.90

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 (377) hide show
  1. package/dist/actor.d.ts +36 -1
  2. package/dist/actor.d.ts.map +1 -1
  3. package/dist/actor.js +39 -1
  4. package/dist/chant-install.d.ts.map +1 -1
  5. package/dist/chant-install.js +1 -2
  6. package/dist/ci-base.d.ts +30 -0
  7. package/dist/ci-base.d.ts.map +1 -0
  8. package/dist/ci-base.js +33 -0
  9. package/dist/ci-comment-commands.d.ts +193 -0
  10. package/dist/ci-comment-commands.d.ts.map +1 -0
  11. package/dist/ci-comment-commands.js +353 -0
  12. package/dist/ci-comment-replies.d.ts +40 -0
  13. package/dist/ci-comment-replies.d.ts.map +1 -0
  14. package/dist/ci-comment-replies.js +59 -0
  15. package/dist/ci-evidence-from-job.d.ts +25 -0
  16. package/dist/ci-evidence-from-job.d.ts.map +1 -1
  17. package/dist/ci-evidence-from-job.js +43 -2
  18. package/dist/ci-evidence-jobs.d.ts +30 -1
  19. package/dist/ci-evidence-jobs.d.ts.map +1 -1
  20. package/dist/ci-evidence-jobs.js +46 -3
  21. package/dist/ci-image.d.ts +21 -4
  22. package/dist/ci-image.d.ts.map +1 -1
  23. package/dist/ci-image.js +62 -10
  24. package/dist/ci-job-guard.d.ts +42 -45
  25. package/dist/ci-job-guard.d.ts.map +1 -1
  26. package/dist/ci-job-guard.js +206 -3
  27. package/dist/ci-note-commands.d.ts +104 -4
  28. package/dist/ci-note-commands.d.ts.map +1 -1
  29. package/dist/ci-note-commands.js +131 -38
  30. package/dist/ci-product-words.d.ts +42 -0
  31. package/dist/ci-product-words.d.ts.map +1 -1
  32. package/dist/ci-product-words.js +25 -0
  33. package/dist/ci-product.d.ts +72 -1
  34. package/dist/ci-product.d.ts.map +1 -1
  35. package/dist/ci-product.js +73 -6
  36. package/dist/cli/commands/build.d.ts.map +1 -1
  37. package/dist/cli/commands/build.js +29 -2
  38. package/dist/cli/handlers/approve.d.ts.map +1 -1
  39. package/dist/cli/handlers/approve.js +2 -1
  40. package/dist/cli/handlers/ci-check.d.ts +1 -1
  41. package/dist/cli/handlers/ci-check.d.ts.map +1 -1
  42. package/dist/cli/handlers/ci-check.js +17 -7
  43. package/dist/cli/handlers/ci-evidence.d.ts.map +1 -1
  44. package/dist/cli/handlers/ci-evidence.js +33 -7
  45. package/dist/cli/handlers/components.d.ts.map +1 -1
  46. package/dist/cli/handlers/components.js +3 -1
  47. package/dist/cli/handlers/generated-check.d.ts +8 -0
  48. package/dist/cli/handlers/generated-check.d.ts.map +1 -1
  49. package/dist/cli/handlers/generated-check.js +31 -1
  50. package/dist/cli/handlers/lock.d.ts.map +1 -1
  51. package/dist/cli/handlers/lock.js +121 -4
  52. package/dist/cli/handlers/pr-comment.d.ts +33 -0
  53. package/dist/cli/handlers/pr-comment.d.ts.map +1 -0
  54. package/dist/cli/handlers/pr-comment.js +201 -0
  55. package/dist/cli/handlers/pr-env.d.ts.map +1 -1
  56. package/dist/cli/handlers/pr-env.js +6 -3
  57. package/dist/cli/handlers/pr-notes.d.ts.map +1 -1
  58. package/dist/cli/handlers/pr-notes.js +23 -1
  59. package/dist/cli/handlers/pr.d.ts +23 -1
  60. package/dist/cli/handlers/pr.d.ts.map +1 -1
  61. package/dist/cli/handlers/pr.js +71 -23
  62. package/dist/cli/handlers/promote.d.ts.map +1 -1
  63. package/dist/cli/handlers/promote.js +2 -1
  64. package/dist/cli/handlers/release.d.ts.map +1 -1
  65. package/dist/cli/handlers/release.js +11 -2
  66. package/dist/cli/handlers/run-wave.d.ts.map +1 -1
  67. package/dist/cli/handlers/run-wave.js +180 -4
  68. package/dist/cli/handlers/run.d.ts.map +1 -1
  69. package/dist/cli/handlers/run.js +2 -1
  70. package/dist/cli/main.d.ts.map +1 -1
  71. package/dist/cli/main.js +41 -2
  72. package/dist/cli/parse-args.d.ts.map +1 -1
  73. package/dist/cli/parse-args.js +31 -0
  74. package/dist/cli/registry.d.ts +19 -1
  75. package/dist/cli/registry.d.ts.map +1 -1
  76. package/dist/components/auto-release.d.ts.map +1 -1
  77. package/dist/components/auto-release.js +2 -1
  78. package/dist/components/pr-checks.d.ts +97 -6
  79. package/dist/components/pr-checks.d.ts.map +1 -1
  80. package/dist/components/pr-checks.js +107 -13
  81. package/dist/components/pr-pipeline.d.ts +19 -14
  82. package/dist/components/pr-pipeline.d.ts.map +1 -1
  83. package/dist/components/pr-pipeline.js +7 -13
  84. package/dist/components/product-pipeline.d.ts +96 -3
  85. package/dist/components/product-pipeline.d.ts.map +1 -1
  86. package/dist/components/product-pipeline.js +120 -14
  87. package/dist/components/product-plan.d.ts +203 -6
  88. package/dist/components/product-plan.d.ts.map +1 -1
  89. package/dist/components/product-plan.js +250 -43
  90. package/dist/drift-record.d.ts +7 -0
  91. package/dist/drift-record.d.ts.map +1 -1
  92. package/dist/drift-record.js +19 -0
  93. package/dist/floor-table.data.d.ts.map +1 -1
  94. package/dist/floor-table.data.js +63 -31
  95. package/dist/forge-check/contract.d.ts +11 -1
  96. package/dist/forge-check/contract.d.ts.map +1 -1
  97. package/dist/forge-check/contract.js +4 -1
  98. package/dist/forge-check/index.d.ts +2 -0
  99. package/dist/forge-check/index.d.ts.map +1 -1
  100. package/dist/forge-check/index.js +2 -0
  101. package/dist/gate-resume-run.d.ts +9 -1
  102. package/dist/gate-resume-run.d.ts.map +1 -1
  103. package/dist/gate-resume-run.js +26 -3
  104. package/dist/generated-check.d.ts +18 -4
  105. package/dist/generated-check.d.ts.map +1 -1
  106. package/dist/generated-check.js +37 -5
  107. package/dist/image-pins.d.ts +26 -0
  108. package/dist/image-pins.d.ts.map +1 -0
  109. package/dist/image-pins.js +19 -0
  110. package/dist/lexicon.d.ts +93 -4
  111. package/dist/lexicon.d.ts.map +1 -1
  112. package/dist/lifecycle/gate-applied.d.ts +9 -0
  113. package/dist/lifecycle/gate-applied.d.ts.map +1 -1
  114. package/dist/lifecycle/git.d.ts +11 -0
  115. package/dist/lifecycle/git.d.ts.map +1 -1
  116. package/dist/lifecycle/git.js +30 -3
  117. package/dist/lifecycle/publish-npm.d.ts +11 -0
  118. package/dist/lifecycle/publish-npm.d.ts.map +1 -1
  119. package/dist/lifecycle/publish-npm.js +27 -1
  120. package/dist/lifecycle/reach-locks.d.ts +131 -0
  121. package/dist/lifecycle/reach-locks.d.ts.map +1 -0
  122. package/dist/lifecycle/reach-locks.js +118 -0
  123. package/dist/lifecycle/release-cut.d.ts +3 -1
  124. package/dist/lifecycle/release-cut.d.ts.map +1 -1
  125. package/dist/lifecycle/release-cut.js +15 -0
  126. package/dist/lifecycle/release-images.d.ts.map +1 -1
  127. package/dist/lifecycle/release-images.js +1 -2
  128. package/dist/notify-product.d.ts +12 -3
  129. package/dist/notify-product.d.ts.map +1 -1
  130. package/dist/notify-product.js +10 -6
  131. package/dist/op/activities/source-release.d.ts.map +1 -1
  132. package/dist/op/activities/source-release.js +2 -1
  133. package/dist/op/activities/source-rollback.d.ts.map +1 -1
  134. package/dist/op/activities/source-rollback.js +2 -1
  135. package/dist/op/apply-status.d.ts +84 -0
  136. package/dist/op/apply-status.d.ts.map +1 -0
  137. package/dist/op/apply-status.js +106 -0
  138. package/dist/op/before-merge-decide.d.ts +102 -0
  139. package/dist/op/before-merge-decide.d.ts.map +1 -0
  140. package/dist/op/before-merge-decide.js +142 -0
  141. package/dist/op/before-merge-done.d.ts +56 -0
  142. package/dist/op/before-merge-done.d.ts.map +1 -0
  143. package/dist/op/before-merge-done.js +69 -0
  144. package/dist/op/before-merge-store.d.ts +20 -0
  145. package/dist/op/before-merge-store.d.ts.map +1 -0
  146. package/dist/op/before-merge-store.js +48 -0
  147. package/dist/op/before-merge.d.ts +150 -0
  148. package/dist/op/before-merge.d.ts.map +1 -0
  149. package/dist/op/before-merge.js +207 -0
  150. package/dist/op/follow-on-run.d.ts +117 -0
  151. package/dist/op/follow-on-run.d.ts.map +1 -0
  152. package/dist/op/follow-on-run.js +154 -0
  153. package/dist/op/follow-on-store.d.ts +17 -0
  154. package/dist/op/follow-on-store.d.ts.map +1 -0
  155. package/dist/op/follow-on-store.js +54 -0
  156. package/dist/op/gate.d.ts +6 -0
  157. package/dist/op/gate.d.ts.map +1 -1
  158. package/dist/op/gate.js +10 -1
  159. package/dist/op/index.d.ts +5 -1
  160. package/dist/op/index.d.ts.map +1 -1
  161. package/dist/op/index.js +2 -0
  162. package/dist/op/op-waves-after-plan.d.ts +13 -0
  163. package/dist/op/op-waves-after-plan.d.ts.map +1 -1
  164. package/dist/op/op-waves-evidence-jobs.d.ts +10 -2
  165. package/dist/op/op-waves-evidence-jobs.d.ts.map +1 -1
  166. package/dist/op/op-waves-evidence-jobs.js +19 -5
  167. package/dist/op/op-waves-follow-on.d.ts +162 -0
  168. package/dist/op/op-waves-follow-on.d.ts.map +1 -0
  169. package/dist/op/op-waves-follow-on.js +355 -0
  170. package/dist/op/op-waves-render-spec.d.ts +100 -0
  171. package/dist/op/op-waves-render-spec.d.ts.map +1 -0
  172. package/dist/op/op-waves-render-spec.js +162 -0
  173. package/dist/op/op-waves-run.d.ts +148 -6
  174. package/dist/op/op-waves-run.d.ts.map +1 -1
  175. package/dist/op/op-waves-run.js +873 -100
  176. package/dist/op/op-waves-split.d.ts +122 -0
  177. package/dist/op/op-waves-split.d.ts.map +1 -0
  178. package/dist/op/op-waves-split.js +166 -0
  179. package/dist/op/op-waves.d.ts +24 -0
  180. package/dist/op/op-waves.d.ts.map +1 -1
  181. package/dist/op/op-waves.js +18 -1
  182. package/dist/op/schedule-overdue.d.ts +15 -1
  183. package/dist/op/schedule-overdue.d.ts.map +1 -1
  184. package/dist/op/schedule-overdue.js +77 -5
  185. package/dist/op/stage-hooks.d.ts +36 -1
  186. package/dist/op/stage-hooks.d.ts.map +1 -1
  187. package/dist/op/stage-hooks.js +17 -3
  188. package/dist/op/wave-stop.d.ts +67 -0
  189. package/dist/op/wave-stop.d.ts.map +1 -0
  190. package/dist/op/wave-stop.js +129 -0
  191. package/dist/planned-files.d.ts +76 -0
  192. package/dist/planned-files.d.ts.map +1 -0
  193. package/dist/planned-files.js +108 -0
  194. package/dist/pr-forge-job.d.ts +22 -0
  195. package/dist/pr-forge-job.d.ts.map +1 -0
  196. package/dist/pr-forge-job.js +46 -0
  197. package/dist/pr-loop.d.ts +3 -6
  198. package/dist/pr-loop.d.ts.map +1 -1
  199. package/dist/pr-loop.js +4 -81
  200. package/dist/pr-plan-note.d.ts +97 -0
  201. package/dist/pr-plan-note.d.ts.map +1 -1
  202. package/dist/pr-plan-note.js +94 -1
  203. package/dist/pr-post.d.ts +28 -3
  204. package/dist/pr-post.d.ts.map +1 -1
  205. package/dist/pr-post.js +146 -13
  206. package/dist/pr-status.d.ts +16 -0
  207. package/dist/pr-status.d.ts.map +1 -0
  208. package/dist/pr-status.js +90 -0
  209. package/dist/ref-gate-init.d.ts +16 -2
  210. package/dist/ref-gate-init.d.ts.map +1 -1
  211. package/dist/ref-gate-init.js +24 -13
  212. package/dist/release-floors.d.ts +39 -1
  213. package/dist/release-floors.d.ts.map +1 -1
  214. package/dist/release-floors.js +63 -25
  215. package/dist/render-module.d.ts +15 -0
  216. package/dist/render-module.d.ts.map +1 -0
  217. package/dist/render-module.js +73 -0
  218. package/dist/state-migration.d.ts.map +1 -1
  219. package/dist/state-migration.js +1 -2
  220. package/dist/wave-blocked.d.ts +7 -1
  221. package/dist/wave-blocked.d.ts.map +1 -1
  222. package/dist/wave-blocked.js +7 -2
  223. package/dist/wave-runtime.mjs +366 -350
  224. package/dist/workspace/ci-green-cli.d.ts.map +1 -1
  225. package/dist/workspace/ci-green-cli.js +3 -2
  226. package/dist/workspace/release-train.d.ts.map +1 -1
  227. package/dist/workspace/release-train.js +2 -1
  228. package/dist/workspace/release-workflow.d.ts +4 -3
  229. package/dist/workspace/release-workflow.d.ts.map +1 -1
  230. package/dist/workspace/release-workflow.js +10 -7
  231. package/dist/workspace/trust/check-evidence-report.d.ts +7 -2
  232. package/dist/workspace/trust/check-evidence-report.d.ts.map +1 -1
  233. package/dist/workspace/trust/check-evidence-report.js +15 -8
  234. package/dist/workspace/trust/ref-gate-cli.d.ts +10 -1
  235. package/dist/workspace/trust/ref-gate-cli.d.ts.map +1 -1
  236. package/dist/workspace/trust/ref-gate-cli.js +30 -10
  237. package/dist/workspace/workspace-run.d.ts.map +1 -1
  238. package/dist/workspace/workspace-run.js +2 -1
  239. package/package.json +1 -1
  240. package/src/actor.test.ts +68 -2
  241. package/src/actor.ts +61 -1
  242. package/src/chant-install.test.ts +2 -3
  243. package/src/chant-install.ts +1 -2
  244. package/src/ci-base.test.ts +41 -0
  245. package/src/ci-base.ts +43 -0
  246. package/src/ci-comment-commands.test.ts +439 -0
  247. package/src/ci-comment-commands.ts +428 -0
  248. package/src/ci-comment-replies.ts +78 -0
  249. package/src/ci-commit.test.ts +2 -3
  250. package/src/ci-evidence-from-job.test.ts +18 -0
  251. package/src/ci-evidence-from-job.ts +58 -2
  252. package/src/ci-evidence-jobs.ts +50 -5
  253. package/src/ci-image.test.ts +130 -10
  254. package/src/ci-image.ts +85 -12
  255. package/src/ci-job-guard.before-merge.test.ts +148 -0
  256. package/src/ci-job-guard.follow-on-record.test.ts +137 -0
  257. package/src/ci-job-guard.follow-on.test.ts +144 -0
  258. package/src/ci-job-guard.ts +221 -3
  259. package/src/ci-note-commands.test.ts +76 -1
  260. package/src/ci-note-commands.ts +198 -46
  261. package/src/ci-product-words.ts +59 -0
  262. package/src/ci-product.ts +90 -6
  263. package/src/cli/commands/build.test.ts +41 -0
  264. package/src/cli/commands/build.ts +27 -2
  265. package/src/cli/handlers/approve.ts +2 -1
  266. package/src/cli/handlers/ci-check.ts +19 -7
  267. package/src/cli/handlers/ci-evidence.ts +29 -8
  268. package/src/cli/handlers/components.ts +3 -1
  269. package/src/cli/handlers/generated-check.ts +31 -1
  270. package/src/cli/handlers/lock-reach.test.ts +103 -0
  271. package/src/cli/handlers/lock.ts +100 -4
  272. package/src/cli/handlers/pr-comment.ts +187 -0
  273. package/src/cli/handlers/pr-env.ts +6 -3
  274. package/src/cli/handlers/pr-notes.ts +30 -6
  275. package/src/cli/handlers/pr-record.test.ts +1 -1
  276. package/src/cli/handlers/pr.ts +64 -21
  277. package/src/cli/handlers/promote.ts +2 -1
  278. package/src/cli/handlers/release.e2e.test.ts +35 -0
  279. package/src/cli/handlers/release.ts +14 -2
  280. package/src/cli/handlers/run-wave.ts +170 -4
  281. package/src/cli/handlers/run.ts +2 -1
  282. package/src/cli/main.ts +41 -2
  283. package/src/cli/parse-args.ts +23 -0
  284. package/src/cli/registry.ts +19 -1
  285. package/src/components/auto-release.ts +2 -1
  286. package/src/components/pr-checks.ts +165 -17
  287. package/src/components/pr-pipeline.ts +22 -18
  288. package/src/components/product-pipeline.apply-status.test.ts +50 -0
  289. package/src/components/product-pipeline.ts +204 -17
  290. package/src/components/product-plan.test.ts +60 -4
  291. package/src/components/product-plan.ts +367 -50
  292. package/src/drift-record.test.ts +20 -0
  293. package/src/drift-record.ts +16 -0
  294. package/src/floor-table.data.ts +63 -31
  295. package/src/forge-check/contract.ts +12 -1
  296. package/src/forge-check/forge-check.test.ts +17 -0
  297. package/src/forge-check/index.ts +2 -0
  298. package/src/gate-resume-run.ts +27 -3
  299. package/src/generated-check.e2e.test.ts +21 -1
  300. package/src/generated-check.test.ts +66 -0
  301. package/src/generated-check.ts +51 -10
  302. package/src/image-pins.ts +31 -0
  303. package/src/lexicon.ts +89 -1
  304. package/src/lifecycle/gate-applied.ts +7 -0
  305. package/src/lifecycle/git.test.ts +48 -0
  306. package/src/lifecycle/git.ts +27 -4
  307. package/src/lifecycle/publish-npm.ts +31 -1
  308. package/src/lifecycle/reach-locks.test.ts +87 -0
  309. package/src/lifecycle/reach-locks.ts +169 -0
  310. package/src/lifecycle/release-cut.ts +17 -1
  311. package/src/lifecycle/release-images.test.ts +56 -0
  312. package/src/lifecycle/release-images.ts +1 -2
  313. package/src/notify-product.ts +19 -8
  314. package/src/op/activities/source-release.ts +2 -1
  315. package/src/op/activities/source-rollback.ts +2 -1
  316. package/src/op/apply-status.test.ts +83 -0
  317. package/src/op/apply-status.ts +132 -0
  318. package/src/op/before-merge-decide.ts +190 -0
  319. package/src/op/before-merge-done.ts +99 -0
  320. package/src/op/before-merge-store.ts +44 -0
  321. package/src/op/before-merge.test.ts +201 -0
  322. package/src/op/before-merge.ts +266 -0
  323. package/src/op/follow-on-run.ts +206 -0
  324. package/src/op/follow-on-store.ts +54 -0
  325. package/src/op/gate-resume.test.ts +27 -0
  326. package/src/op/gate.ts +16 -1
  327. package/src/op/index.ts +15 -0
  328. package/src/op/op-waves-after-plan.ts +13 -0
  329. package/src/op/op-waves-evidence-jobs.ts +21 -7
  330. package/src/op/op-waves-follow-on-record.test.ts +152 -0
  331. package/src/op/op-waves-follow-on.test.ts +247 -0
  332. package/src/op/op-waves-follow-on.ts +385 -0
  333. package/src/op/op-waves-notify-words.test.ts +18 -0
  334. package/src/op/op-waves-render-spec.test.ts +159 -0
  335. package/src/op/op-waves-render-spec.ts +171 -0
  336. package/src/op/op-waves-run.ts +973 -94
  337. package/src/op/op-waves-split-product.test.ts +288 -0
  338. package/src/op/op-waves-split-step.test.ts +298 -0
  339. package/src/op/op-waves-split.test.ts +196 -0
  340. package/src/op/op-waves-split.ts +189 -0
  341. package/src/op/op-waves.ts +31 -3
  342. package/src/op/schedule-overdue.test.ts +72 -1
  343. package/src/op/schedule-overdue.ts +84 -6
  344. package/src/op/stage-hooks.ts +52 -4
  345. package/src/op/wave-stop.test.ts +72 -0
  346. package/src/op/wave-stop.ts +139 -0
  347. package/src/planned-files.test.ts +80 -0
  348. package/src/planned-files.ts +134 -0
  349. package/src/pr-forge-job.test.ts +53 -0
  350. package/src/pr-forge-job.ts +46 -0
  351. package/src/pr-loop-narrowed.test.ts +2 -1
  352. package/src/pr-loop-words.test.ts +2 -1
  353. package/src/pr-loop.test.ts +1 -2
  354. package/src/pr-loop.ts +4 -80
  355. package/src/pr-plan-note.ts +155 -3
  356. package/src/pr-post-replan.test.ts +144 -0
  357. package/src/pr-post-subject.test.ts +230 -0
  358. package/src/pr-post.test.ts +2 -1
  359. package/src/pr-post.ts +151 -15
  360. package/src/pr-status.ts +91 -0
  361. package/src/ref-gate-init.ts +30 -11
  362. package/src/release-floors.ts +81 -25
  363. package/src/render-module.ts +73 -0
  364. package/src/state-migration-record.test.ts +2 -3
  365. package/src/state-migration.ts +1 -2
  366. package/src/wave-blocked.ts +9 -4
  367. package/src/workspace/ci-green-cli.ts +3 -2
  368. package/src/workspace/ci-green-workflow.test.ts +32 -1
  369. package/src/workspace/release-train.ts +2 -1
  370. package/src/workspace/release-workflow.test.ts +36 -5
  371. package/src/workspace/release-workflow.ts +10 -7
  372. package/src/workspace/trust/check-evidence-report.ts +15 -8
  373. package/src/workspace/trust/check-evidence.test.ts +5 -0
  374. package/src/workspace/trust/ref-gate-cli.ts +30 -8
  375. package/src/workspace/trust/ref-gate-pieces.test.ts +46 -1
  376. package/src/workspace/trust/ref-gate.test.ts +10 -0
  377. package/src/workspace/workspace-run.ts +2 -1
@@ -54,7 +54,7 @@ export const EVIDENCE_ID_TOKEN_VAR = "CHANT_ID_TOKEN_SIGSTORE";
54
54
  /** The audience a keyless signing job's token is requested for unless told: sigstore's. */
55
55
  export const EVIDENCE_DEFAULT_AUDIENCE = "sigstore";
56
56
 
57
- export { CHECK_EVIDENCE_FLOOR, CHECK_JOB_FLOOR, GITLAB_OPEN_EVIDENCE_FLOOR, KEYLESS_EVIDENCE_FLOOR, LOCAL_EVIDENCE_FLOOR, PR_LOOP_EVIDENCE_FLOOR, REF_GATE_STATUS_JOB_FLOOR, WAVE_EVIDENCE_JOB_FLOOR } from "./release-floors";
57
+ export { CHECK_EVIDENCE_FLOOR, CHECK_JOB_FLOOR, GITLAB_OPEN_EVIDENCE_FLOOR, GITLAB_WAVE_EVIDENCE_RETRY_FLOOR, GITLAB_WAVE_KEY_SCOPE_FLOOR, KEYLESS_EVIDENCE_FLOOR, LOCAL_EVIDENCE_FLOOR, MEMBER_SIGNED_CHECKS_FLOOR, PR_LOOP_EVIDENCE_FLOOR, REF_GATE_STATUS_JOB_FLOOR, TARGET_SIGNED_CHECKS_FLOOR, WAVE_EVIDENCE_JOB_FLOOR } from "./release-floors";
58
58
 
59
59
  /**
60
60
  * The GitLab environment every signing job names (#4914), with `action:
@@ -79,9 +79,54 @@ export function gitlabOpenEvidenceDir(job: string): string {
79
79
  * With `noForks`, a merge request from a fork is not signed for, as a
80
80
  * product plan with `forks: "skip"` plans none.
81
81
  */
82
- export function openEvidenceLines(opts: { job: string; dir: string; out: string; bin?: string; noForks?: boolean }): string[] {
82
+ export function openEvidenceLines(opts: { job: string; dir: string; out: string; bin?: string; noForks?: boolean; member?: string }): string[] {
83
83
  const chant = opts.bin ?? "chant";
84
- return [`${chant} ci evidence sign --open --job ${opts.job} --from-report ${opts.dir} --base "$CI_COMMIT_SHA" --output ${opts.out}${opts.noForks ? " --no-forks" : ""}`];
84
+ return [`${chant} ci evidence sign --open --job ${opts.job} --from-report ${opts.dir}${memberFlag(opts.member)} --base "$CI_COMMIT_SHA" --output ${opts.out}${opts.noForks ? " --no-forks" : ""}`];
85
+ }
86
+
87
+ /**
88
+ * The check a workspace member's pipeline signs for one of the plan job's
89
+ * two (#4964): `plan:<member>`, `policy:<member>`. A member's plan job plans
90
+ * that member alone, so its pass says nothing of another member's plan; a
91
+ * `refs` rule names each member's checks. The root pipeline's are `plan`
92
+ * and `policy`.
93
+ */
94
+ export function memberEvidenceCheck(check: "plan" | "policy", member?: string): string {
95
+ return member ? `${check}:${member}` : check;
96
+ }
97
+
98
+ /**
99
+ * The check a product plan target's note job signs for one of its plan
100
+ * job's two (#4978): `plan:<target>`, `policy:<target>`. Each target has a
101
+ * plan job of its own, so its pass says nothing of another target's plan,
102
+ * and a `refs` rule names each target's checks. A product plan without
103
+ * targets signs `plan` and `policy`.
104
+ */
105
+ export function targetEvidenceCheck(check: "plan" | "policy", target?: string): string {
106
+ return memberEvidenceCheck(check, target);
107
+ }
108
+
109
+ /**
110
+ * The checks a product plan's note jobs sign (#4978), in the order a `refs`
111
+ * rule lists them: `plan` and `policy`, or with `targets` each target's
112
+ * `plan:<target>` and `policy:<target>`.
113
+ */
114
+ export function productPlanEvidenceChecks(targets?: readonly string[]): string[] {
115
+ if (!targets || targets.length === 0) return ["plan", "policy"];
116
+ return targets.flatMap((t) => [targetEvidenceCheck("plan", t), targetEvidenceCheck("policy", t)]);
117
+ }
118
+
119
+ /**
120
+ * The name `--member` takes (#4964): a workspace member's or (#4978) a
121
+ * product plan target's, which a check name carries after `plan:`.
122
+ */
123
+ export const EVIDENCE_MEMBER_NAME = /^[A-Za-z0-9][A-Za-z0-9_-]*$/;
124
+
125
+ /** ` --member <name>` on a signing line of a member's or a target's plan evidence (#4964, #4978), or nothing. */
126
+ function memberFlag(member: string | undefined): string {
127
+ if (member === undefined) return "";
128
+ if (!EVIDENCE_MEMBER_NAME.test(member)) throw new Error(`the name ${JSON.stringify(member)} is not one a check name can carry: letters, digits, - and _`);
129
+ return ` --member ${member}`;
85
130
  }
86
131
 
87
132
  /**
@@ -133,10 +178,10 @@ export function evidenceKeyEnv(forge: ForgeKind, evidence: PipelineEvidence): Re
133
178
  * the report directory. `result` is the plan job's result as the shell
134
179
  * reads it.
135
180
  */
136
- export function planEvidenceLines(opts: { dir: string; at: string; base: string; result: string; bin?: string }): string[] {
181
+ export function planEvidenceLines(opts: { dir: string; at: string; base: string; result: string; bin?: string; member?: string }): string[] {
137
182
  const chant = opts.bin ?? "chant";
138
183
  return [
139
184
  `git fetch --quiet --no-tags --depth=1 origin ${opts.at} || true`,
140
- `${chant} ci evidence sign --from-report ${opts.dir} --result ${opts.result} --at ${opts.at} --base ${opts.base}`,
185
+ `${chant} ci evidence sign --from-report ${opts.dir}${memberFlag(opts.member)} --result ${opts.result} --at ${opts.at} --base ${opts.base}`,
141
186
  ];
142
187
  }
@@ -10,6 +10,7 @@ import {
10
10
  CI_IMAGE_DOCKER_STAGES_FLOOR,
11
11
  CI_IMAGE_FLOOR,
12
12
  CI_IMAGE_NON_ROOT_FLOOR,
13
+ CI_TOOL_NODE_DOWNLOAD_FLOOR,
13
14
  CI_TOOL_DOCKER_ARCH,
14
15
  CI_TOOL_SHA256,
15
16
  CI_TOOLS,
@@ -27,7 +28,6 @@ import {
27
28
  unzipEntry,
28
29
  type CiTool,
29
30
  } from "./ci-image";
30
- import { NEXT_RELEASE } from "./release-floors";
31
31
 
32
32
  const tmp = (): string => mkdtempSync(join(tmpdir(), "ci-image-"));
33
33
  const sha = (b: Uint8Array): string => createHash("sha256").update(b).digest("hex");
@@ -57,8 +57,8 @@ function tarGz(files: Record<string, string>): Uint8Array {
57
57
  return gzipSync(Buffer.concat(blocks));
58
58
  }
59
59
 
60
- /** A zip of `files`, deflated, with a central directory, as a release's `.zip` holds them. */
61
- function zip(files: Record<string, string>): Uint8Array {
60
+ /** 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. */
61
+ function zip(files: Record<string, string>, modes: Record<string, number> = {}): Uint8Array {
62
62
  const locals: Buffer[] = [];
63
63
  const centrals: Buffer[] = [];
64
64
  let offset = 0;
@@ -83,6 +83,11 @@ function zip(files: Record<string, string>): Uint8Array {
83
83
  central.writeUInt32LE(data.length, 20);
84
84
  central.writeUInt32LE(raw.length, 24);
85
85
  central.writeUInt16LE(n.length, 28);
86
+ if (modes[name] !== undefined) {
87
+ // Made by Unix (3), with the mode in the external attributes' high half.
88
+ central.writeUInt16LE((3 << 8) | 20, 4);
89
+ central.writeUInt32LE(((0o100000 | modes[name]!) << 16) >>> 0, 38);
90
+ }
86
91
  central.writeUInt32LE(offset, 42);
87
92
  locals.push(local, n, data);
88
93
  centrals.push(central, n);
@@ -134,6 +139,40 @@ function runShell(script: string, fixtures: Record<string, Uint8Array | string>,
134
139
  return { status: r.status ?? -1, stderr: r.stderr, urls: existsSync(log) ? readFileSync(log, "utf-8").trim().split("\n") : [] };
135
140
  }
136
141
 
142
+ /**
143
+ * Runs a fetch script as a job with no curl and no unzip would (#4952):
144
+ * both are on PATH as commands that fail, and node's `fetch` is replaced,
145
+ * through `NODE_OPTIONS=--import`, by one that serves the fixtures by the
146
+ * URL's last segment.
147
+ */
148
+ function runNodeShell(script: string, fixtures: Record<string, Uint8Array | string>, env: Record<string, string> = {}): { status: number; stderr: string; urls: string[] } {
149
+ const dir = tmp();
150
+ const serve = join(dir, "serve");
151
+ const bin = join(dir, "bin");
152
+ mkdirSync(serve);
153
+ mkdirSync(bin);
154
+ for (const [name, body] of Object.entries(fixtures)) writeFileSync(join(serve, name), body);
155
+ const log = join(dir, "urls");
156
+ for (const missing of ["curl", "unzip"]) {
157
+ writeFileSync(join(bin, missing), `#!/bin/sh\necho "${missing}: not in this image" >&2\nexit 127\n`);
158
+ chmodSync(join(bin, missing), 0o755);
159
+ }
160
+ const preload = join(dir, "fetch.mjs");
161
+ writeFileSync(
162
+ preload,
163
+ [
164
+ 'import { appendFileSync, existsSync, readFileSync } from "node:fs";',
165
+ "globalThis.fetch = async (url) => {",
166
+ ` appendFileSync(${JSON.stringify(log)}, String(url) + "\\n");`,
167
+ ` const f = ${JSON.stringify(serve)} + "/" + String(url).split("/").pop();`,
168
+ ' return existsSync(f) ? new Response(readFileSync(f)) : new Response("not found", { status: 404 });',
169
+ "};",
170
+ ].join("\n"),
171
+ );
172
+ const r = spawnSync("sh", ["-c", `set -e; ${script}`], { env: { ...process.env, PATH: `${bin}:${process.env.PATH}`, NODE_OPTIONS: `--import ${preload}`, ...env }, encoding: "utf-8" });
173
+ return { status: r.status ?? -1, stderr: r.stderr, urls: existsSync(log) ? readFileSync(log, "utf-8").trim().split("\n") : [] };
174
+ }
175
+
137
176
  describe("ciToolRelease", () => {
138
177
  test("names each release file and its checksums file per architecture", () => {
139
178
  expect(ciToolRelease("tofu", "1.13.1", "arm64")).toMatchObject({
@@ -165,10 +204,11 @@ describe("ciToolRelease", () => {
165
204
  expect(() => ciToolSha256("tofu", "1.13.1", { amd64: "nothex" })).toThrow(/64 lower-case hex/);
166
205
  });
167
206
 
168
- test("CI_IMAGE_FLOOR is the release that shipped it, and #4908's and #4932's floors the next", () => {
207
+ test("CI_IMAGE_FLOOR is the release that shipped it, and #4908's and #4932's floors theirs", () => {
169
208
  expect(CI_IMAGE_FLOOR).toBe("0.124.86");
170
- expect(CI_IMAGE_NON_ROOT_FLOOR).toBe(NEXT_RELEASE);
171
- expect(CI_IMAGE_DOCKER_STAGES_FLOOR).toBe(NEXT_RELEASE);
209
+ expect(CI_IMAGE_NON_ROOT_FLOOR).toBe("0.124.88");
210
+ expect(CI_IMAGE_DOCKER_STAGES_FLOOR).toBe("0.124.88");
211
+ expect(CI_TOOL_NODE_DOWNLOAD_FLOOR).toBe("0.124.89");
172
212
  });
173
213
  });
174
214
 
@@ -231,11 +271,12 @@ describe("ciToolFetchScript against local fixtures", () => {
231
271
  const binary = Buffer.from("#!/bin/sh\necho just\n");
232
272
  const archiveJust = tarGz({ just: binary.toString() });
233
273
  const out = tmp();
234
- const script = ciToolFetchScript("just", "1.36.0", { dir: `${out}/d`, arch: CI_TOOL_DOCKER_ARCH, sha256: { amd64: sha(archiveJust), arm64: "2".repeat(64) } });
274
+ // just publishes a checksums file from 1.35.0 (#4952), so an older release is checked on its recorded sha256.
275
+ const script = ciToolFetchScript("just", "1.34.0", { dir: `${out}/d`, arch: CI_TOOL_DOCKER_ARCH, sha256: { amd64: sha(archiveJust), arm64: "2".repeat(64) } });
235
276
  expect(script).not.toContain("sums");
236
- expect(runShell(script, { "just-1.36.0-x86_64-unknown-linux-musl.tar.gz": archiveJust }, { TARGETARCH: "amd64" }).status).toBe(0);
277
+ expect(runShell(script, { "just-1.34.0-x86_64-unknown-linux-musl.tar.gz": archiveJust }, { TARGETARCH: "amd64" }).status).toBe(0);
237
278
  expect(readFileSync(`${out}/d/just`, "utf-8")).toContain("echo just");
238
- const r = runShell(script, { "just-1.36.0-aarch64-unknown-linux-musl.tar.gz": archiveJust }, { TARGETARCH: "arm64" });
279
+ const r = runShell(script, { "just-1.34.0-aarch64-unknown-linux-musl.tar.gz": archiveJust }, { TARGETARCH: "arm64" });
239
280
  expect(r.status).not.toBe(0);
240
281
  });
241
282
 
@@ -261,7 +302,7 @@ describe("ciToolFetchScript against local fixtures", () => {
261
302
  });
262
303
 
263
304
  test("refuses, before any shell, a release that needs a recorded sha256 it lacks", () => {
264
- 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/);
305
+ 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/);
265
306
  expect(() => ciToolFetchScript("terragrunt", "1.1.0", { dir: "/out/tg", requirePin: true })).toThrow(/no recorded sha256 for terragrunt 1.1.0/);
266
307
  expect(() => ciToolFetchScript("tofu", "1.13.1", { dir: "/out/x y" })).toThrow(/absolute path/);
267
308
  });
@@ -335,6 +376,85 @@ describe("non-root job lines (#4908)", () => {
335
376
  });
336
377
  });
337
378
 
379
+ describe("a job with no curl or unzip (#4952)", () => {
380
+ test("download: node fetches and checks a release with node, and the line names neither tool", () => {
381
+ const a = tarGz({ tofu: "#!/bin/sh\necho node-fetched\n" });
382
+ const root = tmp();
383
+ const line = ciToolInstallLine("tofu", "1.13.1", { root, link: false, download: "node", sha256: { amd64: sha(a), arm64: sha(a) } });
384
+ expect(line).not.toMatch(/\bcurl\b|\bunzip\b/);
385
+ 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` };
386
+ const r = runNodeShell(line, files);
387
+ expect(r.stderr).toBe("");
388
+ expect(r.status).toBe(0);
389
+ expect(readFileSync(`${root}/tofu-1.13.1/tofu`, "utf-8")).toContain("echo node-fetched");
390
+ expect(r.urls).toHaveLength(2);
391
+ });
392
+
393
+ test("download: node fails a tampered archive and a missing file, and installs nothing", () => {
394
+ const a = tarGz({ tofu: "#!/bin/sh\n" });
395
+ const out = tmp();
396
+ const script = ciToolFetchScript("tofu", "1.13.1", { dir: `${out}/d`, arch: CI_TOOL_DOCKER_ARCH, download: "node", sha256: { amd64: sha(a), arm64: sha(a) } });
397
+ const sums = `${sha(a)} tofu_1.13.1_linux_amd64.tar.gz\n`;
398
+ 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);
399
+ const missing = runNodeShell(script, { "tofu_1.13.1_SHA256SUMS": sums }, { TARGETARCH: "amd64" });
400
+ expect(missing.status).not.toBe(0);
401
+ expect(missing.stderr).toContain("tofu_1.13.1_linux_amd64.tar.gz: HTTP 404");
402
+ expect(existsSync(`${out}/d/tofu`)).toBe(false);
403
+ });
404
+
405
+ test("download: node unpacks a zip's member, and the AWS CLI's whole zip for its installer", () => {
406
+ const out = tmp();
407
+ const z = zip({ terraform: "#!/bin/sh\necho terraform\n", "LICENSE.txt": "x" });
408
+ const s1 = ciToolFetchScript("terraform", "1.14.8", { dir: `${out}/tf`, arch: CI_TOOL_DOCKER_ARCH, download: "node" });
409
+ 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" });
410
+ expect(r1.stderr).toBe("");
411
+ expect(readFileSync(`${out}/tf/terraform`, "utf-8")).toContain("echo terraform");
412
+
413
+ // The installer writes the binary where `-i` points, as the AWS CLI's does.
414
+ const installer = '#!/bin/sh\nmkdir -p "$2/v2/current/bin"\ncp "$(dirname "$0")/dist/aws" "$2/v2/current/bin/aws"\n';
415
+ const aws = zip({ "aws/": "", "aws/install": installer, "aws/dist/aws": "#!/bin/sh\necho aws-cli\n" }, { "aws/install": 0o755, "aws/dist/aws": 0o755 });
416
+ const root = tmp();
417
+ const line = ciToolInstallLine("aws-cli", "2.37.9", { root, link: false, download: "node", sha256: { amd64: sha(aws), arm64: sha(aws) } });
418
+ expect(line).not.toMatch(/\bcurl\b|\bunzip\b/);
419
+ const r2 = runNodeShell(line, { "awscli-exe-linux-x86_64-2.37.9.zip": aws, "awscli-exe-linux-aarch64-2.37.9.zip": aws });
420
+ expect(r2.stderr).toBe("");
421
+ expect(r2.status).toBe(0);
422
+ expect(spawnSync(`${root}/aws-cli-2.37.9/v2/current/bin/aws`, { encoding: "utf-8" }).stdout).toBe("aws-cli\n");
423
+ });
424
+
425
+ test("curl stays the default, and download names curl or node only", () => {
426
+ expect(ciToolInstallLine("tofu", "1.13.1")).toContain("curl -fsSLo");
427
+ expect(() => ciToolFetchScript("tofu", "1.13.1", { dir: "/out/t", download: "wget" as never })).toThrow(/download is curl or node/);
428
+ });
429
+ });
430
+
431
+ describe("just's and act's checksums files and recorded sums (#4952)", () => {
432
+ test("just 1.36.0 and act 0.2.89 are recorded, copied from the releases' checksums files", () => {
433
+ expect(ciToolSha256("just", "1.36.0")).toEqual({ amd64: "bc7c9f377944f8de9cd0418b11d2955adebfa25a488c0b5e3dd2d2c0e9d732da", arm64: "bb3886b15e2cbcb9c0eb19956297d36de4eaef45b89d3f5fa5d1fc4ed3b5b51d" });
434
+ expect(ciToolSha256("act", "0.2.89")).toEqual({ amd64: "0191d6f1f3b716b5c55820032605d05fc3c1cdbf581ebeff655019e5dd1524c0", arm64: "daa8679ba9615a74d2d0cec321dc593f21948a2a11bb65862b063d8b930f4bcb" });
435
+ expect(() => ciToolInstallLine("just", "1.36.0", { requirePin: true })).not.toThrow();
436
+ expect(() => ciToolInstallLine("act", "0.2.89", { requirePin: true })).not.toThrow();
437
+ });
438
+
439
+ 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", () => {
440
+ 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");
441
+ expect(ciToolRelease("just", "1.35.0", "arm64").checksums).toBe("just-1.35.0-aarch64-unknown-linux-musl.tar.gz.sha256sum");
442
+ expect(ciToolRelease("just", "1.37.0", "amd64").checksumsUrl).toBe("https://github.com/casey/just/releases/download/1.37.0/SHA256SUMS");
443
+ expect(ciToolRelease("just", "1.34.0", "amd64").checksumsUrl).toBeUndefined();
444
+ expect(ciToolRelease("act", "0.2.89", "arm64").checksumsUrl).toBe("https://github.com/nektos/act/releases/download/v0.2.89/checksums.txt");
445
+ });
446
+
447
+ test("the shell reads just's per-file checksums file", () => {
448
+ const a = tarGz({ just: "#!/bin/sh\necho just\n" });
449
+ const out = tmp();
450
+ const s = ciToolFetchScript("just", "1.36.0", { dir: `${out}/j`, arch: CI_TOOL_DOCKER_ARCH, sha256: { amd64: sha(a), arm64: sha(a) } });
451
+ 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" });
452
+ expect(r.stderr).toBe("");
453
+ 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");
454
+ expect(readFileSync(`${out}/j/just`, "utf-8")).toContain("echo just");
455
+ });
456
+ });
457
+
338
458
  describe("installCiTool", () => {
339
459
  const a = tarGz({ tofu: "#!/bin/sh\necho node-install\n" });
340
460
  const base = "https://github.com/opentofu/opentofu/releases/download/v1.13.1";
package/src/ci-image.ts CHANGED
@@ -18,7 +18,8 @@
18
18
  * checks it, for an image's fetch stage; {@link ciToolInstallLine} is the
19
19
  * job line that runs it unless the binary is there (with `sudo`, or under
20
20
  * a root such as `$RUNNER_TEMP/chant-tools`, for a job that is not root,
21
- * #4908); {@link installCiTool} does the same from Node, for a product
21
+ * #4908). With `download: "node"` both fetch and unpack with node, for
22
+ * an image with no curl or unzip (#4952). {@link installCiTool} does the same from Node, for a product
22
23
  * that installs a pinned release at run time.
23
24
  * - {@link productImageStages} is a product's image as stages a Dockerfile
24
25
  * takes (the docker lexicon's `new Dockerfile({ stages })`), and
@@ -31,7 +32,7 @@
31
32
  * project publishes a checksums file is checked against that file's line
32
33
  * for the archive, and against the recorded sha256 when there is one, so a
33
34
  * tampered checksums file fails as a tampered archive does. A release with
34
- * no checksums file (the AWS CLI, just, act) needs a recorded sha256. An
35
+ * no checksums file (the AWS CLI, just before 1.35.0) needs a recorded sha256. An
35
36
  * image always needs a recorded sha256 for both architectures, and a caller
36
37
  * passes `requirePin` to ask the same of a job line or a run-time install.
37
38
  *
@@ -47,9 +48,9 @@ import { tmpdir } from "node:os";
47
48
  import { join } from "node:path";
48
49
  import { gunzipSync, inflateRawSync } from "node:zlib";
49
50
  import { tarEntry } from "./policy-engine";
50
- import { CI_IMAGE_DOCKER_STAGES_FLOOR, CI_IMAGE_FLOOR, CI_IMAGE_NON_ROOT_FLOOR } from "./release-floors";
51
+ import { CI_IMAGE_DOCKER_STAGES_FLOOR, CI_IMAGE_FLOOR, CI_IMAGE_NON_ROOT_FLOOR, CI_TOOL_NODE_DOWNLOAD_FLOOR } from "./release-floors";
51
52
 
52
- export { CI_IMAGE_DOCKER_STAGES_FLOOR, CI_IMAGE_FLOOR, CI_IMAGE_NON_ROOT_FLOOR };
53
+ export { CI_IMAGE_DOCKER_STAGES_FLOOR, CI_IMAGE_FLOOR, CI_IMAGE_NON_ROOT_FLOOR, CI_TOOL_NODE_DOWNLOAD_FLOOR };
53
54
 
54
55
  // ---------------------------------------------------------------------------
55
56
  // Engine releases
@@ -88,8 +89,8 @@ interface ToolSpec {
88
89
  words: Record<CiToolArch, string>;
89
90
  base(version: string): string;
90
91
  asset(version: string, word: string): string;
91
- /** The checksums file, beside the asset under `base`; absent when the release publishes none. */
92
- checksums?(version: string, asset: string): string;
92
+ /** The checksums file, beside the asset under `base`; absent, or undefined for a version, when the release publishes none. */
93
+ checksums?(version: string, asset: string): string | undefined;
93
94
  layout: CiToolLayout;
94
95
  /** The binary inside the archive, for `tar.gz` and `zip`. Default `bin`. */
95
96
  member?(word: string): string;
@@ -97,6 +98,12 @@ interface ToolSpec {
97
98
  path?: string;
98
99
  }
99
100
 
101
+ /** Whether a release version is at least `major.minor`. */
102
+ function atLeast(version: string, major: number, minor: number): boolean {
103
+ const [a = 0, b = 0] = version.split(".").map((n) => Number.parseInt(n, 10));
104
+ return a > major || (a === major && b >= minor);
105
+ }
106
+
100
107
  const STD = { amd64: "amd64", arm64: "arm64" };
101
108
  const GNU = { amd64: "x86_64", arm64: "aarch64" };
102
109
  const NODE_WORDS = { amd64: "x64", arm64: "arm64" };
@@ -197,6 +204,8 @@ const TOOLS: Record<CiTool, ToolSpec> = {
197
204
  words: GNU,
198
205
  base: (v) => `https://github.com/casey/just/releases/download/${v}`,
199
206
  asset: (v, w) => `just-${v}-${w}-unknown-linux-musl.tar.gz`,
207
+ // #4952: just publishes `SHA256SUMS` from 1.37.0, one `<file>.sha256sum` per file in 1.35.0 and 1.36.0, and none before.
208
+ checksums: (v, asset) => (atLeast(v, 1, 37) ? "SHA256SUMS" : atLeast(v, 1, 35) ? `${asset}.sha256sum` : undefined),
200
209
  layout: "tar.gz",
201
210
  },
202
211
  act: {
@@ -204,6 +213,7 @@ const TOOLS: Record<CiTool, ToolSpec> = {
204
213
  words: { amd64: "x86_64", arm64: "arm64" },
205
214
  base: (v) => `https://github.com/nektos/act/releases/download/v${v}`,
206
215
  asset: (_v, w) => `act_Linux_${w}.tar.gz`,
216
+ checksums: () => "checksums.txt",
207
217
  layout: "tar.gz",
208
218
  },
209
219
  };
@@ -239,6 +249,14 @@ export const CI_TOOL_SHA256: Readonly<Record<string, string>> = {
239
249
  "terragrunt-1.2.0-linux-arm64": "b069ce4310572bc46ee6f057057acc4bc6a9077ef8687e157a64b0551290a371",
240
250
  "aws-cli-2.37.9-linux-amd64": "6b3a6a3d7bb3997928f0bdf7b866914224abf242c2e54e1dcebbe84bee64f356",
241
251
  "aws-cli-2.37.9-linux-arm64": "e7d2cca3622af4765871fe9ce7eeed03acd09dca10a99ebc46e92f79d78765c0",
252
+ // #4952: terragucci's just and act pins (its workflows/shared.ts), read on 2026-11-10 from
253
+ // https://github.com/casey/just/releases/download/1.36.0/just-1.36.0-{x86_64,aarch64}-unknown-linux-musl.tar.gz.sha256sum
254
+ // and https://github.com/nektos/act/releases/download/v0.2.89/checksums.txt.
255
+ // squawk is not here: its releases publish no checksums file, only bare binaries, and no product pins a release.
256
+ "just-1.36.0-linux-amd64": "bc7c9f377944f8de9cd0418b11d2955adebfa25a488c0b5e3dd2d2c0e9d732da",
257
+ "just-1.36.0-linux-arm64": "bb3886b15e2cbcb9c0eb19956297d36de4eaef45b89d3f5fa5d1fc4ed3b5b51d",
258
+ "act-0.2.89-linux-amd64": "0191d6f1f3b716b5c55820032605d05fc3c1cdbf581ebeff655019e5dd1524c0",
259
+ "act-0.2.89-linux-arm64": "daa8679ba9615a74d2d0cec321dc593f21948a2a11bb65862b063d8b930f4bcb",
242
260
  };
243
261
 
244
262
  /** One release file of one tool for one architecture. */
@@ -349,6 +367,48 @@ export interface CiToolCheckOptions {
349
367
  requirePin?: boolean;
350
368
  }
351
369
 
370
+ /**
371
+ * How a fetch line downloads and unpacks a release (#4952): `curl` (the
372
+ * default) with `unzip` for a zip, or `node`, which downloads with node's
373
+ * `fetch` and unpacks a zip with node, for a job whose image carries node
374
+ * but neither curl nor unzip. The check is the same either way; tar,
375
+ * sha256sum and sed are still the image's.
376
+ */
377
+ export type CiToolDownload = "curl" | "node";
378
+
379
+ /** The download line's script for `download: "node"`: `node -e <it> <url> <file>`. A failed answer exits 1 naming the URL and the status. */
380
+ const NODE_FETCH_JS =
381
+ 'const [u,o]=process.argv.slice(1);fetch(u).then(async(r)=>{if(!r.ok)throw new Error(u+": HTTP "+r.status);require("fs").writeFileSync(o,Buffer.from(await r.arrayBuffer()))}).catch((e)=>{console.error(e.message);process.exit(1)})';
382
+
383
+ /**
384
+ * The unpack line's script for `download: "node"`: `node -e <it> <zip>
385
+ * <dir> [member]`, every entry (or the one member) written under `dir`
386
+ * with its executable bit and symbolic links kept, as the AWS CLI's
387
+ * installer needs. Stored and deflated entries only, as {@link unzipEntry}
388
+ * reads them; an entry whose path leaves `dir` fails the line. Written with
389
+ * no single quote or `$`, so it goes inside the shell's single quotes as it is.
390
+ */
391
+ const NODE_UNZIP_JS = [
392
+ 'const fs=require("fs"),p=require("path"),z=require("zlib");const [f,d,m]=process.argv.slice(1);const b=fs.readFileSync(f);',
393
+ 'let e=b.length-22;while(e>=0&&b.readUInt32LE(e)!==0x06054b50)e--;if(e<0)throw new Error(f+" is not a zip archive");',
394
+ "const top=p.resolve(d);let o=b.readUInt32LE(e+16),hit=false;",
395
+ "for(let i=b.readUInt16LE(e+10);i>0;i--){",
396
+ 'const meth=b.readUInt16LE(o+10),size=b.readUInt32LE(o+20),nl=b.readUInt16LE(o+28),xl=b.readUInt16LE(o+30),cl=b.readUInt16LE(o+32),mode=b.readUInt32LE(o+38)>>>16,l=b.readUInt32LE(o+42),n=b.toString("utf8",o+46,o+46+nl);',
397
+ "o+=46+nl+xl+cl;if(m&&n!==m)continue;hit=true;",
398
+ 'const t=p.resolve(top,n);if(t!==top&&!t.startsWith(top+p.sep))throw new Error(n+" is outside "+d);',
399
+ 'if(n.endsWith("/")){fs.mkdirSync(t,{recursive:true});continue}',
400
+ "const s=l+30+b.readUInt16LE(l+26)+b.readUInt16LE(l+28),raw=b.subarray(s,s+size),data=meth===0?raw:meth===8?z.inflateRawSync(raw):null;",
401
+ 'if(!data)throw new Error(n+" uses compression method "+meth);fs.mkdirSync(p.dirname(t),{recursive:true});',
402
+ "if((mode&0o170000)===0o120000)fs.symlinkSync(data.toString(),t);else fs.writeFileSync(t,data,{mode:mode&0o111?0o755:0o644})}",
403
+ 'if(m&&!hit)throw new Error(m+" is not in "+f)',
404
+ ].join("");
405
+
406
+ function checkDownload(download: unknown): CiToolDownload {
407
+ if (download === undefined || download === "curl") return "curl";
408
+ if (download === "node") return "node";
409
+ throw new Error(`download is curl or node, not ${JSON.stringify(download)}`);
410
+ }
411
+
352
412
  export interface CiToolFetchOptions extends CiToolCheckOptions {
353
413
  /** The directory the tool installs into, an absolute path: {@link ciToolDir} under the image's tool root. */
354
414
  dir: string;
@@ -362,10 +422,12 @@ export interface CiToolFetchOptions extends CiToolCheckOptions {
362
422
  * /opt. The download and the check run as the job's user. Default false.
363
423
  */
364
424
  sudo?: boolean;
425
+ /** Download with curl (the default) or with node, for an image with no curl or unzip (#4952). */
426
+ download?: CiToolDownload;
365
427
  }
366
428
 
367
429
  function needPins(tool: CiTool, version: string, sums: Partial<Record<CiToolArch, string>>, requirePin: boolean): void {
368
- const hasSums = spec(tool).checksums !== undefined;
430
+ const hasSums = spec(tool).checksums?.(version, "") !== undefined;
369
431
  const missing = CI_TOOL_ARCHES.filter((a) => !sums[a]);
370
432
  if (missing.length && (requirePin || !hasSums)) {
371
433
  const why = hasSums ? "" : `; ${tool}'s release publishes no checksums file, so chant needs one`;
@@ -385,6 +447,11 @@ export function ciToolFetchScript(tool: CiTool, version: string, options: CiTool
385
447
  const s = spec(tool);
386
448
  const sums = ciToolSha256(tool, version, options.sha256);
387
449
  needPins(tool, version, sums, options.requirePin === true);
450
+ const node = checkDownload(options.download) === "node";
451
+ // #4952: `get <url word> <file>` and `unzipTo <zip> <dir> [member]`, with curl and unzip or with node.
452
+ const get = (url: string, out: string): string => (node ? `node -e '${NODE_FETCH_JS}' ${url} "${out}"` : `curl -fsSLo "${out}" ${url}`);
453
+ const unzipTo = (zipFile: string, into: string, member?: string): string =>
454
+ node ? `node -e '${NODE_UNZIP_JS}' "${zipFile}" "${into}"${member ? ` "${member}"` : ""}` : `unzip -q${member ? " -o" : ""} "${zipFile}"${member ? ` "${member}"` : ""} -d "${into}"`;
388
455
  const name = `${tool} ${version}`;
389
456
  const base = s.base(version);
390
457
  const file = s.asset(version, "$w");
@@ -394,13 +461,13 @@ export function ciToolFetchScript(tool: CiTool, version: string, options: CiTool
394
461
  `case "$a" in ${CI_TOOL_ARCHES.map((a) => `(${a}) w=${s.words[a]} ;;`).join(" ")} (*) echo "${name}: chant fetches it for ${CI_TOOL_ARCHES.join(" and ")}, not $a" >&2; exit 1 ;; esac`,
395
462
  `f="${file}"`,
396
463
  `t="$(mktemp -d)"`,
397
- `curl -fsSLo "$t/$f" "${base}/$f"`,
464
+ get(`"${base}/$f"`, "$t/$f"),
398
465
  `case "$a" in ${CI_TOOL_ARCHES.filter((a) => sums[a]).map((a) => `(${a}) want=${sums[a]} ;;`).join(" ")} (*) want= ;; esac`,
399
466
  ];
400
467
  const checksums = s.checksums?.(version, file);
401
468
  if (checksums) {
402
469
  lines.push(
403
- `curl -fsSLo "$t/sums" ${options.checksumsUrl ?? `"${base}/${checksums}"`}`,
470
+ get(options.checksumsUrl ?? `"${base}/${checksums}"`, "$t/sums"),
404
471
  // The archive's line, with any ./ or * before the name taken off.
405
472
  `line="$(sed -n "s#^\\([0-9a-f]\\{64\\}\\) *[*.]*/*$f\\$#\\1#p" "$t/sums")"`,
406
473
  `{ [ -n "$line" ] || { echo "${name}: $f is not in ${checksums}" >&2; exit 1; }; }`,
@@ -420,13 +487,13 @@ export function ciToolFetchScript(tool: CiTool, version: string, options: CiTool
420
487
  lines.push(`tar -xzf "$t/$f" -C "$t" "${member}"`, `${su}install -m 0755 "$t/${member}" "${dir}/${s.bin}"`);
421
488
  break;
422
489
  case "zip":
423
- lines.push(`unzip -q -o "$t/$f" "${member}" -d "$t"`, `${su}install -m 0755 "$t/${member}" "${dir}/${s.bin}"`);
490
+ lines.push(unzipTo("$t/$f", "$t", member), `${su}install -m 0755 "$t/${member}" "${dir}/${s.bin}"`);
424
491
  break;
425
492
  case "tree":
426
493
  lines.push(`${su}tar -xzf "$t/$f" -C "${dir}" --strip-components=1`);
427
494
  break;
428
495
  case "aws-cli":
429
- lines.push(`unzip -q "$t/$f" -d "$t"`, `${su}"$t/aws/install" -i "${dir}" -b "${dir}/bin"`);
496
+ lines.push(unzipTo("$t/$f", "$t"), `${su}"$t/aws/install" -i "${dir}" -b "${dir}/bin"`);
430
497
  break;
431
498
  }
432
499
  return lines.join(" && ");
@@ -455,6 +522,12 @@ export interface CiToolInstallOptions extends CiToolCheckOptions {
455
522
  sudo?: boolean;
456
523
  /** Skip the install when any `<bin>` is on PATH, whatever its version. Default false: only the versioned directory counts. */
457
524
  onPath?: boolean;
525
+ /**
526
+ * Download with curl (the default) or with node (#4952), for a job whose
527
+ * image carries node but neither curl nor unzip, such as terragucci's
528
+ * images installing the AWS CLI for drift attribution.
529
+ */
530
+ download?: CiToolDownload;
458
531
  }
459
532
 
460
533
  /** Where a job line installs each release by default. */
@@ -475,7 +548,7 @@ export function ciToolInstallLine(tool: CiTool, version: string, options: CiTool
475
548
  const binDir = (options.binDir ?? "/usr/local/bin").replace(/(.)\/+$/, "$1");
476
549
  if (!SHELL_DIR.test(binDir)) throw new Error(`binDir is an absolute path of letters, digits and ._/-, or one under a variable such as $HOME, not ${JSON.stringify(options.binDir)}`);
477
550
  const su = options.sudo ? "sudo " : "";
478
- const install = `(set -e; ${ciToolFetchScript(tool, version, { dir, sha256: options.sha256, requirePin: options.requirePin, sudo: options.sudo })})`;
551
+ const install = `(set -e; ${ciToolFetchScript(tool, version, { dir, sha256: options.sha256, requirePin: options.requirePin, sudo: options.sudo, download: options.download })})`;
479
552
  const inDir = `[ -x "${bin}" ]`;
480
553
  // A plain path is written as it always was; one under a variable is quoted, so the shell expands it as one word.
481
554
  const target = DIR.test(binDir) ? `${binDir}/${s.bin}` : `"${binDir}/${s.bin}"`;