@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
@@ -0,0 +1,79 @@
1
+ /**
2
+ * The forge a checkout's origin remote names (#4920): its kind, host, web
3
+ * origin and repository, for a command run on a laptop with no CI variables
4
+ * and no repository setting, such as plywood's `cancel`.
5
+ *
6
+ * It is the reading chant's own laptop paths make when the environment
7
+ * names no forge (`forgeWorkReader` in ./workspace/forge-work.ts): the
8
+ * host from the remote's URL, the kind from the host's name, and the
9
+ * repository path. Kept out of `pr-forge.ts`, which is in the pr-forge and
10
+ * pr-loop bundles.
11
+ */
12
+
13
+ import { execFileSync } from "node:child_process";
14
+ import type { ForgeKind } from "./pr-forge";
15
+ import { remoteRepoPath } from "./op/activities/forge-pull-request";
16
+ import { remoteHost } from "./op/activities/gh-host";
17
+
18
+ export { remoteRepoPath, remoteHost };
19
+
20
+ /** The forge kind a remote host is: github.com and hosts named for GitHub, GitLab, or Forgejo and Gitea (codeberg.org too). Null for any other. */
21
+ export function forgeKindOfHost(host: string): ForgeKind | null {
22
+ const h = host.toLowerCase().replace(/:\d+$/, "");
23
+ if (h === "github.com" || /(^|[.-])github([.-]|$)/.test(h)) return "github";
24
+ if (h === "gitlab.com" || /(^|[.-])gitlab([.-]|$)/.test(h)) return "gitlab";
25
+ if (h === "codeberg.org" || /(^|[.-])(forgejo|gitea)([.-]|$)/.test(h)) return "forgejo";
26
+ return null;
27
+ }
28
+
29
+ /** The forge a git remote names. */
30
+ export interface RemoteForge {
31
+ kind: ForgeKind;
32
+ /** Lower-cased, with an http(s) remote's port. */
33
+ host: string;
34
+ /** The web origin, `https://host` (an http remote keeps its scheme and port), as `--url` takes it. */
35
+ url: string;
36
+ /** `owner/name`, or a GitLab group path and name. */
37
+ repo: string;
38
+ }
39
+
40
+ /**
41
+ * The forge a remote URL names (`https://host/o/r.git`, `ssh://git@host/o/r`,
42
+ * `git@host:o/r`), or undefined when it names no repository path or its host
43
+ * is none {@link forgeKindOfHost} knows. `kind` stands in for the host's
44
+ * guess, for a self-hosted forge whose name says nothing.
45
+ */
46
+ export function forgeOfRemote(remoteUrl: string | undefined, opts: { kind?: ForgeKind } = {}): RemoteForge | undefined {
47
+ const host = remoteHost(remoteUrl);
48
+ const repo = remoteRepoPath(remoteUrl);
49
+ if (!host || !repo) return undefined;
50
+ const kind = opts.kind ?? forgeKindOfHost(host);
51
+ if (!kind) return undefined;
52
+ let url = `https://${host.replace(/:\d+$/, "")}`;
53
+ try {
54
+ const u = new URL(remoteUrl!.trim());
55
+ if (u.protocol === "http:" || u.protocol === "https:") url = `${u.protocol}//${u.host.toLowerCase()}`;
56
+ } catch {
57
+ // An scp-style remote is ssh, whose port is not the web's.
58
+ }
59
+ return { kind, host, url, repo };
60
+ }
61
+
62
+ /** `git remote get-url <remote>` in `cwd`, or undefined when there is none. */
63
+ function gitRemoteUrl(cwd: string, remote: string): string | undefined {
64
+ try {
65
+ return execFileSync("git", ["remote", "get-url", remote], { cwd, encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] }).trim() || undefined;
66
+ } catch {
67
+ return undefined;
68
+ }
69
+ }
70
+
71
+ /**
72
+ * The forge the checkout at `cwd` names by its `origin` remote (or
73
+ * `remote`), as {@link forgeOfRemote} reads it. Undefined outside a
74
+ * checkout, with no such remote, or for a host no forge kind is known for.
75
+ */
76
+ export function forgeOfCheckout(cwd: string, opts: { remote?: string; kind?: ForgeKind; remoteUrl?: (cwd: string, remote: string) => string | undefined } = {}): RemoteForge | undefined {
77
+ const url = (opts.remoteUrl ?? gitRemoteUrl)(cwd, opts.remote ?? "origin");
78
+ return forgeOfRemote(url, opts.kind ? { kind: opts.kind } : {});
79
+ }
@@ -19,7 +19,10 @@
19
19
  * | Forgejo | `POST /repos/{repo}/actions/workflows/{file}/dispatches` on the run's branch | a token with the `write:repository` scope; Forgejo has no API to re-run a run, so it starts a new run of the workflow |
20
20
  *
21
21
  * GitHub re-runs the failed job and the jobs that need it, at the same
22
- * commit. GitLab retries the job, and the jobs it skipped run after it. A
22
+ * commit. GitLab retries the job, and the jobs it skipped run after it; a
23
+ * job that already ran is not run again, so a waves job's
24
+ * `<wave job>-evidence` that ran after the stopped try is retried with it
25
+ * (#4978), and signs from the new try once it ends. A
23
26
  * Forgejo dispatch runs the whole workflow again at the branch's head, so the
24
27
  * jobs before the gate run again too; they must be safe to repeat (a wave
25
28
  * whose runs already applied plans nothing and applies nothing new).
@@ -64,6 +67,17 @@ export interface ResumeGateRunOptions {
64
67
  dryRun?: boolean;
65
68
  }
66
69
 
70
+ /**
71
+ * The job that signs a GitLab Op waves job's checks (#4926, #4978):
72
+ * `<wave job>-evidence`, as the waves pipeline names it.
73
+ */
74
+ export function gitlabEvidenceJobOf(job: string): string {
75
+ return `${job}-evidence`;
76
+ }
77
+
78
+ /** The GitLab job statuses of a job that ran and ended; a `skipped` or `created` job GitLab runs again after a retry itself. */
79
+ const GITLAB_FINISHED = new Set(["success", "failed", "canceled"]);
80
+
67
81
  const trimSlash = (s: string): string => s.replace(/\/+$/, "");
68
82
 
69
83
  const isObject = (v: unknown): v is Record<string, unknown> => typeof v === "object" && v !== null && !Array.isArray(v);
@@ -123,6 +137,7 @@ export async function resumeGateRun(loc: GateRunLocator, opts: ResumeGateRunOpti
123
137
  if (status === "success") return skip(`job ${loc.job} succeeded`);
124
138
  if (!["failed", "canceled", "skipped"].includes(status)) return skip(`job ${loc.job} is ${status}, not finished`);
125
139
  const name = loc.jobName ?? (typeof job.name === "string" ? job.name : undefined);
140
+ let evidence: Record<string, unknown> | undefined;
126
141
  if (name) {
127
142
  // The pipeline's jobs list leaves retried jobs out, so the job of this name is its newest try.
128
143
  const jobs = await call("GET", `${project}/pipelines/${loc.run}/jobs?per_page=100`);
@@ -130,11 +145,20 @@ export async function resumeGateRun(loc: GateRunLocator, opts: ResumeGateRunOpti
130
145
  if (isObject(newest) && String(newest.id) !== String(loc.job)) {
131
146
  return skip(`job ${loc.job} (${name}) was already retried as job ${String(newest.id)}`);
132
147
  }
148
+ // #4978: a wave job's evidence job that already ran signed for the stopped try; GitLab runs again only the jobs it skipped.
149
+ const found = Array.isArray(jobs) ? jobs.find((j) => isObject(j) && j.name === gitlabEvidenceJobOf(name)) : undefined;
150
+ if (isObject(found) && GITLAB_FINISHED.has(String(found.status))) evidence = found;
133
151
  }
134
- if (opts.dryRun) return wouldResume(`retry job ${loc.job}`);
152
+ if (opts.dryRun) return wouldResume(`retry job ${loc.job}${evidence ? ` and its evidence job ${String(evidence.id)}` : ""}`);
135
153
  const retried = await call("POST", `${project}/jobs/${loc.job}/retry`);
136
154
  const id = isObject(retried) && retried.id !== undefined ? ` as job ${String(retried.id)}` : "";
137
- return { status: "resumed", forge: "gitlab", how: `retried job ${loc.job}${id}`, ...url };
155
+ let also = "";
156
+ if (evidence) {
157
+ // It needs the wave job, so it waits for the retried one; `ci evidence sign --from-job` waits for it too, should it start first.
158
+ const again = await call("POST", `${project}/jobs/${String(evidence.id)}/retry`);
159
+ also = `, and its evidence job ${String(evidence.id)}${isObject(again) && again.id !== undefined ? ` as job ${String(again.id)}` : ""}`;
160
+ }
161
+ return { status: "resumed", forge: "gitlab", how: `retried job ${loc.job}${id}${also}`, ...url };
138
162
  }
139
163
 
140
164
  const call = client(loc.api, { Authorization: `token ${opts.token}`, Accept: "application/json" }, fetchImpl);
@@ -0,0 +1,118 @@
1
+ import { spawnSync } from "node:child_process";
2
+ import { mkdirSync, mkdtempSync, readFileSync, realpathSync, writeFileSync } from "node:fs";
3
+ import { tmpdir } from "node:os";
4
+ import { dirname, join, resolve } from "node:path";
5
+ import { fileURLToPath, pathToFileURL } from "node:url";
6
+ import { describe, expect, it } from "vitest";
7
+
8
+ /**
9
+ * #4909 end to end: `chant dev generated-check` through the real CLI, on a
10
+ * product whose release workflow `chant release workflow` writes, the render
11
+ * terragucci's `just ci-check` had to strip `--output` from with sed; and
12
+ * `chant dev local-image` on a pinned and a local chant.
13
+ */
14
+
15
+ const here = dirname(fileURLToPath(import.meta.url));
16
+ const mainTs = resolve(here, "cli/main.ts");
17
+ const tsxLoader = pathToFileURL(resolve(here, "../../../node_modules/tsx/dist/loader.mjs")).href;
18
+ const chantCommand = `${JSON.stringify(process.execPath)} --import ${tsxLoader} ${JSON.stringify(mainTs)}`;
19
+
20
+ const write = (file: string, body: string | object) => {
21
+ mkdirSync(dirname(file), { recursive: true });
22
+ writeFileSync(file, typeof body === "string" ? body : JSON.stringify(body, null, 2) + "\n");
23
+ };
24
+
25
+ const chant = (cwd: string, ...args: string[]) => spawnSync(process.execPath, ["--import", tsxLoader, mainTs, ...args], { cwd, encoding: "utf8", env: { ...process.env, NO_COLOR: "1" }, timeout: 110_000 });
26
+
27
+ /** A git repository holding a chant workspace with a committed release workflow. */
28
+ function product(): string {
29
+ const dir = realpathSync(mkdtempSync(join(tmpdir(), "chant-4909-e2e-")));
30
+ write(join(dir, "chant.workspace.json"), { name: "product", schema: 1, members: [] });
31
+ write(join(dir, "chant.config.json"), { lexicons: [] });
32
+ write(join(dir, "package.json"), {
33
+ name: "product",
34
+ private: true,
35
+ chantGenerated: {
36
+ regenerate: "chant release workflow --forge github",
37
+ // #4950: no --output; under the check the default file goes to the render tree.
38
+ renders: [{ name: "release", run: `${chantCommand} release workflow --forge github`, files: [".github/workflows/chant-release.yml"] }],
39
+ },
40
+ });
41
+ mkdirSync(join(dir, ".github/workflows"), { recursive: true });
42
+ expect(spawnSync("git", ["init", "-q"], { cwd: dir }).status).toBe(0);
43
+ return dir;
44
+ }
45
+
46
+ describe("chant dev generated-check (#4909)", () => {
47
+ it("passes on the committed release workflow, then fails a hand edit and leaves the render tree", () => {
48
+ const dir = product();
49
+ const written = chant(dir, "release", "workflow", "--forge", "github");
50
+ expect(written.status).toBe(0);
51
+ const committed = readFileSync(join(dir, ".github/workflows/chant-release.yml"), "utf8");
52
+ expect(committed.split("\n")[0]).not.toContain("--output");
53
+
54
+ const ok = chant(dir, "dev", "generated-check", "--json");
55
+ expect(ok.status).toBe(0);
56
+ const result = JSON.parse(ok.stdout);
57
+ expect(result.matched).toEqual([".github/workflows/chant-release.yml"]);
58
+ // The check rendered beside the product and wrote nothing in it.
59
+ expect(readFileSync(join(dir, ".github/workflows/chant-release.yml"), "utf8")).toBe(committed);
60
+ expect(readFileSync(join(result.out, ".github/workflows/chant-release.yml"), "utf8")).toBe(committed);
61
+
62
+ writeFileSync(join(dir, ".github/workflows/chant-release.yml"), committed.replace("name: chant release", "name: hand edited"));
63
+ const bad = chant(dir, "dev", "generated-check");
64
+ expect(bad.status).toBe(1);
65
+ expect(bad.stderr).toContain(".github/workflows/chant-release.yml is not what 'release' renders. Run 'chant release workflow --forge github' and commit the result.");
66
+ expect(bad.stderr).toContain("+ name: chant release");
67
+ expect(bad.stderr).toMatch(/the renders are in .*chant-generated-/);
68
+ }, 120_000);
69
+
70
+ it("writes a module's file-text export in place with dev render, then checks it as a module render (#4950)", () => {
71
+ const dir = realpathSync(mkdtempSync(join(tmpdir(), "chant-4950-e2e-")));
72
+ write(join(dir, "src/images.ts"), `export const dockerfiles = (): Record<string, string> => ({ "images/a/Dockerfile": "FROM a\\n" });\n`);
73
+ write(join(dir, "package.json"), { name: "product", private: true, chantGenerated: { regenerate: "chant dev render src/images.ts dockerfiles", renders: [{ name: "images", module: "src/images.ts", export: "dockerfiles" }] } });
74
+ const missing = chant(dir, "dev", "generated-check");
75
+ expect(missing.status).toBe(1);
76
+ expect(missing.stderr).toContain("images/a/Dockerfile is what 'images' renders, but it is not committed.");
77
+
78
+ const rendered = chant(dir, "dev", "render", "src/images.ts", "dockerfiles");
79
+ expect(rendered.status).toBe(0);
80
+ expect(readFileSync(join(dir, "images/a/Dockerfile"), "utf8")).toBe("FROM a\n");
81
+ const ok = chant(dir, "dev", "generated-check", "--json");
82
+ expect(ok.status).toBe(0);
83
+ expect(JSON.parse(ok.stdout).matched).toEqual(["images/a/Dockerfile"]);
84
+
85
+ const usage = chant(dir, "dev", "render", "src/images.ts");
86
+ expect(usage.status).toBe(2);
87
+ }, 120_000);
88
+
89
+ it("refuses a product with no chantGenerated", () => {
90
+ const dir = realpathSync(mkdtempSync(join(tmpdir(), "chant-4909-e2e-none-")));
91
+ write(join(dir, "package.json"), { name: "none" });
92
+ const r = chant(dir, "dev", "generated-check");
93
+ expect(r.status).toBe(2);
94
+ expect(r.stderr).toContain("declares no chantGenerated");
95
+ }, 60_000);
96
+ });
97
+
98
+ describe("chant dev local-image (#4909)", () => {
99
+ it("names the pin, then the local build and its build context, and refuses a missing tarball", () => {
100
+ const dir = realpathSync(mkdtempSync(join(tmpdir(), "chant-4909-e2e-image-")));
101
+ write(join(dir, "package.json"), { name: "product", private: true, devDependencies: { "@intentius/chant": "1.2.3" } });
102
+ write(join(dir, "node_modules/@intentius/chant/package.json"), { name: "@intentius/chant", version: "1.2.3" });
103
+ const pinned = chant(dir, "dev", "local-image");
104
+ expect(pinned.status).toBe(0);
105
+ expect(pinned.stdout.trim()).toBe("1.2.3");
106
+
107
+ write(join(dir, "node_modules/@intentius/chant/package.json"), { name: "@intentius/chant", version: "1.3.0", chantLocal: { commit: "abc123", dir: "/chant" } });
108
+ write(join(dir, ".chant-local/commit"), "abc123\n");
109
+ write(join(dir, ".chant-local/intentius-chant.tgz"), "tgz");
110
+ const local = chant(dir, "dev", "local-image", "--json");
111
+ expect(local.status).toBe(0);
112
+ expect(JSON.parse(local.stdout).args).toEqual(["--build-context", `chant-local=${join(dir, ".chant-local")}`, "--build-arg", "CHANT_VERSION=local-abc123"]);
113
+
114
+ const missing = chant(dir, "dev", "local-image", "--with", "@intentius/chant-lexicon-fountain");
115
+ expect(missing.status).toBe(1);
116
+ expect(missing.stderr).toContain("no tarball for @intentius/chant-lexicon-fountain; run chant dev local again with --with @intentius/chant-lexicon-fountain");
117
+ }, 60_000);
118
+ });
@@ -0,0 +1,170 @@
1
+ import { existsSync, mkdirSync, mkdtempSync, readFileSync, writeFileSync } from "node:fs";
2
+ import { tmpdir } from "node:os";
3
+ import { dirname, join } from "node:path";
4
+ import { afterEach, describe, expect, it } from "vitest";
5
+ import { checkGenerated, committedPathOf, diffLines, GENERATED_OUT_ENV, GENERATED_ROOT_ENV, isRenderPath, readGeneratedCheckConfig, renderPathOf, type GeneratedCheckConfig } from "./generated-check";
6
+
7
+ /** #4909: a product's generated files checked by chant instead of terragucci's `just ci-check` and plywood's `--check` scripts. */
8
+
9
+ const write = (file: string, body: string | object) => {
10
+ mkdirSync(dirname(file), { recursive: true });
11
+ writeFileSync(file, typeof body === "string" ? body : JSON.stringify(body, null, 2) + "\n");
12
+ };
13
+
14
+ /** A product whose committed files are what its renders write: a workflow, two Dockerfiles by pattern, and a script that checks itself. */
15
+ function product(): { dir: string; config: GeneratedCheckConfig } {
16
+ const dir = mkdtempSync(join(tmpdir(), "chant-4909-product-"));
17
+ write(join(dir, ".github/workflows/ci.yml"), "name: ci\non: push\n");
18
+ write(join(dir, "images/Dockerfile.tofu"), "FROM tofu\n");
19
+ write(join(dir, "images/Dockerfile.node"), "FROM node\n");
20
+ write(join(dir, "images/images.ts"), "// the source\n");
21
+ const config: GeneratedCheckConfig = {
22
+ regenerate: "just ci",
23
+ renders: [
24
+ { name: "ci", run: "mkdir -p {out}/.github/workflows && printf 'name: ci\\non: push\\n' > {out}/.github/workflows/ci.yml", files: [".github/workflows/ci.yml"] },
25
+ { name: "images", run: 'mkdir -p "$CHANT_GENERATED_OUT/images" && printf "FROM tofu\\n" > "$CHANT_GENERATED_OUT/images/Dockerfile.tofu" && printf "FROM node\\n" > "$CHANT_GENERATED_OUT/images/Dockerfile.node"', files: ["images/Dockerfile.*"] },
26
+ { name: "dashboards", run: "true" },
27
+ ],
28
+ };
29
+ write(join(dir, "package.json"), { name: "product", private: true, chantGenerated: config });
30
+ return { dir, config };
31
+ }
32
+
33
+ describe("checkGenerated (#4909)", () => {
34
+ it("passes when every committed file is its render, and leaves the render tree", async () => {
35
+ const { dir, config } = product();
36
+ const r = await checkGenerated(dir, config);
37
+ expect(r.problems).toEqual([]);
38
+ expect(r.ok).toBe(true);
39
+ expect(r.matched).toEqual([".github/workflows/ci.yml", "images/Dockerfile.node", "images/Dockerfile.tofu"]);
40
+ expect(r.out).toContain("chant-generated-");
41
+ expect(readFileSync(join(r.out, "images/Dockerfile.tofu"), "utf8")).toBe("FROM tofu\n");
42
+ });
43
+
44
+ it("fails a hand edit with a diff and the regenerate command, and a file on one side only", async () => {
45
+ const { dir, config } = product();
46
+ write(join(dir, ".github/workflows/ci.yml"), "name: ci\non: pull_request\n");
47
+ write(join(dir, "images/Dockerfile.old"), "FROM old\n");
48
+ const r = await checkGenerated(dir, config);
49
+ expect(r.ok).toBe(false);
50
+ expect(r.problems[0]).toContain(".github/workflows/ci.yml is not what 'ci' renders. Run 'just ci' and commit the result.");
51
+ expect(r.problems[0]).toContain("- on: pull_request");
52
+ expect(r.problems[0]).toContain("+ on: push");
53
+ expect(r.problems[1]).toBe("images/Dockerfile.old is committed, but 'images' no longer renders it. Run 'just ci' and commit the result.");
54
+ expect(existsSync(r.out)).toBe(true);
55
+ });
56
+
57
+ it("fails a render that exits non-zero or writes nothing, and a name it does not have", async () => {
58
+ const { dir } = product();
59
+ const r = await checkGenerated(dir, {
60
+ renders: [
61
+ { name: "broken", run: "echo nope >&2; exit 3", files: ["a.yml"] },
62
+ { name: "silent", run: "true", files: [".github/workflows/ci.yml"] },
63
+ ],
64
+ }, { only: ["broken", "silent", "absent"] });
65
+ expect(r.problems).toEqual([
66
+ "chantGenerated has no render named 'absent'",
67
+ "render 'broken' exited 3: echo nope >&2; exit 3\n nope",
68
+ "render 'silent' wrote no .github/workflows/ci.yml under the render tree",
69
+ ]);
70
+ });
71
+
72
+ it("reads chantGenerated and refuses a malformed one", () => {
73
+ const { dir, config } = product();
74
+ expect(readGeneratedCheckConfig(dir)).toEqual(config);
75
+ write(join(dir, "package.json"), { chantGenerated: { renders: [{ name: "x", run: "true", files: ["../outside"] }] } });
76
+ expect(() => readGeneratedCheckConfig(dir)).toThrow("must be paths inside the product");
77
+ write(join(dir, "package.json"), { name: "none" });
78
+ expect(readGeneratedCheckConfig(dir)).toBeUndefined();
79
+ });
80
+
81
+ it("diffs from the first line that differs", () => {
82
+ expect(diffLines("a\nb\nc\nd\n", "a\nb\nX\nd\n")).toEqual(["@@ line 3 @@", " a", " b", "- c", "+ X"]);
83
+ });
84
+ });
85
+
86
+ describe("a module render (#4950)", () => {
87
+ /** plywood's shape: a TypeScript module whose export returns each Dockerfile by its path from the root. */
88
+ function moduleProduct(): string {
89
+ const dir = mkdtempSync(join(tmpdir(), "chant-4950-module-"));
90
+ write(join(dir, "images/a/Dockerfile"), "FROM a\n");
91
+ write(join(dir, "images/b/Dockerfile"), "FROM b\n");
92
+ write(join(dir, "schema.json"), "{}\n");
93
+ write(
94
+ join(dir, "src/images.ts"),
95
+ [
96
+ `const names: string[] = ["a", "b"];`,
97
+ `export function dockerfiles(): Record<string, string> {`,
98
+ ` return Object.fromEntries(names.map((n) => [\`images/\${n}/Dockerfile\`, \`FROM \${n}\\n\`]));`,
99
+ `}`,
100
+ `export const schema = { "schema.json": "{}\\n" };`,
101
+ `export const outside = async () => ({ "../escape": "x" });`,
102
+ `export const notFiles = () => 3;`,
103
+ ].join("\n"),
104
+ );
105
+ return dir;
106
+ }
107
+
108
+ it("renders a function's or an object's files into the render tree and compares them, all of them with no files listed", async () => {
109
+ const dir = moduleProduct();
110
+ const r = await checkGenerated(dir, {
111
+ renders: [
112
+ { name: "images", module: "src/images.ts", export: "dockerfiles" },
113
+ { name: "schema", module: "src/images.ts", export: "schema", files: ["schema.json"] },
114
+ ],
115
+ });
116
+ expect(r.problems).toEqual([]);
117
+ expect(r.matched).toEqual(["images/a/Dockerfile", "images/b/Dockerfile", "schema.json"]);
118
+ expect(r.renders[0]!.command).toBe("chant dev render src/images.ts dockerfiles");
119
+ expect(readFileSync(join(r.out, "images/b/Dockerfile"), "utf8")).toBe("FROM b\n");
120
+ });
121
+
122
+ it("fails a drifted file, a missing export, a path outside the root and an export that is not files", async () => {
123
+ const dir = moduleProduct();
124
+ write(join(dir, "images/a/Dockerfile"), "FROM hand\n");
125
+ const r = await checkGenerated(dir, {
126
+ renders: [
127
+ { name: "images", module: "src/images.ts", export: "dockerfiles" },
128
+ { name: "absent", module: "src/images.ts", export: "nope" },
129
+ { name: "outside", module: "src/images.ts", export: "outside" },
130
+ { name: "number", module: "src/images.ts", export: "notFiles" },
131
+ ],
132
+ });
133
+ expect(r.problems[0]).toContain("images/a/Dockerfile is not what 'images' renders.");
134
+ expect(r.problems[1]).toBe("render 'absent' exited 1: chant dev render src/images.ts nope\n src/images.ts has no export named nope");
135
+ expect(r.problems[2]).toContain(`src/images.ts export outside names "../escape", which is not a relative path inside the output root`);
136
+ expect(r.problems[3]).toContain("src/images.ts export notFiles must be, or return, an object of file paths to their text");
137
+ });
138
+
139
+ it("reads a module render and refuses one with both a command and a module, or a module with no export", () => {
140
+ const dir = moduleProduct();
141
+ write(join(dir, "package.json"), { chantGenerated: { renders: [{ name: "images", module: "src/images.ts", export: "dockerfiles" }] } });
142
+ expect(readGeneratedCheckConfig(dir)?.renders[0]).toEqual({ name: "images", module: "src/images.ts", export: "dockerfiles" });
143
+ write(join(dir, "package.json"), { chantGenerated: { renders: [{ name: "x", run: "true", module: "src/images.ts", export: "dockerfiles" }] } });
144
+ expect(() => readGeneratedCheckConfig(dir)).toThrow("needs a run command, or a module and its export");
145
+ write(join(dir, "package.json"), { chantGenerated: { renders: [{ name: "x", module: "src/images.ts" }] } });
146
+ expect(() => readGeneratedCheckConfig(dir)).toThrow("needs a module and the name of its export");
147
+ write(join(dir, "package.json"), { chantGenerated: { renders: [{ name: "x", module: "../src/images.ts", export: "dockerfiles" }] } });
148
+ expect(() => readGeneratedCheckConfig(dir)).toThrow("module must be a path inside the product");
149
+ });
150
+ });
151
+
152
+ describe("chant's writers under a check (#4909)", () => {
153
+ afterEach(() => {
154
+ delete process.env[GENERATED_OUT_ENV];
155
+ delete process.env[GENERATED_ROOT_ENV];
156
+ });
157
+
158
+ it("move a product path into the render tree and name a render path as the committed one", () => {
159
+ expect(renderPathOf("/p/.github/workflows/a.yml")).toBe("/p/.github/workflows/a.yml");
160
+ process.env[GENERATED_OUT_ENV] = "/t/out";
161
+ process.env[GENERATED_ROOT_ENV] = "/p";
162
+ expect(renderPathOf("/p/.github/workflows/a.yml")).toBe("/t/out/.github/workflows/a.yml");
163
+ expect(renderPathOf("/elsewhere/a.yml")).toBe("/elsewhere/a.yml");
164
+ expect(renderPathOf("/t/out/a.yml")).toBe("/t/out/a.yml");
165
+ expect(committedPathOf("/t/out/.github/workflows/a.yml")).toBe("/p/.github/workflows/a.yml");
166
+ expect(committedPathOf("/p/a.yml")).toBe("/p/a.yml");
167
+ expect(isRenderPath("/t/out/x")).toBe(true);
168
+ expect(isRenderPath("/t/outside/x")).toBe(false);
169
+ });
170
+ });