JavaScript and TypeScript projects get messy in a very predictable way.
A package gets added for a short experiment.
A build tool changes.
A migration leaves old dependencies behind.
A file stops being imported.
An export survives three refactors for no good reason.
A few months later, the project still works, but package.json and parts of the codebase no longer reflect reality.
That is why I built Sadrazam: a dependency and code-hygiene CLI for JavaScript and TypeScript projects.
Its goal is simple:
tell me what is actually used, what is not, and do it conservatively.
The problem with dependency cleanup tools
A lot of tooling in this space is useful, but the tradeoff is often the same: once a tool gets too aggressive, trust drops.
For me, dependency hygiene tooling needs a few things:
- deterministic analysis over aggressive guessing
- low false positives
- clear CLI and reporter contracts
- safe and narrow auto-fix behavior
I did not want a tool that “feels smart” but quietly makes risky edits.
I wanted a tool that behaves more like an engineer doing a careful review.
What Sadrazam does
Sadrazam analyzes a project by reading package.json, scanning source files, and comparing declared dependencies with actual usage.
It currently supports:
- unused
dependenciesanddevDependencies - missing package declarations
- unused files
- unused exports
- package trace and export trace
- script-aware dependency detection
- workspace and monorepo scanning
- CommonJS and hybrid import support
- framework file scanning for
.vue,.svelte,.astro, and.mdx - safe
--fixand--fix --format - AI summaries via OpenAI, Anthropic, or Gemini
A quick example:
bash
npx sadrazam .
npx sadrazam . --trace typescript
npx sadrazam . --include unused-files,unused-exports
npx sadrazam . --fix --format
Top comments (0)