← Catalog

@carter-mcalister/pi-worktrunk

Worktrunk-backed worktree extension for Pi Coding Agent

Extension

Install

Install with PiG

pig install npm:@carter-mcalister/pi-worktrunk

Install with Pi

pi install npm:@carter-mcalister/pi-worktrunk
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "extensions": [
    "./src/index.ts"
  ]
}

README

Written by the package's publisher, shown as published in version 0.4.1 (README.md). PiG does not review it.

@carter-mcalister/pi-worktrunk

Worktrunk-backed worktree management for Pi Coding Agent.

This extension keeps a familiar /worktree ... command surface inside Pi, but it now delegates worktree behavior to Worktrunk instead of calling git worktree directly.

What changed

pi-worktrunk is now a thin wrapper around wt:

  • /worktree create → wt switch --create --no-cd
  • /worktree list → wt list --format=json
  • /worktree remove → wt remove
  • /worktree status / /worktree cd use wt list --format=json

The extension no longer reads ~/.pi/agent/pi-worktrees-settings.json.

Runtime behavior now comes from Worktrunk config files:

  • user config: ~/.config/worktrunk/config.toml
  • project config: .config/wt.toml

Install

1. Install the Pi extension

pi install npm:@carter-mcalister/pi-worktrunk

2. Install Worktrunk

macOS / Linux (Homebrew):

brew install worktrunk

Or follow the upstream install instructions:

3. Install Worktrunk shell integration

wt config shell install

4. Create Worktrunk config

User config:

wt config create

Project config:

wt config create --project

If Pi is already running, use /reload after installing the extension.

Quick start

In Pi:

/worktree init
/worktree create feature/auth-refactor
/worktree list
/worktree status
/worktree cd feature/auth-refactor
/worktree remove feature/auth-refactor

Command reference

CommandBehavior
/worktree initShow Worktrunk setup guidance
/worktree settingsShow Worktrunk config info via wt config show
/worktree create <branch>Create a worktree via Worktrunk
/worktree listList worktrees and optionally switch via Worktrunk
/worktree statusShow the current worktree from Worktrunk JSON output
/worktree cd <name>Print the matching worktree path
/worktree remove <name>Remove a worktree via Worktrunk
/worktree pruneDeprecated; use Worktrunk-native cleanup flows
/worktree templatesDeprecated; use Worktrunk template docs

Aliases retained:

  • /worktree ls → /worktree list
  • /worktree rm → /worktree remove
  • /worktree config → /worktree settings
  • /worktree vars / /worktree tokens → /worktree templates

Configuration

This extension does not maintain its own runtime config anymore.

Use Worktrunk config instead:

User config

~/.config/worktrunk/config.toml

Example:

worktree-path = "{{ repo_path }}/.worktrees/{{ branch | sanitize }}"

[projects."github.com/org/repo"]
worktree-path = ".worktrees/{{ branch | sanitize }}"

Project config

.config/wt.toml

Example:

[pre-start]
deps = "bun install"

[post-start]
editor = "zellij action new-tab --name {{ branch | sanitize }} --cwd {{ worktree_path }}"

[list]
url = "http://localhost:{{ branch | hash_port }}"

See Worktrunk docs for full configuration:

Removed extension-owned features

The Worktrunk-backed version intentionally drops behavior that duplicated Worktrunk:

  • ~/.pi/agent/pi-worktrees-settings.json
  • repo pattern matching / matching strategies
  • extension-managed onCreate, onSwitch, onBeforeRemove
  • extension-managed branch generators
  • /worktree create --generate
  • /worktree create --name
  • extension template preview for custom hook variables

If you used those features before, migrate them to Worktrunk config and hooks.

Notes

  • This extension expects wt to be installed and available on PATH.
  • Pi keeps the /worktree command surface, but Worktrunk is now the source of truth.
  • For directory switching in your shell, Worktrunk shell integration is still required.

Credits

This package is a maintained fork of @zenobius/pi-worktrees.

Credit to Zenobius for the original project and foundation this fork builds on.

Development

mise install
bun install
mise run check