Skip to content

Add Windows desktop support and fix compiler PATH discovery - #13

Open
blessedcursed wants to merge 3 commits into
PapilotAI:mainfrom
blessedcursed:feat/windows-desktop
Open

blessedcursed wants to merge 3 commits into
PapilotAI:mainfrom
blessedcursed:feat/windows-desktop

Conversation

@blessedcursed

Copy link
Copy Markdown

Papilot desktop can now be packaged and run on Windows, including a native installer, Windows process handling, and Codex executable discovery/bootstrap.

Fixes compiler discovery when Windows supplies Path instead of PATH. Previously the desktop backend could lose the TeX Live directory or send conflicting environment keys, reporting “xelatex was not found” even with a working installation. The launcher now preserves inherited path entries and emits one canonical PATH key on Windows.

Validation:

  • npm run typecheck passed.
  • Windows PATH regression test passed (node --import tsx --test tests/desktop-runtime.test.ts).
  • On the installed Windows app, normalizing PATH allowed the imported XeLaTeX manuscript to compile to 12 pages with no build errors.

Artem added 3 commits November 1, 2026 20:33
Resolve npm shims to the native Codex executable for startup and diagnostics. Invoke npm through Node on Windows so automatic installation does not require a shell.
Package Node and Codex for Windows, use file URLs for the backend loader, and resolve Git with where.exe. Add a native Electron startup and demo PDF smoke check.
@cu1ch3n

cu1ch3n commented Nov 2, 2026

Copy link
Copy Markdown
Member

Thanks for this, the PATH/Path fix looks right. A few things before merging:

1. macOS/Linux behavior must not change. codexExecutable() is also used on Unix (paths.ts, doctor.mjs), and there it returns the first codex on PATH that merely exists, fixed at startup. Previously spawn('codex') and doctor's executable() skipped entries that weren't executable. If a directory or a non-executable codex comes earlier on PATH, the desktop app now fails with EACCES. Please keep the Windows changes behind process.platform === 'win32' and leave the existing Unix code as it was, including the new recent(downloaded) check in papilot.mjs. Also, the second test in tests/codex-executable.test.ts fails on macOS because the temp dir is a symlink (/var → /private/var). Calling fs.realpathSync on it fixes that.

2. The same Windows issues remain in other places:

  • src/server/agents.ts:135 still calls execFile('npm', …), so the Claude/Cursor SDKs can't be installed on Windows.
  • loaderFor() in src/server/update-install.ts still passes a raw path to --import, so updates fail on Windows.
  • doctor's executable() doesn't try .exe, so papilot doctor reports git and latexmk as missing.

3. Stopping processes on Windows:

  • In desktop/runtime.ts, stop() sends SIGTERM, which is a hard kill on Windows, so the backend's cleanup never runs. Calling child.disconnect() first triggers the existing shutdown handler.
  • In vendor/latex-review/src/core/process.ts, a timeout kills only latexmk and leaves xelatex holding file locks. taskkill /pid <pid> /T /F kills the whole tree.

This branch has not been deployed

No deployments
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.

2 participants