@zenobius/pi-worktrees 0.2.0 → 0.3.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # `@zenobius/pi-worktrees`
2
2
 
3
+ <img width="1531" height="1172" alt="image" src="https://github.com/user-attachments/assets/33fe4c01-4d9b-41ec-a326-116db6e750df" />
4
+
5
+
3
6
  Git worktree management for [Pi Coding Agent](https://github.com/badlogic/pi-mono) with a clean `/worktree` command surface.
4
7
 
5
8
  This extension helps you spin up isolated feature workspaces quickly, with safety checks and optional post-create automation.
@@ -44,6 +47,28 @@ If Pi is already running, use `/reload` to load newly installed extensions.
44
47
 
45
48
  ---
46
49
 
50
+ ## Getting started in 2 minutes
51
+
52
+ 1. Install the extension:
53
+
54
+ ```bash
55
+ pi install npm:@zenobius/pi-worktrees
56
+ ```
57
+
58
+ 2. Open a git repo in Pi and run:
59
+
60
+ ```text
61
+ /worktree init
62
+ /worktree create auth-refactor
63
+ /worktree list
64
+ ```
65
+
66
+ 3. Optional: jump into it from your shell using the printed path:
67
+
68
+ ```text
69
+ /worktree cd auth-refactor
70
+ ```
71
+
47
72
  ## Quick start
48
73
 
49
74
  In Pi:
@@ -58,11 +83,9 @@ In Pi:
58
83
  /worktree prune
59
84
  ```
60
85
 
61
- ### How I use `/worktrees`
62
-
63
- Since I use nvim and zellij, i want the worktrees I create to be clones of the workspace
64
- I have for the current one, so to this end, my `onCreate` looks like:
86
+ ### Example: How I use `/worktree`
65
87
 
88
+ I use Neovim and Zellij, and I want each new worktree to boot a ready-to-code workspace. My `onCreate` looks like:
66
89
  ```json
67
90
  {
68
91
  "worktrees": {
@@ -78,12 +101,9 @@ I have for the current one, so to this end, my `onCreate` looks like:
78
101
  }
79
102
  }
80
103
  }
81
-
82
104
  ```
83
105
 
84
- This means when ever i create a new worktree, it creates a new zellij tab with nvim and pi running
85
- in it on the new worktree path.
86
-
106
+ This creates a new Zellij tab with Neovim and Pi running in the new worktree path.
87
107
  ---
88
108
 
89
109
  ## Command reference
@@ -92,7 +112,7 @@ in it on the new worktree path.
92
112
  |---|---|
93
113
  | `/worktree init` | Interactive setup for extension settings |
94
114
  | `/worktree settings` | Show all current settings |
95
- | `/worktree settings <key>` | Get one setting (`worktreeRoot`, `onCreate`) |
115
+ | `/worktree settings <key>` | Get one setting (`worktreeRoot`, `parentDir` alias, `onCreate`) |
96
116
  | `/worktree settings <key> <value>` | Set one setting |
97
117
  | `/worktree create <feature-name>` | Create a new worktree + branch `feature/<feature-name>` |
98
118
  | `/worktree list` | List all worktrees (`/worktree ls` alias) |
@@ -121,6 +141,13 @@ Settings live in `~/.pi/agent/pi-worktrees-settings.json`.
121
141
  }
122
142
  },
123
143
  "matchingStrategy": "fail-on-tie",
144
+ "onCreateDisplayOutputMaxLines": 5,
145
+ "onCreateCmdDisplayPending": "[ ] {{cmd}}",
146
+ "onCreateCmdDisplaySuccess": "[x] {{cmd}}",
147
+ "onCreateCmdDisplayError": "[ ] {{cmd}} [ERROR]",
148
+ "onCreateCmdDisplayPendingColor": "dim",
149
+ "onCreateCmdDisplaySuccessColor": "success",
150
+ "onCreateCmdDisplayErrorColor": "error",
124
151
  "worktree": {
125
152
  "worktreeRoot": "~/.local/share/worktrees/{{project}}",
126
153
  "onCreate": "mise setup"
@@ -128,14 +155,30 @@ Settings live in `~/.pi/agent/pi-worktrees-settings.json`.
128
155
  }
129
156
  ```
130
157
 
158
+ ### Configuration reference
159
+
160
+ | Key | Type | Default | Description |
161
+ |---|---|---|---|
162
+ | `worktrees` | `Record<string, WorktreeSettings>` | `{}` | Pattern-matched settings by repo URL or glob. |
163
+ | `matchingStrategy` | `'fail-on-tie' \| 'first-wins' \| 'last-wins'` | `fail-on-tie` | Tie-break behavior for equally specific patterns. |
164
+ | `onCreateDisplayOutputMaxLines` | `number` (integer, `>= 0`) | `5` | Number of latest stdout/stderr lines shown in live UI updates during `onCreate`. |
165
+ | `onCreateCmdDisplayPending` | `string` | `[ ] {{cmd}}` | Template for pending/running command display lines. |
166
+ | `onCreateCmdDisplaySuccess` | `string` | `[x] {{cmd}}` | Template for successful command display lines. |
167
+ | `onCreateCmdDisplayError` | `string` | `[ ] {{cmd}} [ERROR]` | Template for failed command display lines. |
168
+ | `onCreateCmdDisplayPendingColor` | `string` | `dim` | Pi theme color name for pending/running command lines. |
169
+ | `onCreateCmdDisplaySuccessColor` | `string` | `success` | Pi theme color name for successful command lines. |
170
+ | `onCreateCmdDisplayErrorColor` | `string` | `error` | Pi theme color name for failed command lines. |
171
+ | `worktree` (legacy) | `WorktreeSettings` | n/a | Legacy fallback shape; migrated automatically. |
172
+
131
173
  ### Matching model
132
174
 
133
175
  For the current repository, settings are resolved in this order:
134
-
135
176
  1. Exact URL match in `worktrees`
136
177
  2. Most-specific glob match in `worktrees`
137
- 3. Fallback to legacy `worktree`
178
+ 3. Normalized fallback pattern `"**"`
138
179
 
180
+ At runtime, the extension normalizes the matcher input map to always include `worktrees["**"]`.
181
+ If not explicitly configured, that fallback is seeded from built-in defaults (`worktreeRoot: "{{mainWorktree}}.worktrees"`, `onCreate: "echo \"Created {{path}}\""`).
139
182
  `matchingStrategy` controls ties between equally specific patterns:
140
183
 
141
184
  - `fail-on-tie` (default)
@@ -151,6 +194,34 @@ For the current repository, settings are resolved in this order:
151
194
 
152
195
  When an array is used, commands run sequentially and stop on first failure.
153
196
 
197
+ ### `onCreateDisplayOutputMaxLines`
198
+
199
+ Controls only live UI output verbosity for `onCreate` command execution.
200
+ - **Default**: `5`
201
+ - **Scope**: display only
202
+ - **Does not affect**: logfile contents (full stdout/stderr is still logged)
203
+
204
+ ### `onCreate` command line display templates
205
+
206
+ These templates control how each command line is rendered in the live progress list.
207
+
208
+ - `onCreateCmdDisplayPending` (default: `[ ] {{cmd}}`)
209
+ - `onCreateCmdDisplaySuccess` (default: `[x] {{cmd}}`)
210
+ - `onCreateCmdDisplayError` (default: `[ ] {{cmd}} [ERROR]`)
211
+
212
+ Supported token:
213
+ - `{{cmd}}` (or `{cmd}`) → expanded command string
214
+
215
+ ### `onCreate` command line display colors
216
+
217
+ These settings use Pi theme color names:
218
+
219
+ - `onCreateCmdDisplayPendingColor` (default: `dim`)
220
+ - `onCreateCmdDisplaySuccessColor` (default: `success`)
221
+ - `onCreateCmdDisplayErrorColor` (default: `error`)
222
+
223
+ Supported color names in this extension: `dim`, `accent`, `info`, `success`, `warning`, `error`.
224
+
154
225
  ### `worktreeRoot`
155
226
 
156
227
  Where new worktrees are created.
@@ -11,6 +11,13 @@ export interface OnCreateResult {
11
11
  }
12
12
  export interface OnCreateHookOptions {
13
13
  logPath?: string;
14
+ displayOutputMaxLines?: number;
15
+ cmdDisplayPending?: string;
16
+ cmdDisplaySuccess?: string;
17
+ cmdDisplayError?: string;
18
+ cmdDisplayPendingColor?: string;
19
+ cmdDisplaySuccessColor?: string;
20
+ cmdDisplayErrorColor?: string;
14
21
  }
15
22
  /**
16
23
  * Runs post-create hooks sequentially.