@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
@@ -137,8 +137,15 @@ export function seedFakeNpmRegistry(log, registry) {
137
137
  * registry does, a package's first version is also `latest`. It exits 1
138
138
  * when the package path contains `$FAKE_NPM_FAIL`.
139
139
  * - `view <name>@<version> version` prints the version when it is there.
140
+ * - `view <name> versions --json` (#5154) prints every version it holds, as
141
+ * npm does: a string for one, an array for several; E404 for none.
142
+ * - `view <name> dist-tags.<tag>` (#5136) prints the version the tag names.
143
+ * `$FAKE_NPM_TAG_LAG`, `<name>=<n>[,...]`: the first `n` such views of that
144
+ * name print nothing, as a registry whose tag has not propagated yet.
140
145
  * - `dist-tag add <name>@<version> <tag>` points the tag at a version that is
141
146
  * there. It exits 1 when the name contains `$FAKE_NPM_FAIL_TAG`.
147
+ * - `deprecate <name>@<version> <message>` (#5163) keeps the message on the
148
+ * version, and an empty message clears it.
142
149
  * - `install` (#4049) checks that every dependency in `./package.json` is in
143
150
  * its registry at that version, and installs nothing.
144
151
  * - `audit signatures` (#4049) prints what npm prints for verified
@@ -185,6 +192,26 @@ if (args[0] === "publish") {
185
192
  if (!p.distTags.latest) p.distTags.latest = version;
186
193
  save();
187
194
  console.log("+ " + name + "@" + version);
195
+ } else if (args[0] === "view" && args[2] && args[2].startsWith("dist-tags.")) {
196
+ const name = args[1];
197
+ const p = reg.packages[name];
198
+ if (!p) { console.error("npm error code E404"); console.error("npm error 404 Not Found - " + name); process.exit(1); }
199
+ const lag = (process.env.FAKE_NPM_TAG_LAG || "").split(",").filter(Boolean).find((pair) => pair.slice(0, pair.lastIndexOf("=")) === name);
200
+ reg.tagViews = reg.tagViews || {};
201
+ reg.tagViews[name] = (reg.tagViews[name] || 0) + 1; save();
202
+ if (lag && reg.tagViews[name] <= Number(lag.slice(lag.lastIndexOf("=") + 1))) process.exit(0);
203
+ const tag = p.distTags[args[2].slice("dist-tags.".length)];
204
+ if (tag) console.log(tag);
205
+ } else if (args[0] === "view" && args[2] === "versions") {
206
+ // #5154: every version the registry holds, as npm prints it with --json.
207
+ const p = reg.packages[args[1]];
208
+ if (!p) { console.error("npm error code E404"); console.error("npm error 404 Not Found - " + args[1]); process.exit(1); }
209
+ console.log(JSON.stringify(p.versions.length === 1 ? p.versions[0] : p.versions));
210
+ } else if (args[0] === "view" && args[2] === "version" && args[1].lastIndexOf("@") <= 0) {
211
+ // #5230: a view of a bare name asks whether the package was ever published.
212
+ const p = reg.packages[args[1]];
213
+ if (!p) { console.error("npm error code E404"); console.error("npm error 404 Not Found - " + args[1]); process.exit(1); }
214
+ console.log(p.distTags.latest || p.versions[p.versions.length - 1] || "");
188
215
  } else if (args[0] === "view") {
189
216
  const [name, version] = split(args[1]);
190
217
  const p = reg.packages[name];
@@ -204,6 +231,13 @@ if (args[0] === "publish") {
204
231
  p.distTags[args[3]] = version;
205
232
  save();
206
233
  console.log("+" + args[3] + ": " + args[2]);
234
+ } else if (args[0] === "deprecate") {
235
+ const [name, version] = split(args[1]);
236
+ const p = reg.packages[name];
237
+ if (!p || !p.versions.includes(version)) { console.error("npm error 404 " + args[1] + " is not in the npm registry"); process.exit(1); }
238
+ p.deprecated = p.deprecated || {};
239
+ if (args[2]) p.deprecated[version] = args[2]; else delete p.deprecated[version];
240
+ save();
207
241
  } else if (args[0] === "install") {
208
242
  if (Number(process.env.FAKE_NPM_INSTALL_ETARGET || 0) > (reg.installs || 0)) {
209
243
  reg.installs = (reg.installs || 0) + 1; save();
@@ -240,7 +274,7 @@ export function startFakeForge(forge, api, repo, releases = []) {
240
274
  const json = (status, body) => ({ ok: status < 300, status, headers: { get: () => null }, text: async () => (body === undefined ? "" : JSON.stringify(body)) });
241
275
  const view = (r) => forge === "gitlab"
242
276
  ? { tag_name: r.tag_name, assets: { links: r.assets.map((a) => ({ name: a.name })) } }
243
- : { id: r.id, tag_name: r.tag_name, name: r.name ?? r.tag_name, draft: r.draft, upload_url: `${uploads}/repos/${repo}/releases/${r.id}/assets{?name,label}`, assets: r.assets.map((a) => ({ name: a.name, ...(forge === "github" ? { digest: a.digest } : {}) })) };
277
+ : { id: r.id, tag_name: r.tag_name, name: r.name ?? r.tag_name, draft: r.draft, prerelease: r.prerelease === true, ...(r.body !== undefined ? { body: r.body } : {}), upload_url: `${uploads}/repos/${repo}/releases/${r.id}/assets{?name,label}`, assets: r.assets.map((a) => ({ name: a.name, ...(forge === "github" ? { digest: a.digest } : {}) })) };
244
278
  const text = (b) => (b === undefined ? "" : typeof b === "string" ? b : Buffer.from(b).toString("utf-8"));
245
279
  const fetch = async (url, init) => {
246
280
  calls.push({ method: init.method, url, headers: init.headers, ...(init.body !== undefined ? { body: init.body } : {}) });
@@ -252,7 +286,10 @@ export function startFakeForge(forge, api, repo, releases = []) {
252
286
  }
253
287
  const u = new URL(url);
254
288
  const path = url.split("?")[0];
289
+ const generated = (req) => (fake.generatedNotes ? fake.generatedNotes(req) : `generated: ${Object.entries(req).map(([k, v]) => `${k}=${v}`).join(" ")}`);
255
290
  if (forge === "gitlab") {
291
+ if (init.method === "GET" && path === `${root}/repository/changelog`)
292
+ return json(200, { notes: generated(Object.fromEntries(u.searchParams)) });
256
293
  if (init.method === "PUT" && path.startsWith(`${root}/packages/generic/`)) {
257
294
  packages.set(path, text(init.body));
258
295
  return json(201, { message: "201 Created" });
@@ -279,6 +316,8 @@ export function startFakeForge(forge, api, repo, releases = []) {
279
316
  }
280
317
  if (init.method === "GET" && path === `${root}/releases`)
281
318
  return json(200, releases.map(view));
319
+ if (forge === "github" && init.method === "POST" && path === `${root}/releases/generate-notes`)
320
+ return json(200, { name: "notes", body: generated(JSON.parse(text(init.body))) });
282
321
  if (init.method === "POST" && path === `${root}/releases`) {
283
322
  const b = JSON.parse(text(init.body));
284
323
  const r = { id: nextId++, tag_name: b.tag_name, draft: b.draft === true, target: b.target_commitish, assets: [], ...(b.name ? { name: b.name } : {}), ...(b.body !== undefined ? { body: b.body } : {}) };
@@ -318,6 +357,12 @@ export function startFakeForge(forge, api, repo, releases = []) {
318
357
  if (b.make_latest !== undefined)
319
358
  r.make_latest = b.make_latest;
320
359
  }
360
+ else if (b.draft === true) {
361
+ r.draft = true;
362
+ }
363
+ else if (b.make_latest !== undefined) {
364
+ r.make_latest = b.make_latest;
365
+ }
321
366
  return json(200, view(r));
322
367
  }
323
368
  if (init.method === "DELETE" && edit) {
@@ -336,7 +381,7 @@ export function startFakeForge(forge, api, repo, releases = []) {
336
381
  }
337
382
  return json(404, { message: "Not Found" });
338
383
  };
339
- return {
384
+ const fake = {
340
385
  fetch,
341
386
  calls,
342
387
  releases,
@@ -345,6 +390,7 @@ export function startFakeForge(forge, api, repo, releases = []) {
345
390
  failOnce: (prefix) => void failures.push(prefix),
346
391
  tags,
347
392
  };
393
+ return fake;
348
394
  }
349
395
  /** A small SPDX document, as `npm sbom --sbom-format spdx` writes one. */
350
396
  export function spdxDocument(name) {
@@ -419,8 +465,20 @@ export function startFakeGitHubRepo(api, repo, branch, files) {
419
465
  return json(201, { ref: body.ref, object: { sha: body.sha } });
420
466
  }
421
467
  const contents = path.startsWith(`${root}/contents/`) ? path.slice(`${root}/contents/`.length).split("/").map(decodeURIComponent).join("/") : null;
468
+ if (init.method === "GET" && path === `${root}/commits`) {
469
+ // #5163: the commits of a branch that touch a path, newest first.
470
+ const file = u.searchParams.get("path") ?? "";
471
+ const out = [];
472
+ for (let c = branches.get(u.searchParams.get("sha") ?? branch) ?? null; c; c = commits.get(c).parent) {
473
+ const parent = commits.get(c).parent;
474
+ if (commits.get(c).files.get(file) !== (parent ? commits.get(parent).files.get(file) : undefined))
475
+ out.push({ sha: c });
476
+ }
477
+ return json(200, out);
478
+ }
422
479
  if (contents !== null && init.method === "GET") {
423
- const at = branches.get(u.searchParams.get("ref") ?? branch);
480
+ const r = u.searchParams.get("ref") ?? branch;
481
+ const at = branches.get(r) ?? (commits.has(r) ? r : undefined);
424
482
  const text = at ? commits.get(at).files.get(contents) : undefined;
425
483
  return text === undefined ? json(404, { message: "Not Found" }) : json(200, { sha: blob(text), encoding: "base64", content: Buffer.from(text).toString("base64") });
426
484
  }
@@ -455,3 +513,217 @@ export function startFakeGitHubRepo(api, repo, branch, files) {
455
513
  },
456
514
  };
457
515
  }
516
+ /**
517
+ * A GitHub fake for the index target (#5158): `GET /user` names `user`; the
518
+ * repository, refs, contents (files and submodules), git data (blobs, trees,
519
+ * commits), fork and pull request APIs. A fork made by `POST .../forks`
520
+ * answers 404 to its first `forkDelay` reads, as GitHub makes forks in the
521
+ * background.
522
+ */
523
+ export function startFakeGitHub(api, opts) {
524
+ const calls = [];
525
+ const commits = new Map();
526
+ const trees = new Map();
527
+ const blobs = new Map();
528
+ const repos = new Map();
529
+ const pulls = [];
530
+ let n = 0;
531
+ const id = (what) => createHash("sha1").update(`${what} ${n++}`).digest("hex");
532
+ const commitOf = (parent, message, tree) => {
533
+ const sha = id("commit");
534
+ commits.set(sha, { parent, message, tree });
535
+ trees.set(`t${sha}`, tree);
536
+ return sha;
537
+ };
538
+ const entries = (files) => new Map(Object.entries(files).map(([p, v]) => [p, typeof v === "string" ? { text: v } : v]));
539
+ const resolve = (repo, ref) => repos.get(repo)?.branches.get(ref) ?? (commits.has(ref) ? ref : undefined);
540
+ const blobSha = (text) => createHash("sha1").update(`blob ${text}`).digest("hex");
541
+ const headers = { get: (name) => (name.toLowerCase() === "x-oauth-scopes" && opts.scopes !== undefined && opts.scopes !== null ? opts.scopes : null) };
542
+ const json = (status, body) => ({ ok: status < 300, status, headers, text: async () => (body === undefined ? "" : JSON.stringify(body)) });
543
+ const fetch = async (url, init) => {
544
+ calls.push({ method: init.method, url, headers: init.headers, ...(init.body !== undefined ? { body: init.body } : {}) });
545
+ const u = new URL(url);
546
+ const path = url.split("?")[0];
547
+ const body = typeof init.body === "string" ? JSON.parse(init.body) : {};
548
+ if (path === `${api}/user` && init.method === "GET")
549
+ return json(200, { login: opts.user });
550
+ const m = path.slice(api.length).match(/^\/repos\/([^/]+\/[^/]+)(\/.*)?$/);
551
+ if (!m)
552
+ return json(404, { message: "Not Found" });
553
+ const name = m[1];
554
+ const rest = m[2] ?? "";
555
+ const r = repos.get(name);
556
+ if (r && r.hiddenReads > 0 && init.method === "GET" && rest === "") {
557
+ r.hiddenReads--;
558
+ return json(404, { message: "Not Found" });
559
+ }
560
+ if (rest === "/forks" && init.method === "POST") {
561
+ if (!r)
562
+ return json(404, { message: "Not Found" });
563
+ const forkName = `${opts.user}/${name.split("/")[1]}`;
564
+ if (forkName === name)
565
+ return json(403, { message: "cannot fork your own repository" });
566
+ if (!repos.has(forkName))
567
+ repos.set(forkName, { defaultBranch: r.defaultBranch, branches: new Map([[r.defaultBranch, r.branches.get(r.defaultBranch)]]), fork: true, hiddenReads: opts.forkDelay ?? 0 });
568
+ return json(202, { full_name: forkName });
569
+ }
570
+ if (!r)
571
+ return json(404, { message: "Not Found" });
572
+ if (rest === "" && init.method === "GET")
573
+ return json(200, { full_name: name, default_branch: r.defaultBranch, fork: r.fork, permissions: { push: name.startsWith(`${opts.user}/`) } });
574
+ const ref = rest.match(/^\/git\/refs?\/heads\/(.+)$/);
575
+ if (ref) {
576
+ const branch = decodeURIComponent(ref[1]);
577
+ const at = r.branches.get(branch);
578
+ if (init.method === "GET")
579
+ return at ? json(200, { ref: `refs/heads/${branch}`, object: { sha: at } }) : json(404, { message: "Not Found" });
580
+ if (!at)
581
+ return json(422, { message: "Reference does not exist" });
582
+ if (init.method === "DELETE")
583
+ return void r.branches.delete(branch), json(204);
584
+ if (init.method === "PATCH") {
585
+ const to = String(body.sha);
586
+ if (!commits.has(to))
587
+ return json(422, { message: "Object does not exist" });
588
+ let ancestor = false;
589
+ for (let c = to; c; c = commits.get(c)?.parent ?? null)
590
+ if (c === at)
591
+ ancestor = true;
592
+ if (body.force !== true && !ancestor)
593
+ return json(422, { message: "Update is not a fast forward" });
594
+ r.branches.set(branch, to);
595
+ return json(200, { object: { sha: to } });
596
+ }
597
+ }
598
+ if (rest === "/git/refs" && init.method === "POST") {
599
+ const branch = String(body.ref).replace(/^refs\/heads\//, "");
600
+ if (r.branches.has(branch))
601
+ return json(422, { message: "Reference already exists" });
602
+ if (!commits.has(String(body.sha)))
603
+ return json(422, { message: "Object does not exist" });
604
+ r.branches.set(branch, String(body.sha));
605
+ return json(201, { ref: body.ref, object: { sha: body.sha } });
606
+ }
607
+ const gc = rest.match(/^\/git\/commits\/([0-9a-f]+)$/);
608
+ if (gc && init.method === "GET")
609
+ return commits.has(gc[1]) ? json(200, { sha: gc[1], tree: { sha: `t${gc[1]}` } }) : json(404, { message: "Not Found" });
610
+ if (rest === "/git/blobs" && init.method === "POST") {
611
+ const text = Buffer.from(String(body.content), "base64").toString("utf-8");
612
+ const sha = blobSha(text);
613
+ blobs.set(sha, text);
614
+ return json(201, { sha });
615
+ }
616
+ if (rest === "/git/trees" && init.method === "POST") {
617
+ const base = trees.get(String(body.base_tree));
618
+ if (!base)
619
+ return json(422, { message: "base_tree not found" });
620
+ const tree = new Map(base);
621
+ for (const e of body.tree) {
622
+ if (e.sha === null)
623
+ tree.delete(e.path);
624
+ else if (e.mode === "160000")
625
+ tree.set(e.path, { gitlink: e.sha });
626
+ else if (blobs.has(e.sha))
627
+ tree.set(e.path, { text: blobs.get(e.sha) });
628
+ else
629
+ return json(422, { message: "blob not found" });
630
+ }
631
+ const sha = id("tree");
632
+ trees.set(sha, tree);
633
+ return json(201, { sha });
634
+ }
635
+ if (rest === "/git/commits" && init.method === "POST") {
636
+ const tree = trees.get(String(body.tree));
637
+ const parents = body.parents;
638
+ if (!tree || parents.length !== 1 || !commits.has(parents[0]))
639
+ return json(422, { message: "bad commit" });
640
+ const sha = id("commit");
641
+ commits.set(sha, { parent: parents[0], message: String(body.message), tree });
642
+ trees.set(`t${sha}`, tree);
643
+ return json(201, { sha });
644
+ }
645
+ if (rest === "/commits" && init.method === "GET") {
646
+ // #5163: the commits of a branch that touch a path, newest first.
647
+ const file = u.searchParams.get("path") ?? "";
648
+ const text = (c) => {
649
+ const e = commits.get(c).tree.get(file);
650
+ return e && "text" in e ? e.text : undefined;
651
+ };
652
+ const out = [];
653
+ for (let c = resolve(name, u.searchParams.get("sha") ?? r.defaultBranch) ?? null; c; c = commits.get(c).parent) {
654
+ const parent = commits.get(c).parent;
655
+ if (text(c) !== (parent ? text(parent) : undefined))
656
+ out.push({ sha: c });
657
+ }
658
+ return json(200, out);
659
+ }
660
+ const contents = rest.startsWith("/contents/") ? rest.slice("/contents/".length).split("/").map(decodeURIComponent).join("/") : null;
661
+ if (contents !== null && init.method === "GET") {
662
+ const at = resolve(name, u.searchParams.get("ref") ?? r.defaultBranch);
663
+ const e = at ? commits.get(at).tree.get(contents) : undefined;
664
+ if (!e)
665
+ return json(404, { message: "Not Found" });
666
+ if ("gitlink" in e)
667
+ return json(200, { type: "submodule", sha: e.gitlink });
668
+ return json(200, { type: "file", sha: blobSha(e.text), encoding: "base64", content: Buffer.from(e.text).toString("base64") });
669
+ }
670
+ if (contents !== null && init.method === "PUT") {
671
+ const on = String(body.branch);
672
+ const at = r.branches.get(on);
673
+ if (!at)
674
+ return json(404, { message: "Branch not found" });
675
+ const current = commits.get(at).tree.get(contents);
676
+ if ((current && "text" in current ? blobSha(current.text) : undefined) !== body.sha)
677
+ return json(409, { message: "sha does not match" });
678
+ const tree = new Map(commits.get(at).tree);
679
+ tree.set(contents, { text: Buffer.from(String(body.content), "base64").toString("utf-8") });
680
+ const sha = commitOf(at, String(body.message), tree);
681
+ r.branches.set(on, sha);
682
+ return json(current === undefined ? 201 : 200, { commit: { sha } });
683
+ }
684
+ if (rest === "/pulls" && init.method === "GET") {
685
+ const head = u.searchParams.get("head");
686
+ return json(200, pulls.filter((p) => p.repo === name && (!head || p.head === head)).map((p) => ({ number: p.number, html_url: `https://github.test/${name}/pull/${p.number}`, state: p.state, merged_at: p.merged ? "2026-11-16T00:00:00Z" : null, head: { label: p.head } })));
687
+ }
688
+ if (rest === "/pulls" && init.method === "POST") {
689
+ const head = String(body.head);
690
+ const [owner, branch] = head.split(":");
691
+ const from = [...repos.entries()].find(([k]) => k.split("/")[0] === owner && repos.get(k).branches.has(branch));
692
+ if (!from)
693
+ return json(422, { message: "head not found" });
694
+ if (pulls.some((p) => p.repo === name && p.head === head && p.state === "open"))
695
+ return json(422, { message: "A pull request already exists" });
696
+ const p = { number: pulls.length + 1, repo: name, head, base: String(body.base), title: String(body.title), body: String(body.body), state: "open", merged: false };
697
+ pulls.push(p);
698
+ return json(201, { number: p.number, html_url: `https://github.test/${name}/pull/${p.number}`, state: "open", merged_at: null, head: { label: head } });
699
+ }
700
+ return json(404, { message: "Not Found" });
701
+ };
702
+ return {
703
+ fetch,
704
+ calls,
705
+ pulls,
706
+ repo: (repo, branch, files) => void repos.set(repo, { defaultBranch: branch, branches: new Map([[branch, commitOf(null, "init", entries(files))]]), fork: false, hiddenReads: 0 }),
707
+ head: (repo, branch) => repos.get(repo)?.branches.get(branch),
708
+ read: (repo, ref, p) => {
709
+ const at = resolve(repo, ref);
710
+ const e = at ? commits.get(at).tree.get(p) : undefined;
711
+ return e && "text" in e ? e.text : undefined;
712
+ },
713
+ gitlink: (repo, ref, p) => {
714
+ const at = resolve(repo, ref);
715
+ const e = at ? commits.get(at).tree.get(p) : undefined;
716
+ return e && "gitlink" in e ? e.gitlink : undefined;
717
+ },
718
+ commit: (sha) => {
719
+ const c = commits.get(sha);
720
+ return c ? { message: c.message, parent: c.parent } : undefined;
721
+ },
722
+ push: (repo, branch, files) => {
723
+ const r = repos.get(repo);
724
+ const at = r.branches.get(branch);
725
+ r.branches.set(branch, commitOf(at, "someone else", new Map([...commits.get(at).tree, ...entries(files)])));
726
+ },
727
+ repos: () => [...repos.keys()],
728
+ };
729
+ }
@@ -5,7 +5,8 @@
5
5
  * The provenance statement is an in-toto Statement v1 whose predicate
6
6
  * (`https://intentius.io/chant/release/v1`) names the release, its commit,
7
7
  * and the cut that signed it, with the cut's ssh signature in the
8
- * `chant-release` namespace. Anyone holding the repository checks that
8
+ * `chant-release` namespace, and the green gate the cut passed: a chant
9
+ * green tag, the forge checks by name, or none (#5149). Anyone holding the repository checks that
9
10
  * signature offline with `chant release verify`, against
10
11
  * `.chant/allowed_signers` at the release's commit. The predicate also says
11
12
  * whether the run had an OIDC token: in CI, the provenance a registry records
@@ -5,7 +5,8 @@
5
5
  * The provenance statement is an in-toto Statement v1 whose predicate
6
6
  * (`https://intentius.io/chant/release/v1`) names the release, its commit,
7
7
  * and the cut that signed it, with the cut's ssh signature in the
8
- * `chant-release` namespace. Anyone holding the repository checks that
8
+ * `chant-release` namespace, and the green gate the cut passed: a chant
9
+ * green tag, the forge checks by name, or none (#5149). Anyone holding the repository checks that
9
10
  * signature offline with `chant release verify`, against
10
11
  * `.chant/allowed_signers` at the release's commit. The predicate also says
11
12
  * whether the run had an OIDC token: in CI, the provenance a registry records
@@ -64,7 +65,23 @@ export function releaseProvenance(ctx, subjects) {
64
65
  label: ctx.label,
65
66
  member: ctx.release.member,
66
67
  commit: ctx.release.commit,
67
- cut: cut ? { actor: cut.actor, label: cut.label, timestamp: cut.timestamp, runId: cut.runId, signature: cut.signature, namespace: RELEASE_SEAL_NAMESPACE } : null,
68
+ cut: cut
69
+ ? {
70
+ actor: cut.actor,
71
+ label: cut.label,
72
+ timestamp: cut.timestamp,
73
+ runId: cut.runId,
74
+ signature: cut.signature,
75
+ namespace: RELEASE_SEAL_NAMESPACE,
76
+ // #5149: the gate that let the commit be cut, as the cut line records it; absent on a cut that recorded none.
77
+ ...(cut.green ? { green: cut.green } : {}),
78
+ ...(cut.override ? { override: { by: cut.override.by, at: cut.override.at, reason: cut.override.reason, tag: cut.override.tag } } : {}),
79
+ // #5177: whether the signature above covers that gate, and the payload version a verifier rebuilds.
80
+ ...(cut.lane ? { lane: cut.lane } : {}),
81
+ ...(cut.sealVersion ? { sealVersion: cut.sealVersion } : {}),
82
+ ...(cut.gate ? { gate: cut.gate } : {}),
83
+ }
84
+ : null,
68
85
  provenance: ctx.provenance.oidc ? { kind: "oidc", ci: ctx.provenance.ci } : { kind: "signature", ci: ctx.provenance.ci },
69
86
  },
70
87
  };
@@ -0,0 +1,99 @@
1
+ /**
2
+ * The cargo target (#5167): Rust crates published to crates.io or another
3
+ * Cargo registry with `cargo publish`, one crate at a time, each after the
4
+ * workspace crates it depends on.
5
+ *
6
+ * The crates and their versions come from `cargo metadata --no-deps` on the
7
+ * declared manifest: the ones `crates` names, else every workspace member
8
+ * whose `publish` allows the registry. The version published is the one in
9
+ * each `Cargo.toml`, which `release.version` can stamp with the release's
10
+ * label. A crate's dependency on another workspace crate needs a version
11
+ * beside its path, or cargo refuses to publish it, so the plan refuses it
12
+ * first (`publish-cargo-dependency-version`).
13
+ *
14
+ * A registry has no draft: a crate version is visible as soon as it is
15
+ * published, and a version can never be published twice. So the stage
16
+ * publishes nothing. It reads the registry's sparse index for each crate,
17
+ * and a version already there is `present`. The reveal reads the index
18
+ * again before each crate, so a reveal run again after a failure part way
19
+ * publishes only the crates that are not there yet, and then runs
20
+ *
21
+ * cargo publish -p <crate> --manifest-path <manifest> --no-verify --allow-dirty [--registry <name>]
22
+ *
23
+ * in dependency order. `--no-verify` because a publish never builds: the
24
+ * build belongs to the cut. `--allow-dirty` because the checkout carries the
25
+ * stamped versions, which the publish's own checkout check already allows.
26
+ * cargo waits until the registry's index serves each crate before it
27
+ * returns, so the next crate resolves it. Nothing is out between the stage
28
+ * and the reveal, so a check of what staged can't see this target.
29
+ *
30
+ * Credentials:
31
+ *
32
+ * - `auth: "token"`: a token from `tokenEnv` (default `CARGO_REGISTRY_TOKEN`,
33
+ * or `CARGO_REGISTRIES_<NAME>_TOKEN` with `registry`), handed to cargo in
34
+ * the variable it reads.
35
+ * - `auth: "trusted-publishing"`, crates.io only: the run's OIDC ID token
36
+ * (audience `crates.io`, from GitHub Actions or `CRATES_IO_ID_TOKEN`) is
37
+ * exchanged at `POST {api}/api/v1/trusted_publishing/tokens` for a token
38
+ * that lasts minutes, and revoked with a `DELETE` when the step ends. The
39
+ * stage exchanges and revokes one to check that crates.io takes this
40
+ * workflow as a trusted publisher.
41
+ *
42
+ * Unset, `auth` is a token when the token's variable is set, else trusted
43
+ * publishing when the run has an OIDC ID token.
44
+ *
45
+ * A status change (#5163): `chant release yank` runs `cargo yank --version
46
+ * <version> <crate>` for each crate the release published, and `restore`
47
+ * runs it with `--undo`. A yanked version stays downloadable for lockfiles
48
+ * that name it, and new resolutions skip it. A registry has no deprecation,
49
+ * so `deprecate` changes nothing. A yank needs a token, from the same
50
+ * variable as a publish, that may yank the crates.
51
+ *
52
+ * A registry keeps no file beside a crate, so nothing is attached. Under the
53
+ * `supply-chain` group the target is refused (`publish-sbom-missing`) unless
54
+ * `sbom` is `false`.
55
+ */
56
+ import type { CargoPublishDeclaration } from "./publish-declaration.js";
57
+ import { type PublishDeps, type PublishTarget } from "./release-publish.js";
58
+ /** The first chant that publishes a `cargo` target (#5167). */
59
+ export declare const PUBLISH_CARGO_FLOOR = "0.124.101";
60
+ export declare const CRATES_IO_INDEX = "https://index.crates.io/";
61
+ export declare const CRATES_IO_API = "https://crates.io";
62
+ /** The variable an OIDC ID token for crates.io is read from outside GitHub Actions. */
63
+ export declare const CRATES_IO_ID_TOKEN_ENV = "CRATES_IO_ID_TOKEN";
64
+ /** The audience crates.io takes an OIDC ID token for. */
65
+ export declare const CRATES_IO_AUDIENCE = "crates.io";
66
+ /** The variable cargo reads a registry's token from. */
67
+ export declare function cargoRegistryTokenVar(registry: string | undefined): string;
68
+ /** The variable the declaration's token is read from. */
69
+ export declare function cargoTokenEnv(decl: Pick<CargoPublishDeclaration, "registry" | "tokenEnv">): string;
70
+ /** How the target authenticates in `env`. */
71
+ export declare function cargoAuth(decl: CargoPublishDeclaration, env: NodeJS.ProcessEnv): "token" | "trusted-publishing";
72
+ /** A crate's file in a sparse index, by Cargo's layout. */
73
+ export declare function sparseIndexPath(name: string): string;
74
+ /** One workspace crate, as `cargo metadata` gives it. */
75
+ export interface CargoCrate {
76
+ name: string;
77
+ version: string;
78
+ /** null: any registry; []: none. */
79
+ publish: string[] | null;
80
+ dependencies: Array<{
81
+ name: string;
82
+ req: string;
83
+ kind: string | null;
84
+ path?: string;
85
+ }>;
86
+ }
87
+ /**
88
+ * The crates to publish, each after the selected crates it depends on (ties
89
+ * in name order). A dev-dependency with no version is left out of the order,
90
+ * since cargo drops it from what it publishes.
91
+ */
92
+ export declare function cargoPublishOrder(all: readonly CargoCrate[], decl: Pick<CargoPublishDeclaration, "crates" | "registry">): CargoCrate[];
93
+ /** The workspace's crates, from `cargo metadata --no-deps`. */
94
+ export declare function cargoWorkspace(cargo: string, manifest: string, cwd: string, env: NodeJS.ProcessEnv, runner?: (bin: string, args: string[], cwd: string, env: NodeJS.ProcessEnv) => Promise<{
95
+ code: number;
96
+ stdout: string;
97
+ stderr: string;
98
+ }>): Promise<CargoCrate[]>;
99
+ export declare function cargoTarget(decl: CargoPublishDeclaration, deps: PublishDeps): PublishTarget;