@intentius/sql-yodeler 0.13.5 → 0.15.1

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 (58) hide show
  1. package/dist/ci/image-set.d.ts +75 -0
  2. package/dist/ci/image-set.js +124 -0
  3. package/dist/ci/image-set.js.map +1 -0
  4. package/dist/ci/login.d.ts +6 -0
  5. package/dist/ci/login.js +11 -0
  6. package/dist/ci/login.js.map +1 -1
  7. package/dist/ci/pipeline.d.ts +116 -0
  8. package/dist/ci/pipeline.js +271 -0
  9. package/dist/ci/pipeline.js.map +1 -0
  10. package/dist/ci/render.d.ts +52 -4
  11. package/dist/ci/render.js +245 -15
  12. package/dist/ci/render.js.map +1 -1
  13. package/dist/ci-words.d.ts +11 -1
  14. package/dist/ci-words.js +9 -0
  15. package/dist/ci-words.js.map +1 -1
  16. package/dist/commands/chant.js +4 -2
  17. package/dist/commands/chant.js.map +1 -1
  18. package/dist/commands/ci.js +30 -1
  19. package/dist/commands/ci.js.map +1 -1
  20. package/dist/commands/config.js +2 -0
  21. package/dist/commands/config.js.map +1 -1
  22. package/dist/commands/index.js +5 -0
  23. package/dist/commands/index.js.map +1 -1
  24. package/dist/commands/plan.js +28 -4
  25. package/dist/commands/plan.js.map +1 -1
  26. package/dist/commands/report.d.ts +2 -2
  27. package/dist/commands/report.js +3 -2
  28. package/dist/commands/report.js.map +1 -1
  29. package/dist/commands/stages.d.ts +9 -0
  30. package/dist/commands/stages.js +122 -0
  31. package/dist/commands/stages.js.map +1 -0
  32. package/dist/config/define.d.ts +223 -1
  33. package/dist/config/define.js +3 -0
  34. package/dist/config/define.js.map +1 -1
  35. package/dist/config/load.d.ts +6 -0
  36. package/dist/config/load.js +74 -7
  37. package/dist/config/load.js.map +1 -1
  38. package/dist/config/vocabulary.d.ts +28 -0
  39. package/dist/config/vocabulary.js +73 -0
  40. package/dist/config/vocabulary.js.map +1 -0
  41. package/dist/image-digests.json +4 -0
  42. package/dist/pr/note.d.ts +14 -1
  43. package/dist/pr/note.js +19 -3
  44. package/dist/pr/note.js.map +1 -1
  45. package/dist/project.d.ts +10 -3
  46. package/dist/project.js +8 -2
  47. package/dist/project.js.map +1 -1
  48. package/dist/report/chant-audit.d.ts +22 -0
  49. package/dist/report/chant-audit.js +30 -0
  50. package/dist/report/chant-audit.js.map +1 -0
  51. package/dist/report/jsonl.d.ts +16 -13
  52. package/dist/report/jsonl.js +26 -19
  53. package/dist/report/jsonl.js.map +1 -1
  54. package/dist/schemas.d.ts +1 -1
  55. package/dist/waves/index.js +21 -4
  56. package/dist/waves/index.js.map +1 -1
  57. package/package.json +8 -8
  58. package/schemas/report.schema.json +27 -1
@@ -0,0 +1,271 @@
1
+ /**
2
+ * The environments as stages of chant's pipeline (#384): `.chant/pipeline.ts`
3
+ * from yodel.config.ts, with chant's helpers.
4
+ *
5
+ * `ci.promotion` turns it on. yodel maps its config onto the stage keys of
6
+ * chant's vocabulary and hands them to chant's `pipelineFromConfig`, which
7
+ * writes the declaration; `pipelineSource` writes the file's text and
8
+ * `checkPipelineFile` is what `yodel ci --check` runs on it. Each stage's
9
+ * one wave is the environment's wave as `waves` and the sql lexicon's
10
+ * `sql-migrate` step have it today, so the gate, the approval mode, the
11
+ * tenant runs and the steps around apply stay yodel's keys.
12
+ *
13
+ * The merge applies the first stage. Its op-waves spec, which yodel commits
14
+ * as `yodel-waves.json` and every wave job reads at the base commit, is the
15
+ * first stage's spec from the folded file (`stageWavesSpec`), under the op
16
+ * name the ledger has held since the waves began, `yodel-apply`, so
17
+ * approvals keep counting. The last wave cuts a release (`yodel chant release
18
+ * cut`), and each later stage takes it through `yodel promote --to <env>`,
19
+ * whose gate chant reads from the folded file at the default branch.
20
+ *
21
+ * Everything here maps config. The gates, the risk score, the soak, the
22
+ * holds, the sets and the refusal of `onVerifyFail: "rollback"` on a
23
+ * `sql-migrate` stage are chant's.
24
+ */
25
+ import { CI_SOAK_CHECK_KINDS } from "../config/define.js";
26
+ /** The committed file chant folds. */
27
+ export const PIPELINE_TS = ".chant/pipeline.ts";
28
+ /** What the file's header names: the product, its config and the command that writes it again. */
29
+ export const PIPELINE_SOURCE_OPTIONS = { product: "yodel", config: "yodel.config.ts", command: "yodel ci" };
30
+ /** Whether the project's environments are chant pipeline stages: `ci.promotion` is set. */
31
+ export const pipelineOn = (ci) => ci?.promotion !== undefined;
32
+ /** The line `chant.config.ts` carries under `ci.promotion`, so the merge's release cut waits for the merge commit's checks on the forge (#395). */
33
+ export const RELEASE_GREEN_LINE = 'release: { green: "forge-checks" }';
34
+ /**
35
+ * What `yodel ci` tells a project under `ci.promotion` whose
36
+ * `chant.config.ts` names no `release.green`, or undefined. The merge's
37
+ * last wave of the first stage cuts the release (`release cut auto --yes
38
+ * --wait-checks`), and without `release.green` chant picks the gate: `chant`
39
+ * (a `ci/green/<sha>` tag the merge never writes) once the repository holds
40
+ * any `ci/green/` tag, else `forge-checks`. yodel does not write
41
+ * `chant.config.ts`, so it names the line. A project that sets
42
+ * `release.green` itself, or turns the cut off, hears nothing.
43
+ */
44
+ export function releaseGreenNote(ci, chantConfig) {
45
+ if (!pipelineOn(ci) || ci?.release?.cut === false)
46
+ return undefined;
47
+ const green = isRecord(chantConfig.release) ? chantConfig.release.green : undefined;
48
+ if (green !== undefined)
49
+ return undefined;
50
+ return `chant.config.ts: set ${RELEASE_GREEN_LINE} in it, so the release cut on merge waits for the merge commit's checks on the forge`;
51
+ }
52
+ /** The stage keys yodel reads under `ci.environments.<env>`, in camelCase. */
53
+ export const STAGE_KEYS = [
54
+ "hold",
55
+ "freeze",
56
+ "failureTolerance",
57
+ "approvalRules",
58
+ "risk",
59
+ "soak",
60
+ "canary",
61
+ "onVerifyFail",
62
+ "after",
63
+ "queue",
64
+ "urgent",
65
+ "pauseAfterRollback",
66
+ "publish",
67
+ "reads",
68
+ "config",
69
+ "secrets",
70
+ "imports",
71
+ ];
72
+ /** `value` without the keys `keys`. */
73
+ const omit = (value, keys) => Object.fromEntries(Object.entries(value).filter(([k]) => !keys.includes(k)));
74
+ const isRecord = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
75
+ /**
76
+ * What is wrong with the pipeline keys of `ci`, as yodel reads them, or
77
+ * undefined. `waves` is the waves' environments in order. The values are
78
+ * chant's to check when `yodel ci` writes the file; here are the rules that
79
+ * are yodel's: the promotion order is the waves' order, a stage is one of
80
+ * them, a key is a stage key, and a soak check is of a kind a SQL project
81
+ * has a reader for.
82
+ */
83
+ export function pipelineConfigProblem(ci, waves, where) {
84
+ const promotion = ci.promotion;
85
+ const stageKeys = ["environments", "approvalRules", "risk", "configSets", "release", "recheck"].filter((k) => ci[k] !== undefined);
86
+ if (promotion === undefined) {
87
+ // Without a pipeline, the sets reach the wave jobs and the risk score the plan note; the rest are stage keys.
88
+ const only = stageKeys.filter((k) => k !== "risk" && k !== "configSets" && k !== "environments");
89
+ if (only.length > 0)
90
+ return `${where}.${String(only[0])}: a pipeline key, read with ci.promotion; set ci.promotion to the environments in order`;
91
+ const envs = ci.environments;
92
+ if (envs === undefined)
93
+ return undefined;
94
+ if (!isRecord(envs))
95
+ return `${where}.environments: a map of stage settings, keyed by environment`;
96
+ for (const [env, stage] of Object.entries(envs)) {
97
+ const at = `${where}.environments.${env}`;
98
+ if (waves && !waves.includes(env))
99
+ return `${at}: ${env} has no wave (waves: ${waves.join(", ")})`;
100
+ const problem = stageProblem(stage, at);
101
+ if (problem)
102
+ return problem;
103
+ const staged = Object.keys(stage).filter((k) => !["config", "secrets", "imports", "risk"].includes(k));
104
+ if (staged.length > 0)
105
+ return `${at}.${String(staged[0])}: a stage key, read with ci.promotion; set ci.promotion to the environments in order`;
106
+ }
107
+ return undefined;
108
+ }
109
+ if (!Array.isArray(promotion) || promotion.length === 0 || !promotion.every((e) => typeof e === "string" && e !== ""))
110
+ return `${where}.promotion: the environments in promotion order, a list of names`;
111
+ if (waves && (promotion.length !== waves.length || promotion.some((e, i) => e !== waves[i]))) {
112
+ return `${where}.promotion: ${promotion.join(", ")}; the waves apply ${waves.join(", ")}, and the promotion order is the waves' order`;
113
+ }
114
+ const envs = ci.environments;
115
+ if (envs !== undefined) {
116
+ if (!isRecord(envs))
117
+ return `${where}.environments: a map of stage settings, keyed by environment`;
118
+ for (const [env, stage] of Object.entries(envs)) {
119
+ const at = `${where}.environments.${env}`;
120
+ if (!promotion.includes(env))
121
+ return `${at}: ${env} is not a stage (ci.promotion: ${promotion.join(", ")})`;
122
+ const problem = stageProblem(stage, at);
123
+ if (problem)
124
+ return problem;
125
+ }
126
+ }
127
+ for (const key of ["approvalRules"])
128
+ if (ci[key] !== undefined && !Array.isArray(ci[key]))
129
+ return `${where}.${key}: a list of approval rules`;
130
+ const release = ci.release;
131
+ if (release !== undefined && !(isRecord(release) && Object.keys(release).every((k) => k === "cut" || k === "label") && (release.cut === undefined || typeof release.cut === "boolean") && (release.label === undefined || typeof release.label === "string"))) {
132
+ return `${where}.release: { cut?: true or false, label?: a label, or "auto" }`;
133
+ }
134
+ const recheck = ci.recheck;
135
+ if (recheck !== undefined && !(isRecord(recheck) && Object.keys(recheck).every((k) => k === "schedule") && typeof recheck.schedule === "string" && recheck.schedule.trim().split(/\s+/).length === 5)) {
136
+ return `${where}.recheck: { schedule } with a five-field cron, such as { schedule: "*/15 * * * *" }`;
137
+ }
138
+ return undefined;
139
+ }
140
+ /** One stage's settings: the stage keys, and soak checks of the kinds a SQL project reads. */
141
+ function stageProblem(stage, at) {
142
+ if (!isRecord(stage))
143
+ return `${at}: a map of stage settings`;
144
+ for (const k of Object.keys(stage))
145
+ if (!STAGE_KEYS.includes(k))
146
+ return `${at}.${k}: unknown stage setting (expected ${STAGE_KEYS.join(", ")})`;
147
+ const soak = stage.soak;
148
+ if (soak !== undefined) {
149
+ if (!isRecord(soak) || typeof soak.duration !== "string")
150
+ return `${at}.soak: { duration, checks?, overrides? }, such as { duration: "30m", checks: [...] }`;
151
+ const lists = [soak.checks, ...(Array.isArray(soak.overrides) ? soak.overrides.map((o) => (isRecord(o) ? o.checks : undefined)) : [])];
152
+ for (const list of lists) {
153
+ if (list === undefined)
154
+ continue;
155
+ if (!Array.isArray(list))
156
+ return `${at}.soak.checks: a list of checks`;
157
+ for (const check of list) {
158
+ const kind = isRecord(check) ? check.kind : undefined;
159
+ if (!CI_SOAK_CHECK_KINDS.includes(kind)) {
160
+ return `${at}.soak: a check of kind ${JSON.stringify(kind)}; a SQL stage soaks on ${CI_SOAK_CHECK_KINDS.join(", ")} checks${kind === "health" ? " (the sql lexicon has no lifecycle health reader)" : ""}`;
161
+ }
162
+ }
163
+ }
164
+ }
165
+ const risk = stage.risk;
166
+ if (risk !== undefined && !(isRecord(risk) && Object.keys(risk).every((k) => k === "approveAbove" || k === "approvalRules")))
167
+ return `${at}.risk: { approveAbove?, approvalRules? }`;
168
+ return undefined;
169
+ }
170
+ const ruleOf = (r) => ("all" in r ? { ...r, all: r.all.map(ruleOf) } : "any" in r ? { ...r, any: r.any.map(ruleOf) } : { ...r });
171
+ /** The quorum rules a stage's `risk.approvalRules` adds over its score, as chant's `holds.risk.quorum` takes them. */
172
+ function riskQuorum(rules) {
173
+ if (!rules || rules.length === 0)
174
+ return undefined;
175
+ return rules.map((r) => ({ ...(r.name !== undefined ? { name: r.name } : {}), count: r.count, ...(r.roles ? { roles: [...r.roles] } : {}), ...(r.notAuthor ? { notAuthor: true } : {}), ...(r.proven ? { proven: true } : {}) }));
176
+ }
177
+ /** A stage's `holds.risk`: its own `risk`, else `ci.risk.approveAbove` for every stage. */
178
+ export function stageRisk(ci, env) {
179
+ const own = ci.environments?.[env]?.risk;
180
+ const approveAbove = own?.approveAbove ?? ci.risk?.approveAbove;
181
+ const quorum = riskQuorum(own?.approvalRules);
182
+ if (approveAbove === undefined && quorum === undefined)
183
+ return undefined;
184
+ return { ...(approveAbove !== undefined ? { approveAbove } : {}), ...(quorum ? { quorum } : {}) };
185
+ }
186
+ /** A stage's `risk` as chant's `pipelineFromConfig` reads it: its own keys, with `ci.risk.approveAbove` where the stage sets no threshold. */
187
+ export function stageRiskConfig(ci, env) {
188
+ const own = ci.environments?.[env]?.risk;
189
+ const approveAbove = own?.approveAbove ?? ci.risk?.approveAbove;
190
+ const rules = own?.approvalRules && own.approvalRules.length > 0 ? own.approvalRules.map(ruleOf) : undefined;
191
+ if (approveAbove === undefined && rules === undefined)
192
+ return undefined;
193
+ return { ...(approveAbove !== undefined ? { approveAbove } : {}), ...(rules ? { approvalRules: rules } : {}) };
194
+ }
195
+ /** The pipeline's declaration from yodel.config.ts, through chant's `pipelineFromConfig`. Throws what chant refuses. */
196
+ export async function pipelineDeclaration(input) {
197
+ const { pipelineFromConfig, verifyRollbackProblems } = await import("@intentius/chant/pipeline");
198
+ const { ci } = input;
199
+ const promotion = ci.promotion ?? [];
200
+ const { waves } = input.spec;
201
+ const defaults = omit(input.spec, ["name", "waves"]);
202
+ const byEnv = Object.fromEntries(promotion.map((env) => [env, waves.filter((w) => w.name === env)]));
203
+ const environments = Object.fromEntries(promotion.map((env) => {
204
+ const stage = ci.environments?.[env] ?? {};
205
+ const { approvalRules } = stage;
206
+ const keys = omit(stage, ["risk", "approvalRules", "config", "secrets", "imports"]);
207
+ // The risk keys (chant's `environments.<name>.risk`): the stage's own, else `ci.risk.approveAbove`; chant puts them on the gate's `holds.risk`.
208
+ const risk = stageRiskConfig(ci, env);
209
+ return [env, { ...keys, ...(approvalRules ? { approvalRules: approvalRules.map(ruleOf) } : {}), ...(risk ? { risk } : {}) }];
210
+ }));
211
+ const declaration = pipelineFromConfig({
212
+ name: input.name,
213
+ promotion,
214
+ environments: environments,
215
+ ...(ci.approvalRules ? { approvalRules: ci.approvalRules.map(ruleOf) } : {}),
216
+ waves: byEnv,
217
+ defaults,
218
+ release: { ...(ci.release?.cut !== undefined ? { cut: ci.release.cut } : {}), ...(ci.release?.label !== undefined ? { label: ci.release.label } : {}), bin: [...input.bin] },
219
+ ...(ci.recheck ? { recheck: { schedule: ci.recheck.schedule } } : {}),
220
+ });
221
+ // chant refuses onVerifyFail: "rollback" on a stage that applies a sql-migrate step: a migration that ran stays run.
222
+ const step = defaults.step;
223
+ const refused = verifyRollbackProblems({ spec: declaration, steps: step?.kind ? [{ where: "defaults.step", kind: step.kind }] : [], capability: () => undefined });
224
+ if (refused.length > 0)
225
+ throw new Error(`yodel.config.ts: ci.environments: ${refused.join("; ")}`);
226
+ return declaration;
227
+ }
228
+ /** The text of `.chant/pipeline.ts` for `declaration`, chant's `pipelineSource`. */
229
+ export async function pipelineText(declaration) {
230
+ const { pipelineSource } = await import("@intentius/chant/pipeline");
231
+ return pipelineSource(declaration, PIPELINE_SOURCE_OPTIONS);
232
+ }
233
+ /**
234
+ * The first stage's op-waves spec from the folded text: what the merge
235
+ * applies. It keeps the op name the ledger holds the waves under, `name`.
236
+ * Throws when the text does not fold.
237
+ */
238
+ export async function firstStageSpec(text, name) {
239
+ const { foldPipelineSource, pipelineFindingLine, stageWavesSpec } = await import("@intentius/chant/pipeline");
240
+ const folded = foldPipelineSource(text, PIPELINE_TS);
241
+ if ("finding" in folded)
242
+ throw new Error(pipelineFindingLine(PIPELINE_TS, folded.finding));
243
+ const first = folded.spec.stages[0];
244
+ if (!first)
245
+ throw new Error(`${PIPELINE_TS}: the pipeline has no stage`);
246
+ const spec = omit(stageWavesSpec(folded.spec, first.name), ["labels"]);
247
+ return { ...spec, name, waves: spec.waves };
248
+ }
249
+ /** The stages after the first: the ones the promote jobs reach. */
250
+ export const laterStages = (ci) => (ci.promotion ?? []).slice(1);
251
+ /**
252
+ * chant's environment sets from `ci.environments.<env>` and `ci.configSets`,
253
+ * or undefined when no stage names a set. Every wave environment gets a
254
+ * set, an empty one when it names none, since chant refuses an environment
255
+ * the sets leave out.
256
+ */
257
+ export function environmentSetsOf(ci, envs) {
258
+ const named = Object.entries(ci?.environments ?? {}).filter(([, s]) => s.config !== undefined || s.secrets !== undefined || s.imports !== undefined);
259
+ if (named.length === 0 && ci?.configSets === undefined)
260
+ return undefined;
261
+ const set = (s) => ({
262
+ ...(s?.imports ? { imports: [...s.imports] } : {}),
263
+ ...(s?.config ? { config: { ...s.config } } : {}),
264
+ ...(s?.secrets ? { secrets: structuredClone(s.secrets) } : {}),
265
+ });
266
+ return {
267
+ environments: Object.fromEntries(envs.map((env) => [env, set(ci?.environments?.[env])])),
268
+ ...(ci?.configSets ? { configSets: structuredClone(ci.configSets) } : {}),
269
+ };
270
+ }
271
+ //# sourceMappingURL=pipeline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../../src/ci/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,mBAAmB,EAA0D,MAAM,qBAAqB,CAAC;AAElH,sCAAsC;AACtC,MAAM,CAAC,MAAM,WAAW,GAAG,oBAAoB,CAAC;AAEhD,kGAAkG;AAClG,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,OAAO,EAAE,UAAU,EAAW,CAAC;AAErH,2FAA2F;AAC3F,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EAA2C,EAAW,EAAE,CAAC,EAAE,EAAE,SAAS,KAAK,SAAS,CAAC;AAEhH,mJAAmJ;AACnJ,MAAM,CAAC,MAAM,kBAAkB,GAAG,oCAAoC,CAAC;AAEvE;;;;;;;;;GASG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAAuD,EAAE,WAAoC;IAC5H,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,GAAG,KAAK,KAAK;QAAE,OAAO,SAAS,CAAC;IACpE,MAAM,KAAK,GAAG,QAAQ,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IACpF,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC1C,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IAAI,CAAC,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC;IACrJ,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,EAAE,EAAE,UAAU,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACzE,MAAM,GAAG,GAAG,CAAC,CAA4B,EAAE,EAAE,CAAC,CAAC;QAC7C,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAClD,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACjD,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC/D,CAAC,CAAC;IACH,OAAO;QACL,YAAY,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE,YAAY,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACxF,GAAG,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,eAAe,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC1E,CAAC;AACJ,CAAC"}
@@ -71,12 +71,15 @@
71
71
  * needs no token, in IMAGE. With yodel.config.ts `ci.image` (#66), the CI
72
72
  * image ghcr.io/intentius/sql-yodeler pinned by its digest, every job runs
73
73
  * in that image instead, which carries node, yodel, chant and the lexicons
74
- * on PATH, and no job runs `npm ci` ({@link Toolchain}).
74
+ * on PATH, and no job runs `npm ci` ({@link Toolchain}). `ci.imageBase`
75
+ * (sql-yodeler issue 405) names that image from the release's digests, in
76
+ * its Debian or Chainguard set ({@link imageOf}, ./image-set.ts).
75
77
  *
76
78
  * yodel ci renders through chant's product pipeline (chant#4550) with
77
79
  * yodel's words (#289, ../ci-words.ts): {@link productWaves}.
78
80
  */
79
- import { type ApplySteps, type ApprovalMode, type CiEvidence, type CiLogin, type RespondNew, type RespondRebase, type WaveGate } from "../config/define.js";
81
+ import { type ApplySteps, type ApprovalMode, type CiAgentWaveRefused, type CiConfig, type CiEvidence, type CiLogin, type RespondNew, type RespondRebase, type RespondWaveRefused, type WaveGate } from "../config/define.js";
82
+ import type { EnvironmentSets } from "@intentius/chant/components";
80
83
  import type { OpWaveHooks } from "@intentius/chant/op";
81
84
  import { type CloudToken, type Role } from "../credentials.js";
82
85
  import { type CheckHook } from "./check-hooks.js";
@@ -171,6 +174,18 @@ export interface Environments {
171
174
  respondNew?: RespondNew;
172
175
  /** yodel.config.ts `ci.respond.rebase` (#313): what answers `/yodel rebase`. Default `comment`, or `off` when a reader's password is cloud-minted. */
173
176
  respondRebase?: RespondRebase;
177
+ /** yodel.config.ts `ci.respond.wave-refused`: whether a wave that applied nothing posts chant's diff of the plan. Unset, the spec says nothing and chant's default answers. */
178
+ respondWaveRefused?: RespondWaveRefused;
179
+ /** yodel.config.ts `ci.agent["wave-refused"]`: the model run of `respond.wave-refused: "summary"`. */
180
+ agentWaveRefused?: CiAgentWaveRefused;
181
+ /**
182
+ * yodel.config.ts `ci` with `ci.promotion` set (#384): the environments are
183
+ * stages of chant's pipeline, `.chant/pipeline.ts` is written from it, the
184
+ * merge applies the first stage and the promote jobs the rest.
185
+ */
186
+ pipeline?: CiConfig;
187
+ /** chant's environment sets from `ci.environments.<env>` and `ci.configSets` (#384): each wave job and promote job gets its stage's set. */
188
+ environmentSets?: EnvironmentSets;
174
189
  }
175
190
  /** yodel's checks and the project's tools as check-hook presets for `forge` (#294). */
176
191
  export declare function checkHooksOf(envs_: Environments): CheckHook[];
@@ -379,6 +394,18 @@ interface WavesSpec {
379
394
  idTokens?: Record<string, string>;
380
395
  hooks?: OpWaveHooks;
381
396
  }>;
397
+ /** The responses a wave job posts (chant's `respond`): `wave-refused` as `ci.respond.wave-refused` sets it; absent when the project leaves it unset, so the rendered files are as before. */
398
+ respond?: {
399
+ "wave-refused": RespondWaveRefused;
400
+ };
401
+ /** chant's `waveSummary`, the model run of `wave-refused: summary`: `ci.agent["wave-refused"]` mapped onto chant's field names. Present with that mode only. */
402
+ waveSummary?: {
403
+ command?: string;
404
+ keyEnv?: string;
405
+ timeout?: number;
406
+ maxRuns?: number;
407
+ maxCostUsd?: number;
408
+ };
382
409
  /** The scheduled resume job (yodel.config.ts `ci.resume`); only the pipelines are rendered from it, the spec file leaves it out. */
383
410
  resume?: {
384
411
  schedule: string;
@@ -412,7 +439,7 @@ export interface WaveJobSettings {
412
439
  */
413
440
  export declare function wavesSpec(waves: readonly Wave[], job?: (env: string) => WaveJobSettings, resume?: {
414
441
  schedule: string;
415
- }): WavesSpec;
442
+ }, waveRefused?: RespondWaveRefused, summary?: CiAgentWaveRefused): WavesSpec;
416
443
  /** The sql lexicon's capability for a versioned environment (chant#4569). */
417
444
  export declare const SQL_MIGRATE = "sql-migrate";
418
445
  /**
@@ -426,6 +453,26 @@ export declare const SQL_MIGRATE = "sql-migrate";
426
453
  * variables and OIDC tokens in the spec.
427
454
  */
428
455
  export declare function applyPipelines(dir: string, envs: Environments, product: ChantProduct): Promise<RenderedFile[]>;
456
+ /**
457
+ * The job's token a GitHub or Forgejo wave job's command gets, with the
458
+ * scopes it needs beside chant's own, or undefined for none. A refused
459
+ * wave's diff is posted with it: pull request comments, and the tracking
460
+ * issue a wave with no pull request uses. With `ci.promotion` the first
461
+ * stage's last wave cuts the release, and under `release.green:
462
+ * "forge-checks"` (chant's default without `ci.green`) the cut reads the
463
+ * merge commit's checks and statuses with it (#395).
464
+ */
465
+ export declare function commandToken(forge: Forge, respondWaveRefused: RespondWaveRefused | undefined, pipeline: CiConfig | undefined): {
466
+ commandToken: {
467
+ permissions: Record<string, "read" | "write">;
468
+ };
469
+ } | undefined;
470
+ /** The reject comment workflow's job (#384). */
471
+ export declare const REJECT_JOB = "reject";
472
+ /** Where the promote jobs go on GitLab: their own file, which `.gitlab-ci.yml` includes. */
473
+ export declare const GITLAB_PROMOTE_FILE = ".gitlab/yodel-apply-promote.gitlab-ci.yml";
474
+ /** The stage chant's GitLab promote jobs run in: they name none, so GitLab's default. */
475
+ export declare const PROMOTE_STAGE = "test";
429
476
  /** yodel.config.ts `waves`, checked against the environments; one wave per environment, gate `always`, without it. */
430
477
  export declare function readWaves(dir: string, envs: readonly string[]): Promise<Wave[]>;
431
478
  /**
@@ -541,11 +588,12 @@ export declare function requireProduct(): Promise<ChantProduct>;
541
588
  * check hooks into when the project has none on disk: the one `yodel
542
589
  * upgrade` adds (#298). A project with no declaration, in its directory or
543
590
  * given here, keeps the lint job's own steps ({@link checkHooksDeclaration}).
544
- * `options.respondNew` and `options.respondRebase` stand in for yodel.config.ts `ci.respond`.
591
+ * `options.respondNew`, `options.respondRebase` and `options.respondWaveRefused` stand in for yodel.config.ts `ci.respond`.
545
592
  */
546
593
  export declare function render(dir: string, options?: {
547
594
  declaration?: RenderedFile;
548
595
  respondNew?: RespondNew;
549
596
  respondRebase?: RespondRebase;
597
+ respondWaveRefused?: RespondWaveRefused;
550
598
  }): Promise<RenderedFile[]>;
551
599
  export {};