gitwm 0.1.1 → 0.2.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 +185 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
# WM - Git Worktree Manager
|
|
2
|
+
|
|
3
|
+
A CLI tool that makes git worktree easier to use with file sync and background tasks.
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Interactive UI** - Arrow key selection for add/remove operations
|
|
10
|
+
- **Origin branch detection** - Automatically fetch from remote when branch exists on origin
|
|
11
|
+
- **File sync** - Copy or symlink files (`.env`, configs) to worktrees
|
|
12
|
+
- **Post-install tasks** - Run commands after worktree creation (background supported)
|
|
13
|
+
- **Pretty output** - Colored output with spinners and styled tables
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
### npm / npx
|
|
18
|
+
```bash
|
|
19
|
+
# Run directly
|
|
20
|
+
npx gitwm --help
|
|
21
|
+
|
|
22
|
+
# Or install globally
|
|
23
|
+
npm install -g gitwm
|
|
24
|
+
wm --help
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Go
|
|
28
|
+
```bash
|
|
29
|
+
go install github.com/Devdha/wm@latest
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Binary
|
|
33
|
+
Download from [GitHub Releases](https://github.com/Devdha/wm/releases)
|
|
34
|
+
|
|
35
|
+
## Quick Start
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# Initialize in your project
|
|
39
|
+
wm init
|
|
40
|
+
|
|
41
|
+
# Create a worktree (interactive mode)
|
|
42
|
+
wm add
|
|
43
|
+
|
|
44
|
+
# Or specify branch directly
|
|
45
|
+
wm add feature-login
|
|
46
|
+
|
|
47
|
+
# List all worktrees
|
|
48
|
+
wm list
|
|
49
|
+
|
|
50
|
+
# Remove a worktree (interactive mode)
|
|
51
|
+
wm remove
|
|
52
|
+
|
|
53
|
+
# Or specify path/branch
|
|
54
|
+
wm remove feature-login
|
|
55
|
+
|
|
56
|
+
# Remove worktree and delete branch
|
|
57
|
+
wm remove -b feature-login
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Interactive Mode
|
|
61
|
+
|
|
62
|
+
### `wm add` (no arguments)
|
|
63
|
+
|
|
64
|
+
Select from origin branches or type a new branch name:
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
? Enter branch name or select from origin:
|
|
68
|
+
[ ] ← Type here or press ↓
|
|
69
|
+
─────────────────────
|
|
70
|
+
❯ origin/feature-auth
|
|
71
|
+
origin/bugfix-123
|
|
72
|
+
origin/develop
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
- **Tab**: Switch between input and selection
|
|
76
|
+
- **↑↓**: Navigate options
|
|
77
|
+
- **Enter**: Confirm
|
|
78
|
+
|
|
79
|
+
### `wm remove` (no arguments)
|
|
80
|
+
|
|
81
|
+
Select a worktree to remove:
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
? Select worktree to remove:
|
|
85
|
+
❯ ../wm_repo/feature-auth (feature-auth)
|
|
86
|
+
../wm_repo/bugfix-123 (bugfix-123)
|
|
87
|
+
../wm_repo/main (main) [main]
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Origin Branch Detection
|
|
91
|
+
|
|
92
|
+
When you run `wm add feature-auth` and the branch exists on origin:
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
⚡ Creating worktree for 'feature-auth'...
|
|
96
|
+
|
|
97
|
+
Branch 'feature-auth' exists on origin but not locally.
|
|
98
|
+
? Checkout from origin? (Y/n)
|
|
99
|
+
|
|
100
|
+
📦 Fetching origin/feature-auth...
|
|
101
|
+
✓ Worktree ready: ../wm_repo/feature-auth
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Configuration
|
|
105
|
+
|
|
106
|
+
WM uses a `.wm.yaml` file in your project root:
|
|
107
|
+
|
|
108
|
+
```yaml
|
|
109
|
+
version: 1
|
|
110
|
+
|
|
111
|
+
worktree:
|
|
112
|
+
base_dir: "../wm_{repo}" # {repo} is replaced with repo name
|
|
113
|
+
|
|
114
|
+
sync:
|
|
115
|
+
- ".env" # Copy .env to worktree
|
|
116
|
+
- "apps/*/.env" # Glob patterns supported
|
|
117
|
+
- src: ".env.example"
|
|
118
|
+
dst: ".env"
|
|
119
|
+
mode: copy # or "symlink"
|
|
120
|
+
when: missing # or "always"
|
|
121
|
+
|
|
122
|
+
tasks:
|
|
123
|
+
post_install:
|
|
124
|
+
mode: background # Run async
|
|
125
|
+
commands:
|
|
126
|
+
- "pnpm install"
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Commands
|
|
130
|
+
|
|
131
|
+
### `wm init`
|
|
132
|
+
|
|
133
|
+
Interactive setup to create `.wm.yaml`.
|
|
134
|
+
|
|
135
|
+
### `wm add [branch]`
|
|
136
|
+
|
|
137
|
+
Create a new worktree.
|
|
138
|
+
|
|
139
|
+
- Without arguments: Interactive mode (select from origin or type new name)
|
|
140
|
+
- With branch: Create worktree for that branch
|
|
141
|
+
- If branch exists on origin but not locally: Prompts to fetch
|
|
142
|
+
|
|
143
|
+
Options:
|
|
144
|
+
- `--path, -p`: Custom worktree path
|
|
145
|
+
|
|
146
|
+
**Note**: Branch names with slashes (e.g., `feature/auth`) create flat folders (`feature-auth`), not nested directories.
|
|
147
|
+
|
|
148
|
+
### `wm list`
|
|
149
|
+
|
|
150
|
+
List all worktrees in a styled table.
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
┌────────────────────────────┬────────────────┬─────────┐
|
|
154
|
+
│ PATH │ BRANCH │ HEAD │
|
|
155
|
+
├────────────────────────────┼────────────────┼─────────┤
|
|
156
|
+
│ ../wm_repo/feature-auth │ feature-auth │ a1b2c3d │
|
|
157
|
+
│ ../wm_repo/main │ main │ d4e5f6g │
|
|
158
|
+
└────────────────────────────┴────────────────┴─────────┘
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### `wm remove [path]`
|
|
162
|
+
|
|
163
|
+
Remove a worktree.
|
|
164
|
+
|
|
165
|
+
- Without arguments: Interactive mode (select from list)
|
|
166
|
+
- With path or branch name: Remove that worktree
|
|
167
|
+
|
|
168
|
+
Options:
|
|
169
|
+
- `-f, --force`: Skip confirmation
|
|
170
|
+
- `-b, --branch`: Also delete the branch
|
|
171
|
+
|
|
172
|
+
## Claude Code Skill
|
|
173
|
+
|
|
174
|
+
A skill for Claude Code users is included:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
# Copy skill (Claude Code users)
|
|
178
|
+
cp -r skills/wm ~/.claude/skills/
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Or copy to your project's `.claude/skills/` for project-specific use.
|
|
182
|
+
|
|
183
|
+
## License
|
|
184
|
+
|
|
185
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"gitwm","version":"0.
|
|
1
|
+
{"name":"gitwm","version":"0.2.1","description":"git worktree manager","license":"MIT","bin":{"wm":"bin/wm"},"files":["bin","README.md"],"optionalDependencies":{"gitwm-darwin-arm64":"0.2.1","gitwm-darwin-x64":"0.2.1","gitwm-linux-arm64":"0.2.1","gitwm-linux-x64":"0.2.1","gitwm-win32-x64":"0.2.1"}}
|