PYTHON_BIN := $(shell command -v python3 >/dev/null 2>&1 && echo python3 || echo python)

.PHONY: readiness docs fixtures preflight backend-install backend-test backend-dev frontend-install frontend-typecheck frontend-build m13 m14

readiness:
	bash scripts/run_readiness_check.sh

backend-install:
	cd backend && \
	$(PYTHON_BIN) -m pip install -e .[dev]

backend-test:
	cd backend && \
	$(PYTHON_BIN) -m pytest

backend-dev:
	cd backend && \
	$(PYTHON_BIN) -m uvicorn app.main:app --reload

frontend-install:
	cd frontend && \
	npm install

frontend-typecheck:
	cd frontend && \
	npm run typecheck

frontend-build:
	cd frontend && \
	npm run build

docs:
	$(PYTHON_BIN) scripts/smoke_docs.py

fixtures:
	$(PYTHON_BIN) scripts/validate_fixtures.py

preflight:
	bash scripts/codex_preflight.sh || true
	$(PYTHON_BIN) scripts/preimplementation_audit.py


.PHONY: m13
m13:
	$(PYTHON_BIN) scripts/validate_m13_codex_assets.py


.PHONY: m14
m14:
	$(PYTHON_BIN) scripts/validate_m14_launch_assets.py
