- Added comprehensive configuration files for seamless migration - SSH, GPG, Karabiner, iTerm2, Neofetch, SwiftBar configs - Pass license management system with templates and documentation - Enhanced shell functions with MAS updates and moon phase tracking - Comprehensive encrypted backup system (GPG AES256) - Included encrypted backups of all sensitive data - BBEdit as default editor with proper configuration - Fixed shell compatibility issues - Merged existing .zsh configs with improvements Security: - All sensitive data is GPG encrypted (.gpg files) - Private keys excluded from version control - Only configs and encrypted backups are tracked Following prime directive: durable, thoughtful solutions 🤖 Generated with Claude Code Co-Authored-By: Claude <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/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
|
|
"/opt/homebrew/opt/python@3.12/libexec/bin" # Python 3.12 (fallback)
|
|
"$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 |