Skip to content

feat(web): Search finds threads, commands and settings in one grouped list - #1061

Merged
badcuban merged 5 commits into
mainfrom
refactor/command-palette-search
Nov 23, 2026
Merged

badcuban merged 5 commits into
mainfrom
refactor/command-palette-search

Conversation

@badcuban

Copy link
Copy Markdown
Collaborator

The command palette is also the app's search (the sidebar's Search field opens it), and it did neither job well:

  • It opened on 30 commands. Recent threads started at row 31 in a box that showed 8 rows.
  • It didn't know settings. "font size" and "dark mode" found only threads with those words, and "diff", "model" and "theme" found nothing.
  • Typing a path silently turned Search into Add project, and Enter then created a project.
  • "No matching commands, projects, or threads" showed while the message search was still running. A computer that failed to answer was never mentioned.
  • Groups had a fixed order, so a thread named exactly what you typed sat under every command that mentioned the word.

The causes were structural. Every command was typed by hand inside one 3,289-line component that was also the Add project wizard and the Codex importer, and ranking ran inside each group.

The plan, the reviews it went through and what each step built differently are in docs/design/command-palette.md. A working mockup of the look is beside it.

What changed, one commit per step

  1. Add project and "Bring in Codex conversation" are their own dialogs. Search stays a search, and a typed path adds one "Add project at …" row. Each opening is a session, so a clone that finishes after its dialog closed shows a notice instead of calling back the wrong caller. Shortcuts stand down while either dialog is open, and focus returns to whatever opened it.
  2. One command list. packages/shared/src/appCommands.ts names every command, and a shortcut command without a name fails the build. Whoever owns a behavior registers its handler (apps/web/src/commands/commandHandlers.ts), with the same guard its button or shortcut uses. About 25 commands that had no palette row arrive, the theme commands from feat: custom themes that agents make, with live art behind frosted glass #827 among them. The Keybindings page takes its names from the same list. The palette opens on recent threads.
  3. Search across threads, commands, settings and projects. One pure module (paletteSearch.ts) puts every match on one scale, so the group holding the best match leads. Settings results use the availability rules Settings search uses and open their page with the row lit. The palette says when it is still searching messages and names a computer that failed or stopped early. Commands now match from the start of a word.
  4. The grouped look. Each kind of result sits in its own quiet group in one wider surface. Filters for All, Threads, Commands, Settings and Projects sit under the field. Escape clears the text, then the filter, then closes. The palette draws its own list so the highlight stays on the row you chose when message matches arrive late.

Things a user will notice

  • Keybindings rows read "Toggle terminal" instead of "Terminal: Toggle", grouped under Thread, Panels, Projects, Go to and App.
  • ⌘D is named "Toggle panel", because it shows or hides the side panel on the tab it was left on. "Show diff" opens the diff tab itself.
  • Typing "erminal" no longer finds terminal commands. "term" does.
  • Adding a project by typing a path in Search takes one more Enter.

Checks

  • Format, lint and typecheck pass.
  • Unit tests pass for web, shared and the server's guide.
  • The full browser suite passes (118 files).
  • Startup size is 907.6 KB gzip with main merged in, against a 915 KB budget. The four steps added 3.7 KB of that. Neither dialog body, the command catalog, the settings index nor the search code loads at startup.
  • New tests cover the session guard, the handler registry, which commands are offered on a thread and on Home, every expected search order, the status lines, the filters, staged Escape, the highlight when results arrive late, the phone layout, and that the palette's rows commit nothing while a reply streams.

Known gaps, listed as follow-ups in the plan

  • Archived threads are not searched. An empty search ends with a row that opens Settings › Archived threads.
  • The source behind Wrap up and Reopen still recomputes the inbox on every streamed token while the palette is open, as the old palette did.
  • Tooltips and the rail keep their own words for a few commands.

Add project and "Bring in Codex conversation" lived inside the command
palette, which switched modes on the text in its field: typing a path turned
Search into a folder browser that could create a project on Enter. A clone or
import that finished after the palette closed could also call the wrong
caller back or navigate anyway.

Both flows are now their own dialogs, each with a small store that loads at
startup and a body that loads on first open. Every opening is a session: an
operation's callback, navigation and close happen only if its session is
still open, otherwise a notice says what was added with an Open button. A
typed path in Search adds an "Add project at <path>" row on top of the
results instead of changing modes. App-wide shortcuts stand down while the
palette or either dialog is open, and each dialog returns focus to whatever
opened it. The plan for the rest of the palette work is in
docs/design/command-palette.md.
The palette's commands were a hand-built list inside one component, each
behind its own if, so commands the app already had (the panel's tabs,
switching model, stashing a message, the theme commands) were never offered,
and the Keybindings page made up its own labels ("Diff: Toggle"). The palette
also opened on about 30 commands, with recent threads below them.

One catalog in packages/shared names every command, and a build fails when
a shortcut command has no name. Whoever owns a behavior registers its
handler, with the same guard its button or shortcut uses, and the palette
offers what is registered. The palette now opens on the five most recent
threads, then four suggested commands learned on this device, then a row
into every command. Keybindings takes its names and groups from the catalog.
The open palette no longer redraws while a reply streams, except the part
that decides Wrap up or Reopen, which still reads the inbox on every token.
The palette searched threads and commands only, kept its groups in a fixed
order, and said "No matching commands, projects, or threads" while the
message search was still running. A setting like terminal text size could not
be found, and a thread named exactly what you typed sat under every command
that mentioned the word.

Search now covers threads, commands, settings and projects through one pure
module. Each source keeps its own matcher, and every match gets a tier from
its own words, so the group holding the best match comes first. Settings
results use the same availability rules as Settings search and open their
page with the row lit, and Back returns to the chat. The palette says when it
is still searching messages, names a computer that failed or stopped early,
and offers close matches only when nothing matched. Recent threads follow
this device's last visits.
The palette was a small box inside a box that showed eight two-line rows,
faded its secondary text, and had one hidden filter (typing ">"). Add project
and the Codex import shared the box with no title to say which was open.

Each kind of result now sits in its own quiet filled group, in a wider single
surface with one-line rows. Filters for All, Threads, Commands, Settings and
Projects sit under the field with a count each, and Tab moves between them.
In All a group shows five rows and a "Show all" row. Escape clears the text,
then the filter, then closes. The palette draws its own list so the highlight
follows the row the user chose when message matches arrive late. Add project
and the Codex import take the same look and name their step in a title row.
@vercel

vercel Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
threadlines Ready Ready Preview Nov 23, 2026 6:18pm UTC

Request Review

@badcuban
badcuban enabled auto-merge November 23, 2026 18:18
@badcuban
badcuban added this pull request to the merge queue Nov 23, 2026
Merged via the queue into main with commit ed5eeb1 Nov 23, 2026
23 checks passed
@badcuban
badcuban deleted the refactor/command-palette-search branch November 23, 2026 18:32

This branch was successfully deployed

1 active deployment
Preview — cb4cc5dd Deployed Nov 23, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant