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

agbd

v0.6.0

Published

Interactive CLI to safely inspect and delete Git branches (local and remote)

Readme

agbd (auto git branch delete)

Interactive CLI for pruning unnecessary Git branches safely. agbd lets you inspect, filter, and delete local and remote branches with confirmation workflows and configurable safeguards.

Install

npm install --global agbd

Usage

agbd [options]

Options

  • --pattern <regex>: Filter branches by regular expression (fallback to substring match on invalid regex)
  • --remote: Include remote branches (default: local only)
  • --local-only: Show only local branches without remote counterparts
  • --dry-run: Show deletion plan without modifying branches
  • -y, --yes: Skip confirmation prompts and execute immediately
  • --force: Force delete even when branches are not merged (local only)
  • --protected <list>: Comma-separated list of branch names/regex patterns to keep (default: main,master,develop,release)
  • --default-remote <name>: Default remote name used when remote info is missing (default: origin)
  • --cleanup-merged <days>: Select branches whose last commit is older than the specified number of days
  • --detect-default: Detect the remote default branch and add it to the protected list for this run
  • --save-detected-default: Detect the default branch and persist it into the local config (.agbdrc)
  • --config <command>: Manage configuration (show, set, edit, reset)
  • --no-config: Ignore configuration files and rely on CLI flags + defaults
  • -v, --version: Print version
  • -h, --help: Show help message

Configuration

agbd supports layered configuration with the following priority (highest first):

  1. CLI flags
  2. Local config (.agbdrc searched upward from CWD)
  3. Global config (~/.config/agbd/config.json)
  4. Built-in defaults

Use --no-config to disable config loading. Values include:

  • remote: boolean
  • localOnly: boolean
  • dryRun: boolean
  • yes: boolean
  • force: boolean
  • pattern: string
  • protectedBranches: string array
  • defaultRemote: string
  • cleanupMergedDays: number
  • detectedDefaultBranch: string (auto-populated when running --save-detected-default)

Managing Configuration

  • agbd --config show: Display the current effective configuration and source (default/global/local)
  • agbd --config set: Launch the interactive configuration editor
  • agbd --config edit: Open the global config file in $EDITOR
  • agbd --config reset: Reset the global config to defaults

Examples

# Interactively choose branches and delete them locally
agbd

# Dry-run deletion of remote feature branches older than 30 days
agbd --pattern '^feature/' --remote --cleanup-merged 30 --dry-run

# Force-delete stale bugfix branches without prompts
agbd --pattern 'bugfix/' --force --yes

# Remove fully merged branches except main/master/develop
agbd --cleanup-merged 0 --protected main,master,develop

# Show only local branches without remote counterparts
agbd --local-only

How it works

agbd enumerates local (and optionally remote) branches via Git plumbing commands. Each branch displays last commit time, subject, and merged status. Protection rules let you exclude critical branches by exact match or regex (/regex/flags).

Interactive mode uses Ink to present a multi-select list. You can filter by typing, toggle selection with Space, and confirm with Enter. Auto mode (triggered by specifying --pattern, --cleanup-merged, or --yes) can run non-interactively.

Dry runs show the plan without running deletion commands. Actual deletions rely on git branch -d/-D for local branches and git push <remote> --delete <branch> for remote branches.

Development

# Install dependencies
bun install

# Build
bun run build

# Dev (watch)
bun run dev

# Lint (check/fix)
bun run test
bun run lint

License

MIT

Contributing

Issues and PRs are welcome. See CONTRIBUTING for details.