wt-manager 1.4.0 → 1.7.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 +218 -43
- package/dist/cli.js +25273 -26
- package/dist/cli.js.map +1 -1
- package/dist/commands/config.d.ts +3 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +69 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/new.d.ts.map +1 -1
- package/dist/commands/new.js +39 -78
- package/dist/commands/new.js.map +1 -1
- package/dist/utils/config.d.ts +50 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/config.js +192 -0
- package/dist/utils/config.js.map +1 -0
- package/package.json +17 -19
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ Git worktrees let you work on multiple branches simultaneously—but managing th
|
|
|
15
15
|
|
|
16
16
|
`wt` gives you the dashboard Git forgot to include.
|
|
17
17
|
|
|
18
|
-

|
|
19
19
|
|
|
20
20
|
The `wt list` command shows you everything:
|
|
21
21
|
- All your worktrees with their PR status (open/draft/merged/closed)
|
|
@@ -27,48 +27,39 @@ And when you're done? `wt clean` finds all merged/closed PRs and removes their w
|
|
|
27
27
|
|
|
28
28
|
## Quick Start
|
|
29
29
|
|
|
30
|
-
**Requirements:**
|
|
30
|
+
**Requirements:** Bun 1.0+, Git, and [GitHub CLI](https://cli.github.com/) (`gh auth login`)
|
|
31
31
|
|
|
32
32
|
```bash
|
|
33
33
|
# Install globally
|
|
34
|
-
|
|
34
|
+
bun install -g wt-manager
|
|
35
35
|
|
|
36
36
|
# Create a new worktree
|
|
37
|
-
wt feature/my-feature
|
|
37
|
+
wt new feature/my-feature
|
|
38
38
|
|
|
39
39
|
# See all worktrees with PR status
|
|
40
40
|
wt list
|
|
41
41
|
|
|
42
|
-
#
|
|
43
|
-
wt
|
|
44
|
-
```
|
|
42
|
+
# Quick status of current worktree
|
|
43
|
+
wt status
|
|
45
44
|
|
|
46
|
-
|
|
45
|
+
# Copy worktree path to clipboard
|
|
46
|
+
wt path
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
# Add to ~/.zshrc
|
|
52
|
-
eval "$(wt init)"
|
|
48
|
+
# Clean up merged/closed worktrees
|
|
49
|
+
wt clean
|
|
53
50
|
|
|
54
|
-
#
|
|
55
|
-
wt
|
|
56
|
-
# To navigate to it, open WebStorm, and start Claude, run:
|
|
57
|
-
wtl ../repo-worktrees/feature-my-feature
|
|
51
|
+
# Check environment setup
|
|
52
|
+
wt doctor
|
|
58
53
|
```
|
|
59
54
|
|
|
60
55
|
## Commands
|
|
61
56
|
|
|
62
|
-
### `wt <branch-name> [base-branch]`
|
|
63
57
|
### `wt new <branch-name> [base-branch]`
|
|
64
58
|
|
|
65
59
|
Create a new worktree for a new branch. Worktrees are created in `../<repo>-worktrees/` directory.
|
|
66
60
|
|
|
67
61
|
```bash
|
|
68
|
-
# Create worktree from default branch
|
|
69
|
-
wt feature/new-feature
|
|
70
|
-
|
|
71
|
-
# Create worktree from default branch (explicit)
|
|
62
|
+
# Create worktree from default branch
|
|
72
63
|
wt new feature/new-feature
|
|
73
64
|
|
|
74
65
|
# Create worktree from specific base branch
|
|
@@ -84,12 +75,11 @@ wt new feature/new-feature develop
|
|
|
84
75
|
- Converts slashes in branch names to dashes for directory names (e.g., `feature/foo` → `feature-foo`)
|
|
85
76
|
- Shows spinner during creation
|
|
86
77
|
- Fails if branch already exists locally
|
|
87
|
-
-
|
|
88
|
-
-
|
|
89
|
-
- Copies WebStorm `.idea` settings from main worktree (run configurations, code styles, inspection profiles, scopes, and project files)
|
|
78
|
+
- Copies/symlinks files based on `.wtrc.js` config (see [Configuration](#configuration))
|
|
79
|
+
- Runs post-create commands from config
|
|
90
80
|
- Copies worktree path to clipboard for easy navigation
|
|
91
81
|
|
|
92
|
-
### `wt list`
|
|
82
|
+
### `wt list` (alias: `ls`)
|
|
93
83
|
|
|
94
84
|
List all worktrees with their status, PR information, and branch details.
|
|
95
85
|
|
|
@@ -186,7 +176,7 @@ Removing feature-old...
|
|
|
186
176
|
Run 'wt list' to see remaining worktrees.
|
|
187
177
|
```
|
|
188
178
|
|
|
189
|
-
### `wt remove <name>`
|
|
179
|
+
### `wt remove <name>` (alias: `rm`)
|
|
190
180
|
|
|
191
181
|
Remove a specific worktree by name. Interactive with safety prompts for uncommitted changes and unpushed commits.
|
|
192
182
|
|
|
@@ -240,26 +230,174 @@ Modified:
|
|
|
240
230
|
Run 'wt list' to see remaining worktrees
|
|
241
231
|
```
|
|
242
232
|
|
|
233
|
+
### `wt path [name]`
|
|
234
|
+
|
|
235
|
+
Select a worktree interactively and copy its path to clipboard. Useful for quick navigation.
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
# Interactive selection
|
|
239
|
+
wt path
|
|
240
|
+
|
|
241
|
+
# Fuzzy match and copy directly
|
|
242
|
+
wt path auth
|
|
243
|
+
|
|
244
|
+
# Quiet mode for scripting (prints raw path, no clipboard)
|
|
245
|
+
wt path -q feature
|
|
246
|
+
cd $(wt path -q feature)
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
**Arguments:**
|
|
250
|
+
- `[name]` - Optional fuzzy match on branch or directory name
|
|
251
|
+
|
|
252
|
+
**Options:**
|
|
253
|
+
- `-q, --quiet` - Output path only (for scripting). Requires name argument.
|
|
254
|
+
|
|
255
|
+
**Behavior:**
|
|
256
|
+
- Without argument: Shows interactive list of worktrees to select from
|
|
257
|
+
- With argument: Fuzzy matches and copies path directly to clipboard
|
|
258
|
+
- With `-q`: Prints raw path to stdout (no spinner, no clipboard, no colors)
|
|
259
|
+
- Shows PR status and ahead/behind counts in the selection list
|
|
260
|
+
|
|
261
|
+
**Example:**
|
|
262
|
+
```
|
|
263
|
+
? Select worktree:
|
|
264
|
+
❯ ● feature-auth (↑2 ↓0) [open]
|
|
265
|
+
○ feature-api (↑5 ↓1) [draft]
|
|
266
|
+
○ bugfix-login [merged]
|
|
267
|
+
|
|
268
|
+
✓ Copied to clipboard: /path/to/repo-worktrees/feature-auth
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### `wt status`
|
|
272
|
+
|
|
273
|
+
Show quick status of the current worktree.
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
wt status
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
**Output includes:**
|
|
280
|
+
- Branch name with ahead/behind counts
|
|
281
|
+
- PR status and check runs (if available)
|
|
282
|
+
- Modified and untracked file counts
|
|
283
|
+
|
|
284
|
+
**Example output:**
|
|
285
|
+
```
|
|
286
|
+
feature/auth (↑2 ↓5)
|
|
287
|
+
PR #42 open - ✓ checks passing
|
|
288
|
+
https://github.com/owner/repo/pull/42
|
|
289
|
+
3 modified, 1 untracked
|
|
290
|
+
```
|
|
291
|
+
|
|
243
292
|
### `wt init`
|
|
244
293
|
|
|
245
|
-
|
|
294
|
+
Initialize a `.wtrc.js` configuration file in the current repository.
|
|
246
295
|
|
|
247
296
|
```bash
|
|
248
|
-
|
|
249
|
-
eval "$(wt init)"
|
|
297
|
+
wt init
|
|
250
298
|
```
|
|
251
299
|
|
|
252
|
-
**
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
300
|
+
**Behavior:**
|
|
301
|
+
- Creates `.wtrc.js` in the main worktree root with default configuration
|
|
302
|
+
- If config already exists, shows a message and exits without overwriting
|
|
303
|
+
|
|
304
|
+
### `wt doctor`
|
|
305
|
+
|
|
306
|
+
Check environment and configuration for potential issues.
|
|
257
307
|
|
|
258
308
|
```bash
|
|
259
|
-
|
|
260
|
-
wtl feature/my-feature
|
|
309
|
+
wt doctor
|
|
261
310
|
```
|
|
262
311
|
|
|
312
|
+
**Checks performed:**
|
|
313
|
+
| Check | Pass | Warn/Fail |
|
|
314
|
+
|-------|------|-----------|
|
|
315
|
+
| Git installed | Shows version | Error |
|
|
316
|
+
| Inside git repo | Shows repo name | Error |
|
|
317
|
+
| GitHub CLI installed | Shows version | Warning with install link |
|
|
318
|
+
| GitHub CLI authenticated | Shows username | Warning to run `gh auth login` |
|
|
319
|
+
| Worktrees directory | Shows count | Info if none yet |
|
|
320
|
+
| Config file | Shows if found | Info if using defaults |
|
|
321
|
+
|
|
322
|
+
**Example output:**
|
|
323
|
+
```
|
|
324
|
+
Checks:
|
|
325
|
+
✓ Git: 2.43.0
|
|
326
|
+
✓ Repository: my-repo
|
|
327
|
+
✓ GitHub CLI: 2.40.0
|
|
328
|
+
✓ GitHub auth: username
|
|
329
|
+
✓ Worktrees: 3 worktrees in ../my-repo-worktrees
|
|
330
|
+
○ Config: using defaults (no .wtrc.js)
|
|
331
|
+
|
|
332
|
+
All checks passed!
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
## Configuration
|
|
336
|
+
|
|
337
|
+
Create a `.wtrc.js` file in your repository root to configure worktree behavior (or use `wt init`):
|
|
338
|
+
|
|
339
|
+
```javascript
|
|
340
|
+
export default {
|
|
341
|
+
worktreePath: '$REPO-worktrees/$DIR',
|
|
342
|
+
copy: [
|
|
343
|
+
'.idea/runConfigurations/**',
|
|
344
|
+
'.idea/codeStyles/**',
|
|
345
|
+
'!.idea/workspace.xml'
|
|
346
|
+
],
|
|
347
|
+
symlink: [
|
|
348
|
+
'.env'
|
|
349
|
+
],
|
|
350
|
+
postCreate: 'npm install && code $PATH',
|
|
351
|
+
}
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
### Configuration Options
|
|
355
|
+
|
|
356
|
+
| Option | Type | Default | Description |
|
|
357
|
+
|--------|------|---------|-------------|
|
|
358
|
+
| `worktreePath` | string | `$REPO-worktrees/$DIR` | Path template for new worktrees (relative to parent of main repo) |
|
|
359
|
+
| `copy` | string[] | `[]` | Glob patterns for files to copy from main worktree |
|
|
360
|
+
| `symlink` | string[] | `[]` | Glob patterns for files to symlink from main worktree |
|
|
361
|
+
| `postCreate` | string | `''` | Command to run after creating worktree |
|
|
362
|
+
|
|
363
|
+
### Template Variables
|
|
364
|
+
|
|
365
|
+
Use these variables in `worktreePath` and `postCreate`:
|
|
366
|
+
|
|
367
|
+
| Variable | Description | Example |
|
|
368
|
+
|----------|-------------|---------|
|
|
369
|
+
| `$REPO` | Repository name | `my-repo` |
|
|
370
|
+
| `$BRANCH` | Original branch name | `feature/auth` |
|
|
371
|
+
| `$DIR` | Directory-safe branch name (slashes → dashes) | `feature-auth` |
|
|
372
|
+
| `$PATH` | Full worktree path | `/path/to/my-repo-worktrees/feature-auth` |
|
|
373
|
+
|
|
374
|
+
### Glob Patterns
|
|
375
|
+
|
|
376
|
+
Copy and symlink patterns use gitignore-style globs:
|
|
377
|
+
|
|
378
|
+
- `.env` - single file
|
|
379
|
+
- `.idea/**` - entire directory
|
|
380
|
+
- `!.idea/workspace.xml` - exclude specific file
|
|
381
|
+
- `*.config.js` - wildcard matching
|
|
382
|
+
|
|
383
|
+
### Post-Create Command
|
|
384
|
+
|
|
385
|
+
The `postCreate` string runs via `sh -c` in the new worktree directory. Use shell syntax for chaining:
|
|
386
|
+
|
|
387
|
+
```javascript
|
|
388
|
+
export default {
|
|
389
|
+
postCreate: 'npm install && code $PATH',
|
|
390
|
+
}
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
### View Current Config
|
|
394
|
+
|
|
395
|
+
```bash
|
|
396
|
+
wt config
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
Shows the active configuration with resolved paths.
|
|
400
|
+
|
|
263
401
|
## GitHub Integration
|
|
264
402
|
|
|
265
403
|
This tool integrates with GitHub to provide rich PR information:
|
|
@@ -295,11 +433,15 @@ Here's a typical workflow using these tools:
|
|
|
295
433
|
|
|
296
434
|
```bash
|
|
297
435
|
# Create a new worktree for a feature
|
|
298
|
-
wt feature/add-auth
|
|
436
|
+
wt new feature/add-auth
|
|
299
437
|
|
|
300
|
-
# Navigate to the worktree
|
|
438
|
+
# Navigate to the worktree (path copied to clipboard)
|
|
301
439
|
cd ../my-repo-worktrees/feature-add-auth
|
|
302
440
|
|
|
441
|
+
# Or use wt path to get the path
|
|
442
|
+
wt path auth
|
|
443
|
+
# ✓ Copied to clipboard: /path/to/repo-worktrees/feature-add-auth
|
|
444
|
+
|
|
303
445
|
# Work on your feature...
|
|
304
446
|
git add .
|
|
305
447
|
git commit -m "Add authentication"
|
|
@@ -308,6 +450,11 @@ git push -u origin feature/add-auth
|
|
|
308
450
|
# Create PR via gh CLI
|
|
309
451
|
gh pr create --title "Add authentication" --body "Implements user auth"
|
|
310
452
|
|
|
453
|
+
# Check status of current worktree
|
|
454
|
+
wt status
|
|
455
|
+
# feature/add-auth (↑1 ↓0)
|
|
456
|
+
# PR #42 open - ✓ checks passing
|
|
457
|
+
|
|
311
458
|
# Check status of all worktrees
|
|
312
459
|
wt list
|
|
313
460
|
# Shows: feature-add-auth (open)
|
|
@@ -317,25 +464,53 @@ wt clean
|
|
|
317
464
|
# Removes merged worktree and deletes branch
|
|
318
465
|
```
|
|
319
466
|
|
|
467
|
+
## Installation
|
|
468
|
+
|
|
469
|
+
### Via bun
|
|
470
|
+
|
|
471
|
+
```bash
|
|
472
|
+
bun install -g wt-manager
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
### Standalone Binaries
|
|
476
|
+
|
|
477
|
+
Download pre-built binaries from [GitHub Releases](https://github.com/daviddurika/git-worktree-manager/releases):
|
|
478
|
+
|
|
479
|
+
| Platform | Binary |
|
|
480
|
+
|----------|--------|
|
|
481
|
+
| macOS ARM64 (M1/M2) | `wt-darwin-arm64` |
|
|
482
|
+
| macOS x64 (Intel) | `wt-darwin-x64` |
|
|
483
|
+
| Linux x64 | `wt-linux-x64` |
|
|
484
|
+
| Linux ARM64 | `wt-linux-arm64` |
|
|
485
|
+
| Windows x64 | `wt-windows-x64.exe` |
|
|
486
|
+
|
|
487
|
+
```bash
|
|
488
|
+
# Example: macOS ARM64
|
|
489
|
+
curl -L https://github.com/daviddurika/git-worktree-manager/releases/latest/download/wt-darwin-arm64 -o ~/.local/bin/wt
|
|
490
|
+
chmod +x ~/.local/bin/wt
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
Make sure `~/.local/bin` is in your PATH.
|
|
494
|
+
|
|
320
495
|
## Development
|
|
321
496
|
|
|
322
497
|
### Build
|
|
323
498
|
|
|
324
499
|
```bash
|
|
325
|
-
|
|
500
|
+
bun run build
|
|
326
501
|
```
|
|
327
502
|
|
|
328
503
|
### Watch Mode
|
|
329
504
|
|
|
330
505
|
```bash
|
|
331
|
-
|
|
506
|
+
bun run dev
|
|
332
507
|
```
|
|
333
508
|
|
|
334
509
|
### Linting
|
|
335
510
|
|
|
336
511
|
```bash
|
|
337
|
-
|
|
338
|
-
|
|
512
|
+
bun run lint
|
|
513
|
+
bun run format
|
|
339
514
|
```
|
|
340
515
|
|
|
341
516
|
## License
|