.DEFAULT_GOAL := help
.PHONY: help install fmt lint typecheck test check all clean

help: ## Show this help
	@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
		awk 'BEGIN {FS = ":.*?## "}; {printf "  \033[36m%-12s\033[0m %s\n", $$1, $$2}'

install: ## Install deps + editable package
	uv sync

fmt: ## Format code (ruff)
	uv run ruff format src/ tests/ examples/

lint: ## Lint code (ruff)
	uv run ruff check src/ tests/ examples/

lint-fix: ## Lint + auto-fix (ruff)
	uv run ruff check --fix src/ tests/ examples/

typecheck: ## Type-check (pyright)
	uv run pyright src/ tests/

test: ## Run tests (pytest)
	uv run pytest tests/ -v

check: lint typecheck test ## Run lint + typecheck + test

all: fmt lint-fix typecheck test ## Format + fix + typecheck + test

clean: ## Remove caches and build artifacts
	rm -rf .venv .pytest_cache .ruff_cache dist build __pycache__
	find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
