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

pi-worktrees

v0.1.0

Published

A polished Pi extension for creating, switching, returning from, and deleting managed Git worktrees from the Pi TUI.

Readme

pi-worktrees

pi-worktrees adds a /wt command to Pi for creating, switching, returning from, and deleting managed Git worktrees without leaving your coding session. It is built for clean branch isolation, quick experiments, and safer parallel work across tasks.

Highlights

  • One-command worktrees: create a new Git worktree and switch Pi into it immediately.
  • Native Pi experience: interactive TUI overlay with search, keyboard navigation, badges, and confirmations.
  • Safe managed storage: keeps Pi-created worktrees under a predictable managed directory.
  • Return flow: jump back from a managed worktree to the original project with /wt return.
  • Optional change transfer: move uncommitted changes with --move when creating or returning.
  • Deletion guardrails: confirms destructive deletes and warns when a worktree has uncommitted changes.

Requirements

  • Pi with extension support
  • Node.js compatible with Pi extensions
  • Git with git worktree support
  • pnpm for local development

Installation

Install from npm

Install the extension in Pi with:

pi install npm:pi-worktrees

After installation, restart Pi or use /reload if your session supports hot reload. The /wt command will be available in your Pi session.

Install from Git

After this repository is public, you can also install it directly from GitHub:

pi install git:github.com/0xkuze/pi-worktrees

For a one-off run without adding it to your settings:

pi -e git:github.com/0xkuze/pi-worktrees

Use a local checkout

git clone [email protected]:0xkuze/pi-worktrees.git
cd pi-worktrees
pnpm install
pi -e ./src/index.ts

For hot reload during development, place or symlink the package into a Pi extension location such as .pi/extensions/pi-worktrees/ or ~/.pi/agent/extensions/pi-worktrees/, then use /reload inside Pi.

Usage

Open the worktree overlay:

/wt

Create a managed worktree and switch to it:

/wt create feature-name

Create a worktree and move uncommitted changes into it:

/wt create feature-name --move

Return from a managed worktree to the original project:

/wt return

Return and move uncommitted changes back to the original project:

/wt return --move

Delete a managed worktree:

/wt delete /absolute/path/to/worktree

Commands

| Command | Description | | --- | --- | | /wt | Opens the interactive worktree overlay. | | /wt create [name] | Creates a managed worktree on branch wt/<name> and switches Pi to it. | | /wt create [name] --move | Stashes current changes, creates the worktree, and pops the stash there. | | /wt return | Returns from a managed worktree to the original project. | | /wt return --move | Stashes worktree changes and pops them in the original project. | | /wt delete <path> | Removes a managed worktree after confirmation. |

Aliases are also supported for convenience: new for create, back for return, and remove/rm for delete.

TUI shortcuts

| Shortcut | Action | | --- | --- | | / or j / k | Move through the worktree list. | | / | Search worktrees. | | Enter | Switch to the selected worktree. | | ⌘N or n | Create a new worktree. | | d | Delete the selected managed worktree. | | Esc or q | Close the overlay. |

When the overlay is opened from a managed worktree, the original project appears with a [project] badge so you can return quickly.

Managed storage

By default, managed worktrees are stored under:

~/.local/share/pi-worktrees

Set PI_WORKTREE_HOME to choose a custom storage root:

export PI_WORKTREE_HOME="$HOME/.worktrees/pi"

Worktree names are normalized to kebab-case. If you omit a name, pi-worktrees generates one automatically.

How change transfer works

When you pass --move, pi-worktrees uses Git stash commands across worktrees in the same repository:

  1. git stash push -u in the source worktree
  2. worktree creation or return navigation
  3. git stash pop in the destination worktree

If you choose not to move changes, they remain in the current worktree.

Development

Install dependencies:

pnpm install

Run the full validation suite:

pnpm check

Run only TypeScript validation:

pnpm build

Run tests:

pnpm test

Project structure

src/
  errors/    Error formatting and typed error helpers
  git/       Git command wrappers and worktree parsing
  session/   Pi session switching integration
  storage/   Managed paths, metadata, and name normalization
  ui/        TUI overlay implementation
  worktree/  Create, return, delete, and overlay data flows

Publishing checklist

Before publishing or sharing publicly:

  • Ensure the repository visibility is set to public on GitHub.
  • Run pnpm check and confirm the build and tests pass.
  • Review the package metadata in package.json.
  • Choose and add a license if you want others to reuse, modify, or redistribute the code.

Author

Created and maintained by Cristian Fonseca.