@intentius/chant 0.124.77 → 0.124.79
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.
- package/dist/__fixtures__/notify-messages/events.d.ts +9 -0
- package/dist/__fixtures__/notify-messages/events.d.ts.map +1 -0
- package/dist/__fixtures__/notify-messages/events.js +21 -0
- package/dist/__fixtures__/product-words.d.ts +14 -0
- package/dist/__fixtures__/product-words.d.ts.map +1 -1
- package/dist/__fixtures__/product-words.js +11 -0
- package/dist/__fixtures__/terragucci-notify.d.ts +66 -0
- package/dist/__fixtures__/terragucci-notify.d.ts.map +1 -0
- package/dist/__fixtures__/terragucci-notify.js +133 -0
- package/dist/action-pins.d.ts +8 -0
- package/dist/action-pins.d.ts.map +1 -1
- package/dist/action-pins.js +8 -0
- package/dist/agent-guard.d.ts.map +1 -1
- package/dist/agent-guard.js +1 -2
- package/dist/change-set.d.ts +10 -1
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +4 -1
- package/dist/ci-agent.d.ts +16 -2
- package/dist/ci-agent.d.ts.map +1 -1
- package/dist/ci-agent.js +6 -1
- package/dist/ci-commit.d.ts +66 -2
- package/dist/ci-commit.d.ts.map +1 -1
- package/dist/ci-commit.js +147 -19
- package/dist/ci-own-jobs.d.ts.map +1 -1
- package/dist/ci-own-jobs.js +1 -2
- package/dist/ci-product-words.d.ts +18 -4
- package/dist/ci-product-words.d.ts.map +1 -1
- package/dist/ci-product-words.js +26 -6
- package/dist/ci-product.d.ts +7 -3
- package/dist/ci-product.d.ts.map +1 -1
- package/dist/ci-product.js +8 -5
- package/dist/cli/handlers/release.d.ts +8 -0
- package/dist/cli/handlers/release.d.ts.map +1 -1
- package/dist/cli/handlers/release.js +68 -6
- package/dist/cli/handlers/run-wave.js +1 -0
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +7 -0
- package/dist/cli/mcp/product-tools.d.ts +6 -0
- package/dist/cli/mcp/product-tools.d.ts.map +1 -1
- package/dist/cli/mcp/product-tools.js +7 -0
- package/dist/cli/mcp/read-only.d.ts +12 -0
- package/dist/cli/mcp/read-only.d.ts.map +1 -1
- package/dist/cli/mcp/read-only.js +16 -0
- package/dist/cli/mcp/server.d.ts +11 -0
- package/dist/cli/mcp/server.d.ts.map +1 -1
- package/dist/cli/mcp/server.js +26 -5
- package/dist/cli/mcp/types.d.ts +5 -1
- package/dist/cli/mcp/types.d.ts.map +1 -1
- package/dist/components/capability.d.ts +42 -0
- package/dist/components/capability.d.ts.map +1 -1
- package/dist/components/group-digest.d.ts +17 -0
- package/dist/components/group-digest.d.ts.map +1 -0
- package/dist/components/group-digest.js +18 -0
- package/dist/components/groups.d.ts +2 -11
- package/dist/components/groups.d.ts.map +1 -1
- package/dist/components/groups.js +2 -12
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/pr-env-components.d.ts.map +1 -1
- package/dist/components/pr-env-components.js +1 -2
- package/dist/config.d.ts +28 -8
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +21 -1
- package/dist/lexicon.d.ts +8 -0
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lexicon.js +8 -0
- package/dist/lifecycle/release-cut.d.ts +7 -1
- package/dist/lifecycle/release-cut.d.ts.map +1 -1
- package/dist/lifecycle/release-cut.js +1 -0
- package/dist/lifecycle/release-images.d.ts +86 -3
- package/dist/lifecycle/release-images.d.ts.map +1 -1
- package/dist/lifecycle/release-images.js +131 -6
- package/dist/lifecycle/release-publish.d.ts +8 -1
- package/dist/lifecycle/release-publish.d.ts.map +1 -1
- package/dist/lifecycle/release-publish.js +30 -3
- package/dist/lifecycle/release-version.d.ts +86 -0
- package/dist/lifecycle/release-version.d.ts.map +1 -0
- package/dist/lifecycle/release-version.js +209 -0
- package/dist/mcp/types.d.ts +26 -0
- package/dist/mcp/types.d.ts.map +1 -1
- package/dist/notify-product.d.ts +11 -2
- package/dist/notify-product.d.ts.map +1 -1
- package/dist/notify-product.js +15 -4
- package/dist/notify-relay.d.ts.map +1 -1
- package/dist/notify-relay.js +1 -2
- package/dist/notify.d.ts +36 -4
- package/dist/notify.d.ts.map +1 -1
- package/dist/notify.js +31 -21
- package/dist/notify.schema.json +1 -0
- package/dist/op/activities/review-product.d.ts +111 -0
- package/dist/op/activities/review-product.d.ts.map +1 -0
- package/dist/op/activities/review-product.js +115 -0
- package/dist/op/gate.d.ts +17 -0
- package/dist/op/gate.d.ts.map +1 -1
- package/dist/op/gate.js +36 -0
- package/dist/op/index.d.ts +8 -6
- package/dist/op/index.d.ts.map +1 -1
- package/dist/op/index.js +5 -4
- package/dist/op/op-waves-after-plan.d.ts +76 -1
- package/dist/op/op-waves-after-plan.d.ts.map +1 -1
- package/dist/op/op-waves-after-plan.js +142 -3
- package/dist/op/op-waves-capability-spec.js +1 -2
- package/dist/op/op-waves-capability.d.ts +89 -2
- package/dist/op/op-waves-capability.d.ts.map +1 -1
- package/dist/op/op-waves-capability.js +215 -7
- package/dist/op/op-waves-run-hooks.d.ts +104 -0
- package/dist/op/op-waves-run-hooks.d.ts.map +1 -0
- package/dist/op/op-waves-run-hooks.js +146 -0
- package/dist/op/op-waves-run.d.ts +21 -0
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves-run.js +233 -13
- package/dist/op/op-waves.d.ts +11 -1
- package/dist/op/op-waves.d.ts.map +1 -1
- package/dist/op/op-waves.js +7 -1
- package/dist/op/runtime.d.ts +2 -0
- package/dist/op/runtime.d.ts.map +1 -1
- package/dist/policy-engine.d.ts.map +1 -1
- package/dist/policy-engine.js +1 -2
- package/dist/pr-forge-reads.d.ts +124 -0
- package/dist/pr-forge-reads.d.ts.map +1 -0
- package/dist/pr-forge-reads.js +322 -0
- package/dist/pr-forge.d.ts +14 -0
- package/dist/pr-forge.d.ts.map +1 -1
- package/dist/pr-forge.js +21 -13
- package/dist/pr-plan-note.d.ts +293 -0
- package/dist/pr-plan-note.d.ts.map +1 -0
- package/dist/pr-plan-note.js +361 -0
- package/dist/release-floors.d.ts +13 -1
- package/dist/release-floors.d.ts.map +1 -1
- package/dist/release-floors.js +13 -1
- package/dist/state-export.d.ts.map +1 -1
- package/dist/state-export.js +1 -2
- package/dist/state-migration.d.ts.map +1 -1
- package/dist/state-migration.js +1 -2
- package/dist/state-unlock.d.ts.map +1 -1
- package/dist/state-unlock.js +1 -2
- package/dist/wave-runtime.mjs +314 -314
- package/dist/workspace/change-set.schema.json +7 -0
- package/dist/workspace/release-workflow.d.ts +7 -0
- package/dist/workspace/release-workflow.d.ts.map +1 -1
- package/dist/workspace/release-workflow.js +13 -2
- package/package.json +1 -1
- package/src/__fixtures__/notify-messages/events.ts +23 -0
- package/src/__fixtures__/notify-messages/messages.json +50 -0
- package/src/__fixtures__/pr-loop/terragucci-plan.note.golden.md +53 -0
- package/src/__fixtures__/pr-loop/terragucci-plan.note.json +83 -0
- package/src/__fixtures__/product-words.ts +12 -0
- package/src/__fixtures__/review-agent/terragucci-review.json +94 -0
- package/src/__fixtures__/terragucci-notify.ts +170 -0
- package/src/action-pins.test.ts +11 -1
- package/src/action-pins.ts +9 -0
- package/src/agent-guard.test.ts +1 -2
- package/src/agent-guard.ts +1 -2
- package/src/change-set.test.ts +20 -0
- package/src/change-set.ts +11 -1
- package/src/ci-agent.test.ts +9 -0
- package/src/ci-agent.ts +15 -2
- package/src/ci-commit.test.ts +162 -0
- package/src/ci-commit.ts +167 -21
- package/src/ci-own-jobs.test.ts +1 -2
- package/src/ci-own-jobs.ts +1 -2
- package/src/ci-product-words.ts +35 -7
- package/src/ci-product.ts +9 -6
- package/src/cli/handlers/build-pr-loop-control.test.ts +1 -2
- package/src/cli/handlers/build-run-group.test.ts +1 -2
- package/src/cli/handlers/release.ts +60 -7
- package/src/cli/handlers/run-wave.ts +1 -0
- package/src/cli/main.ts +7 -0
- package/src/cli/mcp/product-tools.test.ts +50 -0
- package/src/cli/mcp/product-tools.ts +8 -0
- package/src/cli/mcp/read-only.ts +19 -0
- package/src/cli/mcp/server.test.ts +30 -0
- package/src/cli/mcp/server.ts +28 -5
- package/src/cli/mcp/types.ts +6 -1
- package/src/components/capability.ts +41 -0
- package/src/components/group-digest.ts +20 -0
- package/src/components/groups.ts +3 -13
- package/src/components/index.ts +2 -0
- package/src/components/pr-env-components.test.ts +1 -2
- package/src/components/pr-env-components.ts +1 -2
- package/src/config.ts +38 -3
- package/src/gate-policy-bundle.test.ts +1 -1
- package/src/lexicon.ts +9 -0
- package/src/lifecycle/release-cut.ts +11 -0
- package/src/lifecycle/release-images-dockerfile.test.ts +229 -0
- package/src/lifecycle/release-images.ts +171 -8
- package/src/lifecycle/release-publish.ts +34 -3
- package/src/lifecycle/release-version.test.ts +155 -0
- package/src/lifecycle/release-version.ts +227 -0
- package/src/mcp/types.ts +27 -0
- package/src/notify-message-words.test.ts +185 -0
- package/src/notify-product.ts +16 -4
- package/src/notify-relay.ts +1 -2
- package/src/notify.schema.json +1 -0
- package/src/notify.ts +59 -19
- package/src/op/activities/review-product.test.ts +116 -0
- package/src/op/activities/review-product.ts +199 -0
- package/src/op/gate.ts +46 -0
- package/src/op/index.ts +10 -4
- package/src/op/op-waves-after-plan-wave.test.ts +226 -0
- package/src/op/op-waves-after-plan.ts +170 -5
- package/src/op/op-waves-capability-spec.ts +1 -1
- package/src/op/op-waves-capability.test.ts +6 -0
- package/src/op/op-waves-capability.ts +243 -10
- package/src/op/op-waves-run-hooks.test.ts +184 -0
- package/src/op/op-waves-run-hooks.ts +195 -0
- package/src/op/op-waves-run.ts +240 -16
- package/src/op/op-waves-step-wave.test.ts +277 -0
- package/src/op/op-waves.ts +15 -2
- package/src/op/runtime.ts +2 -0
- package/src/op/schedule-overdue.test.ts +26 -0
- package/src/policy-engine.test.ts +1 -2
- package/src/policy-engine.ts +1 -2
- package/src/pr-forge-reads.test.ts +285 -0
- package/src/pr-forge-reads.ts +424 -0
- package/src/pr-forge.ts +30 -16
- package/src/pr-plan-note.test.ts +105 -0
- package/src/pr-plan-note.ts +520 -0
- package/src/release-floors.ts +19 -1
- package/src/state-export.test.ts +1 -2
- package/src/state-export.ts +1 -2
- package/src/state-migration.test.ts +1 -2
- package/src/state-migration.ts +1 -2
- package/src/state-unlock.test.ts +1 -2
- package/src/state-unlock.ts +1 -2
- package/src/workspace/change-set.schema.json +7 -0
- package/src/workspace/release-workflow.test.ts +18 -0
- package/src/workspace/release-workflow.ts +23 -2
|
@@ -20,11 +20,39 @@
|
|
|
20
20
|
* The spec's command hooks at `hooks.after.plan` keep running where they
|
|
21
21
|
* ran: after the set digest, before the gate settles. A `perRun` one gets
|
|
22
22
|
* `{planJson}`, `CHANT_PLAN_DIGEST` and `CHANT_PLAN_JSON` the same way.
|
|
23
|
+
*
|
|
24
|
+
* ## The wave answer (#4842)
|
|
25
|
+
*
|
|
26
|
+
* A hook's `wave`, when it has one, is called once per job after its `run`
|
|
27
|
+
* was called for each of its runs, with all of them. It answers for the wave
|
|
28
|
+
* as a whole, as a plans file does for a wave-level plan command:
|
|
29
|
+
*
|
|
30
|
+
* - `pending`: fields for the pending fact (a `description`, the commit it
|
|
31
|
+
* planned), under the plans file's rules (`pendingFields`).
|
|
32
|
+
* - `members`: digest members that are no run, such as the wave's monthly
|
|
33
|
+
* cost from the product's own estimator.
|
|
34
|
+
* - `holds`: reasons the wave waits for a person whatever its gate, one line
|
|
35
|
+
* each, as a held hook's.
|
|
36
|
+
* - `overriders` and `overridersSource`: who may override a denial, in place
|
|
37
|
+
* of the overriders file at base. A run's own answer can name its own
|
|
38
|
+
* `overriders`, which count for that run in place of the wave's.
|
|
39
|
+
* - `report`: the product's report of these plans. When the wave waits,
|
|
40
|
+
* chant stores it beside the pending fact, at
|
|
41
|
+
* `_gates/<op>/<gate>/<digest>.json`, once. When the plans moved after an
|
|
42
|
+
* approval, chant writes it and the report stored for the approved plans
|
|
43
|
+
* to `.chant/op-waves/<name>/wave-<k>/report/` (`current.json`,
|
|
44
|
+
* `approved.json`) and names them on the decision, for the job that
|
|
45
|
+
* explains the refusal.
|
|
46
|
+
*
|
|
47
|
+
* A `wave` that throws follows the hook's `onFailure`, as `run` does.
|
|
23
48
|
*/
|
|
24
49
|
import type { ChangeSetPart } from "../change-set.js";
|
|
25
50
|
import type { OpRunPolicyRow } from "./runtime.js";
|
|
51
|
+
import type { WaveMember } from "../wave-engine.js";
|
|
26
52
|
import { type OpWaveHookFailure } from "./op-waves.js";
|
|
27
|
-
import type
|
|
53
|
+
import { type OpWaveHookOutcome } from "./stage-hooks.js";
|
|
54
|
+
/** The first chant whose after-plan hooks answer for the wave as a whole (`wave`), take a run's own `overriders`, and whose wave keeps the hook's report beside its pending fact (#4842). */
|
|
55
|
+
export declare const OP_WAVE_AFTER_PLAN_WAVE_FLOOR = "0.124.79";
|
|
28
56
|
/** One planned run, as an after-plan hook in the job's process sees it (#4614). */
|
|
29
57
|
export interface OpWaveAfterPlanRun {
|
|
30
58
|
/** The spec's name and `op`. */
|
|
@@ -60,6 +88,34 @@ export interface OpWaveAfterPlanResult {
|
|
|
60
88
|
policy?: OpRunPolicyRow[];
|
|
61
89
|
/** Files the hook wrote for the run, relative to the job's directory. */
|
|
62
90
|
files?: string[];
|
|
91
|
+
/** Who may override this run's denial (#4842), in place of the wave's overriders. */
|
|
92
|
+
overriders?: string[];
|
|
93
|
+
}
|
|
94
|
+
/** A job's planned runs, as a hook's wave answer sees them (#4842). */
|
|
95
|
+
export interface OpWaveAfterPlanWave {
|
|
96
|
+
spec: string;
|
|
97
|
+
op: string;
|
|
98
|
+
wave: number;
|
|
99
|
+
waveName: string;
|
|
100
|
+
job: OpWaveAfterPlanRun["job"];
|
|
101
|
+
/** The runs the hook is for, in the wave's order, as its `run` saw each. */
|
|
102
|
+
runs: OpWaveAfterPlanRun[];
|
|
103
|
+
cwd: string;
|
|
104
|
+
}
|
|
105
|
+
/** What a hook adds to the wave as a whole (#4842). */
|
|
106
|
+
export interface OpWaveAfterPlanWaveResult {
|
|
107
|
+
/** Fields for the wave's pending fact, as a plans file's `pending`. */
|
|
108
|
+
pending?: Record<string, unknown>;
|
|
109
|
+
/** Digest members that are no run, such as the wave's cost. */
|
|
110
|
+
members?: WaveMember[];
|
|
111
|
+
/** Why the wave waits for a person whatever its gate, a line each. */
|
|
112
|
+
holds?: string[];
|
|
113
|
+
/** Who may override a denial, in place of the overriders file at base. */
|
|
114
|
+
overriders?: string[];
|
|
115
|
+
/** Where those overriders come from, for a refusal: "policy.override in terragucci.yml". */
|
|
116
|
+
overridersSource?: string;
|
|
117
|
+
/** The product's report of these plans: stored beside the pending fact, and written for the respond job after the plans moved. */
|
|
118
|
+
report?: string;
|
|
63
119
|
}
|
|
64
120
|
/** An after-plan hook in the wave job's process (#4614). */
|
|
65
121
|
export interface OpWaveAfterPlanHook {
|
|
@@ -70,16 +126,31 @@ export interface OpWaveAfterPlanHook {
|
|
|
70
126
|
/** The runs it is for, as a command hook's `targets`. Default: every run. */
|
|
71
127
|
targets?: string[];
|
|
72
128
|
run(planned: OpWaveAfterPlanRun): OpWaveAfterPlanResult | void | Promise<OpWaveAfterPlanResult | void>;
|
|
129
|
+
/** Called once per job after `run` for each of its runs (#4842): what the hook adds to the wave. */
|
|
130
|
+
wave?(planned: OpWaveAfterPlanWave): OpWaveAfterPlanWaveResult | void | Promise<OpWaveAfterPlanWaveResult | void>;
|
|
73
131
|
}
|
|
74
132
|
/** What is wrong with `afterPlan`, empty when nothing is. */
|
|
75
133
|
export declare function opWaveAfterPlanProblems(hooks: unknown): string[];
|
|
76
134
|
/** What is wrong with one answer of a hook, empty when nothing is. */
|
|
77
135
|
export declare function opWaveAfterPlanResultProblems(value: unknown): string[];
|
|
136
|
+
/** What is wrong with one wave answer (#4842), empty when nothing is. `targets` are the wave's runs, which no digest member may be named. */
|
|
137
|
+
export declare function opWaveAfterPlanWaveResultProblems(value: unknown, targets: readonly string[]): string[];
|
|
78
138
|
/** What one run's hooks came to. */
|
|
79
139
|
export interface OpWaveAfterPlanRunOutcome {
|
|
80
140
|
/** The hooks' rows, in order. */
|
|
81
141
|
policy: OpRunPolicyRow[];
|
|
82
142
|
files: string[];
|
|
143
|
+
/** Who may override its denial (#4842), when a hook named anyone: the last hook's list. */
|
|
144
|
+
overriders?: string[];
|
|
145
|
+
}
|
|
146
|
+
/** What the hooks' wave answers came to (#4842), each hook's in order. */
|
|
147
|
+
export interface OpWaveAfterPlanWaveOutcome {
|
|
148
|
+
pending?: Record<string, unknown>;
|
|
149
|
+
members: WaveMember[];
|
|
150
|
+
holds: string[];
|
|
151
|
+
overriders?: string[];
|
|
152
|
+
overridersSource?: string;
|
|
153
|
+
report?: string;
|
|
83
154
|
}
|
|
84
155
|
/** What the after-plan hooks in the job's process came to (#4614). */
|
|
85
156
|
export interface OpWaveAfterPlanOutcome {
|
|
@@ -90,6 +161,8 @@ export interface OpWaveAfterPlanOutcome {
|
|
|
90
161
|
outcomes: OpWaveHookOutcome[];
|
|
91
162
|
/** Each run's rows and files, by target, for the runs a hook answered. */
|
|
92
163
|
runs: Map<string, OpWaveAfterPlanRunOutcome>;
|
|
164
|
+
/** The wave answers (#4842). */
|
|
165
|
+
wave: OpWaveAfterPlanWaveOutcome;
|
|
93
166
|
}
|
|
94
167
|
/**
|
|
95
168
|
* Call each hook once per run it is for, hook by hook, each over the runs
|
|
@@ -129,6 +202,8 @@ export interface ProductWaveHook {
|
|
|
129
202
|
capabilities?: import("../components/capability.js").CapabilityRegistry;
|
|
130
203
|
/** How the spec's command hooks run, when they call back into the product's process (`RunOpWaveOptions.hookExec`). */
|
|
131
204
|
hookExec?: import("./stage-hooks.js").OpWaveAsyncExec;
|
|
205
|
+
/** Hooks around each run of a wave with a `step` (#4842, `RunOpWaveOptions.runHooks`). */
|
|
206
|
+
runHooks?: import("./op-waves-run-hooks.js").OpWaveRunHooks | readonly import("./op-waves-run-hooks.js").OpWaveRunHooks[];
|
|
132
207
|
}
|
|
133
208
|
/** The product's wave hook while a command it runs in process runs, else undefined. */
|
|
134
209
|
export declare function activeProductWaveHook(): ProductWaveHook | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"op-waves-after-plan.d.ts","sourceRoot":"","sources":["../../src/op/op-waves-after-plan.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"op-waves-after-plan.d.ts","sourceRoot":"","sources":["../../src/op/op-waves-after-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAyC,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC3F,OAAO,EAA4B,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEjF,6LAA6L;AAC7L,eAAO,MAAM,6BAA6B,aAAe,CAAC;AAE1D,mFAAmF;AACnF,MAAM,WAAW,kBAAkB;IACjC,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,oIAAoI;IACpI,GAAG,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,wBAAwB;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAC;IACb,+FAA+F;IAC/F,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yDAAyD;IACzD,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,KAAK,EAAE,OAAO,CAAC;IAC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EAAE,cAAc,EAAE,CAAC;CACrH;AAID,uFAAuF;AACvF,wBAAgB,qBAAqB,IAAI,eAAe,GAAG,SAAS,CAEnE;AAED,kFAAkF;AAClF,wBAAsB,mBAAmB,CAAC,CAAC,EAAE,IAAI,EAAE,eAAe,GAAG,SAAS,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAShH"}
|
|
@@ -20,9 +20,38 @@
|
|
|
20
20
|
* The spec's command hooks at `hooks.after.plan` keep running where they
|
|
21
21
|
* ran: after the set digest, before the gate settles. A `perRun` one gets
|
|
22
22
|
* `{planJson}`, `CHANT_PLAN_DIGEST` and `CHANT_PLAN_JSON` the same way.
|
|
23
|
+
*
|
|
24
|
+
* ## The wave answer (#4842)
|
|
25
|
+
*
|
|
26
|
+
* A hook's `wave`, when it has one, is called once per job after its `run`
|
|
27
|
+
* was called for each of its runs, with all of them. It answers for the wave
|
|
28
|
+
* as a whole, as a plans file does for a wave-level plan command:
|
|
29
|
+
*
|
|
30
|
+
* - `pending`: fields for the pending fact (a `description`, the commit it
|
|
31
|
+
* planned), under the plans file's rules (`pendingFields`).
|
|
32
|
+
* - `members`: digest members that are no run, such as the wave's monthly
|
|
33
|
+
* cost from the product's own estimator.
|
|
34
|
+
* - `holds`: reasons the wave waits for a person whatever its gate, one line
|
|
35
|
+
* each, as a held hook's.
|
|
36
|
+
* - `overriders` and `overridersSource`: who may override a denial, in place
|
|
37
|
+
* of the overriders file at base. A run's own answer can name its own
|
|
38
|
+
* `overriders`, which count for that run in place of the wave's.
|
|
39
|
+
* - `report`: the product's report of these plans. When the wave waits,
|
|
40
|
+
* chant stores it beside the pending fact, at
|
|
41
|
+
* `_gates/<op>/<gate>/<digest>.json`, once. When the plans moved after an
|
|
42
|
+
* approval, chant writes it and the report stored for the approved plans
|
|
43
|
+
* to `.chant/op-waves/<name>/wave-<k>/report/` (`current.json`,
|
|
44
|
+
* `approved.json`) and names them on the decision, for the job that
|
|
45
|
+
* explains the refusal.
|
|
46
|
+
*
|
|
47
|
+
* A `wave` that throws follows the hook's `onFailure`, as `run` does.
|
|
23
48
|
*/
|
|
24
49
|
import { isAbsolute } from "node:path";
|
|
50
|
+
import { NEXT_RELEASE } from "../release-floors.js";
|
|
25
51
|
import { OP_WAVE_HOOK_FAILURES, opWaveHookRuns } from "./op-waves.js";
|
|
52
|
+
import { OP_WAVE_PENDING_RESERVED } from "./stage-hooks.js";
|
|
53
|
+
/** The first chant whose after-plan hooks answer for the wave as a whole (`wave`), take a run's own `overriders`, and whose wave keeps the hook's report beside its pending fact (#4842). */
|
|
54
|
+
export const OP_WAVE_AFTER_PLAN_WAVE_FLOOR = NEXT_RELEASE;
|
|
26
55
|
const ROW_RESULTS = ["passed", "warned", "denied", "held"];
|
|
27
56
|
/** What is wrong with `afterPlan`, empty when nothing is. */
|
|
28
57
|
export function opWaveAfterPlanProblems(hooks) {
|
|
@@ -39,6 +68,8 @@ export function opWaveAfterPlanProblems(hooks) {
|
|
|
39
68
|
problems.push(`${at} needs a name`);
|
|
40
69
|
if (typeof hook.run !== "function")
|
|
41
70
|
problems.push(`${at} needs a run function`);
|
|
71
|
+
if (hook.wave !== undefined && typeof hook.wave !== "function")
|
|
72
|
+
problems.push(`${at}.wave must be a function`);
|
|
42
73
|
if (hook.onFailure !== undefined && !OP_WAVE_HOOK_FAILURES.includes(hook.onFailure))
|
|
43
74
|
problems.push(`${at} has onFailure "${String(hook.onFailure)}"; use ${OP_WAVE_HOOK_FAILURES.join(" or ")}`);
|
|
44
75
|
if (hook.targets !== undefined && (!Array.isArray(hook.targets) || hook.targets.length === 0 || !hook.targets.every((t) => typeof t === "string" && t !== "")))
|
|
@@ -51,7 +82,7 @@ export function opWaveAfterPlanResultProblems(value) {
|
|
|
51
82
|
if (value === undefined || value === null)
|
|
52
83
|
return [];
|
|
53
84
|
if (typeof value !== "object" || Array.isArray(value))
|
|
54
|
-
return ["the answer must be { policy?, files? }"];
|
|
85
|
+
return ["the answer must be { policy?, files?, overriders? }"];
|
|
55
86
|
const r = value;
|
|
56
87
|
const problems = [];
|
|
57
88
|
if (r.policy !== undefined) {
|
|
@@ -77,6 +108,57 @@ export function opWaveAfterPlanResultProblems(value) {
|
|
|
77
108
|
if (r.files !== undefined && (!Array.isArray(r.files) || !r.files.every((f) => typeof f === "string" && f !== "" && !isAbsolute(f) && !f.split("/").includes("..")))) {
|
|
78
109
|
problems.push("`files` must be paths inside the job's directory, relative to it");
|
|
79
110
|
}
|
|
111
|
+
if (r.overriders !== undefined && !principals(r.overriders))
|
|
112
|
+
problems.push("`overriders` must be a list of principals");
|
|
113
|
+
return problems;
|
|
114
|
+
}
|
|
115
|
+
const principals = (v) => Array.isArray(v) && v.every((p) => typeof p === "string" && p.trim() !== "");
|
|
116
|
+
/** What is wrong with one wave answer (#4842), empty when nothing is. `targets` are the wave's runs, which no digest member may be named. */
|
|
117
|
+
export function opWaveAfterPlanWaveResultProblems(value, targets) {
|
|
118
|
+
if (value === undefined || value === null)
|
|
119
|
+
return [];
|
|
120
|
+
if (typeof value !== "object" || Array.isArray(value))
|
|
121
|
+
return ["the wave answer must be { pending?, members?, holds?, overriders?, overridersSource?, report? }"];
|
|
122
|
+
const r = value;
|
|
123
|
+
const problems = [];
|
|
124
|
+
if (r.pending !== undefined) {
|
|
125
|
+
const p = r.pending;
|
|
126
|
+
if (p === null || typeof p !== "object" || Array.isArray(p))
|
|
127
|
+
problems.push("`pending` must be an object of fields for the pending fact");
|
|
128
|
+
else {
|
|
129
|
+
const reserved = Object.keys(p).filter((key) => OP_WAVE_PENDING_RESERVED.includes(key));
|
|
130
|
+
if (reserved.length > 0)
|
|
131
|
+
problems.push(`\`pending\` cannot set ${reserved.join(", ")}, which chant writes`);
|
|
132
|
+
if ("description" in p && typeof p.description !== "string")
|
|
133
|
+
problems.push("`pending.description` must be a string");
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
if (r.overriders !== undefined && !principals(r.overriders))
|
|
137
|
+
problems.push("`overriders` must be a list of principals");
|
|
138
|
+
if (r.overridersSource !== undefined && (typeof r.overridersSource !== "string" || r.overridersSource.trim() === ""))
|
|
139
|
+
problems.push("`overridersSource` must say where the overriders come from");
|
|
140
|
+
if (r.members !== undefined) {
|
|
141
|
+
if (!Array.isArray(r.members))
|
|
142
|
+
problems.push("`members` must be a list of { member, planDigest }");
|
|
143
|
+
else {
|
|
144
|
+
const seen = new Set();
|
|
145
|
+
for (const m of r.members) {
|
|
146
|
+
if (!m || typeof m.member !== "string" || m.member === "" || typeof m.planDigest !== "string" || m.planDigest === "") {
|
|
147
|
+
problems.push("each of `members` needs a member and a planDigest");
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
if (targets.includes(m.member))
|
|
151
|
+
problems.push(`member ${m.member} is also a run's target; a digest member that is no run needs a name of its own`);
|
|
152
|
+
else if (seen.has(m.member))
|
|
153
|
+
problems.push(`\`members\` names ${m.member} twice`);
|
|
154
|
+
seen.add(m.member);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
if (r.holds !== undefined && !(Array.isArray(r.holds) && r.holds.every((h) => typeof h === "string" && h.trim() !== "")))
|
|
159
|
+
problems.push("`holds` must be a list of reasons, each a line saying why the wave waits for a person");
|
|
160
|
+
if (r.report !== undefined && typeof r.report !== "string")
|
|
161
|
+
problems.push("`report` must be the report's text");
|
|
80
162
|
return problems;
|
|
81
163
|
}
|
|
82
164
|
/**
|
|
@@ -86,9 +168,11 @@ export function opWaveAfterPlanResultProblems(value) {
|
|
|
86
168
|
* `approve` it holds the wave and the rest go on.
|
|
87
169
|
*/
|
|
88
170
|
export async function runOpWaveAfterPlanHooks(hooks, runs, log) {
|
|
89
|
-
const out = { holds: [], outcomes: [], runs: new Map() };
|
|
171
|
+
const out = { holds: [], outcomes: [], runs: new Map(), wave: { members: [], holds: [] } };
|
|
172
|
+
const targets = runs.map((r) => r.target);
|
|
90
173
|
for (const hook of hooks) {
|
|
91
|
-
|
|
174
|
+
const mine = opWaveHookRuns(hook, runs);
|
|
175
|
+
for (const run of mine) {
|
|
92
176
|
const label = `after-plan hook ${hook.name} (${run.target})`;
|
|
93
177
|
let problem;
|
|
94
178
|
let answer = undefined;
|
|
@@ -113,6 +197,11 @@ export async function runOpWaveAfterPlanHooks(hooks, runs, log) {
|
|
|
113
197
|
got.files.push(f);
|
|
114
198
|
out.runs.set(run.target, got);
|
|
115
199
|
}
|
|
200
|
+
if (answer?.overriders) {
|
|
201
|
+
const got = out.runs.get(run.target) ?? { policy: [], files: [] };
|
|
202
|
+
got.overriders = [...new Set(answer.overriders)].sort();
|
|
203
|
+
out.runs.set(run.target, got);
|
|
204
|
+
}
|
|
116
205
|
continue;
|
|
117
206
|
}
|
|
118
207
|
if (hook.onFailure === "approve") {
|
|
@@ -126,9 +215,59 @@ export async function runOpWaveAfterPlanHooks(hooks, runs, log) {
|
|
|
126
215
|
log(problem);
|
|
127
216
|
return out;
|
|
128
217
|
}
|
|
218
|
+
if (!hook.wave || mine.length === 0)
|
|
219
|
+
continue;
|
|
220
|
+
// #4842: the hook's answer for the wave, once its runs were each answered.
|
|
221
|
+
const first = mine[0];
|
|
222
|
+
const label = `after-plan hook ${hook.name} (wave ${first.wave})`;
|
|
223
|
+
let problem;
|
|
224
|
+
let answer = undefined;
|
|
225
|
+
try {
|
|
226
|
+
answer = await hook.wave({ spec: first.spec, op: first.op, wave: first.wave, waveName: first.waveName, job: first.job, runs: [...mine], cwd: first.cwd });
|
|
227
|
+
const wrong = opWaveAfterPlanWaveResultProblems(answer, targets);
|
|
228
|
+
if (wrong.length > 0)
|
|
229
|
+
problem = `${label} answered with ${wrong.join("; ")}`;
|
|
230
|
+
}
|
|
231
|
+
catch (err) {
|
|
232
|
+
problem = `${label} failed: ${err instanceof Error ? err.message : String(err)}`;
|
|
233
|
+
}
|
|
234
|
+
const base = { moment: "after-plan", name: hook.name };
|
|
235
|
+
if (problem === undefined) {
|
|
236
|
+
out.outcomes.push({ ...base, exit: 0, outcome: "passed" });
|
|
237
|
+
if (answer)
|
|
238
|
+
foldWaveAnswer(out.wave, answer);
|
|
239
|
+
continue;
|
|
240
|
+
}
|
|
241
|
+
if (hook.onFailure === "approve") {
|
|
242
|
+
out.outcomes.push({ ...base, exit: 1, outcome: "held" });
|
|
243
|
+
out.holds.push(label);
|
|
244
|
+
log(`${problem}, so wave ${first.wave} (${first.waveName}) waits for an approval of its set digest`);
|
|
245
|
+
continue;
|
|
246
|
+
}
|
|
247
|
+
out.outcomes.push({ ...base, exit: 1, outcome: "failed" });
|
|
248
|
+
out.failed = problem;
|
|
249
|
+
log(problem);
|
|
250
|
+
return out;
|
|
129
251
|
}
|
|
130
252
|
return out;
|
|
131
253
|
}
|
|
254
|
+
/** Fold one hook's wave answer into what the answers so far came to: fields and lists add up, a later list of overriders or report wins. */
|
|
255
|
+
function foldWaveAnswer(into, answer) {
|
|
256
|
+
if (answer.pending && Object.keys(answer.pending).length > 0)
|
|
257
|
+
into.pending = { ...into.pending, ...answer.pending };
|
|
258
|
+
for (const m of answer.members ?? [])
|
|
259
|
+
if (!into.members.some((x) => x.member === m.member))
|
|
260
|
+
into.members.push({ member: m.member, planDigest: m.planDigest });
|
|
261
|
+
for (const h of answer.holds ?? [])
|
|
262
|
+
if (!into.holds.includes(h))
|
|
263
|
+
into.holds.push(h);
|
|
264
|
+
if (answer.overriders)
|
|
265
|
+
into.overriders = [...new Set(answer.overriders)].sort();
|
|
266
|
+
if (answer.overridersSource)
|
|
267
|
+
into.overridersSource = answer.overridersSource;
|
|
268
|
+
if (answer.report !== undefined)
|
|
269
|
+
into.report = answer.report;
|
|
270
|
+
}
|
|
132
271
|
/** Fold policy rows into a run's denial and hold: the rules of every `denied` row, and of every `held` row. */
|
|
133
272
|
export function foldPolicyRows(rows, now) {
|
|
134
273
|
const fold = (kind, was) => {
|
|
@@ -28,8 +28,7 @@ export function opWaveStepProblems(spec) {
|
|
|
28
28
|
if (spec.hooks?.apply?.runBy === "apply")
|
|
29
29
|
problems.push("`hooks.apply.runBy: \"apply\"` hands the apply-stage hooks to an apply command, and a `step` has none; leave runBy as chant");
|
|
30
30
|
for (const wave of spec.waves) {
|
|
31
|
-
|
|
32
|
-
problems.push(`wave "${wave.name}" discovers its runs, which only \`planWave\` can report; a \`step\` plans the runs the spec lists`);
|
|
31
|
+
// #4842: a step's capability finds a discovering wave's runs (`discoverRuns`), checked when the wave plans.
|
|
33
32
|
if (wave.hooks?.apply?.runBy === "apply")
|
|
34
33
|
problems.push(`wave "${wave.name}" hands its apply-stage hooks to an apply command, and a \`step\` has none`);
|
|
35
34
|
for (const run of wave.runs ?? []) {
|
|
@@ -31,6 +31,23 @@
|
|
|
31
31
|
* capability refuses as moved (`isPlanMovedError`) applied nothing and the
|
|
32
32
|
* job exits 4, the table's moved code (#4553); any other error fails it.
|
|
33
33
|
*
|
|
34
|
+
* ## A wave planned as one (#4842)
|
|
35
|
+
*
|
|
36
|
+
* Some tools plan a wave as a whole. A `discover` wave asks the step's
|
|
37
|
+
* capability for its runs (`discoverRuns`), such as one layer of a
|
|
38
|
+
* Terragrunt repo's units from `terragrunt find`, and plans each run found
|
|
39
|
+
* with `{target}` filled. A wave marked `together` plans its runs in one
|
|
40
|
+
* `planGroup` call and applies them in one `runGroup` call, as a fan-out
|
|
41
|
+
* applies a group (ws-107): Terragrunt's `run --all` over the layer, or a
|
|
42
|
+
* composed run of roots that read each other. Each run keeps its own member
|
|
43
|
+
* digest (its share of the plan), and the group digest (the capability's
|
|
44
|
+
* digest of the whole with each run's, `groupDigest`) is one more digest
|
|
45
|
+
* member, `(wave plan)`, so an approval of one composition does not apply
|
|
46
|
+
* another. The group's artifact goes back to `runGroup`; a run's own
|
|
47
|
+
* artifact stays on its plan file for `{planJson}`. The run hooks run per
|
|
48
|
+
* run around the one call, each run's `processEnv` and `afterInit` on its
|
|
49
|
+
* member's context.
|
|
50
|
+
*
|
|
34
51
|
* The registry is the project's (`fanOutRegistry`, the one `chant run
|
|
35
52
|
* --components` builds), loaded once per job behind a dynamic import, so the
|
|
36
53
|
* wave-job runtime bundle stays without the config loader. A product that
|
|
@@ -52,7 +69,7 @@
|
|
|
52
69
|
* not apply at another. A run the estimator cannot price holds the wave
|
|
53
70
|
* too. The terraform lexicon's preset is `terraformCostHold` (infracost).
|
|
54
71
|
*/
|
|
55
|
-
import type { Capability, CapabilityRegistry, DeployContext } from "../components/capability.js";
|
|
72
|
+
import type { Capability, CapabilityPlan, CapabilityRegistry, DeployContext } from "../components/capability.js";
|
|
56
73
|
import type { CapabilityTraceFacts } from "../otlp.js";
|
|
57
74
|
import { type ChangeSetDocument, type ChangeSetPart } from "../change-set.js";
|
|
58
75
|
import type { GatePolicyExec } from "../gate-policy.js";
|
|
@@ -65,6 +82,8 @@ export { OP_WAVE_COST_FORMATS, OP_WAVE_COST_MEMBER, opWaveHoldsAt, opWaveHoldsPr
|
|
|
65
82
|
export type { OpWaveCostFormat, OpWaveCostHold, OpWaveHolds, OpWaveStep } from "./op-waves-capability-spec.js";
|
|
66
83
|
/** The input a run's step gets (#4545): the spec's step with the run's values filled in, and the run's own `input` over it. */
|
|
67
84
|
export declare function opWaveStepInput(spec: Pick<OpWavesSpec, "op" | "step">, wave: Pick<OpWave, "name">, run: OpWaveRun): Record<string, unknown>;
|
|
85
|
+
/** The input `discoverRuns` gets (#4842): the spec's step with `{op}` and `{wave}` filled and `{target}` left as written. */
|
|
86
|
+
export declare function opWaveDiscoverInput(spec: Pick<OpWavesSpec, "op" | "step">, wave: Pick<OpWave, "name">): Record<string, unknown>;
|
|
68
87
|
/** The context a run's step plans and applies with: the spec's `labels.Env`, else the wave's name, and the run's target as the component. */
|
|
69
88
|
export declare function opWaveStepContext(spec: Pick<OpWavesSpec, "labels">, wave: Pick<OpWave, "name">, run: OpWaveRun): DeployContext;
|
|
70
89
|
/**
|
|
@@ -87,8 +106,23 @@ export interface OpWaveStepPlan {
|
|
|
87
106
|
destructive: boolean;
|
|
88
107
|
/** The run's lock grain and rows (#4552), which the apply leases on the resource grain. */
|
|
89
108
|
lock?: PlannedLock;
|
|
109
|
+
/** Set when the wave planned `together` (#4842): the one plan every run of it shares. */
|
|
110
|
+
group?: OpWaveStepGroup;
|
|
111
|
+
}
|
|
112
|
+
/** A wave's plan in one `planGroup` call (#4842), shared by each of its runs' plans. */
|
|
113
|
+
export interface OpWaveStepGroup {
|
|
114
|
+
/** The group digest (`groupDigest`): the capability's digest of the whole, with each run's member and plan digest. */
|
|
115
|
+
digest: string;
|
|
116
|
+
/** What `planGroup` gave for `runGroup`. */
|
|
117
|
+
artifact?: unknown;
|
|
118
|
+
/** Each run's plan as the capability gave it, by target. */
|
|
119
|
+
plans: Record<string, CapabilityPlan>;
|
|
90
120
|
}
|
|
91
|
-
/**
|
|
121
|
+
/** The digest member a wave planned `together` adds (#4842): no run has this name. */
|
|
122
|
+
export declare const OP_WAVE_TOGETHER_MEMBER = "(wave plan)";
|
|
123
|
+
/** The release that has `discover` with a `step`, and `together` waves (#4842). */
|
|
124
|
+
export declare const OP_WAVE_STEP_WAVE_FLOOR = "0.124.79";
|
|
125
|
+
/** Whether a part changes nothing, and whether it destroys or replaces something. A plan that changes only outputs changes something (#4849). */
|
|
92
126
|
export declare function partEffects(part: ChangeSetPart | undefined): {
|
|
93
127
|
empty: boolean;
|
|
94
128
|
destructive: boolean;
|
|
@@ -102,7 +136,59 @@ export declare function planOpWaveStep(at: {
|
|
|
102
136
|
planPath: string;
|
|
103
137
|
lockGrain?: LockGrain | null;
|
|
104
138
|
policyBase?: string;
|
|
139
|
+
processEnv?: Record<string, string>;
|
|
140
|
+
afterInit?: () => Promise<void>;
|
|
105
141
|
}, run: OpWaveRun): Promise<OpWaveStepPlan>;
|
|
142
|
+
/**
|
|
143
|
+
* The runs of a `discover` wave through the spec's step (#4842): what the
|
|
144
|
+
* capability's `discoverRuns` finds for wave `k`, each a run of the spec's
|
|
145
|
+
* op, and how many waves it found.
|
|
146
|
+
*/
|
|
147
|
+
export declare function discoverOpWaveStepRuns(at: {
|
|
148
|
+
spec: OpWavesSpec;
|
|
149
|
+
wave: OpWave;
|
|
150
|
+
k: number;
|
|
151
|
+
registry: CapabilityRegistry;
|
|
152
|
+
}): Promise<{
|
|
153
|
+
runs: OpWaveRun[];
|
|
154
|
+
waves?: number;
|
|
155
|
+
}>;
|
|
156
|
+
/**
|
|
157
|
+
* Plan a `together` wave's runs in one `planGroup` call (#4842), writing
|
|
158
|
+
* each run's plan file at `planPath(target)` (relative to `cwd`). Each run's
|
|
159
|
+
* plan carries the group. Throws when the call does or leaves a run out, and
|
|
160
|
+
* on a run's plan as {@link planOpWaveStep} does.
|
|
161
|
+
*/
|
|
162
|
+
export declare function planOpWaveStepGroup(at: {
|
|
163
|
+
spec: OpWavesSpec;
|
|
164
|
+
wave: OpWave;
|
|
165
|
+
cwd: string;
|
|
166
|
+
registry: CapabilityRegistry;
|
|
167
|
+
planPath: (target: string) => string;
|
|
168
|
+
lockGrain?: LockGrain | null;
|
|
169
|
+
policyBase?: string;
|
|
170
|
+
/** Each run's environment and check after init, from the run hooks. */
|
|
171
|
+
runCtx?: (target: string) => {
|
|
172
|
+
processEnv?: Record<string, string>;
|
|
173
|
+
afterInit?: () => Promise<void>;
|
|
174
|
+
};
|
|
175
|
+
}, runs: readonly OpWaveRun[]): Promise<OpWaveStepPlan[]>;
|
|
176
|
+
/**
|
|
177
|
+
* Apply a `together` wave's runs in one `runGroup` call (#4842), with the
|
|
178
|
+
* plan the gate decided. Each run's outcome, in the order given: `applied`
|
|
179
|
+
* and `no-changes` applied, with the member's outputs; `partial`, `failed`
|
|
180
|
+
* and `not-started` failed. A throw fails every run, or moves every run
|
|
181
|
+
* when it is a moved plan (`isPlanMovedError`).
|
|
182
|
+
*/
|
|
183
|
+
export declare function applyOpWaveStepGroup(at: {
|
|
184
|
+
spec: OpWavesSpec;
|
|
185
|
+
wave: OpWave;
|
|
186
|
+
registry: CapabilityRegistry;
|
|
187
|
+
runEnv?: (target: string) => Record<string, string> | undefined;
|
|
188
|
+
}, runs: ReadonlyArray<{
|
|
189
|
+
run: OpWaveRun;
|
|
190
|
+
plan: OpWaveStepPlan;
|
|
191
|
+
}>): Promise<OpWaveStepApply[]>;
|
|
106
192
|
/** How one run's apply through its step came out, with what the capability knew about it (#4555). */
|
|
107
193
|
export type OpWaveStepApply = ({
|
|
108
194
|
outcome: "applied";
|
|
@@ -132,6 +218,7 @@ export declare function applyOpWaveStep(at: {
|
|
|
132
218
|
spec: OpWavesSpec;
|
|
133
219
|
wave: OpWave;
|
|
134
220
|
registry: CapabilityRegistry;
|
|
221
|
+
processEnv?: Record<string, string>;
|
|
135
222
|
}, run: OpWaveRun, plan: OpWaveStepPlan): Promise<OpWaveStepApply>;
|
|
136
223
|
/** The wave's change-set document (#4551) from its runs' parts, or undefined when no run gave one. */
|
|
137
224
|
export declare function opWaveStepChangeSet(plans: readonly OpWaveStepPlan[]): ChangeSetDocument | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"op-waves-capability.d.ts","sourceRoot":"","sources":["../../src/op/op-waves-capability.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"op-waves-capability.d.ts","sourceRoot":"","sources":["../../src/op/op-waves-capability.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsEG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,kBAAkB,EAAE,aAAa,EAA6B,MAAM,0BAA0B,CAAC;AAEzI,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAoB,KAAK,iBAAiB,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAI7F,OAAO,KAAK,EAAE,cAAc,EAAiB,MAAM,gBAAgB,CAAC;AACpE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC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