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
feat: add custom commands for tree view context menu
Allow users to configure external commands (e.g., open in Ghostty, Zed,
Terminal.app) triggered from the tree view context menu via two new settings:
- customCommands.directory: for worktree/repository items
- customCommands.workspace: for workspace file items
Each command supports template variables ({name}, {branch}, {ref}, {head},
{path}, {dir}, {worktree}) and optional environment variables. Commands are
shown in a QuickPick and spawned as fire-and-forget child processes.
Also adds {dir} template variable for workspace items (parent directory).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add custom commands: configure external commands (e.g., open in Ghostty, Zed) triggered from the tree view context menu. Supports template variables for dynamic arguments and environment variables.
@@ -62,6 +63,7 @@ Right-click any item in the tree to access:
62
63
|**Open in Current Window**| Opens in the current VS Code window |
63
64
|**Open in Terminal**| Opens a terminal at the item's location |
64
65
|**Reveal in Finder**| Opens the item's location in your OS file manager |
66
+
|**Custom Commands...**| Runs a user-defined command (when configured) |
65
67
|**Copy Name**| Copy the item's display name to clipboard |
66
68
|**Copy Path**| Copy the item's filesystem path to clipboard |
67
69
@@ -113,9 +115,35 @@ Open VS Code Settings (`Cmd+,` / `Ctrl+,`) and search for `git-work-grove`:
113
115
|`git-work-grove.openBehavior`|`ask`\|`newWindow`\|`currentWindow`\|`terminal`|`ask`| Default action when opening a workspace |
114
116
|`git-work-grove.workspaceFile.include`|`string[]`|`["*.code-workspace"]`| Glob patterns for workspace file scanning |
115
117
|`git-work-grove.workspaceFile.exclude`|`string[]`|`[]`| Glob patterns to exclude from scanning |
118
+
|`git-work-grove.customCommands.directory`|`array`|`[]`| Custom commands for repository/worktree items |
119
+
|`git-work-grove.customCommands.workspace`|`array`|`[]`| Custom commands for workspace file items |
116
120
|`git-work-grove.template.*`|`string`|*(varies)*| Display templates (label, description, terminalName) — see [Template Customization](https://github.com/vp-tw/vscode-extension-git-work-grove/blob/main/docs/templates.md)|
117
121
|`git-work-grove.favorites`|`string[]`|`[]`| Ordered list of favorited item paths (managed via the UI) |
118
122
123
+
### Custom Commands
124
+
125
+
Define custom commands that appear in the tree view context menu. Two settings are available — one for directory items (repository/worktree), one for workspace file items:
126
+
127
+
```json
128
+
{
129
+
"git-work-grove.customCommands.directory": [
130
+
{
131
+
"command": ["npm", "run", "dev"],
132
+
"env": { "NODE_ENV": "development" },
133
+
"label": "Run Dev Server"
134
+
}
135
+
],
136
+
"git-work-grove.customCommands.workspace": [
137
+
{
138
+
"command": ["code", "--goto", "{path}"],
139
+
"label": "Open in Terminal"
140
+
}
141
+
]
142
+
}
143
+
```
144
+
145
+
Each entry has a `label` (shown in QuickPick), a `command` array (`[bin, ...args]`), and an optional `env` object. Both `command` and `env` values support template variables (`{name}`, `{branch}`, `{ref}`, `{head}`, `{path}` — workspace items also have `{dir}` and `{worktree}`).
146
+
119
147
### Template Customization
120
148
121
149
All tree item labels and descriptions are customizable. Templates support variables like `{name}`, `{branch}`, `{ref}`, fallback syntax (`{branch|detached}`), and conditional sections (`{?branch}({branch}){/branch}`).
@@ -145,6 +173,7 @@ These commands appear when right-clicking items in the tree view:
145
173
| Open in Current Window | Open in the current VS Code window |
146
174
| Open in Terminal | Open a terminal at the item's location |
147
175
| Reveal in Finder | Open the item's location in your OS file manager |
176
+
| Custom Commands... | Run a user-defined command (when configured) |
148
177
| Copy Name | Copy the item's display name to clipboard |
149
178
| Copy Path | Copy the item's filesystem path to clipboard |
150
179
| Add Favorite | Pin this item to the Favorites section |
@@ -168,6 +197,7 @@ Design documents for contributors and AI-assisted development:
168
197
-[Open Behavior](https://github.com/vp-tw/vscode-extension-git-work-grove/blob/main/docs/spec/open-behavior.md) — Open modes, URI resolution, click handling
169
198
-[Open in Terminal](https://github.com/vp-tw/vscode-extension-git-work-grove/blob/main/docs/spec/open-in-terminal.md) — CWD resolution, terminal naming, prunable guard
170
199
-[Empty States](https://github.com/vp-tw/vscode-extension-git-work-grove/blob/main/docs/spec/empty-states.md) — Git unavailable, no repository, no worktrees messages
200
+
-[Custom Commands](https://github.com/vp-tw/vscode-extension-git-work-grove/blob/main/docs/spec/custom-commands.md) — Custom commands: settings, execution, context menu
0 commit comments