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

@plunderstruck/repo-ctx

v0.2.0

Published

Agent-first JavaScript and TypeScript code navigation CLI.

Readme

ctx Tool

ctx is an agent-first JavaScript and TypeScript code navigation CLI.

The tool builds a compact structural model of a codebase so an agent can work from indexed symbols, call graphs, data flow, and compact reports instead of repeatedly reading raw files into context.

Examples below use ctx as the installed command name. In this repo checkout, run node tools/ctx/ctx ... from the repo root. Use ctx --root /path/to/repo ... when you want to target a repo other than the current working directory.

Why Use It

  • Find exported, private, and nested symbols without grepping files by hand.
  • Follow call relationships and data flow from real AST-based analysis.
  • See impact and blast radius from one CLI surface.
  • Prefer compact outputs when they help an agent stay precise with fewer tokens.

Quick Start

Install globally:

npm install -g @plunderstruck/repo-ctx
ctx --help

Or use the repo-local checkout:

npm install
node tools/ctx/ctx --help

Initialize ctx for an existing repo:

ctx init

That writes both ctx/config.json and a starter ctx/arch.json when the repo does not already have an architecture config.

Preview the generated config first:

ctx init --dry-run

Build the index:

ctx index

Use the indexed surfaces:

ctx find runRegen
ctx about runRegen
ctx context buildIndexedFileEntry --callers
ctx file tools/ctx/lib/index/regen.js

When in doubt, start with live help:

ctx help
ctx help context

Core Workflow

  1. Run ctx init once per repo.
  2. Run ctx index after source changes.
  3. Use find, file, about, context, code, dataflow, and slice to navigate the codebase.
  4. Use affected, cycles, and similar for change and hygiene views.

Command Chooser

  • find searches for symbols by name or keyword.
  • file shows one file's indexed symbols.
  • about is the symbol card: signature and direct callers/callees.
  • context is the local call-graph view around one symbol.
  • code returns a bounded source snippet for one symbol.

Output Defaults

ctx does not force one renderer for every command.

  • find defaults to TOON because exact symbol identity matters more than prose when names collide.
  • file, about, context, code, impact, complexity, dataflow, and slice stay human-first because their structured forms are materially larger on real code and often repeat identity context across distinct results.
  • map tree stays markdown-first.
  • map stats is best as a human summary, with TOON useful when another tool needs explicit fields.

Use --toon, --json, or --human when a command supports them. Use ctx help <command> for the live contract.

Symbol Coverage

A symbol in ctx is a named code unit the agent can identify and relate. The current JS/TS parser covers:

  • function declarations
  • function-valued const bindings
  • property-assigned functions such as store.reset = () => {}
  • class declarations and class expressions assigned to bindings
  • object-literal methods and accessors under named bindings
  • methods, accessors, class properties, constructors, and constructor parameter properties
  • private class members
  • nested local helpers
  • destructured bindings
  • default exports, CommonJS export assignments, and named/namespace re-exports

The parser intentionally excludes throwaway anonymous callbacks that do not help navigation.

Key Commands

Use ctx help <command> or append --help for live usage.

Indexing

  • ctx init [--dry-run] [--force] [--json]
  • ctx index [--force]

Discovery

  • ctx find "<query>" [filters]
  • ctx file <path>
  • ctx about <symbol>
  • ctx context <symbol> [--depth=N] [--callers] [--budget=N]
  • ctx code <symbol> [--context=<n>]

Analysis

  • ctx impact <symbol> [--depth=N]
  • ctx complexity <symbol>
  • ctx dataflow <symbol>
  • ctx slice <symbol> <variable> [--forward|--backward] [--line=N]

Navigation

  • ctx map tree [--human|--toon|--json]
  • ctx map stats [--human|--json|--toon] [--files] [--full]
  • ctx config <key> [value]

Change And Hygiene

  • ctx affected [ref] [--tests-only] [--verbose|-v] [--since=REF]
  • ctx cycles
  • ctx similar [--to=<symbol>] [--group] [--path=<dir>] [--threshold=<0-1>] [--max=N]

Choosing The Right Symbol Command

  • about is the symbol card. Use it for identity and direct callers/callees.
  • context is the local call-graph view. Use it to walk outward through callees or inspect direct callers around one symbol.
  • impact is the reverse blast-radius view. Use it to trace caller chains back to entry points.

Repo And Package Surface

The named CLI entrypoint is tools/ctx/cli.js. The extensionless tools/ctx/ctx file is now only a tiny shim so existing repo-local workflows keep working.

Useful package scripts:

npm test
npm run check:self-host
npm run self:index
npm run self:help

Generated Files

Do not edit these by hand:

  • ctx/config.json
  • ctx/manifest.json
  • ctx/index.top.md
  • ctx/files/**