#!/usr/bin/env bash
# Run once in each checkout after vp i. Pass a new output directory each time.
set -u
out=$(realpath -m "$1")
mkdir -p "$out"
git rev-parse HEAD > "$out/commit.txt"
T3CODE_DEV_SEED=0 vp run report:client run --trace --out "$out/result.json" > "$out/command.log" 2>&1
status=$?
printf '%s\n' "$status" > "$out/exit.txt"
if test -f "$out/result.json"; then
  printf 'result.json written\n'
else
  printf 'result.json absent\n'
fi
exit "$status"
