Skip to content

Commit e4ff7be

Browse files
fumiya-kumeclaude
andcommitted
update zshrc: guarded claude alias and codex-cli init
- Replace hardcoded claude alias with conditional check that respects Homebrew installations (Intel/Apple Silicon) - Add codex-cli init hook to set CODEX_HOME per git repo 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 991ac13 commit e4ff7be

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

dot_zshrc

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,16 @@ autoload -Uz compinit
4545
compinit -i
4646
# End of Docker CLI completions
4747
export PATH="/Applications/Docker.app/Contents/Resources/bin:$PATH"
48-
alias claude="/Users/kuu/.claude/local/claude"
48+
49+
# Use a guarded alias for `claude` only if the command is not found.
50+
# This prevents shadowing Homebrew's `/usr/local/bin/claude` (Intel)
51+
# or `/opt/homebrew/bin/claude` (Apple Silicon), and only falls back
52+
# to the legacy local install when it actually exists.
53+
if ! command -v claude >/dev/null 2>&1; then
54+
if [[ -x "$HOME/.claude/local/claude" ]]; then
55+
alias claude="$HOME/.claude/local/claude"
56+
fi
57+
fi
4958

5059
[[ "$TERM_PROGRAM" == "kiro" ]] && . "$(kiro --locate-shell-integration-path zsh)"
5160

@@ -111,3 +120,19 @@ add-zsh-hook preexec hide_h_preexec
111120
export PATH="/Users/kuu/.codeium/windsurf/bin:$PATH"
112121
export JAVA_HOME=$HOME/Applications/Android Studio.app/Contents/jbr/Contents/Home"
113122
export PATH="$JAVA_HOME/bin:$PATH"
123+
124+
# >>> codex-cli init >>>
125+
# Codex: Gitリポジトリ内でのみ CODEX_HOME を設定
126+
autoload -Uz add-zsh-hook
127+
128+
_codex_update_codex_home() {
129+
local root
130+
if root=$(git rev-parse --show-toplevel 2>/dev/null); then
131+
export CODEX_HOME="$root/.codex"
132+
else
133+
unset CODEX_HOME
134+
fi
135+
}
136+
add-zsh-hook chpwd _codex_update_codex_home
137+
_codex_update_codex_home
138+
# <<< codex-cli init <<<

0 commit comments

Comments
 (0)