#!/usr/bin/env bash set -Eeuo pipefail case "${1:-}" in validate) source "$ROBORTO_PROJECT_ROOT/scripts/testtask-node.sh" command -v python3 >/dev/null [[ -f "$ROBORTO_PROJECT_ROOT/node_modules/vite/bin/vite.js" ]] || { echo "testtask: missing local dependencies; run npm ci in $ROBORTO_PROJECT_ROOT" >&2 exit 1 } ;; prepare) python3 "$ROBORTO_PROJECT_ROOT/scripts/testtask_snapshot.py" ;; start-backend) # Frontend-only app; keep the runner's backend lifecycle slot alive. exec tail -f /dev/null ;; start-frontend) source "$ROBORTO_PROJECT_ROOT/scripts/testtask-node.sh" cd "$ROBORTO_WORKTREE" exec node node_modules/vite/bin/vite.js --host 127.0.0.1 --port 5187 --strictPort ;; credentials) echo 'Local app; no login. Snapshot storage is isolated by origin/profile. Use Tuesday or Saturday Morning to test EMOM.' ;; cleanup) # Runner owns its processes and disposable browser profile. Retain snapshot evidence. ;; *) echo 'Unknown testtask hook operation' >&2; exit 2 ;; esac