# Toyota Way Pre-commit Hooks - PMCP SDK
This directory contains pre-commit hooks implementing Toyota Way quality standards based on the PAIML MCP Agent Toolkit style.
## Philosophy
Following Toyota manufacturing principles:
- **π Jidoka (θͺεε)**: Stop the line when defects are detected
- **π Kaizen (ζΉε)**: Continuous improvement through quality checks
- **π Genchi Genbutsu (ηΎε°ηΎη©)**: Go see the actual situation (zero SATD tolerance)
## Zero Tolerance Standards
- **No technical debt comments** (TODO, FIXME, HACK, XXX)
- **No unwrap() calls** in production code
- **Zero lint warnings** with comprehensive clippy analysis
- **Perfect formatting** with rustfmt
- **Security vulnerabilities = 0** via cargo audit
- **Documentation tests** must pass (ALWAYS requirement)
- **Version synchronization** between VERSION file and Cargo.toml
## Setup
### Quick Setup
```bash
make setup-full # Complete Toyota Way development environment
```
### Manual Setup
```bash
make setup # Install development tools
make setup-pre-commit # Install pre-commit hooks only
```
## Usage
### Automatic (Recommended)
Pre-commit hooks run automatically on every `git commit` - embodying the Jidoka principle of stopping the line when issues are detected.
### Manual Execution
```bash
make pre-commit-all # Run on all files
make pre-commit-staged # Run on staged files only
make pre-commit-gate # Run Toyota Way quality gate (fallback)
```
## Quality Gates
### Pre-commit Hooks Include:
1. **Standard Quality**:
- Trailing whitespace removal
- End-of-file fixing
- YAML/TOML/JSON validation
- Large file detection
- Unix line ending enforcement
2. **Rust-specific (Zero Tolerance)**:
- Code formatting (`cargo fmt --check`)
- Comprehensive lint analysis (`clippy` with pedantic settings)
- Compilation verification (`cargo check`)
3. **Toyota Way Enforcement**:
- Zero SATD (Self-Admitted Technical Debt) tolerance
- No `unwrap()` calls in production code
- Documentation tests validation
- Security vulnerability checks
- Version file synchronization
### CLAUDE.md Compliance
The configuration matches all requirements from CLAUDE.md:
- β
Pre-commit hook automatically runs Toyota Way quality checks
- β
Format checking: `cargo fmt --check`
- β
Clippy analysis: Zero warnings allowed
- β
Build verification: Must compile successfully
- β
Doctest validation: All doctests must pass
- β
Blocks commits until quality gates pass
## Architecture
The configuration uses:
- **Standard hooks** from `pre-commit/pre-commit-hooks`
- **Rust-specific hooks** from `doublify/pre-commit-rust`
- **Local Toyota Way hooks** for custom quality enforcement
- **Advanced hooks** for line ending consistency
## Integration with Makefile
The pre-commit system integrates seamlessly with existing Makefile targets:
- `make setup-full` includes pre-commit setup
- `make pre-commit-all` runs hooks manually
- `make quality-gate` includes all pre-commit checks
- Fallback to manual checks when pre-commit isn't installed
## Fail-Fast Philosophy
Following Toyota Way principles:
- `fail_fast: true` on all hooks
- Production line stops immediately when defects are found
- Zero tolerance for quality violations
- Manual review required for all changes
## Continuous Improvement (Kaizen)
The system enables continuous improvement through:
- Comprehensive quality metrics collection
- Automatic identification of quality issues
- Integration with existing Toyota Way development workflow
- Feedback loops for quality enhancement
This implementation represents manufacturing-grade quality control applied to software development, ensuring zero defects reach the main branch.