dep-regret

module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 18, 2026 License: MIT

README ΒΆ

πŸͺΆ dep-regret

Do you actually need that dependency?

dep-regret stops your AI agent (or you) from importing a 40 MB library for a 3-line job. For any package it shows the install size, how many dependencies it drags in, and whether a standard-library or native feature already does the job β€” then hands you a one-key, agent-ready prompt to inline it instead.

CI Release Go Reference Go Report Card Dependencies


Try it in one line β€” no signup, no API key, no install:

go run github.com/agenticraptor/dep-regret/cmd/dep-regret@latest check moment

Or cd into any npm / Python / Rust / Go project and just run dep-regret.

dep-regret Β· ~/code/my-app
npm Β· 12

  REGRET      left-pad (npm)         10 KB  β–Έ String.prototype.padStart()
  RECONSIDER  request (npm)         209 KB  β–Έ fetch() or undici
  RECONSIDER  node-fetch (npm)      107 KB  β–Έ global fetch()
  RECONSIDER  uuid (npm)             70 KB  β–Έ crypto.randomUUID()
  RECONSIDER  is-odd (npm)            7 KB  β–Έ n % 2 === 1
  REVIEW      moment (npm)          4.4 MB  β–Έ Intl.DateTimeFormat, Temporal, date-fns…
  REVIEW      lodash (npm)          1.4 MB  β–Έ native ES methods or single-method imports
  KEEP        express (npm)          75 KB  β–Έ looks reasonable
  KEEP        react (npm)           172 KB  β–Έ looks reasonable

  ────────────────────────────────────────────────────
  You could save ~6.5 MB and 26 dependencies
  by inlining 10 of 12 dependencies.

  Run `dep-regret inline left-pad` for an agent-ready prompt to remove it.

Why

AI coding agents add dependencies the way other people add browser tabs. A prompt says "parse this date" and suddenly moment (4.4 MB) is in your package.json. "Pad a string" pulls in left-pad. "Make a UUID" adds a package for something crypto.randomUUID() has done natively for years. This is a named, documented AI-tech-debt smell: dependency churn and 50 MB transitive trees for one-line problems.

dep-regret is the gut-check that fits between "I want X" and "X is now a permanent part of my supply chain":

  • It quantifies the cost. Real install size (all four ecosystems) and direct-dependency count (npm and PyPI), pulled live from the registry β€” with an offline estimate when there's no network.
  • It knows when a built-in already does it. A curated, human-reviewed knowledge base maps commonly-regretted packages to their standard-library or native replacement β€” left-pad β†’ padStart, pytz β†’ zoneinfo, lazy_static β†’ LazyLock, github.com/pkg/errors β†’ fmt.Errorf("%w").
  • It offers a way out. dep-regret inline <pkg> prints a precise, copy-paste prompt that tells your coding agent exactly how to remove the dependency and replace it with native code.

And yes β€” dep-regret itself has zero third-party dependencies. It would be a little awkward otherwise. The whole tool is one small static binary built from the Go standard library. Run dep-regret on its own repo and watch it report nothing to regret.

Features

  • πŸ”Ž scan any project and rank every dependency by a 0–100 regret score, with a quotable headline: "save ~6.5 MB and 26 dependencies."
  • πŸ§ͺ check <pkg> a single package before you add it β€” settle the "do I really need this?" argument in one command.
  • 🧠 Curated knowledge base of 70+ commonly-regretted packages across npm, PyPI, Cargo, and Go, each mapped to its native/stdlib replacement with a line-count estimate and a fair, nuanced note.
  • πŸ€– inline <pkg> generates an agent-ready prompt to vendor/replace the dep (works offline, no key). With --apply and an API key it drafts the replacement itself (Anthropic, OpenAI, or a local Ollama).
  • πŸ›‘οΈ guard installs shell hooks so npm install / pip install / cargo add / go get run a check β€” and ask for confirmation β€” before a flagged package lands.
  • πŸͺ« Works with zero config and zero network. No registry access? You still get a verdict from the embedded knowledge base and size estimates.
  • πŸ“¦ One tiny static binary. Zero dependencies. Naturally.

Install

go install
go install github.com/agenticraptor/dep-regret/cmd/dep-regret@latest
Pre-built binaries

Grab a binary for your OS/arch from the Releases page.

Homebrew (macOS / Linux)
brew install agenticraptor/tap/dep-regret

Available once the Homebrew tap is published β€” see the note in .goreleaser.yaml to enable it.

From source
git clone https://github.com/agenticraptor/dep-regret
cd dep-regret
make install

Quickstart

# 1. Scan the project in the current directory (works with zero setup)
cd ~/code/my-app
dep-regret

# 2. Should I add this package? Check before you commit to it.
dep-regret check moment
dep-regret check left-pad@1.3.0          # a specific version
dep-regret check pytz -e pypi            # pick the ecosystem explicitly

# 3. Get an agent-ready prompt to remove a dependency
dep-regret inline lodash                 # prints a prompt; pipe it to your agent
dep-regret inline lodash | pbcopy        # …or straight to the clipboard

# 4. Guard your package managers (asks before adding a flagged dep)
dep-regret guard --install               # adds a hook to your shell rc

# 5. Export a report for a PR or a teammate
dep-regret scan -f markdown -o dep-regret.md

Usage

dep-regret [path]                Scan a project and rank deps by regret (default)
dep-regret check <pkg>[@version] Analyze a single package before you add it
dep-regret inline <pkg>          Print an agent-ready prompt to inline a dep
dep-regret guard                 Install/print package-manager confirmation hooks
dep-regret doctor                Check your environment and registry access
dep-regret version

Common flags:

Flag Description
-e, --ecosystem npm Β· pypi Β· cargo Β· go (auto-detected for scan)
-f, --format term Β· markdown Β· json Β· plain (default: term)
--offline Skip registry lookups; use only the embedded knowledge base
--flagged (scan) show only flagged dependencies
--top N (scan) show only the N most-regretted dependencies
--apply (inline) draft the replacement with a configured LLM
--color auto Β· always Β· never
-o, --output <file> Write the report to a file

How the regret score works

The score is deterministic and explainable β€” no model, no magic. Given the same inputs it always produces the same number, which is what makes the headline ("save ~6.5 MB") trustworthy. Each dependency starts at 0 and accrues points:

Signal Points
A standard-library / native feature does the job (has_stdlib) +55
It's a trivially-replaceable micro-package (micro) +60
It's deprecated or unmaintained (deprecated) +45
It's a heavyweight often used for a fraction of its surface (heavyweight) +25
Registry reports it as deprecated +40
Install size +3 / MB (max +30)
Direct dependency count (npm / PyPI) +1 / dep (max +15)

The total maps to a verdict:

Score Verdict Meaning
0–24 KEEP Looks reasonable.
25–44 REVIEW Worth a look.
45–69 RECONSIDER You probably have a lighter option.
70–100 REGRET You almost certainly don't need this.

Heavyweight, genuinely-useful libraries (axios, requests, testify) are scored gently on purpose β€” dep-regret flags them for a second look, not a witch hunt. See docs/scoring.md for the full rationale.

The knowledge base

The "a built-in already does this" judgments come from a curated, human-reviewed dataset (internal/knowledge/data/replacements.json), embedded into the binary so it works offline. A few examples:

Ecosystem Package Replace with Since
npm left-pad String.prototype.padStart() ES2017
npm uuid crypto.randomUUID() Node 14.17
npm node-fetch global fetch() Node 18
PyPI pytz zoneinfo Python 3.9
PyPI six (write Python 3) β€”
Cargo lazy_static std::sync::LazyLock Rust 1.80
Cargo num_cpus std::thread::available_parallelism() Rust 1.59
Go github.com/pkg/errors fmt.Errorf("%w", …) Go 1.13
Go github.com/sirupsen/logrus log/slog Go 1.21

Contributions to the knowledge base are the most valuable kind. Know a package that a built-in now replaces? Add an entry β€” it's one JSON object.

Guard your package managers

dep-regret guard --install        # writes a hook into ~/.zshrc or ~/.bashrc
# (or `dep-regret guard --print` to see the snippet and add it yourself)

After that, adding a flagged package pauses for confirmation:

$ npm install moment

moment (npm)
  Verdict   REVIEW  (regret score 38/100)
  Size      4.4 MB
  Replace   Intl.DateTimeFormat, Temporal, date-fns, or day.js

Add this dependency anyway? [y/N]

Remove it any time with dep-regret guard --uninstall.

Privacy

dep-regret runs entirely on your machine. By default it makes read-only requests to public package registries (npmjs.org, pypi.org, crates.io, proxy.golang.org) to look up real install sizes β€” that's the only network it touches. Pass --offline and it makes zero network calls, falling back to the embedded knowledge base and size estimates. The optional inline --apply feature is the only thing that contacts an LLM, and only when you ask it to.

How it works

manifest (package.json / requirements.txt / Cargo.toml / go.mod)
   β”‚
   β”œβ”€β–Ί parse dependencies ─┐
   β”‚                       β”‚
registry lookup ───────────┼─► analyze ──► regret score + verdict ──► render
(size, dep count,          β”‚   (knowledge base + size + deps)          (term / md / json)
 deprecation; optional) β”€β”€β”€β”˜                       β”‚
                                                   └─► inline ──► agent-ready prompt
                                                                  (+ optional LLM draft)

Contributing

Contributions are very welcome β€” see CONTRIBUTING.md. The highest-leverage contributions are new knowledge-base entries and support for more ecosystems (Ruby gems, Maven, NuGet…). Please also read our Code of Conduct.

License

MIT Β© 2026 agenticraptor and dep-regret contributors.

Directories ΒΆ

Path Synopsis
cmd
dep-regret command
Command dep-regret tells you whether a dependency is worth it before your AI agent (or you) adds a 40MB library for a 3-line job.
Command dep-regret tells you whether a dependency is worth it before your AI agent (or you) adds a 40MB library for a 3-line job.
internal
analyze
Package analyze turns a dependency plus optional registry data into a deterministic "regret" verdict: a 0-100 score, a recommendation, and the reasons behind it.
Package analyze turns a dependency plus optional registry data into a deterministic "regret" verdict: a 0-100 score, a recommendation, and the reasons behind it.
buildinfo
Package buildinfo exposes version metadata injected at build time via -ldflags.
Package buildinfo exposes version metadata injected at build time via -ldflags.
cli
Package cli implements the dep-regret command-line interface using only the standard library β€” no third-party command framework.
Package cli implements the dep-regret command-line interface using only the standard library β€” no third-party command framework.
ecosystem
Package ecosystem detects package ecosystems and parses their manifest files into a uniform list of dependencies.
Package ecosystem detects package ecosystems and parses their manifest files into a uniform list of dependencies.
inline
Package inline turns a finding into an agent-ready instruction for replacing a dependency with vendored or native code.
Package inline turns a finding into an agent-ready instruction for replacing a dependency with vendored or native code.
knowledge
Package knowledge holds dep-regret's curated, embedded map of commonly regretted packages to their standard-library or native replacements.
Package knowledge holds dep-regret's curated, embedded map of commonly regretted packages to their standard-library or native replacements.
llm
Package llm provides an optional, dependency-free client for drafting a concrete dependency replacement with an LLM.
Package llm provides an optional, dependency-free client for drafting a concrete dependency replacement with an LLM.
registry
Package registry performs best-effort, read-only lookups of a package's real install size and dependency count from public registries (npm, PyPI, crates.io, the Go module proxy).
Package registry performs best-effort, read-only lookups of a package's real install size and dependency count from public registries (npm, PyPI, crates.io, the Go module proxy).
render
Package render formats analysis results for the terminal, Markdown, JSON, or plain text.
Package render formats analysis results for the terminal, Markdown, JSON, or plain text.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL