# HBF platform developer commands (Blueprint Section 10, CI/CD promotion).
PY ?= python3
PKGS := packages/hbf_schemas packages/fusion_core packages/directconvert_core \
        packages/alphatrack_core packages/evidence_registry apps/api

.PHONY: install test test-science lint hash-vectors api validate reproduce clean

install:  ## Editable-install every package (dependency lockfile in requirements-dev.txt)
	$(PY) -m pip install --break-system-packages -q -r requirements-dev.txt
	@for p in $(PKGS); do $(PY) -m pip install --break-system-packages -q -e $$p; done

test:  ## Run the whole test suite
	$(PY) -m pytest -q

test-science:  ## Scientific-unit + DC-VAL + AlphaTrack goldens only
	$(PY) -m pytest -q packages/directconvert_core packages/alphatrack_core packages/fusion_core

hash-vectors:  ## Regenerate + check canonical hash test vectors (PLAT-01)
	$(PY) tools/check_hash_vectors.py packages/hbf_schemas/test_vectors/canonical_vectors.json

validate:  ## Run independent DirectConvert reference reproduction (DC-VAL-08)
	$(PY) validation/directconvert/reference_cases.py

reproduce:  ## One-command reproducibility demo (PLAT-06)
	$(PY) tools/reproduce.py

api:  ## Launch the FastAPI app locally
	$(PY) -m uvicorn hbf_api.main:app --reload --app-dir apps/api/src

clean:
	find . -type d -name __pycache__ -prune -exec rm -rf {} + ; rm -rf .pytest_cache
