fix(install): honor CLAUDE_CONFIG_DIR as config root, not agents dir (#834)

resolve_dest() for claude-code now appends /agents to CLAUDE_CONFIG_DIR (the config root that replaces ~/.claude); a value already ending in /agents is used verbatim and a trailing slash is stripped. detect_claude_code() honors CLAUDE_CONFIG_DIR so relocated configs are detected. Three regression cases in scripts/test-install.sh.

Fixes #578. The diagnosis and the same fix were first proposed by @halindrome in #579 (June); this lands the current-main version with tests.

Co-Authored-By: Shane McCarron <520688+halindrome@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
emindagg
2026-09-04 13:06:36 -05:00
committed by GitHub
co-authored by Shane McCarron Claude Fable 5.1
parent 882d4cda89
commit af128a9288
2 changed files with 46 additions and 2 deletions
+15 -2
View File
@@ -314,7 +314,20 @@ resolve_dest() {
hermes) var="HERMES_PLUGIN_DIR" ;;
vibe) var="VIBE_HOME" ;;
esac
if [[ -n "$var" && -n "${!var:-}" ]]; then printf '%s' "${!var}"; else printf '%s' "$def"; fi
if [[ -n "$var" && -n "${!var:-}" ]]; then
if [[ "$tool" == "claude-code" ]]; then
# CLAUDE_CONFIG_DIR is the config root (it replaces ~/.claude);
# agents live in its agents/ subdirectory (fixes #578). Strip one
# trailing slash; a value already ending in /agents is used verbatim
# so users who worked around the old bug are not double-nested.
local cfg="${!var}"; cfg="${cfg%/}"
if [[ "$cfg" == */agents ]]; then printf '%s' "$cfg"; else printf '%s' "$cfg/agents"; fi
else
printf '%s' "${!var}"
fi
else
printf '%s' "$def"
fi
}
# resolve_tool_path <tool> — best-effort binary path for the detection UI.
@@ -415,7 +428,7 @@ check_integrations() {
# ---------------------------------------------------------------------------
# Tool detection
# ---------------------------------------------------------------------------
detect_claude_code() { [[ -d "${HOME}/.claude" ]]; }
detect_claude_code() { [[ -d "${CLAUDE_CONFIG_DIR:-${HOME}/.claude}" ]]; }
detect_copilot() { command -v code >/dev/null 2>&1 || [[ -d "${HOME}/.github" || -d "${HOME}/.copilot" ]]; }
detect_antigravity() { [[ -d "${HOME}/.gemini/config/skills" ]]; }
detect_gemini_cli() { command -v gemini >/dev/null 2>&1 || [[ -d "${HOME}/.gemini" ]]; }