#!/usr/bin/env bash
# Run from either checkout after starting its isolated dev server and Metro.
# Arguments: agent-device session, T3 home, server port, synthetic repository root,
# output directory. Seed with seed.py first; pair the client using the repo helper.
set -euo pipefail
session=$1
home_dir=$2
export T3CODE_PORT=$3
repositories=$4
output_dir=$5
mkdir -p "$output_dir"
ad() { agent-device "$@" --session "$session"; }
# Before this segment: New thread > Alpha App; set Replay (dev) / Showcase;
# type the prompt, dismiss keyboard, navigate back. The draft is under Unsent.
ad record start "$output_dir/removal.mp4"
ad press 'label="Update the billing logic in this repository"'
ad press 'role=button label="Alpha App"'
ad press "label=\"Beta Service, $repositories/Beta Service\""
ad screenshot "$output_dir/beta-selected.png"
node apps/server/src/bin.ts project remove "$repositories/Beta Service" --base-dir "$home_dir"
ad snapshot -i
ad screenshot "$output_dir/removed-1.png"
sleep 0.5
ad screenshot "$output_dir/removed-2.png"
# Base: the hero silently says server and Send stays enabled. Tap Send to
# demonstrate the wrong-project turn; thread list --project confirms the owner.
# Head: Choose project has no Send. Pick Alpha App and confirm prompt retention.
ad record stop
