asset sweep
asset-sweep is a zero-config, multi-stack CLI npm package I created to solve a common problem across modern repositories: unused images, fonts, and media files silently piling up and bloating builds. Instead of relying on single-language AST parsers or manually grepping folders one by one, I built a fast 4-stage reverse-lookup scanner that auto-detects React, Next.js, Vite, Expo/React Native, Laravel/PHP, and Python (FastAPI/Django/Flask) projects. Simply run npx asset-sweep -d inside any codebase to see which assets are unreferenced and how much storage you can reclaim.
It includes boundary-safe path matching, a dynamic template interpolation guard (so files loaded via template literals, Blade, or Python f-strings aren't falsely flagged), CI/CD JSON output (--ci), and a reversible trash system (.asset-sweep-trash/) with one-command restore. What started as a tool to clean up my own projects became an open-source npm package that helps developers keep their repositories lean without risking accidental deletions.
Installation & Commands
Run without installing (npx):
npx asset-sweep -d
Or install globally:
npm install -g asset-sweep
Key Commands:
npx asset-sweep -d— Safe dry-run preview (lists unused assets and reclaimable size).npx asset-sweep— Interactive checklist to select which unused assets to sweep.npx asset-sweep -y— Sweep all unused assets to.asset-sweep-trash/without prompts.npx asset-sweep restore— Restore all trashed assets back to their original paths.npx asset-sweep -y -p— Permanently delete all unused assets.npx asset-sweep --ci— Output JSON and exit with code1if unused assets are found.

