# Makefile for {{project_name}}
# Generated by Pragmatic AI Labs MCP Agent Toolkit

.PHONY: all install dev-install format lint type-check test coverage clean run help

# Default target
all: format lint type-check test

# Install production dependencies
install:
	@echo "Installing production dependencies..."
	uv pip sync requirements.txt

# Install development dependencies
dev-install:
	@echo "Installing development dependencies..."
	uv pip sync requirements-dev.txt

# Format code with ruff
format:
	@echo "Formatting code..."
	uv run ruff format src/
{{#if has_tests}}
	uv run ruff format tests/
{{/if}}

# Lint code with ruff
lint:
	@echo "Linting code..."
	uv run ruff check src/ --fix
{{#if has_tests}}
	uv run ruff check tests/ --fix
{{/if}}

# Type check with mypy
type-check:
	@echo "Type checking..."
	uv run mypy src/

{{#if has_tests}}
# Run tests
test:
	@echo "Running tests..."
	uv run pytest -v

# Run tests with coverage
coverage:
	@echo "Running tests with coverage..."
	uv run pytest -v --cov=src --cov-report=html --cov-report=term
{{/if}}

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

# Run the application
run:
	@echo "Running {{project_name}}..."
	uv run python -m src.{{entry_point}}

# Show help
help:
	@echo "Available targets:"
	@echo "  all         - Run format, lint, type-check, and test"
	@echo "  install     - Install production dependencies"
	@echo "  dev-install - Install development dependencies"
	@echo "  format      - Format code with ruff"
	@echo "  lint        - Lint code with ruff"
	@echo "  type-check  - Type check with mypy"
{{#if has_tests}}
	@echo "  test        - Run tests"
	@echo "  coverage    - Run tests with coverage"
{{/if}}
	@echo "  clean       - Clean build artifacts"
	@echo "  run         - Run the application"
	@echo "  help        - Show this help message"