fix(shell): keep Cursor on agent and Grok on grok
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.
This commit is contained in:
@@ -27,6 +27,21 @@ if [[ -d "$ZSH_ALWAYS_ON_DIR" ]]; then
|
||||
. "$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"
|
||||
|
||||
Reference in New Issue
Block a user