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

@ohzw/worktree-command-tui

v0.1.6

Published

A TUI for managing git worktrees

Readme

worktree-command-tui

worktree-command-tui is a terminal UI for managing Git worktrees from inside a repository. It keeps one active runtime session per namespace, lets you switch worktrees with the keyboard, and keeps logs/process cleanup tied to the repo's shared Git state.

Features

  • Discover worktrees from the current repository even when launched from a subdirectory
  • Start, switch, or restart the active worktree session with Enter
  • Stop the active session and clean up recorded orphan processes with s
  • Run an optional per-worktree setup command with i
  • Open the selected worktree in your editor with e
  • Open the selected branch's pull request in a browser with o
  • Delete a non-root worktree from the TUI with d, then confirm
  • Inspect branch, upstream, working tree, and pull request metadata in the detail pane
  • Tail ANSI-colored logs inline or in a full-screen log view
  • Generate and load JSONC config with comments and trailing commas

Requirements

  • Node.js >=20
  • Git
  • A Git repository (additional linked worktrees optional)
  • Optional: GitHub CLI (gh) and a GitHub origin remote for pull request metadata and o / Open PR

Installation

npm install -g @ohzw/worktree-command-tui

Installed binaries:

  • wctui
  • worktree-command-tui (compatibility alias)

Quick start

1) Initialize config

Run this from the repo root or any subdirectory inside the repo:

wctui init

This writes .worktree-command-tui.jsonc at the repository root.

To overwrite an existing config:

wctui init --force

2) Start the TUI

wctui

If config is missing, the CLI exits with a message telling you to run wctui init.

Keyboard shortcuts

Primary shortcuts in the footer:

  • ↑↓ / j k — move selection
  • Enter — start, switch to, or restart the selected worktree
  • i — run setupCommand when configured
  • e — open the selected worktree in the configured editor when editorCommand is configured
  • o — open the selected worktree's pull request when GitHub metadata is available
  • d — arm worktree deletion
  • L — open full-screen logs
  • s — stop active session
  • r — refresh worktree metadata
  • ? — show help
  • q — quit

Additional shortcuts from the help window:

  • g / G — jump to first / last worktree
  • [ / ] — scroll logs
  • PageUp / PageDn — page the selection list
  • Mouse wheel — scroll the pane under the cursor
  • d / y — confirm delete after arming it
  • Esc / n / q — cancel delete confirmation

Security and network behavior

wctui executes the argv commands stored in .worktree-command-tui.jsonc when you press the matching keys. Treat repository config as trusted code:

  • Enter starts command in the selected worktree; pressing it on the active worktree restarts that session.
  • i runs setupCommand; package-manager install commands may run dependency lifecycle scripts.
  • e runs editorCommand with the selected worktree path appended.

Review config before using those actions in an untrusted repository or worktree.

The TUI also reads pull request metadata with the GitHub CLI when remote.origin.url points at github.com. This uses gh api, your existing gh authentication, and a short timeout. Non-GitHub remote hosts are ignored by default.

Configuration

The tool looks for config in this order:

  1. .worktree-command-tui.jsonc
  2. .worktree-command-tui.json

Example config:

{
  // Session namespace used for git-common-dir state files and logs.
  "namespace": "worktree-command-tui",

  // Command launched in the selected worktree.
  "command": ["npm", "run", "dev"],

  // Optional command run manually with the setup key in the selected worktree.
  "setupCommand": ["npm", "install"],

  // Optional command that opens the selected worktree path in an editor.
  // The selected worktree path is appended as the final argv entry.
  "editorCommand": ["code"],

  // TCP ports owned by the command, used when stopping stale/orphaned processes.
  "ports": [3000],

  // Files that must exist in a worktree before the command can be started there.
  "requiredFiles": ["package.json"],

  // Extra process command-line substrings treated as orphans for cleanup.
  "orphanMatchers": []
}

Notes:

  • setupCommand is optional and never runs automatically; i only appears when it is configured. It accepts one argv array or an array of argv arrays executed in order. The built-in ["copy-root-file", "source", "destination"] copies from the repo root into the selected worktree.
  • editorCommand is optional; when set, the selected worktree path is appended to the argv and e becomes available
  • Use ports for every backend/frontend/dev-server port the command may bind; legacy single port configs still load
  • The generated default config auto-detects package manager hints from packageManager or common lockfiles and chooses a default script such as dev, start, or serve
  • Session records and logs are stored under the repository's Git common dir, so they are shared across worktrees in the same repo

Development

npm install
npm test
npm run typecheck
npm run build

License

MIT