# The COMMITTED published spec, not ../sandbox_frontend/public/openapi.json.
# Same generator, but public/ is gitignored (a frontend build artifact), so CI
# could never read it — which is exactly why the freshness gate in
# .github/workflows/cli-ci.yml sat dead from 2026-06-20 to 2026-08-11 while the
# bundled spec drifted 32 endpoints behind. The baseline is kept current by the
# pre-commit drift gate (sandbox_frontend/scripts/check-openapi-drift.js).
SPEC_SRC = ../sandbox_frontend/openapi.baseline.json
SPEC_DST = finradar_cli/data/openapi.json

.PHONY: sync-spec generate check-drift

sync-spec:
	cp $(SPEC_SRC) $(SPEC_DST)
	@python -c "import json;print('synced', json.load(open('$(SPEC_DST)'))['info']['version'])"

generate:
	python generate.py

check-drift: generate
	git diff --exit-code finradar_cli/_generated finradar_cli/data || \
	  (echo 'Generated artifacts out of date — run `make sync-spec` (if the spec moved) then `make generate`, and commit the result' && exit 1)
