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

pi-graph-viz

v0.4.1

Published

Interactive dependency graph visualizer for Pi. Renders AST call graphs (from pi-impact-analyzer or any JSON) as self-contained HTML with cycle detection and hierarchical layout.

Readme

pi-graph-viz

Interactive dependency graph visualizer for the Pi coding agent. Renders any dependency or call graph (from pi-impact-analyzer or direct JSON input) as a self-contained HTML visualization with cycle highlighting, search, and hierarchical layout.

Installation

pi install npm:pi-graph-viz

Features

  • Self-contained HTML: No CDN, no external dependencies. The visualization is a single HTML file with inline CSS and SVG.
  • Hierarchical layout: Nodes arranged by dependency depth (top-down or left-right).
  • Cycle detection: Circular dependencies highlighted in red with a dedicated cycle panel.
  • Search: Find nodes by id or label. Non-matching nodes are dimmed.
  • Type filter: Filter nodes by type (file, function, class, module).
  • Node details: Click any node to see its type, file, line, in-degree, and out-degree.
  • Nexus integration: Reads pi-impact-analyzer JSON output directly.
  • Live server: Serve the visualization on localhost with SSE auto-reload — the browser updates automatically when the graph is regenerated.

Usage

Via Tool (LLM/agent)

Render a graph from direct JSON input:

graph_viz type=json graph='{"nodes":[{"id":"a","label":"A"},{"id":"b","label":"B"}],"edges":[{"source":"a","target":"b"}]}'

Render pi-impact-analyzer output:

graph_viz type=impact output=./report.html

Options:

  • output: Output path for the HTML file (default: graph-viz-report.html).
  • title: Optional title for the visualization.
  • direction: Layout direction, "TB" (top-bottom) or "LR" (left-right, default: "TB").
  • highlightCycles: Highlight cycles in red (default: true).

Via Command (TUI)

Generate and save:

/graph-viz path/to/graph.json

Start a live localhost server:

/graph-viz serve [path-to-graph.json]

Stop the server:

/graph-viz stop

Via Tool with Live Server

graph_viz type=json graph='...' serve=true

The live server supports SSE-based auto-reload: the browser page automatically refreshes when the graph is regenerated.

The JSON file should contain:

{
  "nodes": [
    { "id": "auth", "label": "AuthModule", "type": "module", "file": "src/auth.ts" },
    { "id": "login", "label": "login", "type": "function", "file": "src/auth.ts", "line": 42 }
  ],
  "edges": [
    { "source": "login", "target": "validateToken" },
    { "source": "validateToken", "target": "db" }
  ]
}

Integration with Nexus

pi-graph-viz is part of the Nexus monorepo and pairs naturally with:

  • pi-impact-analyzer: Renders its impact analysis output as an interactive graph.
  • pi-smart-reader: Quick file-level dependency visualization.
  • pi-audit-master: Visualize audit findings as a dependency graph.

Graph Data Types

| Field | Type | Description | |---|---|---| | nodes | Array | Array of {id, label, type?, file?, line?} | | edges | Array | Array of {source, target, type?, weight?} | | title | string | Optional title for the visualization | | metadata | object | Optional metadata key-value pairs |

Node types

  • file - Source file
  • function - Function or method
  • class - Class definition
  • module - Module or namespace

Edge types

  • imports - Import relationship
  • calls - Function call
  • extends - Class inheritance
  • uses - Generic usage

Development

git clone https://github.com/ZachDreamZ/pi-graph-viz.git
cd pi-graph-viz
npm install
npm run build
npm test

Audit Report

This package has been audited by the pi-audit-master extension for code quality, security, and reliability. The full audit report is available in AUDIT-REPORT.md.

Audit Summary

| Category | Issues Found | Issues Fixed | |----------|--------------|--------------| | 🔴 Critical | 2 | 2 ✅ | | 🟠 High | 5 | 5 ✅ | | 🟡 Medium | 4 | 4 ✅ | | 🟢 Low | 3 | 3 ✅ | | Total | 14 | 14 ✅ |

Key Improvements

  • Security: Fixed signal listener removal, added XSS protection for token injection
  • Reliability: Added Node.js fallback, heartbeat cleanup, error logging
  • Performance: Removed redundant require() calls, optimized imports
  • Maintainability: Added debug logging, improved error handling

Performance Metrics

| Metric | Result | |--------|--------| | Graph Analyzer | 0.05ms/analysis | | Large Graph (1000 nodes) | 0.78ms | | HTML Generator | 0.08ms/generation | | Live Server | 0.11ms/update |

For detailed findings and recommendations, see the full audit report.

License

MIT