Commit 4241982
authored
🤖 Add trunk branch selector for workspace creation (#100)
Adds ability to select a trunk/base branch when creating a new
workspace.
## Changes
### UI
- **Command palette**: Added trunk branch selection field with fuzzy
search
- **Modal (CMD+N)**: Added dropdown to select trunk branch
- Both UIs load local branches and show them as options
- Trunk branch selection is optional (defaults to HEAD if not selected)
### Backend
- Added `listLocalBranches()` to enumerate local branches
- Updated `createWorktree()` to accept optional `trunkBranch` parameter
- New logic: if trunk is specified, always create new branch from trunk
- Ignores remote branches when trunk is explicitly selected
- Errors if local branch already exists (prevents overwrite)
- Without trunk: preserves existing behavior (checkout remote or create
from HEAD)
### IPC Layer
- Added `WORKSPACE_LIST_BRANCHES` channel to fetch branches for a
project
- Updated `workspace.create` to accept and pass through `trunkBranch`
- Wired through preload.ts, ipcMain.ts, and type definitions
### Integration
- Updated App.tsx to pass trunk branch from modal to backend
- Updated command palette prompts to collect trunk branch selection
- Command palette supports async option loading with fuzzy filtering
## Use Cases
This enables creating feature branches from any local branch:
- Creating branches from `main` instead of current HEAD
- Starting new work from a specific release branch
- Isolating work from unrelated changes on current branch
## Testing
- ✅ All lint checks pass
- ✅ All TypeScript checks pass
- ✅ Command palette trunk selection works
- ✅ Modal trunk selection works
- ✅ Trunk branch parameter flows through entire stack
_Generated with `cmux`_
Signed-off-by: Thomas Kosiewski <tk@coder.com>1 parent af6ad38 commit 4241982
File tree
18 files changed
+588
-114
lines changed- docs
- src
- components
- constants
- contexts
- hooks
- services
- types
- utils/commands
- tests/ipcMain
18 files changed
+588
-114
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
393 | 393 | | |
394 | 394 | | |
395 | 395 | | |
396 | | - | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
397 | 399 | | |
398 | 400 | | |
399 | 401 | | |
| |||
404 | 406 | | |
405 | 407 | | |
406 | 408 | | |
407 | | - | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
408 | 412 | | |
409 | 413 | | |
410 | 414 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
206 | 207 | | |
207 | 208 | | |
208 | 209 | | |
209 | | - | |
| 210 | + | |
210 | 211 | | |
211 | 212 | | |
212 | | - | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
213 | 219 | | |
214 | 220 | | |
215 | 221 | | |
| |||
329 | 335 | | |
330 | 336 | | |
331 | 337 | | |
332 | | - | |
333 | | - | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
334 | 344 | | |
335 | 345 | | |
336 | 346 | | |
337 | 347 | | |
338 | 348 | | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
339 | 370 | | |
340 | 371 | | |
341 | 372 | | |
| |||
389 | 420 | | |
390 | 421 | | |
391 | 422 | | |
| 423 | + | |
392 | 424 | | |
393 | 425 | | |
394 | 426 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
306 | 306 | | |
307 | 307 | | |
308 | 308 | | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
309 | 314 | | |
310 | 315 | | |
311 | 316 | | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
312 | 368 | | |
313 | 369 | | |
314 | 370 | | |
| |||
318 | 374 | | |
319 | 375 | | |
320 | 376 | | |
321 | | - | |
| 377 | + | |
322 | 378 | | |
323 | 379 | | |
324 | 380 | | |
| |||
331 | 387 | | |
332 | 388 | | |
333 | 389 | | |
334 | | - | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
335 | 395 | | |
336 | 396 | | |
337 | 397 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
34 | 44 | | |
35 | 45 | | |
36 | 46 | | |
| |||
48 | 58 | | |
49 | 59 | | |
50 | 60 | | |
51 | | - | |
| 61 | + | |
52 | 62 | | |
53 | 63 | | |
54 | 64 | | |
| |||
58 | 68 | | |
59 | 69 | | |
60 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
61 | 75 | | |
62 | 76 | | |
| 77 | + | |
63 | 78 | | |
64 | 79 | | |
65 | 80 | | |
66 | 81 | | |
| 82 | + | |
67 | 83 | | |
| 84 | + | |
68 | 85 | | |
69 | 86 | | |
70 | 87 | | |
| |||
76 | 93 | | |
77 | 94 | | |
78 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
79 | 105 | | |
80 | 106 | | |
81 | 107 | | |
82 | 108 | | |
83 | | - | |
| 109 | + | |
84 | 110 | | |
| 111 | + | |
85 | 112 | | |
86 | 113 | | |
87 | 114 | | |
| |||
91 | 118 | | |
92 | 119 | | |
93 | 120 | | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
94 | 175 | | |
95 | 176 | | |
96 | 177 | | |
| |||
104 | 185 | | |
105 | 186 | | |
106 | 187 | | |
107 | | - | |
| 188 | + | |
108 | 189 | | |
109 | 190 | | |
110 | 191 | | |
| |||
122 | 203 | | |
123 | 204 | | |
124 | 205 | | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
125 | 231 | | |
126 | 232 | | |
127 | 233 | | |
| |||
133 | 239 | | |
134 | 240 | | |
135 | 241 | | |
136 | | - | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
137 | 252 | | |
138 | 253 | | |
139 | 254 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
0 commit comments