#!/usr/bin/env bash set -euo pipefail ROOT_DIR="$(cd "$(dirname "$0")" && pwd)" require_cmd() { if ! command -v "$1" >/dev/null 2>&1; then echo "[ERROR] Required command not found: $1" exit 1 fi } ensure_clean_git_state() { if ! git diff --quiet || ! git diff --cached --quiet || [[ -n "$(git ls-files --others --exclude-standard)" ]]; then echo "[ERROR] Working tree is not clean." echo "[HINT] Commit/stash/discard changes first, then rerun this script." exit 1 fi } cd "$ROOT_DIR" require_cmd git ensure_clean_git_state CURRENT_BRANCH="$(git rev-parse --abbrev-ref HEAD)" echo "[INFO] Pull latest changes from origin/$CURRENT_BRANCH" git pull --ff-only origin "$CURRENT_BRANCH" require_cmd docker if ! docker info >/dev/null 2>&1; then echo "[ERROR] Docker daemon is not running or not accessible." echo "[HINT] Git pull is done. Start Docker and rerun this script to start containers." exit 1 fi echo "[INFO] Start baron_qa local stack" chmod +x start-local.sh check-local.sh ./start-local.sh echo "[INFO] Run health check" ./check-local.sh echo echo "[OK] baron_qa is ready" echo "[INFO] Web UI : http://localhost:3002" echo "[INFO] API Docs : http://localhost:4000/docs"