merlin tree

Interactive code structure visualization and dependency analysis. Explore file organization, analyze project structure patterns, and understand code relationships.

Basic Usage

# Display project structure
merlin tree .

# Show with summary format
merlin tree . --format summary

# Limit depth to 3 levels
merlin tree . --depth 3

Pro Tip

Use merlin tree . --show-dependencies to visualize how your modules connect and identify potential refactoring opportunities.

Visualization Features

Structure Analysis

  • File hierarchy display
  • Directory organization
  • File type classification
  • Project structure patterns
  • Code organization insights

File Metrics

  • File size analysis
  • File count statistics
  • Directory depth tracking
  • Size-based filtering
  • Project size overview

Dependency Tracking

  • File dependency relationships
  • Dependency visualization
  • Relationship mapping
  • Connection analysis
  • Dependency depth

Output Formats

  • Interactive terminal display
  • Summary statistics
  • Detailed analysis
  • JSON data export
  • Statistics tables

Advanced Options

--format

Output format (interactive, summary, detailed, json)

$ merlin tree . --format interactive
--depth

Maximum depth to traverse (default: unlimited)

$ merlin tree . --depth 3
--show-dependencies

Show file dependencies

$ merlin tree . --show-dependencies
--file-types

Filter by specific file types

$ merlin tree . --file-types python --file-types javascript
--exclude

Exclude patterns (e.g., __pycache__, *.pyc)

$ merlin tree . --exclude __pycache__ --exclude *.pyc
--min-size

Minimum file size in bytes

$ merlin tree . --min-size 1024
--max-size

Maximum file size in bytes

$ merlin tree . --max-size 1048576

Output Formats

interactive

Rich terminal visualization with navigation

Best for: Interactive exploration of codebase structure

summary

Concise overview with key metrics

Best for: Quick project overview and statistics

detailed

Comprehensive analysis with all information

Best for: In-depth structural analysis

json

Structured data for automation

Best for: Integration with other tools and scripts

Example Tree Output

🌳 Merlin Tree Analyzer v0.1.0
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📁 PROJECT: /Users/dev/my-app
my-app/
├── src/
│ ├── components/
│ │ ├── Header.tsx (2.1KB)
│ │ ├── Footer.tsx (1.8KB)
│ │ └── Button.tsx (3.2KB) → 5 imports
│ ├── pages/
│ │ ├── index.tsx (4.5KB)
│ │ └── about.tsx (2.8KB)
│ └── utils/
│ ├── helpers.ts (1.2KB)
│ └── constants.ts (0.5KB) ⚠ unused
├── package.json (dependencies: 23)
└── README.md (3.1KB)
📊 ANALYSIS SUMMARY
• Total files: 42 • Total size: 156KB
• Avg file size: 3.7KB • Max depth: 4
• Dependencies: 23 external, 89 internal
• Circular deps: 0 • Unused files: 1
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Dependency Visualization

Interactive Dependency Maps

Generate visual dependency graphs that show how your modules connect, identify bottlenecks, and highlight refactoring opportunities.

$ merlin tree . --show-dependencies --format interactive

Related Commands

Use tree visualization alongside other Merlin analysis tools for comprehensive code insights.