#!/usr/bin/env bash
# Run from the checkout being tested, after starting its isolated dev server
# with T3CODE_DEV_SEED=0 and its Metro, and installing its Android dev client.
# Usage: bash reproduce.sh <fresh-server-base-dir> <fixture-repo> <port> <reachable-origin> <agent-device-session>
set -euo pipefail
proof_home="$1"
fixture_repo="$2"
proof_port="$3"
proof_origin="$4"
proof_session="$5"
mkdir -p "$fixture_repo"
cat > "$fixture_repo/README.md" <<'MARKDOWN'
参考链接：https://github.com/pingdotgg/t3code

（https://github.com/pingdotgg/t3code）

详见 https://github.com/pingdotgg/t3code，这里有说明

Control: see https://github.com/pingdotgg/t3code here
MARKDOWN
git -C "$fixture_repo" init -q
node apps/server/src/bin.ts project add "$fixture_repo" --title 'Markdown links' --base-dir "$proof_home"
node apps/server/src/bin.ts thread start "$fixture_repo" Start --title 'Markdown links' --provider devReplay --model multi-turn --wait --json --base-dir "$proof_home"
.agents/skills/test-t3-mobile/scripts/pair-client.sh "$proof_port" "$proof_home" "$proof_origin" agent-device --session "$proof_session"
cat <<'STEPS'
In the app, open the newly seeded Markdown links thread.
Open files > README.md > File actions > Preview.
Use agent-device snapshot -i --session <session> to find each control.
Capture with agent-device screenshot <side>-1.png --session <session>.
Wait 500 ms, capture <side>-2.png, compare SHA-256 hashes; repeat if different.
Inspect the stable screenshot before uploading it.
Pixel 9, API 36, portrait 1080x2424, default light theme and font scale.
Base: all three CJK URLs black, ASCII control blue with GitHub icon.
Head: all four URLs blue with GitHub icon; CJK text/punctuation stay black.
STEPS
