@caddis/cli 0.4.57 → 0.4.59
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/bundles/antigravity-plugin/caddis_statusline.py +45 -11
- package/bundles/antigravity-plugin/plugin.json +1 -1
- package/bundles/antigravity-plugin/scripts/caddis_adhoc.py +69 -23
- package/bundles/antigravity-plugin/scripts/caddis_docs_pr.py +9 -8
- package/bundles/antigravity-plugin/scripts/caddis_lanes.py +4 -2
- package/bundles/antigravity-plugin/scripts/caddis_review.py +22 -2
- package/bundles/antigravity-plugin/scripts/caddis_roadmap.py +14 -8
- package/bundles/antigravity-plugin/scripts/caddis_roadmap_run.py +26 -9
- package/bundles/antigravity-plugin/scripts/caddis_spawn.py +24 -4
- package/bundles/antigravity-plugin/scripts/caddis_spend.py +120 -10
- package/bundles/antigravity-plugin/scripts/caddis_statusline.py +45 -11
- package/bundles/antigravity-plugin/scripts/caddis_worktree_close.py +14 -9
- package/bundles/antigravity-plugin/scripts/caddis_worktree_safety.py +12 -0
- package/bundles/antigravity-plugin/scripts/hook_log.py +13 -2
- package/bundles/antigravity-plugin/scripts/secret_filter.py +6 -2
- package/bundles/antigravity-plugin/scripts/setup_project_ai.py +16 -6
- package/bundles/antigravity-plugin/skills/mmr/SKILL.md +3 -0
- package/bundles/antigravity-plugin/skills/spawn-session/SKILL.md +3 -2
- package/bundles/antigravity-plugin/skills/using-git-worktrees/SKILL.md +52 -175
- package/bundles/codex/.codex/skills/devops/using-git-worktrees/SKILL.md +52 -175
- package/bundles/manifest.json +2 -2
- package/dist/cli.js +310 -46
- package/package.json +1 -1
|
@@ -5,213 +5,90 @@ description: "Use when starting feature work that needs isolation from the curre
|
|
|
5
5
|
|
|
6
6
|
# Using Git Worktrees
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
A worktree gives one branch its own folder. It shares the repository with the main checkout.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
**Branch in place by default.** Run `git switch -c <branch>`. Never create a sibling repository folder.
|
|
11
|
+
Use a worktree only when the checkout is not safe to move.
|
|
11
12
|
|
|
12
|
-
**
|
|
13
|
+
**Announce at start:** "I am using the using-git-worktrees skill to set up an isolated workspace."
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
## When to use a worktree
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
Use a worktree when any of these is true:
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
1. The repo `AGENTS.md` says `Shared checkout: yes` (a dev service serves from it) and your change touches
|
|
20
|
+
served code. A change to `.caddis/` or `docs/` only may use a branch.
|
|
21
|
+
2. Another session or agent may be live in the checkout, or you cannot tell. Codex and agy cannot detect
|
|
22
|
+
peers. For them, "cannot tell" means not safe.
|
|
23
|
+
3. `git status` shows changes you did not make. Never stash, commit, reset or carry them.
|
|
24
|
+
4. Two or more agents edit at the same time. Each editing agent gets its own worktree. The orchestrator
|
|
25
|
+
creates and removes them. Read-only subagents share the checkout and never move HEAD.
|
|
19
26
|
|
|
20
|
-
|
|
27
|
+
If none is true, stop here and use `git switch -c`.
|
|
21
28
|
|
|
22
|
-
|
|
23
|
-
# Check in priority order
|
|
24
|
-
ls -d .worktrees 2>/dev/null # Preferred (hidden)
|
|
25
|
-
ls -d worktrees 2>/dev/null # Alternative
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
**If found:** Use that directory. If both exist, `.worktrees` wins.
|
|
29
|
+
## Create the worktree
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
1. Fetch: `git fetch origin`.
|
|
32
|
+
2. Find the default branch (`main` in most repos): `git symbolic-ref --short refs/remotes/origin/HEAD`.
|
|
33
|
+
It prints `origin/main`. Use the part after `origin/` as `<default>`.
|
|
34
|
+
3. Create the worktree from `origin/<default>`, never from the local HEAD, under `%TEMP%`:
|
|
31
35
|
|
|
32
|
-
```
|
|
33
|
-
|
|
36
|
+
```powershell
|
|
37
|
+
git worktree add -b <branch> "$env:TEMP\<repo>-<short-name>" origin/<default>
|
|
34
38
|
```
|
|
35
39
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
### 3. Ask User
|
|
39
|
-
|
|
40
|
-
If no directory exists and no AGENTS.md preference:
|
|
41
|
-
|
|
42
|
-
```
|
|
43
|
-
No worktree directory found. Where should I create worktrees?
|
|
40
|
+
Do not create worktrees inside the repo (no `.worktrees/`).
|
|
41
|
+
4. State the full path of the worktree. Work only there, and do not switch branches in it.
|
|
44
42
|
|
|
45
|
-
|
|
46
|
-
2. ~/.config/superpowers/worktrees/<project-name>/ (global location)
|
|
43
|
+
## Install dependencies fresh
|
|
47
44
|
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
Install inside the worktree. Use the project's own command (`npm ci`, `python -m venv .venv` then
|
|
46
|
+
`.venv\Scripts\python -m pip install -r requirements.txt`, `cargo build`, `go mod download`). Call the
|
|
47
|
+
venv's own `python`; a bare `pip` can install into the global Python.
|
|
50
48
|
|
|
51
|
-
|
|
49
|
+
Never link `node_modules` or a venv from another folder. Tools that follow the link then change the
|
|
50
|
+
shared copy, and a careless delete can follow it too.
|
|
52
51
|
|
|
53
|
-
|
|
52
|
+
## Verify a clean baseline
|
|
54
53
|
|
|
55
|
-
|
|
54
|
+
Run the project tests. If they fail, report the failures and ask before you go on. Then report:
|
|
56
55
|
|
|
57
|
-
```bash
|
|
58
|
-
# Check if directory is ignored (respects local, global, and system gitignore)
|
|
59
|
-
git check-ignore -q .worktrees 2>/dev/null || git check-ignore -q worktrees 2>/dev/null
|
|
60
56
|
```
|
|
61
|
-
|
|
62
|
-
**If NOT ignored:**
|
|
63
|
-
|
|
64
|
-
Per Jesse's rule "Fix broken things immediately":
|
|
65
|
-
1. Add appropriate line to .gitignore
|
|
66
|
-
2. Commit the change
|
|
67
|
-
3. Proceed with worktree creation
|
|
68
|
-
|
|
69
|
-
**Why critical:** Prevents accidentally committing worktree contents to repository.
|
|
70
|
-
|
|
71
|
-
### For Global Directory (~/.config/superpowers/worktrees)
|
|
72
|
-
|
|
73
|
-
No .gitignore verification needed - outside project entirely.
|
|
74
|
-
|
|
75
|
-
## Creation Steps
|
|
76
|
-
|
|
77
|
-
### 1. Detect Project Name
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
project=$(basename "$(git rev-parse --show-toplevel)")
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
### 2. Create Worktree
|
|
84
|
-
|
|
85
|
-
```bash
|
|
86
|
-
# Determine full path
|
|
87
|
-
case $LOCATION in
|
|
88
|
-
.worktrees|worktrees)
|
|
89
|
-
path="$LOCATION/$BRANCH_NAME"
|
|
90
|
-
;;
|
|
91
|
-
~/.config/superpowers/worktrees/*)
|
|
92
|
-
path="~/.config/superpowers/worktrees/$project/$BRANCH_NAME"
|
|
93
|
-
;;
|
|
94
|
-
esac
|
|
95
|
-
|
|
96
|
-
# Create worktree with new branch
|
|
97
|
-
git worktree add "$path" -b "$BRANCH_NAME"
|
|
98
|
-
cd "$path"
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
### 3. Run Project Setup
|
|
102
|
-
|
|
103
|
-
Auto-detect and run appropriate setup:
|
|
104
|
-
|
|
105
|
-
```bash
|
|
106
|
-
# Node.js
|
|
107
|
-
if [ -f package.json ]; then npm install; fi
|
|
108
|
-
|
|
109
|
-
# Rust
|
|
110
|
-
if [ -f Cargo.toml ]; then cargo build; fi
|
|
111
|
-
|
|
112
|
-
# Python
|
|
113
|
-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
|
114
|
-
if [ -f pyproject.toml ]; then poetry install; fi
|
|
115
|
-
|
|
116
|
-
# Go
|
|
117
|
-
if [ -f go.mod ]; then go mod download; fi
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
### 4. Verify Clean Baseline
|
|
121
|
-
|
|
122
|
-
Run tests to ensure worktree starts clean:
|
|
123
|
-
|
|
124
|
-
```bash
|
|
125
|
-
# Examples - use project-appropriate command
|
|
126
|
-
npm test
|
|
127
|
-
cargo test
|
|
128
|
-
pytest
|
|
129
|
-
go test ./...
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
**If tests fail:** Report failures, ask whether to proceed or investigate.
|
|
133
|
-
|
|
134
|
-
**If tests pass:** Report ready.
|
|
135
|
-
|
|
136
|
-
### 5. Report Location
|
|
137
|
-
|
|
138
|
-
```
|
|
139
|
-
Worktree ready at <full-path>
|
|
57
|
+
Worktree ready at <full-path> (branch <branch>, from origin/<default>)
|
|
140
58
|
Tests passing (<N> tests, 0 failures)
|
|
141
|
-
Ready to implement <feature-name>
|
|
142
59
|
```
|
|
143
60
|
|
|
144
|
-
##
|
|
61
|
+
## Remove it when done
|
|
145
62
|
|
|
146
|
-
|
|
147
|
-
|-----------|--------|
|
|
148
|
-
| `.worktrees/` exists | Use it (verify ignored) |
|
|
149
|
-
| `worktrees/` exists | Use it (verify ignored) |
|
|
150
|
-
| Both exist | Use `.worktrees/` |
|
|
151
|
-
| Neither exists | Check AGENTS.md → Ask user |
|
|
152
|
-
| Directory not ignored | Add to .gitignore + commit |
|
|
153
|
-
| Tests fail during baseline | Report failures + ask |
|
|
154
|
-
| No package.json/Cargo.toml | Skip dependency install |
|
|
63
|
+
A worktree you create is yours to remove. Do it when the PR merges or the work stops. Remove all three:
|
|
155
64
|
|
|
156
|
-
|
|
65
|
+
1. The worktree.
|
|
66
|
+
2. The local branch.
|
|
67
|
+
3. The remote branch, but only when its work is merged, or the owner says it is abandoned. If the work
|
|
68
|
+
only paused, keep the remote branch: it can be the only copy.
|
|
157
69
|
|
|
158
|
-
|
|
70
|
+
After a squash merge, compare trees (content), not ancestry, before you delete.
|
|
159
71
|
|
|
160
|
-
-
|
|
161
|
-
|
|
72
|
+
Do not delete a worktree folder by hand or with `rm -rf`: on Windows it can follow a junction into
|
|
73
|
+
another folder. Use the `safe-cleanup` skill, or `scripts/caddis_worktree_close.py` after a merged PR.
|
|
162
74
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
- **Problem:** Creates inconsistency, violates project conventions
|
|
166
|
-
- **Fix:** Follow priority: existing > AGENTS.md > ask
|
|
167
|
-
|
|
168
|
-
### Proceeding with failing tests
|
|
169
|
-
|
|
170
|
-
- **Problem:** Can't distinguish new bugs from pre-existing issues
|
|
171
|
-
- **Fix:** Report failures, get explicit permission to proceed
|
|
172
|
-
|
|
173
|
-
### Hardcoding setup commands
|
|
174
|
-
|
|
175
|
-
- **Problem:** Breaks on projects using different tools
|
|
176
|
-
- **Fix:** Auto-detect from project files (package.json, etc.)
|
|
177
|
-
|
|
178
|
-
## Example Workflow
|
|
179
|
-
|
|
180
|
-
```
|
|
181
|
-
You: I'm using the using-git-worktrees skill to set up an isolated workspace.
|
|
182
|
-
|
|
183
|
-
[Check .worktrees/ - exists]
|
|
184
|
-
[Verify ignored - git check-ignore confirms .worktrees/ is ignored]
|
|
185
|
-
[Create worktree: git worktree add .worktrees/auth -b feature/auth]
|
|
186
|
-
[Run npm install]
|
|
187
|
-
[Run npm test - 47 passing]
|
|
188
|
-
|
|
189
|
-
Worktree ready at /Users/jesse/myproject/.worktrees/auth
|
|
190
|
-
Tests passing (47 tests, 0 failures)
|
|
191
|
-
Ready to implement auth feature
|
|
192
|
-
```
|
|
75
|
+
Check for leftovers with `git worktree list`.
|
|
193
76
|
|
|
194
|
-
## Red
|
|
77
|
+
## Red flags
|
|
195
78
|
|
|
196
79
|
**Never:**
|
|
197
|
-
- Create worktree
|
|
198
|
-
-
|
|
199
|
-
-
|
|
200
|
-
-
|
|
201
|
-
-
|
|
202
|
-
|
|
203
|
-
**Always:**
|
|
204
|
-
- Follow directory priority: existing > AGENTS.md > ask
|
|
205
|
-
- Verify directory is ignored for project-local
|
|
206
|
-
- Auto-detect and run project setup
|
|
207
|
-
- Verify clean test baseline
|
|
80
|
+
- Create a worktree from the local HEAD or a stale branch.
|
|
81
|
+
- Put a worktree in the repo folder or in a sibling of the repo.
|
|
82
|
+
- Link `node_modules` or a venv into a worktree.
|
|
83
|
+
- Leave a worktree, local branch or merged remote branch behind after the work ends.
|
|
84
|
+
- Use a worktree when `git switch -c` is safe.
|
|
208
85
|
|
|
209
86
|
## Integration
|
|
210
87
|
|
|
211
88
|
**Called by:**
|
|
212
|
-
- **brainstorming** (Phase 4) -
|
|
213
|
-
- Any skill
|
|
89
|
+
- **brainstorming** (Phase 4) - when the design is approved and implementation follows
|
|
90
|
+
- Any skill that needs an isolated workspace
|
|
214
91
|
|
|
215
92
|
**Pairs with:**
|
|
216
|
-
- **finishing-a-development-branch** -
|
|
217
|
-
- **executing-plans** or **subagent-driven-development** -
|
|
93
|
+
- **finishing-a-development-branch** - cleanup after the work is complete
|
|
94
|
+
- **executing-plans** or **subagent-driven-development** - the work happens in this worktree
|
|
@@ -5,213 +5,90 @@ description: "Use when starting feature work that needs isolation from the curre
|
|
|
5
5
|
|
|
6
6
|
# Using Git Worktrees
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
A worktree gives one branch its own folder. It shares the repository with the main checkout.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
**Branch in place by default.** Run `git switch -c <branch>`. Never create a sibling repository folder.
|
|
11
|
+
Use a worktree only when the checkout is not safe to move.
|
|
11
12
|
|
|
12
|
-
**
|
|
13
|
+
**Announce at start:** "I am using the using-git-worktrees skill to set up an isolated workspace."
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
## When to use a worktree
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
Use a worktree when any of these is true:
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
1. The repo `AGENTS.md` says `Shared checkout: yes` (a dev service serves from it) and your change touches
|
|
20
|
+
served code. A change to `.caddis/` or `docs/` only may use a branch.
|
|
21
|
+
2. Another session or agent may be live in the checkout, or you cannot tell. Codex and agy cannot detect
|
|
22
|
+
peers. For them, "cannot tell" means not safe.
|
|
23
|
+
3. `git status` shows changes you did not make. Never stash, commit, reset or carry them.
|
|
24
|
+
4. Two or more agents edit at the same time. Each editing agent gets its own worktree. The orchestrator
|
|
25
|
+
creates and removes them. Read-only subagents share the checkout and never move HEAD.
|
|
19
26
|
|
|
20
|
-
|
|
27
|
+
If none is true, stop here and use `git switch -c`.
|
|
21
28
|
|
|
22
|
-
|
|
23
|
-
# Check in priority order
|
|
24
|
-
ls -d .worktrees 2>/dev/null # Preferred (hidden)
|
|
25
|
-
ls -d worktrees 2>/dev/null # Alternative
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
**If found:** Use that directory. If both exist, `.worktrees` wins.
|
|
29
|
+
## Create the worktree
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
1. Fetch: `git fetch origin`.
|
|
32
|
+
2. Find the default branch (`main` in most repos): `git symbolic-ref --short refs/remotes/origin/HEAD`.
|
|
33
|
+
It prints `origin/main`. Use the part after `origin/` as `<default>`.
|
|
34
|
+
3. Create the worktree from `origin/<default>`, never from the local HEAD, under `%TEMP%`:
|
|
31
35
|
|
|
32
|
-
```
|
|
33
|
-
|
|
36
|
+
```powershell
|
|
37
|
+
git worktree add -b <branch> "$env:TEMP\<repo>-<short-name>" origin/<default>
|
|
34
38
|
```
|
|
35
39
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
### 3. Ask User
|
|
39
|
-
|
|
40
|
-
If no directory exists and no AGENTS.md preference:
|
|
41
|
-
|
|
42
|
-
```
|
|
43
|
-
No worktree directory found. Where should I create worktrees?
|
|
40
|
+
Do not create worktrees inside the repo (no `.worktrees/`).
|
|
41
|
+
4. State the full path of the worktree. Work only there, and do not switch branches in it.
|
|
44
42
|
|
|
45
|
-
|
|
46
|
-
2. ~/.config/superpowers/worktrees/<project-name>/ (global location)
|
|
43
|
+
## Install dependencies fresh
|
|
47
44
|
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
Install inside the worktree. Use the project's own command (`npm ci`, `python -m venv .venv` then
|
|
46
|
+
`.venv\Scripts\python -m pip install -r requirements.txt`, `cargo build`, `go mod download`). Call the
|
|
47
|
+
venv's own `python`; a bare `pip` can install into the global Python.
|
|
50
48
|
|
|
51
|
-
|
|
49
|
+
Never link `node_modules` or a venv from another folder. Tools that follow the link then change the
|
|
50
|
+
shared copy, and a careless delete can follow it too.
|
|
52
51
|
|
|
53
|
-
|
|
52
|
+
## Verify a clean baseline
|
|
54
53
|
|
|
55
|
-
|
|
54
|
+
Run the project tests. If they fail, report the failures and ask before you go on. Then report:
|
|
56
55
|
|
|
57
|
-
```bash
|
|
58
|
-
# Check if directory is ignored (respects local, global, and system gitignore)
|
|
59
|
-
git check-ignore -q .worktrees 2>/dev/null || git check-ignore -q worktrees 2>/dev/null
|
|
60
56
|
```
|
|
61
|
-
|
|
62
|
-
**If NOT ignored:**
|
|
63
|
-
|
|
64
|
-
Per Jesse's rule "Fix broken things immediately":
|
|
65
|
-
1. Add appropriate line to .gitignore
|
|
66
|
-
2. Commit the change
|
|
67
|
-
3. Proceed with worktree creation
|
|
68
|
-
|
|
69
|
-
**Why critical:** Prevents accidentally committing worktree contents to repository.
|
|
70
|
-
|
|
71
|
-
### For Global Directory (~/.config/superpowers/worktrees)
|
|
72
|
-
|
|
73
|
-
No .gitignore verification needed - outside project entirely.
|
|
74
|
-
|
|
75
|
-
## Creation Steps
|
|
76
|
-
|
|
77
|
-
### 1. Detect Project Name
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
project=$(basename "$(git rev-parse --show-toplevel)")
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
### 2. Create Worktree
|
|
84
|
-
|
|
85
|
-
```bash
|
|
86
|
-
# Determine full path
|
|
87
|
-
case $LOCATION in
|
|
88
|
-
.worktrees|worktrees)
|
|
89
|
-
path="$LOCATION/$BRANCH_NAME"
|
|
90
|
-
;;
|
|
91
|
-
~/.config/superpowers/worktrees/*)
|
|
92
|
-
path="~/.config/superpowers/worktrees/$project/$BRANCH_NAME"
|
|
93
|
-
;;
|
|
94
|
-
esac
|
|
95
|
-
|
|
96
|
-
# Create worktree with new branch
|
|
97
|
-
git worktree add "$path" -b "$BRANCH_NAME"
|
|
98
|
-
cd "$path"
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
### 3. Run Project Setup
|
|
102
|
-
|
|
103
|
-
Auto-detect and run appropriate setup:
|
|
104
|
-
|
|
105
|
-
```bash
|
|
106
|
-
# Node.js
|
|
107
|
-
if [ -f package.json ]; then npm install; fi
|
|
108
|
-
|
|
109
|
-
# Rust
|
|
110
|
-
if [ -f Cargo.toml ]; then cargo build; fi
|
|
111
|
-
|
|
112
|
-
# Python
|
|
113
|
-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
|
114
|
-
if [ -f pyproject.toml ]; then poetry install; fi
|
|
115
|
-
|
|
116
|
-
# Go
|
|
117
|
-
if [ -f go.mod ]; then go mod download; fi
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
### 4. Verify Clean Baseline
|
|
121
|
-
|
|
122
|
-
Run tests to ensure worktree starts clean:
|
|
123
|
-
|
|
124
|
-
```bash
|
|
125
|
-
# Examples - use project-appropriate command
|
|
126
|
-
npm test
|
|
127
|
-
cargo test
|
|
128
|
-
pytest
|
|
129
|
-
go test ./...
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
**If tests fail:** Report failures, ask whether to proceed or investigate.
|
|
133
|
-
|
|
134
|
-
**If tests pass:** Report ready.
|
|
135
|
-
|
|
136
|
-
### 5. Report Location
|
|
137
|
-
|
|
138
|
-
```
|
|
139
|
-
Worktree ready at <full-path>
|
|
57
|
+
Worktree ready at <full-path> (branch <branch>, from origin/<default>)
|
|
140
58
|
Tests passing (<N> tests, 0 failures)
|
|
141
|
-
Ready to implement <feature-name>
|
|
142
59
|
```
|
|
143
60
|
|
|
144
|
-
##
|
|
61
|
+
## Remove it when done
|
|
145
62
|
|
|
146
|
-
|
|
147
|
-
|-----------|--------|
|
|
148
|
-
| `.worktrees/` exists | Use it (verify ignored) |
|
|
149
|
-
| `worktrees/` exists | Use it (verify ignored) |
|
|
150
|
-
| Both exist | Use `.worktrees/` |
|
|
151
|
-
| Neither exists | Check AGENTS.md → Ask user |
|
|
152
|
-
| Directory not ignored | Add to .gitignore + commit |
|
|
153
|
-
| Tests fail during baseline | Report failures + ask |
|
|
154
|
-
| No package.json/Cargo.toml | Skip dependency install |
|
|
63
|
+
A worktree you create is yours to remove. Do it when the PR merges or the work stops. Remove all three:
|
|
155
64
|
|
|
156
|
-
|
|
65
|
+
1. The worktree.
|
|
66
|
+
2. The local branch.
|
|
67
|
+
3. The remote branch, but only when its work is merged, or the owner says it is abandoned. If the work
|
|
68
|
+
only paused, keep the remote branch: it can be the only copy.
|
|
157
69
|
|
|
158
|
-
|
|
70
|
+
After a squash merge, compare trees (content), not ancestry, before you delete.
|
|
159
71
|
|
|
160
|
-
-
|
|
161
|
-
|
|
72
|
+
Do not delete a worktree folder by hand or with `rm -rf`: on Windows it can follow a junction into
|
|
73
|
+
another folder. Use the `safe-cleanup` skill, or `scripts/caddis_worktree_close.py` after a merged PR.
|
|
162
74
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
- **Problem:** Creates inconsistency, violates project conventions
|
|
166
|
-
- **Fix:** Follow priority: existing > AGENTS.md > ask
|
|
167
|
-
|
|
168
|
-
### Proceeding with failing tests
|
|
169
|
-
|
|
170
|
-
- **Problem:** Can't distinguish new bugs from pre-existing issues
|
|
171
|
-
- **Fix:** Report failures, get explicit permission to proceed
|
|
172
|
-
|
|
173
|
-
### Hardcoding setup commands
|
|
174
|
-
|
|
175
|
-
- **Problem:** Breaks on projects using different tools
|
|
176
|
-
- **Fix:** Auto-detect from project files (package.json, etc.)
|
|
177
|
-
|
|
178
|
-
## Example Workflow
|
|
179
|
-
|
|
180
|
-
```
|
|
181
|
-
You: I'm using the using-git-worktrees skill to set up an isolated workspace.
|
|
182
|
-
|
|
183
|
-
[Check .worktrees/ - exists]
|
|
184
|
-
[Verify ignored - git check-ignore confirms .worktrees/ is ignored]
|
|
185
|
-
[Create worktree: git worktree add .worktrees/auth -b feature/auth]
|
|
186
|
-
[Run npm install]
|
|
187
|
-
[Run npm test - 47 passing]
|
|
188
|
-
|
|
189
|
-
Worktree ready at /Users/jesse/myproject/.worktrees/auth
|
|
190
|
-
Tests passing (47 tests, 0 failures)
|
|
191
|
-
Ready to implement auth feature
|
|
192
|
-
```
|
|
75
|
+
Check for leftovers with `git worktree list`.
|
|
193
76
|
|
|
194
|
-
## Red
|
|
77
|
+
## Red flags
|
|
195
78
|
|
|
196
79
|
**Never:**
|
|
197
|
-
- Create worktree
|
|
198
|
-
-
|
|
199
|
-
-
|
|
200
|
-
-
|
|
201
|
-
-
|
|
202
|
-
|
|
203
|
-
**Always:**
|
|
204
|
-
- Follow directory priority: existing > AGENTS.md > ask
|
|
205
|
-
- Verify directory is ignored for project-local
|
|
206
|
-
- Auto-detect and run project setup
|
|
207
|
-
- Verify clean test baseline
|
|
80
|
+
- Create a worktree from the local HEAD or a stale branch.
|
|
81
|
+
- Put a worktree in the repo folder or in a sibling of the repo.
|
|
82
|
+
- Link `node_modules` or a venv into a worktree.
|
|
83
|
+
- Leave a worktree, local branch or merged remote branch behind after the work ends.
|
|
84
|
+
- Use a worktree when `git switch -c` is safe.
|
|
208
85
|
|
|
209
86
|
## Integration
|
|
210
87
|
|
|
211
88
|
**Called by:**
|
|
212
|
-
- **brainstorming** (Phase 4) -
|
|
213
|
-
- Any skill
|
|
89
|
+
- **brainstorming** (Phase 4) - when the design is approved and implementation follows
|
|
90
|
+
- Any skill that needs an isolated workspace
|
|
214
91
|
|
|
215
92
|
**Pairs with:**
|
|
216
|
-
- **finishing-a-development-branch** -
|
|
217
|
-
- **executing-plans** or **subagent-driven-development** -
|
|
93
|
+
- **finishing-a-development-branch** - cleanup after the work is complete
|
|
94
|
+
- **executing-plans** or **subagent-driven-development** - the work happens in this worktree
|