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

@mrbns/code-indexer

v0.1.1

Published

Generate greppable per-target indexes of every exported symbol in a TypeScript repo, built for AI-agent code navigation.

Readme

@mrbns/code-indexer

Generates greppable per-target indexes of every exported symbol in a TypeScript repo. Built so AI coding agents can find the right file in one index read + one grep instead of exploring directories.

Deterministic — extraction uses the TypeScript parser only (no LLM, no type checker), so the same source always produces the same index and CI can verify freshness with git diff --exit-code.

Usage

code-indexer full-scan   # rebuild every index file from all tracked files
code-indexer git-diff    # patch indexes using only the staged changes (for pre-commit hooks)

# options
code-indexer full-scan --config ./code-indexer.config.json --out .agents/index

Requires git (files are discovered via git ls-files / git diff --cached). Only tracked files are indexed: brand-new files enter the index when first staged (the pre-commit git-diff mode picks them up), never while untracked.

Config

Resolution order (first match wins):

  1. --config <path> CLI flag
  2. .config/code-indexer.json at the repo root (dot-config convention) — contains the config object directly; the "code-indexer" wrapper key is only for manifest files
  3. A "code-indexer" field in package.json, then deno.json — either an inline config object or a string path to a JSON config file (relative to the repo root; deno.jsonc is not supported)

No dedicated config file is needed — a manifest field is enough:

{
  "code-indexer": {
    "targets": [
      { "name": "server", "base": "apps/server/src" },
      { "name": "website", "base": "apps/website", "include": ["app/**", "lib/**"] }
    ]
  }
}

Or point the field at a file instead: "code-indexer": "./configs/indexer.json".

All other fields are optional (defaults shown):

{
  "outDir": ".agents/index",
  "blockThreshold": 10,
  "extensions": [".ts", ".tsx"],
  "exclude": ["**/*.d.ts", "**/*.test.*", "**/*.spec.*", "**/__tests__/**", "**/*.gen.*"]
}
  • targets (required) — each becomes <outDir>/<name>.md; index paths are relative to base. include/exclude are globs (**, *, ?) relative to base; include defaults to everything.
  • outDir — default .agents/index.
  • blockThreshold — files with more exports than this switch from one-line-per-file to one-line-per-symbol form (default 10).
  • exclude — applies to every target; shown above are the defaults.

Index format

Each index file is YAML frontmatter (target name, base path, format, regenerate commands), an H1 title, then raw record lines — lint-clean markdown with no other markup. Every record line starts with a <path> | prefix, so grep hits are always self-contained:

modules/cart/service.ts | fn addToCart, fn removeItem | Cart line-item operations
modules/products/types.ts | 42 exports | Product domain types
modules/products/types.ts | type Product
modules/products/types.ts | type ProductVariant

Only exported symbols are indexed (export const counts; local variables and private helpers never appear). Re-exports are summarized as * from ./x rather than expanded. The description column is harvested from the first JSDoc line among a file's exports — optional, never required.

Pre-commit (lefthook example)

pre-commit:
  jobs:
    - name: Updating code index
      glob: "*.{ts,tsx}"
      run: pnpm exec code-indexer git-diff && git add .agents/index