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

mapra

v0.1.1

Published

Codebase intelligence for AI agents — stop exploring, start building

Readme

mapra

Stop exploring. Start building.

Mapra encodes your codebase's structure, risk, and complexity into a single version-controlled file — so you and your AI tools understand the whole picture before touching any code.

What does it do?

AI coding agents spend significant time exploring codebases — listing directories, reading files to understand structure, figuring out what depends on what. In testing, a typical structural question required 45 tool calls without mapra. With mapra: zero.

Mapra scans your codebase and produces a .mapra file that captures:

  • Risk — blast radius, cascade depth, and hidden amplifiers (files where a small change breaks many things)
  • Churn — what's been changing and how fast
  • Hotspots — complexity scores for files that need the most care
  • Infrastructure — how your modules connect
  • Conventions — patterns your codebase already follows

One file read gives your AI agent instant structural awareness.

Quick Start

npx mapra

That's it. This scans your codebase, generates .mapra, wires it into your CLAUDE.md, and installs git hooks to keep it fresh.

Requirements

  • Node.js >= 18
  • A git repository

What you get

Here's a real .mapra file from a Next.js app (300 files, 53K lines):

MAPRA v3 | myapp | Nextjs | 300 files | 53,081 lines | generated 2026-03-06
LEGEND: ×N=imported by N files | ×A→B=A direct, B total affected | dN=cascade depth | [AMP]=amplification>=2x

─── RISK (blast radius — modifying these cascades broadly) ─
[AMP] amp7.0  ×3→21     d3   3mod  T5   src/lib/constants.ts
  exports: ORDER_ONLINE_URL
[AMP] amp3.6  ×7→25     d4   3mod  T4   src/lib/ordering-server.ts
  exports: PeriodAvailability
  +55 more with blast radius > 1

─── CHURN (last 30 days, top movers) ─────────────────────
20 commits   +1159 -1011  src/app/api/orders/route.ts  "feat: pre-order core"
12 commits   +306 -36     src/lib/ordering.ts  "feat: pre-order foundation"

─── HOTSPOTS (complexity > 0.3) ─────────────────────────
0.79  src/batch/runner.ts       543L 13imp
0.75  src/cli/index.ts          833L  5imp

The RISK section is mapra's unique value — it shows hidden amplifiers: files with few direct importers but high cascade impact. constants.ts above has only 3 direct importers but affects 21 files (amp 7.0). No other tool surfaces this.

Reading the output

The .mapra header includes a LEGEND that decodes the compact notation:

| Symbol | Meaning | Example | |--------|---------|---------| | ×N | Imported by N files | ×3 = 3 files import this | | ×A→B | A direct importers, B total affected (cascade) | ×3→21 = 3 direct, 21 total | | [AMP] | Hidden amplifier — amplification ratio >= 2x | Few importers but large cascade | | ampN | Amplification ratio (affected / direct) | amp7.0 = 7x amplification | | dN | Cascade depth (longest chain) | d3 = 3 hops max | | Nmod | Number of modules affected | 3mod = crosses 3 module boundaries | | TN | Number of test files covering this file | T5 = 5 test files | | NL | Lines of code | 543L = 543 lines |

Commands

mapra                        First-time setup (generate + wire + hooks)
mapra update                 Regenerate .mapra after code changes
mapra status                 Check .mapra freshness, hook state, wiring

Setup details

mapra setup does four things:

  1. Scans your codebase and writes .mapra
  2. Adds an @.mapra reference to your CLAUDE.md
  3. Installs git hooks (post-commit, post-merge, post-checkout) for auto-update
  4. Adds a prepare script to package.json so teammates get hooks on npm install

Other commands

mapra generate [path]        Scan and write .mapra (without wiring CLAUDE.md)
mapra init [path]            Wire @.mapra into CLAUDE.md (without regenerating)
mapra install-hooks [path]   Install git hooks manually
mapra uninstall-hooks [path] Remove mapra git hooks
mapra validate-plan <file>   Cross-reference a plan's file paths against .mapra

Auto-Update

After setup, .mapra stays fresh automatically:

  • Git hooks regenerate .mapra silently after every commit, merge, and branch switch
  • Teammates get hooks automatically via npm install (prepare script)
  • Safe — regeneration runs in the background; if it fails, your existing .mapra stays intact

Run mapra status to verify everything is working. To remove: mapra uninstall-hooks.

Troubleshooting

Shallow clones

If you cloned with --depth, the CHURN section will be empty or incomplete. Fix with:

git fetch --unshallow
mapra update

.mapra in .gitignore

.mapra should be committed — it's how your team shares structural awareness. If mapra status warns about .gitignore, remove the .mapra entry.

Stale .mapra

If mapra status shows "may be stale", run mapra update. With auto-update hooks installed, this shouldn't happen.

How It Works

  1. Scan — parses source files, extracting imports, exports, and module boundaries
  2. Analyze — computes blast radius, churn velocity, dead code, and convention patterns
  3. Encode — compresses everything into a compact .mapra file (~1-2K tokens for most projects)
  4. Wire — adds an @.mapra reference to your CLAUDE.md so AI tools load the map automatically

Language Support

Currently supports TypeScript and JavaScript codebases (.ts, .tsx, .js, .jsx, .mjs, .cjs). Prisma schemas are also parsed for database relationships.

License

MIT