You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 8fbb0ef
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,7 @@
4
4
5
5
### Added
6
6
-`/speckit.worktrees.specify` command for a worktree-first specify workflow: create or reuse the feature worktree before writing spec artifacts, then continue the normal Spec Kit flow from the worktree root
7
+
- VS Code handoff guidance for `/speckit.worktrees.specify`: optional `--open-vscode` behavior, configurable `code -n <worktree-path>` new-window default, and explicit reuse/print modes
7
8
8
9
### Changed
9
10
- README now documents the recommended response to "pre-hook for specify": use an explicit worktree-first command unless Spec Kit itself can also switch the active project root for the rest of `/speckit.specify`
You can make that the project default in `.specify/extensions/worktrees/worktree-config.yml`:
174
+
175
+
```yaml
176
+
vscode_open_after_create: true
177
+
vscode_open_mode: "new-window"
178
+
vscode_command: "code"
179
+
```
180
+
181
+
Use `vscode_open_mode: "reuse-window"` only when you explicitly want VS Code to replace the current window with the worktree. If the `code` CLI is unavailable, or if `vscode_open_mode: "print-command"` is set, the command reports the exact `code -n <worktree-path>` command to run manually.
182
+
154
183
## Hook
155
184
156
185
**`after_specify`** — automatically creates a worktree after a new feature is specified. Controlled by the `auto_create` config value.
Copy file name to clipboardExpand all lines: commands/speckit.worktrees.specify.md
+48-2Lines changed: 48 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,7 @@ You **MUST** consider the user input before proceeding. The user input should in
16
16
- A feature branch name or slug (for example `005-user-auth`)
17
17
- The feature description to specify
18
18
- Optional worktree flags accepted by `/speckit.worktrees.create`, such as `--layout sibling`, `--path <dir>`, or `--base-ref HEAD`
19
+
- Optional IDE handoff flags: `--open-vscode`, `--no-open-vscode`, `--vscode-new-window`, `--vscode-reuse-window`, or `--vscode-print-command`
19
20
20
21
If the branch name is missing, ask for it before creating anything. If the feature description is missing, create the worktree only after the user confirms they want to continue specifying in that worktree.
21
22
@@ -25,11 +26,32 @@ If the branch name is missing, ask for it before creating anything. If the featu
25
26
2. Verify the working tree has the intended base state for the new feature
26
27
3. Verify `git worktree` is available (`git worktree list` succeeds)
27
28
29
+
## Configuration
30
+
31
+
Read configuration from `.specify/extensions/worktrees/worktree-config.yml` if it exists. Defaults apply when the file is absent.
32
+
33
+
| Key | Default | Description |
34
+
|-----|---------|-------------|
35
+
|`vscode_open_after_create`|`false`| Open the returned worktree with the VS Code CLI after creation |
36
+
|`vscode_open_mode`|`new-window`|`new-window`, `reuse-window`, or `print-command`|
37
+
|`vscode_command`|`code`| VS Code CLI command to run |
38
+
39
+
User flags override configuration for the current command:
40
+
41
+
| Flag | Behavior |
42
+
|------|----------|
43
+
|`--open-vscode`| Enable VS Code handoff |
44
+
|`--no-open-vscode`| Disable VS Code handoff |
45
+
|`--vscode-new-window`| Run `code -n <worktree-path>`|
46
+
|`--vscode-reuse-window`| Run `code -r <worktree-path>`|
47
+
|`--vscode-print-command`| Print the command instead of running it |
48
+
28
49
## Outline
29
50
30
51
1.**Parse the request**:
31
52
- Extract the target branch name
32
53
- Extract any worktree flags
54
+
- Extract any VS Code handoff flags
33
55
- Preserve the remaining text as the feature description
34
56
35
57
2.**Create the worktree first**:
@@ -51,7 +73,29 @@ If the branch name is missing, ask for it before creating anything. If the featu
51
73
- Run all file reads, writes, scripts, git commands, and follow-up Spec Kit steps from that path
52
74
- If using an IDE, open the returned path as its own window before continuing
53
75
54
-
4.**Write the spec inside the worktree**:
76
+
4.**Open VS Code when requested**:
77
+
If VS Code handoff is enabled, open or print the worktree command after creation:
78
+
79
+
```bash
80
+
if [[ "$VSCODE_OPEN_MODE"=="print-command" ]];then
0 commit comments