@intentius/sql-yodeler 0.11.1 → 0.12.0

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 (52) hide show
  1. package/dist/chant/gated-request.d.ts +31 -1
  2. package/dist/chant/gated-request.js +57 -1
  3. package/dist/chant/gated-request.js.map +1 -1
  4. package/dist/chant-floor-version.d.ts +1 -1
  5. package/dist/chant-floor-version.js +1 -1
  6. package/dist/chant-floor.d.ts +14 -12
  7. package/dist/chant-floor.js +33 -19
  8. package/dist/chant-floor.js.map +1 -1
  9. package/dist/ci/login.d.ts +22 -47
  10. package/dist/ci/login.js +35 -82
  11. package/dist/ci/login.js.map +1 -1
  12. package/dist/ci/render.d.ts +42 -73
  13. package/dist/ci/render.js +69 -133
  14. package/dist/ci/render.js.map +1 -1
  15. package/dist/ci-words.d.ts +3 -3
  16. package/dist/ci-words.js +3 -3
  17. package/dist/commands/apply.d.ts +6 -0
  18. package/dist/commands/apply.js +34 -12
  19. package/dist/commands/apply.js.map +1 -1
  20. package/dist/commands/mcp.js +15 -20
  21. package/dist/commands/mcp.js.map +1 -1
  22. package/dist/commands/plan.js +52 -8
  23. package/dist/commands/plan.js.map +1 -1
  24. package/dist/commands/revert.js +5 -1
  25. package/dist/commands/revert.js.map +1 -1
  26. package/dist/config/define.d.ts +1 -1
  27. package/dist/config/settings.d.ts +23 -3
  28. package/dist/config/settings.js +32 -9
  29. package/dist/config/settings.js.map +1 -1
  30. package/dist/mcp/chant-hook.d.ts +7 -5
  31. package/dist/mcp/chant-hook.js +19 -22
  32. package/dist/mcp/chant-hook.js.map +1 -1
  33. package/dist/pr/note.d.ts +26 -23
  34. package/dist/pr/note.js +59 -49
  35. package/dist/pr/note.js.map +1 -1
  36. package/dist/pr/part.d.ts +11 -0
  37. package/dist/pr/part.js +35 -1
  38. package/dist/pr/part.js.map +1 -1
  39. package/dist/pr/render.d.ts +0 -4
  40. package/dist/pr/render.js +5 -62
  41. package/dist/pr/render.js.map +1 -1
  42. package/dist/pr/tenants.d.ts +7 -0
  43. package/dist/pr/tenants.js +25 -0
  44. package/dist/pr/tenants.js.map +1 -1
  45. package/dist/versioned/engine.d.ts +1 -1
  46. package/package.json +7 -7
  47. package/dist/mcp/server.d.ts +0 -40
  48. package/dist/mcp/server.js +0 -106
  49. package/dist/mcp/server.js.map +0 -1
  50. package/dist/versioned/stand-down.d.ts +0 -44
  51. package/dist/versioned/stand-down.js +0 -84
  52. package/dist/versioned/stand-down.js.map +0 -1
@@ -65,7 +65,11 @@ export interface GatedRequestRead {
65
65
  gate: string;
66
66
  digest: string;
67
67
  request: GatedRequest;
68
- applied?: unknown;
68
+ applied?: {
69
+ approvedBy?: string;
70
+ approvedAt?: string;
71
+ timestamp?: string;
72
+ };
69
73
  }
70
74
  /** The parts of chant's `lifecycle/gated-request` yodel calls. */
71
75
  export interface GatedRequestApi {
@@ -151,3 +155,29 @@ export declare function spendAndAct<T>(gated: GatedRequestApi, approved: Extract
151
155
  result: T;
152
156
  pushWarning?: string;
153
157
  }>;
158
+ /** The ledger's remote, as chant chooses it: a name, none at all, or unknown (git failed, or the setting names a remote the repository lacks). */
159
+ export type LedgerRemote = {
160
+ remote: string;
161
+ } | null | "unknown";
162
+ /** {@link LedgerRemote} for the repository at `cwd`, without fetching or pushing. */
163
+ export declare function ledgerRemoteOf(cwd: string, env?: NodeJS.ProcessEnv): Promise<LedgerRemote>;
164
+ /**
165
+ * The applied line chant wrote for `approved` when its spend threw only
166
+ * because the ledger has no remote, else undefined.
167
+ *
168
+ * chant's `spendGatedRequest` (lifecycle/gated-request.ts, 0.124.67) throws
169
+ * whenever the push did not land, and a checkout with no remote never
170
+ * pushes, so a single-machine project could not apply under any gated
171
+ * request. With no remote the local chant/lifecycle branch is the whole
172
+ * ledger, and the spend recorded on it is complete. A push that failed or
173
+ * that another writer beat still refuses: the remote is there, so this
174
+ * answers undefined and the caller throws chant's error.
175
+ */
176
+ export declare function spentWithoutRemote(gated: GatedRequestApi, approved: Extract<RequestGateResult, {
177
+ status: "approved";
178
+ }>, at: {
179
+ op: string;
180
+ cwd: string;
181
+ }, env?: NodeJS.ProcessEnv): Promise<{
182
+ timestamp: string;
183
+ } | undefined>;
@@ -75,7 +75,16 @@ export async function askGatedRequest(gated, a) {
75
75
  */
76
76
  export async function spendAndAct(gated, approved, at, act) {
77
77
  const gate = approved.request.subject;
78
- const applied = await gated.spendGatedRequest({ op: at.op, gate, digest: approved.digest, approval: approved.approval, cwd: at.cwd });
78
+ let applied;
79
+ try {
80
+ applied = await gated.spendGatedRequest({ op: at.op, gate, digest: approved.digest, approval: approved.approval, cwd: at.cwd });
81
+ }
82
+ catch (e) {
83
+ const local = await spentWithoutRemote(gated, approved, at);
84
+ if (!local)
85
+ throw e;
86
+ applied = local;
87
+ }
79
88
  let done;
80
89
  try {
81
90
  done = await act();
@@ -88,4 +97,51 @@ export async function spendAndAct(gated, approved, at, act) {
88
97
  const finished = await gated.finishGatedRequest({ op: at.op, gate, digest: approved.digest, applied: applied.timestamp, result: "applied", detail: done.detail, cwd: at.cwd });
89
98
  return { result: done.result, ...(finished.pushWarning ? { pushWarning: finished.pushWarning } : {}) };
90
99
  }
100
+ /** {@link LedgerRemote} for the repository at `cwd`, without fetching or pushing. */
101
+ export async function ledgerRemoteOf(cwd, env = process.env) {
102
+ const { execFile } = await import("node:child_process");
103
+ const names = await new Promise((resolve) => {
104
+ execFile("git", ["remote"], { cwd, env: { ...env, LC_ALL: "C", LANGUAGE: "" } }, (err, stdout) => {
105
+ resolve(err ? undefined : stdout.split("\n").map((n) => n.trim()).filter(Boolean));
106
+ });
107
+ });
108
+ if (names === undefined)
109
+ return "unknown";
110
+ const specifier = "@intentius/chant/lifecycle/ledger-remote";
111
+ let choose;
112
+ try {
113
+ choose = (await import(specifier)).chooseLedgerRemote;
114
+ }
115
+ catch {
116
+ choose = undefined;
117
+ }
118
+ if (!choose)
119
+ return "unknown";
120
+ const found = choose(names, env);
121
+ if (found === null)
122
+ return null;
123
+ return "failed" in found ? "unknown" : found;
124
+ }
125
+ /**
126
+ * The applied line chant wrote for `approved` when its spend threw only
127
+ * because the ledger has no remote, else undefined.
128
+ *
129
+ * chant's `spendGatedRequest` (lifecycle/gated-request.ts, 0.124.67) throws
130
+ * whenever the push did not land, and a checkout with no remote never
131
+ * pushes, so a single-machine project could not apply under any gated
132
+ * request. With no remote the local chant/lifecycle branch is the whole
133
+ * ledger, and the spend recorded on it is complete. A push that failed or
134
+ * that another writer beat still refuses: the remote is there, so this
135
+ * answers undefined and the caller throws chant's error.
136
+ */
137
+ export async function spentWithoutRemote(gated, approved, at, env = process.env) {
138
+ if ((await ledgerRemoteOf(at.cwd, env)) !== null)
139
+ return undefined;
140
+ const gate = approved.request.subject;
141
+ const read = await gated.readGatedRequests(at.op, { cwd: at.cwd }).catch(() => []);
142
+ const line = read.find((r) => r.gate === gate && r.digest === approved.digest)?.applied;
143
+ if (!line?.timestamp || line.approvedBy !== approved.approval.resolvedBy || line.approvedAt !== approved.approval.timestamp)
144
+ return undefined;
145
+ return { timestamp: line.timestamp };
146
+ }
91
147
  //# sourceMappingURL=gated-request.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"gated-request.js","sourceRoot":"","sources":["../../src/chant/gated-request.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AA+CH,IAAI,GAAqD,CAAC;AAE1D;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,MAAyB,OAAO,CAAC,GAAG;IAChE,IAAI,GAAG,CAAC,oBAAoB,KAAK,GAAG;QAAE,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACxE,GAAG,KAAK,CAAC,KAAK,IAAI,EAAE;QAClB,MAAM,SAAS,GAAG,0CAA0C,CAAC;QAC7D,IAAI,CAAuC,CAAC;QAC5C,IAAI,CAAC;YACH,CAAC,GAAG,CAAC,MAAM,MAAM,CAAC,SAAS,CAAC,CAA6B,CAAC;QAC5D,CAAC;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AAS,CAAC,CAAC,CAAC,KAAK,CAAC;AAC/C,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,KAAsB,EACtB,QAA4D,EAC5D,EAA+B,EAC/B,MAAyB,OAAO,CAAC,GAAG;IAEpC,IAAI,CAAC,MAAM,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IACnE,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC;IACtC,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,iBAAiB,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;IACnF,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,IAAI,CAAC,CAAC,MAAM,KAAK,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IACxF,IAAI,CAAC,IAAI,EAAE,SAAS,IAAI,IAAI,CAAC,UAAU,KAAK,QAAQ,CAAC,QAAQ,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,KAAK,QAAQ,CAAC,QAAQ,CAAC,SAAS;QAAE,OAAO,SAAS,CAAC;IAC9I,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC;AACvC,CAAC"}
@@ -7,7 +7,7 @@
7
7
  * chant-floor.ts is the first module loaded.
8
8
  */
9
9
  /** The first chant (and sql lexicon) whose CI yodel's pipelines run on. */
10
- export declare const CHANT_CI_FLOOR = "0.124.57";
10
+ export declare const CHANT_CI_FLOOR = "0.124.67";
11
11
  /** The packages a project pins at the floor, chant and the sql lexicon, at one version as the templates pin them. */
12
12
  export declare const CHANT_PACKAGES: readonly ["@intentius/chant", "@intentius/chant-lexicon-sql"];
13
13
  /** The line that installs the floor, exact as the templates pin chant. */
@@ -7,7 +7,7 @@
7
7
  * chant-floor.ts is the first module loaded.
8
8
  */
9
9
  /** The first chant (and sql lexicon) whose CI yodel's pipelines run on. */
10
- export const CHANT_CI_FLOOR = "0.124.57";
10
+ export const CHANT_CI_FLOOR = "0.124.67";
11
11
  /** The packages a project pins at the floor, chant and the sql lexicon, at one version as the templates pin them. */
12
12
  export const CHANT_PACKAGES = ["@intentius/chant", "@intentius/chant-lexicon-sql"];
13
13
  /** The line that installs the floor, exact as the templates pin chant. */
@@ -2,13 +2,15 @@
2
2
  * The chant release yodel's pipelines move onto chant's product pipeline
3
3
  * with (#298, tracker #285).
4
4
  *
5
- * Every part of chant CI yodel uses is feature-detected (src/ci-words.ts,
6
- * src/ci/render.ts, src/ci/check-hooks.ts, src/ci/login.ts,
7
- * src/chant/gated-request.ts, src/chant/confirm.ts, src/mcp/chant-hook.ts,
8
- * src/exit.ts), so a project keeps the pipelines it has until its chant is
9
- * at least {@link CHANT_CI_FLOOR}. `yodel upgrade` (src/commands/upgrade.ts)
10
- * then moves it in one commit, and docs/chant-ci.md says so, keyed to the
11
- * same number.
5
+ * yodel 0.12 takes chant {@link CHANT_CI_FLOOR} as its floor (#303): the
6
+ * pipelines render only through chant's product pipeline, and yodel's own
7
+ * copies of what chant now does (its pipeline generator, plan note, cloud
8
+ * login on GitHub and GitLab, MCP server and stand-down) are gone. A
9
+ * project whose pipelines a yodel before 0.11 rendered runs `yodel
10
+ * upgrade` (src/commands/upgrade.ts) to move them in one commit, and
11
+ * docs/chant-ci.md says so, keyed to the same number. {@link chantParts}
12
+ * still lists each part, so `yodel upgrade` says what a chant below the
13
+ * floor lacks.
12
14
  *
13
15
  * chant names that release `NEXT_RELEASE` until the maintainer cuts it
14
16
  * (chant's packages/core/src/release-floors.ts, `CI_PRODUCT_FLOOR`). The
@@ -33,10 +35,10 @@ export interface ChantPart {
33
35
  has: boolean;
34
36
  }
35
37
  /**
36
- * The parts of chant CI yodel feature-detects, in the order docs/chant-ci.md
37
- * lists them. Each check is the one the command that uses it makes, so the
38
- * list says what `yodel ci` and the other commands will do with this chant.
39
- * Variables that keep yodel's own path (`YODEL_GATED_REQUESTS=0`,
40
- * `YODEL_OWN_CONFIRM=1`) are not read here: the list is about chant.
38
+ * The parts of chant CI yodel uses, in the order docs/chant-ci.md lists
39
+ * them, and whether the installed chant has each, so `yodel upgrade` says
40
+ * what a chant below the floor lacks. Variables that keep yodel's own path
41
+ * (`YODEL_GATED_REQUESTS=0`, `YODEL_OWN_CONFIRM=1`) are not read here: the
42
+ * list is about chant.
41
43
  */
42
44
  export declare function chantParts(): Promise<ChantPart[]>;
@@ -2,13 +2,15 @@
2
2
  * The chant release yodel's pipelines move onto chant's product pipeline
3
3
  * with (#298, tracker #285).
4
4
  *
5
- * Every part of chant CI yodel uses is feature-detected (src/ci-words.ts,
6
- * src/ci/render.ts, src/ci/check-hooks.ts, src/ci/login.ts,
7
- * src/chant/gated-request.ts, src/chant/confirm.ts, src/mcp/chant-hook.ts,
8
- * src/exit.ts), so a project keeps the pipelines it has until its chant is
9
- * at least {@link CHANT_CI_FLOOR}. `yodel upgrade` (src/commands/upgrade.ts)
10
- * then moves it in one commit, and docs/chant-ci.md says so, keyed to the
11
- * same number.
5
+ * yodel 0.12 takes chant {@link CHANT_CI_FLOOR} as its floor (#303): the
6
+ * pipelines render only through chant's product pipeline, and yodel's own
7
+ * copies of what chant now does (its pipeline generator, plan note, cloud
8
+ * login on GitHub and GitLab, MCP server and stand-down) are gone. A
9
+ * project whose pipelines a yodel before 0.11 rendered runs `yodel
10
+ * upgrade` (src/commands/upgrade.ts) to move them in one commit, and
11
+ * docs/chant-ci.md says so, keyed to the same number. {@link chantParts}
12
+ * still lists each part, so `yodel upgrade` says what a chant below the
13
+ * floor lacks.
12
14
  *
13
15
  * chant names that release `NEXT_RELEASE` until the maintainer cuts it
14
16
  * (chant's packages/core/src/release-floors.ts, `CI_PRODUCT_FLOOR`). The
@@ -21,12 +23,9 @@ import { readFileSync } from "node:fs";
21
23
  import { createRequire } from "node:module";
22
24
  import { dirname, join } from "node:path";
23
25
  import { chantProduct } from "./ci-words.js";
24
- import { chantLocksWaves, hasSqlCapability } from "./ci/render.js";
25
26
  import { chantCheckHooks } from "./ci/check-hooks.js";
26
- import { chantTrade } from "./ci/login.js";
27
27
  import { gatedRequests } from "./chant/gated-request.js";
28
28
  import { chantConfirm } from "./chant/confirm.js";
29
- import { chantHooks } from "./mcp/chant-hook.js";
30
29
  import { useChantExitTable } from "./exit.js";
31
30
  export { CHANT_CI_FLOOR, CHANT_PACKAGES, installLine } from "./chant-floor-version.js";
32
31
  /**
@@ -55,24 +54,39 @@ export function installedVersion(pkg, from = import.meta.url) {
55
54
  return undefined;
56
55
  }
57
56
  /**
58
- * The parts of chant CI yodel feature-detects, in the order docs/chant-ci.md
59
- * lists them. Each check is the one the command that uses it makes, so the
60
- * list says what `yodel ci` and the other commands will do with this chant.
61
- * Variables that keep yodel's own path (`YODEL_GATED_REQUESTS=0`,
62
- * `YODEL_OWN_CONFIRM=1`) are not read here: the list is about chant.
57
+ * Whether the installed `specifier` exports every one of `names`: what
58
+ * {@link chantParts} asks of a part yodel imports without a check of its
59
+ * own, since the floor has it. A lazy import, with the specifier in a
60
+ * variable, so a chant below the floor is told, not crashed on.
61
+ */
62
+ async function exportsAll(specifier, names) {
63
+ try {
64
+ const m = (await import(specifier));
65
+ return names.every((n) => m[n] !== undefined && m[n] !== null);
66
+ }
67
+ catch {
68
+ return false;
69
+ }
70
+ }
71
+ /**
72
+ * The parts of chant CI yodel uses, in the order docs/chant-ci.md lists
73
+ * them, and whether the installed chant has each, so `yodel upgrade` says
74
+ * what a chant below the floor lacks. Variables that keep yodel's own path
75
+ * (`YODEL_GATED_REQUESTS=0`, `YODEL_OWN_CONFIRM=1`) are not read here: the
76
+ * list is about chant.
63
77
  */
64
78
  export async function chantParts() {
65
79
  const product = (await chantProduct()) !== undefined;
66
80
  const parts = [
67
81
  ["product pipeline (words, jobs, yodel chant)", "the-pipelines", Promise.resolve(product)],
68
82
  ["exit-code table", "exit-codes", useChantExitTable().then((t) => t === "chant")],
69
- ["sql capability (waves with no callback)", "the-apply-waves", hasSqlCapability()],
70
- ["lock grain and stand-down", "locks", chantLocksWaves()],
83
+ ["sql capability (waves with no callback)", "the-apply-waves", exportsAll("@intentius/chant-lexicon-sql/capability-plugin", ["sqlCapabilityPlugin"])],
84
+ ["lock grain and stand-down", "locks", Promise.all([exportsAll("@intentius/chant/op", ["OP_WAVE_STAND_DOWN_FLOOR", "newerCommitOnBranch"]), exportsAll("@intentius/chant-lexicon-sql/lock-grain", ["sqlDefaultLockGrain"])]).then((both) => both.every(Boolean))],
71
85
  ["check hooks", "the-check-on-chants-check-hooks", chantCheckHooks().then((m) => m !== undefined)],
72
- ["cloud identity trade", "cloud-login", chantTrade().then((m) => m !== undefined)],
86
+ ["cloud identity trade", "cloud-login", Promise.all([exportsAll("@intentius/chant/ci-identity", ["tradeLine", "gitlabTradeLines", "gitlabTradeIdTokens", "TRADE_SPEC_ENV", "AZURE_DATABASE_TOKEN_ENV"]), exportsAll("@intentius/chant-lexicon-sql/token-source", ["tradedToken"])]).then((both) => both.every(Boolean))],
73
87
  ["gated requests and run records", "records-on-the-ledger", gatedRequests({}).then((m) => m !== undefined)],
74
88
  ["confirmation at a terminal", "yodel-approve", chantConfirm({}).then((m) => m !== undefined)],
75
- ["MCP tool hook and traces", "mcp-and-traces", chantHooks().then((m) => m !== undefined)],
89
+ ["MCP tool hook and traces", "mcp-and-traces", exportsAll("@intentius/chant/ci-product", ["runChantInProcess", "configureOtlp", "PRODUCT_MCP_HOOK_FLOOR"])],
76
90
  ];
77
91
  const out = [];
78
92
  for (const [name, section, has] of parts)
@@ -1 +1 @@
1
- {"version":3,"file":"chant-floor.js","sourceRoot":"","sources":["../src/chant-floor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;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IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC;QAC9F,CAAC,0BAA0B,EAAE,gBAAgB,EAAE,UAAU,CAAC,6BAA6B,EAAE,CAAC,mBAAmB,EAAE,eAAe,EAAE,wBAAwB,CAAC,CAAC,CAAC;KAC5J,CAAC;IACF,MAAM,GAAG,GAAgB,EAAE,CAAC;IAC5B,KAAK,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,IAAI,KAAK;QAAE,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACzG,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -1,22 +1,23 @@
1
1
  /**
2
2
  * The cloud login a CI job runs before yodel (#132), when a role it holds
3
- * has a password minted by a cloud token source: the job's OIDC token,
4
- * exchanged by the cloud's own command line, which then mints the database
5
- * token (`aws rds generate-db-auth-token`, `gcloud sql generate-login-token`,
6
- * `az account get-access-token`). yodel.config.ts `ci.login` says what to
7
- * log in as ({@link CiLogin}); this renders the steps per forge. Nothing
8
- * here calls a cloud: the rendered job does, when it runs.
3
+ * has a password minted by a cloud token source. yodel.config.ts `ci.login`
4
+ * says what to log in as ({@link CiLogin}); this renders the steps per
5
+ * forge. Nothing here calls a cloud: the rendered job does, when it runs.
9
6
  *
10
- * The token, per forge:
11
- * - GitHub: the job requests it for the cloud's audience
12
- * (ACTIONS_ID_TOKEN_REQUEST_URL, granted by `id-token: write`) and writes
13
- * it to the token file.
14
- * - GitLab: the job's `id_tokens` variable (AWS_ID_TOKEN, GCP_ID_TOKEN,
15
- * AZURE_ID_TOKEN) is written to the token file.
16
- * - Forgejo gives a job no OIDC token: a login is rendered only when the
17
- * config's `tokenFile` names a token the runner provides.
7
+ * On GitHub and GitLab the login is chant's ci-identity trade (#296,
8
+ * chant#4554): one step trades the job's OIDC token for every cloud the job
9
+ * holds a role in, from `/` with no file of the checkout in reach, and
10
+ * writes the cloud's variables for the job's later steps. The sql lexicon's
11
+ * token sources mint the database token from what the trade left
12
+ * (chant#4572): `rds-iam` with the traded AWS keys, `cloud-sql-iam` from the
13
+ * traded Google token, `entra` from the Azure Database token, so the image
14
+ * needs no `aws`, `gcloud` or `az`. yodel keeps only the mapping from
15
+ * `ci.login` to chant's trade spec ({@link tradeSpec}). The trade's GitLab
16
+ * `id_tokens` are chant's (`CHANT_ID_TOKEN_<CLOUD>`).
18
17
  *
19
- * The login, per cloud, from the token file:
18
+ * Forgejo gives a job no OIDC token, so there is nothing to trade: a login
19
+ * is rendered only when the config's `tokenFile` names a token the runner
20
+ * provides, and it is yodel's own, from that file:
20
21
  * - aws: AWS_ROLE_ARN, AWS_WEB_IDENTITY_TOKEN_FILE and AWS_ROLE_SESSION_NAME,
21
22
  * which the aws command line assumes the role with.
22
23
  * - gcp: an external_account credential configuration over the token file
@@ -24,10 +25,9 @@
24
25
  * `gcloud auth login --cred-file` with it, and GOOGLE_APPLICATION_CREDENTIALS.
25
26
  * - azure: `az login --service-principal --federated-token`, and
26
27
  * AZURE_CLIENT_ID, AZURE_TENANT_ID and AZURE_FEDERATED_TOKEN_FILE.
27
- *
28
- * On GitHub and Forgejo the variables go to $GITHUB_ENV, so every later step
29
- * has them (the report too); on GitLab they are the job's `variables`, so
30
- * after_script has them too.
28
+ * The variables go to $GITHUB_ENV, so every later step has them (the
29
+ * report too). Yodel's own login on GitHub and GitLab, from before the
30
+ * trade, left in 0.12 (#303).
31
31
  */
32
32
  import type { AwsLogin, AzureLogin, CiLogin, CloudLogins, GcpLogin } from "../config/define.js";
33
33
  import type { CloudToken, Role } from "../credentials.js";
@@ -50,29 +50,9 @@ export interface TradeSpec {
50
50
  database: true;
51
51
  };
52
52
  }
53
- /** The parts of chant's `ci-identity` yodel calls. */
54
- export interface ChantTrade {
55
- tradeLine(out: string, format: "github-env" | "sh"): string;
56
- gitlabTradeLines(extraUnset?: readonly string[]): string[];
57
- gitlabTradeIdTokens(spec: TradeSpec): Record<string, {
58
- aud: string;
59
- }>;
60
- TRADE_SPEC_ENV: string;
61
- }
62
- /** The trade the next render uses, or none for yodel's own login. {@link chantTrade} finds it; tests set their own. */
63
- export declare function useChantTrade(t: ChantTrade | undefined): void;
64
- /** Whether logins render through chant's trade. */
65
- export declare const tradesThroughChant: () => boolean;
66
- /**
67
- * chant's trade, when the installed chant has it with the database token
68
- * (`AZURE_DATABASE_TOKEN_ENV`, chant#4572) and the sql lexicon mints from a
69
- * traded identity (`tradedToken`); else undefined. Both are imported lazily,
70
- * with the specifiers in variables, so a published chant keeps yodel's login.
71
- */
72
- export declare function chantTrade(): Promise<ChantTrade | undefined>;
73
53
  /** yodel.config.ts `ci.login` for a job's logins, as chant's trade spec. */
74
54
  export declare function tradeSpec(logins: readonly Login[]): TradeSpec;
75
- /** A GitLab job's `id_tokens` for its logins through chant's trade, or undefined for yodel's own. */
55
+ /** A GitLab job's `id_tokens` for its logins through chant's trade, or undefined when it has none. */
76
56
  export declare function tradeIdTokens(logins: readonly Login[]): Record<string, {
77
57
  aud: string;
78
58
  }> | undefined;
@@ -94,7 +74,7 @@ export type Login = {
94
74
  };
95
75
  /** What a job adds for its logins: variables every later command has, and the lines to run before yodel. */
96
76
  export interface LoginSteps {
97
- /** One per cloud: its name and its lines, in order. */
77
+ /** Its name and its lines, in order: one step for chant's trade, or one per cloud on Forgejo. */
98
78
  steps: Array<{
99
79
  name: string;
100
80
  lines: string[];
@@ -104,8 +84,6 @@ export interface LoginSteps {
104
84
  }
105
85
  /** The ID token's audience a cloud accepts. GCP's is the workload identity provider's own. */
106
86
  export declare function audience(login: Login): string;
107
- /** The GitLab ID token variable per cloud, as #50 named them. */
108
- export declare const GITLAB_ID_TOKEN: Record<Cloud, string>;
109
87
  /** The login config for `env`'s roles minted by `token`: the environment's own, else the project's. */
110
88
  export declare function loginFor(login: CiLogin | undefined, env: string, token: CloudToken): Login | undefined;
111
89
  /**
@@ -114,10 +92,7 @@ export declare function loginFor(login: CiLogin | undefined, env: string, token:
114
92
  * for one cloud are refused.
115
93
  */
116
94
  export declare function jobLogins(login: CiLogin | undefined, held: ReadonlyArray<readonly [string, Role]>, cloudOf: (env: string, role: Role) => CloudToken | undefined): Login[];
117
- /**
118
- * The login steps of a job on `forge`, for `logins`. On Forgejo a cloud
119
- * without a `tokenFile` is left out: the runner's own identity mints there.
120
- */
95
+ /** The login steps of a job on `forge`, for `logins`: chant's trade on GitHub and GitLab, the runner's token file on Forgejo. */
121
96
  export declare function loginSteps(forge: LoginForge, logins: readonly Login[]): LoginSteps;
122
97
  /** What is wrong with yodel.config.ts `ci.login`, if anything. */
123
98
  export declare function loginProblem(value: unknown, where: string): string | undefined;
package/dist/ci/login.js CHANGED
@@ -1,22 +1,23 @@
1
1
  /**
2
2
  * The cloud login a CI job runs before yodel (#132), when a role it holds
3
- * has a password minted by a cloud token source: the job's OIDC token,
4
- * exchanged by the cloud's own command line, which then mints the database
5
- * token (`aws rds generate-db-auth-token`, `gcloud sql generate-login-token`,
6
- * `az account get-access-token`). yodel.config.ts `ci.login` says what to
7
- * log in as ({@link CiLogin}); this renders the steps per forge. Nothing
8
- * here calls a cloud: the rendered job does, when it runs.
3
+ * has a password minted by a cloud token source. yodel.config.ts `ci.login`
4
+ * says what to log in as ({@link CiLogin}); this renders the steps per
5
+ * forge. Nothing here calls a cloud: the rendered job does, when it runs.
9
6
  *
10
- * The token, per forge:
11
- * - GitHub: the job requests it for the cloud's audience
12
- * (ACTIONS_ID_TOKEN_REQUEST_URL, granted by `id-token: write`) and writes
13
- * it to the token file.
14
- * - GitLab: the job's `id_tokens` variable (AWS_ID_TOKEN, GCP_ID_TOKEN,
15
- * AZURE_ID_TOKEN) is written to the token file.
16
- * - Forgejo gives a job no OIDC token: a login is rendered only when the
17
- * config's `tokenFile` names a token the runner provides.
7
+ * On GitHub and GitLab the login is chant's ci-identity trade (#296,
8
+ * chant#4554): one step trades the job's OIDC token for every cloud the job
9
+ * holds a role in, from `/` with no file of the checkout in reach, and
10
+ * writes the cloud's variables for the job's later steps. The sql lexicon's
11
+ * token sources mint the database token from what the trade left
12
+ * (chant#4572): `rds-iam` with the traded AWS keys, `cloud-sql-iam` from the
13
+ * traded Google token, `entra` from the Azure Database token, so the image
14
+ * needs no `aws`, `gcloud` or `az`. yodel keeps only the mapping from
15
+ * `ci.login` to chant's trade spec ({@link tradeSpec}). The trade's GitLab
16
+ * `id_tokens` are chant's (`CHANT_ID_TOKEN_<CLOUD>`).
18
17
  *
19
- * The login, per cloud, from the token file:
18
+ * Forgejo gives a job no OIDC token, so there is nothing to trade: a login
19
+ * is rendered only when the config's `tokenFile` names a token the runner
20
+ * provides, and it is yodel's own, from that file:
20
21
  * - aws: AWS_ROLE_ARN, AWS_WEB_IDENTITY_TOKEN_FILE and AWS_ROLE_SESSION_NAME,
21
22
  * which the aws command line assumes the role with.
22
23
  * - gcp: an external_account credential configuration over the token file
@@ -24,37 +25,11 @@
24
25
  * `gcloud auth login --cred-file` with it, and GOOGLE_APPLICATION_CREDENTIALS.
25
26
  * - azure: `az login --service-principal --federated-token`, and
26
27
  * AZURE_CLIENT_ID, AZURE_TENANT_ID and AZURE_FEDERATED_TOKEN_FILE.
27
- *
28
- * On GitHub and Forgejo the variables go to $GITHUB_ENV, so every later step
29
- * has them (the report too); on GitLab they are the job's `variables`, so
30
- * after_script has them too.
28
+ * The variables go to $GITHUB_ENV, so every later step has them (the
29
+ * report too). Yodel's own login on GitHub and GitLab, from before the
30
+ * trade, left in 0.12 (#303).
31
31
  */
32
- let trade;
33
- /** The trade the next render uses, or none for yodel's own login. {@link chantTrade} finds it; tests set their own. */
34
- export function useChantTrade(t) {
35
- trade = t;
36
- }
37
- /** Whether logins render through chant's trade. */
38
- export const tradesThroughChant = () => trade !== undefined;
39
- /**
40
- * chant's trade, when the installed chant has it with the database token
41
- * (`AZURE_DATABASE_TOKEN_ENV`, chant#4572) and the sql lexicon mints from a
42
- * traded identity (`tradedToken`); else undefined. Both are imported lazily,
43
- * with the specifiers in variables, so a published chant keeps yodel's login.
44
- */
45
- export async function chantTrade() {
46
- const identity = "@intentius/chant/ci-identity";
47
- const tokens = "@intentius/chant-lexicon-sql/token-source";
48
- try {
49
- const m = (await import(identity));
50
- const t = (await import(tokens));
51
- const ok = typeof m.tradeLine === "function" && typeof m.gitlabTradeLines === "function" && typeof m.gitlabTradeIdTokens === "function" && typeof m.TRADE_SPEC_ENV === "string" && typeof m.AZURE_DATABASE_TOKEN_ENV === "string" && typeof t.tradedToken === "function";
52
- return ok ? m : undefined;
53
- }
54
- catch {
55
- return undefined;
56
- }
57
- }
32
+ import { gitlabTradeIdTokens, gitlabTradeLines, TRADE_SPEC_ENV, tradeLine } from "@intentius/chant/ci-identity";
58
33
  /** yodel.config.ts `ci.login` for a job's logins, as chant's trade spec. */
59
34
  export function tradeSpec(logins) {
60
35
  const spec = {};
@@ -69,17 +44,17 @@ export function tradeSpec(logins) {
69
44
  }
70
45
  return spec;
71
46
  }
72
- /** A GitLab job's `id_tokens` for its logins through chant's trade, or undefined for yodel's own. */
47
+ /** A GitLab job's `id_tokens` for its logins through chant's trade, or undefined when it has none. */
73
48
  export function tradeIdTokens(logins) {
74
- return trade && logins.length > 0 ? trade.gitlabTradeIdTokens(tradeSpec(logins)) : undefined;
49
+ return logins.length > 0 ? gitlabTradeIdTokens(tradeSpec(logins)) : undefined;
75
50
  }
76
51
  /** The trade's steps for a job on GitHub or GitLab. */
77
- function tradeSteps(t, forge, logins) {
52
+ function tradeSteps(forge, logins) {
78
53
  const spec = JSON.stringify(tradeSpec(logins));
79
54
  const name = `Cloud identity (chant ci-identity: ${logins.map((l) => l.cloud).join(", ")})`;
80
55
  if (forge === "gitlab")
81
- return { steps: [{ name, lines: t.gitlabTradeLines() }], variables: { [t.TRADE_SPEC_ENV]: spec } };
82
- return { steps: [{ name, lines: [`export ${t.TRADE_SPEC_ENV}=${quote(spec)}`, t.tradeLine("$GITHUB_ENV", "github-env")] }], variables: {} };
56
+ return { steps: [{ name, lines: gitlabTradeLines() }], variables: { [TRADE_SPEC_ENV]: spec } };
57
+ return { steps: [{ name, lines: [`export ${TRADE_SPEC_ENV}=${quote(spec)}`, tradeLine("$GITHUB_ENV", "github-env")] }], variables: {} };
83
58
  }
84
59
  export const CLOUDS = ["aws", "gcp", "azure"];
85
60
  /** The cloud whose login a token source mints from. */
@@ -92,8 +67,6 @@ export function audience(login) {
92
67
  return `https://iam.googleapis.com/${login.config.workloadIdentityProvider}`;
93
68
  return "api://AzureADTokenExchange";
94
69
  }
95
- /** The GitLab ID token variable per cloud, as #50 named them. */
96
- export const GITLAB_ID_TOKEN = { aws: "AWS_ID_TOKEN", gcp: "GCP_ID_TOKEN", azure: "AZURE_ID_TOKEN" };
97
70
  /** The login config for `env`'s roles minted by `token`: the environment's own, else the project's. */
98
71
  export function loginFor(login, env, token) {
99
72
  const cloud = CLOUD_OF[token];
@@ -126,19 +99,6 @@ export function jobLogins(login, held, cloudOf) {
126
99
  return l ? [l] : [];
127
100
  });
128
101
  }
129
- /** Where a job keeps a cloud's token by default. */
130
- const defaultTokenFile = (forge, cloud) => {
131
- if (forge === "github")
132
- return `$RUNNER_TEMP/yodel-${cloud}-token`;
133
- if (forge === "gitlab")
134
- return `/tmp/yodel-${cloud}-token`;
135
- return undefined;
136
- };
137
- /**
138
- * Requests the job's OIDC token for an audience and writes it to a file:
139
- * `node -e '<this>' <audience> <file>`, so every image with node runs it.
140
- */
141
- const GITHUB_OIDC = 'const [aud, file] = process.argv.slice(1); const url = process.env.ACTIONS_ID_TOKEN_REQUEST_URL, auth = process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN; if (!url || !auth) { console.error("no OIDC token for this job: the workflow needs permissions id-token: write"); process.exit(1); } fetch(url + "&audience=" + encodeURIComponent(aud), { headers: { Authorization: "bearer " + auth } }).then(async (r) => { if (!r.ok) throw new Error("the OIDC token request answered " + r.status); require("fs").writeFileSync(file, (await r.json()).value, { mode: 0o600 }); }).catch((e) => { console.error(e.message); process.exit(1); })';
142
102
  /** Writes the gcloud credential configuration: `node -e '<this>' <provider> <service account> <token file> <config file>`. */
143
103
  const GCP_CREDENTIALS = 'const [provider, sa, token, file] = process.argv.slice(1); require("fs").writeFileSync(file, JSON.stringify({ type: "external_account", audience: "//iam.googleapis.com/" + provider, subject_token_type: "urn:ietf:params:oauth:token-type:jwt", token_url: "https://sts.googleapis.com/v1/token", service_account_impersonation_url: "https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/" + sa + ":generateAccessToken", credential_source: { file: token } }, null, 2))';
144
104
  const quote = (s) => `'${s.replace(/'/g, `'\\''`)}'`;
@@ -153,23 +113,14 @@ function loginVariables(l, tokenFile) {
153
113
  return { AZURE_CLIENT_ID: l.config.clientId, AZURE_TENANT_ID: l.config.tenantId, AZURE_FEDERATED_TOKEN_FILE: tokenFile };
154
114
  }
155
115
  const STEP_NAME = { aws: "Log in to AWS (web identity)", gcp: "Log in to Google Cloud (workload identity)", azure: "Log in to Azure (federated token)" };
156
- /**
157
- * The login steps of a job on `forge`, for `logins`. On Forgejo a cloud
158
- * without a `tokenFile` is left out: the runner's own identity mints there.
159
- */
160
- export function loginSteps(forge, logins) {
161
- if (trade && forge !== "forgejo" && logins.length > 0)
162
- return tradeSteps(trade, forge, logins);
116
+ /** A Forgejo job's login from the runner's token file; a cloud without a `tokenFile` is left out, since the runner's own identity mints there. */
117
+ function forgejoSteps(logins) {
163
118
  const out = { steps: [], variables: {} };
164
119
  for (const l of logins) {
165
- const file = l.config.tokenFile ?? defaultTokenFile(forge, l.cloud);
120
+ const file = l.config.tokenFile;
166
121
  if (file === undefined)
167
122
  continue;
168
123
  const lines = [];
169
- if (forge === "github")
170
- lines.push(`node -e ${quote(GITHUB_OIDC)} ${quote(audience(l))} ${path(file)}`);
171
- if (forge === "gitlab")
172
- lines.push(`(umask 077 && printf '%s' "$${GITLAB_ID_TOKEN[l.cloud]}" > ${path(file)})`);
173
124
  if (l.cloud === "gcp") {
174
125
  lines.push(`node -e ${quote(GCP_CREDENTIALS)} ${quote(l.config.workloadIdentityProvider)} ${quote(l.config.serviceAccount)} ${path(file)} ${path(`${file}.json`)}`);
175
126
  lines.push(`gcloud auth login --cred-file=${path(`${file}.json`)} --quiet`);
@@ -177,15 +128,17 @@ export function loginSteps(forge, logins) {
177
128
  if (l.cloud === "azure") {
178
129
  lines.push(`az login --service-principal --username ${quote(l.config.clientId)} --tenant ${quote(l.config.tenantId)} --federated-token "$(cat ${path(file)})" --allow-no-subscriptions --output none`);
179
130
  }
180
- const vars = loginVariables(l, file);
181
- if (forge === "gitlab")
182
- Object.assign(out.variables, vars);
183
- else
184
- lines.push(...Object.entries(vars).map(([k, v]) => `echo "${k}=${v}" >> "$GITHUB_ENV"`));
131
+ lines.push(...Object.entries(loginVariables(l, file)).map(([k, v]) => `echo "${k}=${v}" >> "$GITHUB_ENV"`));
185
132
  out.steps.push({ name: STEP_NAME[l.cloud], lines });
186
133
  }
187
134
  return out;
188
135
  }
136
+ /** The login steps of a job on `forge`, for `logins`: chant's trade on GitHub and GitLab, the runner's token file on Forgejo. */
137
+ export function loginSteps(forge, logins) {
138
+ if (logins.length === 0)
139
+ return { steps: [], variables: {} };
140
+ return forge === "forgejo" ? forgejoSteps(logins) : tradeSteps(forge, logins);
141
+ }
189
142
  // ── yodel.config.ts ci.login, checked ───────────────────────────────────────
190
143
  const ROLE_ARN = /^arn:aws[a-z-]*:iam::\d{12}:role\/[\w+=,.@/-]+$/;
191
144
  const PROVIDER = /^projects\/\d+\/locations\/global\/workloadIdentityPools\/[a-z0-9-]+\/providers\/[a-z0-9-]+$/;