#!/usr/bin/env bash
# Synthetic fixture only. Refuse existing directories; never touches an app checkout.
set -euo pipefail
fixture_path=${1:?Usage: rebuild-fixture.sh /tmp/new-disposable-fixture}
if test -e "$fixture_path"; then echo 'Refusing existing fixture path' >&2; exit 1; fi
mkdir -p "$fixture_path"
cd "$fixture_path"
git init -b main
git config user.name 'Synthetic Evidence Fixture'
git config user.email 'fixture@example.invalid'
mkdir -p ios/.agents/skills/ios-release ios/.claude/skills/ios-release docs ios/docs shared
for skill_path in ios/.agents/skills/ios-release/SKILL.md ios/.claude/skills/ios-release/SKILL.md; do
cat > "$skill_path" <<'SKILL'
---
name: ios-release
description: Nested iOS release fixture
---
Use for iOS release verification.
SKILL
done
printf 'ROOT README sentinel\n' > README.md
printf 'IOS README sentinel\n' > ios/README.md
printf 'ROOT setup sentinel\nroot line two\nroot line three\n' > docs/setup.md
printf 'IOS setup sentinel\nios line two\nios line three\n' > ios/docs/setup.md
printf 'export const sentinel = "SHARED sibling";\n' > shared/file.ts
printf 'IOS filename with spaces sentinel\n' > 'ios/file with spaces.txt'
git add .
git commit -m 'test: synthetic nested project fixture'
git switch -c evidence-ios-missing
git rm -r ios
git commit -m 'test: fixture branch without ios directory'
git switch -c evidence-ios-file
printf 'regular file fallback sentinel\n' > ios
git add ios
git commit -m 'test: fixture branch with regular file ios'
git switch main
printf 'Add project rooted at %s/ios through real app UI. Follow replay.md.\n' "$fixture_path"
