.PHONY: help install format test clean open-coverage-report

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

install: ## Install dependencies with uv
	uv sync --all-extras

format: ## Format and lint code with ruff
	uv run ruff format .
	uv run ruff check --fix .

test: ## Run tests with coverage
	uv run pytest -vvv -x --cov=pydefuddle --cov-report=html --cov-report=term-missing

open-coverage-report: ## Open HTML coverage report in browser
	open htmlcov/index.html

clean: ## Remove cache and build artifacts
	rm -rf .pytest_cache htmlcov dist .coverage __pycache__
	find . -name "*.pyc" -delete
	find . -name "__pycache__" -type d -exec rm -rf {} +
	rm -rf .coverage

release: ## Build and publish to PyPI
	uv build
	uv publish
