.DEFAULT_GOAL := help
.PHONY: help install lint fmt typecheck test check demo bench bench-depth

help:  ## show this help
	@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
		awk 'BEGIN {FS = ":.*?## "}; {printf "  %-14s %s\n", $$1, $$2}'

install:  ## sync the locked dev environment and install the pre-commit hook
	uv sync --locked --all-extras
	uv run pre-commit install

lint:  ## ruff check + format check
	uv run ruff check .
	uv run ruff format --check .

fmt:  ## ruff autofix + format
	uv run ruff check --fix .
	uv run ruff format .

typecheck:  ## mypy --strict
	uv run mypy

test:  ## pytest
	uv run pytest

check: lint typecheck test  ## everything CI runs

demo:  ## re-record the README demo (asciinema cast + animated svg via svg-term)
	asciinema rec --overwrite -c scripts/demo_session.sh --cols 100 --rows 12 docs/demo.cast
	npx --yes svg-term-cli --in docs/demo.cast --out docs/demo.svg --window --width 100 --height 12

bench-depth:  ## rebuild the Milestone 0 depth histogram from the pinned corpus
	./scripts/reproduce_depth_histogram.sh

bench:  ## rebuild the precision findings from the pinned benchmark repositories
	./scripts/reproduce_benchmark.sh
