Skip to content

feat: add command palette and session search - #11

Merged
leoncheng57 merged 2 commits into
mainfrom
feat/command-palette-search
Aug 21, 2026
Merged

leoncheng57 merged 2 commits into
mainfrom
feat/command-palette-search

Conversation

@leoncheng57

Copy link
Copy Markdown
Owner

Summary

  • Add a global Cmd/Ctrl+K command palette and visible AppShell search trigger.
  • Search navigation, Phone QR, theme, and bounded sessions from the current project only.
  • Keep ranking React-free and the portal/listbox component focused on DOM and ARIA behavior.

Interaction Contract

  • Cmd/Ctrl+K opens or closes the palette from every route.
  • The visible Search button opens the same palette.
  • Arrow Up/Down wraps through results; Home/End jump; Enter executes; Escape closes.
  • Focus starts in the search input and returns to the prior control when the palette closes.
  • Opening always clears the query and freshly fetches up to 100 sessions.

Ranking Rules

  1. Title prefix, including exact title matches.
  2. Word or path-segment prefix across title and keywords.
  3. Substring across title and keywords.
  4. Equal scores sort by navigation, action, conversation, then localeCompare title, then original position.
  5. Blank queries preserve natural registry order.

Data Flow

Cmd+K -> fetch current project sessions -> normalize commands -> rank -> listbox -> navigate/action

The project directory resolves from the URL directory parameter first, then opencode.directory.v1. Missing directories skip the session request while static commands remain usable.

Accessibility

  • Body portal with modal dialog, labelled combobox, flat listbox, and options.
  • aria-activedescendant keeps typing focus in the input while announcing the active row.
  • Background AppShell content becomes inert while open; body scrolling is locked.
  • Semantic design tokens, existing reduced-motion policy, touch-sized rows, and a z-index above workspace drawers.

Tests

  • npm run typecheck
  • npm test - 115 passed
  • npm run build
  • PORT=13410 MOCK_OPENCODE_PORT=14599 MOCK_PREVIEW_PORT=14600 npm run test:e2e -- --workers=1 - 72 passed
  • git diff --check

Manual Checklist

  • Open from Search and Cmd/Ctrl+K.
  • Arrow and Enter navigation preserve the project directory.
  • Escape restores trigger focus.
  • Phone QR action opens from the palette.
  • Missing directory still shows navigation commands.
  • Palette has no horizontal overflow at 390px.
  • Closing and reopening performs a fresh upstream session fetch.

Non-goals

  • Cross-project or global session search.
  • Project discovery or directory selection.
  • Session polling while the palette is closed or open.
  • New command-palette runtime dependencies.
  • Changes to Hub, Conversation, forge, or session API behavior.

@leoncheng57
leoncheng57 marked this pull request as ready for review August 21, 2026 16:37
@leoncheng57
leoncheng57 merged commit 4b91577 into main Aug 21, 2026
2 checks passed
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.

1 participant