.PHONY: help sync fmt lint tests run build clean

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

sync: ## Install deps into .venv from the lockfile
	uv sync --locked

fmt: ## Format code
	uv run ruff format .

lint: ## Lint (ruff check + format check)
	uv run ruff check .
	uv run ruff format --check .

tests: ## Run the test suite
	uv run pytest -q

run: ## Run the CLI, e.g. make run ARGS="--version"
	uv run mgw $(ARGS)

build: ## Build the wheel/sdist
	uv build

clean: ## Remove build and cache artifacts
	rm -rf dist build .pytest_cache .ruff_cache
	find . -type d -name __pycache__ -prune -exec rm -rf {} +
