Skip to content
SourceVision

SourceVision

Static analysis engine that inventories files, maps imports, detects architectural zones, and catalogs React components.

What It Does

SourceVision runs a 4-phase analysis pipeline:

  1. Inventory — Scan all files, classify by type and role
  2. Imports — Build the dependency graph
  3. Zones — Detect architectural communities via Louvain algorithm, then enrich with AI
  4. Components — Catalog React components with props and usage patterns

CLI

sh
sourcevision analyze .                    # full analysis
sourcevision analyze --fast .             # skip AI enrichment
sourcevision analyze --phase zones .      # run specific phase
sourcevision serve .                      # interactive browser viewer
sourcevision validate .                   # validate analysis output
sourcevision export-pdf .                 # export analysis as PDF report
sourcevision pr-markdown .                # regenerate PR markdown summary
sourcevision git-credential-helper .      # interactive GitHub credential setup
sourcevision reset .                      # clear analysis data
sourcevision workspace .                  # aggregate multiple repos into unified view
sourcevision mcp .                        # start MCP server (stdio)

The sv command is an alias for sourcevision.

Output Files

All output is written to .sourcevision/:

FileContents
manifest.jsonAnalysis metadata, version, timestamps
inventory.jsonFile listing with classifications
imports.jsonDependency graph (edges + metadata)
zones.jsonArchitectural zone map with cohesion/coupling metrics
components.jsonReact component catalog
llms.txtAI-readable codebase summary
CONTEXT.mdDetailed AI context document
zones/{zone-id}/Per-zone context and summary files

Findings

SourceVision produces findings in several categories:

TypeDescriptionActionable?
anti-patternArchitectural violations (circular deps, high coupling)Yes
suggestionImprovement recommendationsYes
move-fileFile placement recommendationsYes
observationMetric descriptions ("Cohesion is 0.36")No
patternDetected code patternsNo
relationshipDependency descriptionsNo

The --actionable-only flag on ndx recommend filters to only the first three types.

Viewer

sh
sourcevision serve .    # opens browser viewer
ndx start .             # includes viewer in dashboard

The viewer provides 8 views: Overview, Imports, Zones, Files, Routes, Architecture, Problems, and Suggestions.

Zone Detection

Zones are detected using Louvain community detection on the import graph, then refined through multiple post-processing passes (small zone absorption, satellite merging, large zone splitting). AI enrichment optionally names zones, writes descriptions, and generates per-zone context files.

For a thorough explanation of the Louvain algorithm, findings system, risk assessment, and all configuration options, see SourceVision Analysis Deep Dive.

See Zone Naming Conventions for naming standards.

MCP Tools

Available via sourcevision mcp . (stdio) or ndx start . (HTTP). Claude Code prefixes these as mcp__sourcevision__{tool}; Codex uses bare names.

ToolDescription
get_overviewProject summary statistics
get_next_stepsPrioritized improvement recommendations
get_zoneArchitectural zone details
get_findingsAnalysis findings (anti-patterns, suggestions, observations)
get_file_infoFile inventory entry, zone, and imports
search_filesSearch inventory by path, role, or language
get_importsImport graph edges
get_classificationsFile archetype classifications
set_file_archetypeOverride archetype classification for a file
get_route_treeRoute structure (pages, API routes, layouts)

Released under the Elastic License 2.0.