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

@infodb/worktree

v1.3.0

Published

CLI tool to manage git worktrees and VSCode workspace files

Downloads

15

Readme

@infodb/worktree

A TypeScript CLI tool for managing git worktrees and VSCode workspace files.

Installation

npm install -g @infodb/worktree

Or use with pnpx:

pnpx @infodb/worktree <command> [arguments] [options]

Usage

Add Command (Create Worktree)

Create a git worktree for a branch and add it to a VSCode workspace:

pnpx @infodb/worktree add <workspace-name> <branch-name> [options]

This creates a worktree directory named {project}.{branch} (e.g., myproject.feature-new-feature)

Basic Usage

pnpx @infodb/worktree add my-workspace feature/new-feature

Note:

  • .code-workspace extension is optional and will be added automatically
  • If the workspace file doesn't exist, it will be created automatically with the current repository included

Custom Directory Name

Specify a custom directory name for the worktree:

pnpx @infodb/worktree add my-workspace feature/new-feature --directory custom-folder-name

Remove Command (Delete Worktree)

Remove a git worktree and remove it from a VSCode workspace:

pnpx @infodb/worktree remove <workspace-name> <branch-name>

Alias: rm

pnpx @infodb/worktree rm my-workspace feature/new-feature

Environment Variable

Set the workspace search directory:

export INFODB_WORKSPACE_DIR="/path/to/workspaces"
pnpx @infodb/worktree feature/new-feature

Commands

add <workspace-name> <branch-name> [options]

Create a new worktree and add it to the specified workspace.

Options:

  • -d, --directory <dir>: Custom directory name for the worktree (defaults to project.branch pattern)

remove <workspace-name> <branch-name>

Remove an existing worktree and remove it from the specified workspace.

Aliases: rm

Global Options

  • -h, --help: Display help information
  • -V, --version: Display version number

How it works

  1. Project Name Detection: Detects project name from git remote URL or uses directory name as fallback
  2. Directory Naming: Creates worktree with {project}.{branch} pattern (e.g., myproject.feature-auth)
  3. Branch Name Sanitization: Converts / to - and removes invalid filesystem characters
  4. Git Worktree Creation: Creates a new git worktree in a directory adjacent to your current repository
  5. Branch Handling:
    • If the branch exists locally, uses it
    • If the branch exists on remote, creates a local tracking branch
    • If the branch doesn't exist, creates a new branch from current HEAD
  6. Workspace Detection: Automatically searches for .code-workspace files in:
    • INFODB_WORKSPACE_DIR environment variable location (if set)
    • Adjacent directories to the repository
  7. VSCode Integration: Adds the worktree directory to the detected or specified VSCode workspace file

Requirements

  • Git repository
  • Node.js 16 or higher
  • VSCode workspace file (optional, for workspace integration)

Examples

# Create worktree and add to workspace
pnpx @infodb/worktree add my-project main
# Creates: myproject.main/

# Create worktree for feature branch (branch name gets sanitized)
pnpx @infodb/worktree add my-project feature/user-auth
# Creates: myproject.feature-user-auth/

# Create worktree with workspace file (extension optional, creates if not exists)
pnpx @infodb/worktree add project feature/user-auth

# Create worktree with custom directory name
pnpx @infodb/worktree add my-project hotfix/critical-bug --directory hotfix-urgent

# Remove worktree and remove from workspace
pnpx @infodb/worktree remove my-project feature/user-auth

# Remove using alias
pnpx @infodb/worktree rm my-project hotfix/critical-bug

# Use environment variable for workspace search
export INFODB_WORKSPACE_DIR="/home/user/workspaces"
pnpx @infodb/worktree add my-project feature/new-feature