fix(install): stop mise-node shadowing + JS CLI duplicate sprawl - #21
Draft
yulonglin wants to merge 1 commit into
Draft
fix(install): stop mise-node shadowing + JS CLI duplicate sprawl#21yulonglin wants to merge 1 commit into
yulonglin wants to merge 1 commit into
Conversation
Audit on the Linux box found `npm` resolving 4 ways (socket alias, mise node 24, distro /usr/bin/npm 9.2, usr-merge dup) and `codex` installed 4 times, with the PATH winner (~/.npm-global, 0.144.5) shadowing the bun copy the daily updater maintained — so updates silently never took effect. Root causes and fixes: - install_node's skip-guard read `node -v` from PATH, so a mise-installed node 24 masked the stock Ubuntu node 18 forever (NodeSource repo was configured, candidate 24.18.0 never installed). Guard now checks the system node via system_node_path() (/usr/bin/node, brew paths), and evict_mise_node() converges any mise-managed node out once a healthy system node exists (mise unuse -g + mise uninstall --all; flags verified against mise --help). - update-ai-tools updated the bun copy blind to PATH shadowing. New dedupe_bun_shadows() removes ~/.npm-global/bin duplicates after each bun update (via npm uninstall -g with explicit prefix) and flags root-owned strays in /usr/local/bin for manual sudo removal. - CLAUDE.md: document system-node guard, mise eviction, and the "one home per JS CLI = bun global" convention; Learnings entry records the audit, incl. that bun add -g lags npm ~7 days by design (bunfig minimumReleaseAge quarantine), so bun-vs-npm version gaps are not bugs. Claude-Session: https://claude.ai/code/session_01XNuZxDGsWjB5rMwHKUAYai
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Problem
Audit on the Linux box (2026-07-19) found the JS toolchain had drifted into duplicate sprawl:
npmresolved 4 ways:socket npmalias → mise node 24.18.0 (~/.local/share/mise) → distro/usr/bin/npm9.2 →/bin/npmusr-merge dup. Plus an orphaned mise node 20.20.0.codexinstalled 4 times:~/.npm-global/bin(0.144.5, wins on PATH) →~/.bun/bin(0.144.1, the one the daily updater maintains) →~/.local/binnative standalone (0.144.3) → stale root-owned/usr/local/bin(Jan 2026).Root causes
install_node's skip-guard readnode -vfrom PATH, so a mise-installed node 24 (manual drift — the repo convention says node is NodeSource/brew, never mise) satisfied the guard forever and the apt node never got upgraded.update-ai-toolsrunsbun add -gblind to PATH shadowing:~/.npm-global/binprecedes~/.bun/bin, so daily codex updates silently never took effect.Fixes
system_node_path(): guard now checks the system node (/usr/bin/node, brew paths) — the one cron/systemd/shebangs actually resolve.evict_mise_node(): converges any mise-managed node out (mise unuse -g+mise uninstall --all, flags verified againstmise --help), but only once a healthy system node exists so it never deletes the box's only modern node.dedupe_bun_shadows()inupdate-ai-tools: after each bun update, removes~/.npm-global/binduplicates (vianpm uninstall -gwith explicit prefix;~/.npm-globalremains the home for socket-cli only) and flags root-owned/usr/local/binstrays for manual sudo removal.bun add -g X@latestlagging npm by ~7 days is the bunfigminimumReleaseAgequarantine working as intended, not a bug.Not in this PR (needs sudo on the box)
Verdict on "retire mise?": no — mise correctly owns the 14+ fast-moving CLI tools (fzf, bat, rg, delta…) that apt ships years stale. The problem was node leaking into mise and JS CLIs having three homes; this PR enforces one owner per tool class instead.
https://claude.ai/code/session_01XNuZxDGsWjB5rMwHKUAYai