Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

Build for Windows ARM (#2080)

Evan Yu6891c77d3e88
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 3d72680d3..cd7387e96 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -160,6 +160,11 @@ jobs:
platform: win
target: nsis
arch: x64
+ - label: Windows arm64
+ runner: windows-11-arm
+ platform: win
+ target: nsis
+ arch: arm64
steps:
- name: Checkout
uses: actions/checkout@v6
@@ -272,6 +277,17 @@ jobs:
done
fi
+ # Windows updater metadata is channel-specific (for example
+ # "latest.yml" or "nightly.yml"). Suffix each per-arch copy so the
+ # release job can merge matching arm64/x64 manifests back into one
+ # canonical manifest per channel.
+ if [[ "${{ matrix.platform }}" == "win" ]]; then
+ shopt -s nullglob
+ for manifest in release-publish/*.yml; do
+ mv "$manifest" "${manifest%.yml}-win-${{ matrix.arch }}.yml"
+ done
+ fi
+
- name: Upload build artifacts
uses: actions/upload-artifact@v7
with:
@@ -342,11 +358,36 @@ jobs:
for x64_manifest in release-assets/*-mac-x64.yml; do
arm64_manifest="${x64_manifest%-x64.yml}.yml"
if [[ -f "$arm64_manifest" ]]; then
- node scripts/merge-mac-update-manifests.ts "$arm64_manifest" "$x64_manifest"
+ node scripts/merge-update-manifests.ts --platform mac "$arm64_manifest" "$x64_manifest"
rm -f "$x64_manifest"
fi
done
+ - name: Merge Windows updater manifests
+ run: |
+ shopt -s nullglob
+ found_windows_manifest=false
+ for x64_manifest in release-assets/*-win-x64.yml; do
+ arm64_manifest="${x64_manifest/-x64.yml/-arm64.yml}"
+ output_manifest="${x64_manifest/-win-x64.yml/.yml}"
+ if [[ ! -f "$arm64_manifest" ]]; then
+ echo "Missing matching arm64 Windows manifest for $x64_manifest" >&2
+ exit 1
+ fi
+
+ found_windows_manifest=true
+ node scripts/merge-update-manifests.ts --platform win \
+ "$arm64_manifest" \
+ "$x64_manifest" \
+ "$output_manifest"
+ rm -f "$arm64_manifest" "$x64_manifest"
+ done
+
+ if [[ "$found_windows_manifest" != true ]]; then
+ echo "No Windows updater manifests found to merge." >&2
+ exit 1
+ fi
+
- name: Publish release
if: needs.preflight.outputs.previous_tag != ''
uses: softprops/action-gh-release@v2
diff --git a/CLAUDE.md b/CLAUDE.md
index 47dc3e3d8..c31706425 120000
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -1 +1 @@
-AGENTS.md
\ No newline at end of file
+AGENTS.md
diff --git a/bun.lock b/bun.lock
index 64f5a5b91..b5b7c6c9c 100644
--- a/bun.lock
+++ b/bun.lock
@@ -202,7 +202,7 @@
"@effect/platform-node-shared": "4.0.0-beta.45",
"@effect/sql-sqlite-bun": "4.0.0-beta.45",
"@effect/vitest": "4.0.0-beta.45",
- "@types/bun": "^1.3.9",
+ "@types/bun": "^1.3.11",
"@types/node": "^24.10.13",
"effect": "4.0.0-beta.45",
"tsdown": "^0.20.3",
@@ -770,7 +770,7 @@
"@types/babel__traverse": ["@types/[email protected]", "", { "dependencies": { "@babel/types": "^7.28.2" } }, "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q=="],
- "@types/bun": ["@types/[email protected]", "", { "dependencies": { "bun-types": "1.3.10" } }, "sha512-0+rlrUrOrTSskibryHbvQkDOWRJwJZqZlxrUs1u4oOoTln8+WIXBPmAuCF35SWB2z4Zl3E84Nl/D0P7803nigQ=="],
+ "@types/bun": ["@types/[email protected]", "", { "dependencies": { "bun-types": "1.3.11" } }, "sha512-5vPne5QvtpjGpsGYXiFyycfpDF2ECyPcTSsFBMa0fraoxiQyMJ3SmuQIGhzPg2WJuWxVBoxWJ2kClYTcw/4fAg=="],
"@types/cacheable-request": ["@types/[email protected]", "", { "dependencies": { "@types/http-cache-semantics": "*", "@types/keyv": "^3.1.4", "@types/node": "*", "@types/responselike": "^1.0.0" } }, "sha512-IQ3EbTzGxIigb1I3qPZc1rWJnH0BmSKv5QYTalEwweFvyBDLSAe24zP0le/hyi7ecGfZVlIVAg4BZqb8WBwKqw=="],
@@ -916,7 +916,7 @@
"builder-util-runtime": ["[email protected]", "", { "dependencies": { "debug": "^4.3.4", "sax": "^1.2.4" } }, "sha512-qt41tMfgHTllhResqM5DcnHyDIWNgzHvuY2jDcYP9iaGpkWxTUzV6GQjDeLnlR1/DtdlcsWQbA7sByMpmJFTLQ=="],
- "bun-types": ["[email protected]", "", { "dependencies": { "@types/node": "*" } }, "sha512-tcpfCCl6XWo6nCVnpcVrxQ+9AYN1iqMIzgrSKYMB/fjLtV2eyAVEg7AxQJuCq/26R6HpKWykQXuSOq/21RYcbg=="],
+ "bun-types": ["[email protected]", "", { "dependencies": { "@types/node": "*" } }, "sha512-1KGPpoxQWl9f6wcZh57LvrPIInQMn2TQ7jsgxqpRzg+l0QPOFvJVH7HmvHo/AiPgwXy+/Thf6Ov3EdVn1vOabg=="],
"bundle-name": ["[email protected]", "", { "dependencies": { "run-applescript": "^7.0.0" } }, "sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q=="],
diff --git a/package.json b/package.json
index 884a512d3..ade7bcce4 100644
--- a/package.json
+++ b/package.json
@@ -16,7 +16,7 @@
"@effect/sql-sqlite-bun": "4.0.0-beta.45",
"@effect/vitest": "4.0.0-beta.45",
"@effect/language-service": "0.84.2",
- "@types/bun": "^1.3.9",
+ "@types/bun": "^1.3.11",
"@types/node": "^24.10.13",
"tsdown": "^0.20.3",
"typescript": "^5.7.3",
@@ -50,7 +50,9 @@
"dist:desktop:dmg:arm64": "node scripts/build-desktop-artifact.ts --platform mac --target dmg --arch arm64",
"dist:desktop:dmg:x64": "node scripts/build-desktop-artifact.ts --platform mac --target dmg --arch x64",
"dist:desktop:linux": "node scripts/build-desktop-artifact.ts --platform linux --target AppImage --arch x64",
- "dist:desktop:win": "node scripts/build-desktop-artifact.ts --platform win --target nsis --arch x64",
+ "dist:desktop:win": "node scripts/build-desktop-artifact.ts --platform win --target nsis",
+ "dist:desktop:win:arm64": "node scripts/build-desktop-artifact.ts --platform win --target nsis --arch arm64",
+ "dist:desktop:win:x64": "node scripts/build-desktop-artifact.ts --platform win --target nsis --arch x64",
"release:smoke": "node scripts/release-smoke.ts",
"clean": "rm -rf node_modules apps/*/node_modules packages/*/node_modules apps/*/dist apps/*/dist-electron packages/*/dist .turbo apps/*/.turbo packages/*/.turbo",
"sync:vscode-icons": "node scripts/sync-vscode-icons.mjs"
@@ -73,10 +75,10 @@
"vite": "^8.0.0"
},
"engines": {
- "bun": "^1.3.9",
+ "bun": "^1.3.11",
"node": "^24.13.1"
},
- "packageManager": "[email protected]",
+ "packageManager": "[email protected]",
"msw": {
"workerDirectory": [
"apps/web/public"
diff --git a/scripts/build-desktop-artifact.ts b/scripts/build-desktop-artifact.ts
index 5d3a437d2..5df46e3a1 100644
--- a/scripts/build-desktop-artifact.ts
+++ b/scripts/build-desktop-artifact.ts
@@ -9,6 +9,7 @@ import desktopPackageJson from "../apps/desktop/package.json" with { type: "json
import serverPackageJson from "../apps/server/package.json" with { type: "json" };
import { BRAND_ASSET_PATHS } from "./lib/brand-assets.ts";
+import { getDefaultBuildArch } from "./lib/build-target-arch.ts";
import { resolveCatalogDependencies } from "./lib/resolve-catalog.ts";
import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
@@ -82,14 +83,7 @@ function getDefaultArch(platform: typeof BuildPlatform.Type): typeof BuildArch.T
return "x64";
}
- if (process.arch === "arm64" && config.archChoices.includes("arm64")) {
- return "arm64";
- }
- if (process.arch === "x64" && config.archChoices.includes("x64")) {
- return "x64";
- }
-
- return config.archChoices[0] ?? "x64";
+ return getDefaultBuildArch(platform, process.arch, process.env, config);
}
class BuildScriptError extends Data.TaggedError("BuildScriptError")<{
diff --git a/scripts/lib/build-target-arch.test.ts b/scripts/lib/build-target-arch.test.ts
new file mode 100644
index 000000000..56251d3ff
--- /dev/null
+++ b/scripts/lib/build-target-arch.test.ts
@@ -0,0 +1,61 @@
+import { assert, describe, it } from "@effect/vitest";
+
+import { getDefaultBuildArch, resolveHostProcessArch } from "./build-target-arch.ts";
+
+describe("build-target-arch", () => {
+ it("prefers arm64 for Windows-on-Arm hosts running x64 emulation", () => {
+ // Windows-on-Arm can run an x64 Node process under emulation while still
+ // exposing the real host CPU via PROCESSOR_ARCHITEW6432.
+ const hostArch = resolveHostProcessArch("win32", "x64", {
+ PROCESSOR_ARCHITECTURE: "AMD64", // The currently running Node process is x64.
+ PROCESSOR_ARCHITEW6432: "ARM64", // Windows exposes the real host CPU here when x64 runs under ARM emulation.
+ });
+
+ assert.equal(hostArch, "arm64");
+ });
+
+ it("falls back to x64 for native x64 Windows hosts", () => {
+ const hostArch = resolveHostProcessArch("win32", "x64", {
+ PROCESSOR_ARCHITECTURE: "AMD64", // Both the process and the Windows host are native x64.
+ });
+
+ assert.equal(hostArch, "x64");
+ });
+
+ it("keeps arm64 when the current process is already native arm64", () => {
+ const hostArch = resolveHostProcessArch("win32", "arm64", {});
+
+ assert.equal(hostArch, "arm64");
+ });
+
+ it("uses the resolved host arch when selecting the default Windows build arch", () => {
+ // This mirrors the packaging script's default-path behavior: the current
+ // process is x64, but the machine itself is ARM64, so the default build
+ // target should be win-arm64 rather than win-x64.
+ const arch = getDefaultBuildArch(
+ "win",
+ "x64",
+ {
+ PROCESSOR_ARCHITECTURE: "AMD64", // The currently running Node process is x64.
+ PROCESSOR_ARCHITEW6432: "ARM64", // The process is x64, but the actual Windows host is ARM64.
+ },
+ { archChoices: ["x64", "arm64"] },
+ );
+
+ assert.equal(arch, "arm64");
+ });
+
+ it("does not apply Windows host env heuristics for non-Windows targets", () => {
+ const arch = getDefaultBuildArch(
+ "linux",
+ "x64",
+ {
+ PROCESSOR_ARCHITECTURE: "AMD64",
+ PROCESSOR_ARCHITEW6432: "ARM64",
+ },
+ { archChoices: ["x64", "arm64"] },
+ );
+
+ assert.equal(arch, "x64");
+ });
+});
diff --git a/scripts/lib/build-target-arch.ts b/scripts/lib/build-target-arch.ts
new file mode 100644
index 000000000..8c3964841
--- /dev/null
+++ b/scripts/lib/build-target-arch.ts
@@ -0,0 +1,50 @@
+export type BuildArch = "arm64" | "x64" | "universal";
+export type BuildPlatform = "mac" | "linux" | "win";
+
+interface PlatformConfig {
+ readonly archChoices: ReadonlyArray<BuildArch>;
+}
+
+function normalizeWindowsArch(value: string | undefined): BuildArch | undefined {
+ const normalized = value?.trim().toLowerCase();
+ if (!normalized) return undefined;
+ if (normalized.includes("arm64") || normalized === "aarch64") return "arm64";
+ if (normalized.includes("amd64") || normalized.includes("x64")) return "x64";
+ return undefined;
+}
+
+export function resolveHostProcessArch(
+ platform: NodeJS.Platform,
+ processArch: NodeJS.Architecture,
+ env: NodeJS.ProcessEnv,
+): BuildArch | undefined {
+ if (processArch === "arm64") return "arm64";
+ if (processArch === "x64") {
+ if (platform !== "win32") return "x64";
+
+ // On Windows-on-Arm, x64 Node/Bun can run under emulation while the host
+ // still reports ARM64 via the processor environment variables.
+ return (
+ normalizeWindowsArch(env.PROCESSOR_ARCHITEW6432) ??
+ normalizeWindowsArch(env.PROCESSOR_ARCHITECTURE) ??
+ "x64"
+ );
+ }
+ return undefined;
+}
+
+export function getDefaultBuildArch(
+ platform: BuildPlatform,
+ processArch: NodeJS.Architecture,
+ env: NodeJS.ProcessEnv,
+ platformConfig: PlatformConfig,
+): BuildArch {
+ const hostPlatform: NodeJS.Platform =
+ platform === "win" ? "win32" : platform === "mac" ? "darwin" : "linux";
+ const hostArch = resolveHostProcessArch(hostPlatform, processArch, env);
+ if (hostArch && platformConfig.archChoices.includes(hostArch)) {
+ return hostArch;
+ }
+
+ return platformConfig.archChoices[0] ?? "x64";
+}
diff --git a/scripts/merge-mac-update-manifests.ts b/scripts/lib/update-manifest.ts
similarity index 58%
rename from scripts/merge-mac-update-manifests.ts
rename to scripts/lib/update-manifest.ts
index c59bc76b9..191a3c0e5 100644
--- a/scripts/merge-mac-update-manifests.ts
+++ b/scripts/lib/update-manifest.ts
@@ -1,23 +1,19 @@
-import { readFileSync, writeFileSync } from "node:fs";
-import { resolve } from "node:path";
-import { fileURLToPath } from "node:url";
-
-interface MacUpdateFile {
+export interface UpdateManifestFile {
readonly url: string;
readonly sha512: string;
readonly size: number;
}
-type MacUpdateScalar = string | number | boolean;
+export type UpdateManifestScalar = string | number | boolean;
-interface MacUpdateManifest {
+export interface UpdateManifest {
readonly version: string;
readonly releaseDate: string;
- readonly files: ReadonlyArray<MacUpdateFile>;
- readonly extras: Readonly<Record<string, MacUpdateScalar>>;
+ readonly files: ReadonlyArray<UpdateManifestFile>;
+ readonly extras: Readonly<Record<string, UpdateManifestScalar>>;
}
-interface MutableMacUpdateFile {
+interface MutableUpdateManifestFile {
url?: string;
sha512?: string;
size?: number;
@@ -31,10 +27,11 @@ function stripSingleQuotes(value: string): string {
}
function parseFileRecord(
- currentFile: MutableMacUpdateFile | null,
+ currentFile: MutableUpdateManifestFile | null,
sourcePath: string,
lineNumber: number,
-): MacUpdateFile | null {
+ platformLabel: string,
+): UpdateManifestFile | null {
if (currentFile === null) {
return null;
}
@@ -44,7 +41,7 @@ function parseFileRecord(
typeof currentFile.size !== "number"
) {
throw new Error(
- `Invalid macOS update manifest at ${sourcePath}:${lineNumber}: incomplete file entry.`,
+ `Invalid ${platformLabel} update manifest at ${sourcePath}:${lineNumber}: incomplete file entry.`,
);
}
return {
@@ -54,7 +51,7 @@ function parseFileRecord(
};
}
-function parseScalarValue(rawValue: string): MacUpdateScalar {
+function parseScalarValue(rawValue: string): UpdateManifestScalar {
const trimmed = rawValue.trim();
const isQuoted = trimmed.startsWith("'") && trimmed.endsWith("'") && trimmed.length >= 2;
const value = isQuoted ? trimmed.slice(1, -1).replace(/''/g, "'") : trimmed;
@@ -67,14 +64,18 @@ function parseScalarValue(rawValue: string): MacUpdateScalar {
return value;
}
-export function parseMacUpdateManifest(raw: string, sourcePath: string): MacUpdateManifest {
+export function parseUpdateManifest(
+ raw: string,
+ sourcePath: string,
+ platformLabel: string,
+): UpdateManifest {
const lines = raw.split(/\r?\n/);
- const files: MacUpdateFile[] = [];
- const extras: Record<string, MacUpdateScalar> = {};
+ const files: UpdateManifestFile[] = [];
+ const extras: Record<string, UpdateManifestScalar> = {};
let version: string | null = null;
let releaseDate: string | null = null;
let inFiles = false;
- let currentFile: MutableMacUpdateFile | null = null;
+ let currentFile: MutableUpdateManifestFile | null = null;
for (const [index, rawLine] of lines.entries()) {
const lineNumber = index + 1;
@@ -83,7 +84,7 @@ export function parseMacUpdateManifest(raw: string, sourcePath: string): MacUpda
const fileUrlMatch = line.match(/^ - url:\s*(.+)$/);
if (fileUrlMatch?.[1]) {
- const finalized = parseFileRecord(currentFile, sourcePath, lineNumber);
+ const finalized = parseFileRecord(currentFile, sourcePath, lineNumber, platformLabel);
if (finalized) files.push(finalized);
currentFile = { url: stripSingleQuotes(fileUrlMatch[1].trim()) };
inFiles = true;
@@ -94,7 +95,7 @@ export function parseMacUpdateManifest(raw: string, sourcePath: string): MacUpda
if (fileShaMatch?.[1]) {
if (currentFile === null) {
throw new Error(
- `Invalid macOS update manifest at ${sourcePath}:${lineNumber}: sha512 without a file entry.`,
+ `Invalid ${platformLabel} update manifest at ${sourcePath}:${lineNumber}: sha512 without a file entry.`,
);
}
currentFile.sha512 = stripSingleQuotes(fileShaMatch[1].trim());
@@ -105,7 +106,7 @@ export function parseMacUpdateManifest(raw: string, sourcePath: string): MacUpda
if (fileSizeMatch?.[1]) {
if (currentFile === null) {
throw new Error(
- `Invalid macOS update manifest at ${sourcePath}:${lineNumber}: size without a file entry.`,
+ `Invalid ${platformLabel} update manifest at ${sourcePath}:${lineNumber}: size without a file entry.`,
);
}
currentFile.size = Number(fileSizeMatch[1]);
@@ -118,7 +119,7 @@ export function parseMacUpdateManifest(raw: string, sourcePath: string): MacUpda
}
if (inFiles && currentFile !== null) {
- const finalized = parseFileRecord(currentFile, sourcePath, lineNumber);
+ const finalized = parseFileRecord(currentFile, sourcePath, lineNumber, platformLabel);
if (finalized) files.push(finalized);
currentFile = null;
}
@@ -127,7 +128,7 @@ export function parseMacUpdateManifest(raw: string, sourcePath: string): MacUpda
const topLevelMatch = line.match(/^([A-Za-z][A-Za-z0-9]*):\s*(.+)$/);
if (!topLevelMatch?.[1] || topLevelMatch[2] === undefined) {
throw new Error(
- `Invalid macOS update manifest at ${sourcePath}:${lineNumber}: unsupported line '${line}'.`,
+ `Invalid ${platformLabel} update manifest at ${sourcePath}:${lineNumber}: unsupported line '${line}'.`,
);
}
@@ -137,7 +138,7 @@ export function parseMacUpdateManifest(raw: string, sourcePath: string): MacUpda
if (key === "version") {
if (typeof value !== "string") {
throw new Error(
- `Invalid macOS update manifest at ${sourcePath}:${lineNumber}: version must be a string.`,
+ `Invalid ${platformLabel} update manifest at ${sourcePath}:${lineNumber}: version must be a string.`,
);
}
version = value;
@@ -147,7 +148,7 @@ export function parseMacUpdateManifest(raw: string, sourcePath: string): MacUpda
if (key === "releaseDate") {
if (typeof value !== "string") {
throw new Error(
- `Invalid macOS update manifest at ${sourcePath}:${lineNumber}: releaseDate must be a string.`,
+ `Invalid ${platformLabel} update manifest at ${sourcePath}:${lineNumber}: releaseDate must be a string.`,
);
}
releaseDate = value;
@@ -161,17 +162,19 @@ export function parseMacUpdateManifest(raw: string, sourcePath: string): MacUpda
extras[key] = value;
}
- const finalized = parseFileRecord(currentFile, sourcePath, lines.length);
+ const finalized = parseFileRecord(currentFile, sourcePath, lines.length, platformLabel);
if (finalized) files.push(finalized);
if (!version) {
- throw new Error(`Invalid macOS update manifest at ${sourcePath}: missing version.`);
+ throw new Error(`Invalid ${platformLabel} update manifest at ${sourcePath}: missing version.`);
}
if (!releaseDate) {
- throw new Error(`Invalid macOS update manifest at ${sourcePath}: missing releaseDate.`);
+ throw new Error(
+ `Invalid ${platformLabel} update manifest at ${sourcePath}: missing releaseDate.`,
+ );
}
if (files.length === 0) {
- throw new Error(`Invalid macOS update manifest at ${sourcePath}: missing files.`);
+ throw new Error(`Invalid ${platformLabel} update manifest at ${sourcePath}: missing files.`);
}
return {
@@ -183,16 +186,17 @@ export function parseMacUpdateManifest(raw: string, sourcePath: string): MacUpda
}
function mergeExtras(
- primary: Readonly<Record<string, MacUpdateScalar>>,
- secondary: Readonly<Record<string, MacUpdateScalar>>,
-): Record<string, MacUpdateScalar> {
- const merged: Record<string, MacUpdateScalar> = { ...primary };
+ primary: Readonly<Record<string, UpdateManifestScalar>>,
+ secondary: Readonly<Record<string, UpdateManifestScalar>>,
+ platformLabel: string,
+): Record<string, UpdateManifestScalar> {
+ const merged: Record<string, UpdateManifestScalar> = { ...primary };
for (const [key, value] of Object.entries(secondary)) {
const existing = merged[key];
if (existing !== undefined && existing !== value) {
throw new Error(
- `Cannot merge macOS update manifests: conflicting '${key}' values ('${existing}' vs '${value}').`,
+ `Cannot merge ${platformLabel} update manifests: conflicting '${key}' values ('${existing}' vs '${value}').`,
);
}
merged[key] = value;
@@ -201,22 +205,23 @@ function mergeExtras(
return merged;
}
-export function mergeMacUpdateManifests(
- primary: MacUpdateManifest,
- secondary: MacUpdateManifest,
-): MacUpdateManifest {
+export function mergeUpdateManifests(
+ primary: UpdateManifest,
+ secondary: UpdateManifest,
+ platformLabel: string,
+): UpdateManifest {
if (primary.version !== secondary.version) {
throw new Error(
- `Cannot merge macOS update manifests with different versions (${primary.version} vs ${secondary.version}).`,
+ `Cannot merge ${platformLabel} update manifests with different versions (${primary.version} vs ${secondary.version}).`,
);
}
- const filesByUrl = new Map<string, MacUpdateFile>();
+ const filesByUrl = new Map<string, UpdateManifestFile>();
for (const file of [...primary.files, ...secondary.files]) {
const existing = filesByUrl.get(file.url);
if (existing && (existing.sha512 !== file.sha512 || existing.size !== file.size)) {
throw new Error(
- `Cannot merge macOS update manifests: conflicting file entry for ${file.url}.`,
+ `Cannot merge ${platformLabel} update manifests: conflicting file entry for ${file.url}.`,
);
}
filesByUrl.set(file.url, file);
@@ -227,7 +232,7 @@ export function mergeMacUpdateManifests(
releaseDate:
primary.releaseDate >= secondary.releaseDate ? primary.releaseDate : secondary.releaseDate,
files: [...filesByUrl.values()],
- extras: mergeExtras(primary.extras, secondary.extras),
+ extras: mergeExtras(primary.extras, secondary.extras, platformLabel),
};
}
@@ -235,15 +240,20 @@ function quoteYamlString(value: string): string {
return `'${value.replace(/'/g, "''")}'`;
}
-function serializeScalarValue(value: MacUpdateScalar): string {
+function serializeScalarValue(value: UpdateManifestScalar): string {
if (typeof value === "string") {
return quoteYamlString(value);
}
return String(value);
}
-export function serializeMacUpdateManifest(manifest: MacUpdateManifest): string {
- const lines = [`version: ${manifest.version}`, "files:"];
+export function serializeUpdateManifest(
+ manifest: UpdateManifest,
+ options: {
+ readonly platformLabel: string;
+ },
+): string {
+ const lines = [`version: ${quoteYamlString(manifest.version)}`, "files:"];
for (const file of manifest.files) {
lines.push(` - url: ${file.url}`);
@@ -254,7 +264,9 @@ export function serializeMacUpdateManifest(manifest: MacUpdateManifest): string
for (const key of Object.keys(manifest.extras).toSorted()) {
const value = manifest.extras[key];
if (value === undefined) {
- throw new Error(`Cannot serialize macOS update manifest: missing value for '${key}'.`);
+ throw new Error(
+ `Cannot serialize ${options.platformLabel} update manifest: missing value for '${key}'.`,
+ );
}
lines.push(`${key}: ${serializeScalarValue(value)}`);
}
@@ -263,25 +275,3 @@ export function serializeMacUpdateManifest(manifest: MacUpdateManifest): string
lines.push("");
return lines.join("\n");
}
-
-function main(args: ReadonlyArray<string>): void {
- const [arm64PathArg, x64PathArg, outputPathArg] = args;
- if (!arm64PathArg || !x64PathArg) {
- throw new Error(
- "Usage: node scripts/merge-mac-update-manifests.ts <latest-mac.yml> <latest-mac-x64.yml> [output-path]",
- );
- }
-
- const arm64Path = resolve(arm64PathArg);
- const x64Path = resolve(x64PathArg);
- const outputPath = resolve(outputPathArg ?? arm64PathArg);
-
- const arm64Manifest = parseMacUpdateManifest(readFileSync(arm64Path, "utf8"), arm64Path);
- const x64Manifest = parseMacUpdateManifest(readFileSync(x64Path, "utf8"), x64Path);
- const merged = mergeMacUpdateManifests(arm64Manifest, x64Manifest);
- writeFileSync(outputPath, serializeMacUpdateManifest(merged));
-}
-
-if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
- main(process.argv.slice(2));
-}
diff --git a/scripts/merge-mac-update-manifests.test.ts b/scripts/merge-mac-update-manifests.test.ts
deleted file mode 100644
index 22d2e7627..000000000
--- a/scripts/merge-mac-update-manifests.test.ts
+++ /dev/null
@@ -1,108 +0,0 @@
-import { assert, describe, it } from "@effect/vitest";
-
-import {
- mergeMacUpdateManifests,
- parseMacUpdateManifest,
- serializeMacUpdateManifest,
-} from "./merge-mac-update-manifests.ts";
-
-describe("merge-mac-update-manifests", () => {
- it("merges arm64 and x64 macOS update manifests into one multi-arch manifest", () => {
- const arm64 = parseMacUpdateManifest(
- `version: 0.0.4
-files:
- - url: T3-Code-0.0.4-arm64.zip
- sha512: arm64zip
- size: 125621344
- - url: T3-Code-0.0.4-arm64.dmg
- sha512: arm64dmg
- size: 131754935
-path: T3-Code-0.0.4-arm64.zip
-sha512: arm64zip
-releaseDate: '2026-03-07T10:32:14.587Z'
-`,
- "latest-mac.yml",
- );
-
- const x64 = parseMacUpdateManifest(
- `version: 0.0.4
-files:
- - url: T3-Code-0.0.4-x64.zip
- sha512: x64zip
- size: 132000112
- - url: T3-Code-0.0.4-x64.dmg
- sha512: x64dmg
- size: 138148807
-path: T3-Code-0.0.4-x64.zip
-sha512: x64zip
-releaseDate: '2026-03-07T10:36:07.540Z'
-`,
- "latest-mac-x64.yml",
- );
-
- const merged = mergeMacUpdateManifests(arm64, x64);
-
- assert.equal(merged.version, "0.0.4");
- assert.equal(merged.releaseDate, "2026-03-07T10:36:07.540Z");
- assert.deepStrictEqual(
- merged.files.map((file) => file.url),
- [
- "T3-Code-0.0.4-arm64.zip",
- "T3-Code-0.0.4-arm64.dmg",
- "T3-Code-0.0.4-x64.zip",
- "T3-Code-0.0.4-x64.dmg",
- ],
- );
-
- const serialized = serializeMacUpdateManifest(merged);
- assert.ok(!serialized.includes("path:"));
- assert.equal((serialized.match(/- url:/g) ?? []).length, 4);
- });
-
- it("rejects mismatched manifest versions", () => {
- const arm64 = parseMacUpdateManifest(
- `version: 0.0.4
-files:
- - url: T3-Code-0.0.4-arm64.zip
- sha512: arm64zip
- size: 1
-releaseDate: '2026-03-07T10:32:14.587Z'
-`,
- "latest-mac.yml",
- );
-
- const x64 = parseMacUpdateManifest(
- `version: 0.0.5
-files:
- - url: T3-Code-0.0.5-x64.zip
- sha512: x64zip
- size: 1
-releaseDate: '2026-03-07T10:36:07.540Z'
-`,
- "latest-mac-x64.yml",
- );
-
- assert.throws(() => mergeMacUpdateManifests(arm64, x64), /different versions/);
- });
-
- it("preserves quoted scalars as strings", () => {
- const manifest = parseMacUpdateManifest(
- `version: '1.0'
-files:
- - url: T3-Code-1.0-x64.zip
- sha512: zipsha
- size: 1
-releaseName: 'true'
-minimumSystemVersion: '13.0'
-stagingPercentage: 50
-releaseDate: '2026-03-07T10:36:07.540Z'
-`,
- "latest-mac.yml",
- );
-
- assert.equal(manifest.version, "1.0");
- assert.equal(manifest.extras.releaseName, "true");
- assert.equal(manifest.extras.minimumSystemVersion, "13.0");
- assert.equal(manifest.extras.stagingPercentage, 50);
- });
-});
diff --git a/scripts/merge-update-manifests.test.ts b/scripts/merge-update-manifests.test.ts
new file mode 100644
index 000000000..33ebacfb0
--- /dev/null
+++ b/scripts/merge-update-manifests.test.ts
@@ -0,0 +1,190 @@
+import { assert, describe, it } from "@effect/vitest";
+
+import {
+ mergePlatformUpdateManifests,
+ parsePlatformUpdateManifest,
+ serializePlatformUpdateManifest,
+} from "./merge-update-manifests.ts";
+
+describe("merge-update-manifests", () => {
+ it("merges arm64 and x64 macOS update manifests into one multi-arch manifest", () => {
+ const arm64 = parsePlatformUpdateManifest(
+ "mac",
+ `version: 0.0.4
+files:
+ - url: T3-Code-0.0.4-arm64.zip
+ sha512: arm64zip
+ size: 125621344
+ - url: T3-Code-0.0.4-arm64.dmg
+ sha512: arm64dmg
+ size: 131754935
+path: T3-Code-0.0.4-arm64.zip
+sha512: arm64zip
+releaseDate: '2026-03-07T10:32:14.587Z'
+`,
+ "latest-mac.yml",
+ );
+
+ const x64 = parsePlatformUpdateManifest(
+ "mac",
+ `version: 0.0.4
+files:
+ - url: T3-Code-0.0.4-x64.zip
+ sha512: x64zip
+ size: 132000112
+ - url: T3-Code-0.0.4-x64.dmg
+ sha512: x64dmg
+ size: 138148807
+path: T3-Code-0.0.4-x64.zip
+sha512: x64zip
+releaseDate: '2026-03-07T10:36:07.540Z'
+`,
+ "latest-mac-x64.yml",
+ );
+
+ const merged = mergePlatformUpdateManifests("mac", arm64, x64);
+
+ assert.equal(merged.version, "0.0.4");
+ assert.equal(merged.releaseDate, "2026-03-07T10:36:07.540Z");
+ assert.deepStrictEqual(
+ merged.files.map((file) => file.url),
+ [
+ "T3-Code-0.0.4-arm64.zip",
+ "T3-Code-0.0.4-arm64.dmg",
+ "T3-Code-0.0.4-x64.zip",
+ "T3-Code-0.0.4-x64.dmg",
+ ],
+ );
+
+ const serialized = serializePlatformUpdateManifest("mac", merged);
+ assert.ok(!serialized.includes("path:"));
+ assert.equal((serialized.match(/- url:/g) ?? []).length, 4);
+ });
+
+ it("merges arm64 and x64 Windows update manifests into one multi-arch manifest", () => {
+ const arm64 = parsePlatformUpdateManifest(
+ "win",
+ `version: 0.0.4
+files:
+ - url: T3-Code-0.0.4-arm64.exe
+ sha512: arm64exe
+ size: 125621344
+ - url: T3-Code-0.0.4-arm64.exe.blockmap
+ sha512: arm64blockmap
+ size: 131754
+path: T3-Code-0.0.4-arm64.exe
+sha512: arm64exe
+releaseDate: '2026-03-07T10:32:14.587Z'
+`,
+ "latest-win-arm64.yml",
+ );
+
+ const x64 = parsePlatformUpdateManifest(
+ "win",
+ `version: 0.0.4
+files:
+ - url: T3-Code-0.0.4-x64.exe
+ sha512: x64exe
+ size: 132000112
+ - url: T3-Code-0.0.4-x64.exe.blockmap
+ sha512: x64blockmap
+ size: 138148
+path: T3-Code-0.0.4-x64.exe
+sha512: x64exe
+releaseDate: '2026-03-07T10:36:07.540Z'
+`,
+ "latest-win-x64.yml",
+ );
+
+ const merged = mergePlatformUpdateManifests("win", arm64, x64);
+
+ assert.equal(merged.version, "0.0.4");
+ assert.equal(merged.releaseDate, "2026-03-07T10:36:07.540Z");
+ assert.deepStrictEqual(
+ merged.files.map((file) => file.url),
+ [
+ "T3-Code-0.0.4-arm64.exe",
+ "T3-Code-0.0.4-arm64.exe.blockmap",
+ "T3-Code-0.0.4-x64.exe",
+ "T3-Code-0.0.4-x64.exe.blockmap",
+ ],
+ );
+
+ const serialized = serializePlatformUpdateManifest("win", merged);
+ assert.ok(!serialized.includes("path:"));
+ assert.equal((serialized.match(/- url:/g) ?? []).length, 4);
+ });
+
+ it("rejects mismatched manifest versions", () => {
+ const primary = parsePlatformUpdateManifest(
+ "win",
+ `version: 0.0.4
+files:
+ - url: T3-Code-0.0.4-arm64.exe
+ sha512: arm64exe
+ size: 1
+releaseDate: '2026-03-07T10:32:14.587Z'
+`,
+ "latest-win-arm64.yml",
+ );
+
+ const secondary = parsePlatformUpdateManifest(
+ "win",
+ `version: 0.0.5
+files:
+ - url: T3-Code-0.0.5-x64.exe
+ sha512: x64exe
+ size: 1
+releaseDate: '2026-03-07T10:36:07.540Z'
+`,
+ "latest-win-x64.yml",
+ );
+
+ assert.throws(
+ () => mergePlatformUpdateManifests("win", primary, secondary),
+ /different versions/,
+ );
+ });
+
+ it("preserves quoted scalars as strings", () => {
+ const manifest = parsePlatformUpdateManifest(
+ "mac",
+ `version: '1.0'
+files:
+ - url: T3-Code-1.0-x64.zip
+ sha512: zipsha
+ size: 1
+releaseName: 'true'
+minimumSystemVersion: '13.0'
+stagingPercentage: 50
+releaseDate: '2026-03-07T10:36:07.540Z'
+`,
+ "latest-mac.yml",
+ );
+
+ assert.equal(manifest.version, "1.0");
+ assert.equal(manifest.extras.releaseName, "true");
+ assert.equal(manifest.extras.minimumSystemVersion, "13.0");
+ assert.equal(manifest.extras.stagingPercentage, 50);
+ });
+
+ it("round-trips numeric-looking versions as strings", () => {
+ const original = parsePlatformUpdateManifest(
+ "win",
+ `version: '1.0'
+files:
+ - url: T3-Code-1.0-x64.exe
+ sha512: exesha
+ size: 1
+releaseDate: '2026-03-07T10:36:07.540Z'
+`,
+ "latest-win-x64.yml",
+ );
+
+ const serialized = serializePlatformUpdateManifest("win", original);
+ assert.ok(serialized.includes("version: '1.0'"));
+
+ const reparsed = parsePlatformUpdateManifest("win", serialized, "latest-win-x64.yml");
+ assert.equal(reparsed.version, "1.0");
+ });
+});
diff --git a/scripts/merge-update-manifests.ts b/scripts/merge-update-manifests.ts
new file mode 100644
index 000000000..1ff74d95e
--- /dev/null
+++ b/scripts/merge-update-manifests.ts
@@ -0,0 +1,91 @@
+import { readFileSync, writeFileSync } from "node:fs";
+import { resolve } from "node:path";
+import { fileURLToPath } from "node:url";
+
+import {
+ mergeUpdateManifests,
+ parseUpdateManifest,
+ serializeUpdateManifest,
+ type UpdateManifest,
+} from "./lib/update-manifest.ts";
+
+export type UpdateManifestPlatform = "mac" | "win";
+
+function getPlatformLabel(platform: UpdateManifestPlatform): string {
+ return platform === "mac" ? "macOS" : "Windows";
+}
+
+export function parsePlatformUpdateManifest(
+ platform: UpdateManifestPlatform,
+ raw: string,
+ sourcePath: string,
+): UpdateManifest {
+ return parseUpdateManifest(raw, sourcePath, getPlatformLabel(platform));
+}
+
+export function mergePlatformUpdateManifests(
+ platform: UpdateManifestPlatform,
+ primary: UpdateManifest,
+ secondary: UpdateManifest,
+): UpdateManifest {
+ return mergeUpdateManifests(primary, secondary, getPlatformLabel(platform));
+}
+
+export function serializePlatformUpdateManifest(
+ platform: UpdateManifestPlatform,
+ manifest: UpdateManifest,
+): string {
+ return serializeUpdateManifest(manifest, {
+ platformLabel: getPlatformLabel(platform),
+ });
+}
+
+function parseArgs(args: ReadonlyArray<string>): {
+ platform: UpdateManifestPlatform;
+ primaryPath: string;
+ secondaryPath: string;
+ outputPath: string;
+} {
+ const [platformFlag, platformValue, primaryPathArg, secondaryPathArg, outputPathArg] = args;
+ if (platformFlag !== "--platform" || (platformValue !== "mac" && platformValue !== "win")) {
+ throw new Error(
+ "Usage: node scripts/merge-update-manifests.ts --platform <mac|win> <primary-path> <secondary-path> [output-path]",
+ );
+ }
+ if (!primaryPathArg || !secondaryPathArg) {
+ throw new Error(
+ "Usage: node scripts/merge-update-manifests.ts --platform <mac|win> <primary-path> <secondary-path> [output-path]",
+ );
+ }
+
+ const primaryPath = resolve(primaryPathArg);
+ const secondaryPath = resolve(secondaryPathArg);
+ const outputPath = resolve(outputPathArg ?? primaryPathArg);
+
+ return {
+ platform: platformValue,
+ primaryPath,
+ secondaryPath,
+ outputPath,
+ };
+}
+
+function main(args: ReadonlyArray<string>): void {
+ const { platform, primaryPath, secondaryPath, outputPath } = parseArgs(args);
+ const primaryManifest = parsePlatformUpdateManifest(
+ platform,
+ readFileSync(primaryPath, "utf8"),
+ primaryPath,
+ );
+ const secondaryManifest = parsePlatformUpdateManifest(
+ platform,
+ readFileSync(secondaryPath, "utf8"),
+ secondaryPath,
+ );
+ const merged = mergePlatformUpdateManifests(platform, primaryManifest, secondaryManifest);
+ writeFileSync(outputPath, serializePlatformUpdateManifest(platform, merged));
+}
+
+if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
+ main(process.argv.slice(2));
+}
diff --git a/scripts/release-smoke.ts b/scripts/release-smoke.ts
index 960730a35..9c4a41510 100644
--- a/scripts/release-smoke.ts
+++ b/scripts/release-smoke.ts
@@ -70,6 +70,48 @@ releaseDate: '2026-03-08T10:36:07.540Z'
return { arm64Path, x64Path };
}
+function writeWindowsManifestFixtures(targetRoot: string): { arm64Path: string; x64Path: string } {
+ const assetDirectory = resolve(targetRoot, "release-assets");
+ mkdirSync(assetDirectory, { recursive: true });
+
+ const arm64Path = resolve(assetDirectory, "latest-win-arm64.yml");
+ const x64Path = resolve(assetDirectory, "latest-win-x64.yml");
+
+ writeFileSync(
+ arm64Path,
+ `version: 9.9.9-smoke.0
+files:
+ - url: T3-Code-9.9.9-smoke.0-arm64.exe
+ sha512: arm64exe
+ size: 126621344
+ - url: T3-Code-9.9.9-smoke.0-arm64.exe.blockmap
+ sha512: arm64blockmap
+ size: 152344
+path: T3-Code-9.9.9-smoke.0-arm64.exe
+sha512: arm64exe
+releaseDate: '2026-03-08T10:32:14.587Z'
+`,
+ );
+
+ writeFileSync(
+ x64Path,
+ `version: 9.9.9-smoke.0
+files:
+ - url: T3-Code-9.9.9-smoke.0-x64.exe
+ sha512: x64exe
+ size: 132000112
+ - url: T3-Code-9.9.9-smoke.0-x64.exe.blockmap
+ sha512: x64blockmap
+ size: 160112
+path: T3-Code-9.9.9-smoke.0-x64.exe
+sha512: x64exe
+releaseDate: '2026-03-08T10:36:07.540Z'
+`,
+ );
+
+ return { arm64Path, x64Path };
+}
+
function assertContains(haystack: string, needle: string, message: string): void {
if (!haystack.includes(needle)) {
throw new Error(message);
@@ -144,7 +186,13 @@ try {
const { arm64Path, x64Path } = writeMacManifestFixtures(tempRoot);
execFileSync(
process.execPath,
- [resolve(repoRoot, "scripts/merge-mac-update-manifests.ts"), arm64Path, x64Path],
+ [
+ resolve(repoRoot, "scripts/merge-update-manifests.ts"),
+ "--platform",
+ "mac",
+ arm64Path,
+ x64Path,
+ ],
{
cwd: repoRoot,
stdio: "inherit",
@@ -163,6 +211,34 @@ try {
"Merged manifest is missing the x64 asset.",
);
+ const { arm64Path: winArm64Path, x64Path: winX64Path } = writeWindowsManifestFixtures(tempRoot);
+ execFileSync(
+ process.execPath,
+ [
+ resolve(repoRoot, "scripts/merge-update-manifests.ts"),
+ "--platform",
+ "win",
+ winArm64Path,
+ winX64Path,
+ ],
+ {
+ cwd: repoRoot,
+ stdio: "inherit",
+ },
+ );
+
+ const mergedWindowsManifest = readFileSync(winArm64Path, "utf8");
+ assertContains(
+ mergedWindowsManifest,
+ "T3-Code-9.9.9-smoke.0-arm64.exe",
+ "Merged Windows manifest is missing the arm64 asset.",
+ );
+ assertContains(
+ mergedWindowsManifest,
+ "T3-Code-9.9.9-smoke.0-x64.exe",
+ "Merged Windows manifest is missing the x64 asset.",
+ );
+
console.log("Release smoke checks passed.");
} finally {
rmSync(tempRoot, { recursive: true, force: true });