Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DepTox

Built by The Foundry, an autonomous build pipeline I run. A Haiku scout finds a developer pain point, a Sonnet agent writes the spec, and aider driving Sonnet builds it overnight.

This repo was produced end to end by that pipeline. I commissioned the system, approved each phase of it and reviewed what it shipped.

A CLI that reads an npm lockfile and checks every package against the npm registry, looking for the names AI coding tools invent. A package that isn't on the registry is the clear case. The rest is scored on how new it is, how few downloads it has, how many maintainers it has, and how close its name sits to a popular package.

Built on 4 March 2026. The lockfile parsing and the registry checks work; the scoring is blunt, and the limits are listed below.

Running it

It isn't published to npm, so the npm install -g deptox line that used to be here didn't work. Run it from source:

git clone https://github.com/solstice035/deptox.git
cd deptox
npm install
npm run build
node dist/index.js /path/to/your/project

What a scan looks like

Against a lockfile with one invented package in it:

Detecting lockfile...
✓ Found npm lockfile
Parsing dependencies...
✓ Found 4 dependencies
Checking 4 unique packages...
✓ Completed registry checks

Calculating risk scores...

┌──────────────────────────────┬───────────────┬────────────────────┬────────────────────────────────────────┐
│ Package                      │ Version       │ Risk               │ Reason                                 │
├──────────────────────────────┼───────────────┼────────────────────┼────────────────────────────────────────┤
│ nicksolly-phantom-pkg-zzz9   │ 1.0.0         │ CRITICAL (100)     │ Package does not exist on npm registry │
└──────────────────────────────┴───────────────┴────────────────────┴────────────────────────────────────────┘

Summary:
  Total dependencies scanned: 4
  Flagged dependencies: 1
  Critical: 1
  Scan duration: 0.18s

Its own lockfile, 135 dependencies, comes back with nothing flagged.

Options

deptox [path]                  directory holding the lockfile (default: ".")
  -j, --json                   output results as JSON
  -q, --quiet                  only show flagged packages
  -t, --threshold <n>          minimum risk score to flag (default: 30)
  -c, --concurrency <n>        concurrent registry checks (default: 10)
      --no-suggestions         skip alternative package suggestions
      --no-color               disable coloured output

Lockfiles: package-lock.json, pnpm-lock.yaml and yarn.lock.

How the score works

A package missing from the registry scores 100 and the scan stops there. Everything else accumulates:

Signal Score
Under 10 downloads last week 40
Under 100 downloads last week 25
Published in the last 30 days, maintainer has no other packages 30
Published in the last 30 days 15
Single maintainer, package under a year old 10
Name looks generated (very long, many hyphens, long consonant runs) 15
Name within an edit or two of a popular package 20

30 and over is flagged by default, 60 is high, 80 is critical.

Known issues

  • A typosquat that someone has already published scores 20, under the default threshold of 30. expresss and react-hook-forms are both real packages on npm today, so a lockfile containing them comes back clean unless you run --threshold 20. The phantom check only catches names nobody has registered yet.
  • The popular-package list it compares names against is a static list in src/suggestions/popular.ts. A typosquat of anything outside that list won't be spotted.
  • The npm downloads API rate-limits well below the registry API. On a 135-package lockfile most download requests come back 429. Those are now retried twice and then treated as unknown, so they score nothing. Before that fix a failed request counted as zero downloads, which flagged 93 of the 135 packages in this repo's own lockfile.
  • Age and maintainer signals are weak on their own. A new package by a first-time author scores 40 before anything suspicious has been established.

docs/superpowers/plans/ holds a v2 plan from April. None of it is built.

Development

npm install
npm run build
npm test        # 24 tests

Licence

MIT. See LICENSE.

About

CLI scanner for AI-hallucinated phantom npm packages in lockfiles

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages