Overview
Integrate documentation validation into the pre-commit workflow to catch errors before they're committed.
This completes Phase 1 of ADR 003.
Context
See ADR 003 for full context: docs/architecture/decisions/003-automated-tool-documentation.md
Scope
Add pre-commit hook that runs documentation validation on modified tool files.
Implementation
1. Pre-commit Configuration
Add to .pre-commit-config.yaml:
repos:
- repo: local
hooks:
- id: validate-tool-docs
name: Validate Tool Documentation
entry: uv run python scripts/validate_tool_docs.py
language: system
files: stocktrim_mcp_server/src/stocktrim_mcp_server/tools/.*\.py$
pass_filenames: true
2. Performance Requirements
- Validation should run only on modified tool files
- Total validation time < 2 seconds for typical commits
- Clear, actionable error messages
- Exit with error code 1 if validation fails
3. Error Handling
When validation fails, show:
- Which file failed
- Which validation rule failed
- Specific location in code (file:line)
- How to fix the issue
Example output:
❌ Tool documentation validation failed:
File: stocktrim_mcp_server/src/stocktrim_mcp_server/tools/foundation/products.py
Tool: delete_product
Error: Tool uses elicitation but missing 🔴 HIGH-RISK indicator
Fix: Add 🔴 HIGH-RISK OPERATION to the docstring summary line.
Tasks
Acceptance Criteria
- Pre-commit hook runs automatically on tool file changes
- Validation errors block commits
- Clear error messages guide developers to fixes
- Fast execution (< 2 seconds for typical commits)
- CI/CD runs full validation on all tools
- Documentation updated in contributing guide
Testing Plan
- Modify tool with invalid documentation
- Attempt to commit
- Verify pre-commit blocks commit
- Verify error message is clear
- Fix documentation
- Verify commit succeeds
- Verify performance is acceptable
Dependencies
Related
Labels
enhancement
Overview
Integrate documentation validation into the pre-commit workflow to catch errors before they're committed.
This completes Phase 1 of ADR 003.
Context
See ADR 003 for full context:
docs/architecture/decisions/003-automated-tool-documentation.mdScope
Add pre-commit hook that runs documentation validation on modified tool files.
Implementation
1. Pre-commit Configuration
Add to
.pre-commit-config.yaml:2. Performance Requirements
3. Error Handling
When validation fails, show:
Example output:
Tasks
Acceptance Criteria
Testing Plan
Dependencies
Related
Labels
enhancement