devghost
v0.4.1
Published
👻 Find dead code, dead imports, and dead dependencies before they haunt your project
Downloads
1,601
Maintainers
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 –
--fixremoves unused imports,--fix‑depsremoves 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 –
--ciexits 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/letand 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 --ciHTML 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:
- Fork the repo
- Create a feature branch (
git checkout -b feature/awesome‑feature) - Commit your changes (
git commit -m "Add awesome feature") - Push and open a Pull Request
📄 License
MIT © Haileyesus
Don't let dead code haunt you.
