.PHONY: test lint fmt fmt-check typecheck coverage clean test-all e2e-local \
	release-prep release-tag release-push release-check release-notes

# Core SDK
test:
	pytest tests/

lint:
	ruff check src/ tests/ scripts/

fmt:
	ruff format src/ tests/ scripts/

fmt-check:
	ruff format --check src/ tests/ scripts/

typecheck:
	mypy src/

coverage:
	pytest --cov=dome --cov-report=html tests/

# All packages (core + adapters)
test-all:
	pytest tests/
	cd packages/dome-langchain && pytest tests/

e2e-local:
	DOME_SDK_E2E=1 pytest tests/e2e -q

# Releases. PKG is core (dome-sdk) or langchain (dome-langchain); pushing the tag
# is what publishes to PyPI, so it is always a separate, explicit step.
PKG ?= core

release-prep:
	python3 scripts/release.py prep $(PKG) $(VERSION)

release-tag:
	python3 scripts/release.py tag $(PKG)

release-push:
	python3 scripts/release.py push $(PKG)

release-check:
	python3 scripts/release.py check --tag $(TAG)

release-notes:
	python3 scripts/release.py notes --tag $(TAG)

clean:
	rm -rf dist/ build/ *.egg-info/ htmlcov/ .coverage coverage.xml .mypy_cache/ .pytest_cache/
	rm -rf packages/dome-langchain/dist/ packages/dome-langchain/build/ packages/dome-langchain/*.egg-info/
	find . -type d -name __pycache__ -exec rm -rf {} +
