# Path to the monorepo .dist/ wheel directory, relative to core/buyer/.
# Used by uv when resolving pure-Python internal packages distributed as wheels
# (arkhai-core, arkhai-kit-config, arkhai-kit-policy, and
# arkhai-kit-settlement-runtime).
# The rule is: no [tool.uv.sources] path entries with ../ in this file; all
# cross-package internal dependencies resolve exclusively from .dist/ wheels
# via --find-links on the CLI.
DIST_DIR ?= ../../.dist

.PHONY: init reinit test

init:
	uv venv --allow-existing --python 3.12
	uv sync --dev --python 3.12 --find-links $(DIST_DIR)

# Reinstall all internal wheel dependencies when iterating on kit packages.
# Run make dist-core / dist-config / dist-policy / dist-kits from the monorepo
# root first to ensure .dist/ has fresh wheels.
reinit:
	uv sync --dev --python 3.12 --find-links $(DIST_DIR) \
		--upgrade-package arkhai-core         --reinstall-package arkhai-core \
		--upgrade-package arkhai-kit-config   --reinstall-package arkhai-kit-config \
		--upgrade-package arkhai-kit-policy   --reinstall-package arkhai-kit-policy \
		--upgrade-package arkhai-kit-identity --reinstall-package arkhai-kit-identity \
		--upgrade-package arkhai-core-registry-client --reinstall-package arkhai-core-registry-client \
		--upgrade-package arkhai-kit-settlement-runtime --reinstall-package arkhai-kit-settlement-runtime

test: reinit
	uv run --find-links $(DIST_DIR) pytest tests/unit -q
