#!/usr/bin/env bash
set -euo pipefail
# Usage: reproduce.sh <checkout> <workspace> <provider-instance> <model-slug>
# Start the checkout first with T3CODE_DEV_SEED=0 vp run dev.
# Enable a Claude provider instance in its fresh settings before using this driver.
checkout=$1
workspace=$2
provider_instance=$3
model_slug=$4
mkdir -p "$workspace"
git -C "$workspace" init -q
cd "$checkout"
node apps/server/src/bin.ts project add "$workspace" --title 'Session cron evidence' --base-dir .t3
node apps/server/src/bin.ts thread start "$workspace" 'Use CronCreate to create a one-shot job scheduled approximately 40 minutes from now (UTC). Its prompt must execute: date -u +%Y-%m-%dT%H:%M:%SZ >> cron-fired.txt . Use recurring:false. Then call CronList to confirm the job. Report its id and due time. Do not use T3 scheduled tasks, shell background jobs, or any substitute. Finish your reply and leave the cron to fire on its own.' --provider "$provider_instance" --model "$model_slug" --title 'One-shot cron' --wait --json --base-dir .t3
# Keep the host and server awake. Do not send another turn before the scheduled time.
