omp packages

@mazli/pi-worktree0.2.0

A Pi package extension that simplifies creating and managing git worktrees.

mazli Published 7 days ago MIT ~272 downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

Pi Worktree

A small Pi extension that makes Git worktrees easy to open from inside Pi.

If you already use worktrees, this removes the setup ceremony: no manual folder creation, no separate git worktree add, no reopening Pi in another directory.

The shortcut

Inside any Git repository, run:

/worktree

Pi Worktree generates a short random name (5 lowercase letters and digits, e.g. k3m9x), creates or reuses a branch and worktree with that name, and switches Pi into it. No name required.

Prefer to name it yourself? Pass one:

/worktree Feature/Auth

What it handles for you

The command takes care of the repetitive setup:

  • creates .worktrees/ when needed
  • creates or reuses the Git branch
  • creates or reuses the matching worktree
  • adds .worktrees to an existing .gitignore when needed
  • copies safe project .pi resources into the worktree when the worktree lacks .pi
  • opens a fresh Pi session rooted in the worktree
  • works from both brand-new and already-persisted Pi sessions

You stay inside Pi. The extension handles the ceremony.

Usage

Run the command with no arguments to get a generated name:

/worktree

Pi will move you into something like:

.worktrees/k3m9x

Or pass a name to use it as the branch and folder name:

/worktree my-feature

Pi will move you into:

.worktrees/my-feature

From there, just keep prompting or coding as usual. The command switches sessions without automatically triggering an agent response.

If your repository root has a .pi/ directory and the worktree does not, Pi Worktree copies the safe project resources it finds (settings.json, skills/, prompts/, extensions/, themes/, SYSTEM.md, and APPEND_SYSTEM.md). Missing entries are skipped, symlinks are ignored, and copy failures only show a warning before the session switch continues.

Naming

The name is used as the Git branch name.

When you omit the name, the extension generates a 5-character lowercase alphanumeric name and retries until it finds one that does not collide with an existing branch or worktree folder.

If the name you pass contains path separators, the folder name is cleaned up:

/worktree Feature/Auth

Branch:

Feature/Auth

Folder:

.worktrees/Feature-Auth

Installation

Install the package with Pi:

pi install npm:@mazli/pi-worktree

Or try it for a single Pi run without installing it permanently:

pi -e npm:@mazli/pi-worktree

Development

From this repository:

npm install
npm run check
pi -e .

The package entry point is declared in package.json and loads the extension from extensions/.

License

MIT