Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SourceMapper

A visual code analysis tool for Rust projects that maps function call relationships across your entire codebase.

🚀 Features

  • Multi-file Analysis - Parses entire Rust projects and tracks relationships across files
  • Cross-file Call Graphs - Visualize how functions call each other, even across module boundaries
  • Import Resolution - Handles use statements to accurately resolve function calls
  • Interactive Visualization - Click nodes to explore function details, callers, and callees
  • Real-time Metrics - See call counts, hotspots, and project statistics
  • Single Binary - Backend and frontend bundled together for easy deployment

📸 Screenshots

Screenshot 2025-11-06 at 7 58 22 PM

🏃 Quick Start

Prerequisites

  • Rust (1.70+)
  • Node.js (18+)
  • npm

Installation

  1. Clone the repository
git clone https://github.com/YOUR_USERNAME/sourcemapper.git
cd sourcemapper
  1. Build the frontend
cd ui
npm install
npm run build
cd ..
  1. Run the server. runs at port http://localhost:5173/
cargo run --release

📖 How It Works

1. Parsing

Uses tree-sitter to parse Rust source files and extract:

  • Function definitions
  • Function calls
  • Import statements (use declarations)
  • Module structure

2. Symbol Resolution

Builds a symbol database that:

  • Maps function names to their definitions
  • Resolves imports to full paths
  • Tracks cross-file relationships

3. Call Graph Construction

Creates a directed graph where:

  • Nodes = Functions
  • Edges = Function calls
  • Handles crate:: paths and module resolution

4. Visualization

Renders the graph with:

  • Hierarchical layout using Dagre
  • Interactive node selection
  • Detailed side panel with metrics

🎯 Use Cases

  • Code Navigation - Quickly understand how functions relate to each other
  • Dependency Analysis - Find highly coupled functions or orphaned code

📊 Metrics

SourceMapper calculates and displays:

  • Total functions and calls in the project
  • Call count per function (how many times a function is called)
  • Hotspots (most frequently called functions) → yet to be implemented.
  • Caller/callee relationships
  • Project-level statistics

🗺️ Roadmap

Completed ✅

  • Multi-file Rust parsing
  • Cross-file call graph generation
  • Import resolution (use statements)
  • Interactive graph visualization
  • Function metrics and statistics
  • Side panel with detailed information

Future Ideas 🚀

  • Single binary deployment.
  • Bidirectional Editing - Modify code through the UI
    • Edit doc comments from side panel
    • Rename functions with automatic refactoring
    • Add new function stubs visually.
  • Export graphs as images (PNG, SVG)

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages