.DEFAULT_GOAL := help
.PHONY: help install lint format typecheck test test-cov build clean ci

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

install:  ## Install dev tooling
	uv sync --group dev

lint:  ## Run linter + format check
	uv run ruff check src tests
	uv run ruff format --check src tests

format:  ## Auto-format and fix lint
	uv run ruff format src tests
	uv run ruff check --fix src tests

typecheck:  ## Run mypy strict
	uv run mypy

test:  ## Run tests
	uv run pytest

test-cov:  ## Run tests with coverage gate
	uv run pytest --cov=plainweave --cov-report=term-missing --cov-fail-under=90

build:  ## Build sdist + wheel
	uv build

clean:  ## Remove build + cache artifacts
	rm -rf dist/ build/ *.egg-info .mypy_cache .ruff_cache .pytest_cache .coverage coverage.json
	find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true

ci: lint typecheck test-cov  ## Run the full local CI gate
