@kianax/wt 0.1.4 → 0.1.6
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/LICENSE +21 -0
- package/README.md +72 -19
- package/dist/cli.js +725 -197
- package/package.json +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Kiana
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,57 +1,102 @@
|
|
|
1
1
|
# wt - Git Worktree Manager
|
|
2
2
|
|
|
3
|
-
A fast,
|
|
3
|
+
A fast, interactive TUI for managing git worktrees. Makes worktrees as effortless as branches.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
# npm
|
|
9
8
|
npm install -g @kianax/wt
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or build from source (requires [Bun](https://bun.sh)):
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
```bash
|
|
12
14
|
bun install && bun run build
|
|
13
15
|
cp wt /usr/local/bin/
|
|
14
16
|
```
|
|
15
17
|
|
|
16
|
-
##
|
|
18
|
+
## Shell Integration
|
|
19
|
+
|
|
20
|
+
Shell integration enables `wt` to change your working directory when selecting a worktree. Without it, selections just print the path.
|
|
17
21
|
|
|
18
|
-
|
|
22
|
+
**Bash/Zsh** - add to `~/.bashrc` or `~/.zshrc`:
|
|
19
23
|
|
|
20
24
|
```bash
|
|
21
25
|
eval "$(wt shell-init bash)" # or zsh
|
|
22
26
|
```
|
|
23
27
|
|
|
24
|
-
|
|
28
|
+
**Fish** - add to `~/.config/fish/config.fish`:
|
|
25
29
|
|
|
26
30
|
```fish
|
|
27
31
|
wt shell-init fish | source
|
|
28
32
|
```
|
|
29
33
|
|
|
34
|
+
The TUI will prompt you to set this up on first run.
|
|
35
|
+
|
|
30
36
|
## Usage
|
|
31
37
|
|
|
32
38
|
```bash
|
|
33
|
-
wt
|
|
34
|
-
wt new
|
|
35
|
-
wt cd
|
|
36
|
-
wt rm
|
|
37
|
-
wt
|
|
38
|
-
wt
|
|
39
|
+
wt # Open interactive TUI
|
|
40
|
+
wt new <name> # Create new worktree
|
|
41
|
+
wt cd <name> # Switch to worktree (requires shell integration)
|
|
42
|
+
wt rm <name> # Remove worktree
|
|
43
|
+
wt mv <old> <new> # Rename worktree
|
|
44
|
+
wt ls # List all worktrees
|
|
45
|
+
wt current # Show current worktree name
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Command Options
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Create with options
|
|
52
|
+
wt new feature --base main # Branch from specific base
|
|
53
|
+
wt new feature --branch feat/foo # Custom branch name
|
|
54
|
+
wt new feature --detach # Detached HEAD (no branch)
|
|
55
|
+
|
|
56
|
+
# Remove with options
|
|
57
|
+
wt rm feature --force # Force remove even if dirty
|
|
58
|
+
wt rm feature --delete-branch # Also delete the branch
|
|
59
|
+
|
|
60
|
+
# List with options
|
|
61
|
+
wt ls --json # JSON output
|
|
62
|
+
wt ls --porcelain # Machine-readable format
|
|
63
|
+
|
|
64
|
+
# Current worktree info
|
|
65
|
+
wt current --path # Full path
|
|
66
|
+
wt current --branch # Branch name
|
|
39
67
|
```
|
|
40
68
|
|
|
41
|
-
|
|
69
|
+
## TUI Keybindings
|
|
42
70
|
|
|
43
71
|
| Key | Action |
|
|
44
72
|
|-----|--------|
|
|
45
|
-
| `j/k` or
|
|
46
|
-
| `Enter` |
|
|
73
|
+
| `j/k` or `↑/↓` | Navigate |
|
|
74
|
+
| `Enter` | Select worktree |
|
|
47
75
|
| `n` | New worktree |
|
|
48
76
|
| `d` | Delete worktree |
|
|
49
77
|
| `r` | Rename worktree |
|
|
78
|
+
| `i` | Show details |
|
|
50
79
|
| `q` | Quit |
|
|
51
80
|
|
|
81
|
+
## Status Indicators
|
|
82
|
+
|
|
83
|
+
The TUI shows status for each worktree:
|
|
84
|
+
|
|
85
|
+
| Status | Meaning |
|
|
86
|
+
|--------|---------|
|
|
87
|
+
| `dirty` | Uncommitted changes |
|
|
88
|
+
| `ahead` | Commits to push |
|
|
89
|
+
| `behind` | Commits to pull |
|
|
90
|
+
| `diverged` | Both ahead and behind |
|
|
91
|
+
| `synced` | Clean and up-to-date |
|
|
92
|
+
| `merged` | Branch merged, can be cleaned up |
|
|
93
|
+
| `stale` | No commits in 30+ days |
|
|
94
|
+
|
|
95
|
+
Sync indicators show commit counts: `+3` (ahead) `-2` (behind)
|
|
96
|
+
|
|
52
97
|
## How It Works
|
|
53
98
|
|
|
54
|
-
Worktrees are stored in `~/.worktrees/<repo-id>/` by default
|
|
99
|
+
Worktrees are stored in `~/.worktrees/<repo-id>/` by default:
|
|
55
100
|
|
|
56
101
|
```
|
|
57
102
|
~/.worktrees/
|
|
@@ -60,19 +105,27 @@ Worktrees are stored in `~/.worktrees/<repo-id>/` by default. Each worktree gets
|
|
|
60
105
|
bugfix-login/
|
|
61
106
|
```
|
|
62
107
|
|
|
108
|
+
The repo ID is derived from your git remote URL (e.g., `github.com-user-repo`).
|
|
109
|
+
|
|
63
110
|
## Configuration
|
|
64
111
|
|
|
65
|
-
|
|
112
|
+
All configuration is in `~/.config/wt/config.json`:
|
|
66
113
|
|
|
67
114
|
```json
|
|
68
115
|
{
|
|
69
116
|
"defaults": {
|
|
70
|
-
"branchPrefix": "feature/"
|
|
117
|
+
"branchPrefix": "feature/",
|
|
118
|
+
"staleDays": 30
|
|
119
|
+
},
|
|
120
|
+
"repos": {
|
|
121
|
+
"github.com-user-repo": {
|
|
122
|
+
"branchPrefix": "feat/"
|
|
123
|
+
}
|
|
71
124
|
}
|
|
72
125
|
}
|
|
73
126
|
```
|
|
74
127
|
|
|
75
|
-
|
|
128
|
+
Use `repos` to override settings for specific repositories (keyed by repo ID).
|
|
76
129
|
|
|
77
130
|
## License
|
|
78
131
|
|