Repository navigation
feat(desktop): Windows build with PowerShell and Git Bash terminal integration - #8696
Thewookie-Eng wants to merge 6 commits into
Conversation
Build the Electron shell on Windows alongside macOS: - Per-arch @lydell/node-pty packages become optionalDependencies, with win32-x64 and win32-arm64 added. electron-builder's bun dependency walk fails on a missing regular dependency but skips a missing optional one. - scripts/ensure-pty-prebuilds.ts picks the arch list from the host platform and checks for conpty.node on Windows. - electron-builder.yml gains win (nsis + zip, x64 + arm64) and nsis sections; scripts/build.ts emits build/generated-icon.png for the .ico. - The agent terminal launches pwsh, then powershell, then COMSPEC on Windows instead of $SHELL, without the POSIX -l flag. - macOS-only hide menu roles are gated; setAppUserModelId is set per channel on Windows. - README documents the Windows build and its parity gaps (no auto-update, no Help search, no Chrome import, uninstrumented PowerShell). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The agent terminal was refused with NO_SHELL_INTEGRATION on Windows because prompt hooks existed only for zsh and bash. PowerShell now gets the same OSC 633 markers: `prompt` reports the directory, previous exit code and prompt start, and `PSConsoleHostReadLine` reports each command line and its start, as Windows Terminal and VS Code do. The hooks travel as -EncodedCommand because dot-sourcing a file is blocked by the default execution policy on Windows clients, and ReadLine is called with two arguments only: PSReadLine 2.0's third parameter is a CancellationToken, and a bool coerces to a cancelled one, which made the prompt loop. Git for Windows' bash is offered through a Windows-only Terminal Shell submenu when Git is installed; the existing bash hooks work there, with cygpath translating the reported directory to a Windows path. The choice persists as `terminalShell` in settings. Also: the marker parser unescapes `\\` so Windows paths survive the hooks' escaping, tab titles split on either separator, tmux probing is skipped on Windows, and detectShell recognises `.exe` names on any host. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The desktop suite is run by CI on macOS, where it passes; on Windows 19 tests failed for reasons in the host rather than the code under test. - 15 tests are skipped on win32: eleven build their fixture with symlink(), which Windows refuses without Developer Mode or elevation, and four assert POSIX mode bits (0o600/0o700) that Windows does not have. - Three path expectations were hard-coded with `/`; they now go through path.join or basename, matching the implementation. - The microphone-settings ipc test expected a settings pane only on macOS, but the handler has carried a Windows ms-settings URL since it was written. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
@Thewookie-Eng is attempting to deploy a commit to the Sim Team on Vercel. A member of the Team first needs to authorize it. |
|
Three of the win32 skips covered more than the platform-specific check. The encryption assertions, the unknown-mount, directory, size-limit and missing-path checks are now their own tests that run everywhere; only the symlink fixtures and the POSIX mode-bit assertion stay skipped. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…t/desktop-windows
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Summary
Builds and runs the desktop shell on Windows alongside macOS, with a working agent terminal.
The shell was already a thin Electron wrapper with most platform-specific code behind
process.platformguards, so the port is small. Three commits, each reviewable on its own:feat(desktop): add Windows packaging and runtime support@lydell/node-pty-*packages move tooptionalDependencies(pluswin32-x64/win32-arm64). electron-builder's bun dependency walk fails on a missing regular dependency but skips a missing optional one, so this is what lets onepackage.jsonpackage both platforms.scripts/ensure-pty-prebuilds.tspicks the arch list from the host platform; the Windows addon isconpty.node, notpty.node.electron-builder.ymlgainswin(nsis + zip, x64 + arm64) andnsissections;scripts/build.tsemitsbuild/generated-icon.pngfrom the same 1024px logo the macOS.iconbundle uses.pwsh→powershell.exe→COMSPECon Windows instead of$SHELL, without the POSIX-lflag. macOS-only hide menu roles are gated (they render as blank rows on Windows);setAppUserModelIdis set per channel.feat(desktop): shell integration for PowerShell and Git Bash on Windowspromptreports cwd, previous exit code and prompt start;PSConsoleHostReadLinereports the command line and its start. This is the arrangement Windows Terminal and VS Code use. Without it the agent was refused withNO_SHELL_INTEGRATION.-EncodedCommand: dot-sourcing a file is blocked by the default execution policy on Windows clients, and lowering it for the shell would loosen it for everything the user runs there.ReadLineis called with two arguments only. In PSReadLine 2.0 (Windows PowerShell 5.1) the third parameter is aCancellationToken; a bool coerces to a cancelled one and the prompt loops.System32\bash.exeis the WSL launcher). The existing bash hooks work there;cygpath -wtranslates the reported cwd. Persisted asterminalShell.\\so Windows paths survive the hooks' escaping; tmux probing is skipped on Windows;detectShellrecognises.exenames on any host.test(desktop): make the unit suite pass on a Windows host— 15 tests skipped onwin32(11 build fixtures withsymlink(), which needs Developer Mode or elevation; 4 assert POSIX mode bits), 3 path expectations go throughpath.join/basename, and the microphone-settings ipc test now expects the Windowsms-settings:URL the handler has always had. No change on macOS.Not in scope, documented in the README as Windows parity gaps: auto-update (
initUpdaterstays a no-op off macOS), Help-menu docs search, Chrome cookie/password import, Terminal.app/iTerm2 theme import, and code signing (unsigned builds trigger SmartScreen;CSC_LINK/CSC_KEY_PASSWORDwork as on macOS). CI is unchanged —desktop-release.ymlstill builds macOS only; a Windows job can follow if this is wanted.Type of Change
Testing
On Windows 11 (10.0.26300), Bun 1.4.2, Node 24, no C++ toolchain:
bun run package:win:dirandbun run package:winproducerelease/win-unpacked/Sim.exeandSim-<version>-x64.exe(NSIS). The packaged app launches, loads the hosted origin, and completes the system-browser sign-in handoff (handoff_redeem_okin the event log).Shell integration was exercised under a real ConPTY with the production launch args and parser, for both shells:
Ecommand-line markersDexit codes0, 0, 3, 3Pcwd aftercdC:\WindowsC:\Windows(via cygpath)apps/desktop:type-check,lint:checkclean;bun run test72/72 files, 860 passed, 16 skipped on this host.macOS: not re-verified by me — the mac packaging config is untouched apart from the
optionalDependenciesmove, andensure-pty-prebuilds.tskeeps the same two darwin arches. A maintainer runningbun run package:diron a Mac once would be the one thing worth confirming.Reviewers may want to focus on: the
optionalDependenciesmove (any effect on the universal build'sx64ArchFileshandling), the PowerShell script inshell-integration.ts, and whether a native app-menu submenu is the right surface for the shell choice versus a web-app setting throughdesktop-bridge.Known limitation: when a PowerShell cmdlet fails (as opposed to a native program), the reported exit code can be a stale
$LASTEXITCODE. VS Code has the same behaviour.Checklist
Screenshots/Videos
n/a — no UI changes to the web app; the only new UI is a native Windows app-menu submenu (Terminal Shell → PowerShell / Git Bash).
🤖 Generated with Claude Code