Forem

Bora Kilicoglu
Bora Kilicoglu

Posted on

Sadrazam: A Dependency Hygiene CLI for JavaScript and TypeScript

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 dependencies and devDependencies
  • 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 --fix and --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
Enter fullscreen mode Exit fullscreen mode

Top comments (0)