Skip to main content

Crate pmat

Crate pmat 

Source
Expand description

§PMAT (Professional Project Quantitative Analysis Toolkit)

A comprehensive toolkit for project analysis, quality assurance, and technical debt management. PMAT provides multiple interfaces (CLI, MCP, HTTP API) for analyzing code quality, complexity, and generating actionable insights for software development teams.

§Core Modules

§Analysis Engines

  • complexity - Code complexity analysis using AST parsing
  • entropy - Actionable entropy analysis for pattern detection
  • tdg - Technical Debt Grading system with persistent scoring
  • [wasm] - WebAssembly quality assurance and verification

§Quality Assurance

  • qdd - Quality-Driven Development with automated code generation
  • services - Core analysis services and quality gates
  • models - Data models for analysis results and reports

§Interface Modules

  • cli - Command-line interface with 25+ commands
  • mcp_server - Model Context Protocol server implementation
  • handlers - HTTP API handlers for REST endpoints
  • [demo] - Demo server and showcase functionality

§Infrastructure

  • [agent] - Claude Code Agent Mode implementation
  • ast - Unified AST module for multi-language parsing
  • contracts - Uniform contracts across ALL interfaces (CLI, MCP, HTTP)
  • protocol - Unified protocol design per SPECIFICATION.md Section 3
  • utils - Common utilities and helpers

§Quick Start Examples

§Basic Usage

use pmat::{MetadataCache, ContentCache};
use std::sync::Arc;
use tokio::sync::RwLock;
use lru::LruCache;
use std::num::NonZeroUsize;

// Create caches for template management
let metadata_cache: MetadataCache = Arc::new(RwLock::new(
    LruCache::new(NonZeroUsize::new(100).expect("internal error"))
));
let content_cache: ContentCache = Arc::new(RwLock::new(
    LruCache::new(NonZeroUsize::new(50).expect("internal error"))  
));

// Caches are ready for use
assert!(metadata_cache.read().await.len() == 0);
assert!(content_cache.read().await.len() == 0);

§Template Server Implementation

use pmat::{TemplateServerTrait, S3Client};
use anyhow::Result;
use std::sync::Arc;

// Example template server implementation
struct MyTemplateServer {
    client: S3Client,
}

#[async_trait::async_trait]
impl TemplateServerTrait for MyTemplateServer {
    async fn get_template_metadata(&self, uri: &str) -> Result<Arc<pmat::PublicTemplateResource>> {
        // Implementation would fetch from storage
        Ok(Arc::new(PublicTemplateResource::default()))
    }

    async fn get_template_content(&self, s3_key: &str) -> Result<Arc<str>> {
        // Implementation would fetch content from S3
        Ok(Arc::from("template content"))
    }

    async fn list_templates(&self, prefix: &str) -> Result<Vec<Arc<pmat::PublicTemplateResource>>> {
        // Implementation would list templates with prefix filter
        Ok(vec![])
    }

    fn get_metadata_cache(&self) -> Option<&pmat::MetadataCache> {
        None // Optional caching
    }
}

let server = MyTemplateServer { client: S3Client };
// Server is ready to handle template requests

Re-exports§

pub use crate::models::template::TemplateResource as PublicTemplateResource;
pub use crate::services::renderer::TemplateRenderer as PublicTemplateRenderer;
pub use models::error::TemplateError;
pub use models::template::ParameterSpec;
pub use models::template::ParameterType;
pub use services::template_service::generate_template;
pub use services::template_service::list_templates;
pub use services::template_service::scaffold_project;
pub use services::template_service::search_templates;
pub use services::template_service::validate_template;

Modules§

ast
Unified AST module for cross-language code analysis
cli
CLI module for the paiml-mcp-agent-toolkit
cli_exit
Process exit codes, declared by the site that raises the error.
contracts
Unified contract definitions for ALL interfaces (CLI, MCP, HTTP)
docs_enforcement
Documentation Enforcement
entropy
Actionable Entropy Analysis Module
explain
Centralized check/metric explanation registry.
graph
handlers
maintenance
Maintenance system for managing roadmaps and tickets.
mcp
mcp_pmcp
High-performance MCP server implementation using the pmcp SDK
mcp_server
models
Core data models for PMAT.
prompts
protocol
Unified Protocol Design implementation per SPECIFICATION.md Section 3
qdd
Quality-Driven Development (QDD) Tool
quality
red_team
roadmap
Roadmap management with PDMT todo generation and quality gate enforcement
scaffold
Scaffolding system for generating projects and agents.
services
Core services for code analysis and refactoring.
state
stateless_server
tdg
test_performance
Performance testing module for SPECIFICATION.md Section 30
unified_quality
Unified Quality Enforcement System
utils
Utility functions and helpers for PMAT.
viz
Terminal Graph Visualization Module

Macros§

__kaizen0178_schema_const
Compile-time tool schema lookup by literal tool name.
impl_service_adapter
Macro to quickly implement Service trait for adapted services
record_telemetry
Convenience macro for recording operation telemetry
status_eprintln
eprintln! for status/progress chatter: silent under --quiet.
status_println
println! for status/progress chatter: silent under --quiet.
tool_metadata
Expand to pmcp::types::ToolInfo for $name, with a schema lookup that cannot silently fall back to an empty schema.

Structs§

S3Client
Placeholder S3 client for template storage operations.
TemplateServer
Template server.

Traits§

TemplateServerTrait
Template server trait defining the interface for template management operations.

Type Aliases§

ContentCache
Shared cache for template content with LRU eviction policy.
MetadataCache
Shared cache for template metadata with LRU eviction policy.