Skip to main content

Crate repo_mapper

Crate repo_mapper 

Source
Expand description

Token-budget-respecting repository map generator.

Produces a compact textual summary of a source code repository by:

  • Extracting symbol tags (definitions and references) with tree-sitter
  • Building a weighted directed file-dependency graph
  • Running Personalized PageRank to rank files by structural relevance
  • Rendering ranked definitions within a token budget

§Quick start

use repo_mapper::RepoMapConfig;

let mut repo_map = RepoMapConfig::builder()
    .root("/path/to/repo")
    .map_tokens(1024)
    .build();

let files = vec![std::path::PathBuf::from("/path/to/repo/src/main.rs")];
let map = repo_map.get_repo_map(&[], &files, &Default::default(), &Default::default());
if let Some(text) = map {
    print!("{text}");
}

Re-exports§

pub use config::RefreshMode;
pub use config::RepoMapConfig;
pub use config::RepoMapConfigBuilder;
pub use repo_map::RepoMap;

Modules§

budget
Binary search for token budget (SPEC §10.2).
cache
Caching modules.
config
Configuration types (SPEC §14).
edge_cases
Edge case handling (SPEC §13).
extract
Core tag extraction (SPEC §3).
file
File reading utilities (SPEC §13.5, §13.6).
graph
Graph construction (SPEC §6).
important
Important files list (SPEC §8).
lang
Language detection from filenames (SPEC §3.1, §4).
parser
Parser registry for tree-sitter languages.
path
Path utilities for relative path computation (SPEC §2.2).
queries
Query registry with bundled .scm files (SPEC §4.1).
rank
PageRank ranking (SPEC §7).
render
Map rendering (SPEC §9).
repo_map
RepoMap public API.
tokens
Token counting with tiktoken (SPEC §10.1).
weight
Edge weight calculation (SPEC §6.4).

Structs§

Tag
A tag extracted from source code (SPEC §2.1).

Enums§

TagKind
The kind of tag: definition or reference (SPEC §2.1).