@intentius/chant 0.124.88 → 0.124.90

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (377) hide show
  1. package/dist/actor.d.ts +36 -1
  2. package/dist/actor.d.ts.map +1 -1
  3. package/dist/actor.js +39 -1
  4. package/dist/chant-install.d.ts.map +1 -1
  5. package/dist/chant-install.js +1 -2
  6. package/dist/ci-base.d.ts +30 -0
  7. package/dist/ci-base.d.ts.map +1 -0
  8. package/dist/ci-base.js +33 -0
  9. package/dist/ci-comment-commands.d.ts +193 -0
  10. package/dist/ci-comment-commands.d.ts.map +1 -0
  11. package/dist/ci-comment-commands.js +353 -0
  12. package/dist/ci-comment-replies.d.ts +40 -0
  13. package/dist/ci-comment-replies.d.ts.map +1 -0
  14. package/dist/ci-comment-replies.js +59 -0
  15. package/dist/ci-evidence-from-job.d.ts +25 -0
  16. package/dist/ci-evidence-from-job.d.ts.map +1 -1
  17. package/dist/ci-evidence-from-job.js +43 -2
  18. package/dist/ci-evidence-jobs.d.ts +30 -1
  19. package/dist/ci-evidence-jobs.d.ts.map +1 -1
  20. package/dist/ci-evidence-jobs.js +46 -3
  21. package/dist/ci-image.d.ts +21 -4
  22. package/dist/ci-image.d.ts.map +1 -1
  23. package/dist/ci-image.js +62 -10
  24. package/dist/ci-job-guard.d.ts +42 -45
  25. package/dist/ci-job-guard.d.ts.map +1 -1
  26. package/dist/ci-job-guard.js +206 -3
  27. package/dist/ci-note-commands.d.ts +104 -4
  28. package/dist/ci-note-commands.d.ts.map +1 -1
  29. package/dist/ci-note-commands.js +131 -38
  30. package/dist/ci-product-words.d.ts +42 -0
  31. package/dist/ci-product-words.d.ts.map +1 -1
  32. package/dist/ci-product-words.js +25 -0
  33. package/dist/ci-product.d.ts +72 -1
  34. package/dist/ci-product.d.ts.map +1 -1
  35. package/dist/ci-product.js +73 -6
  36. package/dist/cli/commands/build.d.ts.map +1 -1
  37. package/dist/cli/commands/build.js +29 -2
  38. package/dist/cli/handlers/approve.d.ts.map +1 -1
  39. package/dist/cli/handlers/approve.js +2 -1
  40. package/dist/cli/handlers/ci-check.d.ts +1 -1
  41. package/dist/cli/handlers/ci-check.d.ts.map +1 -1
  42. package/dist/cli/handlers/ci-check.js +17 -7
  43. package/dist/cli/handlers/ci-evidence.d.ts.map +1 -1
  44. package/dist/cli/handlers/ci-evidence.js +33 -7
  45. package/dist/cli/handlers/components.d.ts.map +1 -1
  46. package/dist/cli/handlers/components.js +3 -1
  47. package/dist/cli/handlers/generated-check.d.ts +8 -0
  48. package/dist/cli/handlers/generated-check.d.ts.map +1 -1
  49. package/dist/cli/handlers/generated-check.js +31 -1
  50. package/dist/cli/handlers/lock.d.ts.map +1 -1
  51. package/dist/cli/handlers/lock.js +121 -4
  52. package/dist/cli/handlers/pr-comment.d.ts +33 -0
  53. package/dist/cli/handlers/pr-comment.d.ts.map +1 -0
  54. package/dist/cli/handlers/pr-comment.js +201 -0
  55. package/dist/cli/handlers/pr-env.d.ts.map +1 -1
  56. package/dist/cli/handlers/pr-env.js +6 -3
  57. package/dist/cli/handlers/pr-notes.d.ts.map +1 -1
  58. package/dist/cli/handlers/pr-notes.js +23 -1
  59. package/dist/cli/handlers/pr.d.ts +23 -1
  60. package/dist/cli/handlers/pr.d.ts.map +1 -1
  61. package/dist/cli/handlers/pr.js +71 -23
  62. package/dist/cli/handlers/promote.d.ts.map +1 -1
  63. package/dist/cli/handlers/promote.js +2 -1
  64. package/dist/cli/handlers/release.d.ts.map +1 -1
  65. package/dist/cli/handlers/release.js +11 -2
  66. package/dist/cli/handlers/run-wave.d.ts.map +1 -1
  67. package/dist/cli/handlers/run-wave.js +180 -4
  68. package/dist/cli/handlers/run.d.ts.map +1 -1
  69. package/dist/cli/handlers/run.js +2 -1
  70. package/dist/cli/main.d.ts.map +1 -1
  71. package/dist/cli/main.js +41 -2
  72. package/dist/cli/parse-args.d.ts.map +1 -1
  73. package/dist/cli/parse-args.js +31 -0
  74. package/dist/cli/registry.d.ts +19 -1
  75. package/dist/cli/registry.d.ts.map +1 -1
  76. package/dist/components/auto-release.d.ts.map +1 -1
  77. package/dist/components/auto-release.js +2 -1
  78. package/dist/components/pr-checks.d.ts +97 -6
  79. package/dist/components/pr-checks.d.ts.map +1 -1
  80. package/dist/components/pr-checks.js +107 -13
  81. package/dist/components/pr-pipeline.d.ts +19 -14
  82. package/dist/components/pr-pipeline.d.ts.map +1 -1
  83. package/dist/components/pr-pipeline.js +7 -13
  84. package/dist/components/product-pipeline.d.ts +96 -3
  85. package/dist/components/product-pipeline.d.ts.map +1 -1
  86. package/dist/components/product-pipeline.js +120 -14
  87. package/dist/components/product-plan.d.ts +203 -6
  88. package/dist/components/product-plan.d.ts.map +1 -1
  89. package/dist/components/product-plan.js +250 -43
  90. package/dist/drift-record.d.ts +7 -0
  91. package/dist/drift-record.d.ts.map +1 -1
  92. package/dist/drift-record.js +19 -0
  93. package/dist/floor-table.data.d.ts.map +1 -1
  94. package/dist/floor-table.data.js +63 -31
  95. package/dist/forge-check/contract.d.ts +11 -1
  96. package/dist/forge-check/contract.d.ts.map +1 -1
  97. package/dist/forge-check/contract.js +4 -1
  98. package/dist/forge-check/index.d.ts +2 -0
  99. package/dist/forge-check/index.d.ts.map +1 -1
  100. package/dist/forge-check/index.js +2 -0
  101. package/dist/gate-resume-run.d.ts +9 -1
  102. package/dist/gate-resume-run.d.ts.map +1 -1
  103. package/dist/gate-resume-run.js +26 -3
  104. package/dist/generated-check.d.ts +18 -4
  105. package/dist/generated-check.d.ts.map +1 -1
  106. package/dist/generated-check.js +37 -5
  107. package/dist/image-pins.d.ts +26 -0
  108. package/dist/image-pins.d.ts.map +1 -0
  109. package/dist/image-pins.js +19 -0
  110. package/dist/lexicon.d.ts +93 -4
  111. package/dist/lexicon.d.ts.map +1 -1
  112. package/dist/lifecycle/gate-applied.d.ts +9 -0
  113. package/dist/lifecycle/gate-applied.d.ts.map +1 -1
  114. package/dist/lifecycle/git.d.ts +11 -0
  115. package/dist/lifecycle/git.d.ts.map +1 -1
  116. package/dist/lifecycle/git.js +30 -3
  117. package/dist/lifecycle/publish-npm.d.ts +11 -0
  118. package/dist/lifecycle/publish-npm.d.ts.map +1 -1
  119. package/dist/lifecycle/publish-npm.js +27 -1
  120. package/dist/lifecycle/reach-locks.d.ts +131 -0
  121. package/dist/lifecycle/reach-locks.d.ts.map +1 -0
  122. package/dist/lifecycle/reach-locks.js +118 -0
  123. package/dist/lifecycle/release-cut.d.ts +3 -1
  124. package/dist/lifecycle/release-cut.d.ts.map +1 -1
  125. package/dist/lifecycle/release-cut.js +15 -0
  126. package/dist/lifecycle/release-images.d.ts.map +1 -1
  127. package/dist/lifecycle/release-images.js +1 -2
  128. package/dist/notify-product.d.ts +12 -3
  129. package/dist/notify-product.d.ts.map +1 -1
  130. package/dist/notify-product.js +10 -6
  131. package/dist/op/activities/source-release.d.ts.map +1 -1
  132. package/dist/op/activities/source-release.js +2 -1
  133. package/dist/op/activities/source-rollback.d.ts.map +1 -1
  134. package/dist/op/activities/source-rollback.js +2 -1
  135. package/dist/op/apply-status.d.ts +84 -0
  136. package/dist/op/apply-status.d.ts.map +1 -0
  137. package/dist/op/apply-status.js +106 -0
  138. package/dist/op/before-merge-decide.d.ts +102 -0
  139. package/dist/op/before-merge-decide.d.ts.map +1 -0
  140. package/dist/op/before-merge-decide.js +142 -0
  141. package/dist/op/before-merge-done.d.ts +56 -0
  142. package/dist/op/before-merge-done.d.ts.map +1 -0
  143. package/dist/op/before-merge-done.js +69 -0
  144. package/dist/op/before-merge-store.d.ts +20 -0
  145. package/dist/op/before-merge-store.d.ts.map +1 -0
  146. package/dist/op/before-merge-store.js +48 -0
  147. package/dist/op/before-merge.d.ts +150 -0
  148. package/dist/op/before-merge.d.ts.map +1 -0
  149. package/dist/op/before-merge.js +207 -0
  150. package/dist/op/follow-on-run.d.ts +117 -0
  151. package/dist/op/follow-on-run.d.ts.map +1 -0
  152. package/dist/op/follow-on-run.js +154 -0
  153. package/dist/op/follow-on-store.d.ts +17 -0
  154. package/dist/op/follow-on-store.d.ts.map +1 -0
  155. package/dist/op/follow-on-store.js +54 -0
  156. package/dist/op/gate.d.ts +6 -0
  157. package/dist/op/gate.d.ts.map +1 -1
  158. package/dist/op/gate.js +10 -1
  159. package/dist/op/index.d.ts +5 -1
  160. package/dist/op/index.d.ts.map +1 -1
  161. package/dist/op/index.js +2 -0
  162. package/dist/op/op-waves-after-plan.d.ts +13 -0
  163. package/dist/op/op-waves-after-plan.d.ts.map +1 -1
  164. package/dist/op/op-waves-evidence-jobs.d.ts +10 -2
  165. package/dist/op/op-waves-evidence-jobs.d.ts.map +1 -1
  166. package/dist/op/op-waves-evidence-jobs.js +19 -5
  167. package/dist/op/op-waves-follow-on.d.ts +162 -0
  168. package/dist/op/op-waves-follow-on.d.ts.map +1 -0
  169. package/dist/op/op-waves-follow-on.js +355 -0
  170. package/dist/op/op-waves-render-spec.d.ts +100 -0
  171. package/dist/op/op-waves-render-spec.d.ts.map +1 -0
  172. package/dist/op/op-waves-render-spec.js +162 -0
  173. package/dist/op/op-waves-run.d.ts +148 -6
  174. package/dist/op/op-waves-run.d.ts.map +1 -1
  175. package/dist/op/op-waves-run.js +873 -100
  176. package/dist/op/op-waves-split.d.ts +122 -0
  177. package/dist/op/op-waves-split.d.ts.map +1 -0
  178. package/dist/op/op-waves-split.js +166 -0
  179. package/dist/op/op-waves.d.ts +24 -0
  180. package/dist/op/op-waves.d.ts.map +1 -1
  181. package/dist/op/op-waves.js +18 -1
  182. package/dist/op/schedule-overdue.d.ts +15 -1
  183. package/dist/op/schedule-overdue.d.ts.map +1 -1
  184. package/dist/op/schedule-overdue.js +77 -5
  185. package/dist/op/stage-hooks.d.ts +36 -1
  186. package/dist/op/stage-hooks.d.ts.map +1 -1
  187. package/dist/op/stage-hooks.js +17 -3
  188. package/dist/op/wave-stop.d.ts +67 -0
  189. package/dist/op/wave-stop.d.ts.map +1 -0
  190. package/dist/op/wave-stop.js +129 -0
  191. package/dist/planned-files.d.ts +76 -0
  192. package/dist/planned-files.d.ts.map +1 -0
  193. package/dist/planned-files.js +108 -0
  194. package/dist/pr-forge-job.d.ts +22 -0
  195. package/dist/pr-forge-job.d.ts.map +1 -0
  196. package/dist/pr-forge-job.js +46 -0
  197. package/dist/pr-loop.d.ts +3 -6
  198. package/dist/pr-loop.d.ts.map +1 -1
  199. package/dist/pr-loop.js +4 -81
  200. package/dist/pr-plan-note.d.ts +97 -0
  201. package/dist/pr-plan-note.d.ts.map +1 -1
  202. package/dist/pr-plan-note.js +94 -1
  203. package/dist/pr-post.d.ts +28 -3
  204. package/dist/pr-post.d.ts.map +1 -1
  205. package/dist/pr-post.js +146 -13
  206. package/dist/pr-status.d.ts +16 -0
  207. package/dist/pr-status.d.ts.map +1 -0
  208. package/dist/pr-status.js +90 -0
  209. package/dist/ref-gate-init.d.ts +16 -2
  210. package/dist/ref-gate-init.d.ts.map +1 -1
  211. package/dist/ref-gate-init.js +24 -13
  212. package/dist/release-floors.d.ts +39 -1
  213. package/dist/release-floors.d.ts.map +1 -1
  214. package/dist/release-floors.js +63 -25
  215. package/dist/render-module.d.ts +15 -0
  216. package/dist/render-module.d.ts.map +1 -0
  217. package/dist/render-module.js +73 -0
  218. package/dist/state-migration.d.ts.map +1 -1
  219. package/dist/state-migration.js +1 -2
  220. package/dist/wave-blocked.d.ts +7 -1
  221. package/dist/wave-blocked.d.ts.map +1 -1
  222. package/dist/wave-blocked.js +7 -2
  223. package/dist/wave-runtime.mjs +366 -350
  224. package/dist/workspace/ci-green-cli.d.ts.map +1 -1
  225. package/dist/workspace/ci-green-cli.js +3 -2
  226. package/dist/workspace/release-train.d.ts.map +1 -1
  227. package/dist/workspace/release-train.js +2 -1
  228. package/dist/workspace/release-workflow.d.ts +4 -3
  229. package/dist/workspace/release-workflow.d.ts.map +1 -1
  230. package/dist/workspace/release-workflow.js +10 -7
  231. package/dist/workspace/trust/check-evidence-report.d.ts +7 -2
  232. package/dist/workspace/trust/check-evidence-report.d.ts.map +1 -1
  233. package/dist/workspace/trust/check-evidence-report.js +15 -8
  234. package/dist/workspace/trust/ref-gate-cli.d.ts +10 -1
  235. package/dist/workspace/trust/ref-gate-cli.d.ts.map +1 -1
  236. package/dist/workspace/trust/ref-gate-cli.js +30 -10
  237. package/dist/workspace/workspace-run.d.ts.map +1 -1
  238. package/dist/workspace/workspace-run.js +2 -1
  239. package/package.json +1 -1
  240. package/src/actor.test.ts +68 -2
  241. package/src/actor.ts +61 -1
  242. package/src/chant-install.test.ts +2 -3
  243. package/src/chant-install.ts +1 -2
  244. package/src/ci-base.test.ts +41 -0
  245. package/src/ci-base.ts +43 -0
  246. package/src/ci-comment-commands.test.ts +439 -0
  247. package/src/ci-comment-commands.ts +428 -0
  248. package/src/ci-comment-replies.ts +78 -0
  249. package/src/ci-commit.test.ts +2 -3
  250. package/src/ci-evidence-from-job.test.ts +18 -0
  251. package/src/ci-evidence-from-job.ts +58 -2
  252. package/src/ci-evidence-jobs.ts +50 -5
  253. package/src/ci-image.test.ts +130 -10
  254. package/src/ci-image.ts +85 -12
  255. package/src/ci-job-guard.before-merge.test.ts +148 -0
  256. package/src/ci-job-guard.follow-on-record.test.ts +137 -0
  257. package/src/ci-job-guard.follow-on.test.ts +144 -0
  258. package/src/ci-job-guard.ts +221 -3
  259. package/src/ci-note-commands.test.ts +76 -1
  260. package/src/ci-note-commands.ts +198 -46
  261. package/src/ci-product-words.ts +59 -0
  262. package/src/ci-product.ts +90 -6
  263. package/src/cli/commands/build.test.ts +41 -0
  264. package/src/cli/commands/build.ts +27 -2
  265. package/src/cli/handlers/approve.ts +2 -1
  266. package/src/cli/handlers/ci-check.ts +19 -7
  267. package/src/cli/handlers/ci-evidence.ts +29 -8
  268. package/src/cli/handlers/components.ts +3 -1
  269. package/src/cli/handlers/generated-check.ts +31 -1
  270. package/src/cli/handlers/lock-reach.test.ts +103 -0
  271. package/src/cli/handlers/lock.ts +100 -4
  272. package/src/cli/handlers/pr-comment.ts +187 -0
  273. package/src/cli/handlers/pr-env.ts +6 -3
  274. package/src/cli/handlers/pr-notes.ts +30 -6
  275. package/src/cli/handlers/pr-record.test.ts +1 -1
  276. package/src/cli/handlers/pr.ts +64 -21
  277. package/src/cli/handlers/promote.ts +2 -1
  278. package/src/cli/handlers/release.e2e.test.ts +35 -0
  279. package/src/cli/handlers/release.ts +14 -2
  280. package/src/cli/handlers/run-wave.ts +170 -4
  281. package/src/cli/handlers/run.ts +2 -1
  282. package/src/cli/main.ts +41 -2
  283. package/src/cli/parse-args.ts +23 -0
  284. package/src/cli/registry.ts +19 -1
  285. package/src/components/auto-release.ts +2 -1
  286. package/src/components/pr-checks.ts +165 -17
  287. package/src/components/pr-pipeline.ts +22 -18
  288. package/src/components/product-pipeline.apply-status.test.ts +50 -0
  289. package/src/components/product-pipeline.ts +204 -17
  290. package/src/components/product-plan.test.ts +60 -4
  291. package/src/components/product-plan.ts +367 -50
  292. package/src/drift-record.test.ts +20 -0
  293. package/src/drift-record.ts +16 -0
  294. package/src/floor-table.data.ts +63 -31
  295. package/src/forge-check/contract.ts +12 -1
  296. package/src/forge-check/forge-check.test.ts +17 -0
  297. package/src/forge-check/index.ts +2 -0
  298. package/src/gate-resume-run.ts +27 -3
  299. package/src/generated-check.e2e.test.ts +21 -1
  300. package/src/generated-check.test.ts +66 -0
  301. package/src/generated-check.ts +51 -10
  302. package/src/image-pins.ts +31 -0
  303. package/src/lexicon.ts +89 -1
  304. package/src/lifecycle/gate-applied.ts +7 -0
  305. package/src/lifecycle/git.test.ts +48 -0
  306. package/src/lifecycle/git.ts +27 -4
  307. package/src/lifecycle/publish-npm.ts +31 -1
  308. package/src/lifecycle/reach-locks.test.ts +87 -0
  309. package/src/lifecycle/reach-locks.ts +169 -0
  310. package/src/lifecycle/release-cut.ts +17 -1
  311. package/src/lifecycle/release-images.test.ts +56 -0
  312. package/src/lifecycle/release-images.ts +1 -2
  313. package/src/notify-product.ts +19 -8
  314. package/src/op/activities/source-release.ts +2 -1
  315. package/src/op/activities/source-rollback.ts +2 -1
  316. package/src/op/apply-status.test.ts +83 -0
  317. package/src/op/apply-status.ts +132 -0
  318. package/src/op/before-merge-decide.ts +190 -0
  319. package/src/op/before-merge-done.ts +99 -0
  320. package/src/op/before-merge-store.ts +44 -0
  321. package/src/op/before-merge.test.ts +201 -0
  322. package/src/op/before-merge.ts +266 -0
  323. package/src/op/follow-on-run.ts +206 -0
  324. package/src/op/follow-on-store.ts +54 -0
  325. package/src/op/gate-resume.test.ts +27 -0
  326. package/src/op/gate.ts +16 -1
  327. package/src/op/index.ts +15 -0
  328. package/src/op/op-waves-after-plan.ts +13 -0
  329. package/src/op/op-waves-evidence-jobs.ts +21 -7
  330. package/src/op/op-waves-follow-on-record.test.ts +152 -0
  331. package/src/op/op-waves-follow-on.test.ts +247 -0
  332. package/src/op/op-waves-follow-on.ts +385 -0
  333. package/src/op/op-waves-notify-words.test.ts +18 -0
  334. package/src/op/op-waves-render-spec.test.ts +159 -0
  335. package/src/op/op-waves-render-spec.ts +171 -0
  336. package/src/op/op-waves-run.ts +973 -94
  337. package/src/op/op-waves-split-product.test.ts +288 -0
  338. package/src/op/op-waves-split-step.test.ts +298 -0
  339. package/src/op/op-waves-split.test.ts +196 -0
  340. package/src/op/op-waves-split.ts +189 -0
  341. package/src/op/op-waves.ts +31 -3
  342. package/src/op/schedule-overdue.test.ts +72 -1
  343. package/src/op/schedule-overdue.ts +84 -6
  344. package/src/op/stage-hooks.ts +52 -4
  345. package/src/op/wave-stop.test.ts +72 -0
  346. package/src/op/wave-stop.ts +139 -0
  347. package/src/planned-files.test.ts +80 -0
  348. package/src/planned-files.ts +134 -0
  349. package/src/pr-forge-job.test.ts +53 -0
  350. package/src/pr-forge-job.ts +46 -0
  351. package/src/pr-loop-narrowed.test.ts +2 -1
  352. package/src/pr-loop-words.test.ts +2 -1
  353. package/src/pr-loop.test.ts +1 -2
  354. package/src/pr-loop.ts +4 -80
  355. package/src/pr-plan-note.ts +155 -3
  356. package/src/pr-post-replan.test.ts +144 -0
  357. package/src/pr-post-subject.test.ts +230 -0
  358. package/src/pr-post.test.ts +2 -1
  359. package/src/pr-post.ts +151 -15
  360. package/src/pr-status.ts +91 -0
  361. package/src/ref-gate-init.ts +30 -11
  362. package/src/release-floors.ts +81 -25
  363. package/src/render-module.ts +73 -0
  364. package/src/state-migration-record.test.ts +2 -3
  365. package/src/state-migration.ts +1 -2
  366. package/src/wave-blocked.ts +9 -4
  367. package/src/workspace/ci-green-cli.ts +3 -2
  368. package/src/workspace/ci-green-workflow.test.ts +32 -1
  369. package/src/workspace/release-train.ts +2 -1
  370. package/src/workspace/release-workflow.test.ts +36 -5
  371. package/src/workspace/release-workflow.ts +10 -7
  372. package/src/workspace/trust/check-evidence-report.ts +15 -8
  373. package/src/workspace/trust/check-evidence.test.ts +5 -0
  374. package/src/workspace/trust/ref-gate-cli.ts +30 -8
  375. package/src/workspace/trust/ref-gate-pieces.test.ts +46 -1
  376. package/src/workspace/trust/ref-gate.test.ts +10 -0
  377. package/src/workspace/workspace-run.ts +2 -1
package/dist/actor.d.ts CHANGED
@@ -3,10 +3,45 @@
3
3
  * actor in a job (`GITHUB_ACTOR`, which Forgejo sets too, then
4
4
  * `GITLAB_USER_LOGIN`), else the login (`USER`, `USERNAME` on Windows).
5
5
  * The terraform and pulumi lexicons' gated requests and the products'
6
- * requesters read it here rather than each writing the order.
6
+ * requesters read it here rather than each writing the order, and so do
7
+ * chant's own CLI handlers and the records they write (#4952). A caller
8
+ * that refuses when nobody is named passes `""` as the fallback.
9
+ *
10
+ * {@link actorOf} is the same order with the two places a product's
11
+ * requester also looks (#4966): `GITHUB_TRIGGERING_ACTOR` ahead of the
12
+ * forge's actor, which names who re-ran a job rather than who started its
13
+ * run, and git's `user.name` in the checkout between the forge's actor and
14
+ * the login, which names the person at a laptop better than `$USER`.
7
15
  */
8
16
  /** The actor fallback's variables, in the order {@link actorFromEnv} reads them. */
9
17
  export declare const ACTOR_ENV_ORDER: readonly ["GITHUB_ACTOR", "GITLAB_USER_LOGIN", "USER", "USERNAME"];
10
18
  /** The first of {@link ACTOR_ENV_ORDER} set to something other than blanks, else `fallback` (default `unknown`). */
11
19
  export declare function actorFromEnv(env?: Record<string, string | undefined>, fallback?: string): string;
20
+ /** Which of the places {@link actorOf} reads, and the answer when none is set. */
21
+ export interface ActorOptions {
22
+ /** The variables. Default `process.env`. */
23
+ env?: Record<string, string | undefined>;
24
+ /** Read `GITHUB_TRIGGERING_ACTOR` first: who re-ran the job, ahead of who started the run. Default false. */
25
+ triggering?: boolean;
26
+ /** Read the forge's actor (`GITHUB_ACTOR`, `GITLAB_USER_LOGIN`). Default true. */
27
+ forge?: boolean;
28
+ /** A checkout whose git config is read after the forge's actor. Unset, git is not asked. */
29
+ repo?: string;
30
+ /** The git config keys read in `repo`, in order. Default `["user.name"]`. */
31
+ gitKeys?: readonly string[];
32
+ /** Read the login (`USER`, `USERNAME`) last. Default true. */
33
+ login?: boolean;
34
+ /** The answer when nothing is set. Default `unknown`; `""` for a caller that refuses. */
35
+ fallback?: string;
36
+ }
37
+ /** The places {@link actorOf} reads for `options`, in order: variable names, and `git:<key>` for a git config key. */
38
+ export declare function actorOrder(options?: Omit<ActorOptions, "env" | "fallback">): string[];
39
+ /**
40
+ * The first place of {@link actorOrder} set to something other than blanks,
41
+ * else `fallback` (#4966). With no options it answers as
42
+ * {@link actorFromEnv}. A git config key is read only when every place
43
+ * before it is empty, so a job with a forge actor runs no git.
44
+ */
45
+ export declare function actorOf(options?: ActorOptions): string;
46
+ export { ACTOR_ORDER_FLOOR } from "./release-floors.js";
12
47
  //# sourceMappingURL=actor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"actor.d.ts","sourceRoot":"","sources":["../src/actor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,oFAAoF;AACpF,eAAO,MAAM,eAAe,YAAI,cAAc,EAAE,mBAAmB,EAAE,MAAM,EAAE,UAAU,CAAU,CAAC;AAElG,oHAAoH;AACpH,wB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B_ACTOR`, which Forgejo sets too, then
4
4
  * `GITLAB_USER_LOGIN`), else the login (`USER`, `USERNAME` on Windows).
5
5
  * The terraform and pulumi lexicons' gated requests and the products'
6
- * requesters read it here rather than each writing the order.
6
+ * requesters read it here rather than each writing the order, and so do
7
+ * chant's own CLI handlers and the records they write (#4952). A caller
8
+ * that refuses when nobody is named passes `""` as the fallback.
9
+ *
10
+ * {@link actorOf} is the same order with the two places a product's
11
+ * requester also looks (#4966): `GITHUB_TRIGGERING_ACTOR` ahead of the
12
+ * forge's actor, which names who re-ran a job rather than who started its
13
+ * run, and git's `user.name` in the checkout between the forge's actor and
14
+ * the login, which names the person at a laptop better than `$USER`.
7
15
  */
16
+ import { spawnSync } from "node:child_process";
8
17
  /** The actor fallback's variables, in the order {@link actorFromEnv} reads them. */
9
18
  export const ACTOR_ENV_ORDER = ["GITHUB_ACTOR", "GITLAB_USER_LOGIN", "USER", "USERNAME"];
10
19
  /** The first of {@link ACTOR_ENV_ORDER} set to something other than blanks, else `fallback` (default `unknown`). */
@@ -16,3 +25,32 @@ export function actorFromEnv(env = process.env, fallback = "unknown") {
16
25
  }
17
26
  return fallback;
18
27
  }
28
+ /** The places {@link actorOf} reads for `options`, in order: variable names, and `git:<key>` for a git config key. */
29
+ export function actorOrder(options = {}) {
30
+ return [
31
+ ...(options.triggering ? ["GITHUB_TRIGGERING_ACTOR"] : []),
32
+ ...(options.forge === false ? [] : ["GITHUB_ACTOR", "GITLAB_USER_LOGIN"]),
33
+ ...(options.repo !== undefined ? (options.gitKeys ?? ["user.name"]).map((k) => `git:${k}`) : []),
34
+ ...(options.login === false ? [] : ["USER", "USERNAME"]),
35
+ ];
36
+ }
37
+ function gitConfig(repo, key) {
38
+ const r = spawnSync("git", ["-C", repo, "config", key], { encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] });
39
+ return r.status === 0 ? r.stdout.trim() : undefined;
40
+ }
41
+ /**
42
+ * The first place of {@link actorOrder} set to something other than blanks,
43
+ * else `fallback` (#4966). With no options it answers as
44
+ * {@link actorFromEnv}. A git config key is read only when every place
45
+ * before it is empty, so a job with a forge actor runs no git.
46
+ */
47
+ export function actorOf(options = {}) {
48
+ const env = options.env ?? process.env;
49
+ for (const place of actorOrder(options)) {
50
+ const v = (place.startsWith("git:") ? gitConfig(options.repo, place.slice(4)) : env[place])?.trim();
51
+ if (v)
52
+ return v;
53
+ }
54
+ return options.fallback ?? "unknown";
55
+ }
56
+ export { ACTOR_ORDER_FLOOR } from "./release-floors.js";
@@ -1 +1 @@
1
- {"version":3,"file":"chant-install.d.ts","sourceRoot":"","sources":["../src/chant-install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AASH,0TAA0T;AAC1T,eAAO,MAAM,eAAe,aAAe,CAAC;AAE5C,0CAA0C;AAC1C,MAAM,WAAW,YAAY;IAC3B,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,GAAG,EAAE,MAAM,CAAC;IACZ,qEAAqE;IACrE,MAAM,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAsBD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,YAAY,GAAG,SAAS,CAWhF;AAID;;;;;;GAMG;AACH,wBAAgB,YAAY,IAAI,YAAY,GAAG,SAAS,CAMvD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAO,GAAG,MAAM,CAE/F;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,C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AAM,CAAC,UAAU,CAAC;IACxB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0IAA0I;IAC1I,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,kHAAkH;IAClH,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,yEAAyE;IACzE,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7B,8GAA8G;IAC9G,eAAe,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACnC,oEAAoE;IACpE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,+FAA+F;IAC/F,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,QAAQ,CAAC,CA0BlG;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAkBpD"}
@@ -32,9 +32,8 @@ import { existsSync, readFileSync } from "node:fs";
32
32
  import * as nodeModule from "node:module";
33
33
  import { delimiter, dirname, join, resolve, sep } from "node:path";
34
34
  import { fileURLToPath, pathToFileURL } from "node:url";
35
- import { NEXT_RELEASE } from "./release-floors.js";
36
35
  /** The first chant with `runChant`, `lastJsonLine`, `installResolveFallback` and `fallbackImportArgs` in `@intentius/chant/chant-install` (#4889): a product runs chant and reads its `--json` document, and a file with no `node_modules` above it imports the product's packages, with no code of the product's own. */
37
- export const CHANT_RUN_FLOOR = NEXT_RELEASE;
36
+ export const CHANT_RUN_FLOOR = "0.124.88";
38
37
  const PACKAGE = "@intentius/chant";
39
38
  /** The install whose manifest is `<root>/package.json`, when it is chant's and names a bin that is there. */
40
39
  function installAt(root) {
@@ -0,0 +1,30 @@
1
+ /**
2
+ * `@intentius/chant/ci-base` (#4966): the base a CI job measures a change
3
+ * from, read off the job's own variables, so a product's check and policy
4
+ * steps need no rule of their own for it (terragucci's `policyBase`).
5
+ *
6
+ * - A pull request's job: its target branch, `origin/<target>`
7
+ * (`GITHUB_BASE_REF` on GitHub and Forgejo, GitLab's
8
+ * `CI_MERGE_REQUEST_TARGET_BRANCH_NAME`).
9
+ * - A push to a branch other than the default branch: `origin/<default>`,
10
+ * so a change that edits a check or a policy on a side branch is still
11
+ * judged by the default branch's.
12
+ * - A push to the default branch, or a job with no branch: no base, and
13
+ * the checkout's own files are the trusted ones.
14
+ *
15
+ * `chant ci check` takes it as its `--base` when none is given.
16
+ *
17
+ * This module imports nothing.
18
+ */
19
+ export interface CiBaseOptions {
20
+ /** A base the caller already has (a flag, a product's own variable); it wins over everything. */
21
+ base?: string;
22
+ /** The default branch. Default GitLab's `CI_DEFAULT_BRANCH`; GitHub and Forgejo jobs carry none, so a product passes its own. */
23
+ defaultBranch?: string;
24
+ /** The remote the branches are fetched from. Default `origin`. */
25
+ remote?: string;
26
+ }
27
+ /** The base ref for the job `env` describes, as the module comment says; undefined when there is none. */
28
+ export declare function ciBaseRef(env?: Record<string, string | undefined>, options?: CiBaseOptions): string | undefined;
29
+ export { CI_BASE_REF_FLOOR } from "./release-floors.js";
30
+ //# sourceMappingURL=ci-base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ci-base.d.ts","sourceRoot":"","sources":["../src/ci-base.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,WAAW,aAAa;IAC5B,iGAAiG;IACjG,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iIAAiI;IACjI,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kEAAkE;IAClE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAID,0GAA0G;AAC1G,wBAAgB,SAAS,CAAC,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,EAAE,OAAO,GAAE,aAAkB,GAAG,MAAM,GAAG,SAAS,CAShI;AAED,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * `@intentius/chant/ci-base` (#4966): the base a CI job measures a change
3
+ * from, read off the job's own variables, so a product's check and policy
4
+ * steps need no rule of their own for it (terragucci's `policyBase`).
5
+ *
6
+ * - A pull request's job: its target branch, `origin/<target>`
7
+ * (`GITHUB_BASE_REF` on GitHub and Forgejo, GitLab's
8
+ * `CI_MERGE_REQUEST_TARGET_BRANCH_NAME`).
9
+ * - A push to a branch other than the default branch: `origin/<default>`,
10
+ * so a change that edits a check or a policy on a side branch is still
11
+ * judged by the default branch's.
12
+ * - A push to the default branch, or a job with no branch: no base, and
13
+ * the checkout's own files are the trusted ones.
14
+ *
15
+ * `chant ci check` takes it as its `--base` when none is given.
16
+ *
17
+ * This module imports nothing.
18
+ */
19
+ const set = (v) => (v && v.trim() ? v.trim() : undefined);
20
+ /** The base ref for the job `env` describes, as the module comment says; undefined when there is none. */
21
+ export function ciBaseRef(env = process.env, options = {}) {
22
+ const given = set(options.base);
23
+ if (given)
24
+ return given;
25
+ const remote = options.remote ?? "origin";
26
+ const target = set(env.GITHUB_BASE_REF) ?? set(env.CI_MERGE_REQUEST_TARGET_BRANCH_NAME);
27
+ if (target)
28
+ return `${remote}/${target}`;
29
+ const branch = set(env.GITHUB_REF_NAME) ?? set(env.CI_COMMIT_BRANCH);
30
+ const main = set(options.defaultBranch) ?? set(env.CI_DEFAULT_BRANCH);
31
+ return branch && main && branch !== main ? `${remote}/${main}` : undefined;
32
+ }
33
+ export { CI_BASE_REF_FLOOR } from "./release-floors.js";
@@ -0,0 +1,193 @@
1
+ /**
2
+ * The comment job on GitHub and Forgejo (#4946): one job that reads every
3
+ * `/<product>` comment and answers the ones no other job of the pipeline
4
+ * takes, the GitHub and Forgejo half of what the GitLab note poll does
5
+ * (./ci-note-commands.ts). Moved from terragucci's `decideComment` and
6
+ * `decideApplyComment` (comment.ts, comment-apply.ts).
7
+ *
8
+ * GitHub and Forgejo start a workflow on the comment itself, so each job
9
+ * that answers a command (the re-plan, the comment lock and unlock, the
10
+ * action job, the agent, the commit jobs, the apply before merge) starts on
11
+ * its own comment, and this job leaves those comments alone. It answers the
12
+ * rest:
13
+ *
14
+ * - a comment the grammar refuses (`parseProductComment` with
15
+ * `leaveCommit`, so a commit word stays the commit job's), with the
16
+ * grammar's reason, an alias's product reason among them
17
+ * (`CiProductAlias.refuse`);
18
+ * - a command no job runs (`plan`, `apply`, `lock`, `unlock`, `action`,
19
+ * `agent`), with the words' reply for it (`words.replies`) or chant's;
20
+ * - with `applyOnMerge`, `/<product> apply` on a merged pull request: the
21
+ * newest push run at its merge commit that has an apply job is started
22
+ * again, unless a later commit of the default branch already carries the
23
+ * product's apply status. On GitHub the run's failed jobs run again
24
+ * (`rerun-failed-jobs`), each wave behind its own gate. Forgejo has no
25
+ * call that runs a run again, so the waves workflow is dispatched on the
26
+ * default branch, and only while the merge commit is still the branch's
27
+ * newest push. A forge re-run cannot stop the waves after one, so with
28
+ * the waves' op (`jobs.waves`, #4979) a `wave-<n>` writes a stop for the
29
+ * merge commit on `chant/lifecycle` before the run starts, and the waves
30
+ * after n wait (./op/wave-stop.ts); without it a wave-n is refused. On a
31
+ * fork, a pull request merged elsewhere, or one closed without merging,
32
+ * the reply says so.
33
+ * - with `noPlanFlags` (#4979), a plan comment with flags the product
34
+ * plan's re-plan cannot take, with the reason.
35
+ * - with `wavesBeforeMerge` (#4984), `/<product> apply [wave-<n>]` on an
36
+ * open pull request: the decision before merge
37
+ * (./op/before-merge-decide.ts) records the head on `chant/lifecycle`
38
+ * and dispatches the waves workflow on the default branch for it.
39
+ *
40
+ * Who asked comes first. On GitHub the commenter's permission is read from
41
+ * the forge; Forgejo answers 403 when a job's token asks for another user's
42
+ * permission, so there the event's `repository.permissions`, computed for
43
+ * the comment's author when the comment was created, is read, and the
44
+ * event must be for this repository and from the comment's author. Someone
45
+ * without write access gets no reply and nothing runs, as on GitLab.
46
+ *
47
+ * The comment is untrusted input: it is read from the event file, never
48
+ * from an expression in a script, and nothing of it reaches a shell. The
49
+ * job runs at the target branch's commit, so none of the change's code
50
+ * runs here.
51
+ */
52
+ import { type ApplyRerun, type ChantNoteJobs, type StartedRun } from "./ci-note-commands.js";
53
+ import { type CiProductWords, type ParsedProductComment } from "./ci-product-words.js";
54
+ import { type ForgeFetch, type PrForge } from "./pr-forge.js";
55
+ import type { ForgeReads } from "./pr-forge-reads.js";
56
+ import type { DecideBeforeMergeInput, WavesBeforeMergeJobs } from "./op/before-merge-decide.js";
57
+ /** The comment job's name in a generated workflow (#4946). */
58
+ export declare const PR_COMMENT_JOB = "comment";
59
+ /** The variable the comment job reads the pipeline's jobs from, as JSON ({@link CommentJobs}), written by the generator (#4946). */
60
+ export declare const COMMENT_JOBS_ENV = "CHANT_COMMENT_JOBS";
61
+ /**
62
+ * The jobs the pipeline has that answer a comment (#4946), so the comment
63
+ * job leaves their comments to them. `preview` is any job that plans on the
64
+ * plan comment (the product plan's re-plan, or the comment preview).
65
+ */
66
+ export interface CommentJobs extends Omit<ChantNoteJobs, "members"> {
67
+ /** The action command is answered by a workflow: the product's own, or the pipeline's action job. */
68
+ actions?: boolean;
69
+ /**
70
+ * The product plan's targets, with its re-plan: a plan comment naming
71
+ * another is skipped by every re-plan job without a word, so the comment
72
+ * job replies with the words' `member` sentence.
73
+ */
74
+ targets?: readonly string[];
75
+ /** The product plan's re-plan skips a fork's pull request (`forks: "skip"`) without a word, so the comment job replies with the words' `fork` sentence. */
76
+ skipForks?: boolean;
77
+ /**
78
+ * The plan comment's job is the product plan's re-plan (#4979), which
79
+ * takes at most one word after the command and no flags: a plan comment
80
+ * with `--target`, `--refresh` or `--target-dependents` gets a reply that
81
+ * says so, where the re-plan would skip it without a word.
82
+ */
83
+ noPlanFlags?: boolean;
84
+ /**
85
+ * The waves on merge (#4979): the op they run as and how many there are.
86
+ * With them a merged pull request's `/<product> apply wave-<n>` runs the
87
+ * apply again and stops after wave n: the job writes the stop on
88
+ * `chant/lifecycle` for the merge commit (./op/wave-stop.ts) before it
89
+ * starts the run, and each later wave waits. An apply without a wave
90
+ * clears it.
91
+ */
92
+ waves?: {
93
+ op: string;
94
+ count: number;
95
+ };
96
+ /**
97
+ * The waves before merge (#4984), with `waves`: `/<product> apply
98
+ * [wave-<n>]` on an open pull request is this job's. It decides
99
+ * (./op/before-merge-decide.ts), records the decided head on
100
+ * `chant/lifecycle`, and dispatches the waves workflow for it.
101
+ */
102
+ wavesBeforeMerge?: WavesBeforeMergeJobs;
103
+ }
104
+ /** What the decision before merge reads and writes with (#4984), the comment job's handler's. */
105
+ export type CommentBeforeMerge = Pick<DecideBeforeMergeInput, "requires" | "statuses" | "git" | "cwd" | "lock" | "record" | "stop" | "now">;
106
+ /** Writes a wave stop for op `op` at `sha` on `chant/lifecycle`, or clears it (#4979). */
107
+ export type CommentWaveStops = (op: string, sha: string, stop: {
108
+ through: number;
109
+ at: string;
110
+ by?: string;
111
+ pr?: number;
112
+ } | null) => Promise<void>;
113
+ /**
114
+ * The apply jobs a re-run looks for at a merge commit: chant's op waves
115
+ * (`wave-<k>-<name>`, its decide and share jobs) and chant's and
116
+ * terragucci's pull request loop jobs (`apply`, `apply-wave-<k>`).
117
+ */
118
+ export declare const RERUN_APPLY_JOBS: RegExp;
119
+ /** The writes a re-run makes, with the job's token. */
120
+ export interface CommentRuns {
121
+ /** GitHub: `POST /repos/{repo}/actions/runs/{run}/rerun-failed-jobs`. */
122
+ rerunFailed(run: number): Promise<StartedRun>;
123
+ /** Forgejo (and before merge, #4984, both): `POST /repos/{repo}/actions/workflows/{workflow}/dispatches` on `ref`, with `inputs`. */
124
+ dispatch(workflow: string, ref: string, inputs?: Record<string, string>): Promise<StartedRun>;
125
+ }
126
+ /** The writes for a GitHub or Forgejo API root, repository and token. */
127
+ export declare function commentRuns(opts: {
128
+ apiBase: string;
129
+ repo: string;
130
+ token: string;
131
+ fetch?: ForgeFetch;
132
+ }): CommentRuns;
133
+ /** What {@link answerProductComment} takes. */
134
+ export interface AnswerCommentOptions {
135
+ forge: "github" | "forgejo";
136
+ /** The `issue_comment` event, as the event file has it. */
137
+ event: unknown;
138
+ /** `owner/name`. */
139
+ repo: string;
140
+ reads: ForgeReads;
141
+ /** chant's client, holding the job's token: it posts the reply and reads the statuses. */
142
+ poster: Pick<PrForge, "addComment" | "commitStatuses">;
143
+ runs: CommentRuns;
144
+ words: CiProductWords;
145
+ /** The default branch. */
146
+ base: string;
147
+ jobs: CommentJobs;
148
+ /** The job's environment, for the words' aliases. */
149
+ env?: Record<string, string | undefined>;
150
+ /** The commit words that take an argument, as `parseProductComment` takes them. */
151
+ commitArgs?: Readonly<Record<string, RegExp>>;
152
+ /** With `jobs.waves` (#4979): writes the wave stop before a re-run starts. Absent: a `wave-<n>` is refused, as before. */
153
+ stops?: CommentWaveStops;
154
+ /** The time a stop is written at. Default now. */
155
+ now?: () => string;
156
+ /** With `jobs.wavesBeforeMerge` (#4984): what the decision reads and writes with. Absent: an open pull request's apply is refused, as before. */
157
+ beforeMerge?: CommentBeforeMerge;
158
+ }
159
+ /** What the comment job did. */
160
+ export interface CommentOutcome {
161
+ /** The command's kind, when the comment parsed as one. */
162
+ command?: string;
163
+ /** True when a run was started again. */
164
+ ran: boolean;
165
+ /** True when the job posted a reply. */
166
+ replied: boolean;
167
+ /** True when something broke (a forge answer), not because the comment asked for nothing. The command exits non-zero on it. */
168
+ fail?: boolean;
169
+ reason: string;
170
+ url?: string;
171
+ }
172
+ /** The command a comment asks for, for a job that only needs to know: the grammar's reading, leaving a commit word to the commit job. */
173
+ export declare function readProductComment(words: CiProductWords, body: unknown, env?: Record<string, string | undefined>, commitArgs?: Readonly<Record<string, RegExp>>): ParsedProductComment | undefined;
174
+ /**
175
+ * Whether another job of the pipeline answers `parsed` on an open or a
176
+ * merged pull request, so the comment job says nothing (#4946).
177
+ */
178
+ export declare function answeredElsewhere(parsed: Exclude<ParsedProductComment, {
179
+ kind: "refused";
180
+ }>, jobs: CommentJobs, open: boolean | undefined): boolean;
181
+ /** Read the comment, and answer it when no other job does (#4946). */
182
+ export declare function answerProductComment(o: AnswerCommentOptions): Promise<CommentOutcome>;
183
+ /** The reply to a plan comment with flags the product plan's re-plan cannot take (#4979). */
184
+ export declare function planFlagsReply(words: CiProductWords): string;
185
+ /** GitHub's start: run the run's failed jobs again, and the jobs that need them. */
186
+ export declare function githubRerun(runs: Pick<CommentRuns, "rerunFailed">): ApplyRerun;
187
+ /**
188
+ * Forgejo's start: Forgejo has no call that runs a run again, so the run's
189
+ * workflow is dispatched on the default branch, which runs its head. That
190
+ * is the merge commit only while no push came after it.
191
+ */
192
+ export declare function forgejoRerun(runs: Pick<CommentRuns, "dispatch">, reads: Pick<ForgeReads, "branchRuns">): ApplyRerun;
193
+ //# sourceMappingURL=ci-comment-commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ci-comment-commands.d.ts","sourceRoot":"","sources":["../src/ci-comment-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAGH,OAAO,EAAc,KAAK,UAAU,EAAqB,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACzH,OAAO,EAAuB,KAAK,cAAc,EAAE,KAAK,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AACzG,OAAO,EAAiB,KAAK,UAAU,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAqB,MAAM,kBAAkB,CAAC;AACtE,OAAO,KAAK,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC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