Commit c2355e6
authored
🤖 refactor: make command palette a workspace switcher by default (#477)
Makes the command palette primarily a **workspace switcher** by default,
with all commands still accessible via prefix keys.
## Motivation
The command palette was showing all commands by default, but workspace
switching is the most common use case. This change optimizes for the
common case while keeping everything accessible.
## Changes
### Behavior
- **Default** (no prefix): Shows only workspace commands (switch,
create, rename, delete, etc.)
- **`>` prefix**: Shows all commands across all sections (Navigation,
Chat, Modes, Projects, Help)
- **`/` prefix**: Shows slash commands for chat input (existing
behavior)
### Code Quality
Took this opportunity to clean up surrounding code:
- **Extracted `resetPaletteState()` helper** - State reset logic was
duplicated 4 times across the component
- **Exported `COMMAND_SECTIONS` constant** - Section names are now
centralized and type-safe
- **Removed unused variable** - `searchQuery` was declared but never
used
- **Added custom filter function** - Properly handles `>` prefix in cmdk
filtering
### Documentation
- Added command palette section to `docs/keybinds.md` explaining the
three modes
- Updated Storybook story with accurate feature descriptions
- Fixed section name inconsistency in Storybook (was "Workspace", now
"Workspaces")
## Testing
- ✅ TypeScript type checking passes
- ✅ Prettier formatting passes
- ✅ Logic verified with unit test simulation
- ✅ All existing functionality preserved
## Before/After
**Before:**
- Opens with all commands visible
- User must scroll/search through Navigation, Chat, Mode, Project, Help
sections to find workspaces
**After:**
- Opens with only workspace commands (the primary use case)
- Type `>` to instantly see all other commands when needed
- Faster workflow for the most common action
_Generated with `cmux`_1 parent 7ca32f4 commit c2355e6
File tree
8 files changed
+344
-55
lines changed- docs
- src
- components
- utils
- commands
8 files changed
+344
-55
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
| 212 | + | |
212 | 213 | | |
213 | 214 | | |
214 | 215 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
57 | 67 | | |
58 | 68 | | |
59 | 69 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
186 | | - | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
187 | 198 | | |
188 | | - | |
189 | 199 | | |
190 | | - | |
191 | | - | |
192 | | - | |
| 200 | + | |
193 | 201 | | |
194 | 202 | | |
195 | | - | |
196 | | - | |
197 | | - | |
| 203 | + | |
198 | 204 | | |
199 | 205 | | |
200 | 206 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
45 | 52 | | |
46 | 53 | | |
47 | 54 | | |
48 | 55 | | |
49 | 56 | | |
50 | | - | |
51 | | - | |
52 | | - | |
| 57 | + | |
53 | 58 | | |
54 | 59 | | |
55 | 60 | | |
56 | 61 | | |
57 | 62 | | |
58 | | - | |
| 63 | + | |
59 | 64 | | |
60 | 65 | | |
61 | 66 | | |
62 | 67 | | |
63 | | - | |
64 | | - | |
65 | | - | |
| 68 | + | |
66 | 69 | | |
67 | 70 | | |
68 | 71 | | |
69 | 72 | | |
70 | | - | |
| 73 | + | |
71 | 74 | | |
72 | 75 | | |
73 | 76 | | |
| |||
200 | 203 | | |
201 | 204 | | |
202 | 205 | | |
203 | | - | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
204 | 210 | | |
205 | 211 | | |
206 | 212 | | |
| |||
298 | 304 | | |
299 | 305 | | |
300 | 306 | | |
| 307 | + | |
| 308 | + | |
301 | 309 | | |
302 | 310 | | |
303 | 311 | | |
| |||
355 | 363 | | |
356 | 364 | | |
357 | 365 | | |
358 | | - | |
359 | | - | |
360 | | - | |
| 366 | + | |
361 | 367 | | |
362 | 368 | | |
363 | 369 | | |
364 | 370 | | |
365 | 371 | | |
366 | 372 | | |
367 | 373 | | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
368 | 386 | | |
369 | 387 | | |
370 | 388 | | |
| |||
375 | 393 | | |
376 | 394 | | |
377 | 395 | | |
378 | | - | |
| 396 | + | |
379 | 397 | | |
380 | 398 | | |
381 | 399 | | |
| |||
389 | 407 | | |
390 | 408 | | |
391 | 409 | | |
392 | | - | |
393 | | - | |
394 | | - | |
| 410 | + | |
395 | 411 | | |
396 | 412 | | |
397 | 413 | | |
| |||
0 commit comments