Skip to content

Commit d2eaf82

Browse files
committed
fix(guide): trigger migration for deprecated install methods
Claude Code npm package is deprecated. Now triggers migration to native installer even when version matches (2.1.7 === 2.1.7), based on install method detection (nvm/npm -> native).
1 parent f9b85a4 commit d2eaf82

1 file changed

Lines changed: 23 additions & 2 deletions

File tree

scripts/guide.sh

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,15 +139,36 @@ process_tool() {
139139
local homepage="$(catalog_get_property "$tool" homepage)"
140140
local auto_update="$(config_get_auto_update "$tool")"
141141

142-
# Check if up-to-date
143-
if [ -n "$is_up_to_date" ] && [ -n "$installed" ]; then
142+
# Check if migration needed (deprecated install method)
143+
local needs_migration=""
144+
if [ "$tool" = "claude" ] && { [ "$method" = "nvm" ] || [ "$method" = "npm" ]; }; then
145+
needs_migration="true"
146+
fi
147+
148+
# Check if up-to-date (but still migrate if needed)
149+
if [ -n "$is_up_to_date" ] && [ -n "$installed" ] && [ -z "$needs_migration" ]; then
144150
printf "\n==> %s %s\n" "$icon" "$display"
145151
printf " installed: %s via %s\n" "$installed" "$method"
146152
printf " target: %s (same)\n" "$(osc8 "$url" "$latest")"
147153
printf " up-to-date; skipping.\n"
148154
return 0
149155
fi
150156

157+
# Handle migration case (version matches but install method deprecated)
158+
if [ -n "$needs_migration" ] && [ -n "$is_up_to_date" ]; then
159+
printf "\n==> ⚠️ %s [migration needed]\n" "$display"
160+
printf " installed: %s via %s (deprecated)\n" "$installed" "$method"
161+
printf " target: %s (native installer)\n" "$(osc8 "$url" "$latest")"
162+
printf " migrating to native installer...\n"
163+
164+
"$ROOT"/scripts/install_tool.sh "$tool" upgrade || true
165+
166+
# Re-audit
167+
CLI_AUDIT_JSON=1 CLI_AUDIT_COLLECT=1 CLI_AUDIT_MERGE=1 "$CLI" audit.py "$tool" >/dev/null 2>&1 || true
168+
AUDIT_JSON="$(cd "$ROOT" && CLI_AUDIT_JSON=1 CLI_AUDIT_RENDER=1 "$CLI" audit.py || true)"
169+
return 0
170+
fi
171+
151172
# Check if auto_update is enabled - install without prompting
152173
if [ "$auto_update" = "true" ]; then
153174
printf "\n==> %s %s [auto-update]\n" "$icon" "$display"

0 commit comments

Comments
 (0)