#!/bin/sh
# Runs a first chunk of the committed HEAD as a newcomer would: in a container that holds only what README.md → Install asks for and a stock Claude Code, from a clone, against a mock Messages API.
# first_chunk.py says what it checks. ci.sh runs this; run it yourself under run-heavy.
# The repo goes in as a git bundle, as in ci.sh.
set -eu
cd "$(dirname "$0")/.."
image=$(docker build --quiet --memory 2g --memory-swap 2g first-chunk-e2e)
git bundle create - HEAD | docker run --rm -i --init --memory 4g --memory-swap 4g "$image" sh -euc '
	cat >/tmp/head.bundle
	git -c init.defaultBranch=main -c advice.detachedHead=false clone --quiet /tmp/head.bundle ~/build-release
	python3 ~/build-release/first-chunk-e2e/first_chunk.py
'
