Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

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

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@ammar-agent
Copy link
Collaborator Author

Refinement: Only Switching, No Mutations

Refined the default filter to be even more focused - now shows only workspace switching commands (ws:switch:*), excluding mutations like:

  • ❌ Create New Workspace
  • ❌ Delete Workspace
  • ❌ Rename Workspace
  • ❌ Open in Terminal

These management commands are still accessible via > prefix.

Rationale:

  • Workspace switching is the primary use case
  • Mutations should require explicit intent (via >)
  • Keeps the default palette extremely focused and fast
  • Matches user expectations for a "switcher"

Testing:

// Default view: Only ws:switch:* commands
testFiltering("") // → ["Switch to Workspace A", "Switch to Workspace B"] ✅

// With > prefix: All commands including mutations
testFiltering(">") // → All 8+ commands including create/delete/rename ✅

@ammar-agent
Copy link
Collaborator Author

Fixed the cmdk filtering issue for > queries in commit bb8102c. The custom filter now runs and properly strips the > prefix when searching commands. 👍

@ammario
Copy link
Member

ammario commented Oct 29, 2025

fyi @ThomasK33 — I think this is a good compromise

Make the command palette primarily a workspace switcher while keeping all
commands accessible via prefix keys. This focuses the palette on the most
common use case (switching workspaces) without sacrificing functionality.

**Changes:**

- Default view shows only workspace commands (switch, create, rename, etc.)
- Type `>` prefix to see all commands across all sections
- Type `/` prefix for slash commands (existing behavior)
- Updated placeholder text to reflect new behavior

**Code quality improvements:**

- Extracted repeated state reset logic into `resetPaletteState()` helper
- Exported command section names as `COMMAND_SECTIONS` constant
- Removed unused `searchQuery` variable
- Updated documentation and Storybook stories

**Documentation:**

- Added command palette section to docs/keybinds.md explaining three modes
- Updated Storybook story with accurate feature descriptions

_Generated with `cmux`_
Changed the default filter to only show `ws:switch:*` commands, excluding
workspace mutations like create, delete, and rename. These management
commands are still accessible via the `>` prefix.

**Why:**
- Workspace switching is the primary use case
- Create/delete/rename are mutations that should require explicit intent
- Keeps the default palette extremely focused and fast

**Changes:**
- Filter by command ID prefix `ws:switch:*` instead of section name
- Updated documentation to clarify "switching" vs "workspace management"
- Updated Storybook story descriptions
Fixed an issue where typing `>abc` wouldn't filter commands because
`shouldUseCmdkFilter` was set to false for command queries. Now cmdk
filtering is enabled for `>` queries so users can search through all commands.

Addresses Codex review comment about unsearchable "all commands" mode.

**Before:**
- `shouldFilter={false}` for `>` queries
- Custom filter was never called
- Typing `>abc` showed all commands unfiltered

**After:**
- `shouldFilter={true}` for `>` queries
- Custom filter strips `>` prefix and filters normally
- Typing `>abc` narrows down to matching commands
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants