Skip to content

feat: Add Windows support #1242

Open
littlekirkycode wants to merge 15 commits intoPostHog:mainfrom
littlekirkycode:feat/windows-support
Open

feat: Add Windows support #1242
littlekirkycode wants to merge 15 commits intoPostHog:mainfrom
littlekirkycode:feat/windows-support

Conversation

@littlekirkycode
Copy link
Contributor

Closes #1241

Adds Windows support for the desktop app — dev workflow, packaging, and native platform integration.

Changes

  1. Cross-platform build scripts (pnpm-run.mjs, rimraf.mjs) so pnpm dev works on Windows
  2. External apps detection rewritten with per-platform paths for editors, terminals, and file managers
  3. Shell service handles PowerShell/pwsh instead of assuming Unix login shell
  4. Window title bar uses titleBarOverlay on Windows, hiddenInset on macOS
  5. Fallback timeout for ready-to-show which fails to fire in packaged Windows builds
  6. Notifications use flashFrame() on Windows instead of dock badge
  7. Squirrel installer for Windows builds, platform-specific native dependency copying
  8. CI release workflow for Windows (publish-windows job)
  9. node-pty patch for Windows compatibility

Testing

  • pnpm dev runs on Windows
  • pnpm --filter code make produces working Squirrel installer
  • Installed app launches and renders correctly on Windows
  • External apps detection finds installed Windows editors/terminals
  • No regressions on macOS — dev and build still work
  • Typecheck and lint pass

littlekirkycode and others added 5 commits March 14, 2026 06:55
- Patch node-pty to fix .bat file resolution and disable Spectre-mitigated
  libs requirement on Windows (pnpm patch)
- Add cross-platform rimraf.mjs to replace rm -rf in package scripts
- Add pnpm-run.mjs wrapper for mprocs (CreateProcessW can't exec .cmd files)
- Add @electron-forge/maker-squirrel for Windows installer support

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add MakerSquirrel for Windows builds (replaces ZIP on win32) and fix
a bug where the packaged app window never becomes visible because
ready-to-show fails to fire. A 3s fallback timeout ensures the window
always appears.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jonathanlab
Copy link
Contributor

👀 I'll take a look at this on my Windows PC later today!

@jonathanlab
Copy link
Contributor

jonathanlab commented Mar 16, 2026

Did some quick tests here, I ran into some issues:

  • Files opened via the file explorer had the wrong path passed in, meaning it would not load. E.g. it'd load as C:\dev\twig/C:\dev\twig\README.md
  • Windows OS buttons (Close/Minimize/Maximize) in the top right are not well integrated with the UI yet. It's currently overlapping with the git actions button.
  • Fonts are not loading.

I've not tested the git workflows yet, nor some of the more nitty gritty stuff w.r.t. the claude code sdk/the .posthog-code folder, but a lot seems to just work as expected, which is great!

@littlekirkycode
Copy link
Contributor Author

Awesome sauce - glad most was working as expected and thanks again for taking the time to review.

I'll look into and fix the issues you mentioned, and take a deeper look to confirm 'git workflows, w.r.t. the claude code sdk/the .posthog-code folder' is all working before you look again.

I'll pop another comment in here when that's finished so you get notified.

littlekirkycode added 5 commits March 16, 2026 17:52
\Extract cross-platform isAbsolutePath() and toRelativePath() utilities to handle both Unix and Windows path formats. Fixes file explorer opening paths like C:\dev\twig/C:\dev\twig\README.md by correctly detecting Windows absolute paths and normalizing path separators.
Add isWindows platform detection and reserve 140px right padding on the header row to avoid the native Close/Minimize/Maximize buttons covering the git interaction controls.
Change @font-face url paths from absolute (/assets/fonts/) to relative (./assets/fonts/) so they resolve correctly when loaded via the file:// protocol in packaged Electron builds. Same fix pattern as the hedgehog mode asset fix.
  Use junction type for symlinks on Windows (no admin required). Use
  path.basename() for cross-platform filename extraction from URIs.
  Normalize gitdir paths with path.resolve() for mixed separators.

  Fix font loading by using relative paths from CSS to font files so Vite
  resolves and bundles them into production builds correctly, rather than
  relying on absolute /assets/ paths that break under file:// protocol.
Use junctions for directories and hard links for files on Windows instead of symlinks, matching pnpm/Deno approach — no admin or Developer Mode required. Use path.basename() for cross-platform filename extractionfrom URIs. Normalize gitdir paths with path.resolve() for mixed separators.
Fix font loading by using relative paths from CSS to font files so Vite resolves and bundles them into production builds correctly.
@littlekirkycode
Copy link
Contributor Author

littlekirkycode commented Mar 16, 2026

1. Fix file path doubling on Windows

Files: utils/path.ts, usePanelLayoutHooks.tsx, FileMentionChip.tsx, FileTreePanel.tsx,
useFileWatcher.ts, prompt-builder.ts

Created shared isAbsolutePath() and toRelativePath() utilities that handle both Unix (/path)
and Windows (C:\path) formats. Fixed 5 files that assumed Unix-only paths — either using
.startsWith("/") to detect absolute paths or .replace(`${repoPath}/`, "") which fails with
backslash separators.

2. Prevent Windows title bar buttons overlapping git actions

Files: platform.ts, HeaderRow.tsx

Added isWindows platform detection and reserved 140px right padding on the header row so native
Close/Minimize/Maximize buttons don't cover the git interaction controls.

3. Fix fonts not loading in packaged builds

Files: globals.css

Changed @font-face URL paths from absolute (/assets/fonts/...) to relative from the CSS file
(../../../assets/fonts/...). This lets Vite resolve and bundle the fonts into production builds
correctly, rather than relying on absolute paths that break under the file:// protocol.

4. Windows compatibility for symlinks, paths, and URI parsing

Files: utils.ts (git package), acp-to-sdk.ts (agent package), workspace/service.ts,
file-watcher/service.ts

  • Symlinks: On Windows, use junctions for directories and hard links for files instead of
    symlinks — no admin or Developer Mode required. Matches the approach used by pnpm, Deno, and npm.
    Falls back to copy if hard link fails (cross-drive).
  • URI parsing: Use path.basename() instead of .split("/").pop() for cross-platform filename
    extraction.
  • Gitdir paths: Normalize with path.resolve() so mixed separators from git's internal .git
    file references work correctly on Windows.

@jonathanlab (sorry had forgotten to tag you yesterday)

@jonathanlab
Copy link
Contributor

Thank you, I'll give this a look tomorrow morning! <3

Copy link
Contributor

@jonathanlab jonathanlab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM for now, ran into no issues today, except for some minor qol stuff like the context menus and confirmation windows created by windows are ugly, we should probably eventually roll our own here like other editors do. Awesome stuff!

Left a stamp, feel free to merge!

littlekirkycode and others added 2 commits March 18, 2026 13:43
- Resolve forge.config.ts conflict: keep Windows platform guard while
  adopting upstream's simplified asset generation checks
- Fix stale pnpm-lock.yaml: remove orphaned maker-squirrel reference
  that broke frozen-lockfile install in CI
- Fix globals.css formatting: split inline format() onto its own line
  to satisfy biome formatter
- Add biome-ignore comments for noNonNullAssertion in suspension
  service and agent test (pre-existing lint issues from main)
- Fix noExplicitAny in analytics.ts: Record<string, any> → unknown
@hyerland
Copy link

Any update on this PR? Would love to test Posthog Code on Windows.

littlekirkycode and others added 3 commits March 19, 2026 16:39
- Add @electron-forge/maker-squirrel to devDependencies (fixes build + integration-test)
- Use env variable instead of inline step output interpolation in release workflow (fixes Semgrep shell-injection finding)
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.

feat: Add Windows support

3 participants