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 🙏

© 2025 – Pkg Stats / Ryan Hefner

devghost

v0.4.1

Published

👻 Find dead code, dead imports, and dead dependencies before they haunt your project

Downloads

1,601

Readme

👻 DevGhost – The Exorcist for Your Codebase

Is your project haunted by dead code?

  • 📄 Export to PDF
  • VSCode Extension v0.1.6 – Fix Entire Workspace command
  • 74% Test Coverage – 68 tests, all passing

✨ Core Features

  • 📊 HTML Reports – Generate beautiful, shareable visual reports with --report html
  • 🔍 Smart Detection – deep static analysis via the TypeScript Compiler API
  • 🧹 Auto‑Fix--fix removes unused imports, --fix‑deps removes dead dependencies
  • 🎯 Interactive Mode – review each issue one‑by‑one
  • 📦 Dependency Cleanup – safely uninstall unused npm packages
  • 💾 Impact Analysis – see how many KB/LOC you'll save
  • 🚀 CI/CD Ready--ci exits with code 1 on any issue
  • 🎨 Beautiful Output – colour‑coded, easy‑to‑read reports
  • 🧩 Unused Types – interfaces, type aliases, enums, classes
  • 🔢 Unused Variables – dead const/let and function parameters
  • Fast – analyses large projects in seconds

� Why DevGhost?

Most tools just list dead code. DevGhost exorcises it.

  • 🛡️ Safety First: The interactive mode lets you approve every single deletion.
  • 🧹 True Cleanup: We don't just find unused files; we remove unused imports, variables, and types inside your files.
  • 🧠 Deep Analysis: Uses the TypeScript Compiler API for precision, not just regex. npm install -g devghost

### Install as Dev Dependency
```bash
npm install -D devghost

📖 Usage

# 👻 Basic scan (default)
devghost

# � Generate HTML report (NEW in v0.4!)
devghost --report html

# 📄 Custom output path
devghost --report html --output ./reports/analysis.html

# �🛡️ Interactive mode (approve every change)
devghost --interactive

# 🧹 Auto-fix unused imports
devghost --fix

# ⚙️ Auto-fix unused functions
devghost --fix-functions

# 📦 Auto-fix unused dependencies
devghost --fix-deps

# 🚀 CI mode (exit with error if issues found)
devghost --ci

HTML Report Features 🎨

The new HTML report provides:

  • 📊 Visual Dashboard – Stats cards and interactive Chart.js charts
  • 🔍 Smart Explorer – File-grouped issues with search & category filters
  • 🌓 Theme Toggle – Beautiful dark/light mode
  • 📋 Copy Commands – One-click to get auto-fix CLI commands
  • ⏱️ Time Estimates – See manual review time vs. auto-fix time
  • 📄 Export to PDF – Print or save reports for documentation
  • 📱 Fully Responsive – Works great on mobile, tablet, and desktop

Sample output

👻 DevGhost - Dead Code Detective
========================================
✓ Scanned 234 files

❌ 3 unused imports
❌ 2 unused exports  
❌ 2 orphaned files
❌ 1 dead dependency

💾 Potential savings: 15 KB, 465 lines, 45 MB deps

🛠️ Configuration

Create a devghost.config.json to tailor the hunt:

{
  "ignore": ["**/*.test.ts", "**/legacy/**"],
  "entry": ["src/index.ts"],
  "includeDev": false
}

Ignore comments

// devghost-ignore-next-line
import { willUseLater } from './future';

// devghost-ignore-file

🔧 Troubleshooting

"No entry points found"

Solution: Specify entry points in devghost.config.json:

{ "entry": ["src/index.ts", "src/cli.ts"] }

False positives with dynamic imports

Solution: Use ignore comments for intentional code:

// devghost-ignore-next-line
import('./dynamic-feature');

Slow on large projects

Solution: Add more specific ignore patterns:

{ "ignore": ["**/node_modules/**", "**/dist/**", "**/*.test.ts"] }

We love community ghosts! To contribute:

  1. Fork the repo
  2. Create a feature branch (git checkout -b feature/awesome‑feature)
  3. Commit your changes (git commit -m "Add awesome feature")
  4. Push and open a Pull Request

📄 License

MIT © Haileyesus


Don't let dead code haunt you.