#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")"
PY=""
for candidate in python3.13 python3.12 python3.11 python3.10 python3.9 python3 python; do
if command -v "$candidate" >/dev/null 2>&1; then PY="$candidate"; break; fi
done
[ -n "$PY" ] || { echo "Python 3 is required. Try: sudo apt install -y python3 python3-venv"; exit 1; }
echo "==> Preparing the environment (this may take a few minutes the first time)"
"$PY" launcher.py --check || true
"$PY" launcher.py --prepare-only
echo
echo "==> Done. Start the dashboard with: ./start.sh"