@intentius/chant 0.124.100 → 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 (270) 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-evidence-claims.d.ts +12 -0
  6. package/dist/ci-evidence-claims.js +12 -0
  7. package/dist/ci-system.d.ts +66 -0
  8. package/dist/ci-system.js +61 -0
  9. package/dist/cli/handlers/build.js +27 -0
  10. package/dist/cli/handlers/release-doctor.d.ts +12 -0
  11. package/dist/cli/handlers/release-doctor.js +118 -0
  12. package/dist/cli/handlers/release-init.d.ts +10 -0
  13. package/dist/cli/handlers/release-init.js +374 -0
  14. package/dist/cli/handlers/release.d.ts +43 -2
  15. package/dist/cli/handlers/release.js +667 -39
  16. package/dist/cli/handlers/run-generate.js +11 -0
  17. package/dist/cli/main.d.ts +2 -0
  18. package/dist/cli/main.js +44 -101
  19. package/dist/cli/parse-args.js +48 -0
  20. package/dist/cli/registry.d.ts +16 -0
  21. package/dist/cli/release-commands/artifacts.d.ts +3 -0
  22. package/dist/cli/release-commands/artifacts.js +14 -0
  23. package/dist/cli/release-commands/candidates.d.ts +3 -0
  24. package/dist/cli/release-commands/candidates.js +16 -0
  25. package/dist/cli/release-commands/changed.d.ts +3 -0
  26. package/dist/cli/release-commands/changed.js +14 -0
  27. package/dist/cli/release-commands/compose.d.ts +3 -0
  28. package/dist/cli/release-commands/compose.js +16 -0
  29. package/dist/cli/release-commands/cut.d.ts +3 -0
  30. package/dist/cli/release-commands/cut.js +50 -0
  31. package/dist/cli/release-commands/doctor.d.ts +3 -0
  32. package/dist/cli/release-commands/doctor.js +14 -0
  33. package/dist/cli/release-commands/export.d.ts +3 -0
  34. package/dist/cli/release-commands/export.js +12 -0
  35. package/dist/cli/release-commands/images.d.ts +3 -0
  36. package/dist/cli/release-commands/images.js +13 -0
  37. package/dist/cli/release-commands/index.d.ts +8 -0
  38. package/dist/cli/release-commands/index.js +52 -0
  39. package/dist/cli/release-commands/init.d.ts +3 -0
  40. package/dist/cli/release-commands/init.js +19 -0
  41. package/dist/cli/release-commands/list.d.ts +3 -0
  42. package/dist/cli/release-commands/list.js +10 -0
  43. package/dist/cli/release-commands/next.d.ts +3 -0
  44. package/dist/cli/release-commands/next.js +13 -0
  45. package/dist/cli/release-commands/publish.d.ts +3 -0
  46. package/dist/cli/release-commands/publish.js +22 -0
  47. package/dist/cli/release-commands/stamp.d.ts +3 -0
  48. package/dist/cli/release-commands/stamp.js +15 -0
  49. package/dist/cli/release-commands/status.d.ts +3 -0
  50. package/dist/cli/release-commands/status.js +17 -0
  51. package/dist/cli/release-commands/tag.d.ts +3 -0
  52. package/dist/cli/release-commands/tag.js +12 -0
  53. package/dist/cli/release-commands/types.d.ts +20 -0
  54. package/dist/cli/release-commands/types.js +1 -0
  55. package/dist/cli/release-commands/verify.d.ts +3 -0
  56. package/dist/cli/release-commands/verify.js +15 -0
  57. package/dist/cli/release-commands/workflow.d.ts +3 -0
  58. package/dist/cli/release-commands/workflow.js +15 -0
  59. package/dist/cloud-lister/index.d.ts +4 -1
  60. package/dist/cloud-lister/index.js +2 -1
  61. package/dist/cloud-lister/kubernetes-components.d.ts +56 -0
  62. package/dist/cloud-lister/kubernetes-components.js +642 -0
  63. package/dist/cloud-lister/kubernetes.d.ts +18 -0
  64. package/dist/cloud-lister/kubernetes.js +26 -1
  65. package/dist/cloud-lister/mask.d.ts +5 -1
  66. package/dist/cloud-lister/mask.js +14 -5
  67. package/dist/components/cli-support.d.ts +1 -1
  68. package/dist/components/cli-support.js +1 -1
  69. package/dist/config-environments.d.ts +8 -1
  70. package/dist/config-environments.js +2 -0
  71. package/dist/config-import.d.ts +1 -1
  72. package/dist/config-import.js +6 -2
  73. package/dist/config-sandbox.d.ts +1 -1
  74. package/dist/config-sandbox.js +3 -3
  75. package/dist/config.d.ts +369 -10
  76. package/dist/config.js +127 -7
  77. package/dist/deep-observation.js +9 -3
  78. package/dist/floor-table.data.js +21 -1
  79. package/dist/forge-remote.d.ts +13 -0
  80. package/dist/forge-remote.js +15 -0
  81. package/dist/lexicon.d.ts +45 -4
  82. package/dist/lifecycle/__fixtures__/package-files.d.ts +32 -0
  83. package/dist/lifecycle/__fixtures__/package-files.js +72 -0
  84. package/dist/lifecycle/__fixtures__/publish-fakes.d.ts +62 -0
  85. package/dist/lifecycle/__fixtures__/publish-fakes.js +275 -3
  86. package/dist/lifecycle/publish-attachments.d.ts +2 -1
  87. package/dist/lifecycle/publish-attachments.js +19 -2
  88. package/dist/lifecycle/publish-cargo.d.ts +99 -0
  89. package/dist/lifecycle/publish-cargo.js +412 -0
  90. package/dist/lifecycle/publish-credentials.d.ts +1 -1
  91. package/dist/lifecycle/publish-credentials.js +13 -0
  92. package/dist/lifecycle/publish-declaration.d.ts +322 -4
  93. package/dist/lifecycle/publish-declaration.js +340 -9
  94. package/dist/lifecycle/publish-forge.d.ts +45 -2
  95. package/dist/lifecycle/publish-forge.js +434 -34
  96. package/dist/lifecycle/publish-git-ssh.d.ts +15 -0
  97. package/dist/lifecycle/publish-git-ssh.js +30 -4
  98. package/dist/lifecycle/publish-github.d.ts +40 -2
  99. package/dist/lifecycle/publish-github.js +100 -3
  100. package/dist/lifecycle/publish-helm.d.ts +83 -0
  101. package/dist/lifecycle/publish-helm.js +452 -0
  102. package/dist/lifecycle/publish-homebrew.d.ts +7 -9
  103. package/dist/lifecycle/publish-homebrew.js +34 -197
  104. package/dist/lifecycle/publish-index.d.ts +141 -0
  105. package/dist/lifecycle/publish-index.js +719 -0
  106. package/dist/lifecycle/publish-marketplace.js +77 -0
  107. package/dist/lifecycle/publish-maven.d.ts +79 -0
  108. package/dist/lifecycle/publish-maven.js +364 -0
  109. package/dist/lifecycle/publish-mcp-registry.d.ts +66 -0
  110. package/dist/lifecycle/publish-mcp-registry.js +305 -0
  111. package/dist/lifecycle/publish-npm.d.ts +27 -1
  112. package/dist/lifecycle/publish-npm.js +216 -3
  113. package/dist/lifecycle/publish-nuget.d.ts +93 -0
  114. package/dist/lifecycle/publish-nuget.js +377 -0
  115. package/dist/lifecycle/publish-oci.d.ts +91 -2
  116. package/dist/lifecycle/publish-oci.js +247 -8
  117. package/dist/lifecycle/publish-package-files.d.ts +16 -0
  118. package/dist/lifecycle/publish-package-files.js +39 -0
  119. package/dist/lifecycle/publish-pypi.d.ts +138 -0
  120. package/dist/lifecycle/publish-pypi.js +657 -0
  121. package/dist/lifecycle/publish-record.d.ts +6 -3
  122. package/dist/lifecycle/publish-record.js +6 -3
  123. package/dist/lifecycle/publish-rubygems.d.ts +84 -0
  124. package/dist/lifecycle/publish-rubygems.js +366 -0
  125. package/dist/lifecycle/publish-signing.d.ts +147 -0
  126. package/dist/lifecycle/publish-signing.js +257 -0
  127. package/dist/lifecycle/publish-targets.d.ts +37 -1
  128. package/dist/lifecycle/publish-targets.js +102 -0
  129. package/dist/lifecycle/publish-tauri.js +43 -0
  130. package/dist/lifecycle/publish-train-names.d.ts +57 -0
  131. package/dist/lifecycle/publish-train-names.js +123 -0
  132. package/dist/lifecycle/publish-verify.d.ts +121 -0
  133. package/dist/lifecycle/publish-verify.js +130 -0
  134. package/dist/lifecycle/query.js +8 -0
  135. package/dist/lifecycle/release-artifacts.d.ts +290 -0
  136. package/dist/lifecycle/release-artifacts.js +808 -0
  137. package/dist/lifecycle/release-changelog.d.ts +13 -1
  138. package/dist/lifecycle/release-changelog.js +35 -2
  139. package/dist/lifecycle/release-cut.d.ts +64 -4
  140. package/dist/lifecycle/release-cut.js +147 -34
  141. package/dist/lifecycle/release-doctor.d.ts +113 -0
  142. package/dist/lifecycle/release-doctor.js +1198 -0
  143. package/dist/lifecycle/release-green.d.ts +86 -0
  144. package/dist/lifecycle/release-green.js +286 -0
  145. package/dist/lifecycle/release-init-registries.d.ts +48 -0
  146. package/dist/lifecycle/release-init-registries.js +97 -0
  147. package/dist/lifecycle/release-init.d.ts +275 -0
  148. package/dist/lifecycle/release-init.js +984 -0
  149. package/dist/lifecycle/release-intents.d.ts +73 -0
  150. package/dist/lifecycle/release-intents.js +128 -0
  151. package/dist/lifecycle/release-next.d.ts +111 -0
  152. package/dist/lifecycle/release-next.js +251 -0
  153. package/dist/lifecycle/release-prerelease.d.ts +19 -0
  154. package/dist/lifecycle/release-prerelease.js +30 -0
  155. package/dist/lifecycle/release-publish.d.ts +256 -10
  156. package/dist/lifecycle/release-publish.js +247 -35
  157. package/dist/lifecycle/release-status-change.d.ts +226 -0
  158. package/dist/lifecycle/release-status-change.js +478 -0
  159. package/dist/lifecycle/release-status.d.ts +11 -0
  160. package/dist/lifecycle/release-status.js +1 -1
  161. package/dist/lifecycle/release-store.d.ts +73 -2
  162. package/dist/lifecycle/release-store.js +32 -1
  163. package/dist/lifecycle/release-tag.d.ts +142 -0
  164. package/dist/lifecycle/release-tag.js +322 -0
  165. package/dist/lifecycle/release-verify.d.ts +73 -1
  166. package/dist/lifecycle/release-verify.js +117 -2
  167. package/dist/lifecycle/release-version-formats.d.ts +73 -0
  168. package/dist/lifecycle/release-version-formats.js +570 -0
  169. package/dist/lifecycle/release-version.d.ts +58 -10
  170. package/dist/lifecycle/release-version.js +164 -36
  171. package/dist/lifecycle/release-workstation.d.ts +3 -2
  172. package/dist/lifecycle/release-workstation.js +3 -2
  173. package/dist/op/generate-pipeline.js +1 -1
  174. package/dist/op/local-executor.d.ts +1 -1
  175. package/dist/op/local-executor.js +2 -2
  176. package/dist/op/op-waves-evidence.js +9 -2
  177. package/dist/pr-forge-base.js +4 -2
  178. package/dist/pr-forge.d.ts +20 -2
  179. package/dist/pr-forge.js +46 -10
  180. package/dist/release-floors.d.ts +8 -1
  181. package/dist/release-floors.js +9 -2
  182. package/dist/sensitive-key.d.ts +12 -0
  183. package/dist/sensitive-key.js +52 -0
  184. package/dist/tool-pins.d.ts +40 -0
  185. package/dist/tool-pins.js +66 -0
  186. package/dist/ts-loader.d.ts +8 -0
  187. package/dist/ts-loader.js +19 -0
  188. package/dist/wave-runtime.mjs +345 -342
  189. package/dist/workspace/ci-forge.d.ts +17 -0
  190. package/dist/workspace/ci-forge.js +17 -0
  191. package/dist/workspace/ci-init.js +1 -1
  192. package/dist/workspace/composites.schema.json +1 -0
  193. package/dist/workspace/declaration.d.ts +8 -0
  194. package/dist/workspace/declaration.js +12 -0
  195. package/dist/workspace/declaration.schema.json +8 -0
  196. package/dist/workspace/environments.d.ts +2 -0
  197. package/dist/workspace/environments.js +1 -1
  198. package/dist/workspace/identity-gate-rule.d.ts +61 -5
  199. package/dist/workspace/identity-gate-rule.js +81 -12
  200. package/dist/workspace/lexicon-outputs.d.ts +1 -1
  201. package/dist/workspace/lexicon-outputs.js +1 -1
  202. package/dist/workspace/member-pipeline.d.ts +2 -1
  203. package/dist/workspace/member-pipeline.js +5 -2
  204. package/dist/workspace/reason-codes.d.ts +2 -0
  205. package/dist/workspace/reason-codes.js +3 -1
  206. package/dist/workspace/release-changed.d.ts +75 -4
  207. package/dist/workspace/release-changed.js +205 -34
  208. package/dist/workspace/release-changed.schema.json +20 -2
  209. package/dist/workspace/release-steps/artifacts.d.ts +7 -0
  210. package/dist/workspace/release-steps/artifacts.js +45 -0
  211. package/dist/workspace/release-steps/builds.d.ts +12 -0
  212. package/dist/workspace/release-steps/builds.js +38 -0
  213. package/dist/workspace/release-steps/doctor.d.ts +8 -0
  214. package/dist/workspace/release-steps/doctor.js +14 -0
  215. package/dist/workspace/release-steps/goreleaser.d.ts +16 -0
  216. package/dist/workspace/release-steps/goreleaser.js +36 -0
  217. package/dist/workspace/release-steps/green.d.ts +3 -0
  218. package/dist/workspace/release-steps/green.js +6 -0
  219. package/dist/workspace/release-steps/images.d.ts +22 -0
  220. package/dist/workspace/release-steps/images.js +59 -0
  221. package/dist/workspace/release-steps/index.d.ts +9 -0
  222. package/dist/workspace/release-steps/index.js +50 -0
  223. package/dist/workspace/release-steps/nfpm.d.ts +13 -0
  224. package/dist/workspace/release-steps/nfpm.js +29 -0
  225. package/dist/workspace/release-steps/nuget.d.ts +14 -0
  226. package/dist/workspace/release-steps/nuget.js +16 -0
  227. package/dist/workspace/release-steps/pypi.d.ts +15 -0
  228. package/dist/workspace/release-steps/pypi.js +21 -0
  229. package/dist/workspace/release-steps/qemu.d.ts +21 -0
  230. package/dist/workspace/release-steps/qemu.js +35 -0
  231. package/dist/workspace/release-steps/signing.d.ts +18 -0
  232. package/dist/workspace/release-steps/signing.js +30 -0
  233. package/dist/workspace/release-steps/stamp.d.ts +3 -0
  234. package/dist/workspace/release-steps/stamp.js +4 -0
  235. package/dist/workspace/release-steps/targets.d.ts +31 -0
  236. package/dist/workspace/release-steps/targets.js +40 -0
  237. package/dist/workspace/release-steps/types.d.ts +104 -0
  238. package/dist/workspace/release-steps/types.js +2 -0
  239. package/dist/workspace/release-steps/verify.d.ts +3 -0
  240. package/dist/workspace/release-steps/verify.js +4 -0
  241. package/dist/workspace/release-toolchains.d.ts +59 -0
  242. package/dist/workspace/release-toolchains.js +133 -0
  243. package/dist/workspace/release-train-workflow.d.ts +36 -0
  244. package/dist/workspace/release-train-workflow.js +121 -0
  245. package/dist/workspace/release-train.d.ts +3 -1
  246. package/dist/workspace/release-train.js +20 -3
  247. package/dist/workspace/release-workflow.d.ts +183 -59
  248. package/dist/workspace/release-workflow.js +570 -201
  249. package/dist/workspace/releases.schema.json +70 -1
  250. package/dist/workspace/search-contract.d.ts +1 -1
  251. package/dist/workspace/security.js +9 -2
  252. package/dist/workspace/train-cut.d.ts +182 -0
  253. package/dist/workspace/train-cut.js +504 -0
  254. package/dist/workspace/train-prepare.d.ts +64 -0
  255. package/dist/workspace/train-prepare.js +313 -0
  256. package/dist/workspace/train-publish.d.ts +177 -0
  257. package/dist/workspace/train-publish.js +574 -0
  258. package/dist/workspace/train-range-labels.d.ts +33 -0
  259. package/dist/workspace/train-range-labels.js +109 -0
  260. package/dist/workspace/train-shell.d.ts +5 -0
  261. package/dist/workspace/train-shell.js +17 -0
  262. package/dist/workspace/trust/check-evidence-report.d.ts +3 -7
  263. package/dist/workspace/trust/check-evidence-report.js +3 -7
  264. package/dist/workspace/trust/seal.d.ts +13 -3
  265. package/dist/workspace/trust/seal.js +14 -4
  266. package/dist/workspace/work-cli.d.ts +3 -2
  267. package/dist/workspace/work-cli.js +3 -2
  268. package/dist/workspace/workspace-ledger.d.ts +14 -1
  269. package/dist/workspace/workspace-ledger.js +33 -7
  270. package/package.json +1 -1
@@ -0,0 +1,123 @@
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
+ * | `maven` | `<groupId>:<artifactId>` |
15
+ * | `nuget` | the package id, lowercased |
16
+ * | `rubygems` | the gem name |
17
+ * | `marketplace` | `<publisher>.<name>`, lowercased |
18
+ * | `mcp` | the server's name in `server.json` |
19
+ * | `forge`, `homebrew`, `index`, `tauri-updater` | where it publishes: the repository, and the formula or manifest name |
20
+ *
21
+ * So an MCP Registry entry that lists an npm package needs `npm:<package>`,
22
+ * and an image an mcp entry lists is `oci:<repository>` in both.
23
+ */
24
+ import { PublishTargetError } from "./release-publish.js";
25
+ /** PEP 503's normalized project name. */
26
+ function pep503(name) {
27
+ return name.toLowerCase().replace(/[-_.]+/g, "-");
28
+ }
29
+ /** An image reference's repository, as a train compares it: lowercased, no tag or digest, no `docker.io/` or `library/`. */
30
+ export function ociRepositoryName(ref) {
31
+ let r = ref.trim().toLowerCase();
32
+ const at = r.indexOf("@");
33
+ if (at >= 0)
34
+ r = r.slice(0, at);
35
+ const slash = r.lastIndexOf("/");
36
+ const colon = r.indexOf(":", slash + 1);
37
+ if (colon >= 0)
38
+ r = r.slice(0, colon);
39
+ r = r.replace(/^(?:https?:\/\/)?(?:index\.docker\.io|registry-1\.docker\.io|docker\.io)\//, "");
40
+ return r.replace(/^library\//, "");
41
+ }
42
+ /** `<kind>:<name>`, the name in the form its registry compares. */
43
+ export function trainName(kind, name) {
44
+ switch (kind) {
45
+ case "oci":
46
+ return `oci:${ociRepositoryName(name)}`;
47
+ case "pypi":
48
+ return `pypi:${pep503(name)}`;
49
+ case "cargo":
50
+ return `cargo:${name.toLowerCase().replace(/_/g, "-")}`;
51
+ case "marketplace":
52
+ return `marketplace:${name.toLowerCase()}`;
53
+ case "nuget":
54
+ return `nuget:${name.toLowerCase()}`;
55
+ default:
56
+ return `${kind}:${name}`;
57
+ }
58
+ }
59
+ /** The project names a wheel or sdist's `Requires-Dist` lines need, leaving out those under an extra. */
60
+ export function pypiRequirements(metadata) {
61
+ const out = new Set();
62
+ for (const [field, value] of metadata) {
63
+ if (field.toLowerCase() !== "requires-dist")
64
+ continue;
65
+ const [spec, marker] = value.split(";", 2);
66
+ if (marker && /\bextra\s*==/.test(marker))
67
+ continue;
68
+ const m = /^\s*([A-Za-z0-9][A-Za-z0-9._-]*)/.exec(spec ?? "");
69
+ if (m)
70
+ out.add(m[1]);
71
+ }
72
+ return [...out];
73
+ }
74
+ /**
75
+ * A label's version as a Python distribution's file name spells it (PEP
76
+ * 440, loosely): `1.4.0-rc.1` is `1.4.0rc1`, `2.0.0-beta.2` is `2.0.0b2`.
77
+ */
78
+ export function pep440Version(version) {
79
+ return version
80
+ .toLowerCase()
81
+ .replace(/^v/, "")
82
+ .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"}`)
83
+ .replace(/[-_]?(post|dev)[-_.]?(\d*)/g, (_m, tag, n) => `.${tag}${n || "0"}`);
84
+ }
85
+ /** The version in a wheel's or sdist's file name, or null when it names none chant can read. */
86
+ export function pypiFileVersion(file) {
87
+ if (file.endsWith(".whl")) {
88
+ const parts = file.slice(0, -4).split("-");
89
+ return parts.length >= 5 ? { name: parts[0], version: parts[1] } : null;
90
+ }
91
+ const m = /^(.+)-([^-]+)\.(tar\.gz|zip)$/.exec(file);
92
+ return m ? { name: m[1], version: m[2] } : null;
93
+ }
94
+ /** How often a train's wait asks a destination again. */
95
+ export const TRAIN_VISIBLE_POLL_MS = 10000;
96
+ /** How long a train waits for a destination to serve a reveal before it stops (#5165). */
97
+ export const TRAIN_VISIBLE_WAIT_MS = 15 * 60000;
98
+ /**
99
+ * Ask `check` until it says what the reveal published is served, every
100
+ * {@link TRAIN_VISIBLE_POLL_MS}, with a line about once a minute; stop with
101
+ * `code` after `capMs`. `check` returns the names still missing.
102
+ */
103
+ export async function waitUntilServed(ctx, deps, o) {
104
+ const sleep = deps.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
105
+ const now = deps.now ?? Date.now;
106
+ const cap = o.capMs ?? TRAIN_VISIBLE_WAIT_MS;
107
+ const start = now();
108
+ let logged;
109
+ for (;;) {
110
+ const missing = await o.check();
111
+ if (missing.length === 0)
112
+ return;
113
+ const waited = now() - start;
114
+ if (waited >= cap) {
115
+ 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.");
116
+ }
117
+ if (logged === undefined || now() - logged >= 60000) {
118
+ ctx.log(`waiting for ${o.what} to serve ${missing.join(", ")}${waited > 0 ? ` (${Math.round(waited / 1000)}s so far)` : ""}`);
119
+ logged = now();
120
+ }
121
+ await sleep(TRAIN_VISIBLE_POLL_MS);
122
+ }
123
+ }
@@ -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")) {