@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
package/dist/ci-login.js CHANGED
@@ -23,8 +23,11 @@
23
23
  * `/tmp`), mode 0600. Then it sets:
24
24
  *
25
25
  * AWS AWS_ROLE_ARN, AWS_WEB_IDENTITY_TOKEN_FILE, AWS_ROLE_SESSION_NAME,
26
- * AWS_REGION, AWS_DEFAULT_REGION (and AWS_ENDPOINT_URL_STS with
27
- * `endpoint`)
26
+ * with `region` AWS_REGION and AWS_DEFAULT_REGION (else the job
27
+ * keeps its own, #4930), and AWS_ENDPOINT_URL_STS with
28
+ * `endpoint`. With no role the job gets the token file and the
29
+ * session name alone, for a tool that assumes its own roles,
30
+ * such as Terragrunt's `credentials` (#4930)
28
31
  * GCP GOOGLE_APPLICATION_CREDENTIALS and
29
32
  * CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE, an `external_account`
30
33
  * file per service account that trades the token at Google's STS
@@ -37,9 +40,11 @@
37
40
  *
38
41
  * gcloud reads CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE, so it needs no
39
42
  * `gcloud auth login`. On GitHub and Forgejo the variables go to
40
- * `$GITHUB_ENV`; on GitLab the script evaluates the `export` lines the
41
- * login prints, which name files and hold no token, then unsets the token
42
- * variables and the spec. No file of variables is left to delete.
43
+ * `$GITHUB_ENV`, which later steps read; on GitLab the script evaluates the
44
+ * `export` lines the login prints, which name files and hold no token, then
45
+ * unsets the token variables and the spec. No file of variables is left to
46
+ * delete. With {@link CloudLoginOptions.sameStep} every forge takes the
47
+ * GitLab form, so the step that logs in can run the tool too (#4930).
43
48
  *
44
49
  * Per target and per stage: the spec is a {@link CloudTradeSpec} without
45
50
  * Pulumi, the plan or apply side of what `resolveCloudIdentity` gives, so a
@@ -47,7 +52,9 @@
47
52
  * other targets take (#4332). The step then writes the
48
53
  * {@link CLOUD_TARGETS_ENV} file the trade writes, each identity's
49
54
  * variables in it, and a product hands each target's tool its own with
50
- * `targetCloudEnv`, as after the trade.
55
+ * `targetCloudEnv`, as after the trade. The login sets no
56
+ * `CLOUD_TRADED_ENV`, which the trade does, so a product tells the login's
57
+ * targets file from a trade's (#4930).
51
58
  *
52
59
  * The functions return {@link OpWaveRunStep}s and the job's `idTokens`, the
53
60
  * shape `OpWavesPipelineOptions.waveJobs[].before` and `recordPlans` take
@@ -55,8 +62,27 @@
55
62
  * writing it into their files.
56
63
  */
57
64
  import { CLOUD_TARGETS_ENV, IDENTITY_KEY, idTokenVar, } from "./ci-identity.js";
65
+ import { restartWithout } from "./ci-handover.js";
58
66
  /** The variable the login step reads its {@link CloudLoginSpec} from, as JSON. */
59
67
  export const LOGIN_SPEC_ENV = "CHANT_CLOUD_LOGIN";
68
+ /**
69
+ * The variable the login sets (#4912): the token files it wrote itself,
70
+ * joined by `:`. A runner's `tokenFile` is not among them.
71
+ * {@link LOGIN_CLEAR_TOKENS} empties them.
72
+ */
73
+ export const LOGIN_TOKEN_FILES_ENV = "CHANT_CLOUD_TOKEN_FILES";
74
+ /**
75
+ * A shell line that empties each file {@link LOGIN_TOKEN_FILES_ENV} names
76
+ * (#4912), so a step that runs after the cloud's tool finds no token in
77
+ * them. It truncates and deletes nothing. The login's `restart` runs it
78
+ * when the step exits. A job whose login is a step of its own runs it in
79
+ * the step after the tool's last use.
80
+ */
81
+ export const LOGIN_CLEAR_TOKENS = `(set -f; IFS=:; for f in \${${LOGIN_TOKEN_FILES_ENV}:-}; do [ ! -f "$f" ] || : > "$f"; done)`;
82
+ /** The marker of a step the login's `restart` started again (#4912): its login is done. */
83
+ export const LOGIN_RESTART_MARKER = "CHANT_CLOUD_LOGGED_IN";
84
+ /** The variables a GitHub or Forgejo step requests an OIDC token with. */
85
+ const ACTIONS_REQUEST_VARS = ["ACTIONS_ID_TOKEN_REQUEST_URL", "ACTIONS_ID_TOKEN_REQUEST_TOKEN"];
60
86
  const LOGIN_CLOUDS = ["aws", "gcp", "azure"];
61
87
  /** The provider's resource name without the `//iam.googleapis.com/` prefix, as ci-identity reads it. */
62
88
  const providerPath = (p) => p.replace(/^(https:)?\/\/iam\.googleapis\.com\//, "");
@@ -72,8 +98,9 @@ export function cloudLoginSpec(spec) {
72
98
  if (spec.azure?.database)
73
99
  throw new Error("a cloud login gives Azure no database token: trade the token with ci-identity's trade step for azure.database");
74
100
  const out = {};
101
+ // #4930: no default region, so the job's own stays. A named one stays where the spec put it, so the step renders as before.
75
102
  if (spec.aws)
76
- out.aws = { ...spec.aws, region: spec.aws.region ?? "us-east-1", audience: spec.aws.audience ?? "sts.amazonaws.com" };
103
+ out.aws = { ...spec.aws, audience: spec.aws.audience ?? "sts.amazonaws.com" };
77
104
  if (spec.gcp) {
78
105
  const provider = providerPath(spec.gcp.provider);
79
106
  out.gcp = { ...spec.gcp, provider, audience: spec.gcp.audience ?? `https://iam.googleapis.com/${provider}` };
@@ -86,7 +113,8 @@ export function cloudLoginSpec(spec) {
86
113
  continue;
87
114
  const key = IDENTITY_KEY[cloud];
88
115
  const ids = [c[key], ...(c.targets ?? []).map((t) => t[key])].filter((v) => v !== undefined);
89
- if (ids.length === 0)
116
+ // #4930: AWS with no role is the token file alone. GCP's credential file and Azure's variables name an identity.
117
+ if (ids.length === 0 && cloud !== "aws")
90
118
  throw new Error(`the ${cloud} login names no identity: give it ${key}, or targets`);
91
119
  for (const [k, v] of Object.entries(c)) {
92
120
  if (typeof v === "string" && !SAFE.test(v))
@@ -123,6 +151,7 @@ export const LOGIN_JS = [
123
151
  'const rand=()=>crypto.randomBytes(8).toString("hex");',
124
152
  'const NO={github:"it needs permissions: id-token: write, and a pull request from a fork gets none",forgejo:"Forgejo serves one from version 15, with Forgejo Runner 12.5 or later, to a job with enable-openid-connect: true; on an older Forgejo give the cloud a tokenFile the runner provides"};',
125
153
  // A cloud's token: the runner's file, else GitLab's id_tokens variable, else the forge's request URL, into a file of its own.
154
+ "const mine=[];",
126
155
  "const tokenFile=async(cloud,s)=>{",
127
156
  'if(s.tokenFile){const f=s.tokenFile.replace(/^\\$\\{?([A-Za-z_][A-Za-z0-9_]*)\\}?/,(m,v)=>process.env[v]||"");let t;try{t=fs.readFileSync(f,"utf8").trim()}catch{throw new Error(cloud+"\\u0027s tokenFile "+f+" cannot be read")}if(!t)throw new Error(cloud+"\\u0027s tokenFile "+f+" is empty");return f}',
128
157
  'const name="CHANT_ID_TOKEN_"+cloud.toUpperCase();let v=process.env[name];',
@@ -133,18 +162,22 @@ export const LOGIN_JS = [
133
162
  'if(!r.ok)throw new Error("the OIDC token request answered "+r.status);',
134
163
  'try{v=JSON.parse(await r.text()).value}catch{throw new Error("the OIDC token request answered with no JSON")}}',
135
164
  'if(!clean(v))throw new Error("the job\\u0027s OIDC token for "+cloud+" is not a token");',
136
- 'const f=tmp+"/chant-oidc-"+cloud+"-"+rand();fs.writeFileSync(f,v,{mode:0o600,flag:"wx"});return f};',
165
+ 'const f=tmp+"/chant-oidc-"+cloud+"-"+rand();fs.writeFileSync(f,v,{mode:0o600,flag:"wx"});mine.push(f);return f};',
137
166
  `const KEY=${JSON.stringify(IDENTITY_KEY)};`,
138
167
  'const ids=(c)=>{const s=spec[c],l=[];if(s[KEY[c]])l.push(s[KEY[c]]);for(const t of s.targets||[])if(!l.includes(t[KEY[c]]))l.push(t[KEY[c]]);return l};',
139
168
  "const vars={},said=[],by={};",
140
169
  "const run=async()=>{",
141
170
  'if(spec.aws){const a=spec.aws;const f=await tokenFile("aws",a);by.aws={};',
142
- 'for(const role of ids("aws")){by.aws[role]={AWS_ROLE_ARN:role,AWS_WEB_IDENTITY_TOKEN_FILE:f,AWS_ROLE_SESSION_NAME:a.sessionName||"chant",AWS_REGION:a.region,AWS_DEFAULT_REGION:a.region,...(a.endpoint?{AWS_ENDPOINT_URL_STS:trim(a.endpoint)}:{})};said.push(role)}',
143
- "if(a.role)Object.assign(vars,by.aws[a.role])}",
171
+ // #4930: the region only when the spec names one; with no role of the job's own, the token file and session name alone.
172
+ 'const base={AWS_WEB_IDENTITY_TOKEN_FILE:f,AWS_ROLE_SESSION_NAME:a.sessionName||"chant",...(a.region?{AWS_REGION:a.region,AWS_DEFAULT_REGION:a.region}:{}),...(a.endpoint?{AWS_ENDPOINT_URL_STS:trim(a.endpoint)}:{})};',
173
+ 'for(const role of ids("aws")){by.aws[role]={AWS_ROLE_ARN:role,...base};said.push(role)}',
174
+ 'if(a.role)Object.assign(vars,by.aws[a.role]);else{Object.assign(vars,base);console.error("chant: wrote the aws OIDC token file, with no role of the job\\u0027s own")}}',
144
175
  'if(spec.gcp){const c=spec.gcp;const f=await tokenFile("gcp",c);by.gcp={};',
145
176
  'const sts=trim(c.stsEndpoint||"https://sts.googleapis.com"),iam=trim(c.iamEndpoint||"https://iamcredentials.googleapis.com");',
177
+ // #4912: stsEndpoint is Google's STS, or its full token URL (terragucci's `token_url`).
178
+ 'const tu=/\\/token$/.test(sts)?sts:sts+"/v1/token";',
146
179
  'for(const sa of ids("gcp")){const cf=tmp+"/chant-gcp-"+rand()+".json";',
147
- 'fs.writeFileSync(cf,JSON.stringify({type:"external_account",audience:"//iam.googleapis.com/"+c.provider,subject_token_type:"urn:ietf:params:oauth:token-type:jwt",token_url:sts+"/v1/token",service_account_impersonation_url:iam+"/v1/projects/-/serviceAccounts/"+sa+":generateAccessToken",credential_source:{file:f}})+"\\n",{mode:0o600,flag:"wx"});',
180
+ 'fs.writeFileSync(cf,JSON.stringify({type:"external_account",audience:"//iam.googleapis.com/"+c.provider,subject_token_type:"urn:ietf:params:oauth:token-type:jwt",token_url:tu,service_account_impersonation_url:iam+"/v1/projects/-/serviceAccounts/"+sa+":generateAccessToken",credential_source:{file:f}})+"\\n",{mode:0o600,flag:"wx"});',
148
181
  "by.gcp[sa]={GOOGLE_APPLICATION_CREDENTIALS:cf,CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE:cf};said.push(sa)}",
149
182
  "if(c.serviceAccount)Object.assign(vars,by.gcp[c.serviceAccount])}",
150
183
  'if(spec.azure){const z=spec.azure;const f=await tokenFile("azure",z);by.azure={};',
@@ -158,6 +191,8 @@ export const LOGIN_JS = [
158
191
  'const clouds=Object.keys(by);if(clouds.some((c)=>(spec[c].targets||[]).length>0)){',
159
192
  'const doc={version:1,clouds:{}};for(const c of clouds){const s=spec[c];doc.clouds[c]={...(s[KEY[c]]?{default:s[KEY[c]]}:{}),targets:(s.targets||[]).map((t)=>({targets:t.targets,identity:t[KEY[c]]})),vars:by[c]}}',
160
193
  `const tf=tmp+"/chant-cloud-targets-"+rand()+".json";fs.writeFileSync(tf,JSON.stringify(doc),{mode:0o600,flag:"wx"});vars.${CLOUD_TARGETS_ENV}=tf}`,
194
+ // #4912: the token files the login wrote, which LOGIN_CLEAR_TOKENS empties; a runner's own stays out.
195
+ `if(mine.length)vars.${LOGIN_TOKEN_FILES_ENV}=mine.join(":");`,
161
196
  'for(const [k,v] of Object.entries(vars))if(!clean(v))throw new Error(k+" is not a value the job can hold");',
162
197
  'if(format==="github-env")fs.appendFileSync(out,Object.entries(vars).map(([k,v])=>k+"="+v+"\\n").join(""));',
163
198
  'else process.stdout.write(Object.entries(vars).map(([k,v])=>"export "+k+"="+Q+v.split(Q).join(Q+"\\\\"+Q+Q)+Q+"\\n").join(""));',
@@ -175,11 +210,36 @@ const stepName = (spec) => `Cloud login (chant ci-login: ${LOGIN_CLOUDS.filter((
175
210
  export function loginLine(out, format, forge) {
176
211
  return `(cd / && node -e '${LOGIN_JS}' "${out}" ${format} ${forge})`;
177
212
  }
178
- /** A GitHub Actions or Forgejo Actions login: one step that appends the variables to `$GITHUB_ENV`. */
179
- function actionsLogin(forge, given) {
213
+ /**
214
+ * The lines that log in and evaluate the variables in the shell that runs
215
+ * them, then unset what held them and `unset`: GitLab's script, and with
216
+ * `sameStep` (#4930) any forge's step. `exit` stops a script with `-e` off.
217
+ */
218
+ function shellLines(spec, forge, unset, exit) {
219
+ return [
220
+ `export ${LOGIN_SPEC_ENV}=${sh(JSON.stringify(spec))}`,
221
+ // An assignment's status is its command substitution's, so a failed login stops the script.
222
+ `${GITLAB_LOGIN_VARS}="$${loginLine("-", "sh", forge)}"${exit ? " || exit 1" : ""}`,
223
+ `eval "$${GITLAB_LOGIN_VARS}"`,
224
+ `unset ${[GITLAB_LOGIN_VARS, LOGIN_SPEC_ENV, ...unset].join(" ")}`,
225
+ ];
226
+ }
227
+ /** The `restart` option, filled: undefined without it. */
228
+ const restartOf = (options) => (options.restart ? (options.restart === true ? {} : options.restart) : undefined);
229
+ /** The trap a restarted login sets: the login's token files emptied when the step exits (#4912). */
230
+ const clearOnExit = `trap ${sh(LOGIN_CLEAR_TOKENS)} EXIT`;
231
+ /** A GitHub Actions or Forgejo Actions login: one step that appends the variables to `$GITHUB_ENV`, or with `sameStep` exports them in its own shell. */
232
+ function actionsLogin(forge, given, options = {}) {
180
233
  const spec = cloudLoginSpec(given);
181
234
  if (Object.keys(spec).length === 0)
182
235
  return { steps: [], idTokens: {} };
236
+ const restart = restartOf(options);
237
+ if (restart) {
238
+ const lines = [`if [ -z "\${${LOGIN_RESTART_MARKER}:-}" ]; then`, ...shellLines(spec, forge, [], true), "fi", restartWithout(restart.shell ?? "bash", [...ACTIONS_REQUEST_VARS, ...(restart.also ?? [])], LOGIN_RESTART_MARKER), clearOnExit];
239
+ return { steps: [{ name: stepName(spec), run: lines }], idTokens: loginIdTokens(spec) };
240
+ }
241
+ if (options.sameStep)
242
+ return { steps: [{ name: stepName(spec), run: shellLines(spec, forge, [], true) }], idTokens: loginIdTokens(spec) };
183
243
  return {
184
244
  steps: [{ name: stepName(spec), run: [`export ${LOGIN_SPEC_ENV}=${sh(JSON.stringify(spec))}`, loginLine("$GITHUB_ENV", "github-env", forge)] }],
185
245
  idTokens: loginIdTokens(spec),
@@ -191,8 +251,8 @@ function actionsLogin(forge, given) {
191
251
  * variables to `$GITHUB_ENV`, so every later step has them. The job needs
192
252
  * `id-token: write`, which `idTokens` asks chant's generators for.
193
253
  */
194
- export function githubCloudLogin(spec) {
195
- return actionsLogin("github", spec);
254
+ export function githubCloudLogin(spec, options) {
255
+ return actionsLogin("github", spec, options);
196
256
  }
197
257
  /**
198
258
  * A Forgejo Actions job's cloud login (#4788), as on GitHub. Forgejo 15 with
@@ -201,10 +261,10 @@ export function githubCloudLogin(spec) {
201
261
  * that asks for `id-token: write`. On an older Forgejo, give each cloud a
202
262
  * `tokenFile` the runner provides; the job then requests none.
203
263
  */
204
- export function forgejoCloudLogin(spec) {
205
- return actionsLogin("forgejo", spec);
264
+ export function forgejoCloudLogin(spec, options) {
265
+ return actionsLogin("forgejo", spec, options);
206
266
  }
207
- /** The GitLab variable the login's `export` lines are kept in until the script evaluates them. */
267
+ /** The variable the login's `export` lines are kept in until the script evaluates them: GitLab's, and with `sameStep` any forge's (#4930). */
208
268
  export const GITLAB_LOGIN_VARS = "CHANT_CLOUD_LOGIN_VARS";
209
269
  /**
210
270
  * A GitLab CI job's cloud login (#4788): script lines that write each
@@ -213,28 +273,20 @@ export const GITLAB_LOGIN_VARS = "CHANT_CLOUD_LOGIN_VARS";
213
273
  * only in its file. The job's `id_tokens:` are `idTokens`, each
214
274
  * `{ aud: <audience> }`.
215
275
  */
216
- export function gitlabCloudLogin(given) {
276
+ export function gitlabCloudLogin(given, options = {}) {
217
277
  const spec = cloudLoginSpec(given);
218
278
  if (Object.keys(spec).length === 0)
219
279
  return { steps: [], idTokens: {} };
220
280
  const idTokens = loginIdTokens(spec);
221
- return {
222
- steps: [
223
- {
224
- name: stepName(spec),
225
- run: [
226
- `export ${LOGIN_SPEC_ENV}=${sh(JSON.stringify(spec))}`,
227
- // An assignment's status is its command substitution's, so a failed login stops the script.
228
- `${GITLAB_LOGIN_VARS}="$${loginLine("-", "sh", "gitlab")}"`,
229
- `eval "$${GITLAB_LOGIN_VARS}"`,
230
- `unset ${[GITLAB_LOGIN_VARS, LOGIN_SPEC_ENV, ...Object.keys(idTokens)].join(" ")}`,
231
- ],
232
- },
233
- ],
234
- idTokens,
235
- };
281
+ const restart = restartOf(options);
282
+ // A GitLab script is one shell already; sameStep adds `|| exit 1`, for a script with -e off.
283
+ const lines = shellLines(spec, "gitlab", Object.keys(idTokens), options.sameStep === true || restart !== undefined);
284
+ // #4912: GitLab's script is no file to restart; the id_tokens variables are unset above, `also` here.
285
+ if (restart)
286
+ lines.push(...(restart.also?.length ? [`unset ${restart.also.join(" ")}`] : []), clearOnExit);
287
+ return { steps: [{ name: stepName(spec), run: lines }], idTokens };
236
288
  }
237
289
  /** A job's cloud login on `forge` (#4788): {@link githubCloudLogin}, {@link gitlabCloudLogin} or {@link forgejoCloudLogin}. */
238
- export function cloudLogin(forge, spec) {
239
- return forge === "gitlab" ? gitlabCloudLogin(spec) : actionsLogin(forge, spec);
290
+ export function cloudLogin(forge, spec, options) {
291
+ return forge === "gitlab" ? gitlabCloudLogin(spec, options) : actionsLogin(forge, spec, options);
240
292
  }
@@ -27,8 +27,8 @@
27
27
  * token and holds no cloud credentials.
28
28
  */
29
29
  import { type CiProductWords, type ParsedProductComment } from "./ci-product-words.js";
30
- import { type GitlabForgeOptions, type PrForge } from "./pr-forge.js";
31
- import type { ForgeReads, PullRequestDetail, PullRequestNote } from "./pr-forge-reads.js";
30
+ import { type ForgeKind, type GitlabForgeOptions, type PrForge } from "./pr-forge.js";
31
+ import type { ForgeReads, PullRequestDetail, PullRequestNote, RunJob, WorkflowRun } from "./pr-forge-reads.js";
32
32
  export { GITLAB_NOTE_COMMANDS_VAR } from "./components/pr-pipeline.js";
33
33
  /** How far back the poll reads: merge requests updated, and notes written, in this many minutes. */
34
34
  export declare const NOTE_COMMANDS_WINDOW_MINUTES: number;
@@ -165,6 +165,56 @@ export interface NotePoll {
165
165
  export declare function pollNoteCommands(o: NoteCommandsOptions): Promise<NotePoll>;
166
166
  /** chant's apply jobs and terragucci's: `apply`, `apply-wave-<n>` and `apply-wave-<n>-share-<m>`, a member's prefixed with its name. */
167
167
  export declare const APPLY_JOBS: RegExp;
168
+ /** What starting a merge commit's apply again came to: a reply alone, a run started (`ran`), or a forge answer that broke it. */
169
+ export type ApplyRetried = {
170
+ kind: "reply";
171
+ text: string;
172
+ } | {
173
+ kind: "ran";
174
+ text: string;
175
+ url?: string;
176
+ } | {
177
+ kind: "fail";
178
+ reason: string;
179
+ };
180
+ /** What {@link ApplyRerun} is told: the merge commit, the pull request's name in a reply, who asked, and the default branch. */
181
+ export interface ApplyRerunContext {
182
+ sha: string;
183
+ /** `!12`, or `pull request 12`. */
184
+ at: string;
185
+ user: string;
186
+ base: string;
187
+ /** The pattern the apply jobs matched, whose groups are the wave and the share. */
188
+ pattern: RegExp;
189
+ }
190
+ /**
191
+ * How a forge starts a merge commit's apply again (#4946), once
192
+ * {@link retryApply} found the push run at the commit with apply jobs and no
193
+ * later apply. GitLab retries the first apply job that did not succeed
194
+ * ({@link gitlabRetry}); GitHub and Forgejo answer in ./ci-comment-commands.ts.
195
+ */
196
+ export type ApplyRerun = (run: WorkflowRun, jobs: RunJob[], c: ApplyRerunContext) => Promise<ApplyRetried>;
197
+ /** What {@link retryApply} reads with. */
198
+ export interface ApplyRetryReads {
199
+ reads: ForgeReads;
200
+ /** chant's client: it reads the later commits' statuses. */
201
+ forge: Pick<PrForge, "commitStatuses">;
202
+ words: CiProductWords;
203
+ /** The default branch. */
204
+ base: string;
205
+ }
206
+ /**
207
+ * Start a merged pull request's apply again (#4785; shared with GitHub and
208
+ * Forgejo in #4946): the newest push run at the merge commit that has an
209
+ * apply job, refused when a later commit of the default branch already
210
+ * carries the product's apply status, since going back to this one would
211
+ * undo it. `rerun` is the forge's own start.
212
+ */
213
+ export declare function retryApply(o: ApplyRetryReads, forgeKind: ForgeKind, mr: PullRequestDetail, user: string, run: Extract<NoteRun, {
214
+ kind: "retry";
215
+ }>, rerun: ApplyRerun): Promise<ApplyRetried>;
216
+ /** GitLab's start: retry the first apply job, by wave and share, that did not succeed; the jobs after it follow by themselves. */
217
+ export declare function gitlabRetry(pipelines: Pick<GitlabPipelines, "retryJob">): ApplyRerun;
168
218
  /** The jobs chant's GitLab pipeline has, which {@link chantNoteRuns} starts. */
169
219
  export interface ChantNoteJobs {
170
220
  /** The comment preview (`--preview-comment`): a plan starts it with `CHANT_PREVIEW_PR`. Without it a plan starts a merge request pipeline. */
@@ -179,8 +229,18 @@ export interface ChantNoteJobs {
179
229
  agent?: boolean;
180
230
  /** The commit jobs, started with `CHANT_COMMIT_PR`, `CHANT_COMMIT` and `CHANT_COMMIT_ARG`. */
181
231
  commits?: boolean;
232
+ /**
233
+ * The members the pipeline was written with (#4946), such as terragucci's
234
+ * roots: a plan or an action naming any other gets the words' `member`
235
+ * reply, and nothing starts. Absent: any member a comment may name.
236
+ */
237
+ members?: readonly string[];
182
238
  }
183
- /** What a command runs in chant's own GitLab pipeline, for the jobs it has. */
239
+ /**
240
+ * What a command runs in chant's own GitLab pipeline, for the jobs it has.
241
+ * A command no job runs gets the words' reply for it (`words.replies`,
242
+ * #4946), else chant's.
243
+ */
184
244
  export declare function chantNoteRuns(jobs: ChantNoteJobs): NoteCommandRuns;
185
245
  /** The directory on `chant/lifecycle` that keeps the notes the poll answered. */
186
246
  export declare const NOTES_DIR = "_notes";
@@ -1 +1 @@
1
- {"version":3,"file":"ci-note-commands.d.ts","sourceRoot":"","sources":["../src/ci-note-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAIH,OAAO,EAA6C,KAAK,cAAc,EAAE,KAAK,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE/H,OAAO,EAAkC,KAAK,kBAAkB,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AACnG,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,eAAe,EAAuB,MAAM,kBAAkB,CAAC;AAE5G,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,oGAAoG;AACpG,eAAO,MAAM,4BAA4B,QAAU,CAAC;AAEpD,oGAAoG;AACpG,eAAO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M;AAED,kIAAkI;AAClI,wBAAgB,WAAW,CAAC,SAAS,EAAE,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,GAAG,UAAU,CAuBpF;AAED,gFAAgF;AAChF,MAAM,WAAW,aAAa;IAC5B,8IAA8I;IAC9I,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,sFAAsF;IACtF,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,2IAA2I;IAC3I,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,uGAAuG;IACvG,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,6EAA6E;IAC7E,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,8FAA8F;IAC9F,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7B;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,aAAa,GAAG,eAAe,CAkDlE;AAED,iFAAiF;AACjF,eAAO,MAAM,SAAS,WAAW,CAAC;AAElC,0CAA0C;AAC1C,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,GAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,OAAO,CAiBlF"}
@@ -29,6 +29,7 @@
29
29
  import { GITLAB_AGENT_ASK_VAR, GITLAB_AGENT_PR_VAR } from "./ci-agent.js";
30
30
  import { GITLAB_COMMIT_ARG_VAR, GITLAB_COMMIT_PR_VAR, GITLAB_COMMIT_WORD_VAR } from "./ci-commit.js";
31
31
  import { parseProductComment, productStatusContext } from "./ci-product-words.js";
32
+ import { commandLine, commentTerms, forkReply, memberReply, notRunReply } from "./ci-comment-replies.js";
32
33
  import { GITLAB_APPLY_PR_VAR, GITLAB_LOCK_PR_VAR, GITLAB_PREVIEW_PR_VAR, GITLAB_UNLOCK_PR_VAR, PREVIEW_COMMENT_ENV } from "./components/pr-pipeline.js";
33
34
  import { ForgeApiError } from "./pr-forge.js";
34
35
  export { GITLAB_NOTE_COMMANDS_VAR } from "./components/pr-pipeline.js";
@@ -204,17 +205,32 @@ async function answer(o, mr, note, least, at, me) {
204
205
  }
205
206
  return reply(`started pipeline${link(started)} to ${run.doing} for ${note.author}`, true, started.url);
206
207
  }
207
- case "retry":
208
- return retry(o, mr, note.author, run, reply, broke);
208
+ case "retry": {
209
+ const done = await retryApply(o, "gitlab", mr, note.author, run, gitlabRetry(o.pipelines));
210
+ if (done.kind === "fail")
211
+ return broke(done.reason);
212
+ return reply(done.text, done.kind === "ran", done.kind === "ran" ? done.url : undefined);
213
+ }
209
214
  }
210
215
  }
211
216
  /** chant's apply jobs and terragucci's: `apply`, `apply-wave-<n>` and `apply-wave-<n>-share-<m>`, a member's prefixed with its name. */
212
217
  export const APPLY_JOBS = /^(?:[a-z0-9][a-z0-9-]*-)?apply(?:-wave-([1-9][0-9]*)(?:-share-([1-9][0-9]*))?)?$/;
213
218
  const NOT_DONE = new Set(["created", "pending", "running", "waiting_for_resource", "preparing", "scheduled"]);
214
- async function retry(o, mr, user, run, reply, broke) {
219
+ /**
220
+ * Start a merged pull request's apply again (#4785; shared with GitHub and
221
+ * Forgejo in #4946): the newest push run at the merge commit that has an
222
+ * apply job, refused when a later commit of the default branch already
223
+ * carries the product's apply status, since going back to this one would
224
+ * undo it. `rerun` is the forge's own start.
225
+ */
226
+ export async function retryApply(o, forgeKind, mr, user, run, rerun) {
215
227
  const { sha } = run;
216
228
  const pattern = run.jobs ?? APPLY_JOBS;
217
- const iid = mr.number;
229
+ const t = commentTerms(forgeKind);
230
+ const at = t.at(mr.number);
231
+ const gitlab = forgeKind === "gitlab";
232
+ const runWord = gitlab ? "pipeline" : "workflow run";
233
+ const reply = (text) => ({ kind: "reply", text });
218
234
  // The newest push pipeline at the merge commit with an apply job: a branch pipeline, or a ci/green tag's.
219
235
  let pipeline;
220
236
  let jobs = [];
@@ -229,11 +245,11 @@ async function retry(o, mr, user, run, reply, broke) {
229
245
  }
230
246
  }
231
247
  if (!pipeline)
232
- return reply(`no pipeline at the merge commit ${short(sha)} of !${iid} has an apply job, so there is nothing to retry; push to ${o.base} again`);
248
+ return reply(`no ${runWord} at the merge commit ${short(sha)} of ${at} has an apply job, so there is nothing to ${gitlab ? "retry" : "run again"}; push to ${o.base} again`);
233
249
  newer = await o.reads.branchRuns(o.base, { event: "push", limit: NOTE_COMMANDS_NEWER_PIPELINES });
234
250
  }
235
251
  catch (e) {
236
- return broke(`could not read the pipelines at ${short(sha)} (${message(e)})`);
252
+ return { kind: "fail", reason: `could not read the ${runWord}s at ${short(sha)} (${message(e)})` };
237
253
  }
238
254
  // A later commit whose apply started applied a newer tree: going back to this one would undo it.
239
255
  const applyContext = productStatusContext(o.words, "apply");
@@ -244,46 +260,64 @@ async function retry(o, mr, user, run, reply, broke) {
244
260
  applied = (await o.forge.commitStatuses?.(c))?.find((s) => s.context === applyContext);
245
261
  }
246
262
  catch (e) {
247
- return broke(`could not read the statuses of ${short(c)} (${message(e)})`);
263
+ return { kind: "fail", reason: `could not read the statuses of ${short(c)} (${message(e)})` };
248
264
  }
249
265
  if (applied) {
250
- const at = applied.targetUrl && /^https?:\/\//.test(applied.targetUrl) ? ` (${applied.targetUrl})` : "";
251
- return reply(`a later apply already ran on ${o.base} at ${short(c)}${at}, so the merge commit ${short(sha)} of !${iid} is not applied: comment on the merge request that commit came from, or push again`);
266
+ const link = applied.targetUrl && /^https?:\/\//.test(applied.targetUrl) ? ` (${applied.targetUrl})` : "";
267
+ return reply(`a later apply already ran on ${o.base} at ${short(c)}${link}, so the merge commit ${short(sha)} of ${at} is not applied: comment on the ${t.request} that commit came from, or push again`);
252
268
  }
253
269
  }
254
- const order = (j) => {
255
- const m = pattern.exec(j.name);
256
- return [m?.[1] ? Number(m[1]) : 0, m?.[2] ? Number(m[2]) : 0];
270
+ return rerun(pipeline, jobs, { sha, at, user, base: o.base, pattern });
271
+ }
272
+ /** GitLab's start: retry the first apply job, by wave and share, that did not succeed; the jobs after it follow by themselves. */
273
+ export function gitlabRetry(pipelines) {
274
+ return async (pipeline, jobs, { sha, at, user, base, pattern }) => {
275
+ const reply = (text) => ({ kind: "reply", text });
276
+ const order = (j) => {
277
+ const m = pattern.exec(j.name);
278
+ return [m?.[1] ? Number(m[1]) : 0, m?.[2] ? Number(m[2]) : 0];
279
+ };
280
+ const sorted = [...jobs].sort((a, b) => order(a)[0] - order(b)[0] || order(a)[1] - order(b)[1]);
281
+ const next = sorted.find((j) => j.status !== "success");
282
+ if (!next)
283
+ return reply(`every apply job of ${at}'s merge commit ${short(sha)} already succeeded`);
284
+ if (NOT_DONE.has(next.status))
285
+ return reply(`${next.name} at ${short(sha)} is ${next.status} already, so it is not retried`);
286
+ if (next.status !== "failed" && next.status !== "canceled") {
287
+ return reply(`${next.name} at ${short(sha)} was ${next.status}, and GitLab retries only a failed or canceled job; push to ${base} again`);
288
+ }
289
+ let retried;
290
+ try {
291
+ retried = await pipelines.retryJob(next.id);
292
+ }
293
+ catch (e) {
294
+ return { kind: "fail", reason: `could not retry ${next.name} of pipeline ${pipeline.id} (${message(e)})` };
295
+ }
296
+ const link = retried.url ? ` (${retried.url})` : "";
297
+ return { kind: "ran", text: `retried ${next.name} of ${at}'s merge commit ${short(sha)}${link} for ${user}; its gate decides again, and the jobs after it follow, each behind its own gate`, ...(retried.url ? { url: retried.url } : {}) };
257
298
  };
258
- const sorted = [...jobs].sort((a, b) => order(a)[0] - order(b)[0] || order(a)[1] - order(b)[1]);
259
- const next = sorted.find((j) => j.status !== "success");
260
- if (!next)
261
- return reply(`every apply job of !${iid}'s merge commit ${short(sha)} already succeeded`);
262
- if (NOT_DONE.has(next.status))
263
- return reply(`${next.name} at ${short(sha)} is ${next.status} already, so it is not retried`);
264
- if (next.status !== "failed" && next.status !== "canceled") {
265
- return reply(`${next.name} at ${short(sha)} was ${next.status}, and GitLab retries only a failed or canceled job; push to ${o.base} again`);
266
- }
267
- let retried;
268
- try {
269
- retried = await o.pipelines.retryJob(next.id);
270
- }
271
- catch (e) {
272
- return broke(`could not retry ${next.name} of pipeline ${pipeline.id} (${message(e)})`);
273
- }
274
- const link = retried.url ? ` (${retried.url})` : "";
275
- return reply(`retried ${next.name} of !${iid}'s merge commit ${short(sha)}${link} for ${user}; its gate decides again, and the jobs after it follow, each behind its own gate`, true, retried.url);
276
299
  }
277
- /** What a command runs in chant's own GitLab pipeline, for the jobs it has. */
300
+ /**
301
+ * What a command runs in chant's own GitLab pipeline, for the jobs it has.
302
+ * A command no job runs gets the words' reply for it (`words.replies`,
303
+ * #4946), else chant's.
304
+ */
278
305
  export function chantNoteRuns(jobs) {
279
306
  return ({ mr, note, parsed, base, words }) => {
280
307
  const iid = String(mr.number);
281
308
  const at = `!${mr.number}`;
282
- const line = (kind) => `\`/${words.product} ${Object.entries(words.commands).find(([, c]) => c === kind)?.[0] ?? kind}\``;
309
+ const line = (kind) => commandLine(words, kind);
310
+ // #4946: a member outside the pipeline's is refused before anything starts, a fork's included.
311
+ const member = parsed.kind === "plan" || parsed.kind === "action" ? parsed.member : undefined;
312
+ if (member !== undefined && jobs.members && !jobs.members.includes(member))
313
+ return { kind: "reply", text: memberReply(words, member, jobs.members, "gitlab") };
283
314
  if (!mr.sameRepo)
284
- return { kind: "reply", text: `a merge request from a fork runs no command: its code never runs with this project's credentials` };
315
+ return { kind: "reply", text: forkReply(words, "gitlab") };
285
316
  const open = mr.state === "open";
286
317
  const intoBase = mr.base === undefined || mr.base === base;
318
+ // #4946: the product's sentence for an apply no job answers, in place of chant's, which say what the merge does.
319
+ if (parsed.kind === "apply" && !jobs.applyBeforeMerge && !jobs.applyOnMerge && words.replies?.apply !== undefined)
320
+ return { kind: "reply", text: words.replies.apply };
287
321
  switch (parsed.kind) {
288
322
  case "plan":
289
323
  if (!open)
@@ -314,13 +348,13 @@ export function chantNoteRuns(jobs) {
314
348
  case "lock":
315
349
  case "unlock":
316
350
  if (!jobs.locks)
317
- return { kind: "reply", text: `${line(parsed.kind)} does not run here: this project takes no locks` };
351
+ return { kind: "reply", text: notRunReply(words, parsed.kind, "gitlab") };
318
352
  if (parsed.kind === "lock" && !open)
319
353
  return { kind: "reply", text: `${at} is not open, so it takes no lock` };
320
354
  return { kind: "pipeline", ref: base, variables: { [parsed.kind === "lock" ? GITLAB_LOCK_PR_VAR : GITLAB_UNLOCK_PR_VAR]: iid }, doing: `${parsed.kind} the ${words.noun[1]} of ${at}` };
321
355
  case "agent":
322
356
  if (!jobs.agent)
323
- return { kind: "reply", text: `the agent command is off in this project` };
357
+ return { kind: "reply", text: notRunReply(words, "agent", "gitlab") };
324
358
  if (!open)
325
359
  return { kind: "reply", text: `${at} is not open, so the agent does not run` };
326
360
  if (mr.head === base)
@@ -59,7 +59,45 @@ export interface CiProductAlias {
59
59
  command: CiProductCommand;
60
60
  /** The variable that turns the alias on in a job (terragucci's `TG_ATLANTIS_COMMENTS`). Absent: always on. */
61
61
  when?: string;
62
+ /**
63
+ * Flags of the other tool that the product has no counterpart for, each
64
+ * with the reply that refuses it (#4946), such as terragucci's `{ "-p":
65
+ * "a root goes by its path, not a project name: ..." }` on `atlantis
66
+ * plan`. A flag here is refused before the alias reads `-d`, so a product
67
+ * can refuse `atlantis apply -d` too. `--` refuses everything after it.
68
+ */
69
+ refuse?: Record<string, string>;
70
+ }
71
+ /**
72
+ * What a comment job replies to a command the pipeline runs no job for
73
+ * (#4946), in the product's own sentences. Each slot left out takes
74
+ * chant's. The comment job on GitHub and Forgejo and the note poll on
75
+ * GitLab both read these.
76
+ */
77
+ export interface CiProductCommentReplies {
78
+ /** A plan comment where no job plans on a comment (GitHub and Forgejo; GitLab starts a merge request pipeline). */
79
+ plan?: string;
80
+ /** An apply comment where no job applies on a comment: neither an apply before merge nor the re-run of a merged pull request's apply. */
81
+ apply?: string;
82
+ /** A lock comment where the pipeline takes no locks. */
83
+ lock?: string;
84
+ /** An unlock comment where the pipeline takes no locks. */
85
+ unlock?: string;
86
+ /** An action comment where no workflow runs actions (GitHub and Forgejo; GitLab names the checkout to run it from). */
87
+ action?: string;
88
+ /** An agent comment where the agent is off. */
89
+ agent?: string;
90
+ /** Any command on a pull request from a fork. */
91
+ fork?: string;
92
+ /**
93
+ * A comment that names a member the pipeline was not written with, over
94
+ * `{member}` (the one named) and `{members}` (the pipeline's, each in
95
+ * backticks, sorted, comma separated).
96
+ */
97
+ member?: string;
62
98
  }
99
+ /** The reply slots, for checking a product's words. */
100
+ export declare const CI_PRODUCT_COMMENT_REPLIES: readonly (keyof CiProductCommentReplies)[];
63
101
  /** The words a product passes. Every slot is optional; a missing one takes chant's. */
64
102
  export interface CiProductWordsInput {
65
103
  /** The status prefix, the note heading and the comment prefix: `chant`, `terragucci`, `plywood`. */
@@ -117,6 +155,8 @@ export interface CiProductWordsInput {
117
155
  adoptMarkers?: string[];
118
156
  /** What chant's notify sends under these words (#4610). */
119
157
  notify?: CiProductNotifyWordsInput;
158
+ /** The replies to commands the pipeline runs no job for (#4946). Default: chant's. */
159
+ replies?: CiProductCommentReplies;
120
160
  }
121
161
  /** The notify slots a product passes (#4610). */
122
162
  export interface CiProductNotifyWordsInput {
@@ -166,6 +206,8 @@ export interface CiProductWords {
166
206
  bin?: string;
167
207
  adoptMarkers: string[];
168
208
  notify: CiProductNotifyWords;
209
+ /** The product's replies to commands no job runs (#4946), when it gives any. */
210
+ replies?: CiProductCommentReplies;
169
211
  }
170
212
  /** chant's own approve line. */
171
213
  export declare const CHANT_APPROVE_TEMPLATE = "chant approve {op} {gate} --plan {digest} --approver {approver} {sign}";
@@ -312,6 +354,19 @@ export type ParsedProductComment =
312
354
  export declare const COMMIT_COMMENT_ARG: RegExp;
313
355
  /** The longest ask an agent comment may carry. */
314
356
  export declare const PRODUCT_COMMENT_ASK_MAX = 2000;
357
+ /** {@link parseProductComment}'s options. */
358
+ export interface ProductCommentOptions {
359
+ /** Leave every comment for a commit word to the commit job (#4890): it is undefined here, a refused one included. */
360
+ leaveCommit?: boolean;
361
+ }
362
+ /**
363
+ * The commit word a comment names (#4890): its first two words, split on
364
+ * any space, are `/<product> <word>` and the words map `<word>` onto
365
+ * `commit`. The commit job replies to a refused comment by this rule
366
+ * (#4838), so a comment job that skips these never answers a comment the
367
+ * commit job answers. Undefined for any other comment.
368
+ */
369
+ export declare function commitWordOf(words: CiProductWords, body: unknown): string | undefined;
315
370
  /**
316
371
  * Read a comment against the product's grammar (moved from terragucci's
317
372
  * comment.ts). Undefined when it is not addressed to the product. A comment
@@ -324,8 +379,14 @@ export declare const PRODUCT_COMMENT_ASK_MAX = 2000;
324
379
  * names the commit words that take one argument after them (#4820), each
325
380
  * with the pattern it must match; it must also match
326
381
  * {@link COMMIT_COMMENT_ARG}. Any other commit word takes nothing.
382
+ *
383
+ * `leaveCommit` (#4890) is for a comment job that is not the commit job: a
384
+ * comment for a commit word is undefined, a malformed one included
385
+ * ({@link commitWordOf}), because the commit job answers it, refusals and
386
+ * all (#4838). Without it, a malformed `/<product> <commit word> x` would
387
+ * get a reply from both jobs.
327
388
  */
328
- export declare function parseProductComment(words: CiProductWords, body: unknown, env?: Record<string, string | undefined>, commitArgs?: Readonly<Record<string, RegExp>>): ParsedProductComment | undefined;
389
+ export declare function parseProductComment(words: CiProductWords, body: unknown, env?: Record<string, string | undefined>, commitArgs?: Readonly<Record<string, RegExp>>, options?: ProductCommentOptions): ParsedProductComment | undefined;
329
390
  /**
330
391
  * The variables the generated action job (#4654) hands the product's action
331
392
  * verb: the comment that started it, on a comment, and the dispatch's two