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

@n-dx/sourcevision

v0.1.8

Published

Codebase analysis tool with structured, git-friendly output

Readme

@n-dx/sourcevision

This is an internal package of @n-dx/core. Install @n-dx/core instead — it includes this package and registers all CLI commands.

Codebase analysis tool that produces structured, git-friendly JSON output describing your project's file inventory, import graph, architectural zones, component definitions, and route structure — with an interactive browser-based viewer and AI integration.

Quick Start

npm i -g sourcevision
sourcevision analyze
sourcevision serve

Open http://localhost:3117 to explore results.

What It Analyzes

Inventory (Phase 1) — Files, languages, line counts, roles, categories. Deterministic SHA-256 hashes.

Imports (Phase 2) — TypeScript/JavaScript import graph via AST analysis. Detects static, dynamic, type, require, and re-export edges. Circular dependency detection. External package tracking.

Zones (Phase 3) — Louvain community detection groups files into architectural zones with cohesion/coupling metrics. Optional AI enrichment (via Claude) adds meaningful names, descriptions, and findings across multiple passes.

Components (Phase 4) — React/Preact component definitions (function, arrow, class, forwardRef). JSX usage graph. React Router v7 / Remix flat-file route detection with convention export analysis (loader, action, meta, etc).

AI Output — Generates llms.txt and CONTEXT.md for LLM consumption. MCP server for real-time AI tool integration.

CLI Reference

sourcevision init              Set up .sourcevision/ in the current project
sourcevision analyze [dir]     Run analysis pipeline (default: .)
sourcevision serve [dir]       Start local viewer (default: .)
sourcevision validate [dir]    Validate .sourcevision/ output files
sourcevision pr-markdown [dir] Regenerate PR markdown at .sourcevision/pr-markdown.md
sourcevision reset [dir]       Remove .sourcevision/ and start fresh
sourcevision mcp [dir]         Start MCP server for AI tool integration

Options

| Flag | Description | |------|-------------| | --port=N | Server port for serve (default: 3117) | | --phase=N | Run only phase N (1=inventory, 2=imports, 3=zones, 4=components) | | --only=MODULE | Run only named module (inventory, imports, zones, components) | | --fast | Skip AI zone-name enrichment (use algorithmic names) |

Output Files

All output is written to .sourcevision/:

| File | Description | |------|-------------| | manifest.json | Metadata, git info, module status tracking | | inventory.json | Complete file inventory with language/role classification | | imports.json | Import graph edges, externals, circulars | | zones.json | Architectural zones with metrics and findings | | components.json | Component definitions, usage graph, route modules | | pr-markdown.md | Regenerated PR-ready markdown based on git diff | | llms.txt | Structured Markdown summary for LLM consumption | | CONTEXT.md | Dense summary with XML markers for Claude parsing |

All JSON output is canonically sorted for deterministic, git-friendly diffs.

AI Integration

llms.txt

Generated automatically after analysis. Provides a structured Markdown summary including project identity, architecture zones, key dependencies, route structure, findings, and file inventory.

CONTEXT.md

Optimized for Claude context windows (~8K tokens). Uses XML-style section markers (<architecture>, <zones>, <routes>, <findings>) for reliable parsing.

MCP Server

Start the MCP server for real-time AI tool integration:

sourcevision mcp

Configure in your MCP client:

{
  "mcpServers": {
    "sourcevision": {
      "command": "sourcevision",
      "args": ["mcp", "/path/to/project"]
    }
  }
}

Tools: get_overview, get_zone, get_file_info, get_imports, get_route_tree, search_files, get_findings

Resources: sourcevision://summary, sourcevision://zones, sourcevision://routes

Viewer Guide

The browser viewer (sourcevision serve) provides these views:

  • Overview — Stats grid, language breakdown, most imported files, circulars, module status
  • Import Graph — Force-directed SVG graph colored by zone, cross-zone edges highlighted
  • Zones — Zone cards with cohesion/coupling meters, findings, file lists
  • Files — Searchable, filterable, sortable file table
  • Routes — Route tree, route module table, convention coverage, component usage
  • Architecture — Architectural patterns and relationships (requires AI enrichment pass 2)
  • Problems — Anti-pattern findings grouped by severity (requires pass 3)
  • Suggestions — Improvement suggestions (requires pass 4)

Testing

npm test              # Run all tests
npm run test:watch    # Watch mode

Test structure:

  • tests/unit/ — Unit tests for analyzers, utils, schema validation
  • tests/integration/ — Pipeline tests, llms.txt/context generation
  • tests/e2e/ — CLI end-to-end tests against fixture projects
  • tests/fixtures/ — Small test projects (TypeScript, Remix)

Development

npm run build         # TypeScript compile + bundle viewer
npm run dev           # TypeScript watch mode
npm run typecheck     # Type check only

Architecture: ESM throughout, TypeScript compiler API for AST analysis, Preact for viewer (bundled into single HTML), Zod for schema validation, Louvain algorithm for zone detection.