Skip to content

feat: Windows support via Node polyfill layer#46

Open
antiresonant wants to merge 1 commit intogarrytan:mainfrom
antiresonant:feat/windows-support
Open

feat: Windows support via Node polyfill layer#46
antiresonant wants to merge 1 commit intogarrytan:mainfrom
antiresonant:feat/windows-support

Conversation

@antiresonant
Copy link

@antiresonant antiresonant commented Mar 14, 2026

Summary

gstack is built for macOS, but Bun on Windows can't launch Playwright browsers — both IPC pipe and WebSocket transports fail. This PR adds automatic Windows detection so everything works out of the box.

  • On Windows, the CLI spawns the browse server via Node + tsx instead of bun run, with a polyfill layer for Bun-specific APIs (Bun.serve, Bun.write, Bun.file, Bun.spawn, etc.)
  • On macOS/Linux, zero changes — all Windows logic is behind process.platform === 'win32' checks
  • Setup script now works from any directory (auto-symlinks into ~/.claude/skills/), detects Windows, and provides Defender exclusion guidance if Chromium fails to launch

What's changed

File Change
browse/src/bun-polyfill-win.ts New — Node polyfills for Bun.serve, Bun.write, Bun.file, Bun.sleep, Bun.spawn, Bun.spawnSync
browse/src/server-node.ts New — Node entry point: loads polyfills then imports server
browse/src/cli.ts Windows path detection (C:\ prefix), spawns server via npx tsx on Windows
browse/src/server.ts import.meta.dir fallback to import.meta.dirname for Node
browse/src/cookie-import-browser.ts Conditional bun:sqlite import (graceful degradation)
package.json Added tsx dep, removed rm -f .*.bun-build (glob fails on Windows)
setup Cross-platform: auto-symlinks from any location, Defender guidance, Node check
WINDOWS.md Setup guide + architecture docs for Windows users

Limitation

cookie-import-browser (importing cookies from installed browsers via bun:sqlite) is unavailable on Windows. cookie-import <json-file> works fine.

Test plan

  • bun run build succeeds on Windows
  • bun run dev goto https://example.com — navigates and returns 200
  • bun run dev snapshot — returns accessibility tree
  • Compiled browse.exe binary works end-to-end
  • Non-browser tests pass (config, cookie-import-browser, cookie-picker-routes, skill-validation)
  • Verify no regression on macOS (all changes are behind win32 checks)

Tested on Windows 11 Pro (10.0.26200), Bun 1.2.18, Node 22.17.0, Playwright 1.58.2.

🤖 Generated with Claude Code

Bun on Windows cannot launch Playwright browsers (both IPC pipe and
WebSocket transports fail). This adds automatic Windows detection that
runs the browse server via Node+tsx instead, with a polyfill layer for
Bun-specific APIs (Bun.serve, Bun.write, Bun.file, Bun.spawn, etc.).

Changes:
- Add bun-polyfill-win.ts: Node-compatible Bun API polyfills
- Add server-node.ts: Node entry point that loads polyfills + server
- cli.ts: detect Windows paths, spawn server via tsx on win32
- server.ts: import.meta.dir fallback for Node compatibility
- cookie-import-browser.ts: conditional bun:sqlite import
- setup: cross-platform (auto-symlinks from any location, Defender
  guidance, Node prerequisite check on Windows)
- package.json: add tsx dep, fix build script glob on Windows
- WINDOWS.md: setup guide and architecture docs

Tested end-to-end on Windows 11 with Bun 1.2.18 + Node 22.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant