#!/bin/bash
run_repo="$HOME/runs/pdf2html-accept-20260823/repo"
run_state="$HOME/runs/pdf2html-accept-20260823/state"
cd "$run_repo" || exit 97
exec > >(tee -a "$run_state/output.log") 2>&1
export PATH="$PATH:$HOME/.claude/bin:$HOME/.local/bin"
export HARNESS_CHILD_SLICE='agent-run.slice'
export RUN_REMOTE_PLACED='1'
set +e
(
bash -lc set +e; run(){ printf "\n=== %s ===\n" "$1"; shift; "$@"; rc=$?; printf "EXIT %s: %d\n" "$1" "$rc"; return "$rc"; }; run frozen-install pnpm install --frozen-lockfile || exit $?; run lint pnpm lint || exit $?; run unit-tests pnpm test:unit || exit $?; run typecheck pnpm typecheck || exit $?; run build pnpm build; exit $?
)
rc=$?
printf "%s" "$rc" > "$run_state/exit-code.tmp"
mv "$run_state/exit-code.tmp" "$run_state/exit-code"
printf "\n[run-remote] finished rc=%s\n" "$rc"
exit $rc
