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

branchcleanup

v1.1.0

Published

Smart Git branch cleanup CLI that detects squash-merged branches with interactive deletion

Readme

Branch Cleanup

Smart Git branch cleanup CLI that detects squash-merged branches with interactive deletion.

Features

  • 🔍 Detects all types of merged branches: Regular merged + squash-merged (GitHub's default)
  • 🎯 Interactive deletion: Safe confirmation prompts for each branch
  • 🛡️ Safety checks: Protected branch detection and dry-run mode
  • 📊 Clear status display: Shows branch type and safety status
  • Fast and lightweight: Minimal dependencies, focused on core functionality

Installation

npm install -g branchcleanup

Usage

List branches

# List all branches with their status
branchcleanup list

# List with custom stale threshold (60 days)
branchcleanup list --stale-threshold=60

# Include remote branches in the list
branchcleanup list --include-remote

Interactive cleanup

# Interactive cleanup with confirmation prompts
branchcleanup cleanup

# Dry run - show what would be deleted
branchcleanup cleanup --dry-run

# Force delete (bypass confirmation)
branchcleanup cleanup --force

# Include remote branches in cleanup
branchcleanup cleanup --include-remote

Options

# Show help
branchcleanup --help

# Show version
branchcleanup --version

Examples

List branches

$ branchcleanup list
┌─────────────────────┬──────────────┬──────────────┐
│ Branch              │ Type         │ Safe to Delete│
├─────────────────────┼──────────────┼──────────────┤
│ feature/user-auth  │ squash-merged│ ✅ Yes       │
│ bugfix/login-page   │ merged       │ ✅ Yes       │
│ experiment/new-ui   │ stale-30d    │ ❌ No (old)   │
└─────────────────────┴──────────────┴──────────────┘

Interactive cleanup

$ branchcleanup cleanup
❓ Delete feature/user-auth (squash-merged)? [y/N] y
✅ Deleted feature/user-auth
❓ Delete bugfix/login-page (merged)? [y/N] y  
✅ Deleted bugfix/login-page
❓ Delete experiment/new-ui ( stale-30d)? [y/N] n
📝 Skipping experiment/new-ui (user declined)

Development

# Clone the repository
git clone https://github.com/sulthonzh/branchcleanup.git
cd branchcleanup

# Install dependencies
npm install

# Run in development mode
npm run dev

# Build for production
npm run build

# Run tests
npm test

# Run linting
npm run lint

How It Works

Branch Detection

The tool detects three types of branches:

  1. Merged branches: Detected using git branch --merged
  2. Squash-merged branches: Detected by checking if all commits from the branch exist in the target branch
  3. Stale branches: Branches not touched in the specified number of days (default: 30)

Remote Branch Support

With the --include-remote flag, the tool can also detect and clean up remote branches:

  • Remote merged branches: Branches merged on the remote repository
  • Remote stale branches: Remote branches not updated within the threshold
  • Safe deletion: Remote branches are pushed to --delete on their respective remotes

Safety Features

  • Protected branch detection: Never deletes main, master, or other protected branches
  • Confirmation prompts: Interactive confirmation for each deletion
  • Dry-run mode: Preview what would be deleted without actually deleting
  • Force mode: Bypass confirmation for bulk operations

License

MIT