@intentius/chant 0.124.55 → 0.124.57

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 (419) hide show
  1. package/dist/ci-agent.d.ts.map +1 -1
  2. package/dist/ci-agent.js +1 -2
  3. package/dist/ci-audit/attribution.d.ts +111 -0
  4. package/dist/ci-audit/attribution.d.ts.map +1 -0
  5. package/dist/ci-audit/attribution.js +194 -0
  6. package/dist/ci-audit/audit-log.d.ts +144 -0
  7. package/dist/ci-audit/audit-log.d.ts.map +1 -0
  8. package/dist/ci-audit/audit-log.js +149 -0
  9. package/dist/ci-audit/index.d.ts +12 -0
  10. package/dist/ci-audit/index.d.ts.map +1 -0
  11. package/dist/ci-audit/index.js +11 -0
  12. package/dist/ci-audit/unrecorded.d.ts +74 -0
  13. package/dist/ci-audit/unrecorded.d.ts.map +1 -0
  14. package/dist/ci-audit/unrecorded.js +95 -0
  15. package/dist/ci-audit.d.ts +3 -0
  16. package/dist/ci-audit.d.ts.map +1 -0
  17. package/dist/ci-audit.js +2 -0
  18. package/dist/ci-control.d.ts.map +1 -1
  19. package/dist/ci-control.js +3 -4
  20. package/dist/ci-estate.d.ts +24 -0
  21. package/dist/ci-estate.d.ts.map +1 -1
  22. package/dist/ci-estate.js +1 -2
  23. package/dist/ci-identity.d.ts.map +1 -1
  24. package/dist/ci-identity.js +2 -3
  25. package/dist/ci-job-guard.d.ts +139 -0
  26. package/dist/ci-job-guard.d.ts.map +1 -0
  27. package/dist/ci-job-guard.js +287 -0
  28. package/dist/ci-jobs.d.ts +7 -0
  29. package/dist/ci-jobs.d.ts.map +1 -1
  30. package/dist/ci-jobs.js +7 -0
  31. package/dist/ci-product-words.d.ts +7 -1
  32. package/dist/ci-product-words.d.ts.map +1 -1
  33. package/dist/ci-product-words.js +38 -4
  34. package/dist/ci-product.d.ts +35 -0
  35. package/dist/ci-product.d.ts.map +1 -1
  36. package/dist/ci-product.js +38 -4
  37. package/dist/ci-respond-run.d.ts +73 -0
  38. package/dist/ci-respond-run.d.ts.map +1 -0
  39. package/dist/ci-respond-run.js +247 -0
  40. package/dist/ci-respond.d.ts +189 -0
  41. package/dist/ci-respond.d.ts.map +1 -0
  42. package/dist/ci-respond.js +285 -0
  43. package/dist/cli/handlers/audit-log.d.ts +12 -0
  44. package/dist/cli/handlers/audit-log.d.ts.map +1 -0
  45. package/dist/cli/handlers/audit-log.js +81 -0
  46. package/dist/cli/handlers/build.d.ts +7 -0
  47. package/dist/cli/handlers/build.d.ts.map +1 -1
  48. package/dist/cli/handlers/build.js +81 -0
  49. package/dist/cli/handlers/ci-check-job.d.ts +11 -0
  50. package/dist/cli/handlers/ci-check-job.d.ts.map +1 -0
  51. package/dist/cli/handlers/ci-check-job.js +27 -0
  52. package/dist/cli/handlers/ci-check.d.ts.map +1 -1
  53. package/dist/cli/handlers/ci-check.js +38 -9
  54. package/dist/cli/handlers/e2e-safe-run.d.ts +12 -0
  55. package/dist/cli/handlers/e2e-safe-run.d.ts.map +1 -0
  56. package/dist/cli/handlers/e2e-safe-run.js +23 -0
  57. package/dist/cli/handlers/lifecycle.d.ts.map +1 -1
  58. package/dist/cli/handlers/lifecycle.js +14 -0
  59. package/dist/cli/handlers/pr.d.ts +5 -0
  60. package/dist/cli/handlers/pr.d.ts.map +1 -1
  61. package/dist/cli/handlers/pr.js +346 -36
  62. package/dist/cli/handlers/run-wave.js +89 -1
  63. package/dist/cli/main.d.ts.map +1 -1
  64. package/dist/cli/main.js +56 -2
  65. package/dist/cli/parse-args.d.ts.map +1 -1
  66. package/dist/cli/parse-args.js +107 -0
  67. package/dist/cli/registry.d.ts +38 -0
  68. package/dist/cli/registry.d.ts.map +1 -1
  69. package/dist/components/adoption.d.ts.map +1 -1
  70. package/dist/components/adoption.js +1 -2
  71. package/dist/components/auto-release.d.ts +5 -2
  72. package/dist/components/auto-release.d.ts.map +1 -1
  73. package/dist/components/auto-release.js +9 -4
  74. package/dist/components/capability.d.ts +47 -0
  75. package/dist/components/capability.d.ts.map +1 -1
  76. package/dist/components/capability.js +25 -0
  77. package/dist/components/check-hooks.d.ts +4 -1
  78. package/dist/components/check-hooks.d.ts.map +1 -1
  79. package/dist/components/check-steps.d.ts +74 -0
  80. package/dist/components/check-steps.d.ts.map +1 -0
  81. package/dist/components/check-steps.js +102 -0
  82. package/dist/components/ci-services.d.ts.map +1 -1
  83. package/dist/components/ci-services.js +1 -2
  84. package/dist/components/deploy-units.d.ts +12 -0
  85. package/dist/components/deploy-units.d.ts.map +1 -1
  86. package/dist/components/deploy-units.js +20 -1
  87. package/dist/components/driver.d.ts +12 -0
  88. package/dist/components/driver.d.ts.map +1 -1
  89. package/dist/components/driver.js +35 -1
  90. package/dist/components/groups.d.ts.map +1 -1
  91. package/dist/components/groups.js +4 -3
  92. package/dist/components/pr-env-ledger.d.ts.map +1 -1
  93. package/dist/components/pr-env-ledger.js +1 -2
  94. package/dist/components/pr-environment.d.ts +1 -1
  95. package/dist/components/pr-environment.d.ts.map +1 -1
  96. package/dist/components/pr-environment.js +1 -1
  97. package/dist/components/pr-pipeline.d.ts +137 -5
  98. package/dist/components/pr-pipeline.d.ts.map +1 -1
  99. package/dist/components/pr-pipeline.js +164 -20
  100. package/dist/components/pr-run.d.ts +8 -0
  101. package/dist/components/pr-run.d.ts.map +1 -1
  102. package/dist/components/pr-run.js +9 -4
  103. package/dist/components/product-pipeline.d.ts +35 -2
  104. package/dist/components/product-pipeline.d.ts.map +1 -1
  105. package/dist/components/product-pipeline.js +24 -5
  106. package/dist/components/row-lease.d.ts +22 -1
  107. package/dist/components/row-lease.d.ts.map +1 -1
  108. package/dist/components/row-lease.js +32 -6
  109. package/dist/components/wave-plan.d.ts +8 -0
  110. package/dist/components/wave-plan.d.ts.map +1 -1
  111. package/dist/components/wave-plan.js +18 -2
  112. package/dist/e2e-harness/bucket.d.ts +21 -0
  113. package/dist/e2e-harness/bucket.d.ts.map +1 -0
  114. package/dist/e2e-harness/bucket.js +61 -0
  115. package/dist/e2e-harness/claim.d.ts +70 -0
  116. package/dist/e2e-harness/claim.d.ts.map +1 -0
  117. package/dist/e2e-harness/claim.js +98 -0
  118. package/dist/e2e-harness/driver.d.ts +64 -0
  119. package/dist/e2e-harness/driver.d.ts.map +1 -0
  120. package/dist/e2e-harness/driver.js +243 -0
  121. package/dist/e2e-harness/forgejo.d.ts +77 -0
  122. package/dist/e2e-harness/forgejo.d.ts.map +1 -0
  123. package/dist/e2e-harness/forgejo.js +205 -0
  124. package/dist/e2e-harness/git.d.ts +32 -0
  125. package/dist/e2e-harness/git.d.ts.map +1 -0
  126. package/dist/e2e-harness/git.js +67 -0
  127. package/dist/e2e-harness/index.d.ts +22 -0
  128. package/dist/e2e-harness/index.d.ts.map +1 -0
  129. package/dist/e2e-harness/index.js +47 -0
  130. package/dist/e2e-harness/jobs.d.ts +8 -0
  131. package/dist/e2e-harness/jobs.d.ts.map +1 -0
  132. package/dist/e2e-harness/jobs.js +34 -0
  133. package/dist/e2e-harness/pins.d.ts +45 -0
  134. package/dist/e2e-harness/pins.d.ts.map +1 -0
  135. package/dist/e2e-harness/pins.js +44 -0
  136. package/dist/e2e-harness/ports.d.ts +113 -0
  137. package/dist/e2e-harness/ports.d.ts.map +1 -0
  138. package/dist/e2e-harness/ports.js +4 -0
  139. package/dist/e2e-harness/reports.d.ts +45 -0
  140. package/dist/e2e-harness/reports.d.ts.map +1 -0
  141. package/dist/e2e-harness/reports.js +57 -0
  142. package/dist/e2e-harness/safe-run-cli.d.ts +17 -0
  143. package/dist/e2e-harness/safe-run-cli.d.ts.map +1 -0
  144. package/dist/e2e-harness/safe-run-cli.js +43 -0
  145. package/dist/e2e-harness/safe-run.d.ts +61 -0
  146. package/dist/e2e-harness/safe-run.d.ts.map +1 -0
  147. package/dist/e2e-harness/safe-run.js +172 -0
  148. package/dist/e2e-harness/scenario.d.ts +11 -0
  149. package/dist/e2e-harness/scenario.d.ts.map +1 -0
  150. package/dist/e2e-harness/scenario.js +89 -0
  151. package/dist/e2e-harness/schemas/demo-cycle.schema.json +282 -0
  152. package/dist/e2e-harness/schemas/demo-step.schema.json +245 -0
  153. package/dist/e2e-harness/schemas/e2e-claim-row.schema.json +33 -0
  154. package/dist/e2e-harness/schemas/e2e-claims.schema.json +18 -0
  155. package/dist/e2e-harness/schemas/e2e-scenario.schema.json +150 -0
  156. package/dist/e2e-harness/schemas/index.d.ts +191 -0
  157. package/dist/e2e-harness/schemas/index.d.ts.map +1 -0
  158. package/dist/e2e-harness/schemas/index.js +62 -0
  159. package/dist/e2e-harness/stack.d.ts +124 -0
  160. package/dist/e2e-harness/stack.d.ts.map +1 -0
  161. package/dist/e2e-harness/stack.js +207 -0
  162. package/dist/e2e-harness/steps.d.ts +11 -0
  163. package/dist/e2e-harness/steps.d.ts.map +1 -0
  164. package/dist/e2e-harness/steps.js +22 -0
  165. package/dist/e2e-harness.d.ts +3 -0
  166. package/dist/e2e-harness.d.ts.map +1 -0
  167. package/dist/e2e-harness.js +2 -0
  168. package/dist/exit-codes.d.ts +7 -1
  169. package/dist/exit-codes.d.ts.map +1 -1
  170. package/dist/exit-codes.js +7 -1
  171. package/dist/lexicon.d.ts +55 -0
  172. package/dist/lexicon.d.ts.map +1 -1
  173. package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
  174. package/dist/lifecycle/gate-ledger.js +2 -3
  175. package/dist/lifecycle/gated-request.d.ts.map +1 -1
  176. package/dist/lifecycle/gated-request.js +1 -2
  177. package/dist/lifecycle/git.d.ts +39 -3
  178. package/dist/lifecycle/git.d.ts.map +1 -1
  179. package/dist/lifecycle/git.js +223 -15
  180. package/dist/lifecycle/lock-rows.d.ts +23 -0
  181. package/dist/lifecycle/lock-rows.d.ts.map +1 -1
  182. package/dist/lifecycle/lock-rows.js +47 -8
  183. package/dist/lifecycle/query.d.ts.map +1 -1
  184. package/dist/lifecycle/query.js +4 -5
  185. package/dist/lifecycle/release-catalog.d.ts.map +1 -1
  186. package/dist/lifecycle/release-catalog.js +1 -1
  187. package/dist/lifecycle/release-ledger.d.ts.map +1 -1
  188. package/dist/lifecycle/release-ledger.js +1 -2
  189. package/dist/lifecycle/release-status.d.ts +20 -0
  190. package/dist/lifecycle/release-status.d.ts.map +1 -1
  191. package/dist/lifecycle/release-status.js +1 -22
  192. package/dist/lifecycle/resource-lock.d.ts +70 -0
  193. package/dist/lifecycle/resource-lock.d.ts.map +1 -1
  194. package/dist/lifecycle/resource-lock.js +241 -5
  195. package/dist/lifecycle/wave-plans.d.ts +23 -7
  196. package/dist/lifecycle/wave-plans.d.ts.map +1 -1
  197. package/dist/lifecycle/wave-plans.js +9 -2
  198. package/dist/op/approval-status.d.ts +103 -0
  199. package/dist/op/approval-status.d.ts.map +1 -0
  200. package/dist/op/approval-status.js +197 -0
  201. package/dist/op/gate.js +21 -4
  202. package/dist/op/index.d.ts +1 -1
  203. package/dist/op/index.d.ts.map +1 -1
  204. package/dist/op/index.js +1 -1
  205. package/dist/op/op-waves-capability-spec.d.ts +8 -0
  206. package/dist/op/op-waves-capability-spec.d.ts.map +1 -1
  207. package/dist/op/op-waves-capability-spec.js +21 -0
  208. package/dist/op/op-waves-release-port.js +1 -1
  209. package/dist/op/op-waves-release.d.ts +2 -1
  210. package/dist/op/op-waves-release.d.ts.map +1 -1
  211. package/dist/op/op-waves-release.js +1 -2
  212. package/dist/op/op-waves-run.d.ts +15 -2
  213. package/dist/op/op-waves-run.d.ts.map +1 -1
  214. package/dist/op/op-waves-run.js +195 -31
  215. package/dist/op/op-waves-stand-down.d.ts.map +1 -1
  216. package/dist/op/op-waves-stand-down.js +1 -2
  217. package/dist/op/op-waves.d.ts +53 -0
  218. package/dist/op/op-waves.d.ts.map +1 -1
  219. package/dist/op/op-waves.js +62 -6
  220. package/dist/op/runtime.d.ts +4 -0
  221. package/dist/op/runtime.d.ts.map +1 -1
  222. package/dist/op/runtime.js +2 -3
  223. package/dist/otlp.d.ts.map +1 -1
  224. package/dist/otlp.js +1 -2
  225. package/dist/parallelism.d.ts +17 -0
  226. package/dist/parallelism.d.ts.map +1 -0
  227. package/dist/parallelism.js +33 -0
  228. package/dist/policy-source.d.ts.map +1 -1
  229. package/dist/policy-source.js +1 -2
  230. package/dist/pr-forge.d.ts.map +1 -1
  231. package/dist/pr-forge.js +56 -39
  232. package/dist/pr-loop.d.ts +9 -0
  233. package/dist/pr-loop.d.ts.map +1 -1
  234. package/dist/pr-loop.js +22 -4
  235. package/dist/pr-merge.d.ts +64 -0
  236. package/dist/pr-merge.d.ts.map +1 -0
  237. package/dist/pr-merge.js +78 -0
  238. package/dist/pr-post.d.ts +70 -1
  239. package/dist/pr-post.d.ts.map +1 -1
  240. package/dist/pr-post.js +116 -5
  241. package/dist/pr-report-url.d.ts.map +1 -1
  242. package/dist/pr-report-url.js +1 -2
  243. package/dist/release-floors.d.ts +1 -1
  244. package/dist/release-floors.js +1 -1
  245. package/dist/run-event.d.ts.map +1 -1
  246. package/dist/run-event.js +1 -2
  247. package/dist/scheduled-op-cloud.d.ts +32 -0
  248. package/dist/scheduled-op-cloud.d.ts.map +1 -0
  249. package/dist/scheduled-op-cloud.js +69 -0
  250. package/dist/wave-runtime.mjs +351 -328
  251. package/dist/workspace/ci-lock-grain.d.ts +5 -0
  252. package/dist/workspace/ci-lock-grain.d.ts.map +1 -1
  253. package/dist/workspace/ci-lock-grain.js +1 -7
  254. package/dist/workspace/ci-run.d.ts.map +1 -1
  255. package/dist/workspace/ci-run.js +5 -1
  256. package/dist/workspace/pr-report.schema.json +5 -0
  257. package/package.json +1 -1
  258. package/src/ci-agent.ts +1 -2
  259. package/src/ci-audit/__fixtures__/cloudtrail-lookup-bucket.json +37 -0
  260. package/src/ci-audit/__fixtures__/cloudtrail-writes-window.json +59 -0
  261. package/src/ci-audit/attribution.ts +260 -0
  262. package/src/ci-audit/audit-log.ts +220 -0
  263. package/src/ci-audit/ci-audit.test.ts +175 -0
  264. package/src/ci-audit/index.ts +14 -0
  265. package/src/ci-audit/unrecorded.ts +140 -0
  266. package/src/ci-audit.ts +2 -0
  267. package/src/ci-control.ts +3 -4
  268. package/src/ci-estate.ts +1 -2
  269. package/src/ci-identity-database.test.ts +2 -3
  270. package/src/ci-identity-targets.test.ts +1 -3
  271. package/src/ci-identity.ts +2 -3
  272. package/src/ci-job-guard.test.ts +154 -0
  273. package/src/ci-job-guard.ts +319 -0
  274. package/src/ci-jobs.ts +8 -0
  275. package/src/ci-product-comment-targets.test.ts +45 -0
  276. package/src/ci-product-words.ts +35 -6
  277. package/src/ci-product.ts +55 -4
  278. package/src/ci-respond-run.ts +291 -0
  279. package/src/ci-respond.test.ts +264 -0
  280. package/src/ci-respond.ts +412 -0
  281. package/src/cli/handlers/audit-log.ts +74 -0
  282. package/src/cli/handlers/build-pr-loop-flags.test.ts +98 -0
  283. package/src/cli/handlers/build.ts +69 -0
  284. package/src/cli/handlers/ci-check-job.test.ts +114 -0
  285. package/src/cli/handlers/ci-check-job.ts +33 -0
  286. package/src/cli/handlers/ci-check.ts +38 -8
  287. package/src/cli/handlers/e2e-safe-run.ts +27 -0
  288. package/src/cli/handlers/lifecycle.ts +13 -0
  289. package/src/cli/handlers/pr-before-merge.test.ts +1 -1
  290. package/src/cli/handlers/pr-deploy-inputs.test.ts +1 -1
  291. package/src/cli/handlers/pr-endpoint.test.ts +1 -1
  292. package/src/cli/handlers/pr-green.test.ts +1 -1
  293. package/src/cli/handlers/pr-plan-comment-targets.test.ts +166 -0
  294. package/src/cli/handlers/pr-plan-flags.test.ts +161 -0
  295. package/src/cli/handlers/pr-plan-targets.test.ts +1 -1
  296. package/src/cli/handlers/pr-record.test.ts +34 -2
  297. package/src/cli/handlers/pr-waves-blocked.test.ts +1 -1
  298. package/src/cli/handlers/pr-waves.test.ts +1 -1
  299. package/src/cli/handlers/pr.test.ts +1 -1
  300. package/src/cli/handlers/pr.ts +311 -32
  301. package/src/cli/handlers/run-wave.ts +79 -1
  302. package/src/cli/main.test.ts +1 -1
  303. package/src/cli/main.ts +56 -2
  304. package/src/cli/parse-args.ts +77 -0
  305. package/src/cli/registry.ts +38 -0
  306. package/src/components/adoption.ts +1 -2
  307. package/src/components/auto-release.test.ts +4 -2
  308. package/src/components/auto-release.ts +9 -5
  309. package/src/components/capability.ts +60 -0
  310. package/src/components/check-hooks.ts +4 -1
  311. package/src/components/check-steps.test.ts +70 -0
  312. package/src/components/check-steps.ts +158 -0
  313. package/src/components/ci-services.ts +1 -2
  314. package/src/components/deploy-units.test.ts +18 -1
  315. package/src/components/deploy-units.ts +26 -1
  316. package/src/components/driver.ts +35 -1
  317. package/src/components/groups.ts +4 -2
  318. package/src/components/plan-flags.test.ts +46 -0
  319. package/src/components/pr-comment-preview-targets.test.ts +34 -0
  320. package/src/components/pr-env-ledger.ts +1 -2
  321. package/src/components/pr-env-run-bundle.test.ts +0 -20
  322. package/src/components/pr-environment.ts +1 -1
  323. package/src/components/pr-pipeline-runners.test.ts +80 -0
  324. package/src/components/pr-pipeline.ts +244 -20
  325. package/src/components/pr-run.ts +17 -6
  326. package/src/components/pr-stale-job.test.ts +34 -0
  327. package/src/components/product-pipeline.ts +50 -8
  328. package/src/components/row-lease.test.ts +61 -1
  329. package/src/components/row-lease.ts +48 -7
  330. package/src/components/wave-plan.ts +18 -2
  331. package/src/e2e-harness/__project__/chant.config.ts +4 -0
  332. package/src/e2e-harness/__project__/src/compose.ts +33 -0
  333. package/src/e2e-harness/bucket.ts +69 -0
  334. package/src/e2e-harness/claim.test.ts +150 -0
  335. package/src/e2e-harness/claim.ts +140 -0
  336. package/src/e2e-harness/driver.test.ts +304 -0
  337. package/src/e2e-harness/driver.ts +294 -0
  338. package/src/e2e-harness/forgejo.ts +267 -0
  339. package/src/e2e-harness/git.ts +96 -0
  340. package/src/e2e-harness/index.ts +49 -0
  341. package/src/e2e-harness/jobs.ts +35 -0
  342. package/src/e2e-harness/pins.ts +52 -0
  343. package/src/e2e-harness/ports.ts +130 -0
  344. package/src/e2e-harness/reports.ts +79 -0
  345. package/src/e2e-harness/safe-run-cli.test.ts +102 -0
  346. package/src/e2e-harness/safe-run-cli.ts +54 -0
  347. package/src/e2e-harness/safe-run.ts +198 -0
  348. package/src/e2e-harness/scenario.ts +89 -0
  349. package/src/e2e-harness/schemas/README.md +62 -0
  350. package/src/e2e-harness/schemas/demo-cycle.schema.json +282 -0
  351. package/src/e2e-harness/schemas/demo-step.schema.json +245 -0
  352. package/src/e2e-harness/schemas/e2e-claim-row.schema.json +33 -0
  353. package/src/e2e-harness/schemas/e2e-claims.schema.json +18 -0
  354. package/src/e2e-harness/schemas/e2e-scenario.schema.json +150 -0
  355. package/src/e2e-harness/schemas/index.ts +220 -0
  356. package/src/e2e-harness/schemas.test.ts +145 -0
  357. package/src/e2e-harness/stack.test.ts +124 -0
  358. package/src/e2e-harness/stack.ts +306 -0
  359. package/src/e2e-harness/steps.ts +30 -0
  360. package/src/e2e-harness.ts +2 -0
  361. package/src/exit-codes.test.ts +3 -2
  362. package/src/exit-codes.ts +7 -1
  363. package/src/gate-decision-bundle.test.ts +0 -2
  364. package/src/lexicon.ts +57 -0
  365. package/src/lifecycle/control-entries-ledger.test.ts +2 -3
  366. package/src/lifecycle/gate-ledger.ts +2 -3
  367. package/src/lifecycle/gated-request.ts +1 -2
  368. package/src/lifecycle/git.test.ts +155 -0
  369. package/src/lifecycle/git.ts +213 -17
  370. package/src/lifecycle/lock-rows.test.ts +6 -1
  371. package/src/lifecycle/lock-rows.ts +58 -7
  372. package/src/lifecycle/query.ts +4 -5
  373. package/src/lifecycle/release-catalog.test.ts +3 -4
  374. package/src/lifecycle/release-catalog.ts +1 -1
  375. package/src/lifecycle/release-ledger.ts +1 -2
  376. package/src/lifecycle/release-status.test.ts +3 -4
  377. package/src/lifecycle/release-status.ts +1 -2
  378. package/src/lifecycle/resource-lock-wait.test.ts +292 -0
  379. package/src/lifecycle/resource-lock.ts +261 -7
  380. package/src/lifecycle/wave-plans.ts +33 -5
  381. package/src/op/approval-status.test.ts +134 -0
  382. package/src/op/approval-status.ts +235 -0
  383. package/src/op/gate-review.test.ts +2 -1
  384. package/src/op/gate.test.ts +7 -5
  385. package/src/op/gate.ts +20 -4
  386. package/src/op/index.ts +2 -0
  387. package/src/op/op-waves-after-plan.test.ts +11 -0
  388. package/src/op/op-waves-capability-spec.ts +20 -0
  389. package/src/op/op-waves-ledger-lock.test.ts +208 -0
  390. package/src/op/op-waves-parallelism.test.ts +89 -0
  391. package/src/op/op-waves-pull-request.test.ts +78 -1
  392. package/src/op/op-waves-release-port.ts +1 -1
  393. package/src/op/op-waves-release.ts +2 -3
  394. package/src/op/op-waves-run.ts +196 -31
  395. package/src/op/op-waves-stand-down.ts +1 -2
  396. package/src/op/op-waves.ts +81 -6
  397. package/src/op/runtime.ts +6 -3
  398. package/src/otlp.ts +1 -2
  399. package/src/parallelism.test.ts +38 -0
  400. package/src/parallelism.ts +33 -0
  401. package/src/policy-source.ts +1 -2
  402. package/src/pr-forge-bundle.test.ts +1 -1
  403. package/src/pr-forge.ts +54 -35
  404. package/src/pr-loop-bundle.test.ts +0 -2
  405. package/src/pr-loop-narrowed.test.ts +63 -0
  406. package/src/pr-loop.ts +30 -4
  407. package/src/pr-merge.test.ts +100 -0
  408. package/src/pr-merge.ts +105 -0
  409. package/src/pr-post-stale.test.ts +163 -0
  410. package/src/pr-post.ts +159 -5
  411. package/src/pr-report-url.ts +1 -2
  412. package/src/product-subpaths-plain-node.e2e.test.ts +1 -0
  413. package/src/release-floors.ts +1 -1
  414. package/src/run-event.ts +1 -2
  415. package/src/scheduled-op-cloud.ts +68 -0
  416. package/src/stage-hooks-bundle.test.ts +0 -2
  417. package/src/workspace/ci-lock-grain.ts +1 -2
  418. package/src/workspace/ci-run.ts +5 -1
  419. package/src/workspace/pr-report.schema.json +5 -0
@@ -0,0 +1,285 @@
1
+ /**
2
+ * Responses to pipeline events (#4629), in CI core so terragucci and plywood
3
+ * answer the same events the same way, each in its own words.
4
+ *
5
+ * - `wave-refused: diff`: a wave that applied nothing because its plan moved
6
+ * since the approval, another run held it, or its decision point declined
7
+ * it posts which members moved and what moved in them, from the approved
8
+ * change set and the current one.
9
+ * - `apply-failed: triage`: a failed apply posts the members and resources
10
+ * that failed with the engine's error, from the run record (an op wave's)
11
+ * or the apply report (`pr-apply`'s).
12
+ * - `description: check`: with a decide service set, the plan-note job asks
13
+ * whether the pull request's title and description leave out what its
14
+ * change set destroys or replaces, and posts the finding. It never
15
+ * approves, gates or blocks anything.
16
+ *
17
+ * The first two are on by default and the third is off. Each one is turned
18
+ * off (or on) with a list such as `wave-refused=off,description=check`: the
19
+ * `--respond` flag, the `CHANT_RESPOND` variable a generated job sets, or an
20
+ * op waves spec's `respond`.
21
+ *
22
+ * Every post is one comment per event and place, found again by its marker,
23
+ * so a job that runs twice edits its comment. Delivery never throws and never
24
+ * changes a job's exit code.
25
+ */
26
+ import { activeProductWords } from "./ci-product-words.js";
27
+ /** Each event's modes; the first is its default. */
28
+ export const CI_RESPONSES = {
29
+ "wave-refused": ["diff", "off"],
30
+ "apply-failed": ["triage", "off"],
31
+ description: ["off", "check"],
32
+ };
33
+ /** The variable a generated job carries its responses in. */
34
+ export const CI_RESPOND_ENV = "CHANT_RESPOND";
35
+ /** Every event at its default. */
36
+ export const CI_RESPOND_DEFAULTS = { "wave-refused": "diff", "apply-failed": "triage", description: "off" };
37
+ /** `wave-refused=off,description=check` as responses, or why it is not a list of them. */
38
+ export function parseRespondList(text) {
39
+ const parts = (typeof text === "string" ? text.split(",") : text.flatMap((t) => t.split(","))).map((p) => p.trim()).filter(Boolean);
40
+ const out = {};
41
+ for (const part of parts) {
42
+ const eq = part.indexOf("=");
43
+ const event = eq < 0 ? part : part.slice(0, eq);
44
+ const mode = eq < 0 ? "" : part.slice(eq + 1);
45
+ if (!(event in CI_RESPONSES))
46
+ return { error: `--respond names no event ${JSON.stringify(event)}; the events are ${Object.keys(CI_RESPONSES).join(", ")}` };
47
+ const modes = CI_RESPONSES[event];
48
+ if (!modes.includes(mode))
49
+ return { error: `--respond ${event} takes ${modes.join(" or ")}, not ${JSON.stringify(mode)}` };
50
+ out[event] = mode;
51
+ }
52
+ return out;
53
+ }
54
+ /** The list form of `responses`, for `--respond` and {@link CI_RESPOND_ENV}. Empty when every event is at its default. */
55
+ export function respondList(responses) {
56
+ return Object.keys(CI_RESPONSES)
57
+ .filter((e) => responses[e] !== undefined && responses[e] !== CI_RESPOND_DEFAULTS[e])
58
+ .map((e) => `${e}=${responses[e]}`)
59
+ .join(",");
60
+ }
61
+ /**
62
+ * The responses in force: the defaults, then `CHANT_RESPOND`, then the
63
+ * spec's or the flag's. A malformed variable is ignored with a warning,
64
+ * since a response never stops a job.
65
+ */
66
+ export function resolveResponses(given, env = process.env, warn = () => { }) {
67
+ let fromEnv = {};
68
+ const raw = env[CI_RESPOND_ENV];
69
+ if (raw) {
70
+ const parsed = parseRespondList(raw);
71
+ if ("error" in parsed)
72
+ warn(`${CI_RESPOND_ENV} is ignored: ${parsed.error}`);
73
+ else
74
+ fromEnv = parsed;
75
+ }
76
+ return { ...CI_RESPOND_DEFAULTS, ...fromEnv, ...(given ?? {}) };
77
+ }
78
+ /** The hidden marker of one response's comment. */
79
+ export function respondMarker(event, place) {
80
+ return `<!-- chant:respond:${event}:${place.replace(/[^A-Za-z0-9._/-]/g, "_")} -->`;
81
+ }
82
+ const shown = (a) => a === undefined ? undefined : a.sensitive ? "(sensitive)" : a.unknown ? "(known after apply)" : JSON.stringify(a.after ?? null);
83
+ function entryDiffs(was, now) {
84
+ const key = (e) => `${e.address}\u0000${e.deposed ?? ""}`;
85
+ const before = new Map(was.map((e) => [key(e), e]));
86
+ const after = new Map(now.map((e) => [key(e), e]));
87
+ const out = [];
88
+ for (const k of [...new Set([...before.keys(), ...after.keys()])].sort()) {
89
+ const b = before.get(k);
90
+ const a = after.get(k);
91
+ const paths = new Set([...(b?.attributes ?? []).map((x) => x.path), ...(a?.attributes ?? []).map((x) => x.path)]);
92
+ const moved = [...paths].filter((p) => shown(b?.attributes.find((x) => x.path === p)) !== shown(a?.attributes.find((x) => x.path === p))).sort();
93
+ if (b?.action === a?.action && moved.length === 0)
94
+ continue;
95
+ out.push({ address: (a ?? b).address, ...(b ? { was: b.action } : {}), ...(a ? { now: a.action } : {}), attributes: moved });
96
+ }
97
+ return out;
98
+ }
99
+ /**
100
+ * The members whose plan digest differs between the approved change set and
101
+ * the current one, entry by entry. `only` narrows to the members a wave
102
+ * holds. A member that planned the same in both is left out.
103
+ */
104
+ export function changeSetDiff(approved, current, only) {
105
+ const names = new Set([...(approved?.members ?? []).map((m) => m.member), ...(current?.members ?? []).map((m) => m.member)]);
106
+ const keep = only ? new Set(only) : undefined;
107
+ const out = [];
108
+ for (const member of [...names].sort()) {
109
+ if (keep && !keep.has(member))
110
+ continue;
111
+ const was = approved?.members.find((m) => m.member === member)?.planDigest ?? null;
112
+ const now = current?.members.find((m) => m.member === member)?.planDigest ?? null;
113
+ if (was === now && was !== null)
114
+ continue;
115
+ const changes = approved && current ? entryDiffs(approved.entries.filter((e) => e.member === member), current.entries.filter((e) => e.member === member)) : [];
116
+ out.push({ member, approved: was, current: now, changes });
117
+ }
118
+ return out;
119
+ }
120
+ /** The members whose plan digest differs, when only the digests are known (an op wave's decision against its share job's plans). */
121
+ export function digestDiff(approved, current) {
122
+ return [...new Set([...Object.keys(approved), ...Object.keys(current)])]
123
+ .sort()
124
+ .filter((m) => approved[m] !== current[m] || approved[m] == null)
125
+ .map((member) => ({ member, approved: approved[member] ?? null, current: current[member] ?? null, changes: [] }));
126
+ }
127
+ /** A digest's first 12 hex characters past its scheme; `none` when there is none. */
128
+ export const shortDigest = (d) => (d ? d.slice(d.lastIndexOf(":") + 1).slice(0, 12) : "none");
129
+ /** The post for a refused wave or apply, in the product's words. */
130
+ export function renderRefusedDiff(d, words = activeProductWords()) {
131
+ const [, applied] = words.verbs.apply;
132
+ const [nounOne, nounMany] = words.noun;
133
+ const lines = [];
134
+ if (d.reason === "moved") {
135
+ lines.push(`${capital(d.label)} ${applied} nothing: its plans changed after the approval (approved ${shortDigest(d.approved)}, now ${shortDigest(d.current)}).`);
136
+ }
137
+ else if (d.reason === "held") {
138
+ lines.push(`${capital(d.label)} ${applied} nothing: another run holds what it changes${d.detail ? ` (${d.detail})` : ""}.`);
139
+ }
140
+ else {
141
+ lines.push(`${capital(d.label)} ${applied} nothing: its decision point declined it${d.detail ? ` (${d.detail})` : ""}.`);
142
+ }
143
+ if (d.members.length === 0) {
144
+ if (d.reason === "moved")
145
+ lines.push("", `No ${nounOne}'s plan differs from the approved change set that could be read.`);
146
+ }
147
+ else {
148
+ lines.push("", `${d.members.length === 1 ? capital(nounOne) : capital(nounMany)} whose plan differs from the approved one:`, "");
149
+ for (const m of d.members) {
150
+ lines.push(`- \`${m.member}\`: plan ${shortDigest(m.approved)} -> ${shortDigest(m.current)}`);
151
+ for (const c of m.changes) {
152
+ const action = c.was === c.now ? c.now : `${c.was ?? "none"} -> ${c.now ?? "none"}`;
153
+ lines.push(` - \`${c.address}\` ${action}${c.attributes.length ? `: ${c.attributes.join(", ")}` : ""}`);
154
+ }
155
+ if (m.current === null)
156
+ lines.push(` - it did not ${words.verbs.plan[0]} this time`);
157
+ }
158
+ }
159
+ if (d.reason === "moved")
160
+ lines.push("", "Approve again only once the new plan is the one you want.");
161
+ else if (d.reason === "held")
162
+ lines.push("", `Run it again once the other run is done; the approval still stands.`);
163
+ return lines.join("\n");
164
+ }
165
+ /** The longest error kept per member, so one engine's dump cannot fill the comment. */
166
+ const ERROR_LIMIT = 2000;
167
+ const clip = (text) => (text.length > ERROR_LIMIT ? `${text.slice(0, ERROR_LIMIT)}\n... (cut at ${ERROR_LIMIT} characters; the job's log has the rest)` : text);
168
+ /** The post for a failed apply, in the product's words. */
169
+ export function renderTriage(f, words = activeProductWords()) {
170
+ const [apply] = words.verbs.apply;
171
+ const [nounOne, nounMany] = words.noun;
172
+ const lines = [`${capital(f.label)} failed (exit ${f.exitCode}).`];
173
+ if (f.members.length > 0) {
174
+ lines.push("", `${f.members.length === 1 ? capital(nounOne) : capital(nounMany)} that did not ${apply}:`);
175
+ for (const m of f.members) {
176
+ lines.push("", `- \`${m.member}\``);
177
+ if (m.resources?.length)
178
+ lines.push(` - failed resources: ${m.resources.map((r) => `\`${r}\``).join(", ")}`);
179
+ if (m.error)
180
+ lines.push("", "```", clip(m.error).replaceAll("```", "'''"), "```");
181
+ }
182
+ }
183
+ if (f.error)
184
+ lines.push("", "```", clip(f.error).replaceAll("```", "'''"), "```");
185
+ lines.push("", `What applied before the failure stays applied. Fix the cause and ${apply} again; the run record keeps every ${nounOne}'s outcome.`);
186
+ return lines.join("\n");
187
+ }
188
+ const MAX_TEXT = 4000;
189
+ const MAX_LISTED = 50;
190
+ const named = (e) => `${e.member}: ${e.address}`;
191
+ /** The destroys and replacements of a change set. */
192
+ export function destructiveEntries(doc) {
193
+ return { destroys: doc.entries.filter((e) => e.action === "delete"), replacements: doc.entries.filter((e) => e.action === "replace") };
194
+ }
195
+ export function descriptionState(doc, title, description) {
196
+ const { destroys, replacements } = destructiveEntries(doc);
197
+ const a = doc.summary.actions;
198
+ return {
199
+ title: title.slice(0, MAX_TEXT),
200
+ description: description.slice(0, MAX_TEXT),
201
+ plan: {
202
+ counts: { create: a.create ?? 0, update: a.update ?? 0, replace: a.replace ?? 0, delete: a.delete ?? 0 },
203
+ destroys: destroys.slice(0, MAX_LISTED).map(named),
204
+ replacements: replacements.slice(0, MAX_LISTED).map(named),
205
+ },
206
+ };
207
+ }
208
+ /** Whether the text names an entry by its address, its type or its member. */
209
+ function mentions(text, e) {
210
+ const hay = text.toLowerCase();
211
+ return [e.address, e.address.replace(/\[.*$/, ""), e.name, e.type].some((s) => typeof s === "string" && s.length > 2 && hay.includes(s.toLowerCase()));
212
+ }
213
+ /** The destroys and replacements the text does not mention; every one when it names them all, since the model found the text leaves something out. */
214
+ export function unmentioned(doc, text) {
215
+ const { destroys, replacements } = destructiveEntries(doc);
216
+ const all = [...destroys, ...replacements];
217
+ const left = all.filter((e) => !mentions(text, e));
218
+ return left.length > 0 ? left : all;
219
+ }
220
+ /** The question asked. A Noul: the probability the answer is yes. */
221
+ export const DESCRIPTION_QUESTION = {
222
+ type: "noul",
223
+ instructions: "Read the pull request's title and description and the summary of its plan. Answer true when the plan destroys or replaces resources that the title and description do not mention or that they contradict. Answer false when the text covers every destroy and replacement, or the plan has none.",
224
+ criteria: {
225
+ true: "the plan destroys or replaces something the text leaves out or contradicts",
226
+ false: "the text describes every destroy and replacement, or there are none",
227
+ },
228
+ };
229
+ /** The default probability a yes needs before the finding is posted. */
230
+ export const DESCRIPTION_THRESHOLD = 0.8;
231
+ /** Ask whether the description leaves out a destroy or replacement. Never throws. */
232
+ export async function checkDescription(input) {
233
+ const { destroys, replacements } = destructiveEntries(input.doc);
234
+ if (destroys.length + replacements.length === 0)
235
+ return { status: "skipped", reason: "the plan destroys and replaces nothing", unmentioned: [] };
236
+ let answer;
237
+ try {
238
+ answer = await input.ask(descriptionState(input.doc, input.title, input.description));
239
+ }
240
+ catch (err) {
241
+ return { status: "error", reason: err instanceof Error ? err.message : String(err), unmentioned: [] };
242
+ }
243
+ const threshold = input.threshold ?? DESCRIPTION_THRESHOLD;
244
+ const base = { probability: answer.probability, model: answer.model, ...(answer.reason ? { reason: answer.reason } : {}) };
245
+ if (!(answer.probability >= threshold))
246
+ return { status: "clear", ...base, unmentioned: [] };
247
+ const left = unmentioned(input.doc, `${input.title}\n${input.description}`);
248
+ const names = left.map(named);
249
+ return { status: "flagged", ...base, unmentioned: names, body: renderDescriptionFinding(left, base, input.words ?? activeProductWords()) };
250
+ }
251
+ function renderDescriptionFinding(left, answer, words) {
252
+ const list = left.slice(0, 10).map((e) => `- \`${named(e).replaceAll("`", "'")}\` (${e.action === "replace" ? "replace" : "destroy"})`);
253
+ if (left.length > 10)
254
+ list.push(`- and ${left.length - 10} more in the plan note`);
255
+ return [
256
+ `Check the description of this pull request. The ${words.verbs.plan[0]} makes changes it does not mention:`,
257
+ "",
258
+ ...list,
259
+ "",
260
+ `${answer.model} answered yes with probability ${answer.probability.toFixed(2)}${answer.reason ? `: ${answer.reason}` : ""}. This finding approves nothing and never blocks a merge.`,
261
+ ].join("\n");
262
+ }
263
+ /**
264
+ * Post one response's body, editing its earlier comment. On a pull request
265
+ * the comment carries the marker as its first line; with no pull request it
266
+ * goes to a tracking issue titled `issue`. Never throws.
267
+ */
268
+ export async function postResponse(forge, event, place, where, body) {
269
+ const marker = respondMarker(event, place);
270
+ const text = `${marker}\n${body}${body.endsWith("\n") ? "" : "\n"}`;
271
+ try {
272
+ if ("pr" in where) {
273
+ const r = await forge.upsertComment(where.pr, marker, text);
274
+ return { posted: true, ...(r.url ? { url: r.url } : {}) };
275
+ }
276
+ const r = await forge.trackIssue(marker, { title: where.issue, body: text }, { match: "anywhere" });
277
+ return { posted: true, ...(r.url ? { url: r.url } : {}) };
278
+ }
279
+ catch (err) {
280
+ return { posted: false, warning: `could not post the ${event} response: ${err instanceof Error ? err.message : String(err)}` };
281
+ }
282
+ }
283
+ function capital(s) {
284
+ return s.length === 0 ? s : s[0].toUpperCase() + s.slice(1);
285
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * `chant audit-log attribute` and `chant audit-log unrecorded` (#4632): the
3
+ * CI core reads of `../../ci-audit`. `attribute` reads a drift document
4
+ * (`chant workspace drift -o <file>`) and names who changed each drifted
5
+ * attribute; `unrecorded` reads the audit log's writes over a window and
6
+ * reports those no recorded apply on the run ledger made. Both read the
7
+ * log with the credentials the job holds and write nothing.
8
+ */
9
+ import type { CommandContext } from "../registry.js";
10
+ export declare function runAuditLogAttribute(ctx: CommandContext): Promise<number>;
11
+ export declare function runAuditLogUnrecorded(ctx: CommandContext): Promise<number>;
12
+ //# sourceMappingURL=audit-log.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit-log.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/audit-log.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAOlD,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CA0B/E;AAED,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CA0BhF"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * `chant audit-log attribute` and `chant audit-log unrecorded` (#4632): the
3
+ * CI core reads of `../../ci-audit`. `attribute` reads a drift document
4
+ * (`chant workspace drift -o <file>`) and names who changed each drifted
5
+ * attribute; `unrecorded` reads the audit log's writes over a window and
6
+ * reports those no recorded apply on the run ledger made. Both read the
7
+ * log with the credentials the job holds and write nothing.
8
+ */
9
+ import { readFileSync } from "node:fs";
10
+ import { resolve } from "node:path";
11
+ import { formatError } from "../format.js";
12
+ const fail = (message, hint) => {
13
+ console.error(formatError({ message, ...(hint ? { hint } : {}) }));
14
+ return 1;
15
+ };
16
+ export async function runAuditLogAttribute(ctx) {
17
+ const { args } = ctx;
18
+ if (!args.input)
19
+ return fail("audit-log attribute reads a drift document: --input <file>", "Write one with chant workspace drift -o <file>.");
20
+ const audit = await import("../../ci-audit.js");
21
+ const { parseDriftDocument } = await import("../../drift-record.js");
22
+ let doc;
23
+ try {
24
+ doc = parseDriftDocument(JSON.parse(readFileSync(resolve(args.input), "utf-8")));
25
+ }
26
+ catch (err) {
27
+ return fail(`--input ${args.input} is not a drift document: ${err instanceof Error ? err.message : String(err)}`);
28
+ }
29
+ let auditLogs;
30
+ if (args.auditLog) {
31
+ const setting = audit.parseAuditLogSetting(args.auditLog);
32
+ if ("error" in setting)
33
+ return fail(setting.error);
34
+ auditLogs = { "*": setting };
35
+ }
36
+ const attributed = await audit.attributeDrift(doc, { ...(auditLogs ? { auditLogs } : {}) });
37
+ if (args.json) {
38
+ console.log(JSON.stringify(attributed, null, 2));
39
+ return 0;
40
+ }
41
+ for (const n of attributed.notes)
42
+ console.error(n);
43
+ const routed = audit.routeAttributions(attributed.attributions);
44
+ console.log(routed.lines.length > 0 ? routed.lines.join("\n") : "no drifted attribute to attribute");
45
+ return 0;
46
+ }
47
+ export async function runAuditLogUnrecorded(ctx) {
48
+ const { args } = ctx;
49
+ if (!args.auditLog)
50
+ return fail("audit-log unrecorded reads a cloud's audit log: --audit-log aws[:<region>]");
51
+ if (!args.op)
52
+ return fail("audit-log unrecorded compares against the applies of the ops named: --op <op>[,<op>...]");
53
+ if (!args.since || !Number.isFinite(Date.parse(args.since)))
54
+ return fail("audit-log unrecorded reads the writes since a time: --since <ISO-8601>");
55
+ const audit = await import("../../ci-audit.js");
56
+ const setting = audit.parseAuditLogSetting(args.auditLog);
57
+ if ("error" in setting)
58
+ return fail(setting.error);
59
+ const { readRunLedger } = await import("../../lifecycle/run-ledger.js");
60
+ const { requireLifecycleLedger } = await import("../../lifecycle/git.js");
61
+ const env = args.env ?? "local";
62
+ const windows = [];
63
+ try {
64
+ await requireLifecycleLedger({ cwd: process.cwd() });
65
+ for (const op of args.op.split(",").map((o) => o.trim()).filter(Boolean)) {
66
+ windows.push(...audit.applyWindowsFromRuns((await readRunLedger(env, op)).records));
67
+ }
68
+ }
69
+ catch (err) {
70
+ return fail(`could not read the run ledger: ${err instanceof Error ? err.message : String(err)}`);
71
+ }
72
+ const until = new Date().toISOString();
73
+ const report = await audit.unrecordedWrites(audit.auditLogOf(setting), windows, { since: new Date(args.since).toISOString(), until });
74
+ if (args.json)
75
+ console.log(JSON.stringify(report, null, 2));
76
+ else
77
+ console.log(audit.renderUnrecorded(report));
78
+ if (report.unavailable)
79
+ return 1;
80
+ return report.unrecorded.length > 0 ? 2 : 0;
81
+ }
@@ -1,3 +1,10 @@
1
1
  import type { CommandContext } from "../registry.js";
2
+ /**
3
+ * Why the pull request loop's merge, respond, decide and plan flags (#4636,
4
+ * #4629, #4627) do not hold together on `chant build`, or undefined when
5
+ * they do. Each value is refused by name, as `pr-apply` and `pr-post` refuse
6
+ * it, so a build never writes a job that fails on its own line.
7
+ */
8
+ export declare function prLoopFlagsProblem(args: Pick<CommandContext["args"], "prLoop" | "applyBeforeMerge" | "merge" | "mergeTokenEnv" | "mergeMethod" | "respond" | "decideBackend" | "decideModel" | "targetDependents">): string | undefined;
2
9
  export declare function runBuild(ctx: CommandContext): Promise<number>;
3
10
  //# sourceMappingURL=build.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/build.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAsSlD,wBAAsB,QAAQ,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAsJnE"}
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/build.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAiGlD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,QAAQ,GAAG,kBAAkB,GAAG,OAAO,GAAG,eAAe,GAAG,aAAa,GAAG,SAAS,GAAG,eAAe,GAAG,aAAa,GAAG,kBAAkB,CAAC,GAAG,MAAM,GAAG,SAAS,CA6BvO;AAuOD,wBAAsB,QAAQ,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAsJnE"}
@@ -9,6 +9,8 @@ import { resolveCliBuildParams, parseParamFlags } from "../build-params-cli.js";
9
9
  import { findWorkspaceRoot } from "../../project-root.js";
10
10
  import { resolvePromotionSource } from "../../components/promote-order.js";
11
11
  import { activeProductWords, isChantWords } from "../../ci-product-words.js";
12
+ import { PR_APPLY_MERGES, PR_MERGE_METHODS } from "../../pr-merge.js";
13
+ import { parseRespondList } from "../../ci-respond.js";
12
14
  /**
13
15
  * The engine install lines the project's lexicons give (#4550,
14
16
  * `LexiconPlugin.ciSetup`), for the default image. A lexicon that cannot
@@ -51,8 +53,17 @@ async function engineSetupFor(path) {
51
53
  * pull request before it merges, beside the record job.
52
54
  * `--preview-comment` (#4620) writes the jobs that answer the product's plan
53
55
  * comment with a preview of the pull request's head.
56
+ * `--pr-runner`, `--pr-variable`, `--pr-secret` and `--parallelism` (#4625)
57
+ * set each stage's runner, the plan and apply jobs' variables and passed
58
+ * secrets, and how many members the plan plans at once.
59
+ * `--merge auto --merge-token-env <VAR> [--merge-method <m>]` (#4636) merges
60
+ * the pull request after its update before merge. `--respond <list>`,
61
+ * `--decide-backend` and `--decide-model` (#4629) set the apply and note
62
+ * jobs' responses and the description check's service. {@link prLoopFlagsProblem}
63
+ * has checked all of them first.
54
64
  */
55
65
  function prLoopOption(args, reportUrl, requireReview = false, requireRunnerStart = false) {
66
+ const respond = args.respond ? parseRespondList(args.respond) : undefined;
56
67
  // #4550: a product's bin set its words; the generated jobs answer its comment and run its bin.
57
68
  const words = activeProductWords();
58
69
  return {
@@ -69,9 +80,73 @@ function prLoopOption(args, reportUrl, requireReview = false, requireRunnerStart
69
80
  ...(args.prEnv ? { prEnvironment: true } : {}),
70
81
  ...(args.applyBeforeMerge ? { applyBeforeMerge: true } : {}),
71
82
  ...(args.previewComment ? { previewComment: true } : {}),
83
+ // #4628: the note carries its target commit, and a push marks the open notes stale.
84
+ ...(args.staleNotes ? { staleNotes: true } : {}),
72
85
  ...(args.requires ? { applyRequires: args.requires } : {}),
86
+ // #4625: where the jobs run, and what the jobs that plan or apply get.
87
+ ...(args.prRunners ? { runners: Object.fromEntries(Object.entries(args.prRunners).map(([stage, labels]) => [stage, labels.length === 1 ? labels[0] : labels])) } : {}),
88
+ ...(args.prVariables ? { variables: args.prVariables } : {}),
89
+ ...(args.prSecrets ? { secrets: args.prSecrets } : {}),
90
+ ...(args.parallelism !== undefined ? { parallelism: args.parallelism } : {}),
91
+ // #4627: the plan refreshes each step's state first.
92
+ ...(args.refresh ? { refresh: true } : {}),
93
+ // #4636: the update before merge merges with its own token.
94
+ ...(args.merge === "auto" && args.mergeTokenEnv ? { applyMerge: { tokenEnv: args.mergeTokenEnv, ...(args.mergeMethod ? { method: args.mergeMethod } : {}) } } : {}),
95
+ // #4629: the responses on the apply and note jobs, and the description check's service.
96
+ ...(respond && Object.keys(respond).length > 0 ? { respond } : {}),
97
+ ...(args.decideBackend && args.decideModel ? { decide: { backend: args.decideBackend, model: args.decideModel } } : {}),
73
98
  };
74
99
  }
100
+ /**
101
+ * Why the pull request loop's merge, respond, decide and plan flags (#4636,
102
+ * #4629, #4627) do not hold together on `chant build`, or undefined when
103
+ * they do. Each value is refused by name, as `pr-apply` and `pr-post` refuse
104
+ * it, so a build never writes a job that fails on its own line.
105
+ */
106
+ export function prLoopFlagsProblem(args) {
107
+ const given = [
108
+ ...(args.merge !== undefined ? ["--merge"] : []),
109
+ ...(args.mergeTokenEnv !== undefined ? ["--merge-token-env"] : []),
110
+ ...(args.mergeMethod !== undefined ? ["--merge-method"] : []),
111
+ ...(args.respond !== undefined ? ["--respond"] : []),
112
+ ...(args.decideBackend !== undefined ? ["--decide-backend"] : []),
113
+ ...(args.decideModel !== undefined ? ["--decide-model"] : []),
114
+ ];
115
+ if (!args.prLoop)
116
+ return given.length > 0 ? `${given.join(", ")} set the pull request loop's jobs, so ${given.length === 1 ? "it needs" : "they need"} --pr-loop` : undefined;
117
+ if (args.targetDependents)
118
+ return "--target-dependents widens a --target, and the pull request's plan job plans with no target, so build takes no --target-dependents; give it in the preview comment beside --target";
119
+ if (args.merge === undefined) {
120
+ if (args.mergeTokenEnv !== undefined || args.mergeMethod !== undefined)
121
+ return "--merge-token-env and --merge-method go with --merge auto";
122
+ }
123
+ else if (!PR_APPLY_MERGES.includes(args.merge)) {
124
+ return `--merge takes ${PR_APPLY_MERGES.join(" or ")}, not ${args.merge}`;
125
+ }
126
+ else if (args.merge === "manual") {
127
+ if (args.mergeTokenEnv !== undefined || args.mergeMethod !== undefined)
128
+ return "--merge manual leaves the merge to a person, so it takes no --merge-token-env or --merge-method";
129
+ }
130
+ else {
131
+ if (!args.applyBeforeMerge)
132
+ return "--merge auto merges a pull request once its update before merge applied, so it needs --apply-before-merge";
133
+ if (!args.mergeTokenEnv)
134
+ return "--merge auto merges with a token of its own, never the job's: --merge-token-env <VAR> (on GitLab a protected variable)";
135
+ if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(args.mergeTokenEnv))
136
+ return `--merge-token-env takes a variable name, not ${args.mergeTokenEnv}`;
137
+ if (args.mergeMethod !== undefined && !PR_MERGE_METHODS.includes(args.mergeMethod))
138
+ return `--merge-method takes ${PR_MERGE_METHODS.join(", ")}, not ${args.mergeMethod}`;
139
+ }
140
+ const respond = args.respond ? parseRespondList(args.respond) : {};
141
+ if ("error" in respond)
142
+ return respond.error;
143
+ const check = respond.description === "check";
144
+ if (check && (!args.decideBackend || !args.decideModel))
145
+ return "--respond description=check asks a decide service, so it needs --decide-backend <name> and --decide-model <id>";
146
+ if (!check && (args.decideBackend !== undefined || args.decideModel !== undefined))
147
+ return "--decide-backend and --decide-model name the description check's service, so they go with --respond description=check";
148
+ return undefined;
149
+ }
75
150
  /**
76
151
  * `chant build --components --generate <lexicon>` — generate mode (#563,
77
152
  * epic #551 Phase 3). Discovers `Component` declarations under `args.path`
@@ -97,6 +172,12 @@ function prLoopOption(args, reportUrl, requireReview = false, requireRunnerStart
97
172
  async function runGenerateComponents(ctx) {
98
173
  const { args } = ctx;
99
174
  const lexicon = args.generate;
175
+ // #4636, #4629, #4627: the pull request loop's flags are checked before anything loads.
176
+ const flagsProblem = prLoopFlagsProblem(args);
177
+ if (flagsProblem) {
178
+ console.error(formatError({ message: flagsProblem }));
179
+ return 1;
180
+ }
100
181
  const { config } = await loadChantConfigUpward(resolve(args.path)).catch(() => ({ config: {} }));
101
182
  const paramsResolution = resolveCliBuildParams(config.buildParams, {
102
183
  cli: parseParamFlags(args.param),
@@ -0,0 +1,11 @@
1
+ /**
2
+ * `chant ci check-job` (#4624): the apply-job guard as a command, for a
3
+ * product that renders its own jobs (`plywood ci check-job`, `terragucci ci
4
+ * check-job` through the product's bin). It reads the job's expectation
5
+ * from CHANT_JOB_GUARD, as the generated op-wave step does, checks it
6
+ * against what the forge tells the job, and exits chant's `misplaced` (9)
7
+ * with one line per value that differs, or when the variable holds no spec. See ../../ci-job-guard.ts.
8
+ */
9
+ import type { CommandContext } from "../registry.js";
10
+ export declare function runCiCheckJob(_ctx: CommandContext, env?: NodeJS.ProcessEnv, fetchFn?: typeof fetch): Promise<number>;
11
+ //# sourceMappingURL=ci-check-job.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ci-check-job.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/ci-check-job.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,wBAAsB,aAAa,CAAC,IAAI,EAAE,cAAc,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,EAAE,OAAO,GAAE,OAAO,KAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAsB9I"}
@@ -0,0 +1,27 @@
1
+ export async function runCiCheckJob(_ctx, env = process.env, fetchFn = fetch) {
2
+ const [{ parseJobGuardSpec, jobSeen, checkJob, describeJobGuard, JOB_GUARD_ENV }, { CHANT_EXIT }, { activeProductWords }] = await Promise.all([
3
+ import("../../ci-job-guard.js"),
4
+ import("../../exit-codes.js"),
5
+ import("../../ci-product-words.js"),
6
+ ]);
7
+ let spec;
8
+ try {
9
+ spec = parseJobGuardSpec(env[JOB_GUARD_ENV]);
10
+ }
11
+ catch (err) {
12
+ console.error(`${activeProductWords().product} check-job: ${err instanceof Error ? err.message : String(err)}`);
13
+ return CHANT_EXIT.misplaced;
14
+ }
15
+ if (spec.product === undefined) {
16
+ const product = activeProductWords().product;
17
+ if (product !== "chant")
18
+ spec = { ...spec, product };
19
+ }
20
+ const seen = await jobSeen(spec, env, fetchFn);
21
+ const { ok, out, err } = describeJobGuard(spec, checkJob(spec, seen));
22
+ for (const line of out)
23
+ console.log(line);
24
+ for (const line of err)
25
+ console.error(line);
26
+ return ok ? CHANT_EXIT.done : CHANT_EXIT.misplaced;
27
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"ci-check.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/ci-check.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAIlD,wBAAsB,UAAU,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAmBrE"}
1
+ {"version":3,"file":"ci-check.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/ci-check.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAsBlD,wBAAsB,UAAU,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAwBrE"}
@@ -3,10 +3,34 @@
3
3
  * (#4556): run the `ci.hooks.check` hooks the workspace declaration at
4
4
  * `--base` names, as a product's check job does. Each target is a root,
5
5
  * stack or component the change touches; a `perRun` hook runs once per
6
- * target. Exits 0 when every hook passed or none is declared, 1 when one
7
- * failed. See `../../components/check-hooks.ts`.
6
+ * target. Then each lexicon the project lists runs its own check steps for
7
+ * the members of its kinds (#4633, `LexiconPlugin.checkSteps`): the pulumi
8
+ * lexicon's `pulumi install`, stack config check and `pulumi about`. Exits 0
9
+ * when every hook and step passed or there were none, 1 (`failed`) when one
10
+ * failed. See `../../components/check-hooks.ts` and
11
+ * `../../components/check-steps.ts`.
8
12
  */
13
+ import { resolve } from "node:path";
14
+ import { CHANT_EXIT } from "../../exit-codes.js";
9
15
  import { formatError } from "../format.js";
16
+ /**
17
+ * The check steps of the lexicons the project at `cwd` lists, best effort:
18
+ * a directory with no chant project, or a lexicon that does not load, gives
19
+ * none, and the hooks still run.
20
+ */
21
+ async function lexiconCheckSteps(ctx, cwd) {
22
+ let plugins = ctx.plugins ?? [];
23
+ if (plugins.length === 0) {
24
+ try {
25
+ const { loadPlugins, resolveProjectLexicons } = await import("../plugins.js");
26
+ plugins = await loadPlugins(await resolveProjectLexicons(resolve(cwd)));
27
+ }
28
+ catch {
29
+ plugins = [];
30
+ }
31
+ }
32
+ return plugins.map((p) => p.checkSteps?.()).filter((a) => a !== undefined);
33
+ }
10
34
  const USAGE = "chant ci check --base <rev> [<target>...] [--output <dir>] [--json]";
11
35
  export async function runCiCheck(ctx) {
12
36
  const { args } = ctx;
@@ -15,20 +39,25 @@ export async function runCiCheck(ctx) {
15
39
  return 1;
16
40
  }
17
41
  const targets = (args.positionals ?? []).slice(1);
18
- const { runCheckHooks } = await import("../../components/check-hooks.js");
42
+ const { runCheckStage } = await import("../../components/check-steps.js");
19
43
  let report;
20
44
  try {
21
- report = runCheckHooks({ base: args.base, targets, ...(args.output ? { dir: args.output } : {}) });
45
+ const adapters = await lexiconCheckSteps(ctx, process.cwd());
46
+ report = await runCheckStage({ base: args.base, targets, adapters, ...(args.output ? { dir: args.output } : {}) });
22
47
  }
23
48
  catch (err) {
24
49
  console.error(formatError({ message: err instanceof Error ? err.message : String(err), hint: USAGE }));
25
- return 1;
50
+ return CHANT_EXIT.failed;
26
51
  }
27
52
  if (args.json)
28
53
  console.log(JSON.stringify(report, null, 2));
29
54
  else if (report.status === "none")
30
- console.error("ci check: no ci.hooks.check at base, so nothing ran");
31
- else
32
- console.error(`ci check: ${report.hooks.filter((h) => h.outcome === "passed").length} passed, ${report.hooks.filter((h) => h.outcome === "failed").length} failed, ${report.hooks.filter((h) => h.outcome === "skipped").length} skipped`);
33
- return report.status === "failed" ? 1 : 0;
55
+ console.error("ci check: no ci.hooks.check at base and no lexicon check step, so nothing ran");
56
+ else {
57
+ const all = [...report.hooks, ...(report.steps ?? [])];
58
+ console.error(`ci check: ${all.filter((h) => h.outcome === "passed").length} passed, ${all.filter((h) => h.outcome === "failed").length} failed, ${all.filter((h) => h.outcome === "skipped").length} skipped`);
59
+ if (report.failed)
60
+ console.error(`ci check: ${report.failed}`);
61
+ }
62
+ return report.status === "failed" ? CHANT_EXIT.failed : CHANT_EXIT.done;
34
63
  }
@@ -0,0 +1,12 @@
1
+ import type { CommandContext } from "../registry.js";
2
+ /** `chant e2e <word>` with a word that is not a verb. */
3
+ export declare function runE2eUnknown(ctx: CommandContext): Promise<number>;
4
+ /**
5
+ * `chant e2e safe-run [--scan <dir>]... -- <command...>` (chant#4587, C1): the
6
+ * harness's no-real-cloud wrapper (`../../e2e-harness/safe-run.ts`) for a
7
+ * driver that is not TypeScript. Exit codes: the command's own code after a
8
+ * CLEAN scan, 3 when the scan rejects the run, 2 for a usage error or a
9
+ * refused environment.
10
+ */
11
+ export declare function runE2eSafeRun(ctx: CommandContext): Promise<number>;
12
+ //# sourceMappingURL=e2e-safe-run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"e2e-safe-run.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/e2e-safe-run.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAIlD,yDAAyD;AACzD,wBAAsB,aAAa,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAGxE;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAQxE"}