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

pkgvet

v0.1.4

Published

Pre-flight inspector for npm packages: statically checks a package before you run or install it, and reports its risk level and what it can touch. Never executes the package.

Downloads

731

Readme

pkgvet

A pre-flight inspector for npm packages. Downloads and statically analyzes a package without executing any code, then reports what it can touch and how risky it looks.

pkgvet inspecting packages

Usage

# Install
npm install -g pkgvet

# Inspect a package
pkgvet inspect <package-spec>

# Or with npx (no install needed)
npx pkgvet inspect <package-spec>

Examples

# Human-readable report
pkgvet inspect [email protected]

# JSON output for scripts/agents
pkgvet inspect shelljs --json

# Fail CI if risk level meets a threshold (exit 1)
pkgvet inspect is0dd --fail-on med

# Opt-in LLM second opinion (requires API key)
pkgvet inspect shelljs --llm

Exit codes

| Code | Meaning | |---|---| | 0 | Clean — risk is below threshold (or no threshold set) | | 1 | Risk meets or exceeds --fail-on threshold | | 2 | Resolution / download / parse failure (never treated as safe) |

What it checks

The tool runs four static analysis passes on the unpacked package:

| Signal | What it looks for | |---|---| | Manifest | preinstall/install/postinstall scripts, deprecated flag | | Publisher | Version published within last 7 days (new accounts are a risk signal) | | Typosquat | Levenshtein + homoglyph distance to 20 popular package names | | Capabilities | AST analysis of .js/.ts/.cjs/.mjs files (.d.ts type declarations are skipped) — real call sites, imports, and member access, not text matching — for: fs:read, fs:write, net, shell, env, obfuscated |

Each finding has a weight. The scorer combines them into a 0–100 score and a low / med / high level, with a bonus for dangerous combinations (e.g. install script + network + env reads = classic credential exfil shape).

--llm (second opinion)

Strictly opt-in. Set one of these environment variables:

| Env var | Provider | Model | Cost | |---|---|---|---| | ANTHROPIC_API_KEY | Anthropic | claude-opus-4-8 | Paid | | OPENAI_API_KEY | OpenAI | gpt-5.5 | Paid | | GROQ_API_KEY | Groq | llama-3.3-70b-versatile | Free | | GEMINI_API_KEY | Gemini | gemini-2.0-flash | Free |

The tool sends only the package name, version, risk level, and detected capabilities (no source code). Each call is capped at 100 output tokens with a 15-second timeout. A failing or missing API key is silently ignored — it never changes the deterministic score, verdict, or exit code.

Principles

  • Never executes the package. Static analysis only.
  • Offline, free, and deterministic by default. The --llm pass is opt-in.
  • Conservative weighting. A benign library that only reads files stays LOW. Risk is driven by dangerous combinations, not single capabilities.

Security model & dependencies

What pkgvet protects you from: the package you point it at. It is downloaded and read as bytes and ASTs — never required, imported, evald, or run, and its lifecycle scripts are never executed. A malicious target package cannot run code through pkgvet, and tarball extraction is guarded against path traversal (zip-slip).

A deliberately small dependency surface. Like any tool, pkgvet runs its own dependencies in-process, so a small, auditable tree is itself a security property. The runtime tree is intentionally minimal:

  • @babel/parser — parse code to ASTs
  • tar — unpack tarballs (pinned to a version with all known path-traversal advisories fixed)
  • semver — resolve version ranges
  • commander — CLI parsing
  • leven — edit distance for typosquat detection

Resolution and download go straight to the registry over HTTPS (fetch), and the downloaded tarball is verified against the registry's integrity hash before extraction. npm audit reports no known vulnerabilities. Dependencies are pinned with integrity hashes in package-lock.json; install with npm ci to install strictly from the lockfile.

The ceiling of static analysis: pkgvet reports what a package can do, not a guarantee that it is safe. Sufficiently obfuscated or dynamically-constructed code can hide intent from any static scanner — which is why heavy obfuscation is itself flagged. Treat the verdict as a strong signal, not a proof.

Install

npm install -g pkgvet
npm run build    # compile TypeScript to dist/

Requires Node >= 18.

License

MIT