Split always-on PATH/env, login hooks, and interactive UX into a managed tree under ~/.config/zsh, with never-overwrite local/ hooks. Agents and interactive shells share one PATH owner; deploy.sh applies the layout safely across machines.
25 lines
804 B
Bash
25 lines
804 B
Bash
# Sole managed PATH builder for every zsh (including non-interactive agents).
|
|
# Do not re-append user tool paths in .zprofile or .zshrc.
|
|
|
|
easyzsh_path_prepend() {
|
|
local dir="$1"
|
|
[[ -n "$dir" && -d "$dir" ]] || return 0
|
|
case ":${PATH}:" in
|
|
*":${dir}:"*) ;;
|
|
*) PATH="${dir}:${PATH}" ;;
|
|
esac
|
|
}
|
|
|
|
# Homebrew first so its shellenv can set prefix vars; we re-assert ~/.local/bin after.
|
|
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, intentional shims such as grok).
|
|
# Never put vendor trees like ~/.grok/bin on PATH wholesale (generic names shadow tools).
|
|
easyzsh_path_prepend "${HOME}/.local/bin"
|
|
|
|
export PATH
|