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.

Get Your Token

Features

FeatureDescription
Code smell detectionLarge Class, Long Method, Feature Envy, Data Clumps, High Coupling, Low Cohesion, Duplicate Code, Long Parameter List, Unused Variables, Hardcoded Values, Cyclomatic Complexity
Design pattern recognitionAll 23 GoF patterns (Behavioral, Creational, Structural) via AI analysis
UML class diagramsMermaid and Graphviz/DOT output with inheritance, composition & dependency relations
AI validationFilter false positives with DeepSeek, Claude, Gemini, GPT, or Groq
Multiple output formatsConsole, JSON, TXT, HTML, Mermaid, DOT
Web dashboardPush results to patternio.dev and track project health over time
Configurable thresholdsYAML/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:

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 --help

Usage

Analyze a project

patternio analyze --dir ./java-project

Output 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 mermaid

AI-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 deepseek

Push 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-packages

Validate parsing

patternio validate --dir ./src

Browse the GoF pattern catalog

patternio catalog

Prints all 23 Gang of Four design patterns with descriptions, use cases, GRASP mappings, and links.


Commands

CommandDescription
analyzeRun full static analysis (smells, patterns, metrics)
diagramGenerate UML class diagrams (Mermaid or DOT)
validateCheck that all Java files parse correctly
catalogDisplay the 23 GoF design patterns catalog

Global flags

FlagDefaultDescription
--dirRoot directory of Java project
--filesSpecific .java files to analyze
--configConfig file path (YAML or JSON)
--profileAnalysis profile: mvp, strict, legacy
--formatconsoleOutput format(s): console, json, txt, html, mermaid, dot
--output-diroutOutput directory for reports
--filterFilter by package (e.g. pkg:com.example)
--includeInclude filename pattern
--excludeExclude filename pattern
--ai-providerAI provider: deepseek, claude, gemini, gpt, groq
--ai-modelOverride default AI model name
--ai-keyAPI 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 codebases

Code smells detected

SmellGRASP PrincipleMetric
Long Parameter ListInformation Expertparams > threshold
High Coupling (CBO)Low CouplingCBO > threshold
Low Cohesion (LCOM)High CohesionLCOM > threshold
Large ClassControllermethods + fields too large
Long MethodControllerlines > threshold
Cyclomatic ComplexityPolymorphismbranches > threshold
Hardcoded ValuesProtected Variationsmagic numbers/strings
Duplicate CodePure Fabricationrepeated blocks
Unused VariablesInformation Expertdeclared 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