Makefileโข4.83 kB
# MoneyWiz MCP Server - Development Makefile
# Modern Python development workflow with Ruff, Black, Mypy, and more
.PHONY: help install install-dev clean lint format type-check security test test-cov test-integration docs pre-commit setup-pre-commit ci-local build
# Default target
help: ## Show this help
@echo "MoneyWiz MCP Server - Development Commands"
@echo "=========================================="
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
# Installation
install: ## Install package for production
pip install -e .
install-dev: ## Install package with development dependencies
pip install -e ".[dev,test]"
# Code Quality
lint: ## Run all linting checks
@echo "๐ Running Ruff linter..."
ruff check .
@echo "โ
Linting complete!"
lint-fix: ## Run linting with auto-fix
@echo "๐ง Running Ruff with auto-fix..."
ruff check --fix .
@echo "โ
Auto-fix complete!"
format: ## Format code with Ruff and Black
@echo "๐จ Formatting code..."
ruff format .
black .
@echo "โ
Formatting complete!"
format-check: ## Check code formatting without making changes
@echo "๐ Checking code formatting..."
ruff format --check .
black --check .
@echo "โ
Format check complete!"
type-check: ## Run static type checking with Mypy
@echo "๐ฌ Running type checks..."
mypy src/
@echo "โ
Type checking complete!"
security: ## Run security checks
@echo "๐ก๏ธ Running security checks..."
bandit -r src/
safety check
@echo "โ
Security checks complete!"
# Testing
test: ## Run tests
@echo "๐งช Running tests..."
pytest
@echo "โ
Tests complete!"
test-cov: ## Run tests with coverage report
@echo "๐งช Running tests with coverage..."
pytest --cov=moneywiz_mcp_server --cov-report=term-missing --cov-report=html
@echo "๐ Coverage report generated in htmlcov/"
test-integration: ## Run integration tests only
@echo "๐ Running integration tests..."
pytest tests/integration/ -v
@echo "โ
Integration tests complete!"
test-unit: ## Run unit tests only
@echo "๐ฌ Running unit tests..."
pytest tests/unit/ -v
@echo "โ
Unit tests complete!"
# Documentation
docs: ## Build documentation (if configured)
@if [ -f "mkdocs.yml" ]; then \
echo "๐ Building documentation..."; \
mkdocs build; \
echo "โ
Documentation built!"; \
else \
echo "๐ No documentation configuration found"; \
fi
docs-serve: ## Serve documentation locally
@if [ -f "mkdocs.yml" ]; then \
echo "๐ Serving documentation at http://localhost:8000"; \
mkdocs serve; \
else \
echo "๐ No documentation configuration found"; \
fi
# Pre-commit
setup-pre-commit: ## Install pre-commit hooks
@echo "๐ช Installing pre-commit hooks..."
pre-commit install
pre-commit install --hook-type commit-msg
@echo "โ
Pre-commit hooks installed!"
pre-commit: ## Run pre-commit hooks on all files
@echo "๐ Running pre-commit hooks..."
pre-commit run --all-files
@echo "โ
Pre-commit complete!"
# CI/CD Simulation
ci-local: ## Run complete CI pipeline locally
@echo "๐ Running local CI pipeline..."
@echo "๐ Step 1: Code formatting check"
$(MAKE) format-check
@echo "๐ Step 2: Linting"
$(MAKE) lint
@echo "๐ Step 3: Type checking"
$(MAKE) type-check
@echo "๐ Step 4: Security checks"
$(MAKE) security
@echo "๐ Step 5: Tests with coverage"
$(MAKE) test-cov
@echo "๐ Step 6: Build package"
$(MAKE) build
@echo "๐ Local CI pipeline complete!"
# Package Management
build: ## Build package distribution
@echo "๐ฆ Building package..."
python -m build
@echo "โ
Package built in dist/"
build-check: ## Check built package
@echo "๐ Checking package..."
twine check dist/*
@echo "โ
Package check complete!"
clean: ## Clean build artifacts and cache
@echo "๐งน Cleaning up..."
rm -rf build/
rm -rf dist/
rm -rf *.egg-info/
rm -rf .coverage
rm -rf htmlcov/
rm -rf .pytest_cache/
rm -rf .ruff_cache/
rm -rf .mypy_cache/
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
find . -type f -name "*.pyc" -delete
@echo "โ
Cleanup complete!"
# Development workflow
dev-setup: ## Complete development environment setup
@echo "๐ Setting up development environment..."
$(MAKE) install-dev
$(MAKE) setup-pre-commit
@echo "โ
Development environment ready!"
quick-check: ## Quick code quality check (format + lint + type)
@echo "โก Quick quality check..."
$(MAKE) format
$(MAKE) lint
$(MAKE) type-check
@echo "โ
Quick check complete!"
# MCP Server specific
run-server: ## Run MCP server locally
@echo "๐ฅ๏ธ Starting MoneyWiz MCP Server..."
python -m moneywiz_mcp_server.main
test-mcp: ## Test MCP server functionality
@echo "๐งช Testing MCP server..."
python test_mcp_minimal.py