#!/usr/bin/env bash
set -euo pipefail
# Run from either requested checkout; all state belongs to that checkout.
TASK_SCRATCH=/tmp/lead-32548-r1/evidence-capture-2
TASK_RUN="$TASK_SCRATCH/$(date -u +%Y%m%dT%H%M%SZ)-$(basename "$PWD")"
mkdir -p "$TASK_RUN"
TASK_REPO="$TASK_SCRATCH/synthetic-github"
if [ ! -d "$TASK_REPO/.git" ]; then
  mkdir -p "$TASK_REPO"
  git -C "$TASK_REPO" init -b main
  printf 'Synthetic public-PR evidence workspace.\n' > "$TASK_REPO/README.md"
  git -C "$TASK_REPO" add README.md
  git -C "$TASK_REPO" -c user.name='Evidence' -c user.email='evidence@example.invalid' commit -m 'Synthetic fixture'
  git -C "$TASK_REPO" remote add origin https://github.com/pingdotgg/t3code.git
fi
cat > "$TASK_RUN/links.md" <<'LINKS'
PR comment link evidence

[Ordinary issue comment](https://github.com/pingdotgg/t3code/pull/29332#issuecomment-6709928633) · [Resolved outdated reply](https://github.com/pingdotgg/t3code/pull/29332#discussion_r4443234588)

[Hidden bot comment](https://github.com/pingdotgg/t3code/pull/29332#issuecomment-6578681526) · [Older page target](https://github.com/pingdotgg/t3code/pull/33684#discussion_r4521046840)

[Plain PR link](https://github.com/pingdotgg/t3code/pull/29332) · [Non-comment files fragment](https://github.com/pingdotgg/t3code/pull/29332/files#diff-1234567890)

[Files reply alias](https://github.com/pingdotgg/t3code/pull/29332/files?w=1#r4443350073) · [Canonical current reply](https://github.com/pingdotgg/t3code/pull/29332#discussion_r4443350073)
LINKS
node apps/server/src/bin.ts project add "$TASK_REPO" --title 'Public PR evidence' --base-dir .t3 > "$TASK_RUN/project.txt"
node apps/server/src/bin.ts thread start --base-dir .t3 --provider devReplay --model todo-list --title 'PR comment link evidence' --json "$TASK_REPO" - < "$TASK_RUN/links.md" > "$TASK_RUN/thread.json"
printf '%s\n' "$TASK_RUN"
