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

@ngommans/codefocus

v1.0.0

Published

Smart code context aggregator — AST-powered search that returns structured, ranked code context for LLM agents

Readme

codefocus

CI npm License: MIT Node 18+

AST-powered code search that returns structured, ranked context for LLM agents.

Tree-sitter parses your codebase into a SQLite graph database. Queries combine full-text search, symbol-aware graph traversal, and PageRank scoring to return the most relevant code sections within a token budget. One call replaces multiple grep/read round-trips.

Install

npm install -g @ngommans/codefocus
# or use directly
npx @ngommans/codefocus

Requires Node 18+.

Quick start

# Index your project (creates .codefocus/index.db)
codefocus index --root .

# Search for relevant code context
codefocus query "handleSync" --budget 8000

# Get a high-level codebase overview
codefocus map --budget 2000

# Find a specific symbol
codefocus find "MyClass" --kind class

# Show dependency graph for a file
codefocus graph src/services/auth.ts

Commands

| Command | Description | |---------|-------------| | index | Parse the codebase with tree-sitter and store symbols in SQLite | | query | Search and return ranked, budget-constrained code context | | find | Quick symbol lookup by name and optional kind filter | | graph | Show dependency graph for a file or symbol | | map | High-level codebase overview ranked by PageRank | | serve | Start MCP server (stdio transport) |

Claude Code integration

MCP server (recommended)

Add .mcp.json to your project root:

{
  "mcpServers": {
    "codefocus": {
      "command": "npx",
      "args": ["--yes", "@ngommans/codefocus", "serve", "--root", "."]
    }
  }
}

Claude Code auto-discovers the MCP server and exposes query, find, graph, and map as tools with sub-10ms response times.

Auto-indexing hook

Add .claude/hooks.json to keep the index fresh:

{
  "hooks": {
    "SessionStart": [{
      "command": "npx --yes @ngommans/codefocus index --root .",
      "timeout": 30000
    }]
  }
}

How it works

  1. Index — tree-sitter parses TypeScript/JavaScript files, extracting symbols (functions, classes, interfaces, types), imports, and cross-file references into a SQLite database with FTS5 full-text search.

  2. Query — combines symbol-name matching, FTS5 content search, and graph expansion (BFS along import/reference edges). Results are ranked by match strength, term frequency, symbol proximity, and PageRank. Relevance thresholds prune noise automatically.

  3. Output — ranked code sections with YAML front matter, constrained to a token budget. One query replaces 3-7 grep/read cycles.

Configuration

Tuning parameters can be customized per-project via .codefocus/config.json:

{
  "scoring": {
    "scoreFloorRatio": 0.20,
    "elbowDropRatio": 0.60,
    "minMarginalValue": 0.00003,
    "symbolProximityBoost": 1.5,
    "defaultBudget": 8000,
    "defaultDepth": 2
  }
}

License

MIT