@intentius/chant 0.124.62 → 0.124.63

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 (229) hide show
  1. package/dist/cli/handlers/approve.d.ts +18 -0
  2. package/dist/cli/handlers/approve.d.ts.map +1 -1
  3. package/dist/cli/handlers/approve.js +142 -16
  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/release.d.ts +6 -4
  8. package/dist/cli/handlers/release.d.ts.map +1 -1
  9. package/dist/cli/handlers/release.js +13 -7
  10. package/dist/cli/main.d.ts.map +1 -1
  11. package/dist/cli/main.js +34 -5
  12. package/dist/cli/mcp/workspace-tools.d.ts.map +1 -1
  13. package/dist/cli/mcp/workspace-tools.js +2 -1
  14. package/dist/cli/parse-args.d.ts.map +1 -1
  15. package/dist/cli/parse-args.js +31 -0
  16. package/dist/cli/registry.d.ts +13 -1
  17. package/dist/cli/registry.d.ts.map +1 -1
  18. package/dist/config.d.ts +32 -0
  19. package/dist/config.d.ts.map +1 -1
  20. package/dist/gate-decision.d.ts +1 -1
  21. package/dist/gate-decision.d.ts.map +1 -1
  22. package/dist/gate-decision.js +4 -2
  23. package/dist/gate-statement.schema.json +44 -0
  24. package/dist/lifecycle/__fixtures__/publish-fakes.d.ts +20 -0
  25. package/dist/lifecycle/__fixtures__/publish-fakes.d.ts.map +1 -1
  26. package/dist/lifecycle/__fixtures__/publish-fakes.js +119 -3
  27. package/dist/lifecycle/gate-ledger.d.ts +17 -3
  28. package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
  29. package/dist/lifecycle/gate-seal.d.ts +39 -3
  30. package/dist/lifecycle/gate-seal.d.ts.map +1 -1
  31. package/dist/lifecycle/gate-seal.js +50 -10
  32. package/dist/lifecycle/gate-statement.d.ts +70 -0
  33. package/dist/lifecycle/gate-statement.d.ts.map +1 -0
  34. package/dist/lifecycle/gate-statement.js +74 -0
  35. package/dist/lifecycle/gate-webauthn.d.ts +79 -0
  36. package/dist/lifecycle/gate-webauthn.d.ts.map +1 -0
  37. package/dist/lifecycle/gate-webauthn.js +105 -0
  38. package/dist/lifecycle/git.d.ts +1 -1
  39. package/dist/lifecycle/git.d.ts.map +1 -1
  40. package/dist/lifecycle/git.js +24 -19
  41. package/dist/lifecycle/ledger-remote.d.ts +37 -0
  42. package/dist/lifecycle/ledger-remote.d.ts.map +1 -0
  43. package/dist/lifecycle/ledger-remote.js +42 -0
  44. package/dist/lifecycle/plan-stale.d.ts +76 -0
  45. package/dist/lifecycle/plan-stale.d.ts.map +1 -0
  46. package/dist/lifecycle/plan-stale.js +121 -0
  47. package/dist/lifecycle/publish-credentials.d.ts +1 -1
  48. package/dist/lifecycle/publish-credentials.d.ts.map +1 -1
  49. package/dist/lifecycle/publish-credentials.js +2 -0
  50. package/dist/lifecycle/publish-declaration.d.ts +87 -0
  51. package/dist/lifecycle/publish-declaration.d.ts.map +1 -1
  52. package/dist/lifecycle/publish-declaration.js +87 -1
  53. package/dist/lifecycle/publish-forge.d.ts +5 -1
  54. package/dist/lifecycle/publish-forge.d.ts.map +1 -1
  55. package/dist/lifecycle/publish-forge.js +14 -4
  56. package/dist/lifecycle/publish-github.d.ts +69 -0
  57. package/dist/lifecycle/publish-github.d.ts.map +1 -0
  58. package/dist/lifecycle/publish-github.js +153 -0
  59. package/dist/lifecycle/publish-homebrew.d.ts +66 -0
  60. package/dist/lifecycle/publish-homebrew.d.ts.map +1 -0
  61. package/dist/lifecycle/publish-homebrew.js +173 -0
  62. package/dist/lifecycle/publish-marketplace.d.ts +51 -0
  63. package/dist/lifecycle/publish-marketplace.d.ts.map +1 -0
  64. package/dist/lifecycle/publish-marketplace.js +254 -0
  65. package/dist/lifecycle/publish-targets.d.ts +6 -0
  66. package/dist/lifecycle/publish-targets.d.ts.map +1 -1
  67. package/dist/lifecycle/publish-targets.js +15 -0
  68. package/dist/lifecycle/publish-tauri.d.ts +61 -0
  69. package/dist/lifecycle/publish-tauri.d.ts.map +1 -0
  70. package/dist/lifecycle/publish-tauri.js +182 -0
  71. package/dist/lifecycle/release-publish.d.ts +5 -2
  72. package/dist/lifecycle/release-publish.d.ts.map +1 -1
  73. package/dist/lifecycle/snapshot-store.d.ts.map +1 -1
  74. package/dist/lifecycle/snapshot-store.js +17 -9
  75. package/dist/lifecycle/test-passkey.d.ts +25 -0
  76. package/dist/lifecycle/test-passkey.d.ts.map +1 -0
  77. package/dist/lifecycle/test-passkey.js +39 -0
  78. package/dist/notify.d.ts +23 -3
  79. package/dist/notify.d.ts.map +1 -1
  80. package/dist/notify.js +8 -2
  81. package/dist/notify.schema.json +12 -3
  82. package/dist/op/activities/activity-contracts.d.ts +4 -4
  83. package/dist/pr-forge.d.ts +20 -0
  84. package/dist/pr-forge.d.ts.map +1 -1
  85. package/dist/pr-forge.js +61 -2
  86. package/dist/release-floors.d.ts +1 -1
  87. package/dist/release-floors.js +1 -1
  88. package/dist/wave-runtime.mjs +331 -330
  89. package/dist/workspace/ci-builds.d.ts +21 -0
  90. package/dist/workspace/ci-builds.d.ts.map +1 -1
  91. package/dist/workspace/ci-builds.js +14 -0
  92. package/dist/workspace/ci-green.d.ts +45 -2
  93. package/dist/workspace/ci-green.d.ts.map +1 -1
  94. package/dist/workspace/ci-green.js +124 -5
  95. package/dist/workspace/ci-quarantine-report.d.ts +80 -0
  96. package/dist/workspace/ci-quarantine-report.d.ts.map +1 -0
  97. package/dist/workspace/ci-quarantine-report.js +205 -0
  98. package/dist/workspace/ci-quarantine.d.ts +73 -0
  99. package/dist/workspace/ci-quarantine.d.ts.map +1 -0
  100. package/dist/workspace/ci-quarantine.js +171 -0
  101. package/dist/workspace/ci-serve.d.ts.map +1 -1
  102. package/dist/workspace/ci-serve.js +7 -4
  103. package/dist/workspace/class-data.d.ts +3 -1
  104. package/dist/workspace/class-data.d.ts.map +1 -1
  105. package/dist/workspace/class-data.js +4 -1
  106. package/dist/workspace/declaration.d.ts +45 -2
  107. package/dist/workspace/declaration.d.ts.map +1 -1
  108. package/dist/workspace/declaration.js +45 -2
  109. package/dist/workspace/declaration.schema.json +51 -3
  110. package/dist/workspace/forge-work.d.ts +76 -0
  111. package/dist/workspace/forge-work.d.ts.map +1 -0
  112. package/dist/workspace/forge-work.js +160 -0
  113. package/dist/workspace/identity-gate-rule.d.ts +3 -2
  114. package/dist/workspace/identity-gate-rule.d.ts.map +1 -1
  115. package/dist/workspace/identity-gate-rule.js +5 -7
  116. package/dist/workspace/identity.d.ts +3 -2
  117. package/dist/workspace/identity.d.ts.map +1 -1
  118. package/dist/workspace/identity.js +6 -3
  119. package/dist/workspace/intent-cli.d.ts +3 -2
  120. package/dist/workspace/intent-cli.d.ts.map +1 -1
  121. package/dist/workspace/intent-cli.js +26 -5
  122. package/dist/workspace/intent-record.d.ts +3 -0
  123. package/dist/workspace/intent-record.d.ts.map +1 -1
  124. package/dist/workspace/intent-record.schema.json +32 -0
  125. package/dist/workspace/intent.d.ts +9 -0
  126. package/dist/workspace/intent.d.ts.map +1 -1
  127. package/dist/workspace/intent.js +3 -0
  128. package/dist/workspace/intent.schema.json +32 -0
  129. package/dist/workspace/kind-readers.d.ts.map +1 -1
  130. package/dist/workspace/kind-readers.js +2 -1
  131. package/dist/workspace/kinds.d.ts +6 -1
  132. package/dist/workspace/kinds.d.ts.map +1 -1
  133. package/dist/workspace/kinds.js +8 -3
  134. package/dist/workspace/plan-stale.schema.json +286 -0
  135. package/dist/workspace/release-candidates.d.ts +33 -6
  136. package/dist/workspace/release-candidates.d.ts.map +1 -1
  137. package/dist/workspace/release-candidates.js +49 -20
  138. package/dist/workspace/release-candidates.schema.json +48 -2
  139. package/dist/workspace/trust/policy.d.ts +10 -0
  140. package/dist/workspace/trust/policy.d.ts.map +1 -1
  141. package/dist/workspace/trust/policy.js +19 -1
  142. package/dist/workspace/trust/run-commits.d.ts.map +1 -1
  143. package/dist/workspace/trust/run-commits.js +2 -1
  144. package/dist/workspace/trust/seal.d.ts.map +1 -1
  145. package/dist/workspace/trust/seal.js +34 -3
  146. package/dist/workspace/trust/trust-files.d.ts.map +1 -1
  147. package/dist/workspace/trust/trust-files.js +6 -1
  148. package/package.json +2 -1
  149. package/src/cli/handlers/approve-external-signature.test.ts +226 -0
  150. package/src/cli/handlers/approve.ts +174 -16
  151. package/src/cli/handlers/plan.ts +74 -0
  152. package/src/cli/handlers/release.ts +12 -7
  153. package/src/cli/main.ts +34 -5
  154. package/src/cli/mcp/workspace-tools.ts +2 -1
  155. package/src/cli/parse-args.ts +24 -0
  156. package/src/cli/registry.ts +13 -1
  157. package/src/gate-decision-bundle.test.ts +4 -2
  158. package/src/gate-decision.ts +11 -2
  159. package/src/gate-statement.schema.json +44 -0
  160. package/src/lifecycle/__fixtures__/publish-fakes.ts +125 -5
  161. package/src/lifecycle/gate-ledger.ts +17 -3
  162. package/src/lifecycle/gate-seal.ts +62 -9
  163. package/src/lifecycle/gate-statement.ts +107 -0
  164. package/src/lifecycle/gate-webauthn.test.ts +77 -0
  165. package/src/lifecycle/gate-webauthn.ts +133 -0
  166. package/src/lifecycle/git.ts +23 -19
  167. package/src/lifecycle/ledger-remote.test.ts +183 -0
  168. package/src/lifecycle/ledger-remote.ts +46 -0
  169. package/src/lifecycle/plan-stale.test.ts +150 -0
  170. package/src/lifecycle/plan-stale.ts +173 -0
  171. package/src/lifecycle/publish-credentials.ts +2 -0
  172. package/src/lifecycle/publish-declaration.ts +93 -1
  173. package/src/lifecycle/publish-forge.ts +15 -4
  174. package/src/lifecycle/publish-github.ts +174 -0
  175. package/src/lifecycle/publish-homebrew.test.ts +179 -0
  176. package/src/lifecycle/publish-homebrew.ts +187 -0
  177. package/src/lifecycle/publish-marketplace.test.ts +254 -0
  178. package/src/lifecycle/publish-marketplace.ts +259 -0
  179. package/src/lifecycle/publish-target-context.test.ts +2 -2
  180. package/src/lifecycle/publish-targets.test.ts +23 -0
  181. package/src/lifecycle/publish-targets.ts +15 -0
  182. package/src/lifecycle/publish-tauri.test.ts +163 -0
  183. package/src/lifecycle/publish-tauri.ts +199 -0
  184. package/src/lifecycle/release-publish.ts +5 -3
  185. package/src/lifecycle/snapshot-store.ts +16 -9
  186. package/src/lifecycle/test-passkey.ts +55 -0
  187. package/src/notify-bundle.test.ts +3 -1
  188. package/src/notify.schema.json +12 -3
  189. package/src/notify.ts +20 -3
  190. package/src/override-gate-bundle.test.ts +2 -0
  191. package/src/pr-forge-bundle.test.ts +2 -2
  192. package/src/pr-forge.test.ts +38 -0
  193. package/src/pr-forge.ts +68 -5
  194. package/src/release-floors.ts +1 -1
  195. package/src/stage-hooks-bundle.test.ts +2 -0
  196. package/src/wave-runtime-bundle.test.ts +3 -2
  197. package/src/workspace/ci-builds.ts +27 -0
  198. package/src/workspace/ci-green-stale.test.ts +193 -0
  199. package/src/workspace/ci-green.ts +138 -6
  200. package/src/workspace/ci-quarantine-report.test.ts +146 -0
  201. package/src/workspace/ci-quarantine-report.ts +235 -0
  202. package/src/workspace/ci-quarantine.test.ts +161 -0
  203. package/src/workspace/ci-quarantine.ts +189 -0
  204. package/src/workspace/ci-serve.ts +7 -4
  205. package/src/workspace/class-data.ts +5 -1
  206. package/src/workspace/declaration.schema.json +51 -3
  207. package/src/workspace/declaration.test.ts +1 -0
  208. package/src/workspace/declaration.ts +88 -5
  209. package/src/workspace/forge-work.test.ts +143 -0
  210. package/src/workspace/forge-work.ts +195 -0
  211. package/src/workspace/identity-gate-rule.ts +6 -8
  212. package/src/workspace/identity.ts +6 -3
  213. package/src/workspace/intent-cli.ts +24 -5
  214. package/src/workspace/intent-record.schema.json +32 -0
  215. package/src/workspace/intent-record.ts +3 -0
  216. package/src/workspace/intent.schema.json +32 -0
  217. package/src/workspace/intent.ts +10 -0
  218. package/src/workspace/kind-readers.ts +2 -1
  219. package/src/workspace/kinds.test.ts +13 -0
  220. package/src/workspace/kinds.ts +12 -3
  221. package/src/workspace/plan-stale.schema.json +286 -0
  222. package/src/workspace/release-candidates.schema.json +48 -2
  223. package/src/workspace/release-candidates.test.ts +77 -4
  224. package/src/workspace/release-candidates.ts +62 -20
  225. package/src/workspace/trust/policy.ts +24 -1
  226. package/src/workspace/trust/run-commits.ts +2 -1
  227. package/src/workspace/trust/seal.ts +35 -3
  228. package/src/workspace/trust/trust-files.test.ts +5 -0
  229. package/src/workspace/trust/trust-files.ts +15 -1
@@ -0,0 +1,259 @@
1
+ /**
2
+ * The editor marketplace target (#4676): a packaged `.vsix` published to the
3
+ * VS Code Marketplace or to Open VSX.
4
+ *
5
+ * The extension's publisher, name and version are read from the
6
+ * `extension/package.json` inside the `.vsix`, and the file must match the
7
+ * digest the release records for it.
8
+ *
9
+ * A marketplace has no draft: a version is visible as soon as it is
10
+ * uploaded, and a version can't be uploaded twice. So the stage uploads
11
+ * nothing. It checks what it can without changing anything: the file and its
12
+ * digest, the token, and whether the marketplace already has the version.
13
+ * The reveal uploads. A failure of another target's stage therefore leaves
14
+ * nothing on a marketplace, and a marketplace's own failure shows only at the
15
+ * reveal, after the targets before it revealed.
16
+ *
17
+ * - Open VSX, through its REST API: the stage reads
18
+ * `GET {registry}/api/{namespace}` (a missing namespace is refused before
19
+ * anything reveals) and `GET {registry}/api/{namespace}/{name}/{version}`.
20
+ * A version already there is `present` when its download's SHA-256 is the
21
+ * file's, and refused otherwise (`publish-marketplace-version-exists`). The
22
+ * reveal sends the file with `POST {registry}/api/-/publish`, then
23
+ * downloads what Open VSX serves for the version and refuses a digest that
24
+ * differs (`publish-marketplace-digest-mismatch`).
25
+ * - The VS Code Marketplace, through `vsce`: the stage asks the gallery's
26
+ * public `extensionquery` API for the extension's versions, and a version
27
+ * already there is `present`, by version only, since the gallery reports no
28
+ * digest. The reveal runs `vsce publish --packagePath <file>` with the
29
+ * token in `VSCE_PAT`. `vsce` must be on `PATH` (`npm i -g @vscode/vsce`).
30
+ *
31
+ * The token is read from `tokenEnv`, else `VSCE_PAT` or `OVSX_PAT`, the
32
+ * variables `vsce` and `ovsx` read, and is masked in all output.
33
+ */
34
+
35
+ import { spawn } from "node:child_process";
36
+ import { readFileSync } from "node:fs";
37
+ import { inflateRawSync } from "node:zlib";
38
+ import { readCredential, type Credential } from "./publish-credentials";
39
+ import type { MarketplacePublishDeclaration } from "./publish-declaration";
40
+ import { bytesDigest, checkReleaseDigest, memberFile, publishTargetKey } from "./publish-targets";
41
+ import { PublishTargetError, type PublishContext, type PublishDeps, type PublishFetch, type PublishItem, type PublishTarget, type StagedTarget } from "./release-publish";
42
+ import { NEXT_RELEASE } from "../release-floors";
43
+
44
+ /** The first chant that publishes a `marketplace` target (#4676). */
45
+ export const PUBLISH_MARKETPLACE_FLOOR = NEXT_RELEASE;
46
+
47
+ export const OPEN_VSX_REGISTRY = "https://open-vsx.org";
48
+ export const VSCODE_GALLERY = "https://marketplace.visualstudio.com";
49
+
50
+ /** The variables a marketplace's token is read from. */
51
+ export function marketplaceTokenEnv(decl: Pick<MarketplacePublishDeclaration, "marketplace" | "tokenEnv">): string[] {
52
+ return [decl.tokenEnv ?? (decl.marketplace === "vscode" ? "VSCE_PAT" : "OVSX_PAT")];
53
+ }
54
+
55
+ /** One file of a zip archive, or null when it holds none by that name. Reads stored and deflated entries; refuses a zip64 archive. */
56
+ export function readZipEntry(zip: Buffer, name: string): Buffer | null {
57
+ let end = -1;
58
+ for (let i = zip.length - 22; i >= Math.max(0, zip.length - 22 - 0xffff); i--) {
59
+ if (zip.readUInt32LE(i) === 0x06054b50) {
60
+ end = i;
61
+ break;
62
+ }
63
+ }
64
+ if (end < 0) throw new Error("not a zip archive: no end of central directory");
65
+ const count = zip.readUInt16LE(end + 10);
66
+ let at = zip.readUInt32LE(end + 16);
67
+ if (count === 0xffff || at === 0xffffffff) throw new Error("a zip64 archive, which chant does not read");
68
+ for (let i = 0; i < count; i++) {
69
+ if (zip.readUInt32LE(at) !== 0x02014b50) throw new Error("a malformed zip central directory");
70
+ const method = zip.readUInt16LE(at + 10);
71
+ const size = zip.readUInt32LE(at + 20);
72
+ const nameLen = zip.readUInt16LE(at + 28);
73
+ const skip = nameLen + zip.readUInt16LE(at + 30) + zip.readUInt16LE(at + 32);
74
+ const local = zip.readUInt32LE(at + 42);
75
+ if (zip.toString("utf-8", at + 46, at + 46 + nameLen) === name) {
76
+ const data = local + 30 + zip.readUInt16LE(local + 26) + zip.readUInt16LE(local + 28);
77
+ const raw = zip.subarray(data, data + size);
78
+ if (method === 0) return Buffer.from(raw);
79
+ if (method === 8) return inflateRawSync(raw);
80
+ throw new Error(`${name} is compressed with method ${method}, which chant does not read`);
81
+ }
82
+ at += 46 + skip;
83
+ }
84
+ return null;
85
+ }
86
+
87
+ /** The publisher, name and version a `.vsix` declares. */
88
+ export function vsixIdentity(bytes: Buffer, path: string): { publisher: string; name: string; version: string } {
89
+ let manifest: { publisher?: unknown; name?: unknown; version?: unknown };
90
+ try {
91
+ const entry = readZipEntry(bytes, "extension/package.json");
92
+ if (!entry) throw new Error("it holds no extension/package.json");
93
+ manifest = JSON.parse(entry.toString("utf-8")) as typeof manifest;
94
+ } catch (err) {
95
+ throw new PublishTargetError("publish-marketplace-vsix-invalid", `${path} is not a .vsix chant can read: ${err instanceof Error ? err.message : String(err)}`, "Package it with vsce package.");
96
+ }
97
+ const { publisher, name, version } = manifest;
98
+ if (typeof publisher !== "string" || typeof name !== "string" || typeof version !== "string" || !publisher || !name || !version) {
99
+ throw new PublishTargetError("publish-marketplace-vsix-invalid", `${path}'s extension/package.json needs publisher, name and version`);
100
+ }
101
+ return { publisher, name, version };
102
+ }
103
+
104
+ function run(bin: string, args: string[], ctx: PublishContext, env: NodeJS.ProcessEnv): Promise<{ code: number; output: string[] }> {
105
+ return new Promise((resolvePromise, reject) => {
106
+ const child = spawn(bin, args, { cwd: ctx.cwd, env, stdio: ["ignore", "pipe", "pipe"] });
107
+ const chunks: string[] = [];
108
+ child.stdout.on("data", (c: Buffer) => chunks.push(c.toString("utf-8")));
109
+ child.stderr.on("data", (c: Buffer) => chunks.push(c.toString("utf-8")));
110
+ child.on("error", reject);
111
+ child.on("close", (code) =>
112
+ resolvePromise({
113
+ code: code ?? 1,
114
+ output: chunks.join("").split("\n").filter((l) => l.trim() !== "").map((l) => ctx.redactor.redact(l)),
115
+ }),
116
+ );
117
+ });
118
+ }
119
+
120
+ export function marketplaceTarget(decl: MarketplacePublishDeclaration, deps: PublishDeps): PublishTarget {
121
+ const fetchImpl: PublishFetch = deps.fetch ?? ((url, init) => fetch(url, init as RequestInit));
122
+ const tokenNames = marketplaceTokenEnv(decl);
123
+ const label = decl.marketplace === "vscode" ? "VS Code Marketplace" : "Open VSX";
124
+ const registry = (decl.registry ?? (decl.marketplace === "vscode" ? VSCODE_GALLERY : OPEN_VSX_REGISTRY)).replace(/\/+$/, "");
125
+
126
+ const setup = (ctx: PublishContext) => {
127
+ const abs = memberFile(ctx.cwd, decl.vsix);
128
+ const bytes = readFileSync(abs);
129
+ const digest = bytesDigest(new Uint8Array(bytes));
130
+ checkReleaseDigest(ctx.release, "asset", ctx.cwd, decl.vsix, [digest]);
131
+ const id = vsixIdentity(bytes, decl.vsix);
132
+ const token = readCredential(ctx.env, tokenNames, ctx.redactor);
133
+ if (!token) {
134
+ throw new PublishTargetError("publish-credentials-missing", `the ${label} target reads its token from ${tokenNames[0]}, and it is not set`, `Set ${tokenNames[0]} in the job's or the shell's environment.`);
135
+ }
136
+ const destination =
137
+ decl.marketplace === "vscode" ? `${registry}/items?itemName=${id.publisher}.${id.name}` : `${registry}/extension/${id.publisher}/${id.name}/${id.version}`;
138
+ const item: PublishItem = { name: `${id.publisher}.${id.name}@${id.version}`, destination, digest };
139
+ return { abs, bytes, digest, id, token, item };
140
+ };
141
+
142
+ const get = async (url: string, init: { method: string; headers: Record<string, string>; body?: string } = { method: "GET", headers: {} }) => {
143
+ const res = await fetchImpl(url, { ...init, headers: { "user-agent": "chant", ...init.headers } });
144
+ return { status: res.status, text: await res.text().catch(() => "") };
145
+ };
146
+ function fail(ctx: PublishContext, what: string, status: number, text: string): never {
147
+ throw new PublishTargetError("publish-marketplace-failed", ctx.redactor.redact(`${what} on ${label} answered ${status}${text ? `: ${text.slice(0, 300)}` : ""}`));
148
+ }
149
+
150
+ /** Open VSX: the SHA-256 of what it serves for the version, or null when it has no such version. */
151
+ const openVsxServed = async (ctx: PublishContext, id: { publisher: string; name: string; version: string }): Promise<string | null> => {
152
+ const meta = await get(`${registry}/api/${encodeURIComponent(id.publisher)}/${encodeURIComponent(id.name)}/${encodeURIComponent(id.version)}`);
153
+ if (meta.status === 404) return null;
154
+ if (meta.status !== 200) fail(ctx, `reading ${id.publisher}.${id.name}@${id.version}`, meta.status, meta.text);
155
+ const download = (JSON.parse(meta.text) as { files?: { download?: unknown } }).files?.download;
156
+ if (typeof download !== "string") fail(ctx, `reading the download of ${id.publisher}.${id.name}@${id.version}`, meta.status, "no files.download");
157
+ const res = await fetchImpl(download, { method: "GET", headers: { "user-agent": "chant" } });
158
+ if (res.status !== 200) fail(ctx, `downloading ${id.publisher}.${id.name}@${id.version}`, res.status, "");
159
+ if (!res.arrayBuffer) throw new PublishTargetError("publish-marketplace-failed", "the fetch this publish runs with can't read a response's bytes, so the download's digest can't be checked");
160
+ return bytesDigest(new Uint8Array(await res.arrayBuffer()));
161
+ };
162
+
163
+ /** VS Code Marketplace: whether the gallery lists the version. */
164
+ const galleryHas = async (ctx: PublishContext, id: { publisher: string; name: string; version: string }): Promise<boolean> => {
165
+ const res = await get(`${registry}/_apis/public/gallery/extensionquery`, {
166
+ method: "POST",
167
+ headers: { "content-type": "application/json", accept: "application/json;api-version=3.0-preview.1" },
168
+ body: JSON.stringify({ filters: [{ criteria: [{ filterType: 7, value: `${id.publisher}.${id.name}` }], pageNumber: 1, pageSize: 1 }], flags: 1 }),
169
+ });
170
+ if (res.status !== 200) fail(ctx, `asking for ${id.publisher}.${id.name}`, res.status, res.text);
171
+ const body = JSON.parse(res.text) as { results?: Array<{ extensions?: Array<{ versions?: Array<{ version?: string }> }> }> };
172
+ return (body.results?.[0]?.extensions?.[0]?.versions ?? []).some((v) => v.version === id.version);
173
+ };
174
+
175
+ const target: PublishTarget = {
176
+ kind: "marketplace",
177
+ name: `${label} ${decl.vsix}`,
178
+ destination: label,
179
+ credentialEnv: tokenNames,
180
+ key: publishTargetKey(decl),
181
+ async plan(ctx) {
182
+ return [setup(ctx).item];
183
+ },
184
+ async stage(ctx) {
185
+ const { id, digest, token, item } = setup(ctx);
186
+ ctx.log(`using the token from ${token.from}`);
187
+ const done = (present: boolean): StagedTarget => ({ target: target.name, destination: target.destination, items: [{ ...item, ...(present ? { present: true } : {}) }], state: present ? { present: "true" } : {} });
188
+ if (decl.marketplace === "openvsx") {
189
+ const ns = await get(`${registry}/api/${encodeURIComponent(id.publisher)}`);
190
+ if (ns.status === 404) {
191
+ throw new PublishTargetError("publish-marketplace-no-namespace", `Open VSX at ${registry} has no namespace ${id.publisher}`, `Create it once with: npx ovsx create-namespace ${id.publisher}`);
192
+ }
193
+ if (ns.status !== 200) fail(ctx, `reading namespace ${id.publisher}`, ns.status, ns.text);
194
+ const served = await openVsxServed(ctx, id);
195
+ if (served === null) {
196
+ ctx.log(`${item.name} is not on Open VSX yet; it is uploaded at the reveal, since Open VSX has no draft`);
197
+ return done(false);
198
+ }
199
+ if (served !== digest) {
200
+ throw new PublishTargetError(
201
+ "publish-marketplace-version-exists",
202
+ `Open VSX already has ${item.name}, with digest ${served}, not ${digest}`,
203
+ "A marketplace version can't be replaced: cut a release with a new version.",
204
+ );
205
+ }
206
+ ctx.log(`${item.name} is already on Open VSX with the same bytes`);
207
+ return done(true);
208
+ }
209
+ if (await galleryHas(ctx, id)) {
210
+ ctx.log(`${item.name} is already on the VS Code Marketplace; it reports no digest to compare`);
211
+ return done(true);
212
+ }
213
+ ctx.log(`${item.name} is not on the VS Code Marketplace yet; it is uploaded at the reveal, since the marketplace has no draft`);
214
+ return done(false);
215
+ },
216
+ async reveal(ctx, staged) {
217
+ const items = staged.items.map((i) => ({ name: i.name, destination: i.destination, ...(i.digest ? { digest: i.digest } : {}) }));
218
+ if (staged.state.present === "true") return { target: target.name, destination: target.destination, items: items.map((i) => ({ ...i, present: true })) };
219
+ const { abs, bytes, id, digest, token, item } = setup(ctx);
220
+ if (decl.marketplace === "openvsx") {
221
+ // Run again after an upload whose record was lost, the version is there: check it rather than send it twice.
222
+ const before = await openVsxServed(ctx, id);
223
+ if (before === null) {
224
+ ctx.log(`uploading ${item.name} (${bytes.byteLength} bytes) to Open VSX`);
225
+ const res = await fetchImpl(`${registry}/api/-/publish?token=${encodeURIComponent(token.value)}`, {
226
+ method: "POST",
227
+ headers: { "user-agent": "chant", "content-type": "application/octet-stream" },
228
+ body: new Uint8Array(bytes),
229
+ });
230
+ if (res.status !== 201 && res.status !== 200) fail(ctx, `publishing ${item.name}`, res.status, await res.text().catch(() => ""));
231
+ }
232
+ const served = before ?? (await openVsxServed(ctx, id));
233
+ if (served !== digest) {
234
+ throw new PublishTargetError("publish-marketplace-digest-mismatch", `Open VSX serves ${item.name} with digest ${served ?? "none"}, and the file published is ${digest}`);
235
+ }
236
+ return { target: target.name, destination: target.destination, items: before === null ? items : items.map((i) => ({ ...i, present: true })) };
237
+ }
238
+ if (await galleryHas(ctx, id)) {
239
+ ctx.log(`${item.name} is already on the VS Code Marketplace`);
240
+ return { target: target.name, destination: target.destination, items: items.map((i) => ({ ...i, present: true })) };
241
+ }
242
+ ctx.log(`running vsce publish --packagePath ${decl.vsix}`);
243
+ const result = await run(deps.vsce ?? "vsce", ["publish", "--packagePath", abs], ctx, vsceEnv(ctx.env, token)).catch((err: unknown) => {
244
+ throw new PublishTargetError("publish-marketplace-failed", `vsce could not be run: ${err instanceof Error ? err.message : String(err)}`, "Install it on the job's PATH: npm install -g @vscode/vsce");
245
+ });
246
+ for (const l of result.output) ctx.log(`vsce: ${l}`);
247
+ if (result.code !== 0) {
248
+ throw new PublishTargetError("publish-marketplace-failed", `vsce publish of ${item.name} exited ${result.code}${result.output.length ? `: ${result.output.slice(-3).join(" ")}` : ""}`);
249
+ }
250
+ return { target: target.name, destination: target.destination, items };
251
+ },
252
+ };
253
+ return target;
254
+ }
255
+
256
+ /** The environment vsce runs with: the run's, with the token in `VSCE_PAT`. */
257
+ function vsceEnv(env: NodeJS.ProcessEnv, token: Credential): NodeJS.ProcessEnv {
258
+ return { ...env, VSCE_PAT: token.value };
259
+ }
@@ -65,9 +65,9 @@ describe("publish target context (#4602)", () => {
65
65
  expectTypeOf<ToyModuleContext>().toMatchTypeOf<PublishContextBase>();
66
66
  });
67
67
 
68
- test("the release targets keep the default context and their three kinds", () => {
68
+ test("the release targets keep the default context and their kinds", () => {
69
69
  expectTypeOf<PublishTarget["kind"]>().toEqualTypeOf<ReleasePublishKind>();
70
- expectTypeOf<ReleasePublishKind>().toEqualTypeOf<"npm" | "oci" | "forge">();
70
+ expectTypeOf<ReleasePublishKind>().toEqualTypeOf<"npm" | "oci" | "forge" | "homebrew" | "marketplace" | "tauri-updater">();
71
71
  expectTypeOf<Parameters<PublishTarget["plan"]>[0]>().toEqualTypeOf<PublishContext>();
72
72
  expectTypeOf<PublishContext>().toMatchTypeOf<PublishContextBase>();
73
73
  expectTypeOf<Awaited<ReturnType<typeof createPublishTargets>>>().toEqualTypeOf<PublishTarget[]>();
@@ -395,6 +395,29 @@ describe("forge release assets", () => {
395
395
  expect((await refused(t2!.stage(ctx))).code).toBe("publish-forge-asset-exists");
396
396
  });
397
397
 
398
+ test("GitHub: latest is sent as make_latest when the reveal publishes the draft, and is refused on a forge that has no such setting (#4676)", async () => {
399
+ const dir = assetDir();
400
+ const api = "https://api.github.test";
401
+ const ctx = context(dir, { env: { GITHUB_TOKEN: "ghs_tokentoken" } });
402
+ for (const [latest, sent] of [[false, "false"], [true, "true"], ["legacy", "legacy"]] as const) {
403
+ const forge = startFakeForge("github", api, "acme/api");
404
+ const [target] = await createPublishTargets([decl({ type: "forge", forge: "github", repo: "acme/api", api, assets: ASSETS, latest })], { fetch: forge.fetch });
405
+ const staged = await target!.stage(ctx);
406
+ // Staging creates the draft without it: a draft is never latest.
407
+ expect(forge.calls.filter((c) => c.method === "POST" && c.url === `${api}/repos/acme/api/releases`).map((c) => JSON.parse(c.body as string))).toEqual([
408
+ { tag_name: "release/v1.4.0", target_commitish: ctx.release.commit, name: "v1.4.0", draft: true },
409
+ ]);
410
+ await target!.reveal(ctx, staged);
411
+ expect(forge.calls.at(-1)).toMatchObject({ method: "PATCH", url: `${api}/repos/acme/api/releases/100`, body: JSON.stringify({ draft: false, make_latest: sent }) });
412
+ }
413
+ expect(() => decl({ type: "forge", forge: "github", repo: "acme/api", assets: ASSETS, latest: "true" })).toThrow();
414
+
415
+ const gitlab = startFakeForge("gitlab", "https://gitlab.test/api/v4", "acme/api");
416
+ const [t] = await createPublishTargets([decl({ type: "forge", forge: "gitlab", repo: "acme/api", assets: ASSETS, latest: false })], { fetch: gitlab.fetch });
417
+ expect((await refused(t!.plan(context(dir, { env: { GITLAB_TOKEN: "glpat-token" } })))).code).toBe("publish-forge-latest-unsupported");
418
+ expect(gitlab.calls).toEqual([]);
419
+ });
420
+
398
421
  test("GitLab: assets go to the generic package registry with a CI job token, and the release is made with its links only at the reveal", async () => {
399
422
  const dir = assetDir();
400
423
  const api = "https://gitlab.test/api/v4";
@@ -9,6 +9,12 @@
9
9
  * as GHCR or Docker Hub over the registry HTTP API, by digest, then tagged.
10
10
  * - `forge` (./publish-forge.ts): files attached to the GitHub, GitLab or
11
11
  * Forgejo release named by the release's tag.
12
+ * - `homebrew` (./publish-homebrew.ts): a formula in a tap repository on
13
+ * GitHub, rendered from a template with each asset's URL and SHA-256.
14
+ * - `marketplace` (./publish-marketplace.ts): a `.vsix` on the VS Code
15
+ * Marketplace (through `vsce`) or Open VSX (through its REST API).
16
+ * - `tauri-updater` (./publish-tauri.ts): a Tauri updater manifest and the
17
+ * app's bundles on a rolling GitHub release, replaced on each publish.
12
18
  *
13
19
  * A file a target reads that the release records as an artifact at the same
14
20
  * path is checked against the release's digest, and a file that differs is
@@ -38,6 +44,15 @@ export async function createPublishTargets(decls: readonly PublishDeclaration[],
38
44
  case "forge":
39
45
  out.push((await import("./publish-forge")).forgeTarget(d, deps));
40
46
  break;
47
+ case "homebrew":
48
+ out.push((await import("./publish-homebrew")).homebrewTarget(d, deps));
49
+ break;
50
+ case "marketplace":
51
+ out.push((await import("./publish-marketplace")).marketplaceTarget(d, deps));
52
+ break;
53
+ case "tauri-updater":
54
+ out.push((await import("./publish-tauri")).tauriUpdaterTarget(d, deps));
55
+ break;
41
56
  }
42
57
  }
43
58
  return out;
@@ -0,0 +1,163 @@
1
+ /**
2
+ * #4676: the Tauri updater target against the forge fake. The stage fills a
3
+ * draft for the rolling tag while the published rolling release stays as it
4
+ * was; the reveal swaps the draft in. Nothing reaches a network.
5
+ */
6
+
7
+ import { afterAll, describe, expect, test } from "vitest";
8
+ import { createHash } from "node:crypto";
9
+ import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
10
+ import { tmpdir } from "node:os";
11
+ import { join } from "node:path";
12
+ import { createRedactor } from "./publish-credentials";
13
+ import { PublishDeclarationSchema } from "./publish-declaration";
14
+ import { createPublishTargets } from "./publish-targets";
15
+ import { tauriManifest } from "./publish-tauri";
16
+ import { PublishTargetError, type PublishContext } from "./release-publish";
17
+ import { makeRelease, type ReleaseArtifact } from "./release-store";
18
+ import { startFakeForge } from "./__fixtures__/publish-fakes";
19
+
20
+ const dirs: string[] = [];
21
+ afterAll(() => {
22
+ for (const d of dirs) rmSync(d, { recursive: true, force: true });
23
+ });
24
+
25
+ const CUT = { actor: "alice", label: "app-v1.4.0", timestamp: "2026-10-17T10:00:00.000Z", runId: "1", signature: null };
26
+ function context(cwd: string, over: Partial<PublishContext> & { artifacts?: ReleaseArtifact[] } = {}): PublishContext & { lines: string[] } {
27
+ const env = over.env ?? { GITHUB_TOKEN: "ghs_tokentoken" };
28
+ const redactor = createRedactor(env);
29
+ const lines: string[] = [];
30
+ const release = makeRelease({ member: null, commit: "c0ffee".padEnd(40, "0"), artifactDigests: over.artifacts ?? [], targets: [{ env: "dev", params: [], templates: [] }] });
31
+ return { release, label: "app-v1.4.0", releaseTag: "release/app-v1.4.0", cut: CUT, provenance: { oidc: false, ci: null, reason: "" }, cwd, tag: null, env, redactor, log: (l) => lines.push(redactor.redact(l)), ...over, lines };
32
+ }
33
+
34
+ async function refused(p: Promise<unknown>): Promise<PublishTargetError> {
35
+ try {
36
+ await p;
37
+ } catch (err) {
38
+ if (err instanceof PublishTargetError) return err;
39
+ throw err;
40
+ }
41
+ throw new Error("expected a PublishTargetError");
42
+ }
43
+
44
+ const API = "https://api.github.test";
45
+ const digest = (text: string) => `sha256:${createHash("sha256").update(text).digest("hex")}`;
46
+ function member(): string {
47
+ const dir = mkdtempSync(join(tmpdir(), "chant-publish-tauri-"));
48
+ dirs.push(dir);
49
+ mkdirSync(join(dir, "dist"));
50
+ const files: Record<string, string> = {
51
+ "Arugula_aarch64.app.tar.gz": "mac arm bundle",
52
+ "Arugula_aarch64.app.tar.gz.sig": "c2lnbmF0dXJlIGFybQ==\n",
53
+ "Arugula_x64.app.tar.gz": "mac intel bundle",
54
+ "Arugula_x64.app.tar.gz.sig": "c2lnbmF0dXJlIHg2NA==\n",
55
+ "Arugula_1.4.0_amd64.AppImage": "linux bundle",
56
+ "Arugula_1.4.0_amd64.AppImage.sig": "c2lnbmF0dXJlIGxpbnV4\n",
57
+ "Arugula_1.4.0_aarch64.dmg": "dmg",
58
+ };
59
+ for (const [name, text] of Object.entries(files)) writeFileSync(join(dir, "dist", name), text);
60
+ writeFileSync(join(dir, "NOTES.md"), "Faster sync.\n");
61
+ return dir;
62
+ }
63
+ const declaration = (over: Record<string, unknown> = {}) =>
64
+ PublishDeclarationSchema.parse({
65
+ type: "tauri-updater",
66
+ repo: "arugula-salad/arugula",
67
+ tag: "app-latest",
68
+ api: API,
69
+ platforms: { "darwin-aarch64": "dist/Arugula_aarch64.app.tar.gz", "darwin-x86_64": "dist/Arugula_x64.app.tar.gz", "linux-x86_64": "dist/Arugula_1.4.0_amd64.AppImage" },
70
+ assets: ["dist/Arugula_1.4.0_aarch64.dmg"],
71
+ notes: "NOTES.md",
72
+ ...over,
73
+ });
74
+ const NAMES = ["Arugula_aarch64.app.tar.gz", "Arugula_x64.app.tar.gz", "Arugula_1.4.0_amd64.AppImage", "Arugula_1.4.0_aarch64.dmg", "latest.json"];
75
+ const download = (name: string) => `https://github.com/arugula-salad/arugula/releases/download/app-latest/${name}`;
76
+
77
+ describe("tauri updater (#4676)", () => {
78
+ test("writes the v2 updater manifest from the bundles' .sig files, stages it with the bundles on a draft, and swaps the rolling release at the reveal", async () => {
79
+ const dir = member();
80
+ const old = { id: 7, tag_name: "app-latest", draft: false, target: "old".padEnd(40, "0"), assets: [{ name: "latest.json", digest: digest("old"), bytes: "old" }], name: "app-latest 1.3.0" };
81
+ const forge = startFakeForge("github", API, "arugula-salad/arugula", [old]);
82
+ const [target] = await createPublishTargets([declaration()], { fetch: forge.fetch });
83
+ const ctx = context(dir);
84
+
85
+ const manifest = {
86
+ version: "1.4.0",
87
+ notes: "Faster sync.",
88
+ pub_date: "2026-10-17T10:00:00.000Z",
89
+ platforms: {
90
+ "darwin-aarch64": { signature: "c2lnbmF0dXJlIGFybQ==", url: download("Arugula_aarch64.app.tar.gz") },
91
+ "darwin-x86_64": { signature: "c2lnbmF0dXJlIHg2NA==", url: download("Arugula_x64.app.tar.gz") },
92
+ "linux-x86_64": { signature: "c2lnbmF0dXJlIGxpbnV4", url: download("Arugula_1.4.0_amd64.AppImage") },
93
+ },
94
+ };
95
+ const text = `${JSON.stringify(manifest, null, 2)}\n`;
96
+ const plan = await target!.plan(ctx);
97
+ expect(plan.map((i) => i.name)).toEqual([...NAMES.slice(0, 4).map((n) => `dist/${n}`), "latest.json"]);
98
+ expect(plan.at(-1)).toEqual({ name: "latest.json", destination: "github arugula-salad/arugula release app-latest, asset latest.json", digest: digest(text) });
99
+ expect(forge.calls).toEqual([]);
100
+
101
+ // The second upload fails: the draft keeps the first, and the rolling release still serves the old manifest.
102
+ forge.failOnce("POST https://uploads.forge.test/repos/arugula-salad/arugula/releases/101/assets?name=Arugula_x64");
103
+ expect((await refused(target!.stage(ctx))).code).toBe("publish-tauri-failed");
104
+ const staged = await target!.stage(ctx);
105
+ expect(staged.items.map((i) => i.present ?? false)).toEqual([true, false, false, false, false]);
106
+ expect(staged.state).toEqual({ releaseId: "101" });
107
+ expect(forge.visible()).toEqual([{ tag: "app-latest", assets: ["latest.json"] }]);
108
+ const draft = forge.releases.find((r) => r.id === 101)!;
109
+ expect(draft).toMatchObject({ draft: true, name: "app-latest 1.4.0", target: ctx.release.commit });
110
+ expect(JSON.parse(draft.assets.find((a) => a.name === "latest.json")!.bytes)).toEqual(manifest);
111
+
112
+ await target!.reveal(ctx, staged);
113
+ expect(forge.visible()).toEqual([{ tag: "app-latest", assets: NAMES }]);
114
+ expect(forge.releases.some((r) => r.id === 7)).toBe(false);
115
+ expect(forge.tags.get("app-latest")).toBe(ctx.release.commit);
116
+ expect(forge.releases.find((r) => r.id === 101)!.make_latest).toBe("false");
117
+ expect(ctx.lines.join("\n")).not.toContain("ghs_tokentoken");
118
+
119
+ // Run again: the reveal finds the draft published; a stage finds every file there and stages nothing.
120
+ const n = forge.calls.length;
121
+ await target!.reveal(ctx, staged);
122
+ expect(forge.calls.slice(n).map((c) => c.method)).toEqual(["GET"]);
123
+ const again = await target!.stage(ctx);
124
+ expect(again.state).toEqual({ published: "101" });
125
+ expect(again.items.every((i) => i.present)).toBe(true);
126
+ });
127
+
128
+ test("with no rolling release yet, the reveal only publishes the draft, with the declared latest and url", async () => {
129
+ const dir = member();
130
+ const forge = startFakeForge("github", API, "arugula-salad/arugula");
131
+ const [target] = await createPublishTargets([declaration({ latest: "legacy", url: "https://dl.arugula.example/{version}/{name}", notes: undefined, assets: undefined })], { fetch: forge.fetch });
132
+ const ctx = context(dir, { cut: null });
133
+ await target!.reveal(ctx, await target!.stage(ctx));
134
+ const rel = forge.releases[0]!;
135
+ expect(rel).toMatchObject({ draft: false, make_latest: "legacy" });
136
+ const manifest = JSON.parse(rel.assets.find((a) => a.name === "latest.json")!.bytes) as Record<string, unknown>;
137
+ expect(Object.keys(manifest)).toEqual(["version", "platforms"]);
138
+ expect(manifest.platforms).toMatchObject({ "linux-x86_64": { url: "https://dl.arugula.example/1.4.0/Arugula_1.4.0_amd64.AppImage" } });
139
+ });
140
+
141
+ test("refuses a bundle that is not the release's, a missing .sig, a release with no version, a missing token, and a draft asset that differs", async () => {
142
+ const make = async (fetch = startFakeForge("github", API, "arugula-salad/arugula").fetch, over: Record<string, unknown> = {}) => (await createPublishTargets([declaration(over)], { fetch }))[0]!;
143
+ const dir = member();
144
+ const artifacts: ReleaseArtifact[] = [{ component: "app", kind: "asset", path: "dist/Arugula_x64.app.tar.gz.sig", digest: `sha256:${"0".repeat(64)}` }];
145
+ expect((await refused((await make()).plan(context(dir, { artifacts })))).code).toBe("publish-artifact-digest-mismatch");
146
+ expect((await refused((await make(undefined, { platforms: { "windows-x86_64-nsis": "dist/Arugula_1.4.0_aarch64.dmg" } })).plan(context(dir)))).code).toBe("publish-file-missing");
147
+ expect((await refused((await make()).plan(context(dir, { label: "latest" })))).code).toBe("publish-tauri-no-version");
148
+ expect((await refused((await make()).plan(context(dir, { env: {} })))).code).toBe("publish-credentials-missing");
149
+ const differs = startFakeForge("github", API, "arugula-salad/arugula", [
150
+ { id: 9, tag_name: "app-latest", draft: true, target: "x", name: "app-latest 1.4.0", assets: [{ name: "latest.json", digest: digest("other"), bytes: "other" }] },
151
+ ]);
152
+ expect((await refused((await make(differs.fetch)).stage(context(dir)))).code).toBe("publish-tauri-asset-exists");
153
+ expect(() => declaration({ platforms: { macos: "x" } })).toThrow();
154
+ expect(() => declaration({ platforms: {} })).toThrow();
155
+ });
156
+
157
+ test("the manifest's keys are in Tauri's order and its platforms sorted", () => {
158
+ const bytes = tauriManifest({ version: "1.0.0", notes: null, pubDate: "2026-01-01T00:00:00Z", platforms: { "windows-x86_64": { signature: "s", url: "u" }, "darwin-aarch64": { signature: "t", url: "v" } } });
159
+ expect(Buffer.from(bytes).toString()).toBe(
160
+ `${JSON.stringify({ version: "1.0.0", pub_date: "2026-01-01T00:00:00Z", platforms: { "darwin-aarch64": { signature: "t", url: "v" }, "windows-x86_64": { signature: "s", url: "u" } } }, null, 2)}\n`,
161
+ );
162
+ });
163
+ });