Post-write .js/.ts lint on the local backend runs PM's node/npx instead of the terminal shell's PATH (user dirs first). pm.activate always puts the store dirs in front, also on drift, activating only packages whose whole chain is installed. tui_gateway puts the store dirs ahead of ~/.local/bin. Bare npx/npm/node/uv/uvx MCP commands resolve to PM's copies; the system fallback tables are gone and an absolute command: stays the user's.
44 lines
1.3 KiB
Python
44 lines
1.3 KiB
Python
"""Directories where tools install outside PATH, grouped by the ecosystem that owns them.
|
|
|
|
Every table in Hermes lives here. A directory literal outside this module fails the ratchet in
|
|
`tests/test_managed_runtime_resolution.py`. Each table is empty on an OS where the ecosystem
|
|
does not install there, so callers compose tables without OS branches.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
|
|
_POSIX = sys.platform != "win32"
|
|
_WIN = sys.platform == "win32"
|
|
|
|
|
|
def homebrew_dirs() -> tuple[str, ...]:
|
|
return ("/opt/homebrew/bin", "/usr/local/bin") if sys.platform == "darwin" else ()
|
|
|
|
|
|
def user_local_bin() -> tuple[str, ...]:
|
|
return ("~/.local/bin",) if _POSIX else ("%USERPROFILE%/.local/bin",)
|
|
|
|
|
|
def rust_tool_dirs() -> tuple[str, ...]:
|
|
return ("~/.cargo/bin",) if _POSIX else ("%USERPROFILE%/.cargo/bin",)
|
|
|
|
|
|
def node_tool_dirs() -> tuple[str, ...]:
|
|
return ("~/.npm-global/bin", "~/.bun/bin", "~/.volta/bin") if _POSIX else ("%APPDATA%/npm", "%USERPROFILE%/.bun/bin", "%LOCALAPPDATA%/Volta/bin")
|
|
|
|
|
|
def hermes_vendored_dirs() -> tuple[str, ...]:
|
|
return ("~/.hermes/bin",) if _POSIX else ("%USERPROFILE%/.hermes/bin",)
|
|
|
|
|
|
def windows_user_program_dirs() -> tuple[str, ...]:
|
|
if not _WIN:
|
|
return ()
|
|
return (
|
|
"%LOCALAPPDATA%/Programs",
|
|
"%USERPROFILE%/scoop/shims",
|
|
"%LOCALAPPDATA%/Microsoft/WinGet/Links",
|
|
)
|