UV ?= uv
COMPOSE_FILE := deploy/docker-compose.adapter.yml
ENV_FILE ?=

.PHONY: check test-slice8 lint compose-config image-build ram-policy-check

check: test-slice8 lint ram-policy-check

test-slice8:
	$(UV) run pytest tests/test_entrypoint.py tests/test_settings.py tests/test_factory.py tests/test_delivery_artifacts.py -q

lint:
	$(UV) run ruff check src tests

ram-policy-check:
	python -m json.tool deploy/ram/knowledge-adapter-oss-read-policy.json >/dev/null

compose-config:
	@test -n "$(ENV_FILE)" || (printf '%s\n' 'ENV_FILE is required' >&2; exit 2)
	docker compose --env-file "$(ENV_FILE)" -f "$(COMPOSE_FILE)" config --quiet

image-build:
	@test -n "$(ENV_FILE)" || (printf '%s\n' 'ENV_FILE is required' >&2; exit 2)
	docker compose --env-file "$(ENV_FILE)" -f "$(COMPOSE_FILE)" build adapter
