npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

sadrazam

v0.1.23

Published

Dependency analysis CLI for JavaScript and TypeScript projects with optional AI-powered insights.

Readme


⚡ 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 package workspaces, Lerna, Rush, and modern frameworks
  • reads common tool configs such as Babel, PostCSS, Commitlint, lint-staged, and Husky hooks
  • reads GitHub Actions, GitLab CI, CircleCI, Azure Pipelines, and Bitbucket Pipelines workflows so CI-only tools are treated as used
  • reads Dockerfile and Docker Compose commands so container-only tools are treated as used
  • 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 .

Create a config file:

npx sadrazam init

init guides you through reporter, scan mode, finding focus, noise exclusions, ignored packages, and custom scan inputs before writing sadrazam.json.

Validate config:

npx sadrazam doctor

doctor checks config values and reports stale allowlist, ignore, and catalog entries.

JSON output:

npx sadrazam . --reporter json

Compact editor-friendly JSON:

npx sadrazam . --reporter compact-json

Compact JSON emits flat findings with best-effort file, line, and column locations for editor integrations.

TOON output:

npx sadrazam . --reporter toon

Auto-fix:

npx sadrazam . --fix --format

--fix removes deterministic unused package declarations and can add missing packages to devDependencies with a "*" placeholder version.

Trace why something is used:

npx sadrazam . --trace typescript

Plugin overrides live in sadrazam.json when automatic tool discovery needs help:

{
  "plugins": {
    "vite": true,
    "jest": false,
    "playwright": {
      "config": "config/playwright.config.ts",
      "entry": "integration/**/*.spec.ts"
    },
    "gitlab-ci": {
      "config": ".gitlab-ci.yml"
    },
    "circleci": {
      "config": ".circleci/config.yml"
    },
    "azure-pipelines": {
      "config": "azure-pipelines.yml"
    },
    "bitbucket-pipelines": {
      "config": "bitbucket-pipelines.yml"
    }
  }
}

Explain findings of one type:

npx sadrazam . --explain unused-files

Focus on export hygiene:

npx sadrazam . --include unused-exports,duplicate-exports,namespace-members

Limit displayed items per finding without changing the scan result or exit code:

npx sadrazam . --max-show-issues 10

🧠 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
  • unresolved local import detection
  • unused file + export detection
  • TypeScript namespace member detection
  • monorepo & workspace support
  • TypeScript path alias support
  • OXC-backed parser and local resolver
  • script-aware scanning
  • CommonJS + modern import support
  • safe auto-fix
  • text, JSON, compact JSON, TOON, markdown, and SARIF output
  • VS Code extension scaffold
  • 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

  • GitHub: https://github.com/borakilicoglu/sadrazam
  • npm: https://www.npmjs.com/package/sadrazam
  • Docs: https://borakilicoglu.github.io/sadrazam/features