forked from cardosofelipe/fast-next-template
- Added `mcp-git-ops` service to `docker-compose.dev.yml` with health checks and configurations. - Integrated SSRF protection in repository URL validation for enhanced security. - Expanded `pyproject.toml` mypy settings and adjusted code to meet stricter type checking. - Improved workspace management and GitWrapper operations with error handling refinements. - Updated input validation, branching, and repository operations to align with new error structure. - Shut down thread pool executor gracefully during server cleanup.
89 lines
2.5 KiB
Makefile
89 lines
2.5 KiB
Makefile
.PHONY: help install install-dev lint lint-fix format format-check type-check test test-cov validate clean run
|
|
|
|
# Ensure commands in this project don't inherit an external Python virtualenv
|
|
# (prevents uv warnings about mismatched VIRTUAL_ENV when running from repo root)
|
|
unexport VIRTUAL_ENV
|
|
|
|
# Default target
|
|
help:
|
|
@echo "Git Operations MCP Server - Development Commands"
|
|
@echo ""
|
|
@echo "Setup:"
|
|
@echo " make install - Install production dependencies"
|
|
@echo " make install-dev - Install development dependencies"
|
|
@echo ""
|
|
@echo "Quality Checks:"
|
|
@echo " make lint - Run Ruff linter"
|
|
@echo " make lint-fix - Run Ruff linter with auto-fix"
|
|
@echo " make format - Format code with Ruff"
|
|
@echo " make format-check - Check if code is formatted"
|
|
@echo " make type-check - Run mypy type checker"
|
|
@echo ""
|
|
@echo "Testing:"
|
|
@echo " make test - Run pytest"
|
|
@echo " make test-cov - Run pytest with coverage"
|
|
@echo ""
|
|
@echo "All-in-one:"
|
|
@echo " make validate - Run all checks (lint + format + types)"
|
|
@echo ""
|
|
@echo "Running:"
|
|
@echo " make run - Run the server locally"
|
|
@echo ""
|
|
@echo "Cleanup:"
|
|
@echo " make clean - Remove cache and build artifacts"
|
|
|
|
# Setup
|
|
install:
|
|
@echo "Installing production dependencies..."
|
|
@uv pip install -e .
|
|
|
|
install-dev:
|
|
@echo "Installing development dependencies..."
|
|
@uv pip install -e ".[dev]"
|
|
|
|
# Quality checks
|
|
lint:
|
|
@echo "Running Ruff linter..."
|
|
@uv run ruff check .
|
|
|
|
lint-fix:
|
|
@echo "Running Ruff linter with auto-fix..."
|
|
@uv run ruff check --fix .
|
|
|
|
format:
|
|
@echo "Formatting code..."
|
|
@uv run ruff format .
|
|
|
|
format-check:
|
|
@echo "Checking code formatting..."
|
|
@uv run ruff format --check .
|
|
|
|
type-check:
|
|
@echo "Running mypy..."
|
|
@uv run python -m mypy server.py config.py models.py exceptions.py git_wrapper.py workspace.py providers/ --explicit-package-bases
|
|
|
|
# Testing
|
|
test:
|
|
@echo "Running tests..."
|
|
@IS_TEST=True uv run pytest tests/ -v
|
|
|
|
test-cov:
|
|
@echo "Running tests with coverage..."
|
|
@IS_TEST=True uv run pytest tests/ -v --cov=. --cov-report=term-missing --cov-report=html
|
|
|
|
# All-in-one validation
|
|
validate: lint format-check type-check
|
|
@echo "All validations passed!"
|
|
|
|
# Running
|
|
run:
|
|
@echo "Starting Git Operations server..."
|
|
@uv run python server.py
|
|
|
|
# Cleanup
|
|
clean:
|
|
@echo "Cleaning up..."
|
|
@rm -rf __pycache__ .pytest_cache .mypy_cache .ruff_cache .coverage htmlcov
|
|
@find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
|
|
@find . -type f -name "*.pyc" -delete 2>/dev/null || true
|