@intentius/chant 0.124.62 → 0.124.64

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 (262) hide show
  1. package/dist/cli/handlers/approve.d.ts +26 -0
  2. package/dist/cli/handlers/approve.d.ts.map +1 -1
  3. package/dist/cli/handlers/approve.js +167 -18
  4. package/dist/cli/handlers/plan.d.ts +10 -0
  5. package/dist/cli/handlers/plan.d.ts.map +1 -0
  6. package/dist/cli/handlers/plan.js +71 -0
  7. package/dist/cli/handlers/pr.d.ts.map +1 -1
  8. package/dist/cli/handlers/pr.js +2 -1
  9. package/dist/cli/handlers/release.d.ts +11 -7
  10. package/dist/cli/handlers/release.d.ts.map +1 -1
  11. package/dist/cli/handlers/release.js +93 -20
  12. package/dist/cli/main.d.ts.map +1 -1
  13. package/dist/cli/main.js +48 -7
  14. package/dist/cli/mcp/workspace-tools.d.ts.map +1 -1
  15. package/dist/cli/mcp/workspace-tools.js +2 -1
  16. package/dist/cli/parse-args.d.ts.map +1 -1
  17. package/dist/cli/parse-args.js +43 -0
  18. package/dist/cli/registry.d.ts +18 -2
  19. package/dist/cli/registry.d.ts.map +1 -1
  20. package/dist/config.d.ts +50 -0
  21. package/dist/config.d.ts.map +1 -1
  22. package/dist/config.js +1 -0
  23. package/dist/gate-decision.d.ts +1 -1
  24. package/dist/gate-decision.d.ts.map +1 -1
  25. package/dist/gate-decision.js +4 -2
  26. package/dist/gate-statement.schema.json +46 -0
  27. package/dist/lifecycle/__fixtures__/publish-fakes.d.ts +20 -0
  28. package/dist/lifecycle/__fixtures__/publish-fakes.d.ts.map +1 -1
  29. package/dist/lifecycle/__fixtures__/publish-fakes.js +119 -3
  30. package/dist/lifecycle/gate-ledger.d.ts +28 -5
  31. package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
  32. package/dist/lifecycle/gate-ledger.js +6 -0
  33. package/dist/lifecycle/gate-seal.d.ts +59 -7
  34. package/dist/lifecycle/gate-seal.d.ts.map +1 -1
  35. package/dist/lifecycle/gate-seal.js +68 -15
  36. package/dist/lifecycle/gate-statement.d.ts +95 -0
  37. package/dist/lifecycle/gate-statement.d.ts.map +1 -0
  38. package/dist/lifecycle/gate-statement.js +110 -0
  39. package/dist/lifecycle/gate-webauthn.d.ts +79 -0
  40. package/dist/lifecycle/gate-webauthn.d.ts.map +1 -0
  41. package/dist/lifecycle/gate-webauthn.js +105 -0
  42. package/dist/lifecycle/git.d.ts +1 -1
  43. package/dist/lifecycle/git.d.ts.map +1 -1
  44. package/dist/lifecycle/git.js +24 -19
  45. package/dist/lifecycle/ledger-remote.d.ts +37 -0
  46. package/dist/lifecycle/ledger-remote.d.ts.map +1 -0
  47. package/dist/lifecycle/ledger-remote.js +42 -0
  48. package/dist/lifecycle/plan-stale.d.ts +76 -0
  49. package/dist/lifecycle/plan-stale.d.ts.map +1 -0
  50. package/dist/lifecycle/plan-stale.js +120 -0
  51. package/dist/lifecycle/publish-credentials.d.ts +1 -1
  52. package/dist/lifecycle/publish-credentials.d.ts.map +1 -1
  53. package/dist/lifecycle/publish-credentials.js +2 -0
  54. package/dist/lifecycle/publish-declaration.d.ts +107 -0
  55. package/dist/lifecycle/publish-declaration.d.ts.map +1 -1
  56. package/dist/lifecycle/publish-declaration.js +110 -1
  57. package/dist/lifecycle/publish-forge.d.ts +5 -1
  58. package/dist/lifecycle/publish-forge.d.ts.map +1 -1
  59. package/dist/lifecycle/publish-forge.js +13 -4
  60. package/dist/lifecycle/publish-git-ssh.d.ts +82 -0
  61. package/dist/lifecycle/publish-git-ssh.d.ts.map +1 -0
  62. package/dist/lifecycle/publish-git-ssh.js +180 -0
  63. package/dist/lifecycle/publish-github.d.ts +69 -0
  64. package/dist/lifecycle/publish-github.d.ts.map +1 -0
  65. package/dist/lifecycle/publish-github.js +153 -0
  66. package/dist/lifecycle/publish-homebrew.d.ts +77 -0
  67. package/dist/lifecycle/publish-homebrew.d.ts.map +1 -0
  68. package/dist/lifecycle/publish-homebrew.js +265 -0
  69. package/dist/lifecycle/publish-marketplace.d.ts +85 -0
  70. package/dist/lifecycle/publish-marketplace.d.ts.map +1 -0
  71. package/dist/lifecycle/publish-marketplace.js +398 -0
  72. package/dist/lifecycle/publish-targets.d.ts +6 -0
  73. package/dist/lifecycle/publish-targets.d.ts.map +1 -1
  74. package/dist/lifecycle/publish-targets.js +15 -0
  75. package/dist/lifecycle/publish-tauri.d.ts +61 -0
  76. package/dist/lifecycle/publish-tauri.d.ts.map +1 -0
  77. package/dist/lifecycle/publish-tauri.js +181 -0
  78. package/dist/lifecycle/release-cut.d.ts +51 -5
  79. package/dist/lifecycle/release-cut.d.ts.map +1 -1
  80. package/dist/lifecycle/release-cut.js +165 -16
  81. package/dist/lifecycle/release-publish.d.ts +18 -2
  82. package/dist/lifecycle/release-publish.d.ts.map +1 -1
  83. package/dist/lifecycle/release-publish.js +5 -0
  84. package/dist/lifecycle/release-revocation.d.ts +4 -3
  85. package/dist/lifecycle/release-revocation.d.ts.map +1 -1
  86. package/dist/lifecycle/release-revocation.js +5 -4
  87. package/dist/lifecycle/release-store.d.ts +32 -0
  88. package/dist/lifecycle/release-store.d.ts.map +1 -1
  89. package/dist/lifecycle/release-store.js +11 -0
  90. package/dist/lifecycle/snapshot-store.d.ts.map +1 -1
  91. package/dist/lifecycle/snapshot-store.js +17 -9
  92. package/dist/lifecycle/test-passkey.d.ts +25 -0
  93. package/dist/lifecycle/test-passkey.d.ts.map +1 -0
  94. package/dist/lifecycle/test-passkey.js +39 -0
  95. package/dist/notify.d.ts +23 -3
  96. package/dist/notify.d.ts.map +1 -1
  97. package/dist/notify.js +8 -2
  98. package/dist/notify.schema.json +12 -3
  99. package/dist/op/gate.d.ts +1 -1
  100. package/dist/op/gate.d.ts.map +1 -1
  101. package/dist/op/gate.js +2 -1
  102. package/dist/pr-forge.d.ts +20 -0
  103. package/dist/pr-forge.d.ts.map +1 -1
  104. package/dist/pr-forge.js +87 -8
  105. package/dist/release-floors.d.ts +1 -1
  106. package/dist/release-floors.js +1 -1
  107. package/dist/wave-runtime.mjs +333 -331
  108. package/dist/workspace/ci-builds.d.ts +21 -0
  109. package/dist/workspace/ci-builds.d.ts.map +1 -1
  110. package/dist/workspace/ci-builds.js +14 -0
  111. package/dist/workspace/ci-green.d.ts +45 -2
  112. package/dist/workspace/ci-green.d.ts.map +1 -1
  113. package/dist/workspace/ci-green.js +123 -5
  114. package/dist/workspace/ci-quarantine-report.d.ts +80 -0
  115. package/dist/workspace/ci-quarantine-report.d.ts.map +1 -0
  116. package/dist/workspace/ci-quarantine-report.js +204 -0
  117. package/dist/workspace/ci-quarantine.d.ts +73 -0
  118. package/dist/workspace/ci-quarantine.d.ts.map +1 -0
  119. package/dist/workspace/ci-quarantine.js +170 -0
  120. package/dist/workspace/ci-serve.d.ts.map +1 -1
  121. package/dist/workspace/ci-serve.js +7 -4
  122. package/dist/workspace/class-data.d.ts +3 -1
  123. package/dist/workspace/class-data.d.ts.map +1 -1
  124. package/dist/workspace/class-data.js +4 -1
  125. package/dist/workspace/declaration.d.ts +45 -2
  126. package/dist/workspace/declaration.d.ts.map +1 -1
  127. package/dist/workspace/declaration.js +45 -2
  128. package/dist/workspace/declaration.schema.json +51 -3
  129. package/dist/workspace/forge-work.d.ts +76 -0
  130. package/dist/workspace/forge-work.d.ts.map +1 -0
  131. package/dist/workspace/forge-work.js +160 -0
  132. package/dist/workspace/identity-gate-rule.d.ts +3 -2
  133. package/dist/workspace/identity-gate-rule.d.ts.map +1 -1
  134. package/dist/workspace/identity-gate-rule.js +5 -7
  135. package/dist/workspace/identity.d.ts +3 -2
  136. package/dist/workspace/identity.d.ts.map +1 -1
  137. package/dist/workspace/identity.js +6 -3
  138. package/dist/workspace/intent-cli.d.ts +3 -2
  139. package/dist/workspace/intent-cli.d.ts.map +1 -1
  140. package/dist/workspace/intent-cli.js +26 -5
  141. package/dist/workspace/intent-record.d.ts +3 -0
  142. package/dist/workspace/intent-record.d.ts.map +1 -1
  143. package/dist/workspace/intent-record.schema.json +32 -0
  144. package/dist/workspace/intent.d.ts +9 -0
  145. package/dist/workspace/intent.d.ts.map +1 -1
  146. package/dist/workspace/intent.js +2 -0
  147. package/dist/workspace/intent.schema.json +32 -0
  148. package/dist/workspace/kind-readers.d.ts.map +1 -1
  149. package/dist/workspace/kind-readers.js +2 -1
  150. package/dist/workspace/kinds.d.ts +6 -1
  151. package/dist/workspace/kinds.d.ts.map +1 -1
  152. package/dist/workspace/kinds.js +8 -3
  153. package/dist/workspace/plan-stale.schema.json +286 -0
  154. package/dist/workspace/release-candidates.d.ts +42 -7
  155. package/dist/workspace/release-candidates.d.ts.map +1 -1
  156. package/dist/workspace/release-candidates.js +64 -23
  157. package/dist/workspace/release-candidates.schema.json +55 -2
  158. package/dist/workspace/releases.schema.json +47 -0
  159. package/dist/workspace/trust/policy.d.ts +10 -0
  160. package/dist/workspace/trust/policy.d.ts.map +1 -1
  161. package/dist/workspace/trust/policy.js +19 -1
  162. package/dist/workspace/trust/run-commits.d.ts.map +1 -1
  163. package/dist/workspace/trust/run-commits.js +2 -1
  164. package/dist/workspace/trust/seal.d.ts.map +1 -1
  165. package/dist/workspace/trust/seal.js +34 -3
  166. package/dist/workspace/trust/trust-files.d.ts.map +1 -1
  167. package/dist/workspace/trust/trust-files.js +6 -1
  168. package/package.json +2 -1
  169. package/src/cli/handlers/approve-external-signature.test.ts +328 -0
  170. package/src/cli/handlers/approve.ts +206 -18
  171. package/src/cli/handlers/plan.ts +74 -0
  172. package/src/cli/handlers/pr.ts +2 -1
  173. package/src/cli/handlers/release.ts +84 -20
  174. package/src/cli/main.ts +48 -7
  175. package/src/cli/mcp/workspace-tools.ts +2 -1
  176. package/src/cli/parse-args.ts +33 -0
  177. package/src/cli/registry.ts +18 -2
  178. package/src/config.ts +8 -0
  179. package/src/gate-decision-bundle.test.ts +4 -2
  180. package/src/gate-decision.ts +11 -2
  181. package/src/gate-statement.schema.json +46 -0
  182. package/src/lifecycle/__fixtures__/publish-fakes.ts +125 -5
  183. package/src/lifecycle/gate-ledger.ts +34 -5
  184. package/src/lifecycle/gate-seal.ts +86 -15
  185. package/src/lifecycle/gate-statement.ts +144 -0
  186. package/src/lifecycle/gate-webauthn.test.ts +77 -0
  187. package/src/lifecycle/gate-webauthn.ts +133 -0
  188. package/src/lifecycle/git.ts +23 -19
  189. package/src/lifecycle/ledger-remote.test.ts +183 -0
  190. package/src/lifecycle/ledger-remote.ts +46 -0
  191. package/src/lifecycle/plan-stale.test.ts +149 -0
  192. package/src/lifecycle/plan-stale.ts +172 -0
  193. package/src/lifecycle/publish-credentials.ts +2 -0
  194. package/src/lifecycle/publish-declaration.ts +116 -1
  195. package/src/lifecycle/publish-forge.ts +14 -4
  196. package/src/lifecycle/publish-git-ssh.ts +202 -0
  197. package/src/lifecycle/publish-github.ts +174 -0
  198. package/src/lifecycle/publish-homebrew.test.ts +358 -0
  199. package/src/lifecycle/publish-homebrew.ts +283 -0
  200. package/src/lifecycle/publish-marketplace.test.ts +406 -0
  201. package/src/lifecycle/publish-marketplace.ts +421 -0
  202. package/src/lifecycle/publish-resume.test.ts +40 -0
  203. package/src/lifecycle/publish-target-context.test.ts +2 -2
  204. package/src/lifecycle/publish-targets.test.ts +23 -0
  205. package/src/lifecycle/publish-targets.ts +15 -0
  206. package/src/lifecycle/publish-tauri.test.ts +163 -0
  207. package/src/lifecycle/publish-tauri.ts +198 -0
  208. package/src/lifecycle/release-cut-lane.test.ts +177 -0
  209. package/src/lifecycle/release-cut-override.test.ts +213 -0
  210. package/src/lifecycle/release-cut.ts +198 -17
  211. package/src/lifecycle/release-publish.ts +23 -3
  212. package/src/lifecycle/release-revocation.ts +5 -4
  213. package/src/lifecycle/release-store.ts +44 -0
  214. package/src/lifecycle/snapshot-store.ts +16 -9
  215. package/src/lifecycle/test-passkey.ts +55 -0
  216. package/src/notify-bundle.test.ts +3 -1
  217. package/src/notify.schema.json +12 -3
  218. package/src/notify.ts +20 -3
  219. package/src/op/gate.ts +2 -1
  220. package/src/override-gate-bundle.test.ts +2 -0
  221. package/src/pr-forge-bundle.test.ts +2 -2
  222. package/src/pr-forge.test.ts +38 -0
  223. package/src/pr-forge.ts +93 -11
  224. package/src/pr-requires.test.ts +9 -0
  225. package/src/release-floors.ts +1 -1
  226. package/src/stage-hooks-bundle.test.ts +2 -0
  227. package/src/wave-runtime-bundle.test.ts +3 -2
  228. package/src/workspace/ci-builds.ts +27 -0
  229. package/src/workspace/ci-green-stale.test.ts +193 -0
  230. package/src/workspace/ci-green.ts +137 -6
  231. package/src/workspace/ci-quarantine-report.test.ts +145 -0
  232. package/src/workspace/ci-quarantine-report.ts +234 -0
  233. package/src/workspace/ci-quarantine.test.ts +160 -0
  234. package/src/workspace/ci-quarantine.ts +188 -0
  235. package/src/workspace/ci-serve.ts +7 -4
  236. package/src/workspace/class-data.ts +5 -1
  237. package/src/workspace/declaration.schema.json +51 -3
  238. package/src/workspace/declaration.test.ts +1 -0
  239. package/src/workspace/declaration.ts +88 -5
  240. package/src/workspace/forge-work.test.ts +143 -0
  241. package/src/workspace/forge-work.ts +195 -0
  242. package/src/workspace/identity-gate-rule.ts +6 -8
  243. package/src/workspace/identity.ts +6 -3
  244. package/src/workspace/intent-cli.ts +24 -5
  245. package/src/workspace/intent-record.schema.json +32 -0
  246. package/src/workspace/intent-record.ts +3 -0
  247. package/src/workspace/intent.schema.json +32 -0
  248. package/src/workspace/intent.ts +9 -0
  249. package/src/workspace/kind-readers.ts +2 -1
  250. package/src/workspace/kinds.test.ts +13 -0
  251. package/src/workspace/kinds.ts +12 -3
  252. package/src/workspace/plan-stale.schema.json +286 -0
  253. package/src/workspace/release-candidates.schema.json +55 -2
  254. package/src/workspace/release-candidates.test.ts +77 -4
  255. package/src/workspace/release-candidates.ts +80 -23
  256. package/src/workspace/releases.schema.json +47 -0
  257. package/src/workspace/trust/gate-seal.test.ts +44 -0
  258. package/src/workspace/trust/policy.ts +24 -1
  259. package/src/workspace/trust/run-commits.ts +2 -1
  260. package/src/workspace/trust/seal.ts +35 -3
  261. package/src/workspace/trust/trust-files.test.ts +5 -0
  262. package/src/workspace/trust/trust-files.ts +15 -1
@@ -0,0 +1,181 @@
1
+ /**
2
+ * The Tauri updater target (#4676): the updater manifest a Tauri v2 app reads
3
+ * (`latest.json`), and a rolling GitHub release under a fixed tag, such as
4
+ * `app-latest`, that holds the release's bundles and that manifest. Each
5
+ * publish replaces what the rolling release held.
6
+ *
7
+ * The manifest is the updater's static JSON:
8
+ *
9
+ * ```json
10
+ * {
11
+ * "version": "1.4.0",
12
+ * "notes": "...",
13
+ * "pub_date": "2026-10-17T10:00:00.000Z",
14
+ * "platforms": {
15
+ * "darwin-aarch64": { "signature": "<the .sig file's text>", "url": "https://.../Acme_aarch64.app.tar.gz" }
16
+ * }
17
+ * }
18
+ * ```
19
+ *
20
+ * `version` is the release's label from its first digit on; `notes` is the
21
+ * text of the declared `notes` file, left out without one; `pub_date` is the
22
+ * time of the cut whose signature the publish carries, left out when none is
23
+ * known, so the manifest is the same bytes on every run. Each platform's
24
+ * `signature` is the text of the `.sig` file the Tauri build wrote beside its
25
+ * updater bundle, and `url` is the `url` pattern for that bundle, by default
26
+ * its download URL on the rolling release.
27
+ *
28
+ * GitHub can't replace a release's contents in one request, so the two steps
29
+ * (#4048) are a draft and a swap:
30
+ *
31
+ * - The stage makes a draft release for the rolling tag named
32
+ * `<tag> <version>` at the release's commit, or finds the one an earlier
33
+ * stage made, and uploads each bundle, each declared asset and the manifest
34
+ * to it. A file already on the draft with the same digest is not sent
35
+ * again; one that differs is refused (`publish-tauri-asset-exists`). The
36
+ * published rolling release is untouched, so the updater sees nothing new.
37
+ * A rolling release that already holds every file with the same digests is
38
+ * what an earlier reveal left, and the stage does nothing.
39
+ * - The reveal deletes the published rolling release, deletes the tag so it
40
+ * is made again at the release's commit, and publishes the draft with
41
+ * `make_latest` from `latest` (default `false`: a rolling release is not
42
+ * the repository's latest). Between the delete and the publish, a few
43
+ * requests apart, the rolling release's URLs answer 404, which an updater
44
+ * treats as no update.
45
+ */
46
+ import { readFileSync } from "node:fs";
47
+ import { basename } from "node:path";
48
+ import { readCredential } from "./publish-credentials.js";
49
+ import { GitHubRepo, githubApi } from "./publish-github.js";
50
+ import { fillUrl, releaseVersion } from "./publish-homebrew.js";
51
+ import { bytesDigest, checkReleaseDigest, memberFile, publishTargetKey } from "./publish-targets.js";
52
+ import { PublishTargetError } from "./release-publish.js";
53
+ /** The first chant that publishes a `tauri-updater` target (#4676). */
54
+ export const PUBLISH_TAURI_UPDATER_FLOOR = "0.124.63";
55
+ /** The updater manifest's bytes: 2-space JSON with a trailing newline, keys in the order Tauri's docs show them. */
56
+ export function tauriManifest(m) {
57
+ const platforms = {};
58
+ for (const key of Object.keys(m.platforms).sort())
59
+ platforms[key] = { signature: m.platforms[key].signature, url: m.platforms[key].url };
60
+ const doc = { version: m.version, ...(m.notes !== null ? { notes: m.notes } : {}), ...(m.pubDate !== null ? { pub_date: m.pubDate } : {}), platforms };
61
+ return new Uint8Array(Buffer.from(`${JSON.stringify(doc, null, 2)}\n`, "utf-8"));
62
+ }
63
+ export function tauriUpdaterTarget(decl, deps) {
64
+ const fetchImpl = deps.fetch ?? ((url, init) => fetch(url, init));
65
+ const tokenNames = [decl.tokenEnv ?? "GITHUB_TOKEN"];
66
+ const manifestName = decl.manifest ?? "latest.json";
67
+ const urlPattern = decl.url ?? `https://github.com/${decl.repo}/releases/download/{tag}/{name}`;
68
+ const read = (ctx, path) => {
69
+ const bytes = new Uint8Array(readFileSync(memberFile(ctx.cwd, path)));
70
+ const digest = bytesDigest(bytes);
71
+ checkReleaseDigest(ctx.release, "asset", ctx.cwd, path, [digest]);
72
+ return { path, name: basename(path), bytes, digest };
73
+ };
74
+ const setup = (ctx) => {
75
+ const version = releaseVersion(ctx.label);
76
+ if (!version || !ctx.label) {
77
+ throw new PublishTargetError("publish-tauri-no-version", `the updater manifest's version is the release's label from its first digit, and release ${ctx.release.releaseDigest} has ${ctx.label ? `the label ${ctx.label}, which has no digit` : "no label"}`, "Cut the release with a label such as app-v1.4.0.");
78
+ }
79
+ const token = readCredential(ctx.env, tokenNames, ctx.redactor);
80
+ if (!token) {
81
+ throw new PublishTargetError("publish-credentials-missing", `the tauri-updater target reads its token from ${tokenNames[0]}, and it is not set`, `Set ${tokenNames[0]} to a token that may write releases on ${decl.repo}.`);
82
+ }
83
+ const files = [];
84
+ const platforms = {};
85
+ for (const [platform, path] of Object.entries(decl.platforms)) {
86
+ const bundle = read(ctx, path);
87
+ const sig = read(ctx, `${path}.sig`);
88
+ const signature = Buffer.from(sig.bytes).toString("utf-8").trim();
89
+ if (!signature)
90
+ throw new PublishTargetError("publish-tauri-signature-missing", `${path}.sig is empty, and the updater installs only a signed bundle`);
91
+ if (!files.some((f) => f.name === bundle.name))
92
+ files.push(bundle);
93
+ platforms[platform] = { signature, url: fillUrl(urlPattern, { tag: decl.tag, label: ctx.label, version, name: bundle.name }) };
94
+ }
95
+ for (const path of decl.assets ?? [])
96
+ files.push(read(ctx, path));
97
+ const notes = decl.notes ? readFileSync(memberFile(ctx.cwd, decl.notes), "utf-8").trim() : null;
98
+ const bytes = tauriManifest({ version, notes, pubDate: ctx.cut?.timestamp ?? null, platforms });
99
+ files.push({ path: manifestName, name: manifestName, bytes, digest: bytesDigest(bytes) });
100
+ const names = new Set();
101
+ for (const f of files) {
102
+ if (names.has(f.name))
103
+ throw new PublishTargetError("publish-tauri-asset-name-taken", `two files are named ${f.name}, and a release holds one asset per name`);
104
+ names.add(f.name);
105
+ }
106
+ const repo = new GitHubRepo(githubApi(decl.api, ctx.env), decl.repo, token, fetchImpl, ctx, "publish-tauri-failed");
107
+ return { version, token, files, repo, draftName: `${decl.tag} ${version}` };
108
+ };
109
+ const where = (name) => `github ${decl.repo} release ${decl.tag}, asset ${name}`;
110
+ const itemOf = (f, present = false) => ({ name: f.path, destination: where(f.name), digest: f.digest, ...(present ? { present: true } : {}) });
111
+ const holdsAll = (rel, files) => rel.assets.size === files.length && files.every((f) => rel.assets.get(f.name) === f.digest);
112
+ const target = {
113
+ kind: "tauri-updater",
114
+ name: `tauri updater ${decl.repo} ${decl.tag}`,
115
+ destination: `github ${decl.repo} release ${decl.tag}`,
116
+ credentialEnv: tokenNames,
117
+ key: publishTargetKey(decl),
118
+ async plan(ctx) {
119
+ return setup(ctx).files.map((f) => itemOf(f));
120
+ },
121
+ async stage(ctx) {
122
+ const { version, token, files, repo, draftName } = setup(ctx);
123
+ ctx.log(`using the token from ${token.from}`);
124
+ const done = (items, state) => ({ target: target.name, destination: target.destination, items, state });
125
+ const published = await repo.publishedRelease(decl.tag);
126
+ if (published && holdsAll(published, files)) {
127
+ ctx.log(`release ${decl.tag} already holds ${version}'s files`);
128
+ return done(files.map((f) => itemOf(f, true)), { published: published.id });
129
+ }
130
+ let draft = await repo.draftRelease(decl.tag, draftName);
131
+ if (draft)
132
+ ctx.log(`using the draft release ${draftName}`);
133
+ else {
134
+ ctx.log(`creating a draft release ${draftName} at ${ctx.release.commit.slice(0, 12)}`);
135
+ draft = await repo.createDraft(decl.tag, ctx.release.commit, draftName);
136
+ }
137
+ const items = [];
138
+ for (const f of files) {
139
+ if (draft.assets.has(f.name)) {
140
+ const theirs = draft.assets.get(f.name);
141
+ if (theirs !== f.digest) {
142
+ throw new PublishTargetError("publish-tauri-asset-exists", `the draft release ${draftName} on ${decl.repo} already has ${f.name}${theirs ? ` with digest ${theirs}, not ${f.digest}` : ", and GitHub reports no digest to compare"}`, "Delete the draft on GitHub so the stage makes it again.");
143
+ }
144
+ items.push(itemOf(f, true));
145
+ continue;
146
+ }
147
+ ctx.log(`uploading ${f.name} (${f.bytes.byteLength} bytes) to the draft`);
148
+ await repo.uploadAsset(draft, f.name, f.bytes);
149
+ items.push(itemOf(f));
150
+ }
151
+ return done(items, { releaseId: draft.id });
152
+ },
153
+ async reveal(ctx, staged) {
154
+ const items = staged.items.map((i) => ({ name: i.name, destination: i.destination, ...(i.digest ? { digest: i.digest } : {}) }));
155
+ if (staged.state.published)
156
+ return { target: target.name, destination: target.destination, items: items.map((i) => ({ ...i, present: true })) };
157
+ const id = staged.state.releaseId;
158
+ if (!id)
159
+ throw new PublishTargetError("publish-tauri-failed", `the staged release for ${decl.tag} has no draft id to publish`);
160
+ const { repo } = setup(ctx);
161
+ const old = await repo.publishedRelease(decl.tag);
162
+ if (old?.id === id) {
163
+ ctx.log(`release ${decl.tag} is already the staged draft, published`);
164
+ return { target: target.name, destination: target.destination, items };
165
+ }
166
+ if (old) {
167
+ ctx.log(`deleting the published release ${decl.tag} (${old.id}) and its tag`);
168
+ await repo.deleteRelease(old.id);
169
+ }
170
+ // A tag that is there stays where it is when a release is published on it, so it goes, and the publish makes it at the release's commit.
171
+ await repo.deleteRef(`tags/${decl.tag}`);
172
+ const makeLatest = String(decl.latest ?? false);
173
+ ctx.log(`publishing the draft as ${decl.tag} with make_latest ${makeLatest}`);
174
+ const res = await repo.publishDraft(id, makeLatest);
175
+ if (res.status !== 200)
176
+ repo.fail(`publishing the draft release ${decl.tag}`, res);
177
+ return { target: target.name, destination: target.destination, items };
178
+ },
179
+ };
180
+ return target;
181
+ }
@@ -31,15 +31,42 @@
31
31
  * all the same, and readers report whether the signature verifies. With
32
32
  * `ci.green.signedSince` declared, a green tag counts only with a valid
33
33
  * statement (`../workspace/ci-green.ts`), so a hand-pushed tag cuts nothing.
34
+ *
35
+ * A lane (#4692): a cut given a lane `ci.green.lanes` declares checks that
36
+ * lane's tags, `ci/green-<lane>/<sha>` and `ci/revoked-<lane>/<sha>`, in place
37
+ * of `ci/green/<sha>` and `ci/revoked/<sha>`, and the cut line names the lane.
38
+ *
39
+ * An override (#4693): a commit with no green tag that counts is cut when the
40
+ * cut asks for it (`overrideGreen`) and a person's override of it stands on
41
+ * the override ledger, `_gates/policy-override.jsonl` (`../override-gate.ts`).
42
+ * The subject is `release-<sha12>`, the plan the commit, and the rule
43
+ * `ci-green` (or `ci-green-<lane>`). It counts when a person the overriders
44
+ * file at base lists wrote it with a reason, sealed under a `release` gate in
45
+ * `identity.gates`. The cut spends it and records it on the cut line. With no
46
+ * override that counts, a cut (not a dry run) records the request for one,
47
+ * which `chant approve policy-override` answers. A revoked commit is never
48
+ * cut, override or not.
34
49
  */
35
- import { type Release, type ReleaseCut, type ReleaseTarget } from "./release-store.js";
50
+ import { type Release, type ReleaseCut, type ReleaseCutOverride, type ReleaseTarget } from "./release-store.js";
36
51
  import type { CompiledTarget, TargetCompiler } from "../components/release-compile.js";
52
+ /** The first chant that cuts from a lane's green tag and writes `lane` on the cut line (#4692). */
53
+ export declare const RELEASE_CUT_LANE_FLOOR = "0.124.64";
54
+ /** The first chant that cuts a commit that is not green under an override and writes `override` on the cut line (#4693). */
55
+ export declare const RELEASE_CUT_OVERRIDE_FLOOR = "0.124.64";
56
+ /** The override gate's subject for a cut of `commit` (#4693): `release-<sha12>`. */
57
+ export declare function greenOverrideSubject(commit: string): string;
58
+ /** The rule an override of a cut names (#4693): `ci-green`, or `ci-green-<lane>` for a lane's tag. */
59
+ export declare function greenOverrideRule(lane: string | null): string;
37
60
  /** The stable codes a cut refuses with. */
38
61
  export type ReleaseCutCode = "not-a-git-repository" | "release-commit-not-green" | "release-commit-revoked" | "release-worktree-dirty" | "release-no-environments" | "release-no-components" | "release-build-inputs-differ" | "release-unsigned" | "release-signer-refused" | "declaration-invalid";
39
62
  export declare class ReleaseCutError extends Error {
40
63
  readonly code: ReleaseCutCode;
41
64
  readonly fix?: string | undefined;
42
- constructor(code: ReleaseCutCode, message: string, fix?: string | undefined);
65
+ /** The cut recorded a request for an override on `chant/lifecycle` (#4693), which the caller pushes. */
66
+ readonly recorded: boolean;
67
+ constructor(code: ReleaseCutCode, message: string, fix?: string | undefined,
68
+ /** The cut recorded a request for an override on `chant/lifecycle` (#4693), which the caller pushes. */
69
+ recorded?: boolean);
43
70
  }
44
71
  export interface CutRequest {
45
72
  /** The member's directory. */
@@ -68,6 +95,19 @@ export interface CutRequest {
68
95
  };
69
96
  /** The publish channel recorded on the cut (#4168 4.3), in place of `latest`. */
70
97
  channel?: string;
98
+ /**
99
+ * The green lane to check (#4692), one `ci.green.lanes` declares at base:
100
+ * the commit must carry `ci/green-<lane>/<sha>` and no
101
+ * `ci/revoked-<lane>/<sha>`. Recorded on the cut. Absent, the full
102
+ * `ci/green/<sha>` tag is checked.
103
+ */
104
+ lane?: string;
105
+ /**
106
+ * Cut the commit when it has no green tag that counts, under a person's
107
+ * override of it (#4693). Without an override that counts the cut is
108
+ * refused, and a cut that is not a dry run records the request for one.
109
+ */
110
+ overrideGreen?: boolean;
71
111
  }
72
112
  export interface CutResult {
73
113
  release: Release;
@@ -88,9 +128,9 @@ export interface CutResult {
88
128
  * and the tags on it that were ignored for want of a valid statement
89
129
  * (#4031). The tags are judged by `green`, the declaration's `ci.green` at
90
130
  * base, with the runner keys read at its branch's tip; with no `ci.green`,
91
- * every tag counts.
131
+ * every tag counts. With `lane` (#4692), that lane's tags are read.
92
132
  */
93
- export declare function greenState(top: string, sha: string, green?: import("../workspace/declaration.js").CiGreen | null): Promise<{
133
+ export declare function greenState(top: string, sha: string, green?: import("../workspace/declaration.js").CiGreen | null, lane?: string): Promise<{
94
134
  state: "green" | "revoked" | "none";
95
135
  ignored: Array<{
96
136
  tag: string;
@@ -138,6 +178,10 @@ export interface CutPlan {
138
178
  }>;
139
179
  /** Whether the release gate in identity.gates requires a signed cut. */
140
180
  signatureRequired: boolean;
181
+ /** The green lane the commit was checked in (#4692), or null for the full green tag. */
182
+ lane: string | null;
183
+ /** The override the cut would run under and spend (#4693), when the commit is not green; null when it is. */
184
+ override: ReleaseCutOverride | null;
141
185
  }
142
186
  /**
143
187
  * The dry run of {@link cutRelease} (#4027): the same checks and compile,
@@ -153,7 +197,9 @@ export declare function planRelease(req: CutRequest): Promise<CutPlan>;
153
197
  * push. Throws {@link ReleaseCutError} before anything is written when the
154
198
  * commit isn't green, the tree is dirty, or an environment can't be compiled
155
199
  * to the same artifacts, and `ReleaseLabelError` (./release-store.ts) when the
156
- * label is taken or the release already carries another one.
200
+ * label is taken or the release already carries another one. The one write
201
+ * before a refusal is the request for an override (#4693), when the cut asks
202
+ * for one and none stands; the error's `recorded` says so.
157
203
  *
158
204
  * The cut line names its run (#4027): the CI run's id and origin in CI, and
159
205
  * outside CI an id minted from the cut's time, `local-<epoch ms>`, with the
@@ -1 +1 @@
1
- {"version":3,"file":"release-cut.d.ts","sourceRoot":"","sources":["../../src/lifecycle/release-cut.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AASH,OAAO,EAUL,KAAK,OAAO,EAEZ,KAAK,UAAU,EACf,KAAK,aAAa,EAGnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAEpF,2CAA2C;AAC3C,MAAM,MAAM,cAAc,GACtB,sBAAsB,GACtB,0BAA0B,GAC1B,wBAAwB,GACxB,wBAAwB,GACxB,yBAAyB,GACzB,uBAAuB,GACvB,6BAA6B,GAC7B,kBAAkB,GAClB,wBAAwB,GACxB,qBAAqB,CAAC;AAE1B,qBAAa,eAAgB,SAAQ,KAAK;IAEtC,QAAQ,CAAC,IAAI,EAAE,cAAc;IAE7B,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM;IAHvB,YACW,IAAI,EAAE,cAAc,EAC7B,OAAO,EAAE,MAAM,EACN,GAAG,CAAC,EAAE,MAAM,YAAA,EAItB;CACF;AAED,MAAM,WAAW,UAAU;IACzB,8BAA8B;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,cAAc,CAAC;IACzB,6CAA6C;IAC7C,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,iGAAiG;IACjG,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;IACjB,uDAAuD;IACvD,GAAG,CAAC,EAAE,MAAM,C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iBAAiB,EAAE,OAAO,CAAC;IAC3B,wFAAwF;IACxF,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,6GAA6G;IAC7G,QAAQ,EAAE,kBAAkB,GAAG,IAAI,CAAC;CACrC;AAED;;;;;;GAMG;AACH,wBAAsB,WAAW,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CA8DnE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,UAAU,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,CAwEpE"}
@@ -31,6 +31,21 @@
31
31
  * all the same, and readers report whether the signature verifies. With
32
32
  * `ci.green.signedSince` declared, a green tag counts only with a valid
33
33
  * statement (`../workspace/ci-green.ts`), so a hand-pushed tag cuts nothing.
34
+ *
35
+ * A lane (#4692): a cut given a lane `ci.green.lanes` declares checks that
36
+ * lane's tags, `ci/green-<lane>/<sha>` and `ci/revoked-<lane>/<sha>`, in place
37
+ * of `ci/green/<sha>` and `ci/revoked/<sha>`, and the cut line names the lane.
38
+ *
39
+ * An override (#4693): a commit with no green tag that counts is cut when the
40
+ * cut asks for it (`overrideGreen`) and a person's override of it stands on
41
+ * the override ledger, `_gates/policy-override.jsonl` (`../override-gate.ts`).
42
+ * The subject is `release-<sha12>`, the plan the commit, and the rule
43
+ * `ci-green` (or `ci-green-<lane>`). It counts when a person the overriders
44
+ * file at base lists wrote it with a reason, sealed under a `release` gate in
45
+ * `identity.gates`. The cut spends it and records it on the cut line. With no
46
+ * override that counts, a cut (not a dry run) records the request for one,
47
+ * which `chant approve policy-override` answers. A revoked commit is never
48
+ * cut, override or not.
34
49
  */
35
50
  import { execFileSync } from "node:child_process";
36
51
  import { realpathSync } from "node:fs";
@@ -40,11 +55,29 @@ import { getHeadCommit } from "./git.js";
40
55
  import { resolveMemberLedger } from "./member-ledger.js";
41
56
  import { resolveCiRun } from "./release-ledger.js";
42
57
  import { appendCut, invalidLabel, labelsByDigest, makeRelease, persistRelease, readAllReleases, readCuts, readRelease, ReleaseLabelError, templateBytesDigest, } from "./release-store.js";
58
+ import { NEXT_RELEASE } from "../release-floors.js";
59
+ /** The first chant that cuts from a lane's green tag and writes `lane` on the cut line (#4692). */
60
+ export const RELEASE_CUT_LANE_FLOOR = NEXT_RELEASE;
61
+ /** The first chant that cuts a commit that is not green under an override and writes `override` on the cut line (#4693). */
62
+ export const RELEASE_CUT_OVERRIDE_FLOOR = NEXT_RELEASE;
63
+ /** The override gate's subject for a cut of `commit` (#4693): `release-<sha12>`. */
64
+ export function greenOverrideSubject(commit) {
65
+ return `release-${commit.slice(0, 12)}`;
66
+ }
67
+ /** The rule an override of a cut names (#4693): `ci-green`, or `ci-green-<lane>` for a lane's tag. */
68
+ export function greenOverrideRule(lane) {
69
+ return lane !== null ? `ci-green-${lane}` : "ci-green";
70
+ }
71
+ /** How long a recorded request for an override stands before a cut records a fresh one. */
72
+ const OVERRIDE_REQUEST_HOURS = 48;
43
73
  export class ReleaseCutError extends Error {
44
- constructor(code, message, fix) {
74
+ constructor(code, message, fix,
75
+ /** The cut recorded a request for an override on `chant/lifecycle` (#4693), which the caller pushes. */
76
+ recorded = false) {
45
77
  super(message);
46
78
  this.code = code;
47
79
  this.fix = fix;
80
+ this.recorded = recorded;
48
81
  this.name = "ReleaseCutError";
49
82
  }
50
83
  }
@@ -64,13 +97,13 @@ function tryGit(top, args) {
64
97
  * and the tags on it that were ignored for want of a valid statement
65
98
  * (#4031). The tags are judged by `green`, the declaration's `ci.green` at
66
99
  * base, with the runner keys read at its branch's tip; with no `ci.green`,
67
- * every tag counts.
100
+ * every tag counts. With `lane` (#4692), that lane's tags are read.
68
101
  */
69
- export async function greenState(top, sha, green = null) {
102
+ export async function greenState(top, sha, green = null, lane) {
70
103
  const { judgedCiTags } = await import("./release-revocation.js");
71
104
  let tags;
72
105
  try {
73
- tags = await judgedCiTags(top, green);
106
+ tags = await judgedCiTags(top, green, lane);
74
107
  }
75
108
  catch (err) {
76
109
  const { WorkspaceReadError } = await import("../workspace/declaration.js");
@@ -116,13 +149,96 @@ async function previousRelease(top, commit, cwd) {
116
149
  .sort((a, b) => b.depth - a.depth || (b.at < a.at ? -1 : b.at > a.at ? 1 : 0));
117
150
  return candidates[0]?.r;
118
151
  }
152
+ /**
153
+ * Decide the override of a cut of `commit`, which has no green tag that
154
+ * counts (#4693), as `decideOverride` decides any: against the overriders
155
+ * file and, when `sealed`, the signers at base. With none that counts and
156
+ * `record`, the request for one is appended unless one stands.
157
+ */
158
+ async function greenOverride(req) {
159
+ const og = await import("../override-gate.js");
160
+ const { readOverrideLedger, recordOverrideDenial } = await import("./override-ledger.js");
161
+ const { resolveBase } = await import("../workspace/trust/provenance.js");
162
+ const subject = greenOverrideSubject(req.commit);
163
+ const rules = [greenOverrideRule(req.lane)];
164
+ const base = resolveBase(req.top).commit;
165
+ const overriders = base ? og.overridersAt(req.top, base) : null;
166
+ const signers = req.sealed && base ? (await import("../gate-decision.js")).gateSignersAt(req.top, base) : undefined;
167
+ const ledger = await readOverrideLedger({ cwd: req.cwd });
168
+ const verdict = og.decideOverride({
169
+ ledger,
170
+ applied: ledger.applied,
171
+ subject,
172
+ planDigest: req.commit,
173
+ rules,
174
+ overriders: overriders?.principals ?? [],
175
+ mode: req.sealed ? "sealed" : "ledger",
176
+ ...(signers ? { signers } : {}),
177
+ now: req.now,
178
+ });
179
+ if (verdict.status === "overridden") {
180
+ const o = verdict.override;
181
+ return { override: { by: o.by, at: o.at, reason: o.reason, digest: o.digest, sealed: o.sealed } };
182
+ }
183
+ let recorded = false;
184
+ if (req.record && !verdict.standing) {
185
+ await recordOverrideDenial({
186
+ subject,
187
+ planDigest: req.commit,
188
+ rules,
189
+ timestamp: req.now,
190
+ expiresAt: new Date(Date.parse(req.now) + OVERRIDE_REQUEST_HOURS * 3600000).toISOString(),
191
+ description: `release cut of commit ${req.commit.slice(0, 12)}, which has no ${req.lane !== null ? `ci/green-${req.lane}` : "ci/green"} tag that counts`,
192
+ }, { cwd: req.cwd });
193
+ recorded = true;
194
+ }
195
+ const notes = [
196
+ ...verdict.refusals.map((r) => `an override does not count: ${r}`),
197
+ ...(verdict.status === "moved" ? [`${verdict.by} overrode another commit or rule (${verdict.was ?? "no digest"}), which counts for nothing here`] : []),
198
+ recorded
199
+ ? `the request for an override of ${subject} is recorded on chant/lifecycle`
200
+ : verdict.standing
201
+ ? `the request for an override of ${subject} has stood since ${verdict.standing.timestamp}`
202
+ : `a cut with --yes records the request for an override of ${subject}`,
203
+ ];
204
+ const who = !overriders?.active
205
+ ? `${og.OVERRIDERS_PATH} at base does not exist, so nobody may override it yet. Once it lists a person, they may`
206
+ : overriders.principals.length > 0
207
+ ? `${overriders.principals.join(", ")} may`
208
+ : `${og.OVERRIDERS_PATH} at base lists nobody, so nobody may`;
209
+ return {
210
+ override: null,
211
+ why: notes.join("; "),
212
+ fix: `${who} override it with: ${og.overrideCommand(subject, rules, req.sealed)}, and then cut again with --override-green.`,
213
+ recorded,
214
+ };
215
+ }
216
+ /**
217
+ * The lane `name` as the declaration at base declares it (#4692), or a
218
+ * `declaration-invalid` refusal when there is no `ci.green` or it declares
219
+ * no such lane.
220
+ */
221
+ async function declaredLane(green, name) {
222
+ if (!green) {
223
+ throw new ReleaseCutError("declaration-invalid", `the cut asks for lane ${JSON.stringify(name)}, and chant.workspace.json at base declares no ci.green, so it has no lanes`);
224
+ }
225
+ const { laneOf, WorkspaceReadError } = await import("../workspace/declaration.js");
226
+ try {
227
+ return laneOf(green, name).name;
228
+ }
229
+ catch (err) {
230
+ if (err instanceof WorkspaceReadError)
231
+ throw new ReleaseCutError("declaration-invalid", err.message);
232
+ throw err;
233
+ }
234
+ }
119
235
  /**
120
236
  * The checks and the compile a cut makes before it builds or writes: the
121
237
  * commit is green and not revoked, the cut is signed when the release gate
122
238
  * asks, the tree is clean, every environment compiles with the same build
123
239
  * steps, and which artifacts are carried from an earlier release.
124
240
  */
125
- async function prepare(req) {
241
+ async function prepare(req, record = false) {
126
242
  const cwd = resolve(req.cwd);
127
243
  const top = tryGit(cwd, ["rev-parse", "--show-toplevel"]);
128
244
  if (!top)
@@ -132,17 +248,35 @@ async function prepare(req) {
132
248
  const { scopeSource } = await import("../workspace/write-scope.js");
133
249
  const { releaseRuleFrom } = await import("../workspace/identity.js");
134
250
  const source = scopeSource(cwd);
135
- const { state, ignored } = await greenState(top, commit, source.declaration?.ci?.green ?? null);
251
+ const green = source.declaration?.ci?.green ?? null;
252
+ const lane = req.lane !== undefined ? await declaredLane(green, req.lane) : null;
253
+ const { state, ignored } = await greenState(top, commit, green, lane ?? undefined);
254
+ // Who may cut is the declaration's identity.gates.release, read at base.
255
+ const releaseRule = releaseRuleFrom(source);
256
+ let override = null;
136
257
  if (state !== "green") {
137
258
  const why = ignored.length > 0 ? `; ignored: ${ignored.map((t) => `${t.tag} (${t.status}): ${t.reason}`).join("; ")}` : "";
138
- throw new ReleaseCutError(state === "revoked" ? "release-commit-revoked" : "release-commit-not-green", state === "revoked"
139
- ? `commit ${commit.slice(0, 12)} has a ci/revoked tag: it went red after it was green, so no release is cut from it`
140
- : ignored.some((t) => t.tag.startsWith("ci/green/"))
141
- ? `commit ${commit.slice(0, 12)} has no ci/green tag that counts, so no release is cut from it${why}`
142
- : `commit ${commit.slice(0, 12)} has no ci/green tag, so no release is cut from it`, "Check out a green commit (`chant ci last-green` names the newest) after fetching the tags: git fetch origin --tags");
259
+ // #4692: a lane's tags are ci/green-<lane>/ and ci/revoked-<lane>/.
260
+ const greenTag = lane !== null ? `ci/green-${lane}` : "ci/green";
261
+ const revokedTag = lane !== null ? `ci/revoked-${lane}` : "ci/revoked";
262
+ const message = state === "revoked"
263
+ ? `commit ${commit.slice(0, 12)} has a ${revokedTag} tag: it went red after it was green, so no release is cut from it`
264
+ : ignored.some((t) => t.tag.startsWith(`${greenTag}/`))
265
+ ? `commit ${commit.slice(0, 12)} has no ${greenTag} tag that counts, so no release is cut from it${why}`
266
+ : `commit ${commit.slice(0, 12)} has no ${greenTag} tag, so no release is cut from it`;
267
+ const fix = `Check out a green commit (\`chant ci last-green${lane !== null ? ` --lane ${lane}` : ""}\` names the newest) after fetching the tags: git fetch origin --tags`;
268
+ if (state === "revoked") {
269
+ throw new ReleaseCutError("release-commit-revoked", req.overrideGreen ? `${message}, and an override does not cut a revoked commit` : message, fix);
270
+ }
271
+ if (!req.overrideGreen)
272
+ throw new ReleaseCutError("release-commit-not-green", message, fix);
273
+ // #4693: a person's override of this commit lets it through.
274
+ const now = (req.now ?? (() => new Date()))().toISOString();
275
+ const decided = await greenOverride({ top, cwd, commit, lane, sealed: releaseRule.requirement !== null, record, now });
276
+ if (decided.override === null)
277
+ throw new ReleaseCutError("release-commit-not-green", `${message}; ${decided.why}`, decided.fix, decided.recorded);
278
+ override = { green: false, tag: `${greenTag}/${commit}`, ...decided.override };
143
279
  }
144
- // Who may cut is the declaration's identity.gates.release, read at base.
145
- const releaseRule = releaseRuleFrom(source);
146
280
  if (releaseRule.requirement && req.sign === undefined) {
147
281
  throw new ReleaseCutError("release-unsigned", `chant.workspace.json at base names a release gate in identity.gates${releaseRule.requirement.class !== null ? `, from the class ${releaseRule.requirement.class}` : ""}, and this cut is not signed`, `chant release cut <label> --actor <principal> --sign [<key file>], with a key ${releaseRule.rule.signers.signersPath} at base lists for that principal.`);
148
282
  }
@@ -210,6 +344,8 @@ async function prepare(req) {
210
344
  carried: artifacts,
211
345
  reused,
212
346
  member: ledger.members.length > 0 ? ledger.members.join("/") : null,
347
+ lane,
348
+ override,
213
349
  };
214
350
  }
215
351
  /**
@@ -302,6 +438,8 @@ export async function planRelease(req) {
302
438
  reused: p.reused,
303
439
  publishSteps: [...steps.values()],
304
440
  signatureRequired: p.releaseRule.requirement !== null,
441
+ lane: p.lane,
442
+ override: p.override,
305
443
  };
306
444
  }
307
445
  /**
@@ -310,14 +448,16 @@ export async function planRelease(req) {
310
448
  * push. Throws {@link ReleaseCutError} before anything is written when the
311
449
  * commit isn't green, the tree is dirty, or an environment can't be compiled
312
450
  * to the same artifacts, and `ReleaseLabelError` (./release-store.ts) when the
313
- * label is taken or the release already carries another one.
451
+ * label is taken or the release already carries another one. The one write
452
+ * before a refusal is the request for an override (#4693), when the cut asks
453
+ * for one and none stands; the error's `recorded` says so.
314
454
  *
315
455
  * The cut line names its run (#4027): the CI run's id and origin in CI, and
316
456
  * outside CI an id minted from the cut's time, `local-<epoch ms>`, with the
317
457
  * origin `{ forge: "local" }`.
318
458
  */
319
459
  export async function cutRelease(req) {
320
- const p = await prepare(req);
460
+ const p = await prepare(req, true);
321
461
  const { cwd, commit, compiled, releaseRule, reused } = p;
322
462
  const artifacts = [...p.carried];
323
463
  for (const env of p.envs) {
@@ -358,16 +498,25 @@ export async function cutRelease(req) {
358
498
  }
359
499
  const stored = await persistRelease(release, templates, { cwd });
360
500
  const ci = resolveCiRun(req.env ?? process.env);
501
+ const runId = ci?.runId ?? `local-${Date.parse(timestamp)}`;
502
+ // #4693: the override is spent before the cut line names it, so it lets one cut through.
503
+ if (p.override) {
504
+ const { appliedOverride } = await import("../override-gate.js");
505
+ const { recordOverridesApplied } = await import("./override-ledger.js");
506
+ await recordOverridesApplied([appliedOverride({ subject: greenOverrideSubject(commit), digest: p.override.digest, at: p.override.at, by: p.override.by }, { timestamp, runId, commit })], { cwd });
507
+ }
361
508
  const outcome = await appendCut({
362
509
  releaseDigest: release.releaseDigest,
363
510
  label: req.label,
364
511
  actor: req.actor,
365
512
  timestamp,
366
- runId: ci?.runId ?? `local-${Date.parse(timestamp)}`,
513
+ runId,
367
514
  runOrigin: ci?.runOrigin ?? { forge: "local" },
368
515
  signature,
369
516
  ...(req.composed ? { composed: req.composed } : {}),
370
517
  ...(req.channel ? { channel: req.channel } : {}),
518
+ ...(p.lane !== null ? { lane: p.lane } : {}),
519
+ ...(p.override ? { override: p.override } : {}),
371
520
  }, { cwd });
372
521
  return {
373
522
  release,
@@ -67,6 +67,8 @@ export interface PublishItem {
67
67
  digest?: string;
68
68
  /** True when the destination already held it, so nothing was uploaded. */
69
69
  present?: boolean;
70
+ /** True when the destination refused it and the target turns a refusal into a warning (a marketplace's `onRefusal: "warn"`, #4698), so it was not published. */
71
+ refused?: boolean;
70
72
  /** Set on a file attached to what the target publishes (#4049): an SBOM or the release's provenance statement. */
71
73
  attachment?: "sbom" | "provenance";
72
74
  /** The SBOM file an npm package carries at its root (#4049). */
@@ -101,13 +103,26 @@ export interface PublishedTarget {
101
103
  destination: string;
102
104
  /** Each thing published, in order. */
103
105
  items: PublishItem[];
106
+ /**
107
+ * Set when the destination refused the reveal and the target declares that
108
+ * a warning (#4698): why, with the items `refused`. The publish goes on, and
109
+ * the target is not recorded as revealed, so the same publish run again
110
+ * reveals it again.
111
+ */
112
+ warning?: string;
104
113
  }
105
114
  /** Injected into the targets, so tests drive them with fakes. */
106
115
  export interface PublishDeps {
107
- /** The HTTP client the OCI and forge targets use. Default: the global `fetch`. */
116
+ /** The HTTP client the OCI, forge, homebrew, marketplace and tauri-updater targets use. Default: the global `fetch`. */
108
117
  fetch?: PublishFetch;
109
118
  /** The npm executable. Default: `npm` on `PATH`. */
110
119
  npm?: string;
120
+ /** The vsce executable the VS Code Marketplace target runs (#4676). Default: `vsce` on `PATH`. */
121
+ vsce?: string;
122
+ /** The git executable the homebrew target runs to push over SSH (#4699). Default: `git` on `PATH`. */
123
+ git?: string;
124
+ /** The ssh executable git runs for it (#4699). Default: `ssh` on `PATH`. */
125
+ ssh?: string;
111
126
  /** How a target waits between polls of a registry (#4244). Default: a timer. */
112
127
  sleep?: (ms: number) => Promise<void>;
113
128
  /** The clock a target's wait reads (#4244). Default: `Date.now`. */
@@ -126,6 +141,7 @@ export type PublishFetch = (url: string, init: {
126
141
  get(name: string): string | null;
127
142
  };
128
143
  text(): Promise<string>;
144
+ arrayBuffer?(): Promise<ArrayBuffer>;
129
145
  }>;
130
146
  /**
131
147
  * The part of a target's context every kind of target is given, whatever it
@@ -178,7 +194,7 @@ export declare class PublishTargetError extends Error {
178
194
  constructor(code: string, message: string, fix?: string | undefined);
179
195
  }
180
196
  /** The kinds `release.publish` declares and `createPublishTargets` makes. */
181
- export type ReleasePublishKind = "npm" | "oci" | "forge";
197
+ export type ReleasePublishKind = "npm" | "oci" | "forge" | "homebrew" | "marketplace" | "tauri-updater";
182
198
  /** The npm dist-tag a set of packages is staged under before `latest` moves (#4048), as chant's own releases do (#3903). */
183
199
  export declare const NPM_STAGE_TAG = "next";
184
200
  /**