# Agentic Composer SDK - Development Makefile

.PHONY: help install install-dev test lint format clean docs publish

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

lock: ## Generate or update uv.lock file
	uv lock

install: ## Install the SDK in development mode
	uv venv .venv
	source .venv/bin/activate && uv sync --locked

install-dev: ## Install SDK with development dependencies
	uv sync --group dev --locked

test: ## Run tests with coverage
	uv run pytest tests/ -v --cov=src --cov-report=html --cov-report=term

test-fast: ## Run tests without coverage (faster)
	uv run pytest tests/ -v

lint: ## Run linting with ruff
	uv run ruff check src/ tests/ examples/

lint-fix: ## Run linting with auto-fix
	uv run ruff check --fix src/ tests/ examples/

format: ## Format code with ruff
	uv run ruff format src/ tests/ examples/

format-check: ## Check if code is properly formatted
	uv run ruff format --check src/ tests/ examples/

type-check: ## Run type checking with mypy
	uv run mypy src/

clean: ## Clean up cache and build artifacts
	find . -type d -name "__pycache__" -exec rm -rf {} +
	find . -type d -name "*.egg-info" -exec rm -rf {} +
	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 {} +
	rm -rf build/ dist/ htmlcov/

examples: ## Run the example usage script
	cd examples && uv run python example_usage.py

docs: ## Generate documentation (placeholder)
	@echo "Documentation generation not yet implemented"

pre-commit: ## Run pre-commit checks (lint, format, type-check, test)
	make format-check
	make lint
	make type-check
	make test-fast

build: ## Build the package
	uv build

publish-test: ## Publish to test PyPI
	uv publish --repository-url https://test.pypi.org/legacy/

publish: ## Publish to PyPI
	uv publish

# Development workflow
dev-setup: install-dev ## Complete development setup
	@echo "Development environment ready!"
	@echo "Run 'make help' to see available commands"

check-all: pre-commit ## Run all quality checks
	@echo "All quality checks passed!"