@carter-mcalister/pi-worktrunk
Worktrunk-backed worktree extension for Pi Coding Agent
Package details
Install @carter-mcalister/pi-worktrunk from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@carter-mcalister/pi-worktrunk- Package
@carter-mcalister/pi-worktrunk- Version
0.4.1- Published
- Apr 12, 2026
- Downloads
- 76/mo · 5/wk
- Author
- carter-mcalister
- License
- MIT
- Types
- extension
- Size
- 81.2 KB
- Dependencies
- 2 dependencies · 2 peers
Pi manifest JSON
{
"extensions": [
"./src/index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
@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 cdusewt 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
| Command | Behavior |
|---|---|
/worktree init |
Show Worktrunk setup guidance |
/worktree settings |
Show Worktrunk config info via wt config show |
/worktree create <branch> |
Create a worktree via Worktrunk |
/worktree list |
List worktrees and optionally switch via Worktrunk |
/worktree status |
Show the current worktree from Worktrunk JSON output |
/worktree cd <name> |
Print the matching worktree path |
/worktree remove <name> |
Remove a worktree via Worktrunk |
/worktree prune |
Deprecated; use Worktrunk-native cleanup flows |
/worktree templates |
Deprecated; 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:
- https://worktrunk.dev/config/
- https://worktrunk.dev/hook/
- https://worktrunk.dev/switch/
- https://worktrunk.dev/list/
- https://worktrunk.dev/remove/
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
wtto be installed and available onPATH. - Pi keeps the
/worktreecommand 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