Brewfile: stripped to essential tools (~600MB freed), removed boost, cmake, aerc, newsboat, fontforge, starship, and 24 auto-dependencies. Added caffeine, ollama, fastfetch, ocrmypdf, tea, sshpass, vitetris. Dropped 1password, iterm2, github-desktop, hazel, swiftbar, oversight. Shell: fixed all stale references (fzf, zoxide, starship, old paths, Homebrew node aliases). Updated project paths to ~/_Dev/. Added CapableMind aliases (cm, bmf, bmf-health, bmf-status, bmf-logs). Configs: removed iterm2, neofetch, swiftbar configs. Added capablemind (launchd plists, MCP example, bmf-start script). Updated SSH config with git.skemantix.com. Added CLAUDE.md to dotfiles. Scripts: consolidated 3 backup scripts into 1 (backup-all-secrets.sh), added pass store backup. Added setup-capablemind.sh for full environment reconstruction. Updated symlinks.sh for new config structure. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
85 lines
3.0 KiB
Bash
85 lines
3.0 KiB
Bash
# ░█▀█░█▀█░▀█▀░█░█░█▀▀
|
|
# ░█▀▀░█▀█░░█░░█▀█░▀▀█
|
|
# ░▀░░░▀░▀░░▀░░▀░▀░▀▀▀
|
|
|
|
# Intelligent PATH management with existence checking and deduplication
|
|
|
|
# Ensure we have a clean slate for PATH manipulation
|
|
# Remove duplicates automatically (zsh-specific)
|
|
if [[ -n "$ZSH_VERSION" ]]; then
|
|
typeset -U path PATH
|
|
fi
|
|
|
|
# Define potential paths in priority order
|
|
declare -a potential_paths=(
|
|
"$HOME/dotfiles/bin" # Dotfiles scripts
|
|
"$HOME/bin" # Personal scripts
|
|
"$HOME/.local/bin" # User-installed binaries
|
|
"/opt/homebrew/bin" # Homebrew (Apple Silicon)
|
|
"/opt/homebrew/sbin" # Homebrew system binaries
|
|
"/usr/local/bin" # Homebrew (Intel)
|
|
"/usr/local/sbin" # System binaries
|
|
"/opt/homebrew/opt/python@3.13/libexec/bin" # Python 3.13
|
|
"$HOME/.cargo/bin" # Rust binaries
|
|
"/opt/homebrew/opt/gnu-sed/libexec/gnubin" # GNU sed
|
|
"/opt/homebrew/opt/gnu-tar/libexec/gnubin" # GNU tar
|
|
"/opt/homebrew/opt/coreutils/libexec/gnubin" # GNU coreutils
|
|
)
|
|
|
|
# Build PATH intelligently
|
|
build_path() {
|
|
local new_paths=()
|
|
|
|
# Add existing paths that we want to keep
|
|
for existing_path in "${path[@]}"; do
|
|
case "$existing_path" in
|
|
# Skip paths we're going to add explicitly
|
|
"$HOME/bin"|"$HOME/.local/bin"|"/opt/homebrew"*|"/usr/local"*|"$HOME/.cargo/bin") ;;
|
|
# Keep system paths and others
|
|
*) new_paths+=("$existing_path") ;;
|
|
esac
|
|
done
|
|
|
|
# Add our curated paths (only if they exist)
|
|
for check_path in "${potential_paths[@]}"; do
|
|
if [[ -d "$check_path" ]]; then
|
|
new_paths=("$check_path" "${new_paths[@]}")
|
|
fi
|
|
done
|
|
|
|
# Rebuild PATH
|
|
path=("${new_paths[@]}")
|
|
}
|
|
|
|
# Execute PATH building
|
|
build_path
|
|
|
|
# Verify critical tools are accessible
|
|
verify_path() {
|
|
local critical_tools=(git zsh python3 brew)
|
|
local missing_tools=()
|
|
|
|
for tool in "${critical_tools[@]}"; do
|
|
if ! command -v "$tool" >/dev/null 2>&1; then
|
|
missing_tools+=("$tool")
|
|
fi
|
|
done
|
|
|
|
if (( ${#missing_tools[@]} > 0 )); then
|
|
echo "⚠️ Missing critical tools: ${missing_tools[*]}"
|
|
echo "💡 Consider running: brew install ${missing_tools[*]}"
|
|
fi
|
|
}
|
|
|
|
# Run verification only in interactive shells
|
|
[[ $- == *i* ]] && verify_path
|
|
|
|
# MANPATH configuration for enhanced man pages
|
|
if [[ -d "/opt/homebrew/share/man" ]]; then
|
|
export MANPATH="/opt/homebrew/share/man:$MANPATH"
|
|
fi
|
|
|
|
# Info path for GNU info pages
|
|
if [[ -d "/opt/homebrew/share/info" ]]; then
|
|
export INFOPATH="/opt/homebrew/share/info:$INFOPATH"
|
|
fi |