ReviewOS

also looking at this

craft-native/craft

feat: add Linux and Windows named-window routing

#325
Merged glennmichael123 wants to merge codex/multi-window-linux-windows into main
29 files +2250 -200

Review threads live on the whole diff, not on one commit, so none are shown here - a thread's line means something in the branch's final form, and painting it into an intermediate step would put it on code it is not about.

.github/workflows/ci.ymlmodified+10-2
Changes to .github/workflows/ci.yml
@@ -112,8 +112,16 @@ jobs:
112112 run: |
113113 # The Pantry .bin shim can print zig version but cannot locate Zig's
114114 # lib directory during a build. Run the locked package binary itself.
115 $env:CRAFT_ZIG = Join-Path $env:GITHUB_WORKSPACE 'pantry/ziglang-org/0.17.0-dev.1963_e00c6c439/bin/zig.exe'
116 if (-not (Test-Path -LiteralPath $env:CRAFT_ZIG)) { throw "Pinned Zig executable missing: $env:CRAFT_ZIG" }
115 $package = Join-Path $env:GITHUB_WORKSPACE 'pantry/ziglang-org/0.17.0-dev.1963_e00c6c439'
116 $env:CRAFT_ZIG = ''
117 foreach ($candidate in @((Join-Path $package 'zig.exe'), (Join-Path $package 'bin/zig.exe'))) {
118 if (Test-Path -LiteralPath $candidate) { $env:CRAFT_ZIG = $candidate; break }
119 }
120 if (-not $env:CRAFT_ZIG) {
121 Get-ChildItem (Join-Path $env:GITHUB_WORKSPACE 'pantry') -Filter zig.exe -Recurse -File |
122 Select-Object -ExpandProperty FullName
123 throw "Pinned Zig executable missing from $package"
124 }
117125 bun run build:core
118126
119127 - name: Stage pinned WebView2 loader
scripts/zig.test.tsmodified+9-2
Changes to scripts/zig.test.ts
@@ -31,11 +31,18 @@ test('accepts only the locked snapshot by default, even when PATH shadows it', (
3131test('Windows uses the pinned Pantry installation instead of its .bin shim', () => {
3232 const f = fixture()
3333 const version = pinnedZigVersion(f.root)
34 const installed = join(f.root, 'pantry/ziglang-org/0.17.0-dev.1963_e00c6c439/bin/zig.exe')
34 const packageDir = join(f.root, 'pantry/ziglang-org/0.17.0-dev.1963_e00c6c439')
35 const installed = join(packageDir, 'zig.exe')
3536 expect(pinnedPantryZigPath(f.root, version, f.env, 'win32')).toBeNull()
36 mkdirSync(join(installed, '..'), { recursive: true })
37 mkdirSync(packageDir, { recursive: true })
3738 writeFileSync(installed, '')
3839 expect(pinnedPantryZigPath(f.root, version, f.env, 'win32')).toBe(installed)
40 const mirrored = join(packageDir, 'bin/zig.exe')
41 mkdirSync(join(packageDir, 'bin'))
42 writeFileSync(mirrored, '')
43 expect(pinnedPantryZigPath(f.root, version, f.env, 'win32')).toBe(installed)
44 rmSync(installed)
45 expect(pinnedPantryZigPath(f.root, version, f.env, 'win32')).toBe(mirrored)
3946 expect(pinnedPantryZigPath(f.root, version, { ...f.env, CRAFT_ZIG: f.path }, 'win32')).toBeNull()
4047 expect(pinnedPantryZigPath(f.root, version, f.env, 'darwin')).toBeNull()
4148})
scripts/zig.tsmodified+7-2
Changes to scripts/zig.ts
@@ -11,8 +11,13 @@ export function pinnedZigVersion(root: string): string {
1111
1212export function pinnedPantryZigPath(root: string, expected: string, env: NodeJS.ProcessEnv, hostPlatform: string): string | null {
1313 if (hostPlatform !== 'win32' || env.CRAFT_ZIG) return null
14 const installed = join(root, 'pantry', 'ziglang-org', expected.replace('+', '_'), 'bin', 'zig.exe')
15 return existsSync(installed) ? installed : null
14 const packageDir = join(root, 'pantry', 'ziglang-org', expected.replace('+', '_'))
15 // The official Windows ZIP has zig.exe at its root; the Pantry registry
16 // mirror can package it under bin/. Both keep Zig's lib directory nearby.
17 for (const installed of [join(packageDir, 'zig.exe'), join(packageDir, 'bin', 'zig.exe')]) {
18 if (existsSync(installed)) return installed
19 }
20 return null
1621}
1722
1823export function resolveZig(root: string, env: NodeJS.ProcessEnv = process.env, hostPlatform = process.platform): { path: string, version: string, overridden: boolean } {