diff --git a/Makefile b/Makefile index 1afd330..9628426 100755 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ .PHONY: help dev dev-full prod down logs logs-dev clean clean-slate drop-db reset-db push-images deploy -.PHONY: test test-backend test-mcp test-frontend test-all test-cov test-integration validate validate-all +.PHONY: test test-backend test-mcp test-frontend test-all test-cov test-integration validate validate-all format-all VERSION ?= latest REGISTRY ?= ghcr.io/cardosofelipe/pragma-stack @@ -22,6 +22,9 @@ help: @echo " make test-cov - Run all tests with coverage reports" @echo " make test-integration - Run MCP integration tests (requires running stack)" @echo "" + @echo "Formatting:" + @echo " make format-all - Format code in backend + MCP servers + frontend" + @echo "" @echo "Validation:" @echo " make validate - Validate backend + MCP servers (lint, type-check, test)" @echo " make validate-all - Validate everything including frontend" @@ -161,6 +164,25 @@ test-integration: @echo "Note: Requires running stack (make dev first)" @cd backend && RUN_INTEGRATION_TESTS=true IS_TEST=True uv run pytest tests/integration/ -v +# ============================================================================ +# Formatting +# ============================================================================ + +format-all: + @echo "Formatting backend..." + @cd backend && make format + @echo "" + @echo "Formatting LLM Gateway..." + @cd mcp-servers/llm-gateway && make format + @echo "" + @echo "Formatting Knowledge Base..." + @cd mcp-servers/knowledge-base && make format + @echo "" + @echo "Formatting frontend..." + @cd frontend && npm run format + @echo "" + @echo "All code formatted!" + # ============================================================================ # Validation (lint + type-check + test) # ============================================================================ diff --git a/mcp-servers/knowledge-base/Makefile b/mcp-servers/knowledge-base/Makefile index 13758c7..8aaf942 100644 --- a/mcp-servers/knowledge-base/Makefile +++ b/mcp-servers/knowledge-base/Makefile @@ -1,4 +1,8 @@ -.PHONY: help install install-dev lint lint-fix format type-check test test-cov validate clean run +.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: @@ -12,6 +16,7 @@ help: @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:" @@ -19,7 +24,7 @@ help: @echo " make test-cov - Run pytest with coverage" @echo "" @echo "All-in-one:" - @echo " make validate - Run lint, type-check, and tests" + @echo " make validate - Run all checks (lint + format + types)" @echo "" @echo "Running:" @echo " make run - Run the server locally" @@ -49,6 +54,10 @@ 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 mypy . --ignore-missing-imports @@ -62,8 +71,9 @@ test-cov: @echo "Running tests with coverage..." @uv run pytest tests/ -v --cov=. --cov-report=term-missing --cov-report=html + # All-in-one validation -validate: lint type-check test +validate: lint format-check type-check @echo "All validations passed!" # Running diff --git a/mcp-servers/llm-gateway/Makefile b/mcp-servers/llm-gateway/Makefile index bf1fb73..f3cd6ce 100644 --- a/mcp-servers/llm-gateway/Makefile +++ b/mcp-servers/llm-gateway/Makefile @@ -1,4 +1,8 @@ -.PHONY: help install install-dev lint lint-fix format type-check test test-cov validate clean run +.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: @@ -12,6 +16,7 @@ help: @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:" @@ -19,7 +24,7 @@ help: @echo " make test-cov - Run pytest with coverage" @echo "" @echo "All-in-one:" - @echo " make validate - Run lint, type-check, and tests" + @echo " make validate - Run all checks (lint + format + types)" @echo "" @echo "Running:" @echo " make run - Run the server locally" @@ -49,6 +54,10 @@ 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 mypy . --ignore-missing-imports @@ -63,7 +72,7 @@ test-cov: @uv run pytest tests/ -v --cov=. --cov-report=term-missing --cov-report=html # All-in-one validation -validate: lint type-check test +validate: lint format-check type-check @echo "All validations passed!" # Running