Skip to content

fix: add pnpm/yarn/bun global bin paths and resolve claude CLI for GUI-launched apps#649

Merged
Jinwoo-H merged 1 commit into
mainfrom
Jinwoo-H/pnpm-codex-fix
Apr 14, 2026
Merged

fix: add pnpm/yarn/bun global bin paths and resolve claude CLI for GUI-launched apps#649
Jinwoo-H merged 1 commit into
mainfrom
Jinwoo-H/pnpm-codex-fix

Conversation

@Jinwoo-H

Copy link
Copy Markdown
Contributor

Summary

  • Generalize resolveCodexCommand() into a shared resolveCommand() helper, export new resolveClaudeCommand() for the Claude CLI
  • Add pnpm, yarn, and bun global bin directories to the version manager probe so users who installed Codex/Claude via these package managers are found in GUI-launched Electron apps
  • Wire claude-pty.ts to use resolveClaudeCommand() instead of bare 'claude' — fixes the same PATH-inheritance bug that was already fixed for Codex
  • Simplify Windows PTY spawn in both claude-pty.ts and codex-fetcher.ts to always route through cmd.exe on win32, fixing the bare-command PATHEXT fallback edge case

Subsumes and closes #638.

New paths probed

Package manager macOS Linux Windows
pnpm ~/Library/pnpm ~/.local/share/pnpm AppData/Local/pnpm
yarn ~/.yarn/bin ~/.yarn/bin AppData/Local/Yarn/bin
bun ~/.bun/bin ~/.bun/bin ~/.bun/bin

Test plan

  • All 1526 existing + new tests pass
  • Verify Codex usage tracking works when codex installed via pnpm/yarn/bun
  • Verify Claude usage tracking works when claude installed via pnpm/yarn/bun
  • Verify no regressions on macOS (GUI-launched app)
  • Verify Windows PTY spawn works with bare command fallback

…I-launched apps

GUI-launched Electron apps don't inherit shell PATH, so spawning bare
'codex' or 'claude' fails for users who installed via pnpm, yarn, or bun.

- Generalize resolveCodexCommand() into a shared resolveCommand() that
  works for any CLI name, and export resolveClaudeCommand() alongside it
- Add pnpm global bin dirs (macOS ~/Library/pnpm, Linux ~/.local/share/pnpm,
  Windows AppData/Local/pnpm)
- Add yarn global bin dirs (~/.yarn/bin, Windows AppData/Local/Yarn/bin)
- Add bun global bin (~/.bun/bin on all platforms)
- Wire claude-pty.ts to use resolveClaudeCommand() instead of bare 'claude'
- Simplify Windows PTY spawn to always route through cmd.exe on win32,
  fixing the bare-command PATHEXT fallback edge case (subsumes #638)

Closes #638
@Jinwoo-H Jinwoo-H merged commit a913d7f into main Apr 14, 2026
1 check passed
@Jinwoo-H Jinwoo-H deleted the Jinwoo-H/pnpm-codex-fix branch April 14, 2026 19:32
Jinwoo-H added a commit that referenced this pull request Apr 16, 2026
GUI-launched Electron apps inherit a minimal PATH that excludes Node
version manager directories (nvm, volta, asdf, fnm, pnpm, yarn, bun,
mise). PR #649 fixed *finding* the codex binary in these directories,
but spawning it still failed because the codex script's shebang
(#!/usr/bin/env node) couldn't locate node.

Augment patchPackagedProcessPath() with version manager bin paths so
node is discoverable for all spawn sites (login, rate limits, usage).
Also improve the ENOENT error message to distinguish "CLI not found"
from "CLI found but node missing" and add mise shims support.

Closes #589
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