@intentius/chant 0.124.101 → 0.124.102

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 (101) hide show
  1. package/dist/ci-evidence-claims.d.ts +12 -0
  2. package/dist/ci-evidence-claims.js +12 -0
  3. package/dist/cli/handlers/release-init.js +50 -18
  4. package/dist/cli/handlers/release.d.ts +1 -1
  5. package/dist/cli/handlers/release.js +12 -9
  6. package/dist/cli/release-commands/cut.js +4 -3
  7. package/dist/cli/release-commands/init.js +4 -1
  8. package/dist/cli/release-commands/workflow.js +4 -2
  9. package/dist/cloud-lister/index.d.ts +4 -1
  10. package/dist/cloud-lister/index.js +2 -1
  11. package/dist/cloud-lister/kubernetes-components.d.ts +56 -0
  12. package/dist/cloud-lister/kubernetes-components.js +642 -0
  13. package/dist/cloud-lister/kubernetes.d.ts +18 -0
  14. package/dist/cloud-lister/kubernetes.js +26 -1
  15. package/dist/cloud-lister/mask.d.ts +5 -1
  16. package/dist/cloud-lister/mask.js +14 -5
  17. package/dist/config-import.d.ts +1 -1
  18. package/dist/config-import.js +6 -2
  19. package/dist/config-sandbox.d.ts +1 -1
  20. package/dist/config-sandbox.js +3 -3
  21. package/dist/config.d.ts +75 -1
  22. package/dist/config.js +27 -2
  23. package/dist/deep-observation.js +9 -3
  24. package/dist/floor-table.data.js +12 -6
  25. package/dist/lexicon.d.ts +4 -2
  26. package/dist/lifecycle/__fixtures__/package-files.d.ts +32 -0
  27. package/dist/lifecycle/__fixtures__/package-files.js +72 -0
  28. package/dist/lifecycle/__fixtures__/publish-fakes.js +5 -0
  29. package/dist/lifecycle/publish-credentials.d.ts +1 -1
  30. package/dist/lifecycle/publish-credentials.js +5 -0
  31. package/dist/lifecycle/publish-declaration.d.ts +123 -0
  32. package/dist/lifecycle/publish-declaration.js +140 -0
  33. package/dist/lifecycle/publish-helm.d.ts +83 -0
  34. package/dist/lifecycle/publish-helm.js +452 -0
  35. package/dist/lifecycle/publish-maven.d.ts +79 -0
  36. package/dist/lifecycle/publish-maven.js +364 -0
  37. package/dist/lifecycle/publish-mcp-registry.js +1 -2
  38. package/dist/lifecycle/publish-npm.d.ts +27 -1
  39. package/dist/lifecycle/publish-npm.js +51 -1
  40. package/dist/lifecycle/publish-nuget.d.ts +93 -0
  41. package/dist/lifecycle/publish-nuget.js +377 -0
  42. package/dist/lifecycle/publish-oci.d.ts +57 -1
  43. package/dist/lifecycle/publish-oci.js +1 -1
  44. package/dist/lifecycle/publish-package-files.d.ts +16 -0
  45. package/dist/lifecycle/publish-package-files.js +39 -0
  46. package/dist/lifecycle/publish-pypi.d.ts +2 -0
  47. package/dist/lifecycle/publish-pypi.js +1 -1
  48. package/dist/lifecycle/publish-rubygems.d.ts +84 -0
  49. package/dist/lifecycle/publish-rubygems.js +366 -0
  50. package/dist/lifecycle/publish-targets.d.ts +10 -0
  51. package/dist/lifecycle/publish-targets.js +22 -0
  52. package/dist/lifecycle/publish-train-names.d.ts +4 -1
  53. package/dist/lifecycle/publish-train-names.js +5 -0
  54. package/dist/lifecycle/release-artifacts.d.ts +80 -2
  55. package/dist/lifecycle/release-artifacts.js +242 -5
  56. package/dist/lifecycle/release-cut.d.ts +6 -1
  57. package/dist/lifecycle/release-cut.js +15 -0
  58. package/dist/lifecycle/release-doctor.js +208 -6
  59. package/dist/lifecycle/release-init-registries.d.ts +48 -0
  60. package/dist/lifecycle/release-init-registries.js +97 -0
  61. package/dist/lifecycle/release-init.d.ts +22 -2
  62. package/dist/lifecycle/release-init.js +132 -7
  63. package/dist/lifecycle/release-next.js +1 -2
  64. package/dist/lifecycle/release-publish.d.ts +1 -1
  65. package/dist/lifecycle/release-publish.js +1 -1
  66. package/dist/lifecycle/release-tag.js +1 -2
  67. package/dist/op/local-executor.d.ts +1 -1
  68. package/dist/op/local-executor.js +2 -2
  69. package/dist/op/op-waves-evidence.js +9 -2
  70. package/dist/release-floors.d.ts +1 -1
  71. package/dist/release-floors.js +1 -1
  72. package/dist/sensitive-key.d.ts +12 -0
  73. package/dist/sensitive-key.js +52 -0
  74. package/dist/tool-pins.d.ts +2 -0
  75. package/dist/tool-pins.js +12 -0
  76. package/dist/ts-loader.d.ts +8 -0
  77. package/dist/ts-loader.js +19 -0
  78. package/dist/wave-runtime.mjs +325 -325
  79. package/dist/workspace/lexicon-outputs.d.ts +1 -1
  80. package/dist/workspace/lexicon-outputs.js +1 -1
  81. package/dist/workspace/release-steps/index.js +4 -0
  82. package/dist/workspace/release-steps/nfpm.d.ts +13 -0
  83. package/dist/workspace/release-steps/nfpm.js +29 -0
  84. package/dist/workspace/release-steps/nuget.d.ts +14 -0
  85. package/dist/workspace/release-steps/nuget.js +16 -0
  86. package/dist/workspace/release-steps/targets.d.ts +2 -2
  87. package/dist/workspace/release-steps/targets.js +3 -3
  88. package/dist/workspace/release-train-workflow.d.ts +7 -0
  89. package/dist/workspace/release-train-workflow.js +46 -10
  90. package/dist/workspace/release-workflow.d.ts +28 -3
  91. package/dist/workspace/release-workflow.js +38 -15
  92. package/dist/workspace/train-cut.d.ts +2 -2
  93. package/dist/workspace/train-cut.js +27 -5
  94. package/dist/workspace/train-prepare.d.ts +6 -3
  95. package/dist/workspace/train-prepare.js +54 -8
  96. package/dist/workspace/train-publish.js +2 -3
  97. package/dist/workspace/train-shell.d.ts +5 -0
  98. package/dist/workspace/train-shell.js +17 -0
  99. package/dist/workspace/trust/check-evidence-report.d.ts +3 -7
  100. package/dist/workspace/trust/check-evidence-report.js +3 -7
  101. package/package.json +1 -1
@@ -14,7 +14,10 @@
14
14
  * - the workspace packages it depends on, directly or not, that this run
15
15
  * does not publish are built once each, dependencies first, so a package
16
16
  * that builds against another's output finds it. The members this run
17
- * publishes build when npm packs them, in the train's layer order. The
17
+ * publishes build when npm packs them, in the train's layer order. A
18
+ * member cut here whose package an earlier run of the publish already
19
+ * revealed is not packed again, so it builds here like any other
20
+ * dependency (#5222): a resumed publish finds what it left built. The
18
21
  * command is `release.train.buildDependencies`, else the package's
19
22
  * `prepack` script, else its `build` script.
20
23
  *
@@ -23,7 +26,7 @@
23
26
  * target; its dependencies are its `dependencies`, `peerDependencies` and
24
27
  * `optionalDependencies` that name another such package.
25
28
  */
26
- import { execFileSync, spawnSync } from "node:child_process";
29
+ import { execFileSync } from "node:child_process";
27
30
  import { existsSync, readdirSync, readFileSync, realpathSync } from "node:fs";
28
31
  // @ts-ignore — picomatch has no types declaration
29
32
  import picomatch from "picomatch";
@@ -31,8 +34,10 @@ import { resolve } from "node:path";
31
34
  import { readDeclaration } from "./declaration.js";
32
35
  import { findTrain, readReleaseTrains } from "./release-train.js";
33
36
  import { TrainCutError, trainConfigAt } from "./train-cut.js";
37
+ import { runToStderr } from "./train-shell.js";
34
38
  import { locateWorkspace } from "./which-chant.js";
35
- const defaultRun = (command, cwd) => spawnSync("sh", ["-c", command], { cwd, stdio: ["ignore", "inherit", "inherit"] }).status ?? 1;
39
+ // A build's stdout goes to stderr: under --json, stdout is the prepare's JSON document alone.
40
+ const defaultRun = (command, cwd) => runToStderr(command, { cwd });
36
41
  /** Stamp and build what the train's members cut from this commit need before `train publish` (#5154). */
37
42
  export async function prepareTrain(q) {
38
43
  const located = locateWorkspace(q.cwd);
@@ -60,13 +65,20 @@ export async function prepareTrain(q) {
60
65
  // Every workspace package the members name, by name.
61
66
  const packages = new Map();
62
67
  const ownedBy = new Map();
68
+ // Per member, each package it owns and the npm targets that pack it (none for a package only release.version names).
69
+ const packedBy = new Map();
70
+ const declsOf = new Map();
63
71
  for (const m of members) {
64
72
  const dir = resolve(root, m.dir);
65
73
  if (!existsSync(dir))
66
74
  continue;
67
75
  const release = (await loadChantConfig(dir)).config.release;
68
- const dirs = [...(release?.version?.packages ?? []), ...(release?.publish ?? []).flatMap((t) => (t.type === "npm" ? (t.packages ?? []) : []))];
69
- for (const p of dirs) {
76
+ declsOf.set(m.name, (release?.publish ?? []));
77
+ const dirs = [
78
+ ...(release?.version?.packages ?? []).map((p) => ({ p, decl: null })),
79
+ ...(release?.publish ?? []).flatMap((t) => (t.type === "npm" ? (t.packages ?? []).map((p) => ({ p, decl: t })) : [])),
80
+ ];
81
+ for (const { p, decl } of dirs) {
70
82
  const file = resolve(dir, p, "package.json");
71
83
  if (!existsSync(file))
72
84
  continue;
@@ -81,7 +93,11 @@ export async function prepareTrain(q) {
81
93
  if (typeof pkg.name !== "string")
82
94
  continue;
83
95
  packages.set(pkg.name, { dir: abs, name: pkg.name, needs: Object.keys({ ...pkg.dependencies, ...pkg.peerDependencies, ...pkg.optionalDependencies }), scripts: pkg.scripts ?? {} });
84
- ownedBy.set(m.name, [...(ownedBy.get(m.name) ?? []), pkg.name]);
96
+ if (!(ownedBy.get(m.name) ?? []).includes(pkg.name))
97
+ ownedBy.set(m.name, [...(ownedBy.get(m.name) ?? []), pkg.name]);
98
+ const by = packedBy.get(m.name) ?? new Map();
99
+ by.set(pkg.name, [...(by.get(pkg.name) ?? []), ...(decl ? [decl] : [])]);
100
+ packedBy.set(m.name, by);
85
101
  }
86
102
  }
87
103
  // The repository's other workspace packages (npm, yarn and pnpm workspaces), which a member's package may build against.
@@ -123,7 +139,7 @@ export async function prepareTrain(q) {
123
139
  // Build, once each and dependencies first, the packages the published ones need and this run does not publish.
124
140
  const built = [];
125
141
  if (config.buildDependencies !== false) {
126
- const published = new Set(here.flatMap((t) => ownedBy.get(t.member) ?? []));
142
+ const published = await packedThisRun(here, members, root, ownedBy, packedBy, declsOf);
127
143
  const order = [];
128
144
  const seen = new Set();
129
145
  const visit = (name) => {
@@ -144,7 +160,7 @@ export async function prepareTrain(q) {
144
160
  continue;
145
161
  const shown = p.dir.startsWith(`${realpathSync(located.top ?? root)}/`) ? p.dir.slice(realpathSync(located.top ?? root).length + 1) : p.dir;
146
162
  say(`build ${name} (${shown}), which ${[...published].filter((x) => dependsOn(packages, x, name)).join(", ")} builds against: ${command}`);
147
- const code = (q.run ?? defaultRun)(command, p.dir);
163
+ const code = await (q.run ?? defaultRun)(command, p.dir);
148
164
  if (code !== 0)
149
165
  throw new TrainCutError("train-build-failed", `building ${name} in ${shown} failed (exit ${code}): ${command}`, "Fix the build and run the prepare again in a clean checkout of the train's commit.");
150
166
  built.push({ dir: shown, command });
@@ -152,6 +168,36 @@ export async function prepareTrain(q) {
152
168
  }
153
169
  return { train, stamped, built };
154
170
  }
171
+ /**
172
+ * The packages the publish packs in this run: those of each member cut here,
173
+ * less the ones an earlier run already revealed (#5222). A package is
174
+ * revealed when every npm target that packs it is; a package no npm target
175
+ * packs, when every target of its member is.
176
+ */
177
+ async function packedThisRun(here, members, root, ownedBy, packedBy, declsOf) {
178
+ const { publishProgress, readPublishRecords } = await import("../lifecycle/publish-record.js");
179
+ const { publishTargetKey } = await import("../lifecycle/publish-targets.js");
180
+ const out = new Set();
181
+ for (const t of here) {
182
+ const m = members.find((x) => x.name === t.member);
183
+ const owned = ownedBy.get(t.member) ?? [];
184
+ if (!m) {
185
+ owned.forEach((n) => out.add(n));
186
+ continue;
187
+ }
188
+ const progress = publishProgress(await readPublishRecords(t.releaseDigest, { cwd: resolve(root, m.dir) }).catch(() => []));
189
+ const revealed = (d) => progress.revealed.has(publishTargetKey(d));
190
+ const decls = declsOf.get(t.member) ?? [];
191
+ const memberRevealed = decls.length > 0 && decls.every(revealed);
192
+ for (const name of owned) {
193
+ const by = packedBy.get(t.member)?.get(name) ?? [];
194
+ const done = by.length > 0 ? by.every(revealed) : memberRevealed;
195
+ if (!done)
196
+ out.add(name);
197
+ }
198
+ }
199
+ return out;
200
+ }
155
201
  /**
156
202
  * The package directories the repository's root declares as workspaces:
157
203
  * `workspaces` in its package.json (an array, or `{ packages }` as yarn
@@ -59,9 +59,8 @@ import { PublishTargetError, revealOrder } from "../lifecycle/release-publish.js
59
59
  import { readDeclaration } from "./declaration.js";
60
60
  import { findTrain, readReleaseTrains } from "./release-train.js";
61
61
  import { locateWorkspace } from "./which-chant.js";
62
- import { NEXT_RELEASE } from "../release-floors.js";
63
62
  /** The first chant whose `chant workspace train publish` orders and resumes members of every target kind (#5165): the oci, forge, homebrew, index, marketplace, pypi, cargo, mcp-registry and tauri-updater targets name what they publish and need, say whether a pinned release is published, and wait until a reveal is served before the next layer; a member's `release.dependsOn` names members a manifest doesn't show. */
64
- export const TRAIN_PUBLISH_TARGETS_FLOOR = NEXT_RELEASE;
63
+ export const TRAIN_PUBLISH_TARGETS_FLOOR = "0.124.101";
65
64
  /** A train publish that stopped, with what it left staged and revealed (`<member>: <target>`), so a run of the same command resumes. */
66
65
  export class TrainPublishRunError extends PublishTargetError {
67
66
  constructor(code, message, fix, member, step, staged, revealed) {
@@ -500,7 +499,7 @@ export async function runTrainPublish(ctx, words) {
500
499
  cwd,
501
500
  env,
502
501
  ...(ref !== undefined ? { train: ref } : {}),
503
- yes: args.yes === true,
502
+ yes: args.yes === true && args.dryRun !== true,
504
503
  allowUnsigned: args.allowUnsigned === true,
505
504
  requireProvenance: args.requireProvenance === true,
506
505
  say: (line) => (json ? undefined : console.error(line)),
@@ -0,0 +1,5 @@
1
+ /** Runs `line` with `sh -c` and returns its exit code; its stdout and stderr both reach this process's stderr. */
2
+ export declare function runToStderr(line: string, o: {
3
+ cwd: string;
4
+ env?: NodeJS.ProcessEnv;
5
+ }): Promise<number>;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The shell lines a train command runs for its user: `release.train.check`
3
+ * in `train cut`, and the builds of `train prepare`. Their stdout goes to
4
+ * this process's stderr, as `release.verify`'s does, so stdout carries only
5
+ * what the command prints itself, and under `--json` that is one JSON
6
+ * document a step can parse.
7
+ */
8
+ import { spawn } from "node:child_process";
9
+ /** Runs `line` with `sh -c` and returns its exit code; its stdout and stderr both reach this process's stderr. */
10
+ export function runToStderr(line, o) {
11
+ return new Promise((done) => {
12
+ const child = spawn("sh", ["-c", line], { cwd: o.cwd, env: o.env ?? process.env, stdio: ["ignore", "pipe", "inherit"] });
13
+ child.stdout.on("data", (chunk) => process.stderr.write(chunk));
14
+ child.on("error", () => done(1));
15
+ child.on("close", (code) => done(code ?? 1));
16
+ });
17
+ }
@@ -16,15 +16,11 @@
16
16
  * Kept apart from ./check-evidence.ts so `pr-post` reads the note file
17
17
  * without loading the signer.
18
18
  */
19
- /** The variable a generated job hands the runner key in, as PEM (the same one the tick and `chant ci run` read). */
20
- export declare const CHECK_EVIDENCE_KEY_ENV = "CHANT_RUNNER_KEY";
19
+ import { CHECK_EVIDENCE_KEY_ENV, RUNNER_IDENTITY_ENV } from "../../ci-evidence-claims.js";
20
+ /** The runner key and runner identity variables live in ../../ci-evidence-claims.ts (#5219). */
21
+ export { CHECK_EVIDENCE_KEY_ENV, RUNNER_IDENTITY_ENV };
21
22
  /** The variable a developer's or an agent's local evidence key is read from, as PEM (#4868). A check hook never sees it. */
22
23
  export declare const LOCAL_EVIDENCE_KEY_ENV = "CHANT_LOCAL_EVIDENCE_KEY";
23
- /**
24
- * The variable a generated job sets to `oidc` when it signs keyless from
25
- * its OIDC identity (#4869) instead of with a runner key.
26
- */
27
- export declare const RUNNER_IDENTITY_ENV = "CHANT_RUNNER_IDENTITY";
28
24
  /** The GitLab `id_tokens` variable a keyless signing job's token comes in (#4869), with the signing audience. */
29
25
  export declare const SIGNING_ID_TOKEN_VAR = "CHANT_ID_TOKEN_SIGSTORE";
30
26
  /** The file the signing step writes beside the plan report, which `pr-post` reads. */
@@ -18,15 +18,11 @@
18
18
  */
19
19
  import { existsSync, readFileSync } from "node:fs";
20
20
  import { join } from "node:path";
21
- /** The variable a generated job hands the runner key in, as PEM (the same one the tick and `chant ci run` read). */
22
- export const CHECK_EVIDENCE_KEY_ENV = "CHANT_RUNNER_KEY";
21
+ import { CHECK_EVIDENCE_KEY_ENV, RUNNER_IDENTITY_ENV } from "../../ci-evidence-claims.js";
22
+ /** The runner key and runner identity variables live in ../../ci-evidence-claims.ts (#5219). */
23
+ export { CHECK_EVIDENCE_KEY_ENV, RUNNER_IDENTITY_ENV };
23
24
  /** The variable a developer's or an agent's local evidence key is read from, as PEM (#4868). A check hook never sees it. */
24
25
  export const LOCAL_EVIDENCE_KEY_ENV = "CHANT_LOCAL_EVIDENCE_KEY";
25
- /**
26
- * The variable a generated job sets to `oidc` when it signs keyless from
27
- * its OIDC identity (#4869) instead of with a runner key.
28
- */
29
- export const RUNNER_IDENTITY_ENV = "CHANT_RUNNER_IDENTITY";
30
26
  /** The GitLab `id_tokens` variable a keyless signing job's token comes in (#4869), with the signing audience. */
31
27
  export const SIGNING_ID_TOKEN_VAR = "CHANT_ID_TOKEN_SIGSTORE";
32
28
  /** The file the signing step writes beside the plan report, which `pr-post` reads. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intentius/chant",
3
- "version": "0.124.101",
3
+ "version": "0.124.102",
4
4
  "description": "Declarative infrastructure-as-code toolkit — TypeScript on Node.js",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://intentius.io/chant",