.PHONY: install install-dev test lint format format-check typecheck check all clean

# RUN wraps every command; PYTHON is the interpreter. Defaults run through uv with
# all extras + dev. In an environment without uv (e.g. a CI image where deps are
# pip-installed), call e.g. `make all RUN= PYTHON=python3.12`.
RUN ?= uv run --extra all --extra dev
PYTHON ?= python

# Install both servers (all extras) into the environment.
install:
	uv sync --extra all

# Install both servers + dev tooling.
install-dev:
	uv sync --extra all --extra dev

# Tools are invoked as `python -m <tool>` so they work without the console
# scripts being on PATH.
test:
	$(RUN) $(PYTHON) -m pytest

lint:
	$(RUN) $(PYTHON) -m ruff check .

format:
	$(RUN) $(PYTHON) -m ruff format .

format-check:
	$(RUN) $(PYTHON) -m ruff format --check .

typecheck:
	$(RUN) $(PYTHON) -m mypy

check: lint typecheck test

# The full gate CI runs.
all: lint format-check typecheck test

clean:
	rm -rf dist build *.egg-info .pytest_cache .mypy_cache .ruff_cache
	find . -type d -name __pycache__ -prune -exec rm -rf {} +
