PAIML智能代理工具包
STDIOOfficial零配置AI代码分析与重构工具包
零配置AI代码分析与重构工具包
Zero-configuration AI context generation for any codebase. Analyze code quality, complexity, and technical debt across 17+ programming languages with extreme quality enforcement and Toyota Way standards.
📖 https://paiml.github.io/pmat-book/ - Complete documentation, tutorials, and guides
# Rust (recommended) cargo install pmat # macOS/Linux brew install pmat # Windows choco install pmat # npm (global) npm install -g pmat-agent
# Analyze codebase and generate AI-ready context pmat context # Analyze complexity pmat analyze complexity # Grade technical debt (A+ through F) pmat analyze tdg # Find Self-Admitted Technical Debt pmat analyze satd # Test suite quality (mutation testing) pmat mutate --target src/
Install pre-commit hooks for automatic quality enforcement:
# Install git hooks (bashrs quality, pmat-book validation) pmat hooks install # Check hook status pmat hooks status # Dry-run to see what would be checked pmat hooks install --dry-run
Hooks enforce:
📖 PMAT Book - Complete guide with tutorials
Key chapters:
# Generate context for Claude/GPT pmat context --output context.md --format llm-optimized # Analyze TypeScript project pmat analyze complexity --language typescript # Technical debt grading with components pmat analyze tdg --include-components # Semantic search (natural language) pmat embed sync ./src pmat semantic search "error handling patterns" # Validate documentation for hallucinations pmat validate-readme --targets README.md
Evaluate test suite quality by introducing code mutations and checking if tests detect them.
# Basic mutation testing pmat mutate --target src/lib.rs # With quality gate (fail if score < 85%) pmat mutate --target src/ --threshold 85 # Failures only (CI/CD optimization) pmat mutate --target src/ --failures-only # JSON output for integration pmat mutate --target src/ --output-format json > results.json
Mutation Score = (Killed Mutants / Total Valid Mutants) × 100%
Supported Languages: Rust, Python, TypeScript, JavaScript, Go, C++
Key Features:
Documentation:
Example Projects:
Zero-regression quality enforcement across local development, git workflows, and CI/CD pipelines.
# 1. Create quality baseline pmat tdg baseline create --output .pmat/tdg-baseline.json --path . # 2. Install git hooks (optional) pmat hooks install --tdg-enforcement # 3. Check for regressions pmat tdg check-regression \ --baseline .pmat/tdg-baseline.json \ --path . \ --max-score-drop 5.0 \ --fail-on-regression # 4. Enforce quality standards for new code pmat tdg check-quality \ --path . \ --min-grade B+ \ --new-files-only \ --fail-on-violation
Baseline System:
Quality Gates:
Git Hooks:
CI/CD Templates:
Create .pmat/tdg-rules.toml:
[quality_gates] rust_min_grade = "A" python_min_grade = "B+" max_score_drop = 5.0 mode = "strict" # strict, warning, or disabled [baseline] baseline_path = ".pmat/tdg-baseline.json" auto_update_on_main = true
GitHub Actions:
cp templates/ci/github-actions-tdg.yml .github/workflows/tdg-quality.yml
GitLab CI:
cp templates/ci/gitlab-ci-tdg.yml .gitlab-ci.yml
Jenkins:
cp templates/ci/Jenkinsfile-tdg Jenkinsfile
See Complete Guide: docs/guides/ci-cd-tdg-integration.md
Track Technical Debt Grading (TDG) scores at specific git commits for "quality archaeology" workflows.
# Analyze with git context pmat tdg server/src/lib.rs --with-git-context # Query specific commit pmat tdg history --commit v2.178.0 # History since reference pmat tdg history --since HEAD~10 # Commit range pmat tdg history --range v2.177.0..v2.178.0 # Filter by file pmat tdg history --path server/src/lib.rs --since HEAD~5 # JSON output for scripting pmat tdg history --commit 60125a0 --format json
Use Cases:
Example Workflows:
# Find when quality dropped below B+ pmat tdg history --since HEAD~50 --format json | \ jq '.history[] | select(.score.grade | test("C|D|F"))' # Quality delta between releases pmat tdg history --range v2.177.0..v2.178.0 # Per-file quality trend pmat tdg history --path src/lib.rs --since HEAD~20
Features:
--commit v2.178.0)with_git_context: true parameter)PMAT provides 19 MCP tools for AI agents:
# Start MCP server pmat mcp # Use with Claude Code, Cline, or other MCP clients
Tools include: context generation, complexity analysis, TDG scoring, semantic search, code clustering, documentation validation, and more.
See MCP Tools Documentation for details.
Built by: Pragmatic AI Labs
License: MIT
Repository: github.com/paiml/paiml-mcp-agent-toolkit
Issues: GitHub Issues
Current Version: v2.167.0 (Sprint 44 - Coverage Remediation)
See ROADMAP.md for project status and future plans.
Quality Standards: