#!/usr/bin/env bash
# Start the QA Playwright worker on worker.apis.aicountly.com (Linux).
set -euo pipefail
cd "$(dirname "$0")/.."

if [[ ! -f .env ]]; then
  echo "Missing .env — copy .env.example and set QA_WORKER_TOKEN." >&2
  exit 1
fi

if [[ ! -d node_modules ]]; then
  npm install
fi

echo "Starting QA worker poll loop (Ctrl+C to stop)..."
exec npm start
