Files
dotfiles/shell/environment.zsh
T
David F GliddenandClaude 546e43fc64 Refactor shell configuration following prime directive principles
🎯 Comprehensive refinement addressing durability and maintainability:

**Modular Architecture:**
- environment.zsh: Centralized environment variables with XDG compliance
- paths.zsh: Intelligent PATH management with existence checking
- aliases.zsh: Enhanced aliases with tool fallbacks and context awareness
- functions.zsh: Sophisticated functions with error handling and recovery
- .zshrc: Clean main config with graceful degradation

**Key Improvements:**
- ✅ Fixed PATH duplication and made portable
- ✅ Added graceful dependency handling throughout
- ✅ Enhanced vault/chamber/work context integration
- ✅ Comprehensive error recovery in sysupdate()
- ✅ Intelligent tool detection and fallbacks
- ✅ Performance optimizations for different shell modes

**Philosophy Applied:**
- μέτρον (measure): Right amount of features without bloat
- συμμετρία (proportion): Balanced modular structure
- πρόσφορον (fitting): Portable, maintainable, testable

**Testing:**
- Syntax validation for all modules
- Function loading verification
- Isolated test environment
- Ready for production deployment

🤖 Generated with Claude Code (https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-27 14:01:23 +02:00

64 lines
2.3 KiB
Bash

# ░█▀▀░█▀█░█░█░▀█▀░█▀▄░█▀█░█▀█░█▄█░█▀▀░█▀█░▀█▀
# ░█▀▀░█░█░▀▄▀░░█░░█▀▄░█░█░█░█░█░█░█▀▀░█░█░░█░
# ░▀▀▀░▀░▀░░▀░░▀▀▀░▀░▀░▀▀▀░▀░▀░▀░▀░▀▀▀░▀░▀░░▀░
# Core environment variables with graceful fallbacks
# 🖋 Preferred editors
export EDITOR="${EDITOR:-bbedit}"
export VISUAL="${VISUAL:-bbedit}"
# 🌍 Locale settings
export LANG="${LANG:-en_US.UTF-8}"
export LC_ALL="${LC_ALL:-en_US.UTF-8}"
# 🗂 History configuration
export HISTFILE="${HISTFILE:-$HOME/.zsh_history}"
export HISTSIZE=100000
export SAVEHIST=100000
# 🧠 XDG Base Directory specification
export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
export XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}"
export XDG_STATE_HOME="${XDG_STATE_HOME:-$HOME/.local/state}"
# 📚 Vault and workspace paths
export VAULT_PATH="$HOME/Library/Mobile Documents/iCloud~md~obsidian/Documents/David, root-and-branch"
export CHAMBER_PATH="$HOME/animal-davidglidden-eu"
export WORK_PATH="$HOME/Documents/GitHub/davidglidden.github.io"
export DOTFILES_PATH="$HOME/dotfiles"
# 🔧 Tool configurations
export HOMEBREW_NO_ANALYTICS=1
export HOMEBREW_NO_INSECURE_REDIRECT=1
export HOMEBREW_CASK_OPTS="--require-sha"
# 🎨 Color and display
export CLICOLOR=1
export LSCOLORS="ExGxBxDxCxEgEdxbxgxcxd"
export GREP_OPTIONS="--color=auto"
# 🐍 Python settings
export PYTHONDONTWRITEBYTECODE=1
export PYTHONUNBUFFERED=1
# 📊 Performance monitoring
export TIMEFMT=$'\n================\nCPU\t%P\nuser\t%*U\nsystem\t%*S\ntotal\t%*E'
# 🌓 Optional API keys (with existence checks)
[[ -f "$HOME/.env.local" ]] && source "$HOME/.env.local"
# 🔐 Security
export GPG_TTY=$(tty)
# 🚀 Development context detection
detect_context() {
case "$PWD" in
"$WORK_PATH"*) export CURRENT_CONTEXT="work" ;;
"$CHAMBER_PATH"*) export CURRENT_CONTEXT="chamber" ;;
"$VAULT_PATH"*) export CURRENT_CONTEXT="vault" ;;
"$DOTFILES_PATH"*) export CURRENT_CONTEXT="dotfiles" ;;
*) export CURRENT_CONTEXT="personal" ;;
esac
}