#!/usr/bin/env bash
# Commands used for both recordings, from the open Review demo thread.
# Run in the tested checkout; set AGENT_DEVICE, SESSION, and OUT for your lease.
set -euo pipefail
: "${AGENT_DEVICE:=agent-device}" "${SESSION:?}" "${OUT:?}"
"$AGENT_DEVICE" snapshot -i --session "$SESSION"
"$AGENT_DEVICE" record start "$OUT/flow.mp4" --fps 10 --hide-touches --session "$SESSION"
# Thread snapshot: @e7 is Git controls.
"$AGENT_DEVICE" press @e7 --session "$SESSION"
"$AGENT_DEVICE" snapshot -i --session "$SESSION"
# Git controls snapshot: @e29 is Review changes.
"$AGENT_DEVICE" press @e29 --session "$SESSION"
"$AGENT_DEVICE" snapshot -i --session "$SESSION"
# Review snapshot: @e6 is Select diff.
"$AGENT_DEVICE" press @e6 --session "$SESSION"
"$AGENT_DEVICE" snapshot -i --session "$SESSION"
"$AGENT_DEVICE" screenshot "$OUT/menu-a.png" --session "$SESSION"
sleep 0.5
"$AGENT_DEVICE" screenshot "$OUT/menu-b.png" --session "$SESSION"
"$AGENT_DEVICE" record stop --session "$SESSION"
# The remote CLI exports recordings to the checkout's current directory.
# Repeat screenshot pair if the pixel comparison is nonzero.
compare -metric AE "$OUT/menu-a.png" "$OUT/menu-b.png" null:
