#!/bin/bash
set -uo pipefail
echo "===== Replaying last codex prompt through shim, capturing RAW output ====="
cd /tmp
SANDBOX=$(mktemp -d /tmp/pr-review-XXXX)
cd "$SANDBOX"
PWD="$SANDBOX" OLDPWD="$SANDBOX" /home/claude/repos/codex-pr-reviewer/codex-stdin-shim.sh < /tmp/last-prompt-codex-stdin-shim_sh.txt > /tmp/cj/codex-raw.txt 2>/tmp/cj/codex-raw.err
echo "exit=$?"
echo "----- stdout size -----"
wc -c /tmp/cj/codex-raw.txt
echo "----- stderr size -----"
wc -c /tmp/cj/codex-raw.err
echo "----- first 80 lines of stdout -----"
head -80 /tmp/cj/codex-raw.txt
echo "----- last 40 lines of stdout -----"
tail -40 /tmp/cj/codex-raw.txt
