.PHONY: help setup format lint test clean all

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

##@ Setup
setup: ## Initial project setup
	@echo "Setting up development environment..."
	@echo "Installing Python 3.12 if needed..."
	@uv python install 3.12
	@echo "Creating virtual environment..."
	@uv venv .venv --python 3.12
	@echo "Installing dependencies..."
	@uv pip install -e ".[dev]"
	@echo "Setting up pre-commit hooks..."
	@uv run pre-commit install
	@echo "Setup complete! Activate the virtual environment with: source .venv/bin/activate"

##@ Development
format: ## Format code with ruff
	@echo "Formatting code..."
	@uv run ruff format src
	@uv run ruff check --fix src

lint: ## Lint code with ruff and mypy
	@echo "Linting code..."
	@uv run ruff check src
	@uv run mypy src

test: ## Run tests
	@echo "Running tests..."
	@uv run pytest

##@ Maintenance
clean: ## Clean build artifacts and cache
	@echo "Cleaning build artifacts..."
	@rm -rf build/ dist/ *.egg-info
	@find . -type d -name __pycache__ -exec rm -rf {} +
	@find . -type f -name "*.pyc" -delete
	@find . -type d -name .pytest_cache -exec rm -rf {} +
	@find . -type d -name .mypy_cache -exec rm -rf {} +
	@find . -type d -name .ruff_cache -exec rm -rf {} +

all: format lint ## Format and lint
