#!/usr/bin/env bash # Shell configuration diagnostic tool # Following the prime directive: understand before fixing set -euo pipefail echo "🔍 Shell Configuration Diagnostic" echo "==================================" echo "1. Current shell: $SHELL" echo "2. Zsh version: $(zsh --version)" echo "" echo "3. Checking for conflicting aliases:" alias | grep -E "(cd=|chamber=)" || echo " No cd/chamber aliases found" echo "" echo "4. Testing functions.zsh syntax:" if zsh -n ~/dotfiles/shell/functions.zsh; then echo " ✅ Syntax is valid" else echo " ❌ Syntax error found" fi echo "" echo "5. Testing incremental loading:" echo " Loading environment.zsh..." source ~/dotfiles/shell/environment.zsh && echo " ✅ OK" || echo " ❌ FAILED" echo " Loading paths.zsh..." source ~/dotfiles/shell/paths.zsh && echo " ✅ OK" || echo " ❌ FAILED" echo " Loading functions.zsh..." if source ~/dotfiles/shell/functions.zsh 2>&1 | head -1; then echo " ✅ OK" else echo " ❌ FAILED - this is where the issue occurs" fi echo "" echo "6. Checking for hidden characters around line 311:" sed -n '310,312p' ~/dotfiles/shell/functions.zsh | cat -A echo "" echo "🎯 Recommended next steps:" echo " - If syntax is clean, the issue is environmental" echo " - Check what aliases exist before functions.zsh loads" echo " - Consider isolation: load functions in clean shell"