Skip to main content

augmented_node_path

Function augmented_node_path 

Source
pub fn augmented_node_path() -> String
Expand description

A PATH that resolves Node-based CLIs (bob, claude, codex) even from a process launched by Finder/Launchpad, which inherits only the minimal launchd PATH (/usr/bin:/bin:/usr/sbin:/sbin) rather than the user’s shell PATH.

Strategy: keep the process’s own PATH first (an explicit PATH still wins), then append the user’s real PATH as resolved by their login shell — which sources their rc, so it knows where nvm / pnpm / volta / asdf / fnm / Homebrew put node, with no guessing. If the shell query is unavailable (no $SHELL, a timeout, a sandboxed app that can’t spawn, …) we fall back to a hardcoded best-effort list, so we’re never worse than before.

Used by the run path (which prepends the resolved binary’s own dir on top of this) and by readiness probes that locate claude/codex via a bare Command::new(name). Computed once and cached for the process — the (bounded) shell spawn happens at most once per launch, lazily on the first readiness/run/login, never at construction.