#!/usr/bin/env bash
# start.sh — start Agent0 and the glitch-tunnel.
#
# Run this every time (after reboots, etc.).
# Run bootstrap.sh once first to set everything up.

set -euo pipefail

REPO_DIR="$(cd "$(dirname "$0")" && pwd)"
OS="$(uname -s)"

GREEN='\033[0;32m'; YELLOW='\033[1;33m'; NC='\033[0m'
info() { echo -e "${GREEN}✓${NC} $*"; }
warn() { echo -e "${YELLOW}!${NC} $*"; }

cd "$REPO_DIR"

# ── Sanity check ──────────────────────────────────────────────────────────────
if [[ ! -f "${REPO_DIR}/.env" ]]; then
  echo "No .env found. Run bootstrap.sh first."
  exit 1
fi


# ── Docker containers ─────────────────────────────────────────────────────────
info "Starting agents and glitch-tunnel..."
docker compose up -d 
echo ""
docker compose ps

echo ""
info "Agents are up. Open https://agent0.glitch.university"
