🐚 Fix: zsh Pfad-Berechnung mit ${(%):-%x}

KRITISCHER FIX: BASH_SOURCE[0] funktioniert nicht in zsh!

Problem:
- BASH_SOURCE[0] ist bash-spezifisch
- In zsh war SCRIPT_DIR leer → WALDWAECHTER_DIR falsch
- CRUMB_LOGS_DIR: /Users/bmt/Documents/logs (falsch!)
- Sollte: /Users/bmt/Documents/CF_Zero_V1/logs

Lösung:
- if BASH_VERSION → BASH_SOURCE[0]
- elif ZSH_VERSION → ${(%):-%x}
- else → fallback $0

Jetzt funktionieren Pfade in beiden Shells korrekt!

crew_doctor wird jetzt den richtigen Pfad zeigen 

🤖 Generated with Claude Code
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Branko May Trinkwald
2025-12-21 19:54:13 +01:00
parent 43a16d30f2
commit 6fefaf9081

View File

@@ -3,7 +3,18 @@
# Source this file to make all AI characters available as commands
# Determine the repo root directory (lib/ is inside repo root)
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Support both bash and zsh
if [[ -n "$BASH_VERSION" ]]; then
# Bash: use BASH_SOURCE
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
elif [[ -n "$ZSH_VERSION" ]]; then
# Zsh: use ${(%):-%x} to get the script path
SCRIPT_DIR="$(cd "$(dirname "${(%):-%x}")" && pwd)"
else
# Fallback: use $0 (may not work when sourced)
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
fi
WALDWAECHTER_DIR="$(dirname "$SCRIPT_DIR")"
ROLES_DIR="${WALDWAECHTER_DIR}/crumbforest_roles"