# MCPB bundle configuration
BUNDLE_NAME = mcp-folk
VERSION ?= 0.1.0
.PHONY: help install dev-install format format-check lint lint-fix typecheck test test-cov clean run check all pack
help: ## Show this help message
@echo 'Usage: make [target]'
@echo ''
@echo 'Available targets:'
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'
install: ## Install the package
uv pip install -e .
dev-install: ## Install the package with dev dependencies
uv pip install -e ".[dev]"
format: ## Format code with ruff
uv run ruff format src/ tests/
format-check: ## Check code formatting with ruff
uv run ruff format --check src/ tests/
lint: ## Lint code with ruff
uv run ruff check src/ tests/
lint-fix: ## Lint and fix code with ruff
uv run ruff check --fix src/ tests/
typecheck: ## Type check code with mypy
uv run mypy src/
test: ## Run tests with pytest
uv run pytest tests/ -v
test-cov: ## Run tests with coverage
uv run pytest tests/ -v --cov=src/mcp_folk --cov-report=term-missing
clean: ## Clean up build artifacts and cache
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
find . -type f -name "*.pyc" -delete
find . -type f -name "*.pyo" -delete
find . -type f -name "*.pyd" -delete
find . -type f -name ".coverage" -delete
find . -type d -name "*.egg-info" -exec rm -rf {} + 2>/dev/null || true
find . -type d -name ".pytest_cache" -exec rm -rf {} + 2>/dev/null || true
find . -type d -name ".ruff_cache" -exec rm -rf {} + 2>/dev/null || true
find . -type d -name ".mypy_cache" -exec rm -rf {} + 2>/dev/null || true
find . -type d -name "build" -exec rm -rf {} + 2>/dev/null || true
find . -type d -name "dist" -exec rm -rf {} + 2>/dev/null || true
rm -rf *.mcpb
run: ## Run the MCP server in stdio mode
uv run python -m mcp_folk.server
pack: ## Build MCPB bundle for local testing
@echo "Vendoring dependencies..."
@rm -rf deps/
@uv pip install --target ./deps --only-binary :all: . 2>/dev/null || uv pip install --target ./deps .
@echo "Packing bundle..."
@OS=$$(uname -s | tr '[:upper:]' '[:lower:]'); \
ARCH=$$(uname -m); \
case "$$ARCH" in x86_64) ARCH="amd64";; esac; \
mcpb pack . "$(BUNDLE_NAME)-$(VERSION)-$$OS-$$ARCH.mcpb"
@echo "Done! Bundle ready for testing"
check: format-check lint typecheck test ## Run all checks
all: clean install format lint typecheck test ## Clean, install, format, lint, type check, and test
# Development shortcuts
fmt: format ## Alias for format
t: test ## Alias for test
l: lint ## Alias for lint
tc: typecheck ## Alias for typecheck