Skip to content

Commit 978b3d7

Browse files
AI Assistantclaude
andcommitted
fix(path-check): validate RC file configuration instead of subprocess PATH
Check if package managers are configured in shell RC file rather than checking if they're in the current subprocess PATH. This prevents false positives when tools are properly configured but subprocess doesn't inherit shell environment. - Add is_configured_in_rc() helper to check RC file directly - Apply RC file check universally (not just for nvm) - Change warning message to clarify RC file vs PATH distinction - Fixes false "missing from PATH" warnings for properly configured tools 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 85a04c6 commit 978b3d7

File tree

3 files changed

+33
-12
lines changed

3 files changed

+33
-12
lines changed

latest_versions.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"gh:mikefarah/yq": "latest_redirect",
3333
"gh:mvdan/sh": "latest_redirect",
3434
"gh:ninja-build/ninja": "latest_redirect",
35-
"gh:nodejs/node": "latest_redirect",
35+
"gh:nodejs/node": "releases_api",
3636
"gh:phiresky/ripgrep-all": "latest_redirect",
3737
"gh:prettier/prettier": "latest_redirect",
3838
"gh:profclems/glab": "latest_redirect",
@@ -44,7 +44,7 @@
4444
"gh:sharkdp/bat": "latest_redirect",
4545
"gh:sharkdp/fd": "latest_redirect",
4646
"gh:tummychow/git-absorb": "latest_redirect",
47-
"gh:universal-ctags/ctags": "releases_api",
47+
"gh:universal-ctags/ctags": "latest_redirect",
4848
"gh:wagoodman/dive": "latest_redirect",
4949
"gh:watchexec/watchexec": "latest_redirect",
5050
"local_dc:docker-compose": "plugin",

scripts/lib/path_check.sh

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,34 +107,55 @@ declare -A PATH_REQUIREMENTS=(
107107
# Priority order rules: lower number = should come earlier in PATH
108108
# This ensures language version managers take precedence over system packages
109109

110+
# Check if a tool is properly configured in RC file
111+
is_configured_in_rc() {
112+
local init_cmd="$1"
113+
local rc_file
114+
rc_file=$(detect_shell_rc)
115+
116+
# Extract first significant line from init command
117+
local first_line
118+
first_line=$(echo -e "$init_cmd" | head -1)
119+
120+
# Check if it's in the RC file
121+
grep -qF "${first_line}" "$rc_file" 2>/dev/null
122+
}
123+
110124
# Check a single PATH requirement
111125
check_path_requirement() {
112126
local name="$1"
113127
local requirement="${PATH_REQUIREMENTS[$name]}"
114-
128+
115129
IFS='|' read -r dir init_cmd description priority <<< "$requirement"
116-
130+
117131
# Expand home directory
118132
dir="${dir/#\~/$HOME}"
119-
133+
120134
local result=""
121135
local warning=""
122136
local fix=""
123-
137+
124138
# Check if directory exists
125139
if [ ! -d "$dir" ]; then
126140
result="not_installed"
127141
return 0
128142
fi
129-
130-
# Check if in PATH
143+
144+
# Check if already configured in RC file (more reliable than checking current PATH)
145+
if is_configured_in_rc "$init_cmd"; then
146+
result="ok"
147+
echo "$result|$warning|$fix"
148+
return 0
149+
fi
150+
151+
# Not in RC file - check if in current PATH (might be manually set)
131152
if ! path_contains "$dir"; then
132153
result="missing"
133-
warning="⚠️ $description missing from PATH"
154+
warning="⚠️ $description not configured in shell RC file"
134155
fix="add_to_path|$name|$dir|$init_cmd"
135156
else
136157
result="ok"
137-
158+
138159
# Check priority ordering (e.g., ~/.local/bin should come before /usr/bin)
139160
if [ "$name" = "local-bin" ] || [ "$name" = "cargo" ] || [ "$name" = "rbenv-shims" ]; then
140161
if ! path_order_ok "$dir" "/usr/bin"; then
@@ -144,7 +165,7 @@ check_path_requirement() {
144165
fi
145166
fi
146167
fi
147-
168+
148169
echo "$result|$warning|$fix"
149170
}
150171

tools_snapshot.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"__meta__": {
33
"count": 70,
4-
"created_at": "2025-10-16T13:00:20Z",
4+
"created_at": "2025-10-16T13:46:21Z",
55
"offline": false,
66
"partial_failures": 0,
77
"schema_version": 1

0 commit comments

Comments
 (0)