@intentius/chant 0.124.14 → 0.124.15

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 (110) hide show
  1. package/dist/build.d.ts +6 -0
  2. package/dist/build.d.ts.map +1 -1
  3. package/dist/build.js +1 -0
  4. package/dist/change-set.d.ts +24 -2
  5. package/dist/change-set.d.ts.map +1 -1
  6. package/dist/change-set.js +50 -1
  7. package/dist/ci-jobs.d.ts +227 -0
  8. package/dist/ci-jobs.d.ts.map +1 -0
  9. package/dist/ci-jobs.js +448 -0
  10. package/dist/components/pr-pipeline.d.ts.map +1 -1
  11. package/dist/components/pr-pipeline.js +3 -2
  12. package/dist/composite.d.ts +10 -2
  13. package/dist/composite.d.ts.map +1 -1
  14. package/dist/composite.js +8 -0
  15. package/dist/discovery/collect.d.ts +2 -1
  16. package/dist/discovery/collect.d.ts.map +1 -1
  17. package/dist/discovery/collect.js +16 -1
  18. package/dist/discovery/fold-import.d.ts.map +1 -1
  19. package/dist/discovery/fold-import.js +2 -107
  20. package/dist/discovery/host-composite.d.ts +35 -0
  21. package/dist/discovery/host-composite.d.ts.map +1 -0
  22. package/dist/discovery/host-composite.js +93 -0
  23. package/dist/discovery/index.d.ts +9 -0
  24. package/dist/discovery/index.d.ts.map +1 -1
  25. package/dist/discovery/index.js +1 -1
  26. package/dist/gate-decision.d.ts +20 -9
  27. package/dist/gate-decision.d.ts.map +1 -1
  28. package/dist/gate-decision.js +72 -19
  29. package/dist/lifecycle/gate-audit.d.ts +69 -2
  30. package/dist/lifecycle/gate-audit.d.ts.map +1 -1
  31. package/dist/lifecycle/gate-audit.js +76 -2
  32. package/dist/lifecycle/gate-ledger.d.ts +24 -0
  33. package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
  34. package/dist/lifecycle/gate-ledger.js +9 -1
  35. package/dist/op/activities/activity-contracts.d.ts +1 -1
  36. package/dist/op/activities/activity-contracts.js +1 -1
  37. package/dist/op/activities/change-set.d.ts +8 -3
  38. package/dist/op/activities/change-set.d.ts.map +1 -1
  39. package/dist/op/activities/change-set.js +5 -2
  40. package/dist/op/activities/reconcile.d.ts +28 -16
  41. package/dist/op/activities/reconcile.d.ts.map +1 -1
  42. package/dist/op/activities/reconcile.js +34 -20
  43. package/dist/op/builders.d.ts +1 -1
  44. package/dist/op/builders.d.ts.map +1 -1
  45. package/dist/op/builders.js +1 -1
  46. package/dist/op/op-waves-run.d.ts +1 -1
  47. package/dist/op/op-waves-run.d.ts.map +1 -1
  48. package/dist/op/op-waves-run.js +3 -3
  49. package/dist/workspace/__fixtures__/contract-repo.d.ts +7 -0
  50. package/dist/workspace/__fixtures__/contract-repo.d.ts.map +1 -1
  51. package/dist/workspace/__fixtures__/contract-repo.js +17 -1
  52. package/dist/workspace/__fixtures__/sessions.d.ts +1 -1
  53. package/dist/workspace/__fixtures__/sessions.d.ts.map +1 -1
  54. package/dist/workspace/__fixtures__/sessions.js +3 -3
  55. package/dist/workspace/change-set.schema.json +5 -3
  56. package/dist/workspace/ci-green-workflow.d.ts +3 -1
  57. package/dist/workspace/ci-green-workflow.d.ts.map +1 -1
  58. package/dist/workspace/ci-green-workflow.js +5 -2
  59. package/dist/workspace/class-data.d.ts +84 -0
  60. package/dist/workspace/class-data.d.ts.map +1 -0
  61. package/dist/workspace/class-data.js +238 -0
  62. package/dist/workspace/kinds.d.ts +3 -7
  63. package/dist/workspace/kinds.d.ts.map +1 -1
  64. package/dist/workspace/kinds.js +6 -40
  65. package/dist/workspace/principal-classes.d.ts +4 -11
  66. package/dist/workspace/principal-classes.d.ts.map +1 -1
  67. package/dist/workspace/principal-classes.js +11 -94
  68. package/package.json +1 -1
  69. package/src/build.ts +8 -0
  70. package/src/change-set.test.ts +48 -0
  71. package/src/change-set.ts +52 -2
  72. package/src/ci-jobs.test.ts +49 -0
  73. package/src/ci-jobs.ts +515 -0
  74. package/src/components/pr-pipeline.ts +3 -2
  75. package/src/composite.ts +15 -3
  76. package/src/discovery/collect.ts +15 -1
  77. package/src/discovery/fold-build-parity.test.ts +71 -0
  78. package/src/discovery/fold-import.ts +2 -113
  79. package/src/discovery/fold-project-provenance.test.ts +21 -4
  80. package/src/discovery/host-composite.ts +101 -0
  81. package/src/discovery/index.ts +11 -1
  82. package/src/gate-decision-bundle.test.ts +5 -4
  83. package/src/gate-decision-identity.test.ts +59 -6
  84. package/src/gate-decision.ts +81 -21
  85. package/src/lifecycle/gate-audit.test.ts +55 -1
  86. package/src/lifecycle/gate-audit.ts +116 -3
  87. package/src/lifecycle/gate-ledger.test.ts +20 -1
  88. package/src/lifecycle/gate-ledger.ts +33 -1
  89. package/src/op/activities/activity-contracts.ts +1 -1
  90. package/src/op/activities/change-set.ts +11 -3
  91. package/src/op/activities/lexicon-upgrade.test.ts +2 -0
  92. package/src/op/activities/reconcile.test.ts +62 -2
  93. package/src/op/activities/reconcile.ts +46 -22
  94. package/src/op/builders.ts +1 -1
  95. package/src/op/op-waves-run.ts +4 -3
  96. package/src/op/op-waves.test.ts +2 -0
  97. package/src/op/work-lease-run.test.ts +12 -4
  98. package/src/workspace/__fixtures__/contract-repo.ts +17 -1
  99. package/src/workspace/__fixtures__/sessions.ts +3 -3
  100. package/src/workspace/change-set.schema.json +5 -3
  101. package/src/workspace/ci-green-workflow.test.ts +4 -4
  102. package/src/workspace/ci-green-workflow.ts +5 -2
  103. package/src/workspace/class-data.test.ts +64 -0
  104. package/src/workspace/class-data.ts +236 -0
  105. package/src/workspace/kinds.ts +6 -35
  106. package/src/workspace/principal-classes.ts +11 -94
  107. package/src/workspace/records-formats.test.ts +7 -2
  108. package/src/workspace/records-sessions-write.test.ts +3 -3
  109. package/src/workspace/status-contract.e2e.test.ts +37 -0
  110. package/src/workspace/status-contract.test.ts +23 -21
@@ -0,0 +1,448 @@
1
+ /**
2
+ * The job primitives chant's three CI generators share (#3765): the scheduled
3
+ * Op pipeline (`generateOpsPipeline`), the Op waves pipeline
4
+ * (`generateOpWavesPipeline`) and the component pipeline (`chant build
5
+ * --components --generate`, with `--pr-loop`, `--wave-gate` and
6
+ * `--promote-to`). Each forge lexicon builds its documents from these, so a
7
+ * trigger, a token, a permission rule or an image default is decided once:
8
+ *
9
+ * - the image a generated job runs in, {@link CI_IMAGE};
10
+ * - the branches a trigger filters on, {@link triggerBranches};
11
+ * - the job token and secret expressions of GitHub Actions and Forgejo
12
+ * Actions, {@link GITHUB_JOB_TOKEN} and {@link githubSecret};
13
+ * - the `permissions:` a finding-mode needs and the rules for adding to it,
14
+ * {@link permissionsFor} and {@link mergePermissions};
15
+ * - the `setup` steps and `environment` a job may carry, checked once per
16
+ * forge ({@link assertSetupSteps}, {@link assertEnvironment},
17
+ * {@link gitlabSetupScript}, {@link assertGitlabEnvironment});
18
+ * - GitLab's `rules:` expressions and `id_tokens:` declaration.
19
+ *
20
+ * The Forgejo dialect (action refs, dropped `permissions:` and
21
+ * `environment:`, the header note naming what was dropped) is the forgejo
22
+ * lexicon's, in its `components/ci-jobs.ts`, since the transform it applies
23
+ * lives there.
24
+ */
25
+ // ── Every forge ─────────────────────────────────────────────────────────────
26
+ /**
27
+ * The image every generated job runs in unless the caller names another. It
28
+ * carries node and npm, which `chant` needs, and git, which a job that reads
29
+ * the base commit or pushes to `chant/lifecycle` needs (#3789).
30
+ */
31
+ export const CI_IMAGE = "node:22";
32
+ /**
33
+ * The branch a `push` trigger filters on when it names none. A generator
34
+ * works from a spec, not a checkout, so it cannot read a project's real
35
+ * default branch; a project on another one names it.
36
+ */
37
+ export const DEFAULT_BRANCH = "main";
38
+ /**
39
+ * The branches a push trigger filters on: the ones given, or
40
+ * {@link DEFAULT_BRANCH} when none are. An empty list is none, on every
41
+ * forge.
42
+ */
43
+ export function pushBranches(branches) {
44
+ return branches && branches.length > 0 ? [...branches] : [DEFAULT_BRANCH];
45
+ }
46
+ /**
47
+ * The branches a trigger filters on: a `pull_request` trigger's list, or
48
+ * undefined for every branch; a `push` trigger's, with {@link pushBranches}'
49
+ * default; none for `cron`.
50
+ */
51
+ export function triggerBranches(trigger) {
52
+ switch (trigger.kind) {
53
+ case "cron":
54
+ return undefined;
55
+ case "pull_request":
56
+ return trigger.branches && trigger.branches.length > 0 ? [...trigger.branches] : undefined;
57
+ case "push":
58
+ return pushBranches(trigger.branches);
59
+ }
60
+ }
61
+ /** A job id every forge accepts, from a kebab- or camel-cased name. */
62
+ export function ciJobName(name) {
63
+ return name.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
64
+ }
65
+ /** A command template with each `{name}` part filled in. */
66
+ export function fillCommand(template, name) {
67
+ return template.map((part) => part.replace("{name}", name));
68
+ }
69
+ /** `{ [key]: map }` when the map has an entry, else `{}`: for spreading an optional mapping into a document. */
70
+ export function nonEmpty(key, map) {
71
+ return map && Object.keys(map).length > 0 ? { [key]: map } : {};
72
+ }
73
+ /**
74
+ * A job's `environment:` mapping. Always the mapping form, never the string
75
+ * shorthand, so adding a `url` later is a new key rather than a reshaped
76
+ * value. GitHub and GitLab read the same two keys.
77
+ */
78
+ export function environmentDoc(environment) {
79
+ return { name: environment.name, ...(environment.url === undefined ? {} : { url: environment.url }) };
80
+ }
81
+ /** The directory part of a relative path, `.` when there is none. */
82
+ export function dirnameOf(path) {
83
+ const i = path.lastIndexOf("/");
84
+ return i <= 0 ? "." : path.slice(0, i);
85
+ }
86
+ // ── GitHub Actions and Forgejo Actions ──────────────────────────────────────
87
+ /** The runner label a generated job asks for; the Forgejo dialect rewrites it to the project's label. */
88
+ export const GITHUB_RUNNER = "ubuntu-latest";
89
+ /** The job token, which GitHub and Forgejo both mint for every run. */
90
+ export const GITHUB_JOB_TOKEN = "${{ github.token }}";
91
+ /** A repository secret, by name. */
92
+ export function githubSecret(name) {
93
+ return `\${{ secrets.${name} }}`;
94
+ }
95
+ /**
96
+ * A repository secret, or the job token when the secret is unset (#3624). An
97
+ * unset secret reads as the empty string, so a workflow generated for a
98
+ * production token still runs in a fork or a fresh repository, with what the
99
+ * job token may do.
100
+ */
101
+ export function githubSecretOrJobToken(name) {
102
+ return `\${{ secrets.${name} || github.token }}`;
103
+ }
104
+ /** Each name mapped from the repository secret of the same name. */
105
+ export function githubSecretEnv(names) {
106
+ return Object.fromEntries(names.map((n) => [n, githubSecret(n)]));
107
+ }
108
+ /**
109
+ * Least-privilege `permissions:` for a finding-mode. `report` needs no write
110
+ * access; `issue` needs only `issues: write`; `pull-request` (and
111
+ * `merge-request`, generated the same way when a GitLab-authored spec is
112
+ * targeted at github) needs `contents: write` to push the reconcile branch
113
+ * plus `pull-requests: write` to open the PR. `comment` changes nothing in
114
+ * the repository, so its whole scope is `{ contents: read, pull-requests:
115
+ * write }`.
116
+ */
117
+ export function permissionsForMode(mode) {
118
+ switch (mode) {
119
+ case "issue":
120
+ return { contents: "read", issues: "write" };
121
+ case "comment":
122
+ return { contents: "read", "pull-requests": "write" };
123
+ case "pull-request":
124
+ case "merge-request":
125
+ return { contents: "write", "pull-requests": "write" };
126
+ case "report":
127
+ return { contents: "read" };
128
+ }
129
+ }
130
+ /**
131
+ * {@link permissionsForMode} on a trigger. A `pull_request` trigger reports
132
+ * its finding as a comment on the triggering PR itself (#2084): any mode but
133
+ * `report` posts something to act on a finding, so on that trigger every
134
+ * such mode also gets `pull-requests: write` for the comment.
135
+ */
136
+ export function permissionsFor(mode, trigger) {
137
+ const base = permissionsForMode(mode);
138
+ if (trigger.kind === "pull_request" && mode !== "report")
139
+ return { ...base, "pull-requests": "write" };
140
+ return base;
141
+ }
142
+ /**
143
+ * Every scope `GITHUB_TOKEN` accepts in a workflow's `permissions:` mapping,
144
+ * kebab-cased as GitHub spells them. An additive scope outside this set is
145
+ * refused by name rather than emitted: GitHub ignores an unknown key, so
146
+ * `id_token` or `idToken` would generate a workflow that looks like it grants
147
+ * OIDC and hands the run no token at all.
148
+ */
149
+ export const GITHUB_TOKEN_SCOPES = new Set([
150
+ "actions",
151
+ "attestations",
152
+ "checks",
153
+ "contents",
154
+ "deployments",
155
+ "discussions",
156
+ "id-token",
157
+ "issues",
158
+ "models",
159
+ "packages",
160
+ "pages",
161
+ "pull-requests",
162
+ "repository-projects",
163
+ "security-events",
164
+ "statuses",
165
+ ]);
166
+ /**
167
+ * Merge a spec's additive `permissions` over the finding-mode's own set
168
+ * (#2242), refusing by name anything that is not strictly additive:
169
+ *
170
+ * - a blanket `write-all`/`read-all`, in either the key or the value
171
+ * position, which is the exact thing {@link permissionsForMode} exists to
172
+ * avoid;
173
+ * - a scope GitHub does not define ({@link GITHUB_TOKEN_SCOPES}), because
174
+ * GitHub ignores the key and the run silently gets nothing;
175
+ * - a scope the mode already grants, at any value — additive means additive,
176
+ * so this can neither downgrade `contents: write` to read nor restate it.
177
+ * A mode whose set is wrong is fixed by changing the mode, where the
178
+ * scope and the behavior that spends it stay together;
179
+ * - `pull-requests: write` on a trigger with no pull request. Pull-request
180
+ * access is what the finding-modes own: `pull-request` grants it together
181
+ * with the `contents: write` needed to push the branch first, and
182
+ * `comment` grants it on the one trigger that carries a pull request to
183
+ * comment on. Adding it beside a mode that posts nothing, on a cron or
184
+ * push run, grants write access no step in the generated job can spend.
185
+ */
186
+ export function mergePermissions(name, base, additive, trigger) {
187
+ const merged = { ...base };
188
+ for (const [rawScope, value] of Object.entries(additive)) {
189
+ const scope = rawScope.trim();
190
+ const where = `Scheduled Op "${name}" adds permission "${scope}: ${value}"`;
191
+ if (scope === "write-all" || scope === "read-all" || String(value).endsWith("-all")) {
192
+ throw new Error(`${where}, a blanket grant. \`permissions\` on a scheduled Op is additive over the ` +
193
+ `least-privilege set its finding-mode needs, one named scope at a time. Name the scopes the ` +
194
+ `job actually spends (e.g. { "id-token": "write" }).`);
195
+ }
196
+ if (!GITHUB_TOKEN_SCOPES.has(scope)) {
197
+ throw new Error(`${where}, which is not a GITHUB_TOKEN permission scope. GitHub ignores an unrecognized key, so ` +
198
+ `this would emit a workflow that reads as granted and hands the run nothing. Known scopes: ` +
199
+ `${[...GITHUB_TOKEN_SCOPES].sort().join(", ")}.`);
200
+ }
201
+ if (scope in base) {
202
+ throw new Error(`${where}, but its finding-mode already grants "${scope}: ${base[scope]}". These permissions are ` +
203
+ `additive only — they never replace, widen or downgrade a scope the mode computed. Change the ` +
204
+ `Op's findingMode if that set is wrong, and add only scopes no mode grants (e.g. "id-token").`);
205
+ }
206
+ if (scope === "pull-requests" && trigger.kind !== "pull_request") {
207
+ throw new Error(`${where}, but this Op's trigger is "${trigger.kind}", which carries no pull request. Pull-request ` +
208
+ `write access belongs to a finding-mode: "pull-request" grants it with the contents: write its ` +
209
+ `branch push needs, and "comment" grants it on the pull_request trigger. Set findingMode instead ` +
210
+ `of adding the scope here.`);
211
+ }
212
+ merged[scope] = value;
213
+ }
214
+ return merged;
215
+ }
216
+ /**
217
+ * Refs that name an action repository's own default branch. A generated
218
+ * workflow is committed once and then re-run unattended, often over a cloud
219
+ * role, so "whatever was pushed to that repo last" is not a version — the
220
+ * code that assumes the role can change between the run somebody reviewed and
221
+ * the next one. A release channel the action's author cuts deliberately (`v6`,
222
+ * `v6.2.4`, `stable`) or a commit sha is a version, and both pass.
223
+ */
224
+ const DEFAULT_BRANCH_REFS = new Set(["main", "master", "head", "default"]);
225
+ /** `owner/repo` or `owner/repo/subpath`, then `@ref`. */
226
+ const USES_PATTERN = /^([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+)((?:\/[A-Za-z0-9_.-]+)*)@([^\s@]+)$/;
227
+ /**
228
+ * Validate a `setup` list for GitHub or Forgejo Actions (#2242). A `run`
229
+ * entry needs a non-empty line and nothing else. A `uses` entry has to be a
230
+ * pinned `owner/repo[/subpath]@ref`: no bare `owner/repo`, since an unpinned
231
+ * action resolves to its default branch, and no ref in
232
+ * {@link DEFAULT_BRANCH_REFS} for the same reason spelled out loud. Local
233
+ * (`./path`) and container (`docker://`) refs are refused too — they are
234
+ * legal GitHub Actions, but the generator emits a workflow into a repository
235
+ * it has never seen, so it cannot know a local path resolves there.
236
+ */
237
+ export function assertSetupSteps(name, setup) {
238
+ setup.forEach((step, index) => {
239
+ const where = `Scheduled Op "${name}" setup step ${index + 1}`;
240
+ if ("uses" in step) {
241
+ const ref = step.uses.trim();
242
+ const match = USES_PATTERN.exec(ref);
243
+ if (!match) {
244
+ throw new Error(`${where} has \`uses: "${step.uses}"\`, which is not a pinned action reference. ` +
245
+ `Write it as owner/repo@ref (optionally owner/repo/subpath@ref), e.g. ` +
246
+ `"aws-actions/configure-aws-credentials@v6". A local "./path" or "docker://" ref is not ` +
247
+ `accepted here: this generator emits a workflow into a repository it cannot inspect, so it ` +
248
+ `has no way to tell whether such a ref resolves there.`);
249
+ }
250
+ const gitRef = match[4];
251
+ if (DEFAULT_BRANCH_REFS.has(gitRef.toLowerCase())) {
252
+ throw new Error(`${where} pins \`uses: "${step.uses}"\` to "${gitRef}", the action repository's own default ` +
253
+ `branch, which names whatever was pushed there last rather than a version. A generated ` +
254
+ `workflow is committed once and re-run unattended, often over a cloud role, so pin a release ` +
255
+ `tag or a commit sha instead (e.g. "${match[1]}/${match[2]}@v1" or "@<40-char sha>").`);
256
+ }
257
+ return;
258
+ }
259
+ if (step.run.trim() === "") {
260
+ throw new Error(`${where} has an empty \`run\` line. Give it a command, or drop the entry.`);
261
+ }
262
+ });
263
+ }
264
+ /** One setup entry as a GitHub Actions step: `with:` and `env:` only when they hold something. */
265
+ export function setupStepDoc(step) {
266
+ if ("uses" in step) {
267
+ return {
268
+ uses: step.uses,
269
+ ...nonEmpty("with", step.with),
270
+ ...nonEmpty("env", step.env),
271
+ };
272
+ }
273
+ return { run: step.run, ...nonEmpty("env", step.env) };
274
+ }
275
+ /**
276
+ * Validate an `environment` for GitHub Actions (#2257). GitHub creates an
277
+ * environment it has never seen on first use rather than failing the run,
278
+ * and an environment created that way carries no protection rules at all —
279
+ * so a job can name one and read as gated while being gated by nothing.
280
+ * Neither the generator nor GitHub can tell those apart at build time, which
281
+ * is why what is refused here is only the shape that could never bind: a
282
+ * name that is blank, and a `url` that is neither absolute nor an expression
283
+ * the forge resolves.
284
+ */
285
+ export function assertEnvironment(name, environment) {
286
+ const where = `Scheduled Op "${name}" environment`;
287
+ if (environment.name.trim() === "") {
288
+ throw new Error(`${where} has an empty \`name\`. An environment is named repository configuration — the ` +
289
+ `protection rules and reviewers live on the environment, not in this workflow — so there is ` +
290
+ `nothing for a blank name to resolve to. Give it the environment's name, or drop the option.`);
291
+ }
292
+ if (environment.url === undefined)
293
+ return;
294
+ const url = environment.url.trim();
295
+ if (url === "") {
296
+ throw new Error(`${where} "${environment.name}" has an empty \`url\`. Omit the field rather than setting it to "".`);
297
+ }
298
+ if (!/^https?:\/\//.test(url) && !url.includes("${{")) {
299
+ throw new Error(`${where} "${environment.name}" has \`url: "${environment.url}"\`, which is neither an absolute ` +
300
+ `http(s) URL nor a \${{ }} expression. GitHub renders this value as the deployment's own link, ` +
301
+ `so a relative path becomes a dead link on the environment page rather than an error anywhere. ` +
302
+ `Write the full URL, or an expression the run resolves to one.`);
303
+ }
304
+ }
305
+ // ── GitLab CI ───────────────────────────────────────────────────────────────
306
+ /** The pipeline source GitLab reports for a merge-request pipeline. */
307
+ export const GITLAB_MERGE_REQUEST_SOURCE = '$CI_PIPELINE_SOURCE == "merge_request_event"';
308
+ /** The pipeline source GitLab reports for a pipeline schedule. */
309
+ export const GITLAB_SCHEDULE_SOURCE = '$CI_PIPELINE_SOURCE == "schedule"';
310
+ /** A job variable that makes the runner clone the whole history, which a job reading the base commit needs. */
311
+ export const GITLAB_FULL_HISTORY = { GIT_DEPTH: "0" };
312
+ /** The `rules:` if-expression for a push to `branch`, a quoted name or an expression such as `$CI_DEFAULT_BRANCH`. */
313
+ export function gitlabPushRule(branch) {
314
+ return `$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == ${branch}`;
315
+ }
316
+ /**
317
+ * Refuse a branch name that cannot be interpolated into a `rules:`
318
+ * if-expression. The expression is a string GitLab parses, so a `"` would end
319
+ * it early and a `$` would expand as a variable — either one silently changes
320
+ * which pipelines match the job, which is worse than not generating it.
321
+ * `subject` names what filters, such as `Scheduled Op "apply"`.
322
+ */
323
+ export function assertGitlabBranch(subject, branch) {
324
+ if (branch.trim() === "") {
325
+ throw new Error(`${subject} has an empty branch filter. Name a branch, or drop the filter.`);
326
+ }
327
+ if (/["$\\]/.test(branch)) {
328
+ throw new Error(`${subject} filters on branch "${branch}", which carries a character this generator ` +
329
+ `cannot put in a GitLab \`rules:\` expression: a quote would end the expression early and a "$" ` +
330
+ `would expand as a CI/CD variable, either of which silently changes which pipelines run the job. ` +
331
+ `Name a branch without \`"\`, \`$\` or \`\\\`.`);
332
+ }
333
+ }
334
+ /**
335
+ * One `rules:` entry per branch a trigger filters on, each checked by
336
+ * {@link assertGitlabBranch}. Two or more branches are two or more entries:
337
+ * `rules:` is an OR over its list, which is how GitLab spells the alternation
338
+ * github expresses as a `branches:` array. A cron trigger is selected by
339
+ * `selector`, the CI/CD variable a pipeline schedule sets, and the Op's name.
340
+ */
341
+ export function gitlabRules(subject, trigger, selector) {
342
+ switch (trigger.kind) {
343
+ case "cron":
344
+ return [{ if: `${GITLAB_SCHEDULE_SOURCE} && $${selector.variable} == "${selector.value}"` }];
345
+ case "pull_request": {
346
+ const branches = triggerBranches(trigger);
347
+ if (!branches)
348
+ return [{ if: GITLAB_MERGE_REQUEST_SOURCE }];
349
+ return branches.map((branch) => {
350
+ assertGitlabBranch(subject, branch);
351
+ return { if: `${GITLAB_MERGE_REQUEST_SOURCE} && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "${branch}"` };
352
+ });
353
+ }
354
+ case "push":
355
+ return pushBranches(trigger.branches).map((branch) => {
356
+ assertGitlabBranch(subject, branch);
357
+ return { if: gitlabPushRule(JSON.stringify(branch)) };
358
+ });
359
+ }
360
+ }
361
+ /**
362
+ * The `id_tokens:` entry an `id-token: write` spec gets. The name is the
363
+ * environment variable the JWT lands in, which the job's own setup line reads
364
+ * (`aws sts assume-role-with-web-identity --web-identity-token
365
+ * "$CHANT_ID_TOKEN"`, or the provider's equivalent).
366
+ *
367
+ * `$CI_SERVER_URL` as the audience is GitLab's own documented default: an
368
+ * identity provider federated to a GitLab instance is registered with that
369
+ * instance's URL as its audience, and the variable expands to exactly that on
370
+ * gitlab.com and on a self-managed instance alike.
371
+ */
372
+ export const GITLAB_ID_TOKEN_NAME = "CHANT_ID_TOKEN";
373
+ export const GITLAB_ID_TOKEN_AUDIENCE = "$CI_SERVER_URL";
374
+ /**
375
+ * Turn additive `permissions` (#2242) into the one GitLab declaration that
376
+ * carries the same meaning, refusing everything else by name.
377
+ *
378
+ * `id-token: write` is that one: GitLab's OIDC surface is `id_tokens:`, a
379
+ * per-job declaration of a JWT the job exchanges for cloud credentials
380
+ * itself. `id-token: read` is refused rather than mapped, because GitLab
381
+ * either mints the token into the job or does not. Every other scope is
382
+ * refused: GitLab has no per-job token-scope mapping at all, and a scope
383
+ * quietly dropped would emit a job that reads as granted and runs with
384
+ * nothing.
385
+ */
386
+ export function gitlabIdTokens(name, permissions) {
387
+ let wantsIdToken = false;
388
+ for (const [rawScope, value] of Object.entries(permissions ?? {})) {
389
+ const scope = rawScope.trim();
390
+ if (scope === "id-token") {
391
+ if (value !== "write") {
392
+ throw new Error(`Scheduled Op "${name}" adds permission "id-token: ${value}", but GitLab either mints an ` +
393
+ `OIDC token into a job or does not — there is no read-only half of an \`id_tokens:\` ` +
394
+ `declaration. Ask for { "id-token": "write" }, or drop the option.`);
395
+ }
396
+ wantsIdToken = true;
397
+ continue;
398
+ }
399
+ throw new Error(`Scheduled Op "${name}" adds permission "${scope}: ${value}", but GitLab CI has no per-job ` +
400
+ `token-scope mapping — there is no \`permissions:\` key to add it to (#2242). The one scope that ` +
401
+ `does cross over is "id-token": "write", which becomes an \`id_tokens:\` declaration. Drop the ` +
402
+ `option here, or generate this Op for github.`);
403
+ }
404
+ return wantsIdToken ? { [GITLAB_ID_TOKEN_NAME]: { aud: GITLAB_ID_TOKEN_AUDIENCE } } : undefined;
405
+ }
406
+ /**
407
+ * A `setup` list as GitLab `script:` lines. A `uses` entry is a GitHub
408
+ * Actions marketplace action, which GitLab has no shape for, so it is refused
409
+ * by name rather than dropped. `subject` names whose setup it is, such as
410
+ * `Scheduled Op "apply"`.
411
+ */
412
+ export function gitlabSetupScript(subject, setup) {
413
+ return (setup ?? []).map((step, index) => {
414
+ if ("uses" in step) {
415
+ throw new Error(`${subject} setup step ${index + 1} is \`uses: "${step.uses}"\`, a GitHub Actions ` +
416
+ `marketplace action. GitLab CI jobs run \`script\` lines only, so there is nothing to translate it ` +
417
+ `into (#2242). Express the setup as a \`{ run }\` entry, or generate it for github/forgejo.`);
418
+ }
419
+ return step.run;
420
+ });
421
+ }
422
+ /**
423
+ * Validate an `environment` on GitLab's own terms (#2257). A GitLab job
424
+ * naming an environment that does not exist creates an unprotected one on
425
+ * first deploy rather than failing, so the only shapes worth refusing at
426
+ * build time are the ones that could never bind: a blank name, and a `url`
427
+ * that is neither absolute nor a variable expression GitLab expands, which
428
+ * would render as a dead "View deployment" link.
429
+ */
430
+ export function assertGitlabEnvironment(name, environment) {
431
+ const where = `Scheduled Op "${name}" environment`;
432
+ if (environment.name.trim() === "") {
433
+ throw new Error(`${where} has an empty \`name\`. A GitLab environment is a project object, and its approval ` +
434
+ `rules live on that object rather than in this file, so a blank name resolves to nothing. ` +
435
+ `Give it the environment's name, or drop the option.`);
436
+ }
437
+ if (environment.url === undefined)
438
+ return;
439
+ const url = environment.url.trim();
440
+ if (url === "") {
441
+ throw new Error(`${where} "${environment.name}" has an empty \`url\`. Omit the field rather than setting it to "".`);
442
+ }
443
+ if (!/^https?:\/\//.test(url) && !url.includes("$")) {
444
+ throw new Error(`${where} "${environment.name}" has \`url: "${environment.url}"\`, which is neither an absolute ` +
445
+ `http(s) URL nor a variable expression GitLab expands. It becomes the environment's own link, ` +
446
+ `so a relative path is a dead link on the environment page rather than an error anywhere.`);
447
+ }
448
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"pr-pipeline.d.ts","sourceRoot":"","sources":["../../src/components/pr-pipeline.ts"],"names":[],"mappings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MAAM,EAAE,CAAC;CAClB;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,qBAA0B,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,EAAE,CA2B3H;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAEjE;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAErF;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAU1D"}
@@ -36,6 +36,7 @@
36
36
  * that one of its units reaches selects that unit.
37
37
  */
38
38
  import { PR_APPLY_GATE } from "../pr-loop.js";
39
+ import { CI_IMAGE, GITHUB_JOB_TOKEN } from "../ci-jobs.js";
39
40
  /** Where both jobs write their reports, kept as a CI artifact. */
40
41
  export const PR_LOOP_REPORT_DIR = ".chant/pr";
41
42
  /**
@@ -50,7 +51,7 @@ export const PR_APPLY_RECORD = ".chant/pr-resume/pr-apply.json";
50
51
  * `PR_LOOP_SETUP` adds OpenTofu on top of it. A caller who sets `image`
51
52
  * brings both and gets no setup lines.
52
53
  */
53
- export const PR_LOOP_IMAGE = "node:22";
54
+ export const PR_LOOP_IMAGE = CI_IMAGE;
54
55
  /** Installs OpenTofu into `PR_LOOP_IMAGE`. */
55
56
  export const PR_LOOP_SETUP = [
56
57
  "command -v tofu >/dev/null 2>&1 || (curl -fsSL https://get.opentofu.org/install-opentofu.sh -o /tmp/install-opentofu.sh && sh /tmp/install-opentofu.sh --install-method standalone)",
@@ -71,7 +72,7 @@ export function prLoopJobs(forge, env, options = {}, member) {
71
72
  ...(member ? ["--member", member] : []),
72
73
  ];
73
74
  const github = forge !== "gitlab";
74
- const token = github ? { GITHUB_TOKEN: "${{ github.token }}" } : {};
75
+ const token = github ? { GITHUB_TOKEN: GITHUB_JOB_TOKEN } : {};
75
76
  return [
76
77
  {
77
78
  jobName: "plan",
@@ -74,8 +74,16 @@ export declare class CompositeRegistry {
74
74
  * });
75
75
  * export const storage = SecureStorage({ name: "data" });
76
76
  * ```
77
- */
78
- export declare function Composite<P, M extends CompositeFactoryMembers = CompositeMembers>(factory: (props: P) => M, name?: string): CompositeDefinition<P, M>;
77
+ *
78
+ * `D` (chant#3787) lets a lexicon give the definition a more precise call
79
+ * signature than `(props: P) => M`, such as a generic one whose members' types
80
+ * depend on the literal props it is called with. It is a type only: the value
81
+ * is the same definition, and `D` must still be a `CompositeDefinition<P, M>`,
82
+ * so an intersection with the precise signature first is the usual form. It
83
+ * is passed as a type argument rather than by casting the result, because the
84
+ * fold recognizes a composite by its `export const X = Composite(...)` shape.
85
+ */
86
+ export declare function Composite<P, M extends CompositeFactoryMembers = CompositeMembers, D extends CompositeDefinition<P, M> = CompositeDefinition<P, M>>(factory: (props: P) => M, name?: string): D;
79
87
  /**
80
88
  * chant#3608 — the composite whose call built `entity`, or `undefined` for an
81
89
  * entity no chant composite built.
@@ -1 +1 @@
1
- {"version":3,"file":"composite.d.ts","sourceRoot":"","sources":["../src/composite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAG7D;;GAEG;AACH,eAAO,MAAM,gBAAgB,eAAgC,CAAC;AAE9D;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAE1D;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,uBAAuB,GAE/B,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,iBAAiB,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,GAO/D,iBAAiB,CAAC,GAAG,CAAC,CAAC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AAM,EAAE,OAAO,CAAC,GACnC,iBAAiB,CAAC,CAAC,CAAC,GAAG,CAAC,CAM1B;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,EAC9C,IAAI,EAAE,KAAK,KAAK,EAAE,CAAC,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,EAC/D,KAAK,EAAE,CAAC,EACR,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,CAAC,CAEH;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7D,IAAI,EAAE,CAAC,EACP,SAAS,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,MAAM,GAC9B,CAAC,CAqBH"}
package/dist/composite.js CHANGED
@@ -51,6 +51,14 @@ CompositeRegistry.definitions = new Map();
51
51
  * });
52
52
  * export const storage = SecureStorage({ name: "data" });
53
53
  * ```
54
+ *
55
+ * `D` (chant#3787) lets a lexicon give the definition a more precise call
56
+ * signature than `(props: P) => M`, such as a generic one whose members' types
57
+ * depend on the literal props it is called with. It is a type only: the value
58
+ * is the same definition, and `D` must still be a `CompositeDefinition<P, M>`,
59
+ * so an intersection with the precise signature first is the usual form. It
60
+ * is passed as a type argument rather than by casting the result, because the
61
+ * fold recognizes a composite by its `export const X = Composite(...)` shape.
54
62
  */
55
63
  export function Composite(factory, name) {
56
64
  const id = Symbol();
@@ -2,7 +2,8 @@ import { type Declarable } from "../declarable.js";
2
2
  /**
3
3
  * Collects all declarable entities from imported modules.
4
4
  * CompositeInstance exports are expanded into individual entities
5
- * with `{exportName}_{memberName}` naming.
5
+ * with `{exportName}_{memberName}` naming, and so are host composite
6
+ * instances the fold resolved (chant#3612, ./host-composite.ts).
6
7
  * LexiconOutput exports are also collected so that build() can
7
8
  * extract them and pass them to the serializer.
8
9
  *
@@ -1 +1 @@
1
- {"version":3,"file":"collect.d.ts","sourceRoot":"","sources":["../../src/discovery/collect.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAmI9D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,CAAC,EAClE,SAAS,CAAC,EAAE,MAAM,GACjB,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAiEzB"}
1
+ {"version":3,"file":"collect.d.ts","sourceRoot":"","sources":["../../src/discovery/collect.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAgJ9D;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,CAAC,EAClE,SAAS,CAAC,EAAE,MAAM,GACjB,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAiEzB"}
@@ -4,6 +4,7 @@ import { isCompositeInstance, expandComposite, compositeOfMember } from "../comp
4
4
  import { isLexiconOutput } from "../lexicon-output.js";
5
5
  import { DiscoveryError } from "../errors.js";
6
6
  import { setProvenance } from "../provenance.js";
7
+ import { expandHostComposite, hostCompositeName } from "./host-composite.js";
7
8
  /**
8
9
  * The entity key for an export. `export default` is per-module — the `Op` pattern
9
10
  * (`export default op`) uses it, and two op files must not collide on the literal
@@ -106,6 +107,19 @@ function enumerateEntries(modules) {
106
107
  });
107
108
  }
108
109
  }
110
+ else if (hostCompositeName(value) !== undefined) {
111
+ // chant#3612 — a host composite instance the fold resolved, expanded
112
+ // here rather than by one caller, so `build()` and `foldProject`
113
+ // report the same entities for it. See ./host-composite.ts.
114
+ for (const [expandedName, entity] of expandHostComposite(name, value)) {
115
+ entries.push({
116
+ bareKey: expandedName,
117
+ value: entity,
118
+ file,
119
+ provenance: { sourceFile: file, compositeInstance: name },
120
+ });
121
+ }
122
+ }
109
123
  else if (isLexiconOutput(value)) {
110
124
  // LexiconOutput is not a Declarable but build() expects to find them in
111
125
  // the entities map so it can collect and pass them to serializers.
@@ -118,7 +132,8 @@ function enumerateEntries(modules) {
118
132
  /**
119
133
  * Collects all declarable entities from imported modules.
120
134
  * CompositeInstance exports are expanded into individual entities
121
- * with `{exportName}_{memberName}` naming.
135
+ * with `{exportName}_{memberName}` naming, and so are host composite
136
+ * instances the fold resolved (chant#3612, ./host-composite.ts).
122
137
  * LexiconOutput exports are also collected so that build() can
123
138
  * extract them and pass them to the serializer.
124
139
  *
@@ -1 +1 @@
1
- {"version":3,"file":"fold-import.d.ts","sourceRoot":"","sources":["../../src/discovery/fold-import.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAMjC,OAAO,EAAsC,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AACpF,OAAO,EAAkC,KAAK,iBAAiB,EAAyB,MAAM,cAAc,CAAC;AAqD7G,OAAO,EAA4B,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEnF,OAAO,EAAgD,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAC7F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAEH,mGAAmG;AACnG,MAAM,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,iBAAiB,CAAC,CAAC;AAElF,MAAM,MAAM,cAA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