npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@snevins/repo-mapper

v1.5.3

Published

Generate token-budgeted repo maps for LLM context using tree-sitter and PageRank

Downloads

1,398

Readme

repo-mapper

npm version License: MIT

Generate token-budgeted maps of code repositories for LLM context. Uses tree-sitter for accurate parsing and PageRank for importance ranking.

Features

  • Token budgeting: Fit the most important code into your context window
  • Smart ranking: PageRank algorithm prioritizes frequently-referenced code
  • Module clustering: Groups files by directory with global top-50 guarantee
  • Focus mode: Bias output toward files you're working on
  • Fast caching: Only re-parses changed files

Supported Languages

| Language | Extensions | |----------|------------| | TypeScript | .ts, .tsx, .mts, .cts | | JavaScript | .js, .jsx, .mjs, .cjs | | Python | .py, .pyw | | Go | .go | | Rust | .rs | | Solidity | .sol |

Installation

# Run directly with npx
npx @snevins/repo-mapper@latest . --tokens 4000

# Or install globally
npm install -g @snevins/repo-mapper
repo-mapper . --tokens 4000

Usage

repo-mapper [paths...] [options]

Options

| Option | Default | Description | |--------|---------|-------------| | -t, --tokens <n> | 4000 | Maximum tokens for output | | -f, --focus <file> | | Files to prioritize (repeatable) | | -o, --output <file> | stdout | Write output to file | | -r, --refresh | false | Ignore cache, re-parse all | | -v, --verbose | false | Print progress info | | --type <lang> | | Filter by language: ts, js, python, go, rust, solidity (repeatable) | | --ignore <pattern> | | Additional ignore patterns (repeatable) | | --include <pattern> | | Only include files matching pattern (repeatable) | | --no-ignore | false | Disable default ignores | | --max-files <n> | 10000 | Maximum files to process |

Examples

# Map current directory with 2000 token budget
repo-mapper . -t 2000

# Focus on specific files you're editing
repo-mapper . -f src/api.ts -f src/types.ts -t 4000

# Only TypeScript files
repo-mapper . --type ts -t 2000

# Only Rust files in a mixed repo
repo-mapper . --type rust -t 2000

# Save to file for LLM prompt
repo-mapper . -t 8000 -o context.md

# Full refresh, verbose output
repo-mapper . -r -v

Output Format

src/ranking.ts:
(Rank: 0.1234)

  15: export function rankDefinitions(tags: Tag[], graph: FileGraph): RankedDefinition[] {
  42: export function buildPersonalization(focusFiles: string[]): Map<string, number> {

src/pagerank.ts:
(Rank: 0.0891)

   8: export function computePageRank(graph: FileGraph, options?: PageRankOptions): Map<string, number> {

Caching

Cache is stored in a global directory to avoid polluting your repository:

| Platform | Location | |----------|----------| | Linux | ~/.cache/repo-mapper/ (or $XDG_CACHE_HOME/repo-mapper/) | | macOS | ~/Library/Caches/repo-mapper/ | | Windows | %LOCALAPPDATA%\repo-mapper\Cache\ |

Each project gets a unique subdirectory based on its path. Files are re-parsed only when modified (mtime-based invalidation).

Clear cache with: rm -rf ~/.cache/repo-mapper (Linux) or equivalent for your platform

How It Works

  1. Discover - Find all supported source files
  2. Parse - Extract definitions and references using tree-sitter
  3. Graph - Build reference graph (file A calls function in file B)
  4. Rank - Run PageRank to score files by importance
  5. Budget - Binary search to fit top definitions within token limit

Claude Code Plugin

repo-mapper includes a Claude Code plugin with commands and skills.

Installation

# Add to your Claude Code plugins
claude plugins add /path/to/repo-mapper-ts

Commands

| Command | Description | |---------|-------------| | /status | Check if repo-mapper is installed and up to date | | /update-codemap | Generate or update CODEMAP.md with smart language detection |

Skills

The using-repo-mapper skill provides guidance on effective repo-mapper usage patterns.

License

MIT