PatternIO
A Java CLI tool that detects code smells, discovers design patterns, and generates UML class diagrams from your Java codebase, with optional AI-powered validation from 5 providers.
Features
| Feature | Description |
|---|---|
| Code smell detection | Large Class, Long Method, Feature Envy, Data Clumps, High Coupling, Low Cohesion, Duplicate Code, Long Parameter List, Unused Variables, Hardcoded Values, Cyclomatic Complexity |
| Design pattern recognition | All 23 GoF patterns (Behavioral, Creational, Structural) via AI analysis |
| UML class diagrams | Mermaid and Graphviz/DOT output with inheritance, composition & dependency relations |
| AI validation | Filter false positives with DeepSeek, Claude, Gemini, GPT, or Groq |
| Multiple output formats | Console, JSON, TXT, HTML, Mermaid, DOT |
| Web dashboard | Push results to patternio.dev and track project health over time |
| Configurable thresholds | YAML/JSON config with built-in profiles (mvp, strict, legacy) |
Installation
Quick Install (Recommended)
One-click installers that automatically download and install PatternIO to your system PATH, just download it from the home page.
Manual Installation
Download the binary for your platform:
| Platform | Download |
|---|---|
| Linux (x64) | patternio-1.0.0-linux-amd64 |
| Linux (ARM) | patternio-1.0.0-linux-arm64 |
| macOS (Intel) | patternio-1.0.0-darwin-amd64 |
| macOS (Apple Silicon) | patternio-1.0.0-darwin-arm64 |
| Windows (x64) | patternio-1.0.0-windows-amd64.exe |
Then install manually:
# Linux / macOS
chmod +x patternio-*
sudo mv patternio-* /usr/local/bin/patternio
# Windows (PowerShell as Administrator)
Move-Item patternio-*.exe C:\Windows\System32\patternio.exe
# Verify
patternio --helpUsage
Analyze a project
patternio analyze --dir ./java-projectOutput formats
# HTML report
patternio analyze --dir ./src --format html
# JSON for CI pipelines
patternio analyze --dir ./src --format json
# Multiple formats at once
patternio analyze --dir ./src --format html,json,txt
# Mermaid class diagram
patternio analyze --dir ./src --format mermaidAI-powered validation
Use any of the 5 supported AI providers to filter false-positive code smells:
# DeepSeek
patternio analyze --dir ./src --ai-provider deepseek --ai-key sk-***
# Claude
patternio analyze --dir ./src --ai-provider claude --ai-key sk-ant-***
# Gemini
patternio analyze --dir ./src --ai-provider gemini --ai-key AIza***
# GPT
patternio analyze --dir ./src --ai-provider gpt --ai-key sk-***
# Groq (Llama)
patternio analyze --dir ./src --ai-provider groq --ai-key gsk_***Or set the key as an environment variable:
export AI_API_KEY=sk-***
patternio analyze --dir ./src --ai-provider deepseekPush results to the dashboard
patternio analyze --dir ./src \
--api-token pio_sk_*** \
--format html \
--ai-provider deepseek --ai-key sk-***Results appear on your PatternIO dashboard.
Generate UML diagrams
# Mermaid format
patternio diagram --dir ./src --diagram-format mermaid
# Graphviz DOT format
patternio diagram --dir ./src --diagram-format dot
# Split by package
patternio diagram --dir ./src --split-packagesValidate parsing
patternio validate --dir ./srcBrowse the GoF pattern catalog
patternio catalogPrints all 23 Gang of Four design patterns with descriptions, use cases, GRASP mappings, and links.
Commands
| Command | Description |
|---|---|
| analyze | Run full static analysis (smells, patterns, metrics) |
| diagram | Generate UML class diagrams (Mermaid or DOT) |
| validate | Check that all Java files parse correctly |
| catalog | Display the 23 GoF design patterns catalog |
Global flags
| Flag | Default | Description |
|---|---|---|
| --dir | — | Root directory of Java project |
| --files | — | Specific .java files to analyze |
| --config | — | Config file path (YAML or JSON) |
| --profile | — | Analysis profile: mvp, strict, legacy |
| --format | console | Output format(s): console, json, txt, html, mermaid, dot |
| --output-dir | out | Output directory for reports |
| --filter | — | Filter by package (e.g. pkg:com.example) |
| --include | — | Include filename pattern |
| --exclude | — | Exclude filename pattern |
| --ai-provider | — | AI provider: deepseek, claude, gemini, gpt, groq |
| --ai-model | — | Override default AI model name |
| --ai-key | — | API key (or use env vars) |
Built-in profiles
patternio analyze --dir ./src --profile strict # tighter thresholds
patternio analyze --dir ./src --profile mvp # relaxed for prototypes
patternio analyze --dir ./src --profile legacy # tolerant for old codebasesCode smells detected
| Smell | GRASP Principle | Metric |
|---|---|---|
| Long Parameter List | Information Expert | params > threshold |
| High Coupling (CBO) | Low Coupling | CBO > threshold |
| Low Cohesion (LCOM) | High Cohesion | LCOM > threshold |
| Large Class | Controller | methods + fields too large |
| Long Method | Controller | lines > threshold |
| Cyclomatic Complexity | Polymorphism | branches > threshold |
| Hardcoded Values | Protected Variations | magic numbers/strings |
| Duplicate Code | Pure Fabrication | repeated blocks |
| Unused Variables | Information Expert | declared but never read |
Web dashboard
Create a free account at patternio.dev, generate an API token, then push results:
patternio analyze --dir ./src --api-token pio_sk_***The dashboard gives you:
- Analysis history — track smells and health score over time
- Per-class metrics — CBO, LCOM, line counts, violation breakdowns
- UML diagrams — interactive Mermaid class diagrams
- AI suggestions — GoF pattern recommendations with confidence scores
- Team sharing — share analysis results across your team
License
MIT © PatternIO