Grok's installer prepends ~/.grok/bin and steals ~/.local/bin/agent. easyzsh already shims `grok`; claim `agent` for Cursor and drop the vendor bin from PATH so a later Grok upgrade cannot shadow it.
49 lines
1.7 KiB
Bash
49 lines
1.7 KiB
Bash
# Always-on env for every zsh (interactive, login, agents, zsh -c).
|
|
# Machine-local overrides: ~/.config/zsh/local.zsh (never overwritten by deploy).
|
|
|
|
# Homebrew (macOS). cd /tmp so TCC-protected CWDs do not break brew shellenv.
|
|
if [[ -x /opt/homebrew/bin/brew ]]; then
|
|
eval "$(cd /tmp && /opt/homebrew/bin/brew shellenv)"
|
|
elif [[ -x /usr/local/bin/brew ]]; then
|
|
eval "$(cd /tmp && /usr/local/bin/brew shellenv)"
|
|
fi
|
|
|
|
# User-local binaries (pipx, uv tools, grok shim, …).
|
|
# Do not put vendor trees like ~/.grok/bin on PATH wholesale (names like `agent` shadow tools).
|
|
if [[ -d "$HOME/.local/bin" ]]; then
|
|
case ":${PATH}:" in
|
|
*":$HOME/.local/bin:"*) ;;
|
|
*) PATH="$HOME/.local/bin:${PATH}" ;;
|
|
esac
|
|
export PATH
|
|
fi
|
|
|
|
# Always-on tool fragments (~/.config/zsh/*.zsh). local.zsh is sourced last so it wins.
|
|
ZSH_ALWAYS_ON_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/zsh"
|
|
if [[ -d "$ZSH_ALWAYS_ON_DIR" ]]; then
|
|
for f in "$ZSH_ALWAYS_ON_DIR"/*.zsh(N); do
|
|
[[ ${f:t} == local.zsh ]] && continue
|
|
# shellcheck disable=SC1090
|
|
. "$f"
|
|
done
|
|
fi
|
|
|
|
# Cursor owns `agent` when installed. Grok is only ~/.local/bin/grok.
|
|
# Grok's installer also writes ~/.local/bin/agent and may prepend ~/.grok/bin.
|
|
_easyzsh_agent=
|
|
[[ -L $HOME/.local/bin/agent ]] && _easyzsh_agent=$(readlink $HOME/.local/bin/agent)
|
|
if [[ -x $HOME/.local/bin/cursor-agent ]]; then
|
|
if [[ ! -e $HOME/.local/bin/agent || $_easyzsh_agent == *'/.grok/'* ]]; then
|
|
ln -sfn $HOME/.local/bin/cursor-agent $HOME/.local/bin/agent
|
|
fi
|
|
elif [[ -L $HOME/.local/bin/agent && $_easyzsh_agent == *'/.grok/'* ]]; then
|
|
rm -f $HOME/.local/bin/agent
|
|
fi
|
|
unset _easyzsh_agent
|
|
path=(${path:#$HOME/.grok/bin})
|
|
|
|
if [[ -f "$ZSH_ALWAYS_ON_DIR/local.zsh" ]]; then
|
|
# shellcheck disable=SC1090
|
|
. "$ZSH_ALWAYS_ON_DIR/local.zsh"
|
|
fi
|