@intentius/chant 0.124.40 → 0.124.42

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 (346) hide show
  1. package/dist/__fixtures__/oidc-emulator.d.ts +49 -0
  2. package/dist/__fixtures__/oidc-emulator.d.ts.map +1 -0
  3. package/dist/__fixtures__/oidc-emulator.js +89 -0
  4. package/dist/ci-handover.d.ts +117 -0
  5. package/dist/ci-handover.d.ts.map +1 -0
  6. package/dist/ci-handover.js +217 -0
  7. package/dist/ci-identity.d.ts +190 -0
  8. package/dist/ci-identity.d.ts.map +1 -0
  9. package/dist/ci-identity.js +219 -0
  10. package/dist/cli/handlers/approve.d.ts +2 -1
  11. package/dist/cli/handlers/approve.d.ts.map +1 -1
  12. package/dist/cli/handlers/approve.js +20 -6
  13. package/dist/cli/handlers/build.d.ts.map +1 -1
  14. package/dist/cli/handlers/build.js +18 -1
  15. package/dist/cli/handlers/fan-out.d.ts.map +1 -1
  16. package/dist/cli/handlers/fan-out.js +42 -5
  17. package/dist/cli/handlers/gate-resume.d.ts +3 -0
  18. package/dist/cli/handlers/gate-resume.d.ts.map +1 -1
  19. package/dist/cli/handlers/gate-resume.js +15 -2
  20. package/dist/cli/handlers/lock.d.ts +8 -0
  21. package/dist/cli/handlers/lock.d.ts.map +1 -0
  22. package/dist/cli/handlers/lock.js +197 -0
  23. package/dist/cli/handlers/pr-env.d.ts +34 -0
  24. package/dist/cli/handlers/pr-env.d.ts.map +1 -0
  25. package/dist/cli/handlers/pr-env.js +436 -0
  26. package/dist/cli/handlers/pr.d.ts +76 -0
  27. package/dist/cli/handlers/pr.d.ts.map +1 -1
  28. package/dist/cli/handlers/pr.js +615 -55
  29. package/dist/cli/handlers/promote.d.ts.map +1 -1
  30. package/dist/cli/handlers/promote.js +9 -0
  31. package/dist/cli/handlers/query.d.ts +6 -0
  32. package/dist/cli/handlers/query.d.ts.map +1 -0
  33. package/dist/cli/handlers/query.js +80 -0
  34. package/dist/cli/handlers/run.d.ts.map +1 -1
  35. package/dist/cli/handlers/run.js +11 -0
  36. package/dist/cli/main.d.ts.map +1 -1
  37. package/dist/cli/main.js +49 -4
  38. package/dist/cli/parse-args.d.ts.map +1 -1
  39. package/dist/cli/parse-args.js +46 -2
  40. package/dist/cli/registry.d.ts +31 -2
  41. package/dist/cli/registry.d.ts.map +1 -1
  42. package/dist/components/capability.d.ts +47 -0
  43. package/dist/components/capability.d.ts.map +1 -1
  44. package/dist/components/capability.js +44 -0
  45. package/dist/components/cli-support.d.ts +6 -0
  46. package/dist/components/cli-support.d.ts.map +1 -1
  47. package/dist/components/cli-support.js +8 -1
  48. package/dist/components/driver.d.ts +10 -0
  49. package/dist/components/driver.d.ts.map +1 -1
  50. package/dist/components/driver.js +52 -2
  51. package/dist/components/fan-out-run.d.ts +37 -0
  52. package/dist/components/fan-out-run.d.ts.map +1 -1
  53. package/dist/components/fan-out-run.js +44 -4
  54. package/dist/components/gate-plan.d.ts +2 -0
  55. package/dist/components/gate-plan.d.ts.map +1 -1
  56. package/dist/components/gate-plan.js +1 -0
  57. package/dist/components/pr-environment.d.ts +298 -0
  58. package/dist/components/pr-environment.d.ts.map +1 -0
  59. package/dist/components/pr-environment.js +406 -0
  60. package/dist/components/pr-hooks.d.ts +66 -0
  61. package/dist/components/pr-hooks.d.ts.map +1 -0
  62. package/dist/components/pr-hooks.js +119 -0
  63. package/dist/components/pr-pipeline.d.ts +92 -2
  64. package/dist/components/pr-pipeline.d.ts.map +1 -1
  65. package/dist/components/pr-pipeline.js +150 -21
  66. package/dist/components/pr-policy.d.ts +109 -0
  67. package/dist/components/pr-policy.d.ts.map +1 -0
  68. package/dist/components/pr-policy.js +150 -0
  69. package/dist/components/pr-run.d.ts +6 -0
  70. package/dist/components/pr-run.d.ts.map +1 -1
  71. package/dist/components/pr-run.js +8 -3
  72. package/dist/components/wave-plan.d.ts +14 -1
  73. package/dist/components/wave-plan.d.ts.map +1 -1
  74. package/dist/components/wave-plan.js +34 -2
  75. package/dist/gate-decision.d.ts +15 -2
  76. package/dist/gate-decision.d.ts.map +1 -1
  77. package/dist/gate-decision.js +17 -2
  78. package/dist/gate-policy.d.ts +140 -0
  79. package/dist/gate-policy.d.ts.map +1 -0
  80. package/dist/gate-policy.js +242 -0
  81. package/dist/lifecycle/gate-checkpoint.d.ts +1 -1
  82. package/dist/lifecycle/gate-checkpoint.js +1 -1
  83. package/dist/{workspace/trust → lifecycle}/gate-seal.d.ts +1 -1
  84. package/dist/lifecycle/gate-seal.d.ts.map +1 -0
  85. package/dist/lifecycle/query.d.ts +68 -0
  86. package/dist/lifecycle/query.d.ts.map +1 -0
  87. package/dist/lifecycle/query.js +246 -0
  88. package/dist/lifecycle/run-ledger.d.ts +13 -0
  89. package/dist/lifecycle/run-ledger.d.ts.map +1 -1
  90. package/dist/lifecycle/run-ledger.js +16 -0
  91. package/dist/lifecycle/target-lock.d.ts +97 -0
  92. package/dist/lifecycle/target-lock.d.ts.map +1 -0
  93. package/dist/lifecycle/target-lock.js +286 -0
  94. package/dist/op/activities/activity-contracts.d.ts +30 -0
  95. package/dist/op/activities/activity-contracts.d.ts.map +1 -1
  96. package/dist/op/activities/activity-contracts.js +26 -0
  97. package/dist/op/activities/index.d.ts +2 -0
  98. package/dist/op/activities/index.d.ts.map +1 -1
  99. package/dist/op/activities/index.js +4 -0
  100. package/dist/op/activities/pr-refs.d.ts +10 -0
  101. package/dist/op/activities/pr-refs.d.ts.map +1 -0
  102. package/dist/op/activities/pr-refs.js +26 -0
  103. package/dist/op/activities/predict-behaviour.d.ts +2 -4
  104. package/dist/op/activities/predict-behaviour.d.ts.map +1 -1
  105. package/dist/op/activities/predict-behaviour.js +2 -21
  106. package/dist/op/activities/review-agent.d.ts +137 -0
  107. package/dist/op/activities/review-agent.d.ts.map +1 -0
  108. package/dist/op/activities/review-agent.js +266 -0
  109. package/dist/op/builders.d.ts +9 -0
  110. package/dist/op/builders.d.ts.map +1 -1
  111. package/dist/op/builders.js +11 -0
  112. package/dist/op/cron.d.ts +8 -0
  113. package/dist/op/cron.d.ts.map +1 -1
  114. package/dist/op/cron.js +51 -0
  115. package/dist/op/gate-approval.d.ts +20 -13
  116. package/dist/op/gate-approval.d.ts.map +1 -1
  117. package/dist/op/gate-approval.js +13 -18
  118. package/dist/op/gate-quorum.d.ts +131 -0
  119. package/dist/op/gate-quorum.d.ts.map +1 -0
  120. package/dist/op/gate-quorum.js +183 -0
  121. package/dist/op/gate-resume.d.ts +4 -2
  122. package/dist/op/gate-resume.d.ts.map +1 -1
  123. package/dist/op/gate-resume.js +5 -4
  124. package/dist/op/gate-review.js +1 -1
  125. package/dist/op/gate.d.ts +32 -4
  126. package/dist/op/gate.d.ts.map +1 -1
  127. package/dist/op/gate.js +40 -24
  128. package/dist/op/index.d.ts +6 -4
  129. package/dist/op/index.d.ts.map +1 -1
  130. package/dist/op/index.js +4 -3
  131. package/dist/op/local-executor.d.ts.map +1 -1
  132. package/dist/op/local-executor.js +9 -3
  133. package/dist/op/op-waves-run.d.ts +28 -43
  134. package/dist/op/op-waves-run.d.ts.map +1 -1
  135. package/dist/op/op-waves-run.js +170 -120
  136. package/dist/op/op-waves.d.ts +55 -3
  137. package/dist/op/op-waves.d.ts.map +1 -1
  138. package/dist/op/op-waves.js +63 -8
  139. package/dist/op/schedule-overdue.d.ts +57 -0
  140. package/dist/op/schedule-overdue.d.ts.map +1 -0
  141. package/dist/op/schedule-overdue.js +138 -0
  142. package/dist/op/stage-hooks.d.ts +132 -0
  143. package/dist/op/stage-hooks.d.ts.map +1 -0
  144. package/dist/op/stage-hooks.js +142 -0
  145. package/dist/override-gate.d.ts +2 -2
  146. package/dist/override-gate.d.ts.map +1 -1
  147. package/dist/override-gate.js +1 -1
  148. package/dist/pr-forge.d.ts +64 -0
  149. package/dist/pr-forge.d.ts.map +1 -1
  150. package/dist/pr-forge.js +331 -44
  151. package/dist/pr-loop.d.ts +107 -1
  152. package/dist/pr-loop.d.ts.map +1 -1
  153. package/dist/pr-loop.js +84 -3
  154. package/dist/pr-post.d.ts +72 -0
  155. package/dist/pr-post.d.ts.map +1 -0
  156. package/dist/pr-post.js +134 -0
  157. package/dist/pr-requires.d.ts +38 -0
  158. package/dist/pr-requires.d.ts.map +1 -0
  159. package/dist/pr-requires.js +48 -0
  160. package/dist/wave-blocked.d.ts +79 -0
  161. package/dist/wave-blocked.d.ts.map +1 -0
  162. package/dist/wave-blocked.js +245 -0
  163. package/dist/wave-engine.d.ts +6 -0
  164. package/dist/wave-engine.d.ts.map +1 -1
  165. package/dist/wave-engine.js +2 -0
  166. package/dist/wave-runtime.mjs +243 -243
  167. package/dist/workspace/__fixtures__/two-member-workspace.d.ts +1 -0
  168. package/dist/workspace/__fixtures__/two-member-workspace.d.ts.map +1 -1
  169. package/dist/workspace/__fixtures__/two-member-workspace.js +1 -1
  170. package/dist/workspace/checks/ci-workflow.d.ts.map +1 -1
  171. package/dist/workspace/checks/ci-workflow.js +19 -4
  172. package/dist/workspace/ci-branches.d.ts +51 -0
  173. package/dist/workspace/ci-branches.d.ts.map +1 -0
  174. package/dist/workspace/ci-branches.js +69 -0
  175. package/dist/workspace/ci-cloud-identity.d.ts +11 -0
  176. package/dist/workspace/ci-cloud-identity.d.ts.map +1 -0
  177. package/dist/workspace/ci-cloud-identity.js +24 -0
  178. package/dist/workspace/ci-init.d.ts.map +1 -1
  179. package/dist/workspace/ci-init.js +5 -4
  180. package/dist/workspace/ci-locks.d.ts +12 -0
  181. package/dist/workspace/ci-locks.d.ts.map +1 -0
  182. package/dist/workspace/ci-locks.js +6 -0
  183. package/dist/workspace/ci-run.d.ts +17 -1
  184. package/dist/workspace/ci-run.d.ts.map +1 -1
  185. package/dist/workspace/ci-run.js +66 -4
  186. package/dist/workspace/ci-workflow-at.d.ts +14 -0
  187. package/dist/workspace/ci-workflow-at.d.ts.map +1 -0
  188. package/dist/workspace/ci-workflow-at.js +17 -0
  189. package/dist/workspace/ci-workflow.d.ts +11 -3
  190. package/dist/workspace/ci-workflow.d.ts.map +1 -1
  191. package/dist/workspace/ci-workflow.js +10 -2
  192. package/dist/workspace/declaration.d.ts +69 -3
  193. package/dist/workspace/declaration.d.ts.map +1 -1
  194. package/dist/workspace/declaration.js +72 -1
  195. package/dist/workspace/declaration.schema.json +149 -2
  196. package/dist/workspace/identity-gate-rule.d.ts +1 -1
  197. package/dist/workspace/identity-gate-rule.d.ts.map +1 -1
  198. package/dist/workspace/identity-gate-rule.js +1 -1
  199. package/dist/workspace/identity.d.ts +1 -1
  200. package/dist/workspace/identity.d.ts.map +1 -1
  201. package/dist/workspace/lineage-upgrade.d.ts.map +1 -1
  202. package/dist/workspace/lineage-upgrade.js +8 -5
  203. package/dist/workspace/member-pipeline.d.ts +6 -0
  204. package/dist/workspace/member-pipeline.d.ts.map +1 -1
  205. package/dist/workspace/member-pipeline.js +23 -0
  206. package/dist/workspace/pr-report.schema.json +94 -3
  207. package/dist/workspace/reason-codes.d.ts +1 -1
  208. package/dist/workspace/reason-codes.d.ts.map +1 -1
  209. package/dist/workspace/reason-codes.js +1 -1
  210. package/dist/workspace/security.d.ts.map +1 -1
  211. package/dist/workspace/security.js +4 -0
  212. package/dist/workspace/status-gates.d.ts +3 -2
  213. package/dist/workspace/status-gates.d.ts.map +1 -1
  214. package/dist/workspace/status-gates.js +8 -7
  215. package/dist/workspace/status.d.ts.map +1 -1
  216. package/dist/workspace/status.js +4 -1
  217. package/dist/workspace/trust/seal.d.ts +2 -2
  218. package/dist/workspace/trust/seal.d.ts.map +1 -1
  219. package/dist/workspace/trust/seal.js +2 -2
  220. package/package.json +1 -1
  221. package/src/__fixtures__/oidc-emulator.ts +118 -0
  222. package/src/ci-handover.test.ts +209 -0
  223. package/src/ci-handover.ts +237 -0
  224. package/src/ci-identity.test.ts +201 -0
  225. package/src/ci-identity.ts +310 -0
  226. package/src/cli/handlers/approve.ts +18 -5
  227. package/src/cli/handlers/build.ts +18 -1
  228. package/src/cli/handlers/fan-out.ts +43 -6
  229. package/src/cli/handlers/gate-resume.ts +16 -2
  230. package/src/cli/handlers/lock.test.ts +98 -0
  231. package/src/cli/handlers/lock.ts +202 -0
  232. package/src/cli/handlers/operator.test.ts +3 -1
  233. package/src/cli/handlers/pr-before-merge.test.ts +276 -0
  234. package/src/cli/handlers/pr-env.ts +462 -0
  235. package/src/cli/handlers/pr-waves-blocked.test.ts +247 -0
  236. package/src/cli/handlers/pr.test.ts +184 -0
  237. package/src/cli/handlers/pr.ts +605 -61
  238. package/src/cli/handlers/promote.ts +9 -0
  239. package/src/cli/handlers/query.ts +78 -0
  240. package/src/cli/handlers/run.ts +10 -0
  241. package/src/cli/main.ts +49 -4
  242. package/src/cli/parse-args.ts +34 -2
  243. package/src/cli/registry.ts +31 -2
  244. package/src/components/capability-targets.test.ts +162 -0
  245. package/src/components/capability.ts +71 -0
  246. package/src/components/cli-support.ts +14 -1
  247. package/src/components/driver.ts +54 -3
  248. package/src/components/fan-out-run.ts +58 -3
  249. package/src/components/fan-out-waves.test.ts +45 -1
  250. package/src/components/gate-plan.ts +3 -0
  251. package/src/components/pr-environment.test.ts +249 -0
  252. package/src/components/pr-environment.ts +538 -0
  253. package/src/components/pr-hooks.test.ts +118 -0
  254. package/src/components/pr-hooks.ts +157 -0
  255. package/src/components/pr-pipeline.ts +194 -21
  256. package/src/components/pr-policy.test.ts +145 -0
  257. package/src/components/pr-policy.ts +211 -0
  258. package/src/components/pr-run.ts +14 -2
  259. package/src/components/wave-plan.ts +38 -3
  260. package/src/gate-decision-bundle.test.ts +4 -3
  261. package/src/gate-decision.ts +39 -2
  262. package/src/gate-policy-bundle.test.ts +28 -0
  263. package/src/gate-policy.test.ts +162 -0
  264. package/src/gate-policy.ts +298 -0
  265. package/src/lifecycle/gate-checkpoint.ts +1 -1
  266. package/src/{workspace/trust → lifecycle}/gate-seal.ts +1 -1
  267. package/src/lifecycle/query.test.ts +91 -0
  268. package/src/lifecycle/query.ts +315 -0
  269. package/src/lifecycle/run-ledger.ts +18 -0
  270. package/src/lifecycle/target-lock.test.ts +195 -0
  271. package/src/lifecycle/target-lock.ts +347 -0
  272. package/src/op/activities/activity-contracts.ts +31 -0
  273. package/src/op/activities/index.ts +6 -0
  274. package/src/op/activities/pr-refs.ts +28 -0
  275. package/src/op/activities/predict-behaviour.ts +3 -23
  276. package/src/op/activities/review-agent.test.ts +240 -0
  277. package/src/op/activities/review-agent.ts +355 -0
  278. package/src/op/builders.ts +13 -0
  279. package/src/op/cron.ts +44 -0
  280. package/src/op/gate-alias.test.ts +2 -2
  281. package/src/op/gate-approval.test.ts +30 -9
  282. package/src/op/gate-approval.ts +23 -26
  283. package/src/op/gate-quorum.test.ts +139 -0
  284. package/src/op/gate-quorum.ts +248 -0
  285. package/src/op/gate-resume.ts +6 -3
  286. package/src/op/gate-review.ts +1 -1
  287. package/src/op/gate.ts +64 -23
  288. package/src/op/index.ts +13 -1
  289. package/src/op/local-executor.ts +9 -2
  290. package/src/op/op-waves-hook-targets.test.ts +126 -0
  291. package/src/op/op-waves-policy-hold.test.ts +66 -0
  292. package/src/op/op-waves-quorum.test.ts +101 -0
  293. package/src/op/op-waves-run.ts +197 -183
  294. package/src/op/op-waves.ts +83 -10
  295. package/src/op/schedule-overdue.test.ts +220 -0
  296. package/src/op/schedule-overdue.ts +161 -0
  297. package/src/op/stage-hooks.ts +251 -0
  298. package/src/override-gate-bundle.test.ts +1 -1
  299. package/src/override-gate.ts +2 -2
  300. package/src/pr-forge-bundle.test.ts +2 -2
  301. package/src/pr-forge.test.ts +33 -0
  302. package/src/pr-forge.ts +347 -35
  303. package/src/pr-loop-bundle.test.ts +2 -2
  304. package/src/pr-loop.test.ts +58 -0
  305. package/src/pr-loop.ts +170 -4
  306. package/src/pr-post.test.ts +141 -0
  307. package/src/pr-post.ts +159 -0
  308. package/src/pr-requires.test.ts +184 -0
  309. package/src/pr-requires.ts +79 -0
  310. package/src/review-agent-bundle.test.ts +35 -0
  311. package/src/stage-hooks-bundle.test.ts +38 -0
  312. package/src/wave-blocked-bundle.test.ts +25 -0
  313. package/src/wave-blocked.test.ts +146 -0
  314. package/src/wave-blocked.ts +271 -0
  315. package/src/wave-engine.ts +8 -0
  316. package/src/workspace/__fixtures__/two-member-workspace.ts +2 -2
  317. package/src/workspace/checks/ci-workflow.test.ts +9 -0
  318. package/src/workspace/checks/ci-workflow.ts +18 -4
  319. package/src/workspace/ci-branches.test.ts +62 -0
  320. package/src/workspace/ci-branches.ts +79 -0
  321. package/src/workspace/ci-cloud-identity.test.ts +53 -0
  322. package/src/workspace/ci-cloud-identity.ts +23 -0
  323. package/src/workspace/ci-init.ts +5 -4
  324. package/src/workspace/ci-locks.ts +16 -0
  325. package/src/workspace/ci-run-index.test.ts +2 -1
  326. package/src/workspace/ci-run.test.ts +107 -8
  327. package/src/workspace/ci-run.ts +74 -5
  328. package/src/workspace/ci-workflow-at.ts +23 -0
  329. package/src/workspace/ci-workflow.ts +13 -2
  330. package/src/workspace/declaration.schema.json +149 -2
  331. package/src/workspace/declaration.test.ts +76 -0
  332. package/src/workspace/declaration.ts +140 -5
  333. package/src/workspace/identity-gate-rule.ts +1 -1
  334. package/src/workspace/identity.ts +1 -1
  335. package/src/workspace/lineage-upgrade.ts +11 -8
  336. package/src/workspace/member-pipeline.test.ts +29 -0
  337. package/src/workspace/member-pipeline.ts +30 -0
  338. package/src/workspace/pr-report.schema.json +94 -3
  339. package/src/workspace/reason-codes.ts +1 -1
  340. package/src/workspace/security.ts +4 -0
  341. package/src/workspace/status-gates.ts +9 -6
  342. package/src/workspace/status.ts +4 -1
  343. package/src/workspace/trust/gate-seal.test.ts +1 -1
  344. package/src/workspace/trust/seal.ts +2 -2
  345. package/dist/workspace/trust/gate-seal.d.ts.map +0 -1
  346. /package/dist/{workspace/trust → lifecycle}/gate-seal.js +0 -0
@@ -7,5 +7,6 @@
7
7
  export declare function twoMemberWorkspace(options?: {
8
8
  root?: boolean;
9
9
  prefix?: string;
10
+ extra?: Record<string, unknown>;
10
11
  }): string;
11
12
  //# sourceMappingURL=two-member-workspace.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"two-member-workspace.d.ts","sourceRoot":"","sources":["../../../src/workspace/__fixtures__/two-member-workspace.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,iGAAiG;AACjG,wBAAgB,kBAAkB,CAAC,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,MAAM,CAsB5F"}
1
+ {"version":3,"file":"two-member-workspace.d.ts","sourceRoot":"","sources":["../../../src/workspace/__fixtures__/two-member-workspace.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,iGAAiG;AACjG,wBAAgB,kBAAkB,CAAC,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAO,GAAG,MAAM,CAsB7H"}
@@ -20,7 +20,7 @@ export function twoMemberWorkspace(options = {}) {
20
20
  if (options.root)
21
21
  members.unshift({ name: "platform", dir: ".", kind: "chant" });
22
22
  const files = {
23
- "chant.workspace.json": JSON.stringify({ name: "shop", schema: 1, members }, null, 2),
23
+ "chant.workspace.json": JSON.stringify({ name: "shop", schema: 1, members, ...options.extra }, null, 2),
24
24
  "services/api/chant.config.ts": "export default {};\n",
25
25
  "services/api/src/infra.ts": "\n",
26
26
  "apps/web/chant.config.ts": "export default {};\n",
@@ -1 +1 @@
1
- {"version":3,"file":"ci-workflow.d.ts","sourceRoot":"","sources":["../../../src/workspace/checks/ci-workflow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAuB,MAAM,WAAW,CAAC;AAQrE,eAAO,MAAM,eAAe,WAAW,CAAC;AAaxC,eAAO,MAAM,kBAAkB,EAAE,SAAS,cAAc,EAmGvD,CAAC"}
1
+ {"version":3,"file":"ci-workflow.d.ts","sourceRoot":"","sources":["../../../src/workspace/checks/ci-workflow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAuB,MAAM,WAAW,CAAC;AAQrE,eAAO,MAAM,eAAe,WAAW,CAAC;AAexC,eAAO,MAAM,kBAAkB,EAAE,SAAS,cAAc,EA+GvD,CAAC"}
@@ -11,7 +11,7 @@
11
11
  * WSP101 to WSP106's to report; this check asks only whether the jobs the
12
12
  * workflow needs are there.
13
13
  */
14
- import { appliesOnMerge, STUB_MARKER, workflowOf } from "../ci-workflow.js";
14
+ import { appliesBeforeMerge, appliesOnMerge, STUB_MARKER, workflowOf } from "../ci-workflow.js";
15
15
  import { matchesCheckRun } from "../ci-green.js";
16
16
  import { staticPromotionOrder } from "../promotion-order.js";
17
17
  import { joinPath } from "../tree.js";
@@ -21,6 +21,8 @@ const memberDir = (dir) => (dir === "." ? "" : dir);
21
21
  const PLAN = /\bci\s+run\s+plan\b|\bcomponents\s+pr-plan\b/;
22
22
  const RECORD = /\bci\s+run\s+record\b|\bcomponents\s+pr-record\b/;
23
23
  const APPLY = /\bci\s+run\s+apply\b|\bcomponents\s+pr-apply\b/;
24
+ /** An apply before merge (#4301): `pr-apply --before-merge`, or `ci run apply --apply-before-merge`. */
25
+ const BEFORE_MERGE = /--(?:apply-)?before-merge\b/;
24
26
  const TICK = /\bci\s+tick\b/;
25
27
  const PUBLISH = /\brelease\s+publish\b/;
26
28
  /** The apply job names a required phase could match. */
@@ -106,18 +108,31 @@ export const CI_WORKFLOW_CHECKS = [
106
108
  if (missing.length > 0) {
107
109
  finding("ci-workflow-pipeline-missing", `no pipeline file runs ${missing.join(", ")}; generate them with chant build --components --generate <forge> --pr-loop and chant ci workflow`);
108
110
  }
111
+ // #4301: an apply before merge is its own job, allowed only under apply-before-merge.
112
+ const beforeMerge = under.some((u) => appliesBeforeMerge(u.workflow)) || appliesBeforeMerge(d.ci?.workflow ?? null);
113
+ const earlyLines = commandLines(ctx, APPLY).filter((c) => BEFORE_MERGE.test(c.text));
114
+ if (!beforeMerge) {
115
+ for (const l of earlyLines) {
116
+ finding("ci-workflow-pipeline-differs", `${l.path} applies before merge, and no member's workflow is apply-before-merge; regenerate without --apply-before-merge, or set ci.workflow to apply-before-merge`, { treeFile: l.path, line: l.line });
117
+ }
118
+ }
119
+ else if (earlyLines.length === 0 && has(PLAN)) {
120
+ const l = commandLines(ctx, PLAN)[0];
121
+ finding("ci-workflow-pipeline-differs", `${l.path} has no job that applies before merge, and the workflow is apply-before-merge; regenerate with --apply-before-merge`, { treeFile: l.path, line: l.line });
122
+ }
123
+ const mergeApply = (l) => !BEFORE_MERGE.test(l.text);
109
124
  if (!applyOnMerge) {
110
- for (const l of commandLines(ctx, APPLY)) {
125
+ for (const l of commandLines(ctx, APPLY).filter(mergeApply)) {
111
126
  finding("ci-workflow-pipeline-differs", `${l.path} applies on merge, and the workflow is trunk-curated, where a merge records the plan and deploys nothing; regenerate without --apply-on-merge, or set ci.workflow to trunk-curated+apply-on-merge`, { treeFile: l.path, line: l.line });
112
127
  }
113
128
  }
114
- else if (!has(APPLY) && has(RECORD)) {
129
+ else if (!commandLines(ctx, APPLY).some(mergeApply) && has(RECORD)) {
115
130
  const l = commandLines(ctx, RECORD)[0];
116
131
  finding("ci-workflow-pipeline-differs", `${l.path} records on merge, and the workflow is trunk-curated+apply-on-merge; regenerate with --apply-on-merge`, { treeFile: l.path, line: l.line });
117
132
  }
118
133
  else {
119
134
  // #4168 step 9: an apply measured from a push's base applies each merge; the workflow applies green commits.
120
- for (const l of commandLines(ctx, APPLY).filter((c) => /--base\b/.test(c.text) || (/\bcomponents\s+pr-apply\b/.test(c.text) && !/--green\b/.test(c.text)))) {
135
+ for (const l of commandLines(ctx, APPLY).filter(mergeApply).filter((c) => /--base\b/.test(c.text) || (/\bcomponents\s+pr-apply\b/.test(c.text) && !/--green\b/.test(c.text)))) {
121
136
  finding("ci-workflow-pipeline-differs", `${l.path} applies each merge, and under trunk-curated+apply-on-merge the apply applies the newest green commit; regenerate with --apply-on-merge`, { treeFile: l.path, line: l.line });
122
137
  }
123
138
  }
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Branch routing and label filters for the pull-request loop (#4292).
3
+ *
4
+ * `ci.branches` maps a branch to member-name globs. A member a glob matches
5
+ * applies from that branch: its generated pull-request pipeline targets it,
6
+ * and its record or apply job does nothing on a push to any other branch. A
7
+ * member no glob matches applies from every branch but those, the default
8
+ * branch included. terragucci's `apply.branches` (`branchLayers`) works the
9
+ * same way over Terraform roots.
10
+ *
11
+ * `ci.labels` maps a pull request label to member-name globs. When a pull
12
+ * request carries one of the labels, its plan job plans only the members
13
+ * those labels' globs match, and every other member's plan job plans
14
+ * nothing. A label never gates: the record and apply jobs on the push never
15
+ * read labels, and an apply still waits for an approval of the digest it
16
+ * plans. Anyone with triage access can set a label, so a label may narrow
17
+ * what a reviewer sees ahead of the merge and no more.
18
+ */
19
+ /** Branch or label name to member-name globs. */
20
+ export type MemberGlobs = Readonly<Record<string, readonly string[]>>;
21
+ /** The keys of `map` whose globs match `member`, in declaration order. */
22
+ export declare function keysMatching(map: MemberGlobs | undefined, member: string): string[];
23
+ /** The branch `ci.branches` routes `member` to, or null when no glob matches it. */
24
+ export declare function routedBranch(branches: MemberGlobs | undefined, member: string): string | null;
25
+ /** Each member that two branches' globs match, with the branches. The declaration refuses these. */
26
+ export declare function routeConflicts(branches: MemberGlobs | undefined, members: readonly string[]): Array<{
27
+ member: string;
28
+ branches: string[];
29
+ }>;
30
+ /**
31
+ * Whether a push to `pushed` applies `member`, with a line that says why.
32
+ * A routed member applies only from its branch. Any other member applies
33
+ * from every branch `ci.branches` does not name.
34
+ */
35
+ export declare function appliesFrom(branches: MemberGlobs | undefined, member: string, pushed: string): {
36
+ applies: boolean;
37
+ note: string;
38
+ };
39
+ /**
40
+ * Whether a pull request's plan job plans `member`, given the labels the pull
41
+ * request carries. With none of `ci.labels` on the pull request every member
42
+ * plans. With some, a member plans only when one of those labels' globs
43
+ * matches it.
44
+ */
45
+ export declare function plansUnderLabels(labels: MemberGlobs | undefined, member: string, carried: readonly string[]): {
46
+ plans: boolean;
47
+ note?: string;
48
+ };
49
+ /** The branch the job runs on, from the forge's own variables: GitHub and Forgejo's GITHUB_REF_NAME, GitLab's CI_COMMIT_BRANCH. */
50
+ export declare function pushedBranchFromEnv(env?: Record<string, string | undefined>): string | undefined;
51
+ //# sourceMappingURL=ci-branches.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ci-branches.d.ts","sourceRoot":"","sources":["../../src/workspace/ci-branches.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAKH,iDAAiD;AACjD,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CAAC;AAItE,0EAA0E;AAC1E,wBAAgB,YAAY,CAAC,GAAG,EAAE,WAAW,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAEnF;AAED,oFAAoF;AACpF,wBAAgB,YAAY,CAAC,QAAQ,EAAE,WAAW,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAE7F;AAED,oGAAoG;AACpG,wBAAgB,cAAc,CAAC,QAAQ,EAAE,WAAW,GAAG,SAAS,EAAE,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,KAAK,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAE3I;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,WAAW,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAWjI;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAO/I;AAED,mIAAmI;AACnI,wBAAgB,mBAAmB,CAAC,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,GAAG,MAAM,GAAG,SAAS,CAE7G"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Branch routing and label filters for the pull-request loop (#4292).
3
+ *
4
+ * `ci.branches` maps a branch to member-name globs. A member a glob matches
5
+ * applies from that branch: its generated pull-request pipeline targets it,
6
+ * and its record or apply job does nothing on a push to any other branch. A
7
+ * member no glob matches applies from every branch but those, the default
8
+ * branch included. terragucci's `apply.branches` (`branchLayers`) works the
9
+ * same way over Terraform roots.
10
+ *
11
+ * `ci.labels` maps a pull request label to member-name globs. When a pull
12
+ * request carries one of the labels, its plan job plans only the members
13
+ * those labels' globs match, and every other member's plan job plans
14
+ * nothing. A label never gates: the record and apply jobs on the push never
15
+ * read labels, and an apply still waits for an approval of the digest it
16
+ * plans. Anyone with triage access can set a label, so a label may narrow
17
+ * what a reviewer sees ahead of the merge and no more.
18
+ */
19
+ // @ts-ignore: picomatch has no types declaration
20
+ import picomatch from "picomatch";
21
+ const matches = (globs, member) => globs.some((g) => picomatch(g)(member));
22
+ /** The keys of `map` whose globs match `member`, in declaration order. */
23
+ export function keysMatching(map, member) {
24
+ return Object.keys(map ?? {}).filter((k) => matches(map[k], member));
25
+ }
26
+ /** The branch `ci.branches` routes `member` to, or null when no glob matches it. */
27
+ export function routedBranch(branches, member) {
28
+ return keysMatching(branches, member)[0] ?? null;
29
+ }
30
+ /** Each member that two branches' globs match, with the branches. The declaration refuses these. */
31
+ export function routeConflicts(branches, members) {
32
+ return members.map((member) => ({ member, branches: keysMatching(branches, member) })).filter((c) => c.branches.length > 1);
33
+ }
34
+ /**
35
+ * Whether a push to `pushed` applies `member`, with a line that says why.
36
+ * A routed member applies only from its branch. Any other member applies
37
+ * from every branch `ci.branches` does not name.
38
+ */
39
+ export function appliesFrom(branches, member, pushed) {
40
+ const own = routedBranch(branches, member);
41
+ if (own !== null) {
42
+ return own === pushed
43
+ ? { applies: true, note: `ci.branches: ${pushed} applies member ${member}` }
44
+ : { applies: false, note: `ci.branches: member ${member} applies from ${own}, not ${pushed}` };
45
+ }
46
+ if (Object.prototype.hasOwnProperty.call(branches ?? {}, pushed)) {
47
+ return { applies: false, note: `ci.branches: ${pushed} applies only the members its globs match, and member ${member} is not one` };
48
+ }
49
+ return { applies: true, note: `ci.branches: member ${member} is routed to no branch, so ${pushed} applies it` };
50
+ }
51
+ /**
52
+ * Whether a pull request's plan job plans `member`, given the labels the pull
53
+ * request carries. With none of `ci.labels` on the pull request every member
54
+ * plans. With some, a member plans only when one of those labels' globs
55
+ * matches it.
56
+ */
57
+ export function plansUnderLabels(labels, member, carried) {
58
+ const set = carried.filter((l) => Object.prototype.hasOwnProperty.call(labels ?? {}, l));
59
+ if (set.length === 0)
60
+ return { plans: true };
61
+ const by = set.filter((l) => matches(labels[l], member));
62
+ return by.length > 0
63
+ ? { plans: true, note: `ci.labels: ${by.join(", ")} plan${by.length === 1 ? "s" : ""} member ${member}` }
64
+ : { plans: false, note: `ci.labels: the pull request's labels ${set.join(", ")} plan other members, so member ${member} is not planned here; its record and apply on merge still plan it` };
65
+ }
66
+ /** The branch the job runs on, from the forge's own variables: GitHub and Forgejo's GITHUB_REF_NAME, GitLab's CI_COMMIT_BRANCH. */
67
+ export function pushedBranchFromEnv(env = process.env) {
68
+ return env.CI_COMMIT_BRANCH || (env.GITHUB_REF_TYPE === undefined || env.GITHUB_REF_TYPE === "branch" ? env.GITHUB_REF_NAME : undefined) || undefined;
69
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The cloud identities a generated pull-request pipeline takes (#4296): the
3
+ * workspace declaration's `ci.identity.cloud`, resolved for the pipeline's
4
+ * environment and member (../ci-identity.ts). Read from the working tree of
5
+ * the workspace that holds `cwd`, as `ci.reportUrl` is (./ci-report-url.ts).
6
+ * A directory outside a workspace reads nothing.
7
+ */
8
+ import { type PipelineCloudIdentity } from "../ci-identity.js";
9
+ /** The plan and apply identities of the pipeline for `env` and `member`, or undefined. */
10
+ export declare function declaredCloudIdentity(cwd: string, env: string, member?: string): Promise<PipelineCloudIdentity | undefined>;
11
+ //# sourceMappingURL=ci-cloud-identity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ci-cloud-identity.d.ts","sourceRoot":"","sources":["../../src/workspace/ci-cloud-identity.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAwB,KAAK,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAElF,0FAA0F;AAC1F,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAUjI"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * The cloud identities a generated pull-request pipeline takes (#4296): the
3
+ * workspace declaration's `ci.identity.cloud`, resolved for the pipeline's
4
+ * environment and member (../ci-identity.ts). Read from the working tree of
5
+ * the workspace that holds `cwd`, as `ci.reportUrl` is (./ci-report-url.ts).
6
+ * A directory outside a workspace reads nothing.
7
+ */
8
+ import { findWorkspaceRoot } from "../project-root.js";
9
+ import { resolveCloudIdentity } from "../ci-identity.js";
10
+ /** The plan and apply identities of the pipeline for `env` and `member`, or undefined. */
11
+ export async function declaredCloudIdentity(cwd, env, member) {
12
+ const found = findWorkspaceRoot(cwd);
13
+ if (!found)
14
+ return undefined;
15
+ const [{ readDeclaration, WorkspaceReadError }, { workingTree }] = await Promise.all([import("./declaration.js"), import("./tree.js")]);
16
+ try {
17
+ return resolveCloudIdentity(readDeclaration(workingTree(found.dir)).ci?.identity?.cloud, env, member);
18
+ }
19
+ catch (err) {
20
+ if (!(err instanceof WorkspaceReadError))
21
+ throw err;
22
+ throw Object.assign(new Error(`${err.describe()} [${err.code}]`), { code: err.code });
23
+ }
24
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"ci-init.d.ts","sourceRoot":"","sources":["../../src/workspace/ci-init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAItD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAgB,WAAW,EAAkB,MAAM,eAAe,CAAC;AAE1E,OAAO,EAAE,WAAW,EAAE,CAAC;AAGvB,OAAO,EAAyD,KAAK,UAAU,EAAoB,MAAM,eAAe,CAAC;AAEzH,OAAO,EAAmB,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAEjE,OAAO,EAA2B,KAAK,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAKxF,oDAAoD;AACpD,eAAO,MAAM,oBAAoB,YAAI,SAAS,EAAE,MAAM,CAAU,CAAC;AAEjE,mEAAmE;AACnE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,gGAAgG;AAChG,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,8EAA8E;IAC9E,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,gDAAgD;IAChD,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AM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAmCnF;AAED,6GAA6G;AAC7G,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,GAAG,MAAM,EAAE,CAO5E;AAoBD,wBAAsB,SAAS,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CA2EpE"}
@@ -34,7 +34,7 @@ import { basename, join } from "node:path";
34
34
  import { formatError, formatSuccess } from "../cli/format.js";
35
35
  import { parseYAMLDocument } from "../yaml.js";
36
36
  import { CI_WORKFLOW_CHECKS } from "./checks/ci-workflow.js";
37
- import { CI_WORKFLOWS, STUB_MARKER, appliesOnMerge } from "./ci-workflow.js";
37
+ import { CI_WORKFLOWS, STUB_MARKER, appliesBeforeMerge, appliesOnMerge } from "./ci-workflow.js";
38
38
  export { STUB_MARKER };
39
39
  import { CI_GREEN_WORKFLOW_FILE, jobCheckRuns, readWorkflowSources, workflowsHolding } from "./ci-green-workflow.js";
40
40
  import { findWorkspaceRoot } from "../project-root.js";
@@ -43,7 +43,7 @@ import { staticPromotionOrder } from "./promotion-order.js";
43
43
  import { SECURITY_GROUPS } from "./security.js";
44
44
  import { gitTop, workingTree } from "./tree.js";
45
45
  import { RELEASE_WORKFLOW_FORGES } from "./release-workflow.js";
46
- const USAGE = "chant ci init --workflow trunk-curated|trunk-curated+apply-on-merge [--forge github|gitlab|forgejo] [--security <group>]... [--yes]";
46
+ const USAGE = "chant ci init --workflow trunk-curated|trunk-curated+apply-on-merge|apply-before-merge [--forge github|gitlab|forgejo] [--security <group>]... [--yes]";
47
47
  /** The environments a config with none is given. */
48
48
  export const DEFAULT_ENVIRONMENTS = ["staging", "prod"];
49
49
  const memberDir = (dir) => (dir === "." ? "" : dir);
@@ -253,11 +253,12 @@ export function proposeCiInit(root, options) {
253
253
  if (reported("ci-workflow-pipeline-missing") || reported("ci-workflow-pipeline-differs")) {
254
254
  for (const m of releasing) {
255
255
  const env = firstEnv.get(m.name);
256
+ const workflow = m.ciWorkflow ?? proposed.ci.workflow;
256
257
  commands.push({
257
258
  cwd: memberDir(m.dir) || ".",
258
259
  // The root member builds alone: at a workspace root, chant build refuses without --root-only (WSP000).
259
- args: ["build", "--components", "--generate", forge, "--pr-loop", ...(m.dir === "." ? ["--root-only"] : []), ...(env ? ["--env", env] : []), ...(appliesOnMerge(m.ciWorkflow ?? proposed.ci.workflow) ? ["--apply-on-merge"] : [])],
260
- why: `the pull-request pipeline for ${m.name}: plan on a pull request, ${appliesOnMerge(m.ciWorkflow ?? proposed.ci.workflow) ? "apply" : "record"} on merge`,
260
+ args: ["build", "--components", "--generate", forge, "--pr-loop", ...(m.dir === "." ? ["--root-only"] : []), ...(env ? ["--env", env] : []), ...(appliesOnMerge(workflow) ? ["--apply-on-merge"] : []), ...(appliesBeforeMerge(workflow) ? ["--apply-before-merge"] : [])],
261
+ why: `the pull-request pipeline for ${m.name}: plan on a pull request, ${appliesBeforeMerge(workflow) ? "apply on request before merge, record" : appliesOnMerge(workflow) ? "apply" : "record"} on merge`,
261
262
  });
262
263
  }
263
264
  if (forge === "github") {
@@ -0,0 +1,12 @@
1
+ /**
2
+ * `ci.locks` (#4293): when a pull request takes its target locks
3
+ * (../lifecycle/target-lock.ts). Read from the declaration at base, the
4
+ * target branch's tip, as the security groups are (./security.ts), so a
5
+ * pull request cannot turn its own locks off. Null outside a workspace and
6
+ * when the declaration sets none.
7
+ */
8
+ import type { CiLocks } from "./declaration.js";
9
+ export declare const CI_LOCKS: readonly ["apply", "plan"];
10
+ /** The `ci.locks` of the workspace holding `cwd`, read at `at` when given, else at base, else from the working tree. */
11
+ export declare function ciLocksAt(cwd: string, at?: string): CiLocks | null;
12
+ //# sourceMappingURL=ci-locks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ci-locks.d.ts","sourceRoot":"","sources":["../../src/workspace/ci-locks.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAG7C,eAAO,MAAM,QAAQ,4BAA0D,CAAC;AAEhF,wHAAwH;AACxH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAElE"}
@@ -0,0 +1,6 @@
1
+ import { scopeSource } from "./write-scope.js";
2
+ export const CI_LOCKS = ["apply", "plan"];
3
+ /** The `ci.locks` of the workspace holding `cwd`, read at `at` when given, else at base, else from the working tree. */
4
+ export function ciLocksAt(cwd, at) {
5
+ return scopeSource(cwd, at).declaration?.ci?.locks ?? null;
6
+ }
@@ -45,6 +45,16 @@
45
45
  * commit: `pending` when it starts, `success` or `failure` when it settles.
46
46
  * A status the forge refuses is a warning and never fails the job.
47
47
  *
48
+ * The plan runs the pull request's code, so no step of the plan job gets a
49
+ * forge token (#4295, ../ci-handover.ts): every name in `FORGE_TOKEN_VARS`
50
+ * is left out of its steps' environment, from the runner, a secret or the
51
+ * forge job alike, and `pr-plan` runs with `--no-status`. Once the steps
52
+ * settle, the runner posts the note and the `chant/plan` status from the
53
+ * report with its own token (`postPlanReport`, ../pr-post.ts). In place, a
54
+ * generated job holds no token and its `plan-note` job posts; a job that
55
+ * still holds one was generated before #4295, and the runner posts for it
56
+ * with a warning to regenerate.
57
+ *
48
58
  * Signing is opt-in (#4156). With no runner key the record is unsigned, and
49
59
  * a reader counts it with no signer. A key `.chant/trust.json` does not list
50
60
  * leaves it unsigned with a note `--verbose` prints, unless the declaration
@@ -70,7 +80,7 @@
70
80
  * a CI one does.
71
81
  */
72
82
  import { type PrLoopJob, type PrLoopPipelineOptions } from "../components/pr-pipeline.js";
73
- import { type CommitStatus, type ForgeKind } from "../pr-forge.js";
83
+ import { type CommitStatus, type ForgeKind, type PrForge } from "../pr-forge.js";
74
84
  import type { CommandContext } from "../cli/registry.js";
75
85
  import { type RunOrigin } from "../lifecycle/release-ledger.js";
76
86
  import { type OpRunResult, type StepRecord } from "../op/local-executor.js";
@@ -270,6 +280,12 @@ export interface CiRunRequest {
270
280
  secrets?: CiSecrets;
271
281
  /** `--output`: where the job's report is copied, from `cwd`. Default `.chant/pr`. */
272
282
  output?: string;
283
+ /**
284
+ * The forge client that posts the plan's note and `chant/plan` status from
285
+ * its report once the steps settle (#4295). Default: one built from the
286
+ * runner's environment when it holds a forge token.
287
+ */
288
+ planForge?: PrForge;
273
289
  /** `--run-index-limit`: how many runs the index at `loop.reportUrl` keeps (#4098). Default 200. */
274
290
  runIndexLimit?: number;
275
291
  /** A runner key, PEM, that signs the run's record. */
@@ -1 +1 @@
1
- {"version":3,"file":"ci-run.d.ts","sourceRoot":"","sources":["../../src/workspace/ci-run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsEG;AAMH,OAAO,EAA+E,KAAK,SAAS,EAAE,KAAK,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AACpK,OAAO,EAAiE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAE/H,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,EAA4E,KAAK,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAKvI,OAAO,EAA8B,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACrG,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,KAAK,EAAgB,QAAQ,EAAmB,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAc,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAMvD,OAAO,EAA2D,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AASvG,mGAAmG;AACnG,MAAM,MAAM,SAAS,GAAG,SAAS,C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45,6 +45,16 @@
45
45
  * commit: `pending` when it starts, `success` or `failure` when it settles.
46
46
  * A status the forge refuses is a warning and never fails the job.
47
47
  *
48
+ * The plan runs the pull request's code, so no step of the plan job gets a
49
+ * forge token (#4295, ../ci-handover.ts): every name in `FORGE_TOKEN_VARS`
50
+ * is left out of its steps' environment, from the runner, a secret or the
51
+ * forge job alike, and `pr-plan` runs with `--no-status`. Once the steps
52
+ * settle, the runner posts the note and the `chant/plan` status from the
53
+ * report with its own token (`postPlanReport`, ../pr-post.ts). In place, a
54
+ * generated job holds no token and its `plan-note` job posts; a job that
55
+ * still holds one was generated before #4295, and the runner posts for it
56
+ * with a warning to regenerate.
57
+ *
48
58
  * Signing is opt-in (#4156). With no runner key the record is unsigned, and
49
59
  * a reader counts it with no signer. A key `.chant/trust.json` does not list
50
60
  * leaves it unsigned with a note `--verbose` prints, unless the declaration
@@ -75,6 +85,8 @@ import { tmpdir } from "node:os";
75
85
  import { dirname, join, relative, resolve, sep } from "node:path";
76
86
  import { PR_APPLY_RECORD, PR_LOOP_REPORT_DIR, prLoopJobs, prLoopSetup, PR_LOOP_IMAGE } from "../components/pr-pipeline.js";
77
87
  import { detectForge, ForgeEnvironmentError, forgeFromEnv, FORGE_KINDS } from "../pr-forge.js";
88
+ import { holdsForgeToken, withoutForgeTokens } from "../ci-handover.js";
89
+ import { postPlanReport } from "../pr-post.js";
78
90
  import { PR_APPLY_GATE } from "../pr-loop.js";
79
91
  import { formatError, formatWarning } from "../cli/format.js";
80
92
  import { CHANT_CI_RUN_FORGE_ENV, CHANT_CI_RUN_ID_ENV, FORGE_RUN_ENV, resolveCiJob } from "../lifecycle/release-ledger.js";
@@ -480,7 +492,8 @@ export async function ciRun(req) {
480
492
  const started = req.requireRunnerStart || isolated ? runnerStartFor(req, { top, commit, hostEnv }) : undefined;
481
493
  // A generated wave job's command, as prLoopWaveJobs writes it. #4161: a local job's command posts no status or note.
482
494
  const forgeCommand = req.noForge ? found.command.replace(` --forge ${req.forge}`, "") : found.command;
483
- const command = `${forgeCommand}${req.wave !== undefined ? ` --wave ${req.wave}` : ""}${req.local ? " --no-status" : ""}`;
495
+ const noStatus = req.local && !/ --no-status(?: |$)/.test(forgeCommand);
496
+ const command = `${forgeCommand}${req.wave !== undefined ? ` --wave ${req.wave}` : ""}${noStatus ? " --no-status" : ""}`;
484
497
  const job = { ...found, command, ...(req.wave !== undefined ? { wave: req.wave } : {}) };
485
498
  const own = ciJobEnv(job, {
486
499
  forge: req.forge,
@@ -491,14 +504,19 @@ export async function ciRun(req) {
491
504
  secrets: ciSecretsFor(req.secrets, req.job),
492
505
  });
493
506
  // #4156: in place, the forge job's environment is the job's, less the runner key.
494
- const jobEnv = req.inPlace ? { ...definedEnv(hostEnv), ...own } : own;
507
+ // #4295: the plan runs the pull request's code, so no step of it gets a forge token, whatever gave it one.
508
+ const merged = req.inPlace ? { ...definedEnv(hostEnv), ...own } : own;
509
+ const jobEnv = req.job === "plan" ? withoutForgeTokens(merged) : merged;
495
510
  delete jobEnv[RUNNER_KEY_ENV];
511
+ const poster = req.job === "plan" ? planPoster(req, hostEnv) : undefined;
496
512
  // #4096: the secrets and the job's secret-looking variables, redacted from everything the run writes and returns.
497
513
  // In place the forge's own variables come too; one whose value is short, such as a flag, is left out, so it can't blank common words.
498
514
  const redact = ciRedactor(req.inPlace ? { ...longValues(jobEnv), ...own } : jobEnv, req.secrets);
499
515
  try {
500
516
  const ran = await runCiJob(req, { cwd, top, commit, place, job, jobEnv, ...(redact ? { redact } : {}) });
501
- const result = started ? { ...ran, notes: [started, ...ran.notes] } : ran;
517
+ const posted = poster ? await postFromReport(req, poster, ran, { commit, ...(place.member ? { member: place.member } : {}) }) : [];
518
+ const withPosts = posted.length > 0 ? { ...ran, warnings: [...ran.warnings, ...posted] } : ran;
519
+ const result = started ? { ...withPosts, notes: [started, ...withPosts.notes] } : withPosts;
502
520
  return redact ? { ...result, warnings: result.warnings.map(redact), notes: result.notes.map(redact), ...(result.pushWarning ? { pushWarning: redact(result.pushWarning) } : {}) } : result;
503
521
  }
504
522
  catch (err) {
@@ -507,6 +525,49 @@ export async function ciRun(req) {
507
525
  throw err;
508
526
  }
509
527
  }
528
+ /**
529
+ * Who posts the plan's note and `chant/plan` status (#4295): the runner,
530
+ * from the report, once the plan's steps settled, with the forge token the
531
+ * steps never got. None on `--local`, for a plain git server (`noForge`), or
532
+ * without a token. In place, a token means the job was generated before the
533
+ * plan-note job existed: the runner still posts, and says to regenerate.
534
+ */
535
+ function planPoster(req, hostEnv) {
536
+ if (req.local || req.noForge || req.pr === undefined)
537
+ return undefined;
538
+ const warning = req.inPlace
539
+ ? "this plan job holds a forge token, which the pull request's code runs beside in the same job; regenerate the pipeline, whose plan-note job posts the note from a fresh job (#4295)"
540
+ : undefined;
541
+ if (req.planForge)
542
+ return { forge: req.planForge, ...(warning ? { warning } : {}) };
543
+ if (!holdsForgeToken(hostEnv))
544
+ return undefined;
545
+ try {
546
+ return { forge: forgeFromEnv(req.forge, hostEnv), ...(warning ? { warning } : {}) };
547
+ }
548
+ catch (err) {
549
+ return { error: `the plan's note and status will not be posted: ${message(err)}` };
550
+ }
551
+ }
552
+ /** Post the plan's note and status from the report the job wrote (#4295), and return the warnings. */
553
+ async function postFromReport(req, poster, ran, at) {
554
+ if ("error" in poster)
555
+ return [poster.error];
556
+ const warnings = poster.warning ? [poster.warning] : [];
557
+ const dir = ran.report ?? resolve(req.cwd, req.output ?? PR_LOOP_REPORT_DIR);
558
+ const posted = await postPlanReport({
559
+ forge: poster.forge,
560
+ dir,
561
+ pr: req.pr,
562
+ head: at.commit,
563
+ env: req.env,
564
+ ...(at.member ? { member: at.member } : {}),
565
+ result: ran.status === "ok" ? "success" : "failure",
566
+ });
567
+ if (posted.refused)
568
+ warnings.push(`the plan report was not posted: ${posted.refused}`);
569
+ return [...warnings, ...posted.warnings];
570
+ }
510
571
  /**
511
572
  * `--require-runner-start` (#4147): the runner-start statement for this
512
573
  * forge job, checked against `.chant/trust.json` at `--base` (the commit
@@ -784,11 +845,12 @@ export function ciLoopOptions(args) {
784
845
  ...(args.prBuildCommand ? { buildCommand: args.prBuildCommand } : {}),
785
846
  ...(args.waveGate ? { waveGate: args.waveGate } : {}),
786
847
  ...(args.requireReview === true ? { requireReview: true } : {}),
848
+ ...(args.applyBeforeMerge ? { applyBeforeMerge: true } : {}),
787
849
  };
788
850
  }
789
851
  const USAGE = "chant ci run plan|record|apply --env <env> --base <sha> [--pr <n>] [--commit <sha>] [--forge github|gitlab|forgejo] " +
790
852
  "[--gate <name>] [--wave-gate <name>] [--wave <k>] [--branch <name>] [--events-json] [--report-url <url>] [--run-index-limit <n>] [--image <image>] [--before-script <line>]... " +
791
- "[--pr-build] [--pr-build-command <line>] [--require-review] [--no-status] [--status-url <url template>] " +
853
+ "[--pr-build] [--pr-build-command <line>] [--require-review] [--apply-before-merge] [--no-status] [--status-url <url template>] " +
792
854
  "[--chant <command>] [--pass-env <NAME>]... [--secrets <file>] [--key <runner key.pem>] [-o <dir>] [--in-place | --local] [--no-push] [--verbose] | chant ci run --at <sha> | chant ci run --setup-key [--trust [--principal <name>]] [--state <dir>] [--branch <name>]";
793
855
  const ENV_NAME = /^[A-Za-z_][A-Za-z0-9_]*$/;
794
856
  /** The host's runner key in `--state`, or in ci serve's default state directory, when `--setup-key` made one there (#4099). */
@@ -0,0 +1,14 @@
1
+ /**
2
+ * `ci.workflow` read at base (#4301, ws-106), as `ci.locks` is
3
+ * (./ci-locks.ts): the target branch's tip, so a pull request that sets
4
+ * `apply-before-merge` in its own copy of the declaration gets nothing from it.
5
+ */
6
+ import type { CiWorkflow } from "./declaration.js";
7
+ /**
8
+ * The workflow the member holding `cwd` follows, or `member` when given:
9
+ * its own `ci.workflow`, else the top level's, read at `at` when given, else
10
+ * at base, else from the working tree. Null outside a workspace and when
11
+ * neither sets one.
12
+ */
13
+ export declare function ciWorkflowAt(cwd: string, at?: string, member?: string): CiWorkflow | null;
14
+ //# sourceMappingURL=ci-workflow-at.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ci-workflow-at.d.ts","sourceRoot":"","sources":["../../src/workspace/ci-workflow-at.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAKhD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAMzF"}
@@ -0,0 +1,17 @@
1
+ import { workflowOf } from "./ci-workflow.js";
2
+ import { memberAtCwd } from "./security.js";
3
+ import { scopeSource } from "./write-scope.js";
4
+ /**
5
+ * The workflow the member holding `cwd` follows, or `member` when given:
6
+ * its own `ci.workflow`, else the top level's, read at `at` when given, else
7
+ * at base, else from the working tree. Null outside a workspace and when
8
+ * neither sets one.
9
+ */
10
+ export function ciWorkflowAt(cwd, at, member) {
11
+ const source = scopeSource(cwd, at);
12
+ const d = source.declaration;
13
+ if (!d)
14
+ return null;
15
+ const name = member ?? memberAtCwd(source, cwd);
16
+ return workflowOf(d, d.members.find((m) => m.name === name) ?? null);
17
+ }
@@ -7,6 +7,8 @@
7
7
  * from a green commit and promoted through the member's environments, gated
8
8
  * in the last (4.2). `trunk-curated+apply-on-merge` is the same, and each
9
9
  * newest green commit is also applied (section 5, step 9).
10
+ * `apply-before-merge` (#4301, ws-106) is `trunk-curated`, and a person may
11
+ * also apply an open pull request's plan from its head before it merges.
10
12
  *
11
13
  * A workflow requires no security group: those are opt-in on their own
12
14
  * (./security.ts). `chant workspace check` reports what a member under a
@@ -17,9 +19,15 @@
17
19
  import type { CiWorkflow, Declaration, Member } from "./declaration.js";
18
20
  /** The marker a component stub `chant ci init` writes carries until someone fills it in. WSP151 reports a member whose only components carry it. */
19
21
  export declare const STUB_MARKER = "TODO(chant ci init)";
20
- export declare const CI_WORKFLOWS: readonly ["trunk-curated", "trunk-curated+apply-on-merge"];
22
+ export declare const CI_WORKFLOWS: readonly ["trunk-curated", "trunk-curated+apply-on-merge", "apply-before-merge"];
21
23
  /** Whether `workflow` turns the apply on merge back on. */
22
24
  export declare function appliesOnMerge(workflow: CiWorkflow): boolean;
25
+ /**
26
+ * Whether `workflow` lets an open pull request's plan apply from its head
27
+ * before it merges (#4301, ws-106). Only `apply-before-merge` does, so with
28
+ * no workflow or either trunk-curated one nothing applies before merge.
29
+ */
30
+ export declare function appliesBeforeMerge(workflow: CiWorkflow | null): boolean;
23
31
  /** The workflow `member` follows: its own `ci.workflow`, else the top level's, else null. */
24
32
  export declare function workflowOf(declaration: Pick<Declaration, "ci">, member: Pick<Member, "ciWorkflow"> | null): CiWorkflow | null;
25
33
  /** One requirement of the workflows, with the `workspace check` code that reports it missing. */
@@ -75,8 +83,8 @@ export declare const CI_WORKFLOW_REQUIREMENTS: readonly [{
75
83
  readonly perMember: false;
76
84
  }, {
77
85
  readonly code: "ci-workflow-pipeline-differs";
78
- readonly requirement: "the pipeline matches the workflow: no apply job under `trunk-curated`, and under `trunk-curated+apply-on-merge` an apply job that applies the newest green commit, not each merge";
79
- readonly fix: "regenerate the pull-request pipeline, with `--apply-on-merge` only under apply on merge";
86
+ readonly requirement: "the pipeline matches the workflow: no apply job under `trunk-curated`, and under `trunk-curated+apply-on-merge` an apply job that applies the newest green commit, not each merge; a job that applies before merge only, and always, under `apply-before-merge`";
87
+ readonly fix: "regenerate the pull-request pipeline, with `--apply-on-merge` only under apply on merge and `--apply-before-merge` only under apply before merge";
80
88
  readonly perMember: false;
81
89
  }, {
82
90
  readonly code: "ci-workflow-publish-missing";
@@ -1 +1 @@
1
- {"version":3,"file":"ci-workflow.d.ts","sourceRoot":"","sources":["../../src/workspace/ci-workflow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAErE,oJAAoJ;AACpJ,eAAO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