#!/bin/bash
export GIT_PAGER=cat PAGER=cat
cd /tmp/agents
echo "=== diff stat ==="
git diff --stat
echo "=== add ==="
git add pr-review-shared/lib/ask-ai.js pr-review-shared/lib/__tests__/ask-ai.test.js pr-review-shared/lib/__tests__/review-handler.test.js codex-pr-reviewer/index.js gemini-pr-reviewer/index.js
echo "=== commit ==="
git -c user.name="Gautam AI" -c user.email="gautamai@icloud.com" commit -m "fix(pr-review): address bot review feedback on #804

- ask-ai: one-shot cleanup guard (error+close both fire) + try/catch
  around spawn so the temp sandbox is removed on a synchronous throw
- ask-ai tests: sandbox removed after close, cleanup is one-shot, sync
  spawn throw rejects (covers the cleanup-double-fire suggestion)
- review-handler test: assert the model is never invoked when a PR has
  no actionable diff (empty/unpatched files -> no-files abort)
- codex/gemini index: trim verbose comments, point to ask-ai.js JSDoc" 2>&1 | tail -8
echo "=== push ==="
git push origin feat/ai-reviewer-repo-context-fix 2>&1 | tail -6
echo "=== head ==="
git log --oneline -2
echo "DONE_S6"
