#!/usr/bin/env bash # Builds the broken repository state. This is the Dockerfile's analogue: it # constructs the environment the agent wakes up in, deterministically. set -euo pipefail cd "$TB_WORK" git init -q -b main git config user.name "Release Bot" git config user.email "release@example.invalid" git config commit.gpgsign false git config core.autocrlf false mkdir -p src cat > src/app.py <<'EOF' VERSION = 1 def main(): return "v1" EOF git add -A git commit -qm "Initial import" mkdir -p notes cat > notes/plan.md <<'EOF' # Plan - step one: wire up the loader EOF git add -A git commit -qm "Add plan notes" cat > src/app.py <<'EOF' VERSION = 2 DEFAULTS = {"retries": 3, "timeout": 30} def main(): return "v2" def load(path): with open(path, "r", encoding="utf-8") as handle: return handle.read() EOF git add -A git commit -qm "Add config loader" git rm -q src/app.py git commit -qm "Drop legacy module" mkdir -p docs cat > docs/build.md <<'EOF' # Build Run `make build`. EOF git add -A git commit -qm "Document build" # An abandoned experiment: a commit on a branch that is then deleted, leaving # the commit unreachable from every ref. git checkout -q -b wip HEAD~2 cat > notes/plan.md <<'EOF' # Plan - step one: wire up the loader - step two: add retry budget (work in progress) EOF git add -A git commit -qm "wip: plan" git checkout -q main git branch -qD wip # Untracked junk that must end up ignored, not deleted. printf 'starting\n' > debug.log mkdir -p build printf 'object file\n' > build/tmp.o