# Enable Nix flakes for this project
use flake

# Python environment configuration
export PYTHONPATH="$PWD:$PYTHONPATH"
export PYTHONDONTWRITEBYTECODE=1
export PYTHONUNBUFFERED=1

# Add project bin directory to PATH if it exists
if [ -d "$PWD/bin" ]; then
  PATH_add "$PWD/bin"
fi

# Add scripts directory to PATH if it exists
if [ -d "$PWD/scripts" ]; then
  PATH_add "$PWD/scripts"
fi

# Ensure uv environment is synced
if command -v uv >/dev/null 2>&1; then
  echo "🔄 Syncing uv environment..."
  uv sync --all-extras
  
  # Activate the virtual environment if it exists
  if [ -f ".venv/bin/activate" ]; then
    source .venv/bin/activate
  fi
else
  echo "⚠️  uv not found. Run 'pip install uv' to install it."
fi

# Display project info on directory entry
echo "📦 Loaded segnomms development environment"
if [ -n "$VIRTUAL_ENV" ]; then
  echo "🐍 Virtual environment: $VIRTUAL_ENV"
fi
echo "🚀 Type 'make help' to see available commands"
