wt-manager 1.4.1 → 1.7.2
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 +231 -43
- package/dist/cli.js +25395 -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,69 +27,72 @@ 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
|
|
75
66
|
wt new feature/new-feature develop
|
|
67
|
+
|
|
68
|
+
# CI/CD: get just the path
|
|
69
|
+
wt new feature/new-feature -q
|
|
70
|
+
|
|
71
|
+
# Composable with cd
|
|
72
|
+
cd $(wt new feature/new-feature -q)
|
|
73
|
+
|
|
74
|
+
# Interactive but skip the postCreate command
|
|
75
|
+
wt new feature/new-feature --no-post-create
|
|
76
76
|
```
|
|
77
77
|
|
|
78
78
|
**Arguments:**
|
|
79
79
|
- `<branch-name>` - Name of the new branch to create
|
|
80
80
|
- `[base-branch]` - Base branch to create from (default: auto-detected from origin/HEAD)
|
|
81
81
|
|
|
82
|
+
**Options:**
|
|
83
|
+
- `-q, --quiet` - Print only the worktree path (implies `--no-post-create`, skips clipboard)
|
|
84
|
+
- `--no-post-create` - Skip the `postCreate` command from `.wtrc.js`
|
|
85
|
+
|
|
82
86
|
**Behavior:**
|
|
83
87
|
- Automatically creates the worktree directory structure
|
|
84
88
|
- Converts slashes in branch names to dashes for directory names (e.g., `feature/foo` → `feature-foo`)
|
|
85
89
|
- Shows spinner during creation
|
|
86
90
|
- 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)
|
|
91
|
+
- Copies/symlinks files based on `.wtrc.js` config (see [Configuration](#configuration))
|
|
92
|
+
- Runs post-create commands from config
|
|
90
93
|
- Copies worktree path to clipboard for easy navigation
|
|
91
94
|
|
|
92
|
-
### `wt list`
|
|
95
|
+
### `wt list` (alias: `ls`)
|
|
93
96
|
|
|
94
97
|
List all worktrees with their status, PR information, and branch details.
|
|
95
98
|
|
|
@@ -186,7 +189,7 @@ Removing feature-old...
|
|
|
186
189
|
Run 'wt list' to see remaining worktrees.
|
|
187
190
|
```
|
|
188
191
|
|
|
189
|
-
### `wt remove <name>`
|
|
192
|
+
### `wt remove <name>` (alias: `rm`)
|
|
190
193
|
|
|
191
194
|
Remove a specific worktree by name. Interactive with safety prompts for uncommitted changes and unpushed commits.
|
|
192
195
|
|
|
@@ -240,26 +243,174 @@ Modified:
|
|
|
240
243
|
Run 'wt list' to see remaining worktrees
|
|
241
244
|
```
|
|
242
245
|
|
|
246
|
+
### `wt path [name]`
|
|
247
|
+
|
|
248
|
+
Select a worktree interactively and copy its path to clipboard. Useful for quick navigation.
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
# Interactive selection
|
|
252
|
+
wt path
|
|
253
|
+
|
|
254
|
+
# Fuzzy match and copy directly
|
|
255
|
+
wt path auth
|
|
256
|
+
|
|
257
|
+
# Quiet mode for scripting (prints raw path, no clipboard)
|
|
258
|
+
wt path -q feature
|
|
259
|
+
cd $(wt path -q feature)
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
**Arguments:**
|
|
263
|
+
- `[name]` - Optional fuzzy match on branch or directory name
|
|
264
|
+
|
|
265
|
+
**Options:**
|
|
266
|
+
- `-q, --quiet` - Output path only (for scripting). Requires name argument.
|
|
267
|
+
|
|
268
|
+
**Behavior:**
|
|
269
|
+
- Without argument: Shows interactive list of worktrees to select from
|
|
270
|
+
- With argument: Fuzzy matches and copies path directly to clipboard
|
|
271
|
+
- With `-q`: Prints raw path to stdout (no spinner, no clipboard, no colors)
|
|
272
|
+
- Shows PR status and ahead/behind counts in the selection list
|
|
273
|
+
|
|
274
|
+
**Example:**
|
|
275
|
+
```
|
|
276
|
+
? Select worktree:
|
|
277
|
+
❯ ● feature-auth (↑2 ↓0) [open]
|
|
278
|
+
○ feature-api (↑5 ↓1) [draft]
|
|
279
|
+
○ bugfix-login [merged]
|
|
280
|
+
|
|
281
|
+
✓ Copied to clipboard: /path/to/repo-worktrees/feature-auth
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
### `wt status`
|
|
285
|
+
|
|
286
|
+
Show quick status of the current worktree.
|
|
287
|
+
|
|
288
|
+
```bash
|
|
289
|
+
wt status
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
**Output includes:**
|
|
293
|
+
- Branch name with ahead/behind counts
|
|
294
|
+
- PR status and check runs (if available)
|
|
295
|
+
- Modified and untracked file counts
|
|
296
|
+
|
|
297
|
+
**Example output:**
|
|
298
|
+
```
|
|
299
|
+
feature/auth (↑2 ↓5)
|
|
300
|
+
PR #42 open - ✓ checks passing
|
|
301
|
+
https://github.com/owner/repo/pull/42
|
|
302
|
+
3 modified, 1 untracked
|
|
303
|
+
```
|
|
304
|
+
|
|
243
305
|
### `wt init`
|
|
244
306
|
|
|
245
|
-
|
|
307
|
+
Initialize a `.wtrc.js` configuration file in the current repository.
|
|
246
308
|
|
|
247
309
|
```bash
|
|
248
|
-
|
|
249
|
-
eval "$(wt init)"
|
|
310
|
+
wt init
|
|
250
311
|
```
|
|
251
312
|
|
|
252
|
-
**
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
313
|
+
**Behavior:**
|
|
314
|
+
- Creates `.wtrc.js` in the main worktree root with default configuration
|
|
315
|
+
- If config already exists, shows a message and exits without overwriting
|
|
316
|
+
|
|
317
|
+
### `wt doctor`
|
|
318
|
+
|
|
319
|
+
Check environment and configuration for potential issues.
|
|
257
320
|
|
|
258
321
|
```bash
|
|
259
|
-
|
|
260
|
-
wtl feature/my-feature
|
|
322
|
+
wt doctor
|
|
261
323
|
```
|
|
262
324
|
|
|
325
|
+
**Checks performed:**
|
|
326
|
+
| Check | Pass | Warn/Fail |
|
|
327
|
+
|-------|------|-----------|
|
|
328
|
+
| Git installed | Shows version | Error |
|
|
329
|
+
| Inside git repo | Shows repo name | Error |
|
|
330
|
+
| GitHub CLI installed | Shows version | Warning with install link |
|
|
331
|
+
| GitHub CLI authenticated | Shows username | Warning to run `gh auth login` |
|
|
332
|
+
| Worktrees directory | Shows count | Info if none yet |
|
|
333
|
+
| Config file | Shows if found | Info if using defaults |
|
|
334
|
+
|
|
335
|
+
**Example output:**
|
|
336
|
+
```
|
|
337
|
+
Checks:
|
|
338
|
+
✓ Git: 2.43.0
|
|
339
|
+
✓ Repository: my-repo
|
|
340
|
+
✓ GitHub CLI: 2.40.0
|
|
341
|
+
✓ GitHub auth: username
|
|
342
|
+
✓ Worktrees: 3 worktrees in ../my-repo-worktrees
|
|
343
|
+
○ Config: using defaults (no .wtrc.js)
|
|
344
|
+
|
|
345
|
+
All checks passed!
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
## Configuration
|
|
349
|
+
|
|
350
|
+
Create a `.wtrc.js` file in your repository root to configure worktree behavior (or use `wt init`):
|
|
351
|
+
|
|
352
|
+
```javascript
|
|
353
|
+
export default {
|
|
354
|
+
worktreePath: '$REPO-worktrees/$DIR',
|
|
355
|
+
copy: [
|
|
356
|
+
'.idea/runConfigurations/**',
|
|
357
|
+
'.idea/codeStyles/**',
|
|
358
|
+
'!.idea/workspace.xml'
|
|
359
|
+
],
|
|
360
|
+
symlink: [
|
|
361
|
+
'.env'
|
|
362
|
+
],
|
|
363
|
+
postCreate: 'npm install && code $PATH',
|
|
364
|
+
}
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
### Configuration Options
|
|
368
|
+
|
|
369
|
+
| Option | Type | Default | Description |
|
|
370
|
+
|--------|------|---------|-------------|
|
|
371
|
+
| `worktreePath` | string | `$REPO-worktrees/$DIR` | Path template for new worktrees (relative to parent of main repo) |
|
|
372
|
+
| `copy` | string[] | `[]` | Glob patterns for files to copy from main worktree |
|
|
373
|
+
| `symlink` | string[] | `[]` | Glob patterns for files to symlink from main worktree |
|
|
374
|
+
| `postCreate` | string | `''` | Command to run after creating worktree |
|
|
375
|
+
|
|
376
|
+
### Template Variables
|
|
377
|
+
|
|
378
|
+
Use these variables in `worktreePath` and `postCreate`:
|
|
379
|
+
|
|
380
|
+
| Variable | Description | Example |
|
|
381
|
+
|----------|-------------|---------|
|
|
382
|
+
| `$REPO` | Repository name | `my-repo` |
|
|
383
|
+
| `$BRANCH` | Original branch name | `feature/auth` |
|
|
384
|
+
| `$DIR` | Directory-safe branch name (slashes → dashes) | `feature-auth` |
|
|
385
|
+
| `$PATH` | Full worktree path | `/path/to/my-repo-worktrees/feature-auth` |
|
|
386
|
+
|
|
387
|
+
### Glob Patterns
|
|
388
|
+
|
|
389
|
+
Copy and symlink patterns use gitignore-style globs:
|
|
390
|
+
|
|
391
|
+
- `.env` - single file
|
|
392
|
+
- `.idea/**` - entire directory
|
|
393
|
+
- `!.idea/workspace.xml` - exclude specific file
|
|
394
|
+
- `*.config.js` - wildcard matching
|
|
395
|
+
|
|
396
|
+
### Post-Create Command
|
|
397
|
+
|
|
398
|
+
The `postCreate` string runs via `sh -c` in the new worktree directory. Use shell syntax for chaining:
|
|
399
|
+
|
|
400
|
+
```javascript
|
|
401
|
+
export default {
|
|
402
|
+
postCreate: 'npm install && code $PATH',
|
|
403
|
+
}
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
### View Current Config
|
|
407
|
+
|
|
408
|
+
```bash
|
|
409
|
+
wt config
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
Shows the active configuration with resolved paths.
|
|
413
|
+
|
|
263
414
|
## GitHub Integration
|
|
264
415
|
|
|
265
416
|
This tool integrates with GitHub to provide rich PR information:
|
|
@@ -295,11 +446,15 @@ Here's a typical workflow using these tools:
|
|
|
295
446
|
|
|
296
447
|
```bash
|
|
297
448
|
# Create a new worktree for a feature
|
|
298
|
-
wt feature/add-auth
|
|
449
|
+
wt new feature/add-auth
|
|
299
450
|
|
|
300
|
-
# Navigate to the worktree
|
|
451
|
+
# Navigate to the worktree (path copied to clipboard)
|
|
301
452
|
cd ../my-repo-worktrees/feature-add-auth
|
|
302
453
|
|
|
454
|
+
# Or use wt path to get the path
|
|
455
|
+
wt path auth
|
|
456
|
+
# ✓ Copied to clipboard: /path/to/repo-worktrees/feature-add-auth
|
|
457
|
+
|
|
303
458
|
# Work on your feature...
|
|
304
459
|
git add .
|
|
305
460
|
git commit -m "Add authentication"
|
|
@@ -308,6 +463,11 @@ git push -u origin feature/add-auth
|
|
|
308
463
|
# Create PR via gh CLI
|
|
309
464
|
gh pr create --title "Add authentication" --body "Implements user auth"
|
|
310
465
|
|
|
466
|
+
# Check status of current worktree
|
|
467
|
+
wt status
|
|
468
|
+
# feature/add-auth (↑1 ↓0)
|
|
469
|
+
# PR #42 open - ✓ checks passing
|
|
470
|
+
|
|
311
471
|
# Check status of all worktrees
|
|
312
472
|
wt list
|
|
313
473
|
# Shows: feature-add-auth (open)
|
|
@@ -317,25 +477,53 @@ wt clean
|
|
|
317
477
|
# Removes merged worktree and deletes branch
|
|
318
478
|
```
|
|
319
479
|
|
|
480
|
+
## Installation
|
|
481
|
+
|
|
482
|
+
### Via bun
|
|
483
|
+
|
|
484
|
+
```bash
|
|
485
|
+
bun install -g wt-manager
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
### Standalone Binaries
|
|
489
|
+
|
|
490
|
+
Download pre-built binaries from [GitHub Releases](https://github.com/daviddurika/git-worktree-manager/releases):
|
|
491
|
+
|
|
492
|
+
| Platform | Binary |
|
|
493
|
+
|----------|--------|
|
|
494
|
+
| macOS ARM64 (M1/M2) | `wt-darwin-arm64` |
|
|
495
|
+
| macOS x64 (Intel) | `wt-darwin-x64` |
|
|
496
|
+
| Linux x64 | `wt-linux-x64` |
|
|
497
|
+
| Linux ARM64 | `wt-linux-arm64` |
|
|
498
|
+
| Windows x64 | `wt-windows-x64.exe` |
|
|
499
|
+
|
|
500
|
+
```bash
|
|
501
|
+
# Example: macOS ARM64
|
|
502
|
+
curl -L https://github.com/daviddurika/git-worktree-manager/releases/latest/download/wt-darwin-arm64 -o ~/.local/bin/wt
|
|
503
|
+
chmod +x ~/.local/bin/wt
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
Make sure `~/.local/bin` is in your PATH.
|
|
507
|
+
|
|
320
508
|
## Development
|
|
321
509
|
|
|
322
510
|
### Build
|
|
323
511
|
|
|
324
512
|
```bash
|
|
325
|
-
|
|
513
|
+
bun run build
|
|
326
514
|
```
|
|
327
515
|
|
|
328
516
|
### Watch Mode
|
|
329
517
|
|
|
330
518
|
```bash
|
|
331
|
-
|
|
519
|
+
bun run dev
|
|
332
520
|
```
|
|
333
521
|
|
|
334
522
|
### Linting
|
|
335
523
|
|
|
336
524
|
```bash
|
|
337
|
-
|
|
338
|
-
|
|
525
|
+
bun run lint
|
|
526
|
+
bun run format
|
|
339
527
|
```
|
|
340
528
|
|
|
341
529
|
## License
|