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

treezap

v0.1.6

Published

CLI primitives for discovering and deleting stale Git worktrees.

Readme

Treezap

Clean up stale Git worktrees without guessing where your tools put them.

Treezap is a small CLI that starts from the directory where your main checkouts live, asks Git where each repository's registered worktrees are, and removes only linked worktrees that pass conservative safety checks.

Treezap demo

Why

Agent and editor workflows create worktrees in many different places. The main checkout is usually easy to find; the worktrees are not. Treezap uses Git's own worktree registry to discover them, then applies deterministic checks before deleting anything.

Usage

Run it directly with npx:

npx treezap candidates ~/code --min-age 30d

Quick Start

Scan the directory that contains your normal project checkouts:

npx treezap scan ~/code

Evaluate linked worktrees older than the minimum age:

npx treezap candidates ~/code --min-age 30d

The JSON includes candidates for worktrees that pass every safety check and blockedCandidates for old worktrees that need review before deletion.

Print a compact count summary:

npx treezap candidates ~/code --min-age 30d --count
deletable: 15
old_enough_blocked: 116
blocked_dirty: 31
blocked_untracked: 16
blocked_missing_default_branch: 0
blocked_unique_patches: 27

Delete eligible linked worktrees:

npx treezap rm-old ~/code --min-age 30d

Inspect one path:

npx treezap stat /path/to/worktree

Delete one eligible linked worktree:

npx treezap rm /path/to/worktree --min-age 30d

Safety Rules

A worktree is not deleted unless it is:

  • older than the minimum age
  • clean, with no tracked changes
  • free of untracked files
  • able to identify the repository default branch
  • free of unique committed patches relative to the default branch

Bulk deletion skips primary repository checkouts. It only deletes linked worktrees discovered through git worktree list.

Treezap uses refs/remotes/origin/HEAD as the default branch signal and git cherry <default-branch> HEAD to distinguish committed work that is patch-equivalent to the default branch from committed work that still has unique patches. Missing upstream metadata is diagnostic; it is not a deletion blocker when committed patches are already represented on the default branch.

--min-age accepts case-insensitive durations:

  • 30d days
  • 2w weeks
  • 1m months, treated as 30 days
  • 1y years, treated as 365 days

The default is 30d.

Commands

treezap scan <root>
treezap stat <path>
treezap candidates <root> [--min-age duration] [--count]
treezap rm <path> [--min-age duration]
treezap rm-old <root> [--min-age duration]

Command output is JSON except --help and candidates --count, so the CLI is straightforward to drive from scripts or agents.

Development

npm test
npm run check
npm run build

The Docker fixture creates repositories and worktrees across several locations:

npm run fixture:build
npm run fixture:check
npm run fixture:shell