UV ?= uv
RUN = $(UV) run --locked --all-extras

.PHONY: help install format lint test dev clean ci build

help:
	@echo "install: sync locked dependencies; format: format code; lint: check code"
	@echo "test: tests and branch coverage; dev: local demo; build: wheel and sdist"
	@echo "ci: lint, tests and build; clean: remove generated artifacts"

install:
	$(UV) sync --locked --all-extras

format: install
	$(RUN) ruff check --fix .
	$(RUN) ruff format .

lint: install
	$(RUN) ruff check .
	$(RUN) ruff format --check .

test: install
	$(RUN) bash scripts/test.sh

dev: install
	$(RUN) uvicorn examples.main:app --reload

build:
	$(UV) build --clear
	$(RUN) python scripts/check_dist.py

ci: lint test build

clean:
	rm -rf build dist .ruff_cache htmlcov .pytest_cache .coverage coverage.xml
