.PHONY: test lint format typecheck fix clean install pre-commit help

help: ## Show this help message
	@echo "Usage: make [target]"
	@echo ""
	@echo "Targets:"
	@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "  %-15s %s\n", $$1, $$2}' $(MAKEFILE_LIST)

install: ## Install dependencies with uv
	uv sync --group dev

test: ## Run the test suite with coverage
	uv run pytest tests/

test-fast: ## Run tests without coverage
	uv run pytest tests/ -o addopts=""

lint: ## Run ruff linter
	uv run ruff check src tests

format: ## Run ruff formatter
	uv run ruff format src tests

typecheck: ## Run ty type checker
	uv run ty check src tests

fix: ## Auto-fix linting issues where possible
	uv run ruff check --fix src tests

check: lint typecheck test ## Run all checks (lint + typecheck + test)

pre-commit: ## Run pre-commit hooks on all files
	uv run pre-commit run --all-files

build: ## Build wheel and sdist for PyPI
	uv build

clean: ## Remove build artifacts and cache files
	rm -rf build/ dist/ .egg-info/ .pytest_cache/ .mypy_cache/ .ruff_cache/
	find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
	find . -type f -name "*.pyc" -delete
	find . -type f -name "*.pyo" -delete
