Discover CLIs installed via mise, asdf, volta, bun, pnpm#27
Open
wook95 wants to merge 1 commit intoaroido:mainfrom
Open
Discover CLIs installed via mise, asdf, volta, bun, pnpm#27wook95 wants to merge 1 commit intoaroido:mainfrom
wook95 wants to merge 1 commit intoaroido:mainfrom
Conversation
The candidate executable list and shell fallback were both blind to
runtime version managers that put binaries outside the existing
hardcoded directories. When tokenmon launches as a GUI app, its
inherited PATH typically lacks the entries those managers add through
.zshrc, so executables installed via mise (~/.local/share/mise/installs/
node/<ver>/bin/<name> with shims at ~/.local/share/mise/shims/),
asdf (~/.asdf/shims/), volta (~/.volta/bin/), bun (~/.bun/bin/), or
pnpm (~/Library/pnpm/) were not discovered and the provider showed as
missing even though the CLI was installed.
Two fixes:
- Add the well-known shim/bin directories of mise, asdf, volta, bun,
and pnpm to the static candidate list, plus enumerate
~/.local/share/mise/installs/node/<version>/bin so we still find
the binary when the shim is absent.
- Try the user's shell with -ilc before -lc when falling back to
'command -v'. Login-only shells skip .zshrc, where mise/asdf
activation typically lives, so a GUI-launched lookup misses those
PATH additions. Output parsing now picks the last absolute path on
stdout to ignore MOTD or prompt banners that interactive shells
sometimes emit.
Adds focused tests covering the new candidate paths and the version
enumeration helper.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On macOS with
codexinstalled via mise (~/.local/share/mise/installs/node/24.12.0/bin/codex, shimmed at~/.local/share/mise/shims/codex), the menu bar showed Codex as missing even though the CLI worked fine in the terminal.Two things were going on:
candidateExecutablePathswalks a fixed list — homebrew,/usr/local/bin,~/.local/bin, npm-global, yarn — but nothing for mise/asdf/volta or the increasingly common bun and pnpm installs. So nothing in the static list matched.The shell fallback then runs
/bin/zsh -lc 'command -v codex', which is a login non-interactive shell. That skips.zshrc, whereeval "$(mise activate zsh)"typically lives, so the lookup misses every binary mise/asdf hands out via.zshrcactivation. From a GUI launch the inherited PATH is sparse (no terminal session has touched it), so this fails too.env -i /bin/zsh -lc 'command -v codex'reproduces the empty result.The fix:
~/.local/share/mise/installs/node/<ver>/bindirectly so we still resolve the binary if the shim layer is missing.-ilcbefore-lcwhen shelling out tocommand -v. Interactive shells can leak prompt/MOTD output, so I take the last line on stdout that starts with/instead of trusting the whole capture.Added three tests in
TokenmonProviderDiscoveryTests. They exercise the new candidate paths, the version enumeration helper, and the empty-installs-root case.swift buildand the filtered test run pass on my machine; verified end-to-end against the real mise install that was failing before.