# CAD Automation Development Makefile

.PHONY: help install install-dev test test-cov test-watch lint format type-check clean build docs serve-docs

# Default target
help:
	@echo "Available commands:"
	@echo "  install       Install package and dependencies"
	@echo "  install-dev   Install package with development dependencies"
	@echo "  test          Run tests"
	@echo "  test-cov      Run tests with coverage report"
	@echo "  test-watch    Run tests in watch mode"
	@echo "  lint          Run linting"
	@echo "  format        Format code with black"
	@echo "  type-check    Run type checking with mypy"
	@echo "  clean         Clean build artifacts and cache"
	@echo "  build         Build package"
	@echo "  docs          Generate documentation"
	@echo "  serve-docs    Serve documentation locally"
	@echo "  ci            Run full CI pipeline locally"

# Installation
install:
	pip install -e .

install-dev:
	pip install -e .[dev]

# Testing
test:
	pytest tests/ -v

test-cov:
	pytest tests/ --cov=src/cad_automation --cov-report=html --cov-report=term-missing

test-watch:
	ptw tests/ --runner "pytest --cov=src/cad_automation"

# Code Quality
lint:
	flake8 src/cad_automation tests
	@echo "Linting completed"

format:
	black src/cad_automation tests
	isort src/cad_automation tests
	@echo "Code formatting completed"

type-check:
	mypy src/cad_automation
	@echo "Type checking completed"

# Cleaning
clean:
	rm -rf build/
	rm -rf dist/
	rm -rf *.egg-info/
	rm -rf .coverage
	rm -rf htmlcov/
	rm -rf .pytest_cache/
	rm -rf __pycache__/
	rm -rf src/cad_automation/__pycache__/
	rm -rf tests/__pycache__/
	rm -rf .mypy_cache/
	find . -type f -name "*.pyc" -delete
	find . -type d -name "__pycache__" -delete
	@echo "Clean completed"

# Build
build: clean
	python -m build
	@echo "Build completed"

# Development workflow
dev-setup: install-dev
	pre-commit install
	@echo "Development environment setup completed"

check-all: lint type-check test-cov
	@echo "All checks passed!"

# CI simulation
ci: check-all build
	@echo "CI pipeline completed successfully"

# Quick development cycle
dev: format type-check test
	@echo "Development cycle completed"

# Documentation (placeholder for future implementation)
docs:
	@echo "Documentation generation not yet implemented"

serve-docs:
	@echo "Documentation serving not yet implemented"
