@intentius/chant 0.124.100 → 0.124.101

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 (223) hide show
  1. package/dist/action-pins.d.ts +2 -0
  2. package/dist/action-pins.js +3 -0
  3. package/dist/ci-detect.d.ts +13 -0
  4. package/dist/ci-detect.js +12 -0
  5. package/dist/ci-system.d.ts +66 -0
  6. package/dist/ci-system.js +61 -0
  7. package/dist/cli/handlers/build.js +27 -0
  8. package/dist/cli/handlers/release-doctor.d.ts +12 -0
  9. package/dist/cli/handlers/release-doctor.js +118 -0
  10. package/dist/cli/handlers/release-init.d.ts +10 -0
  11. package/dist/cli/handlers/release-init.js +342 -0
  12. package/dist/cli/handlers/release.d.ts +42 -1
  13. package/dist/cli/handlers/release.js +656 -31
  14. package/dist/cli/handlers/run-generate.js +11 -0
  15. package/dist/cli/main.d.ts +2 -0
  16. package/dist/cli/main.js +44 -101
  17. package/dist/cli/parse-args.js +48 -0
  18. package/dist/cli/registry.d.ts +16 -0
  19. package/dist/cli/release-commands/artifacts.d.ts +3 -0
  20. package/dist/cli/release-commands/artifacts.js +14 -0
  21. package/dist/cli/release-commands/candidates.d.ts +3 -0
  22. package/dist/cli/release-commands/candidates.js +16 -0
  23. package/dist/cli/release-commands/changed.d.ts +3 -0
  24. package/dist/cli/release-commands/changed.js +14 -0
  25. package/dist/cli/release-commands/compose.d.ts +3 -0
  26. package/dist/cli/release-commands/compose.js +16 -0
  27. package/dist/cli/release-commands/cut.d.ts +3 -0
  28. package/dist/cli/release-commands/cut.js +49 -0
  29. package/dist/cli/release-commands/doctor.d.ts +3 -0
  30. package/dist/cli/release-commands/doctor.js +14 -0
  31. package/dist/cli/release-commands/export.d.ts +3 -0
  32. package/dist/cli/release-commands/export.js +12 -0
  33. package/dist/cli/release-commands/images.d.ts +3 -0
  34. package/dist/cli/release-commands/images.js +13 -0
  35. package/dist/cli/release-commands/index.d.ts +8 -0
  36. package/dist/cli/release-commands/index.js +52 -0
  37. package/dist/cli/release-commands/init.d.ts +3 -0
  38. package/dist/cli/release-commands/init.js +16 -0
  39. package/dist/cli/release-commands/list.d.ts +3 -0
  40. package/dist/cli/release-commands/list.js +10 -0
  41. package/dist/cli/release-commands/next.d.ts +3 -0
  42. package/dist/cli/release-commands/next.js +13 -0
  43. package/dist/cli/release-commands/publish.d.ts +3 -0
  44. package/dist/cli/release-commands/publish.js +22 -0
  45. package/dist/cli/release-commands/stamp.d.ts +3 -0
  46. package/dist/cli/release-commands/stamp.js +15 -0
  47. package/dist/cli/release-commands/status.d.ts +3 -0
  48. package/dist/cli/release-commands/status.js +17 -0
  49. package/dist/cli/release-commands/tag.d.ts +3 -0
  50. package/dist/cli/release-commands/tag.js +12 -0
  51. package/dist/cli/release-commands/types.d.ts +20 -0
  52. package/dist/cli/release-commands/types.js +1 -0
  53. package/dist/cli/release-commands/verify.d.ts +3 -0
  54. package/dist/cli/release-commands/verify.js +15 -0
  55. package/dist/cli/release-commands/workflow.d.ts +3 -0
  56. package/dist/cli/release-commands/workflow.js +13 -0
  57. package/dist/components/cli-support.d.ts +1 -1
  58. package/dist/components/cli-support.js +1 -1
  59. package/dist/config-environments.d.ts +8 -1
  60. package/dist/config-environments.js +2 -0
  61. package/dist/config.d.ts +294 -9
  62. package/dist/config.js +100 -5
  63. package/dist/floor-table.data.js +15 -1
  64. package/dist/forge-remote.d.ts +13 -0
  65. package/dist/forge-remote.js +15 -0
  66. package/dist/lexicon.d.ts +41 -2
  67. package/dist/lifecycle/__fixtures__/publish-fakes.d.ts +62 -0
  68. package/dist/lifecycle/__fixtures__/publish-fakes.js +270 -3
  69. package/dist/lifecycle/publish-attachments.d.ts +2 -1
  70. package/dist/lifecycle/publish-attachments.js +19 -2
  71. package/dist/lifecycle/publish-cargo.d.ts +99 -0
  72. package/dist/lifecycle/publish-cargo.js +412 -0
  73. package/dist/lifecycle/publish-credentials.d.ts +1 -1
  74. package/dist/lifecycle/publish-credentials.js +8 -0
  75. package/dist/lifecycle/publish-declaration.d.ts +199 -4
  76. package/dist/lifecycle/publish-declaration.js +200 -9
  77. package/dist/lifecycle/publish-forge.d.ts +45 -2
  78. package/dist/lifecycle/publish-forge.js +434 -34
  79. package/dist/lifecycle/publish-git-ssh.d.ts +15 -0
  80. package/dist/lifecycle/publish-git-ssh.js +30 -4
  81. package/dist/lifecycle/publish-github.d.ts +40 -2
  82. package/dist/lifecycle/publish-github.js +100 -3
  83. package/dist/lifecycle/publish-homebrew.d.ts +7 -9
  84. package/dist/lifecycle/publish-homebrew.js +34 -197
  85. package/dist/lifecycle/publish-index.d.ts +141 -0
  86. package/dist/lifecycle/publish-index.js +719 -0
  87. package/dist/lifecycle/publish-marketplace.js +77 -0
  88. package/dist/lifecycle/publish-mcp-registry.d.ts +66 -0
  89. package/dist/lifecycle/publish-mcp-registry.js +306 -0
  90. package/dist/lifecycle/publish-npm.js +165 -2
  91. package/dist/lifecycle/publish-oci.d.ts +34 -1
  92. package/dist/lifecycle/publish-oci.js +246 -7
  93. package/dist/lifecycle/publish-pypi.d.ts +136 -0
  94. package/dist/lifecycle/publish-pypi.js +657 -0
  95. package/dist/lifecycle/publish-record.d.ts +6 -3
  96. package/dist/lifecycle/publish-record.js +6 -3
  97. package/dist/lifecycle/publish-signing.d.ts +147 -0
  98. package/dist/lifecycle/publish-signing.js +257 -0
  99. package/dist/lifecycle/publish-targets.d.ts +27 -1
  100. package/dist/lifecycle/publish-targets.js +80 -0
  101. package/dist/lifecycle/publish-tauri.js +43 -0
  102. package/dist/lifecycle/publish-train-names.d.ts +54 -0
  103. package/dist/lifecycle/publish-train-names.js +118 -0
  104. package/dist/lifecycle/publish-verify.d.ts +121 -0
  105. package/dist/lifecycle/publish-verify.js +130 -0
  106. package/dist/lifecycle/query.js +8 -0
  107. package/dist/lifecycle/release-artifacts.d.ts +212 -0
  108. package/dist/lifecycle/release-artifacts.js +571 -0
  109. package/dist/lifecycle/release-changelog.d.ts +13 -1
  110. package/dist/lifecycle/release-changelog.js +35 -2
  111. package/dist/lifecycle/release-cut.d.ts +58 -3
  112. package/dist/lifecycle/release-cut.js +132 -34
  113. package/dist/lifecycle/release-doctor.d.ts +113 -0
  114. package/dist/lifecycle/release-doctor.js +996 -0
  115. package/dist/lifecycle/release-green.d.ts +86 -0
  116. package/dist/lifecycle/release-green.js +286 -0
  117. package/dist/lifecycle/release-init.d.ts +255 -0
  118. package/dist/lifecycle/release-init.js +859 -0
  119. package/dist/lifecycle/release-intents.d.ts +73 -0
  120. package/dist/lifecycle/release-intents.js +128 -0
  121. package/dist/lifecycle/release-next.d.ts +111 -0
  122. package/dist/lifecycle/release-next.js +252 -0
  123. package/dist/lifecycle/release-prerelease.d.ts +19 -0
  124. package/dist/lifecycle/release-prerelease.js +30 -0
  125. package/dist/lifecycle/release-publish.d.ts +256 -10
  126. package/dist/lifecycle/release-publish.js +246 -34
  127. package/dist/lifecycle/release-status-change.d.ts +226 -0
  128. package/dist/lifecycle/release-status-change.js +478 -0
  129. package/dist/lifecycle/release-status.d.ts +11 -0
  130. package/dist/lifecycle/release-status.js +1 -1
  131. package/dist/lifecycle/release-store.d.ts +73 -2
  132. package/dist/lifecycle/release-store.js +32 -1
  133. package/dist/lifecycle/release-tag.d.ts +142 -0
  134. package/dist/lifecycle/release-tag.js +323 -0
  135. package/dist/lifecycle/release-verify.d.ts +73 -1
  136. package/dist/lifecycle/release-verify.js +117 -2
  137. package/dist/lifecycle/release-version-formats.d.ts +73 -0
  138. package/dist/lifecycle/release-version-formats.js +570 -0
  139. package/dist/lifecycle/release-version.d.ts +58 -10
  140. package/dist/lifecycle/release-version.js +164 -36
  141. package/dist/lifecycle/release-workstation.d.ts +3 -2
  142. package/dist/lifecycle/release-workstation.js +3 -2
  143. package/dist/op/generate-pipeline.js +1 -1
  144. package/dist/pr-forge-base.js +4 -2
  145. package/dist/pr-forge.d.ts +20 -2
  146. package/dist/pr-forge.js +46 -10
  147. package/dist/release-floors.d.ts +8 -1
  148. package/dist/release-floors.js +9 -2
  149. package/dist/tool-pins.d.ts +38 -0
  150. package/dist/tool-pins.js +54 -0
  151. package/dist/wave-runtime.mjs +337 -334
  152. package/dist/workspace/ci-forge.d.ts +17 -0
  153. package/dist/workspace/ci-forge.js +17 -0
  154. package/dist/workspace/ci-init.js +1 -1
  155. package/dist/workspace/composites.schema.json +1 -0
  156. package/dist/workspace/declaration.d.ts +8 -0
  157. package/dist/workspace/declaration.js +12 -0
  158. package/dist/workspace/declaration.schema.json +8 -0
  159. package/dist/workspace/environments.d.ts +2 -0
  160. package/dist/workspace/environments.js +1 -1
  161. package/dist/workspace/identity-gate-rule.d.ts +61 -5
  162. package/dist/workspace/identity-gate-rule.js +81 -12
  163. package/dist/workspace/member-pipeline.d.ts +2 -1
  164. package/dist/workspace/member-pipeline.js +5 -2
  165. package/dist/workspace/reason-codes.d.ts +2 -0
  166. package/dist/workspace/reason-codes.js +3 -1
  167. package/dist/workspace/release-changed.d.ts +75 -4
  168. package/dist/workspace/release-changed.js +205 -34
  169. package/dist/workspace/release-changed.schema.json +20 -2
  170. package/dist/workspace/release-steps/artifacts.d.ts +7 -0
  171. package/dist/workspace/release-steps/artifacts.js +45 -0
  172. package/dist/workspace/release-steps/builds.d.ts +12 -0
  173. package/dist/workspace/release-steps/builds.js +38 -0
  174. package/dist/workspace/release-steps/doctor.d.ts +8 -0
  175. package/dist/workspace/release-steps/doctor.js +14 -0
  176. package/dist/workspace/release-steps/goreleaser.d.ts +16 -0
  177. package/dist/workspace/release-steps/goreleaser.js +36 -0
  178. package/dist/workspace/release-steps/green.d.ts +3 -0
  179. package/dist/workspace/release-steps/green.js +6 -0
  180. package/dist/workspace/release-steps/images.d.ts +22 -0
  181. package/dist/workspace/release-steps/images.js +59 -0
  182. package/dist/workspace/release-steps/index.d.ts +9 -0
  183. package/dist/workspace/release-steps/index.js +46 -0
  184. package/dist/workspace/release-steps/pypi.d.ts +15 -0
  185. package/dist/workspace/release-steps/pypi.js +21 -0
  186. package/dist/workspace/release-steps/qemu.d.ts +21 -0
  187. package/dist/workspace/release-steps/qemu.js +35 -0
  188. package/dist/workspace/release-steps/signing.d.ts +18 -0
  189. package/dist/workspace/release-steps/signing.js +30 -0
  190. package/dist/workspace/release-steps/stamp.d.ts +3 -0
  191. package/dist/workspace/release-steps/stamp.js +4 -0
  192. package/dist/workspace/release-steps/targets.d.ts +31 -0
  193. package/dist/workspace/release-steps/targets.js +40 -0
  194. package/dist/workspace/release-steps/types.d.ts +104 -0
  195. package/dist/workspace/release-steps/types.js +2 -0
  196. package/dist/workspace/release-steps/verify.d.ts +3 -0
  197. package/dist/workspace/release-steps/verify.js +4 -0
  198. package/dist/workspace/release-toolchains.d.ts +59 -0
  199. package/dist/workspace/release-toolchains.js +133 -0
  200. package/dist/workspace/release-train-workflow.d.ts +29 -0
  201. package/dist/workspace/release-train-workflow.js +85 -0
  202. package/dist/workspace/release-train.d.ts +3 -1
  203. package/dist/workspace/release-train.js +20 -3
  204. package/dist/workspace/release-workflow.d.ts +160 -61
  205. package/dist/workspace/release-workflow.js +539 -193
  206. package/dist/workspace/releases.schema.json +70 -1
  207. package/dist/workspace/search-contract.d.ts +1 -1
  208. package/dist/workspace/security.js +9 -2
  209. package/dist/workspace/train-cut.d.ts +182 -0
  210. package/dist/workspace/train-cut.js +482 -0
  211. package/dist/workspace/train-prepare.d.ts +61 -0
  212. package/dist/workspace/train-prepare.js +267 -0
  213. package/dist/workspace/train-publish.d.ts +177 -0
  214. package/dist/workspace/train-publish.js +575 -0
  215. package/dist/workspace/train-range-labels.d.ts +33 -0
  216. package/dist/workspace/train-range-labels.js +109 -0
  217. package/dist/workspace/trust/seal.d.ts +13 -3
  218. package/dist/workspace/trust/seal.js +14 -4
  219. package/dist/workspace/work-cli.d.ts +3 -2
  220. package/dist/workspace/work-cli.js +3 -2
  221. package/dist/workspace/workspace-ledger.d.ts +14 -1
  222. package/dist/workspace/workspace-ledger.js +33 -7
  223. package/package.json +1 -1
@@ -50,6 +50,8 @@ import { GitHubRepo, githubApi } from "./publish-github.js";
50
50
  import { fillUrl, releaseVersion } from "./publish-homebrew.js";
51
51
  import { bytesDigest, checkReleaseDigest, memberFile, publishTargetKey } from "./publish-targets.js";
52
52
  import { PublishTargetError } from "./release-publish.js";
53
+ import { prereleaseOf } from "./release-prerelease.js";
54
+ import { trainName, waitUntilServed } from "./publish-train-names.js";
53
55
  /** The first chant that publishes a `tauri-updater` target (#4676). */
54
56
  export const PUBLISH_TAURI_UPDATER_FLOOR = "0.124.63";
55
57
  /** The updater manifest's bytes: 2-space JSON with a trailing newline, keys in the order Tauri's docs show them. */
@@ -106,6 +108,7 @@ export function tauriUpdaterTarget(decl, deps) {
106
108
  const repo = new GitHubRepo(githubApi(decl.api, ctx.env), decl.repo, token, fetchImpl, ctx, "publish-tauri-failed");
107
109
  return { version, token, files, repo, draftName: `${decl.tag} ${version}` };
108
110
  };
111
+ const skipNote = (ctx) => `skipped: ${ctx.label} is a prerelease, and the updater feed is what installed apps update from`;
109
112
  const where = (name) => `github ${decl.repo} release ${decl.tag}, asset ${name}`;
110
113
  const itemOf = (f, present = false) => ({ name: f.path, destination: where(f.name), digest: f.digest, ...(present ? { present: true } : {}) });
111
114
  const holdsAll = (rel, files) => rel.assets.size === files.length && files.every((f) => rel.assets.get(f.name) === f.digest);
@@ -115,10 +118,48 @@ export function tauriUpdaterTarget(decl, deps) {
115
118
  destination: `github ${decl.repo} release ${decl.tag}`,
116
119
  credentialEnv: tokenNames,
117
120
  key: publishTargetKey(decl),
121
+ /** #5165: the rolling release; it needs nothing a train orders by. */
122
+ async names() {
123
+ return { provides: [trainName("tauri-updater", `${decl.repo}@${decl.tag}`)], needs: [] };
124
+ },
125
+ /**
126
+ * #5165: whether the rolling release is this version's, by the name the
127
+ * stage gives its draft (`<tag> <version>`). A rolling release that holds
128
+ * another version can't say whether this one went out before it.
129
+ */
130
+ async published(ctx) {
131
+ if (prereleaseOf(ctx.label))
132
+ return true;
133
+ const version = releaseVersion(ctx.label);
134
+ const token = readCredential(ctx.env, tokenNames, ctx.redactor);
135
+ if (!version || !token)
136
+ return null;
137
+ const rel = await new GitHubRepo(githubApi(decl.api, ctx.env), decl.repo, token, fetchImpl, ctx, "publish-tauri-failed").publishedRelease(decl.tag);
138
+ return rel?.name === `${decl.tag} ${version}` ? true : null;
139
+ },
140
+ /** #5165: wait until the rolling release GitHub serves is this version's. */
141
+ async visible(ctx) {
142
+ const version = releaseVersion(ctx.label);
143
+ const token = readCredential(ctx.env, tokenNames, ctx.redactor);
144
+ if (prereleaseOf(ctx.label) || !version || !token)
145
+ return;
146
+ const repo = new GitHubRepo(githubApi(decl.api, ctx.env), decl.repo, token, fetchImpl, ctx, "publish-tauri-failed");
147
+ await waitUntilServed(ctx, deps, {
148
+ what: `github ${decl.repo}`,
149
+ code: "publish-tauri-not-served",
150
+ check: async () => ((await repo.publishedRelease(decl.tag))?.name === `${decl.tag} ${version}` ? [] : [`release ${decl.tag} ${version}`]),
151
+ });
152
+ },
118
153
  async plan(ctx) {
154
+ if (prereleaseOf(ctx.label))
155
+ return [{ name: decl.tag, destination: target.destination, notes: skipNote(ctx) }];
119
156
  return setup(ctx).files.map((f) => itemOf(f));
120
157
  },
121
158
  async stage(ctx) {
159
+ if (prereleaseOf(ctx.label)) {
160
+ ctx.log(skipNote(ctx));
161
+ return { target: target.name, destination: target.destination, items: [], state: { prerelease: "true" } };
162
+ }
122
163
  const { version, token, files, repo, draftName } = setup(ctx);
123
164
  ctx.log(`using the token from ${token.from}`);
124
165
  const done = (items, state) => ({ target: target.name, destination: target.destination, items, state });
@@ -151,6 +192,8 @@ export function tauriUpdaterTarget(decl, deps) {
151
192
  return done(items, { releaseId: draft.id });
152
193
  },
153
194
  async reveal(ctx, staged) {
195
+ if (staged.state.prerelease === "true")
196
+ return { target: target.name, destination: target.destination, items: [] };
154
197
  const items = staged.items.map((i) => ({ name: i.name, destination: i.destination, ...(i.digest ? { digest: i.digest } : {}) }));
155
198
  if (staged.state.published)
156
199
  return { target: target.name, destination: target.destination, items: items.map((i) => ({ ...i, present: true })) };
@@ -0,0 +1,54 @@
1
+ /**
2
+ * What a publish target tells a release train (#5165): the names it publishes
3
+ * and needs, qualified by kind so the train can order members across target
4
+ * kinds, and the wait before the next layer reveals.
5
+ *
6
+ * A name is `<kind>:<name>`, the name in the form its registry compares:
7
+ *
8
+ * | Kind | Name |
9
+ * |---|---|
10
+ * | `npm` | the package name, as written |
11
+ * | `oci` | the repository, lowercased, with no tag or digest, and Docker Hub's `docker.io/` (and `library/`) left off |
12
+ * | `pypi` | the project name normalized as PEP 503 does |
13
+ * | `cargo` | the crate name, lowercased, `_` as `-` |
14
+ * | `marketplace` | `<publisher>.<name>`, lowercased |
15
+ * | `mcp` | the server's name in `server.json` |
16
+ * | `forge`, `homebrew`, `index`, `tauri-updater` | where it publishes: the repository, and the formula or manifest name |
17
+ *
18
+ * So an MCP Registry entry that lists an npm package needs `npm:<package>`,
19
+ * and an image an mcp entry lists is `oci:<repository>` in both.
20
+ */
21
+ import { type PublishContextBase, type PublishDeps } from "./release-publish.js";
22
+ export type TrainNameKind = "npm" | "oci" | "pypi" | "cargo" | "marketplace" | "mcp" | "forge" | "homebrew" | "index" | "tauri-updater";
23
+ /** An image reference's repository, as a train compares it: lowercased, no tag or digest, no `docker.io/` or `library/`. */
24
+ export declare function ociRepositoryName(ref: string): string;
25
+ /** `<kind>:<name>`, the name in the form its registry compares. */
26
+ export declare function trainName(kind: TrainNameKind, name: string): string;
27
+ /** The project names a wheel or sdist's `Requires-Dist` lines need, leaving out those under an extra. */
28
+ export declare function pypiRequirements(metadata: ReadonlyArray<readonly [string, string]>): string[];
29
+ /**
30
+ * A label's version as a Python distribution's file name spells it (PEP
31
+ * 440, loosely): `1.4.0-rc.1` is `1.4.0rc1`, `2.0.0-beta.2` is `2.0.0b2`.
32
+ */
33
+ export declare function pep440Version(version: string): string;
34
+ /** The version in a wheel's or sdist's file name, or null when it names none chant can read. */
35
+ export declare function pypiFileVersion(file: string): {
36
+ name: string;
37
+ version: string;
38
+ } | null;
39
+ /** How often a train's wait asks a destination again. */
40
+ export declare const TRAIN_VISIBLE_POLL_MS = 10000;
41
+ /** How long a train waits for a destination to serve a reveal before it stops (#5165). */
42
+ export declare const TRAIN_VISIBLE_WAIT_MS: number;
43
+ /**
44
+ * Ask `check` until it says what the reveal published is served, every
45
+ * {@link TRAIN_VISIBLE_POLL_MS}, with a line about once a minute; stop with
46
+ * `code` after `capMs`. `check` returns the names still missing.
47
+ */
48
+ export declare function waitUntilServed(ctx: Pick<PublishContextBase, "log">, deps: Pick<PublishDeps, "sleep" | "now">, o: {
49
+ what: string;
50
+ code: string;
51
+ check: () => Promise<string[]>;
52
+ capMs?: number;
53
+ fix?: string;
54
+ }): Promise<void>;
@@ -0,0 +1,118 @@
1
+ /**
2
+ * What a publish target tells a release train (#5165): the names it publishes
3
+ * and needs, qualified by kind so the train can order members across target
4
+ * kinds, and the wait before the next layer reveals.
5
+ *
6
+ * A name is `<kind>:<name>`, the name in the form its registry compares:
7
+ *
8
+ * | Kind | Name |
9
+ * |---|---|
10
+ * | `npm` | the package name, as written |
11
+ * | `oci` | the repository, lowercased, with no tag or digest, and Docker Hub's `docker.io/` (and `library/`) left off |
12
+ * | `pypi` | the project name normalized as PEP 503 does |
13
+ * | `cargo` | the crate name, lowercased, `_` as `-` |
14
+ * | `marketplace` | `<publisher>.<name>`, lowercased |
15
+ * | `mcp` | the server's name in `server.json` |
16
+ * | `forge`, `homebrew`, `index`, `tauri-updater` | where it publishes: the repository, and the formula or manifest name |
17
+ *
18
+ * So an MCP Registry entry that lists an npm package needs `npm:<package>`,
19
+ * and an image an mcp entry lists is `oci:<repository>` in both.
20
+ */
21
+ import { PublishTargetError } from "./release-publish.js";
22
+ /** PEP 503's normalized project name. */
23
+ function pep503(name) {
24
+ return name.toLowerCase().replace(/[-_.]+/g, "-");
25
+ }
26
+ /** An image reference's repository, as a train compares it: lowercased, no tag or digest, no `docker.io/` or `library/`. */
27
+ export function ociRepositoryName(ref) {
28
+ let r = ref.trim().toLowerCase();
29
+ const at = r.indexOf("@");
30
+ if (at >= 0)
31
+ r = r.slice(0, at);
32
+ const slash = r.lastIndexOf("/");
33
+ const colon = r.indexOf(":", slash + 1);
34
+ if (colon >= 0)
35
+ r = r.slice(0, colon);
36
+ r = r.replace(/^(?:https?:\/\/)?(?:index\.docker\.io|registry-1\.docker\.io|docker\.io)\//, "");
37
+ return r.replace(/^library\//, "");
38
+ }
39
+ /** `<kind>:<name>`, the name in the form its registry compares. */
40
+ export function trainName(kind, name) {
41
+ switch (kind) {
42
+ case "oci":
43
+ return `oci:${ociRepositoryName(name)}`;
44
+ case "pypi":
45
+ return `pypi:${pep503(name)}`;
46
+ case "cargo":
47
+ return `cargo:${name.toLowerCase().replace(/_/g, "-")}`;
48
+ case "marketplace":
49
+ return `marketplace:${name.toLowerCase()}`;
50
+ default:
51
+ return `${kind}:${name}`;
52
+ }
53
+ }
54
+ /** The project names a wheel or sdist's `Requires-Dist` lines need, leaving out those under an extra. */
55
+ export function pypiRequirements(metadata) {
56
+ const out = new Set();
57
+ for (const [field, value] of metadata) {
58
+ if (field.toLowerCase() !== "requires-dist")
59
+ continue;
60
+ const [spec, marker] = value.split(";", 2);
61
+ if (marker && /\bextra\s*==/.test(marker))
62
+ continue;
63
+ const m = /^\s*([A-Za-z0-9][A-Za-z0-9._-]*)/.exec(spec ?? "");
64
+ if (m)
65
+ out.add(m[1]);
66
+ }
67
+ return [...out];
68
+ }
69
+ /**
70
+ * A label's version as a Python distribution's file name spells it (PEP
71
+ * 440, loosely): `1.4.0-rc.1` is `1.4.0rc1`, `2.0.0-beta.2` is `2.0.0b2`.
72
+ */
73
+ export function pep440Version(version) {
74
+ return version
75
+ .toLowerCase()
76
+ .replace(/^v/, "")
77
+ .replace(/[-_.]?(alpha|a|beta|b|preview|pre|c|rc)[-_.]?(\d*)/, (_m, tag, n) => `${tag === "alpha" ? "a" : tag === "beta" ? "b" : tag === "c" || tag === "pre" || tag === "preview" ? "rc" : tag}${n || "0"}`)
78
+ .replace(/[-_]?(post|dev)[-_.]?(\d*)/g, (_m, tag, n) => `.${tag}${n || "0"}`);
79
+ }
80
+ /** The version in a wheel's or sdist's file name, or null when it names none chant can read. */
81
+ export function pypiFileVersion(file) {
82
+ if (file.endsWith(".whl")) {
83
+ const parts = file.slice(0, -4).split("-");
84
+ return parts.length >= 5 ? { name: parts[0], version: parts[1] } : null;
85
+ }
86
+ const m = /^(.+)-([^-]+)\.(tar\.gz|zip)$/.exec(file);
87
+ return m ? { name: m[1], version: m[2] } : null;
88
+ }
89
+ /** How often a train's wait asks a destination again. */
90
+ export const TRAIN_VISIBLE_POLL_MS = 10000;
91
+ /** How long a train waits for a destination to serve a reveal before it stops (#5165). */
92
+ export const TRAIN_VISIBLE_WAIT_MS = 15 * 60000;
93
+ /**
94
+ * Ask `check` until it says what the reveal published is served, every
95
+ * {@link TRAIN_VISIBLE_POLL_MS}, with a line about once a minute; stop with
96
+ * `code` after `capMs`. `check` returns the names still missing.
97
+ */
98
+ export async function waitUntilServed(ctx, deps, o) {
99
+ const sleep = deps.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
100
+ const now = deps.now ?? Date.now;
101
+ const cap = o.capMs ?? TRAIN_VISIBLE_WAIT_MS;
102
+ const start = now();
103
+ let logged;
104
+ for (;;) {
105
+ const missing = await o.check();
106
+ if (missing.length === 0)
107
+ return;
108
+ const waited = now() - start;
109
+ if (waited >= cap) {
110
+ throw new PublishTargetError(o.code, `${o.what} did not serve ${missing.join(", ")} within ${Math.round(cap / 1000)}s of the reveal, so the members that depend on it were not published`, o.fix ?? "It was published. Once it is served, run the publish again: it publishes nothing twice and goes on from there.");
111
+ }
112
+ if (logged === undefined || now() - logged >= 60000) {
113
+ ctx.log(`waiting for ${o.what} to serve ${missing.join(", ")}${waited > 0 ? ` (${Math.round(waited / 1000)}s so far)` : ""}`);
114
+ logged = now();
115
+ }
116
+ await sleep(TRAIN_VISIBLE_POLL_MS);
117
+ }
118
+ }
@@ -0,0 +1,121 @@
1
+ /**
2
+ * The verify step of a publish (#5157): `release.verify` in `chant.config.ts`,
3
+ * commands `chant release publish` runs after every target has staged and
4
+ * before any reveals, so a candidate is tested as a consumer will get it.
5
+ *
6
+ * Each command runs through the shell in the member's directory, in the
7
+ * order declared, with the run's environment and the staged references
8
+ * ({@link verifyEnv}). The first that exits other than 0 stops the publish:
9
+ * nothing has revealed, so nothing is visible, and the record gets a
10
+ * `verify-failed` line. Run again, the publish stages nothing again and runs
11
+ * the commands again before it reveals. Once a reveal is recorded the
12
+ * commands do not run, since a failure could no longer hold anything back.
13
+ *
14
+ * A target whose stage is already visible (npm under `stage: false`) is
15
+ * staged after the commands pass, in its turn to reveal, so it is never
16
+ * visible before them; they can't see it, and the publish says so
17
+ * ({@link unstagedForVerify}). A target that uploads at reveal (marketplace,
18
+ * PyPI, Cargo, the MCP Registry: `uploadsAtReveal`) stages nothing and uploads after the
19
+ * commands pass, so they can't see it either, and the same warning names it.
20
+ *
21
+ * Why `release.verify` and not `release.workflow.verify`: the commands are
22
+ * part of `chant release publish` itself, so they run wherever the publish
23
+ * runs (a workstation, a hand-written CI job, the generated workflow's
24
+ * publish job, `chant workspace train publish`). `release.workflow` holds
25
+ * only what the generated workflow file renders.
26
+ */
27
+ import type { Release } from "./release-store.js";
28
+ import { type PublishItem, type PublishTarget, type StagedTarget } from "./release-publish.js";
29
+ /** One entry of `release.verify`: a shell command, or one with a name for messages. */
30
+ export type ReleaseVerifyDeclaration = string | {
31
+ name?: string;
32
+ run: string;
33
+ };
34
+ /** An entry of `release.verify` with its name filled in. */
35
+ export interface VerifyStep {
36
+ name: string;
37
+ run: string;
38
+ }
39
+ /** The entries of `release.verify`, each named: its own `name`, else the command. */
40
+ export declare function verifySteps(decls: readonly ReleaseVerifyDeclaration[] | undefined): VerifyStep[];
41
+ /** The key a verify line carries in the publish record: `verify:` and 16 hex digits of the commands' SHA-256. */
42
+ export declare function verifyKey(steps: readonly VerifyStep[]): string;
43
+ /** One staged target, as the commands see it in `CHANT_STAGED`. */
44
+ export interface StagedReference {
45
+ /** The workspace member, in a train publish. */
46
+ member?: string;
47
+ kind: string;
48
+ name: string;
49
+ destination: string;
50
+ items: PublishItem[];
51
+ state: Record<string, string>;
52
+ }
53
+ /** The staged reference of `target`. */
54
+ export declare function stagedReference(target: Pick<PublishTarget, "kind" | "name" | "destination">, staged: StagedTarget, member?: string): StagedReference;
55
+ /**
56
+ * The targets of `targets` the verify commands can't see, `name` each: those
57
+ * whose stage is already visible (npm `stage: false`) and those that stage
58
+ * nothing and upload at reveal (marketplace, PyPI, Cargo, the MCP Registry).
59
+ */
60
+ export declare function unstagedForVerify(targets: ReadonlyArray<Pick<PublishTarget, "name" | "stagesVisibly" | "uploadsAtReveal">>): string[];
61
+ /** The warning a publish prints when the verify commands can't see some targets. */
62
+ export declare function unstagedWarning(names: readonly string[]): string;
63
+ /**
64
+ * The variables the commands get beside the run's environment:
65
+ *
66
+ * - `CHANT_RELEASE_LABEL`, `CHANT_RELEASE_DIGEST`, `CHANT_RELEASE_COMMIT`,
67
+ * and `CHANT_RELEASE_TAG` when the release has a tag;
68
+ * - `CHANT_STAGED`, the path of a JSON file with the release, every staged
69
+ * target (kind, name, destination, items with their digests, state such
70
+ * as a draft's `releaseId`) and the artifacts the release records;
71
+ * - `CHANT_STAGED_NPM` (`name@version` of each staged package, spaces
72
+ * between) and `CHANT_STAGED_NPM_TAG` (`next`);
73
+ * - `CHANT_STAGED_IMAGES` (`repository@sha256:...` of each staged image);
74
+ * - `CHANT_STAGED_RELEASE_ID` and `CHANT_STAGED_RELEASE_URL`, the first
75
+ * staged forge draft's id and page.
76
+ *
77
+ * A variable with nothing to name is not set.
78
+ */
79
+ export declare function verifyEnv(o: {
80
+ release: Release;
81
+ label: string | null;
82
+ releaseTag: string | null;
83
+ staged: readonly StagedReference[];
84
+ file: string;
85
+ }): Record<string, string>;
86
+ /** The document `CHANT_STAGED` names. */
87
+ export declare function stagedDocument(o: {
88
+ release: Release;
89
+ label: string | null;
90
+ releaseTag: string | null;
91
+ staged: readonly StagedReference[];
92
+ }): Record<string, unknown>;
93
+ /** Run one command; the default runs it through the shell with its output on stderr. Returns its exit status. */
94
+ export type VerifyRunner = (command: string, o: {
95
+ cwd: string;
96
+ env: NodeJS.ProcessEnv;
97
+ }) => number | null;
98
+ /** How the commands went: every one passed, or the first that failed and its exit status. */
99
+ export type VerifyOutcome = {
100
+ passed: true;
101
+ } | {
102
+ passed: false;
103
+ step: VerifyStep;
104
+ exitCode: number | null;
105
+ };
106
+ /**
107
+ * Run `steps` in `cwd`, in order, with `env` and the staged references.
108
+ * Stops at the first that fails. The `CHANT_STAGED` file is written to a
109
+ * temporary directory outside the checkout and removed afterwards.
110
+ */
111
+ export declare function runVerifySteps(o: {
112
+ cwd: string;
113
+ steps: readonly VerifyStep[];
114
+ env: NodeJS.ProcessEnv;
115
+ release: Release;
116
+ label: string | null;
117
+ releaseTag: string | null;
118
+ staged: readonly StagedReference[];
119
+ say: (line: string) => void;
120
+ run?: VerifyRunner;
121
+ }): VerifyOutcome;
@@ -0,0 +1,130 @@
1
+ /**
2
+ * The verify step of a publish (#5157): `release.verify` in `chant.config.ts`,
3
+ * commands `chant release publish` runs after every target has staged and
4
+ * before any reveals, so a candidate is tested as a consumer will get it.
5
+ *
6
+ * Each command runs through the shell in the member's directory, in the
7
+ * order declared, with the run's environment and the staged references
8
+ * ({@link verifyEnv}). The first that exits other than 0 stops the publish:
9
+ * nothing has revealed, so nothing is visible, and the record gets a
10
+ * `verify-failed` line. Run again, the publish stages nothing again and runs
11
+ * the commands again before it reveals. Once a reveal is recorded the
12
+ * commands do not run, since a failure could no longer hold anything back.
13
+ *
14
+ * A target whose stage is already visible (npm under `stage: false`) is
15
+ * staged after the commands pass, in its turn to reveal, so it is never
16
+ * visible before them; they can't see it, and the publish says so
17
+ * ({@link unstagedForVerify}). A target that uploads at reveal (marketplace,
18
+ * PyPI, Cargo, the MCP Registry: `uploadsAtReveal`) stages nothing and uploads after the
19
+ * commands pass, so they can't see it either, and the same warning names it.
20
+ *
21
+ * Why `release.verify` and not `release.workflow.verify`: the commands are
22
+ * part of `chant release publish` itself, so they run wherever the publish
23
+ * runs (a workstation, a hand-written CI job, the generated workflow's
24
+ * publish job, `chant workspace train publish`). `release.workflow` holds
25
+ * only what the generated workflow file renders.
26
+ */
27
+ import { spawnSync } from "node:child_process";
28
+ import { createHash } from "node:crypto";
29
+ import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
30
+ import { tmpdir } from "node:os";
31
+ import { join } from "node:path";
32
+ import { NPM_STAGE_TAG } from "./release-publish.js";
33
+ /** The entries of `release.verify`, each named: its own `name`, else the command. */
34
+ export function verifySteps(decls) {
35
+ return (decls ?? []).map((d) => (typeof d === "string" ? { name: d, run: d } : { name: d.name ?? d.run, run: d.run }));
36
+ }
37
+ /** The key a verify line carries in the publish record: `verify:` and 16 hex digits of the commands' SHA-256. */
38
+ export function verifyKey(steps) {
39
+ return `verify:${createHash("sha256").update(JSON.stringify(steps.map((s) => s.run))).digest("hex").slice(0, 16)}`;
40
+ }
41
+ /** The staged reference of `target`. */
42
+ export function stagedReference(target, staged, member) {
43
+ return { ...(member !== undefined ? { member } : {}), kind: target.kind, name: target.name, destination: target.destination, items: staged.items, state: staged.state };
44
+ }
45
+ /**
46
+ * The targets of `targets` the verify commands can't see, `name` each: those
47
+ * whose stage is already visible (npm `stage: false`) and those that stage
48
+ * nothing and upload at reveal (marketplace, PyPI, Cargo, the MCP Registry).
49
+ */
50
+ export function unstagedForVerify(targets) {
51
+ return targets.filter((t) => t.stagesVisibly === true || t.uploadsAtReveal === true).map((t) => t.name);
52
+ }
53
+ /** The warning a publish prints when the verify commands can't see some targets. */
54
+ export function unstagedWarning(names) {
55
+ return `${names.join(", ")} publish${names.length === 1 ? "es" : ""} without a stage (npm stage: false, or a marketplace, PyPI or Cargo upload), so release.verify can't check ${names.length === 1 ? "it" : "them"}: ${names.length === 1 ? "it publishes" : "they publish"} after the verify commands pass, straight to where consumers resolve ${names.length === 1 ? "it" : "them"}`;
56
+ }
57
+ /**
58
+ * The variables the commands get beside the run's environment:
59
+ *
60
+ * - `CHANT_RELEASE_LABEL`, `CHANT_RELEASE_DIGEST`, `CHANT_RELEASE_COMMIT`,
61
+ * and `CHANT_RELEASE_TAG` when the release has a tag;
62
+ * - `CHANT_STAGED`, the path of a JSON file with the release, every staged
63
+ * target (kind, name, destination, items with their digests, state such
64
+ * as a draft's `releaseId`) and the artifacts the release records;
65
+ * - `CHANT_STAGED_NPM` (`name@version` of each staged package, spaces
66
+ * between) and `CHANT_STAGED_NPM_TAG` (`next`);
67
+ * - `CHANT_STAGED_IMAGES` (`repository@sha256:...` of each staged image);
68
+ * - `CHANT_STAGED_RELEASE_ID` and `CHANT_STAGED_RELEASE_URL`, the first
69
+ * staged forge draft's id and page.
70
+ *
71
+ * A variable with nothing to name is not set.
72
+ */
73
+ export function verifyEnv(o) {
74
+ const env = {
75
+ CHANT_RELEASE_LABEL: o.label ?? "",
76
+ CHANT_RELEASE_DIGEST: o.release.releaseDigest,
77
+ CHANT_RELEASE_COMMIT: o.release.commit,
78
+ CHANT_STAGED: o.file,
79
+ };
80
+ if (o.releaseTag)
81
+ env.CHANT_RELEASE_TAG = o.releaseTag;
82
+ const npm = o.staged.filter((s) => s.kind === "npm").flatMap((s) => s.items.map((i) => i.name));
83
+ if (npm.length > 0) {
84
+ env.CHANT_STAGED_NPM = npm.join(" ");
85
+ env.CHANT_STAGED_NPM_TAG = NPM_STAGE_TAG;
86
+ }
87
+ const images = o.staged.filter((s) => s.kind === "oci").flatMap((s) => s.items.filter((i) => !i.attachment).map((i) => i.destination));
88
+ if (images.length > 0)
89
+ env.CHANT_STAGED_IMAGES = images.join(" ");
90
+ const draft = o.staged.find((s) => s.kind === "forge" && s.state.releaseId);
91
+ if (draft) {
92
+ env.CHANT_STAGED_RELEASE_ID = draft.state.releaseId;
93
+ if (draft.state.releaseUrl)
94
+ env.CHANT_STAGED_RELEASE_URL = draft.state.releaseUrl;
95
+ }
96
+ return env;
97
+ }
98
+ /** The document `CHANT_STAGED` names. */
99
+ export function stagedDocument(o) {
100
+ return {
101
+ release: { label: o.label, releaseDigest: o.release.releaseDigest, commit: o.release.commit, tag: o.releaseTag },
102
+ targets: o.staged.map((s) => ({ ...s, state: Object.fromEntries(Object.entries(s.state).filter(([k]) => k !== "notes")) })),
103
+ artifacts: o.release.artifactDigests.map((a) => ({ component: a.component, kind: a.kind, path: a.path, digest: a.digest, ...(a.ref ? { ref: a.ref } : {}) })),
104
+ };
105
+ }
106
+ const defaultRun = (command, o) => spawnSync(command, { cwd: o.cwd, env: o.env, shell: true, stdio: ["ignore", 2, 2] }).status;
107
+ /**
108
+ * Run `steps` in `cwd`, in order, with `env` and the staged references.
109
+ * Stops at the first that fails. The `CHANT_STAGED` file is written to a
110
+ * temporary directory outside the checkout and removed afterwards.
111
+ */
112
+ export function runVerifySteps(o) {
113
+ const run = o.run ?? defaultRun;
114
+ const dir = mkdtempSync(join(tmpdir(), "chant-verify-"));
115
+ try {
116
+ const file = join(dir, "staged.json");
117
+ writeFileSync(file, `${JSON.stringify(stagedDocument(o), null, 2)}\n`);
118
+ const env = { ...o.env, ...verifyEnv({ ...o, file }) };
119
+ for (const step of o.steps) {
120
+ o.say(` verifying: ${step.name}`);
121
+ const code = run(step.run, { cwd: o.cwd, env });
122
+ if (code !== 0)
123
+ return { passed: false, step, exitCode: code };
124
+ }
125
+ return { passed: true };
126
+ }
127
+ finally {
128
+ rmSync(dir, { recursive: true, force: true });
129
+ }
130
+ }
@@ -223,6 +223,14 @@ export async function loadQueryData(ledgers) {
223
223
  }
224
224
  }
225
225
  const trees = (await port.trees()).sort();
226
+ // #5163: the status records of releases chant release cut made sit beside them, under _releases.
227
+ if (trees.includes("_releases")) {
228
+ const { records, malformed: bad } = parseReleaseStatus(await port.read("_releases", RELEASE_STATUS_FILE));
229
+ malformed.release_status += bad;
230
+ for (const r of records) {
231
+ data.release_status.push({ member, env: r.env, component: r.component, digest: r.digest, release_version: str(r.releaseVersion), status: r.status, reason: str(r.reason), replacement: str(r.replacement), actor: r.actor, timestamp: r.timestamp });
232
+ }
233
+ }
226
234
  for (const env of trees.filter((t) => !t.startsWith("_"))) {
227
235
  for (const file of (await port.list(env)).sort()) {
228
236
  if (file.endsWith(".json")) {