Skip to content

borakilicoglu/sadrazam

Repository files navigation

Sadrazam logo

Find and remove unused dependencies in seconds — with AI-powered explanations.


⚡ What is Sadrazam?

Sadrazam is a CLI tool that scans your project and tells you:

  • which dependencies are unused
  • which ones are misplaced or risky
  • what you can safely remove or fix

👉 And if you enable AI:
it explains why, what to do next, and supports agent-friendly TOON output for automation and LLM workflows.


🚀 Quick Start

npx sadrazam .

That’s it.


🧠 Example Output

❌ Unused dependency: lodash
💡 Suggested: remove

⚠️ Misplaced dependency: typescript
💡 Suggested: move to devDependencies

With AI:

🧠 lodash is not imported anywhere in your codebase.
Removing it will reduce bundle size and install time.

🎯 Why Sadrazam?

JavaScript projects accumulate dependencies over time.

  • unused packages slow installs
  • wrong dependencies increase risk
  • messy package.json hurts maintainability

Sadrazam answers one question:

👉 What can I safely remove from this project?


🔥 What Makes It Different?

Unlike traditional tools:

  • detects unused dependencies AND unused files/exports
  • understands monorepos and modern frameworks
  • optional AI layer for real explanations (not raw output)
  • safe auto-fix for package.json

⚡ Common Use Cases

  • clean up old projects
  • audit dependency bloat
  • prepare for production
  • CI dependency checks
  • monorepo hygiene

🛠️ Usage

Basic scan:

npx sadrazam .

JSON output:

npx sadrazam . --reporter json

TOON output:

npx sadrazam . --reporter toon

Auto-fix:

npx sadrazam . --fix --format

Trace why something is used:

npx sadrazam . --trace typescript

🧠 AI Mode (Optional)

Enable AI to get explanations and recommendations:

AI_PROVIDER=openai AI_TOKEN=your_token npx sadrazam . --ai

AI will:

  • explain why a dependency is unused
  • suggest what action to take
  • summarize cleanup steps

⚙️ Features

  • unused dependency detection
  • unused file + export detection
  • monorepo & workspace support
  • script-aware scanning
  • CommonJS + modern import support
  • safe auto-fix
  • JSON + TOON + text output
  • AI-powered insights

👉 Full feature list: https://borakilicoglu.github.io/sadrazam/features


📦 Install

npm install -g sadrazam

or:

npx sadrazam .

🧪 When to Use It

Run Sadrazam when:

  • your project feels bloated
  • you're unsure which deps are safe to remove
  • you're preparing for deployment
  • you're reviewing a codebase

💡 Philosophy

Sadrazam is built around a simple idea:

Keep your dependency tree clean, understandable, and safe.

AI is optional — the core tool works without it.


❤️ Support

If this tool saves you time:

⭐ Star the repo
☕ Support via GitHub Sponsors

https://github.com/sponsors/borakilicoglu


🔗 Links

About

Find unused, misplaced, and risky dependencies in your JavaScript and TypeScript projects, with optional AI-powered insights.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Sponsor this project

 

Packages

 
 
 

Contributors