#!/usr/bin/env bash set -euo pipefail ROOT=/root/projects/website-builder-backend-clean cd "$ROOT" HOST=127.0.0.1 PORT=8000 echo "========================================" echo "Dolor3V Runtime Endpoint Validation" echo "========================================" cleanup() { if [[ -n "${UVICORN_PID:-}" ]] && kill -0 "$UVICORN_PID" 2>/dev/null; then echo echo "[CLEANUP] Stopping Uvicorn..." kill "$UVICORN_PID" || true wait "$UVICORN_PID" 2>/dev/null || true fi } trap cleanup EXIT echo echo "[1/10] Compile" python3 -m py_compile backend/main.py echo echo "[2/10] Start FastAPI" python3 -m uvicorn backend.main:app \ --host "$HOST" \ --port "$PORT" \ >/tmp/dolor3v_uvicorn.log 2>&1 & UVICORN_PID=$! echo echo "[3/10] Wait for startup" READY=0 for i in $(seq 1 30); do if curl -fs "http://$HOST:$PORT/health" >/dev/null 2>&1; then READY=1 break fi sleep 1 done if [[ "$READY" -ne 1 ]]; then echo echo "========== UVICORN LOG ==========" cat /tmp/dolor3v_uvicorn.log exit 1 fi echo "[OK] Server started." echo echo "[4/10] /health" curl -fs "http://$HOST:$PORT/health" echo echo echo "[5/10] /openapi.json" curl -fs "http://$HOST:$PORT/openapi.json" >/dev/null echo "[OK] OpenAPI available." echo echo "[6/10] /mcp" curl -s \ -X POST \ "http://$HOST:$PORT/mcp" \ -H "Content-Type: application/json" \ -d '{}' || true echo echo echo "[7/10] Workspace session" curl -s \ -X POST \ "http://$HOST:$PORT/api/workspace/session" \ -H "Content-Type: application/json" \ -d '{}' || true echo echo echo "[8/10] Workspace sessions" curl -s \ "http://$HOST:$PORT/api/workspace/sessions" || true echo echo echo "[9/10] IDE search" curl -s \ "http://$HOST:$PORT/api/ide/search?q=test" || true echo echo echo "[10/10] Chat endpoint" curl -s \ -X POST \ "http://$HOST:$PORT/api/workspace/chat/message" \ -H "Content-Type: application/json" \ -d '{"message":"hello"}' || true echo echo echo "========================================" echo "Dolor3V Runtime Validation Completed" echo "========================================"