claude: disable zoxide cd hook in Claude Code subshells #1157

Merged
JakeHillion merged 1 commits from feature/tpvvsytnvrrl into main 2026-06-13 00:41:43 +01:00
+10
View File
@@ -64,6 +64,16 @@ in
}' "$target" > "$target.tmp"
${pkgs.coreutils}/bin/mv "$target.tmp" "$target"
'';
# Disable zoxide cd hook inside Claude Code subshells to avoid cd breakage.
# Claude Code sets CLAUDECODE=1 in all subprocesses it spawns (Bash tool,
# hooks, MCP, etc.), so we check for that and strip the cd function back out
# after zoxide loads unconditionally (mkAfter ensures this runs after zoxide init).
programs.zsh.initContent = lib.mkAfter ''
if [[ -n "$CLAUDECODE" ]]; then
unfunction cd 2>/dev/null || true
fi
'';
};
};
}