#!/bin/bash
run_repo="$HOME/runs/pdf2html-accept2-20260823/repo"
run_state="$HOME/runs/pdf2html-accept2-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
(
sh -c set +e; label=frozen-install; printf "\n=== %s ===\n" "$label"; FT_FROM_HOOK=1 FT_HINTS=1 ft pnpm install --frozen-lockfile; rc=$?; printf "EXIT %s: %d\n" "$label" "$rc"; [ "$rc" -eq 0 ] || exit "$rc"; for task in lint test:unit typecheck build; do printf "\n=== %s ===\n" "$task"; FT_FROM_HOOK=1 FT_HINTS=1 ft pnpm "$task"; rc=$?; printf "EXIT %s: %d\n" "$task" "$rc"; [ "$rc" -eq 0 ] || exit "$rc"; done
)
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
