@intentius/chant 0.124.109 → 0.124.110

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 (338) hide show
  1. package/dist/__golden__/wave-loop/fan-out-applied.json +12 -6
  2. package/dist/__golden__/wave-loop/fan-out-apply-fails.json +8 -4
  3. package/dist/__golden__/wave-loop/fan-out-gated.json +4 -2
  4. package/dist/__golden__/wave-loop/fan-out-no-members.json +16 -8
  5. package/dist/__golden__/wave-loop/fan-out-plan-fails.json +8 -4
  6. package/dist/__golden__/wave-loop/fan-out-same-root.json +4 -2
  7. package/dist/agent-facts.d.ts +130 -0
  8. package/dist/agent-facts.js +196 -0
  9. package/dist/change-risk.d.ts +216 -0
  10. package/dist/change-risk.js +304 -0
  11. package/dist/change-set.d.ts +8 -0
  12. package/dist/ci-agent-alert.d.ts +139 -0
  13. package/dist/ci-agent-alert.js +342 -0
  14. package/dist/ci-agent-triggers.d.ts +152 -0
  15. package/dist/ci-agent-triggers.js +232 -0
  16. package/dist/ci-agent-verify-failed.d.ts +149 -0
  17. package/dist/ci-agent-verify-failed.js +191 -0
  18. package/dist/ci-agent.d.ts +136 -8
  19. package/dist/ci-agent.js +353 -26
  20. package/dist/ci-comment-commands.d.ts +8 -0
  21. package/dist/ci-comment-commands.js +17 -1
  22. package/dist/ci-comment-reject.d.ts +70 -0
  23. package/dist/ci-comment-reject.js +135 -0
  24. package/dist/ci-comment-replies.d.ts +3 -1
  25. package/dist/ci-comment-replies.js +6 -0
  26. package/dist/ci-estate/delivery.d.ts +25 -3
  27. package/dist/ci-estate/delivery.js +28 -9
  28. package/dist/ci-estate/page.d.ts +7 -3
  29. package/dist/ci-estate/page.js +19 -4
  30. package/dist/ci-estate/rows.d.ts +14 -2
  31. package/dist/ci-estate/rows.js +9 -1
  32. package/dist/ci-estate.d.ts +5 -2
  33. package/dist/ci-estate.js +3 -2
  34. package/dist/ci-handover.d.ts +2 -7
  35. package/dist/ci-handover.js +3 -20
  36. package/dist/ci-jobs.d.ts +6 -0
  37. package/dist/ci-jobs.js +17 -0
  38. package/dist/ci-note-commands.d.ts +2 -0
  39. package/dist/ci-note-commands.js +12 -1
  40. package/dist/ci-product-words.d.ts +151 -1
  41. package/dist/ci-product-words.js +1390 -3
  42. package/dist/ci-product.d.ts +100 -4
  43. package/dist/ci-product.js +99 -3
  44. package/dist/ci-respond-run.d.ts +9 -0
  45. package/dist/ci-respond-run.js +35 -4
  46. package/dist/ci-respond-summary-env.d.ts +56 -0
  47. package/dist/ci-respond-summary-env.js +81 -0
  48. package/dist/ci-respond-summary.d.ts +103 -0
  49. package/dist/ci-respond-summary.js +243 -0
  50. package/dist/ci-respond.d.ts +4 -2
  51. package/dist/ci-respond.js +4 -2
  52. package/dist/cli/command-group.js +1 -1
  53. package/dist/cli/commands/lint.js +21 -3
  54. package/dist/cli/handlers/agent.js +49 -4
  55. package/dist/cli/handlers/approve.js +3 -1
  56. package/dist/cli/handlers/build.d.ts +97 -1
  57. package/dist/cli/handlers/build.js +251 -3
  58. package/dist/cli/handlers/fan-out.js +55 -0
  59. package/dist/cli/handlers/graph.d.ts +14 -0
  60. package/dist/cli/handlers/graph.js +58 -3
  61. package/dist/cli/handlers/lifecycle-health.d.ts +7 -0
  62. package/dist/cli/handlers/lifecycle-health.js +47 -9
  63. package/dist/cli/handlers/lifecycle.js +4 -1
  64. package/dist/cli/handlers/notify-relay.d.ts +2 -2
  65. package/dist/cli/handlers/notify-relay.js +67 -7
  66. package/dist/cli/handlers/pipeline-agent.d.ts +30 -0
  67. package/dist/cli/handlers/pipeline-agent.js +255 -0
  68. package/dist/cli/handlers/pipeline-artifacts.d.ts +39 -0
  69. package/dist/cli/handlers/pipeline-artifacts.js +203 -0
  70. package/dist/cli/handlers/pipeline.d.ts +16 -0
  71. package/dist/cli/handlers/pipeline.js +112 -0
  72. package/dist/cli/handlers/pr-comment.js +4 -0
  73. package/dist/cli/handlers/pr-notes.js +4 -1
  74. package/dist/cli/handlers/pr.d.ts +20 -0
  75. package/dist/cli/handlers/pr.js +114 -11
  76. package/dist/cli/handlers/promote.js +792 -47
  77. package/dist/cli/handlers/reject.d.ts +84 -0
  78. package/dist/cli/handlers/reject.js +216 -0
  79. package/dist/cli/handlers/replan.d.ts +54 -0
  80. package/dist/cli/handlers/replan.js +177 -0
  81. package/dist/cli/handlers/run-generate.d.ts +5 -0
  82. package/dist/cli/handlers/run-generate.js +31 -4
  83. package/dist/cli/handlers/run-wave.js +15 -2
  84. package/dist/cli/handlers/run.js +4 -2
  85. package/dist/cli/handlers/stage.d.ts +35 -0
  86. package/dist/cli/handlers/stage.js +90 -0
  87. package/dist/cli/lsp/server.js +4 -0
  88. package/dist/cli/main.js +88 -8
  89. package/dist/cli/parse-args.js +35 -2
  90. package/dist/cli/registry.d.ts +12 -0
  91. package/dist/components/auto-release.d.ts +2 -0
  92. package/dist/components/auto-release.js +1 -0
  93. package/dist/components/capability.d.ts +40 -0
  94. package/dist/components/cli-support.d.ts +21 -1
  95. package/dist/components/cli-support.js +28 -6
  96. package/dist/components/component.d.ts +23 -4
  97. package/dist/components/component.schema.json +28 -0
  98. package/dist/components/declared-reads.d.ts +44 -4
  99. package/dist/components/declared-reads.js +80 -3
  100. package/dist/components/discover.d.ts +8 -0
  101. package/dist/components/discover.js +1 -1
  102. package/dist/components/driver.d.ts +13 -0
  103. package/dist/components/driver.js +23 -2
  104. package/dist/components/environment-sets.d.ts +229 -0
  105. package/dist/components/environment-sets.js +338 -0
  106. package/dist/components/fan-out-canary.d.ts +47 -0
  107. package/dist/components/fan-out-canary.js +58 -0
  108. package/dist/components/fan-out-run.d.ts +17 -0
  109. package/dist/components/fan-out-run.js +14 -1
  110. package/dist/components/fan-out-support.d.ts +7 -0
  111. package/dist/components/fan-out-support.js +1 -1
  112. package/dist/components/groups.d.ts +8 -1
  113. package/dist/components/groups.js +19 -1
  114. package/dist/components/index.d.ts +5 -2
  115. package/dist/components/index.js +4 -1
  116. package/dist/components/pr-cost.d.ts +28 -0
  117. package/dist/components/pr-cost.js +53 -0
  118. package/dist/components/pr-pipeline.d.ts +33 -0
  119. package/dist/components/pr-pipeline.js +32 -5
  120. package/dist/components/pr-policy.d.ts +33 -2
  121. package/dist/components/pr-policy.js +5 -2
  122. package/dist/components/pr-risk.d.ts +42 -0
  123. package/dist/components/pr-risk.js +74 -0
  124. package/dist/components/product-pipeline.d.ts +43 -0
  125. package/dist/components/product-pipeline.js +67 -1
  126. package/dist/components/promote.d.ts +6 -0
  127. package/dist/components/promote.js +13 -0
  128. package/dist/components/release-compile.js +3 -1
  129. package/dist/components/release-gate.d.ts +6 -1
  130. package/dist/components/release-gate.js +10 -2
  131. package/dist/components/step-environments.d.ts +236 -0
  132. package/dist/components/step-environments.js +392 -0
  133. package/dist/components/upstream-replan.d.ts +201 -0
  134. package/dist/components/upstream-replan.js +249 -0
  135. package/dist/components/verify-step.d.ts +30 -0
  136. package/dist/components/verify-step.js +27 -0
  137. package/dist/components/wave-plan.js +6 -2
  138. package/dist/config-environments.d.ts +4 -2
  139. package/dist/control/dispatch.d.ts +15 -0
  140. package/dist/control/dispatch.js +28 -4
  141. package/dist/cost-estimate.d.ts +188 -0
  142. package/dist/cost-estimate.js +363 -0
  143. package/dist/drift-record.d.ts +36 -0
  144. package/dist/drift-record.js +44 -0
  145. package/dist/engine-facts.d.ts +105 -0
  146. package/dist/engine-facts.js +111 -0
  147. package/dist/exit-codes.d.ts +4 -3
  148. package/dist/exit-codes.js +4 -3
  149. package/dist/flag-params.d.ts +2 -2
  150. package/dist/flag-params.js +9 -4
  151. package/dist/floor-table.data.js +53 -0
  152. package/dist/forge-token-vars.d.ts +12 -0
  153. package/dist/forge-token-vars.js +25 -0
  154. package/dist/gate-decision.d.ts +3 -1
  155. package/dist/gate-decision.js +3 -1
  156. package/dist/gated-waves.d.ts +2 -0
  157. package/dist/gated-waves.js +1 -0
  158. package/dist/graph-ir.d.ts +30 -0
  159. package/dist/graph-ir.js +33 -1
  160. package/dist/graph-refs.d.ts +26 -0
  161. package/dist/graph-refs.js +34 -3
  162. package/dist/graph-schema/graph.schema.json +136 -0
  163. package/dist/health.d.ts +65 -0
  164. package/dist/health.js +62 -0
  165. package/dist/lexicon.d.ts +188 -1
  166. package/dist/lifecycle/disruption.d.ts +14 -1
  167. package/dist/lifecycle/disruption.js +5 -1
  168. package/dist/lifecycle/gate-change-set.d.ts +8 -0
  169. package/dist/lifecycle/gate-change-set.js +2 -1
  170. package/dist/lifecycle/gate-ledger.d.ts +26 -0
  171. package/dist/lifecycle/gate-rejection.d.ts +82 -0
  172. package/dist/lifecycle/gate-rejection.js +93 -0
  173. package/dist/lifecycle/gate-seal.d.ts +3 -3
  174. package/dist/lifecycle/gate-seal.js +5 -5
  175. package/dist/lifecycle/observe.d.ts +17 -0
  176. package/dist/lifecycle/observe.js +10 -1
  177. package/dist/lifecycle/release-cut.js +4 -0
  178. package/dist/lifecycle/release-ledger.d.ts +8 -0
  179. package/dist/lifecycle/release-risk.d.ts +137 -0
  180. package/dist/lifecycle/release-risk.js +214 -0
  181. package/dist/lifecycle/release-store.d.ts +9 -0
  182. package/dist/lifecycle/release-store.js +4 -0
  183. package/dist/lifecycle/stage-log.d.ts +85 -0
  184. package/dist/lifecycle/stage-log.js +141 -0
  185. package/dist/lint/canary-checks.d.ts +31 -0
  186. package/dist/lint/canary-checks.js +45 -0
  187. package/dist/lint/rule.d.ts +1 -0
  188. package/dist/lint/rules/evl012-pipeline-fold.d.ts +14 -0
  189. package/dist/lint/rules/evl012-pipeline-fold.js +30 -0
  190. package/dist/lint/rules/index.d.ts +1 -0
  191. package/dist/lint/rules/index.js +3 -0
  192. package/dist/notify-relay-repo.d.ts +54 -0
  193. package/dist/notify-relay-repo.js +84 -0
  194. package/dist/notify-relay.d.ts +53 -3
  195. package/dist/notify-relay.js +96 -3
  196. package/dist/notify.d.ts +57 -1
  197. package/dist/notify.js +7 -1
  198. package/dist/notify.schema.json +61 -3
  199. package/dist/observation.d.ts +34 -0
  200. package/dist/observation.js +14 -1
  201. package/dist/op/activities/review-agent.d.ts +39 -2
  202. package/dist/op/activities/review-agent.js +88 -5
  203. package/dist/op/agent-permit.d.ts +88 -0
  204. package/dist/op/agent-permit.js +97 -0
  205. package/dist/op/gate-approval-base.d.ts +8 -0
  206. package/dist/op/gate-approval-base.js +9 -0
  207. package/dist/op/gate-approval.d.ts +30 -1
  208. package/dist/op/gate-approval.js +23 -2
  209. package/dist/op/gate-quorum.d.ts +114 -8
  210. package/dist/op/gate-quorum.js +198 -21
  211. package/dist/op/gate-reject.d.ts +79 -0
  212. package/dist/op/gate-reject.js +96 -0
  213. package/dist/op/gate-summary.js +1 -1
  214. package/dist/op/gate.d.ts +28 -3
  215. package/dist/op/gate.js +55 -13
  216. package/dist/op/generate-pipeline.d.ts +15 -1
  217. package/dist/op/generate-pipeline.js +32 -5
  218. package/dist/op/index.d.ts +11 -6
  219. package/dist/op/index.js +10 -5
  220. package/dist/op/local-executor.d.ts +2 -0
  221. package/dist/op/local-executor.js +23 -4
  222. package/dist/op/op-waves-after-plan.d.ts +23 -0
  223. package/dist/op/op-waves-after-plan.js +12 -1
  224. package/dist/op/op-waves-capability-spec.d.ts +14 -0
  225. package/dist/op/op-waves-capability-spec.js +46 -6
  226. package/dist/op/op-waves-capability.d.ts +21 -13
  227. package/dist/op/op-waves-capability.js +22 -59
  228. package/dist/op/op-waves-environment-sets.d.ts +41 -0
  229. package/dist/op/op-waves-environment-sets.js +82 -0
  230. package/dist/op/op-waves-quorum-warnings.d.ts +53 -0
  231. package/dist/op/op-waves-quorum-warnings.js +90 -0
  232. package/dist/op/op-waves-release-port.d.ts +7 -0
  233. package/dist/op/op-waves-release-port.js +15 -3
  234. package/dist/op/op-waves-release.d.ts +15 -0
  235. package/dist/op/op-waves-release.js +15 -0
  236. package/dist/op/op-waves-run.d.ts +37 -3
  237. package/dist/op/op-waves-run.js +141 -18
  238. package/dist/op/op-waves-soak.d.ts +57 -0
  239. package/dist/op/op-waves-soak.js +111 -0
  240. package/dist/op/op-waves-split.d.ts +4 -0
  241. package/dist/op/op-waves-split.js +4 -0
  242. package/dist/op/op-waves.d.ts +67 -4
  243. package/dist/op/op-waves.js +71 -3
  244. package/dist/pipeline/agent-ajv.d.ts +4 -0
  245. package/dist/pipeline/agent-ajv.js +14 -0
  246. package/dist/pipeline/agent-steps.d.ts +329 -0
  247. package/dist/pipeline/agent-steps.js +602 -0
  248. package/dist/pipeline/artifacts.d.ts +264 -0
  249. package/dist/pipeline/artifacts.js +425 -0
  250. package/dist/pipeline/diff.d.ts +45 -0
  251. package/dist/pipeline/diff.js +177 -0
  252. package/dist/pipeline/fold.d.ts +43 -0
  253. package/dist/pipeline/fold.js +140 -0
  254. package/dist/pipeline/generate.d.ts +52 -0
  255. package/dist/pipeline/generate.js +120 -0
  256. package/dist/pipeline/product.d.ts +225 -0
  257. package/dist/pipeline/product.js +257 -0
  258. package/dist/pipeline/promote.d.ts +404 -0
  259. package/dist/pipeline/promote.js +694 -0
  260. package/dist/pipeline/read.d.ts +37 -0
  261. package/dist/pipeline/read.js +58 -0
  262. package/dist/pipeline/rendered.d.ts +25 -0
  263. package/dist/pipeline/rendered.js +53 -0
  264. package/dist/pipeline/soak-checks.d.ts +80 -0
  265. package/dist/pipeline/soak-checks.js +254 -0
  266. package/dist/pipeline/soak-gate.d.ts +97 -0
  267. package/dist/pipeline/soak-gate.js +176 -0
  268. package/dist/pipeline/soak-sources.d.ts +17 -0
  269. package/dist/pipeline/soak-sources.js +42 -0
  270. package/dist/pipeline/soak.d.ts +260 -0
  271. package/dist/pipeline/soak.js +378 -0
  272. package/dist/pipeline/spec.d.ts +724 -0
  273. package/dist/pipeline/spec.js +567 -0
  274. package/dist/pipeline/stage-ledger.d.ts +187 -0
  275. package/dist/pipeline/stage-ledger.js +185 -0
  276. package/dist/pipeline/stage-waves.d.ts +114 -0
  277. package/dist/pipeline/stage-waves.js +161 -0
  278. package/dist/pipeline/stages.d.ts +64 -0
  279. package/dist/pipeline/stages.js +174 -0
  280. package/dist/pipeline/verify-rollback.d.ts +277 -0
  281. package/dist/pipeline/verify-rollback.js +393 -0
  282. package/dist/pipeline.d.ts +142 -0
  283. package/dist/pipeline.js +143 -0
  284. package/dist/pr-loop.d.ts +22 -0
  285. package/dist/pr-loop.js +8 -0
  286. package/dist/pr-plan-note.d.ts +15 -1
  287. package/dist/pr-plan-note.js +8 -0
  288. package/dist/pr-post.d.ts +31 -0
  289. package/dist/pr-post.js +89 -0
  290. package/dist/release-floors.d.ts +1 -1
  291. package/dist/release-floors.js +1 -1
  292. package/dist/report-store/audit.schema.json +50 -0
  293. package/dist/report-store/dora.schema.json +331 -0
  294. package/dist/report-store/estate.schema.json +96 -0
  295. package/dist/report-store/run.schema.json +14 -0
  296. package/dist/report-store.d.ts +151 -0
  297. package/dist/report-store.js +344 -0
  298. package/dist/run-event.d.ts +7 -2
  299. package/dist/wave-runtime.mjs +458 -404
  300. package/dist/workspace/catalog-edges.js +3 -3
  301. package/dist/workspace/change-set.schema.json +4 -0
  302. package/dist/workspace/ci-cloud-identity.d.ts +4 -0
  303. package/dist/workspace/ci-cloud-identity.js +30 -0
  304. package/dist/workspace/ci-run.js +17 -2
  305. package/dist/workspace/ci-secrets.d.ts +3 -1
  306. package/dist/workspace/ci-secrets.js +7 -1
  307. package/dist/workspace/compose-graph.d.ts +1 -1
  308. package/dist/workspace/compose-graph.js +3 -1
  309. package/dist/workspace/declaration.d.ts +27 -0
  310. package/dist/workspace/declaration.js +35 -0
  311. package/dist/workspace/declaration.schema.json +56 -0
  312. package/dist/workspace/graph-cli.js +26 -0
  313. package/dist/workspace/graph.schema.json +5 -1
  314. package/dist/workspace/identity-gate-rule.d.ts +4 -0
  315. package/dist/workspace/identity-gate-rule.js +2 -2
  316. package/dist/workspace/identity-reject-rule.d.ts +14 -0
  317. package/dist/workspace/identity-reject-rule.js +24 -0
  318. package/dist/workspace/identity.d.ts +3 -0
  319. package/dist/workspace/identity.js +2 -1
  320. package/dist/workspace/nested-graph.js +2 -0
  321. package/dist/workspace/pr-report.schema.json +65 -0
  322. package/dist/workspace/promotion-order.d.ts +19 -4
  323. package/dist/workspace/promotion-order.js +26 -4
  324. package/dist/workspace/release-train.d.ts +14 -0
  325. package/dist/workspace/release-train.js +32 -0
  326. package/dist/workspace/run-event.schema.json +2 -2
  327. package/dist/workspace/stack-read-edges.d.ts +19 -0
  328. package/dist/workspace/stack-read-edges.js +54 -0
  329. package/dist/workspace/status-gates.d.ts +51 -1
  330. package/dist/workspace/status-gates.js +60 -0
  331. package/dist/workspace/status-stages.d.ts +223 -0
  332. package/dist/workspace/status-stages.js +279 -0
  333. package/dist/workspace/status.d.ts +45 -1
  334. package/dist/workspace/status.js +109 -5
  335. package/dist/workspace/status.schema.json +283 -2
  336. package/dist/workspace/trust/seal.d.ts +7 -0
  337. package/dist/workspace/trust/seal.js +9 -0
  338. package/package.json +5 -1
@@ -35,7 +35,8 @@ import { getHeadCommit } from "../lifecycle/git.js";
35
35
  import { buildCapabilityRegistry } from "./capability-plugin-loader.js";
36
36
  import { componentSetFanOut, formRunGroups, planAndRunComponentGroup } from "./groups.js";
37
37
  import { applyConfigDefaults } from "./config-defaults.js";
38
- import { withDeclaredReads } from "./declared-reads.js";
38
+ import { componentForEnvironment } from "./step-environments.js";
39
+ import { graphReadsOf, withDeclaredReads } from "./declared-reads.js";
39
40
  import { loadChantConfig } from "../config.js";
40
41
  /** Discover components under `path` and shape them for `chant list --components`. */
41
42
  export async function listComponents(path, sandbox) {
@@ -82,7 +83,7 @@ export async function describeComponent(path, name, sandbox) {
82
83
  };
83
84
  }
84
85
  /** Compute the components' dependency graph under `path`, for `chant graph --components`. */
85
- export async function computeComponentGraph(path, sandbox, buildParams) {
86
+ export async function computeComponentGraph(path, sandbox, buildParams, options = {}) {
86
87
  // #1490 — without this the component graph is always the DEFAULT-parameter
87
88
  // graph. `discoverComponents` has honoured `buildParams` since #1108; every
88
89
  // caller simply stopped short of passing them, so `--param backups=omit`
@@ -128,7 +129,18 @@ export async function computeComponentGraph(path, sandbox, buildParams) {
128
129
  for (const dep of c.dependsOn ?? [])
129
130
  edges.push({ from: c.name, to: dep });
130
131
  }
131
- return { success: true, order, waves, edges, files, liveNames, composites, archetypes, environments };
132
+ let reads = [];
133
+ if (options.reads) {
134
+ try {
135
+ const registry = options.reads.registry ?? (await buildCapabilityRegistry(await registryOptions(path)));
136
+ const env = options.reads.env;
137
+ reads = await graphReadsOf(driverComponents, registry, path, env !== undefined ? { env } : undefined);
138
+ }
139
+ catch {
140
+ reads = [];
141
+ }
142
+ }
143
+ return { success: true, order, waves, edges, files, liveNames, composites, archetypes, environments, ...(reads.length > 0 ? { reads } : {}) };
132
144
  }
133
145
  catch (err) {
134
146
  if (err instanceof UnknownDependencyError || err instanceof DependencyCycleError) {
@@ -404,14 +416,19 @@ export async function runComponents(path, selector, options = {}) {
404
416
  // exporter. A single name runs on its own, against seeded outputs.
405
417
  let resolvedTargets;
406
418
  let added = resolved.added ?? [];
419
+ // #5360: each step's inputs for this environment, before the reads, the plan or the run read them.
420
+ const forEnv = (component) => componentForEnvironment(applyConfigDefaults(component, config), env).component;
407
421
  if (resolved.list) {
408
- const enabled = await withDeclaredReads(resolved.list.enabled.map((component) => applyConfigDefaults(component, config)), registry, path);
422
+ const enabled = await withDeclaredReads(resolved.list.enabled.map(forEnv), registry, path, { env });
409
423
  ({ targets: resolvedTargets, added } = dependencyClosure(resolved.list.named, enabled));
410
424
  }
411
425
  else {
412
- const defaulted = resolved.targets.map((component) => applyConfigDefaults(component, config));
413
- resolvedTargets = selector === "all" ? await withDeclaredReads(defaulted, registry, path) : defaulted;
426
+ const defaulted = resolved.targets.map(forEnv);
427
+ resolvedTargets = selector === "all" ? await withDeclaredReads(defaulted, registry, path, { env }) : defaulted;
414
428
  }
429
+ const unnamed = resolvedTargets.flatMap((component) => componentForEnvironment(component, env).refusals);
430
+ if (unnamed.length > 0)
431
+ return { success: false, selected: [], error: unnamed.map((r) => r.message).join("\n") };
415
432
  if (options.prepare) {
416
433
  const prepared = await options.prepare(resolvedTargets, { inputs: resolved.inputs ?? {} });
417
434
  if ("error" in prepared)
@@ -572,3 +589,8 @@ export async function runComponents(path, selector, options = {}) {
572
589
  throw err;
573
590
  }
574
591
  }
592
+ /** The options the project's own capability registry is built with. */
593
+ async function registryOptions(path) {
594
+ const { config } = await loadChantConfig(path);
595
+ return { plugins: config.capabilities, lexicons: lexiconNames(config.lexicons) };
596
+ }
@@ -72,6 +72,15 @@ export interface Step {
72
72
  revision?: Wiring;
73
73
  /** Named inputs passed into an apply step; each may be a literal or any wiring reference. */
74
74
  inputs?: Record<string, Wiring>;
75
+ /**
76
+ * The step's inputs per environment (#5360), keyed by environment name:
77
+ * for the run's environment, core merges that entry's keys over the
78
+ * step's own, one level deep, before the capability sees its input, such
79
+ * as `{ dev: { stack: "acme/shop/dev" }, prod: { stack: "acme/shop/prod" } }`
80
+ * on a `pulumi-up` step. An environment the map does not name is refused
81
+ * before anything runs. See ./step-environments.ts.
82
+ */
83
+ environments?: Record<string, Record<string, unknown>>;
75
84
  [param: string]: unknown;
76
85
  }
77
86
  /** Everything on a component gate step except the key that names it. */
@@ -81,6 +90,19 @@ export interface GateBase {
81
90
  timeout?: string;
82
91
  /** Human-readable description of the action required to unblock this gate. */
83
92
  description?: string;
93
+ /**
94
+ * The environments the gate applies in (#5401): a list of names, or a map
95
+ * whose entries may set `gate`, `description` and `timeout` there, such as
96
+ * `["staging", "prod"]`. In any other environment the run skips the gate
97
+ * and records the skip. Omitted, the gate applies in every environment.
98
+ * `chant build` refuses a name the member does not declare. See
99
+ * ./step-environments.ts.
100
+ */
101
+ environments?: string[] | Record<string, {
102
+ gate?: string;
103
+ description?: string;
104
+ timeout?: string;
105
+ }>;
84
106
  }
85
107
  /**
86
108
  * Mirrors `$defs.Gate` — a human approval decided against the gate ledger; the
@@ -242,10 +264,7 @@ export declare function phase(name: string, steps: Array<Step | Gate | Phase>, o
242
264
  parallel?: boolean;
243
265
  }): Phase;
244
266
  /** Author a gate step — a human approval the driver decides against the gate ledger, stopping the run `gated` when nothing has answered it. */
245
- export declare function gate(name: string, opts?: {
246
- timeout?: string;
247
- description?: string;
248
- }): Gate;
267
+ export declare function gate(name: string, opts?: Pick<GateBase, "timeout" | "description" | "environments">): Gate;
249
268
  /**
250
269
  * Author a cross-stack output reference — the TypeScript-side equivalent of
251
270
  * the JSON contract's `{ stackOutput: { stack, name } }` (schema
@@ -208,6 +208,15 @@
208
208
  "type": "object",
209
209
  "description": "Named inputs passed into an apply step, each of which may be a literal or any WiringValue reference — most commonly a stackOutput reference imported from another component's stack.",
210
210
  "additionalProperties": { "$ref": "#/$defs/WiringValue" }
211
+ },
212
+ "environments": {
213
+ "type": "object",
214
+ "description": "The step's inputs per environment, keyed by environment name. For the run's environment, that entry's keys replace the step's own, one level deep, before the capability sees its input. An environment the map does not name is refused before anything runs.",
215
+ "minProperties": 1,
216
+ "additionalProperties": {
217
+ "type": "object",
218
+ "propertyNames": { "not": { "enum": ["kind", "environments"] } }
219
+ }
211
220
  }
212
221
  }
213
222
  },
@@ -244,6 +253,25 @@
244
253
  "description": {
245
254
  "type": "string",
246
255
  "description": "Human-readable description of the action required to unblock this gate."
256
+ },
257
+ "environments": {
258
+ "description": "The environments the gate applies in: a list of names, or a map whose entries may set gate, description and timeout there. In any other environment the run skips the gate and records the skip. Omitted, the gate applies in every environment. chant build refuses a name the member does not declare.",
259
+ "oneOf": [
260
+ { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "type": "string", "minLength": 1 } },
261
+ {
262
+ "type": "object",
263
+ "minProperties": 1,
264
+ "additionalProperties": {
265
+ "type": "object",
266
+ "additionalProperties": false,
267
+ "properties": {
268
+ "gate": { "$ref": "#/$defs/GateName" },
269
+ "description": { "type": "string" },
270
+ "timeout": { "type": "string" }
271
+ }
272
+ }
273
+ }
274
+ ]
247
275
  }
248
276
  }
249
277
  },
@@ -12,8 +12,9 @@
12
12
  * upstream's plan cannot say the value, and a reader whose plan read another
13
13
  * value than the upstream applied is held for a round.
14
14
  */
15
- import type { CapabilityRegistry, DeclaredRead } from "./capability.js";
15
+ import type { CapabilityRegistry, DeclaredRead, GraphRead } from "./capability.js";
16
16
  import type { DriverComponent } from "./driver.js";
17
+ import { type StepEnvironmentOptions } from "./step-environments.js";
17
18
  /** A declared read with the kind of the step it names. */
18
19
  export type PlacedRead = DeclaredRead & {
19
20
  index: number;
@@ -25,7 +26,16 @@ export type PlacedRead = DeclaredRead & {
25
26
  * project, its own reads of itself left out. A capability that throws
26
27
  * reports none.
27
28
  */
28
- export declare function declaredReadsOf(components: readonly DriverComponent[], registry: CapabilityRegistry, root: string): Promise<PlacedRead[]>;
29
+ export declare function declaredReadsOf(components: readonly DriverComponent[], registry: CapabilityRegistry, root: string,
30
+ /**
31
+ * The run's environment (#5360): each step is read with its
32
+ * `environments` entry for it, so a stack or root that sits only in the
33
+ * map is the one the capability reads. A step that does not name it is
34
+ * read as declared.
35
+ */
36
+ environment?: {
37
+ env: string;
38
+ } & StepEnvironmentOptions): Promise<PlacedRead[]>;
29
39
  /**
30
40
  * `components` with each declared read written in (#4466): the reader's
31
41
  * step gets `{ stackOutput: { stack: upstream, name: output } }` at the
@@ -33,5 +43,35 @@ export declare function declaredReadsOf(components: readonly DriverComponent[],
33
43
  * on the upstream. Components no read names come back as they were.
34
44
  */
35
45
  export declare function applyDeclaredReads(components: readonly DriverComponent[], reads: readonly PlacedRead[]): DriverComponent[];
36
- /** {@link declaredReadsOf} and {@link applyDeclaredReads} in one: `components` with their declared reads written in. */
37
- export declare function withDeclaredReads(components: readonly DriverComponent[], registry: CapabilityRegistry, root: string): Promise<DriverComponent[]>;
46
+ /**
47
+ * {@link declaredReadsOf} and {@link applyDeclaredReads} in one: `components`
48
+ * with their declared reads written in. With `environment`, the components
49
+ * come back resolved for it (#5360), the reads written into the resolved steps.
50
+ */
51
+ export declare function withDeclaredReads(components: readonly DriverComponent[], registry: CapabilityRegistry, root: string, environment?: {
52
+ env: string;
53
+ } & StepEnvironmentOptions): Promise<DriverComponent[]>;
54
+ /**
55
+ * The first chant whose `chant graph --components` draws the reads a
56
+ * capability reports through `graphReads`: an edge from the reader to the
57
+ * component it reads, naming the output, and a node marked external for a
58
+ * stack no component deploys (#5331). It is also the first chant whose
59
+ * `chant workspace graph` asks a lexicon's `workspaceStackReads` and draws the
60
+ * reads between members.
61
+ */
62
+ export declare const GRAPH_READS_FLOOR = "0.124.110";
63
+ /** A graph read with the kind of the step it names. */
64
+ export type PlacedGraphRead = GraphRead & {
65
+ index: number;
66
+ kind: string;
67
+ };
68
+ /**
69
+ * Each capability's graph reads among `components` (#5331): the reads
70
+ * {@link declaredReadsOf} would place, and those naming a stack outside the
71
+ * project. A capability without `graphReads` reports its `declaredReads`
72
+ * as they are. The steps are read for `environment` as `declaredReadsOf`
73
+ * reads them. A capability that throws reports none.
74
+ */
75
+ export declare function graphReadsOf(components: readonly DriverComponent[], registry: CapabilityRegistry, root: string, environment?: {
76
+ env: string;
77
+ } & StepEnvironmentOptions): Promise<PlacedGraphRead[]>;
@@ -13,6 +13,7 @@
13
13
  * value than the upstream applied is held for a round.
14
14
  */
15
15
  import { capabilitySteps } from "./wave-plan.js";
16
+ import { componentForEnvironment } from "./step-environments.js";
16
17
  /** `pointer`'s segments, unescaped (RFC 6901). */
17
18
  function segments(pointer) {
18
19
  if (pointer === "")
@@ -53,7 +54,16 @@ function mapSteps(phases, replace) {
53
54
  * project, its own reads of itself left out. A capability that throws
54
55
  * reports none.
55
56
  */
56
- export async function declaredReadsOf(components, registry, root) {
57
+ export async function declaredReadsOf(components, registry, root,
58
+ /**
59
+ * The run's environment (#5360): each step is read with its
60
+ * `environments` entry for it, so a stack or root that sits only in the
61
+ * map is the one the capability reads. A step that does not name it is
62
+ * read as declared.
63
+ */
64
+ environment) {
65
+ if (environment)
66
+ components = components.map((c) => componentForEnvironment(c, environment.env, environment).component);
57
67
  const names = new Set(components.map((c) => c.name));
58
68
  const byKind = new Map();
59
69
  for (const component of components) {
@@ -124,8 +134,75 @@ export function applyDeclaredReads(components, reads) {
124
134
  return { ...component, dependsOn, deploy };
125
135
  });
126
136
  }
127
- /** {@link declaredReadsOf} and {@link applyDeclaredReads} in one: `components` with their declared reads written in. */
128
- export async function withDeclaredReads(components, registry, root) {
137
+ /**
138
+ * {@link declaredReadsOf} and {@link applyDeclaredReads} in one: `components`
139
+ * with their declared reads written in. With `environment`, the components
140
+ * come back resolved for it (#5360), the reads written into the resolved steps.
141
+ */
142
+ export async function withDeclaredReads(components, registry, root, environment) {
143
+ if (environment)
144
+ components = components.map((c) => componentForEnvironment(c, environment.env, environment).component);
129
145
  const reads = await declaredReadsOf(components, registry, root);
130
146
  return reads.length > 0 ? applyDeclaredReads(components, reads) : [...components];
131
147
  }
148
+ /**
149
+ * The first chant whose `chant graph --components` draws the reads a
150
+ * capability reports through `graphReads`: an edge from the reader to the
151
+ * component it reads, naming the output, and a node marked external for a
152
+ * stack no component deploys (#5331). It is also the first chant whose
153
+ * `chant workspace graph` asks a lexicon's `workspaceStackReads` and draws the
154
+ * reads between members.
155
+ */
156
+ export const GRAPH_READS_FLOOR = "0.124.110";
157
+ /**
158
+ * Each capability's graph reads among `components` (#5331): the reads
159
+ * {@link declaredReadsOf} would place, and those naming a stack outside the
160
+ * project. A capability without `graphReads` reports its `declaredReads`
161
+ * as they are. The steps are read for `environment` as `declaredReadsOf`
162
+ * reads them. A capability that throws reports none.
163
+ */
164
+ export async function graphReadsOf(components, registry, root, environment) {
165
+ if (environment)
166
+ components = components.map((c) => componentForEnvironment(c, environment.env, environment).component);
167
+ const names = new Set(components.map((c) => c.name));
168
+ const byKind = new Map();
169
+ for (const component of components) {
170
+ const seen = new Map();
171
+ for (const step of capabilitySteps(component.deploy)) {
172
+ if (!registry.has(step.kind))
173
+ continue;
174
+ const index = seen.get(step.kind) ?? 0;
175
+ seen.set(step.kind, index + 1);
176
+ const { kind, ...rest } = step;
177
+ (byKind.get(kind) ?? byKind.set(kind, []).get(kind)).push({ component: component.name, index, step: rest });
178
+ }
179
+ }
180
+ const out = [];
181
+ for (const [kind, members] of byKind) {
182
+ const capability = registry.resolve(kind);
183
+ let reported;
184
+ try {
185
+ if (typeof capability.graphReads === "function")
186
+ reported = await capability.graphReads({ root }, members);
187
+ else if (typeof capability.declaredReads === "function") {
188
+ reported = (await capability.declaredReads({ root }, members)).map((r) => ({ reader: r.reader, index: r.index ?? 0, upstream: r.upstream, output: r.output }));
189
+ }
190
+ else
191
+ continue;
192
+ }
193
+ catch {
194
+ continue;
195
+ }
196
+ for (const r of reported ?? []) {
197
+ if (!names.has(r.reader) || r.reader === r.upstream)
198
+ continue;
199
+ if (r.upstream !== undefined ? !names.has(r.upstream) : r.external === undefined)
200
+ continue;
201
+ out.push({ ...r, index: r.index ?? 0, kind });
202
+ }
203
+ }
204
+ return out.sort((a, b) => a.reader.localeCompare(b.reader) ||
205
+ a.index - b.index ||
206
+ (a.upstream ?? a.external ?? "").localeCompare(b.upstream ?? b.external ?? "") ||
207
+ (a.output ?? "").localeCompare(b.output ?? ""));
208
+ }
@@ -101,6 +101,14 @@ export interface ImportedComponentModule {
101
101
  file: string;
102
102
  exports: Record<string, unknown>;
103
103
  }
104
+ /**
105
+ * Every `*.component.ts` file under `path`, through the one discovery walk
106
+ * (`../discovery/walk.ts`, #2527): the same dot-directory, `dist`,
107
+ * git-ignore and child-project rules as source discovery, the project's
108
+ * `exclude`/`include` globs and the skip marker (#2519). Scanned from outside
109
+ * any project, every child project is read.
110
+ */
111
+ export declare function findComponentFiles(path: string): Promise<string[]>;
104
112
  /**
105
113
  * Collect every `Component`-shaped export from already-imported `modules`,
106
114
  * enforcing the duplicate-`component.name` rule (across files, or within one
@@ -57,7 +57,7 @@ import { esModuleNamespace } from "../module-interop.js";
57
57
  * `exclude`/`include` globs and the skip marker (#2519). Scanned from outside
58
58
  * any project, every child project is read.
59
59
  */
60
- async function findComponentFiles(path) {
60
+ export async function findComponentFiles(path) {
61
61
  return walkDiscovery({
62
62
  walker: "components",
63
63
  root: path,
@@ -53,6 +53,7 @@ import type { CapabilityRegistry, DeployContext, GroupMemberStatus } from "./cap
53
53
  import type { FanOutGroup } from "./fan-out.js";
54
54
  import type { ReleaseIdentity } from "../telemetry-attribution.js";
55
55
  import type { RunProgressEvent } from "./run-progress.js";
56
+ import { type SkippedGate } from "./step-environments.js";
56
57
  import { type RunEventSink } from "../run-event-stream.js";
57
58
  export type { RunProgressEvent } from "./run-progress.js";
58
59
  /** A wiring reference or literal value, as it appears in a step's fields (schema `WiringValue`). */
@@ -79,6 +80,12 @@ export interface DriverGate {
79
80
  signalName?: string;
80
81
  timeout?: string;
81
82
  description?: string;
83
+ /** The environments the gate applies in (#5401); resolved away before the driver decides it. See ./step-environments.ts. */
84
+ environments?: string[] | Record<string, {
85
+ gate?: string;
86
+ description?: string;
87
+ timeout?: string;
88
+ }>;
82
89
  }
83
90
  /** One named phase of a deploy composition (schema `Phase`). A step may itself be a nested `Phase` (fan-out). */
84
91
  export interface DriverPhase {
@@ -86,6 +93,8 @@ export interface DriverPhase {
86
93
  steps: Array<DriverStep | DriverGate | DriverPhase>;
87
94
  parallel?: boolean;
88
95
  onFailure?: DriverPhase[];
96
+ /** The gates taken out of this phase because they apply in other environments (#5401), which the driver records as skipped. */
97
+ skippedGates?: SkippedGate[];
89
98
  }
90
99
  /** The subset of the Component contract the driver needs to run a deploy (schema-shaped; see component.schema.json). */
91
100
  export interface DriverComponent {
@@ -134,6 +143,10 @@ export interface DriverStepRecord {
134
143
  /** Set when the gate passed over an empty change set (#4045) rather than on a person's approval. */
135
144
  empty?: true;
136
145
  };
146
+ /** Set on a `gate` step skipped because it applies only in other environments (#5401): the environments it names. */
147
+ gateSkipped?: {
148
+ environments: string[];
149
+ };
137
150
  }
138
151
  export interface DriverComponentResult {
139
152
  component: string;
@@ -56,6 +56,7 @@ import { componentPlanDigest } from "./gate-plan.js";
56
56
  import { componentDeployInputs } from "./deploy-inputs.js";
57
57
  import { isPlanMovedError, PLAN_MOVED_EXIT_CODE, PlanFlagRefusedError, planFlagRefusal, TargetsRefusedError, targetRefusal } from "./capability.js";
58
58
  import { isPromotedArtifact } from "./auto-release.js";
59
+ import { componentsForEnvironment, stepInputForEnvironment } from "./step-environments.js";
59
60
  import { gateEventsOf, joinRunEventSinks, progressSinkOf } from "../run-event-stream.js";
60
61
  function isGateStep(step) {
61
62
  return step.kind === "gate";
@@ -328,11 +329,14 @@ function progressStatus(status) {
328
329
  }
329
330
  /** Run a single capability step. Never throws for a capability-run failure; returns a fail record instead. */
330
331
  async function runCapabilityStep(step, phaseName, ctx, registry, phaseOutputs, componentOutputs) {
331
- const { kind, ...rest } = step;
332
- const resolvedInput = resolveStepInput(rest, phaseOutputs, componentOutputs);
332
+ const { kind, ...declared } = step;
333
333
  const start = Date.now();
334
334
  let lease;
335
+ let resolvedInput = declared;
335
336
  try {
337
+ // #5360: the step's inputs for this environment, before the capability sees them.
338
+ const rest = stepInputForEnvironment(declared, ctx.env, { component: ctx.component, phase: phaseName, kind });
339
+ resolvedInput = resolveStepInput(rest, phaseOutputs, componentOutputs);
336
340
  const capability = registry.resolve(kind);
337
341
  // #4594: on the resource grain, a run that plans inside its steps leases the step's rows first and applies the plan it leased for.
338
342
  const leased = await leaseCapabilityStep(capability, ctx, resolvedInput);
@@ -404,6 +408,21 @@ async function runPhase(phaseDef, ctx, registry, phaseOutputs, componentOutputs,
404
408
  /** Decide this phase's gates against the ledger, in authored order, before any of its work starts. Throws `GateStop` at the first one nobody has approved. */
405
409
  const decideGates = async () => {
406
410
  const gateRecords = [];
411
+ // #5401: a gate that applies only in other environments was taken out of the phase; its skip is recorded first.
412
+ for (const skipped of phaseDef.skippedGates ?? []) {
413
+ const kind = `gate:${skipped.gate}`;
414
+ gateRecords.push({ component: ctx.component, phase: phaseDef.phase, kind, status: "skipped", durationMs: 0, gateSkipped: { environments: [...skipped.environments] } });
415
+ emit?.({
416
+ type: "step-settle",
417
+ component: ctx.component,
418
+ phase: phaseDef.phase,
419
+ step: kind,
420
+ status: "skipped",
421
+ skip: "environment",
422
+ durationMs: 0,
423
+ message: `gate "${skipped.gate}" applies in ${skipped.environments.join(", ")}, not ${ctx.env}`,
424
+ });
425
+ }
407
426
  for (const gate of phaseDef.steps.filter(isGateStep)) {
408
427
  const start = Date.now();
409
428
  const base = { component: ctx.component, phase: phaseDef.phase, kind: `gate:${gateName(gate)}` };
@@ -946,6 +965,8 @@ export function assertTargetsAccepted(component, registry, ctx) {
946
965
  walk(phase.steps);
947
966
  }
948
967
  export async function runInterpretDriver(components, registry, options) {
968
+ // #5360: each step's inputs for this environment; a step that names others is refused before the first wave.
969
+ components = componentsForEnvironment(components, options.env);
949
970
  const graph = resolveComponentGraph(components);
950
971
  const byName = new Map(components.map((c) => [c.name, c]));
951
972
  // ws-107 (#4465): the grouped waves, and each member's group.