feat(ui): Ctrl-K command palette #101

Manually merged
lz merged 5 commits from feat/command-palette into main 2026-09-04 17:24:58 +02:00
Owner

Issue #96, design D7. Fourth and last PR in the chain — stacked on #100, merge after it.

A filter over the workspaces store, an overlay, and a keydown listener.

Index = every workspace, every session, and each of the five DockViews for each of them, plus New workspace…. Enter opens the highlighted target's terminal; Tab narrows to that target's views; Escape backs out of the narrowing before it closes the palette, so leaving costs the same keystrokes as entering.

An empty query is not "everything": it shows the two groups worth showing unprompted — Needs you (workspaces stuck in pulling/booting or errored, and previews awaiting approval) and Recent. Once the operator types, the list is flat and ranked — grouping there put a pending-port row above the workspace you just named, and Enter then opened the wrong thing.

Two deliberate deviations from the spec

  • The spec says "no API". Needs-you's pending previews are in no client store — previews are fetched per session — so this adds one read-only route, GET /api/previews/pending, behind the same operator gate as everything else. Without it the group can only report half of what it promises.
  • The spec has Tab step into "the D3 menu, rendered inline". Half of that menu (new-session, Container logs) is wired to component-local state a palette cannot reach, so a faithful version would ship rows that do nothing — and each new onPick switch is a new place for exactly that. Tab narrows to the target's views instead: the drill-down a palette is for, with nothing dead in it.

Also here, because the palette is what makes them reachable

  • The rail's pinned footer (spec §D6). At 52px there was no way to search or create a workspace without expanding the sidebar first.
  • A header Ctrl-K chip — the whole affordance on a phone. Hidden off the main page, where the palette is not mounted and it would do nothing.
  • NewWorkerModal moves from Workers up to MainSplit: three surfaces raise it now and only one is the list. Focus returns to whichever raised it.

The binding

isPaletteChord is a pure predicate with its own test, because the interesting part is what it must not match and that is only checkable in a test. Measured in a real browser:

chord claimed? why
Ctrl-K / Ctrl-P yes, preventDefault both are browser chords in a tab (Firefox search bar / Chrome omnibox; Print)
Ctrl-Shift-K no Firefox's Web Console — caught in the browser pass, the uppercase match was swallowing it
Ctrl-K with caps lock yes caps lock reports 'K' with shiftKey: false
Cmd-K no no Mac accelerators anywhere, per the design

Verification

Gates: 4875 files / 0 errors 0 warnings, 113 files / 1075 tests, lint clean.

Browser (seeded instance, playwright-cli): open by chord / chip / rail footer; the Needs-you group against seeded stuck workspaces and pending previews; ranking; Tab drill and Shift-Tab; Enter opening a panel and recording a recent; the modal from all three entry points with focus return; and the mobile layout at 390px.

New unit tests: palette-index.test.ts (index construction, the Needs-you predicate, shell-preview routing to the workspace target, token filtering and ranking), palette-chord.test.ts, palette-recents.test.ts.


Rebased after the spec audit

Rebased onto the updated #100. One conflict resolution worth naming: both branches added a VIEW_LABEL record to panel-target.ts, which is a compile error together. The palette's copy stayed — it documents why the ellipsis on Settings… belongs at the call site rather than in the name.

Verified after the rebase that the palette and the new menu work together: Ctrl-K still opens, the rail's pinned footer (Search / +) coexists with the rail's new context menu, and the fleet-wide workspaces.portCount() feeds the shared menuContextFor rather than the per-card fetch it replaced.

Rebased again after #100's review pass. Gates at this tip: 4889 files / 0 errors 0 warnings, 117 files / 1133 tests, lint clean.

Issue #96, design **D7**. Fourth and last PR in the chain — stacked on #100, merge after it. A filter over the `workspaces` store, an overlay, and a keydown listener. **Index** = every workspace, every session, and each of the five `DockView`s for each of them, plus `New workspace…`. `Enter` opens the highlighted target's terminal; `Tab` narrows to that target's views; `Escape` backs out of the narrowing before it closes the palette, so leaving costs the same keystrokes as entering. An empty query is not "everything": it shows the two groups worth showing unprompted — **Needs you** (workspaces stuck in `pulling`/`booting` or errored, and previews awaiting approval) and **Recent**. Once the operator types, the list is **flat and ranked** — grouping there put a pending-port row above the workspace you just named, and `Enter` then opened the wrong thing. ### Two deliberate deviations from the spec - **The spec says "no API".** Needs-you's pending previews are in no client store — previews are fetched per session — so this adds one read-only route, `GET /api/previews/pending`, behind the same operator gate as everything else. Without it the group can only report half of what it promises. - **The spec has `Tab` step into "the D3 menu, rendered inline".** Half of that menu (`new-session`, `Container logs`) is wired to component-local state a palette cannot reach, so a faithful version would ship rows that do nothing — and each new `onPick` switch is a new place for exactly that. `Tab` narrows to the target's views instead: the drill-down a palette is for, with nothing dead in it. ### Also here, because the palette is what makes them reachable - **The rail's pinned footer** (spec §D6). At 52px there was no way to search or create a workspace without expanding the sidebar first. - **A header `Ctrl-K` chip** — the whole affordance on a phone. Hidden off the main page, where the palette is not mounted and it would do nothing. - **`NewWorkerModal` moves from `Workers` up to `MainSplit`**: three surfaces raise it now and only one is the list. Focus returns to whichever raised it. ### The binding `isPaletteChord` is a pure predicate with its own test, because the interesting part is what it must *not* match and that is only checkable in a test. Measured in a real browser: | chord | claimed? | why | |---|---|---| | `Ctrl-K` / `Ctrl-P` | yes, `preventDefault` | both are browser chords in a tab (Firefox search bar / Chrome omnibox; Print) | | `Ctrl-Shift-K` | **no** | Firefox's Web Console — caught in the browser pass, the uppercase match was swallowing it | | `Ctrl-K` with caps lock | yes | caps lock reports `'K'` with `shiftKey: false` | | `Cmd-K` | no | no Mac accelerators anywhere, per the design | ### Verification Gates: **4875 files / 0 errors 0 warnings**, **113 files / 1075 tests**, lint clean. Browser (seeded instance, `playwright-cli`): open by chord / chip / rail footer; the Needs-you group against seeded stuck workspaces and pending previews; ranking; `Tab` drill and `Shift-Tab`; `Enter` opening a panel and recording a recent; the modal from all three entry points with focus return; and the mobile layout at 390px. New unit tests: `palette-index.test.ts` (index construction, the Needs-you predicate, shell-preview routing to the workspace target, token filtering and ranking), `palette-chord.test.ts`, `palette-recents.test.ts`. --- ### Rebased after the spec audit Rebased onto the updated #100. One conflict resolution worth naming: both branches added a `VIEW_LABEL` record to `panel-target.ts`, which is a compile error together. The palette's copy stayed — it documents why the ellipsis on `Settings…` belongs at the call site rather than in the name. Verified after the rebase that the palette and the new menu work together: `Ctrl-K` still opens, the rail's pinned footer (Search / +) coexists with the rail's new context menu, and the fleet-wide `workspaces.portCount()` feeds the shared `menuContextFor` rather than the per-card fetch it replaced. Rebased again after #100's review pass. Gates at this tip: 4889 files / 0 errors 0 warnings, 117 files / 1133 tests, lint clean.
lz force-pushed feat/command-palette from f6d4619931
All checks were successful
ci / nexus (pull_request) Successful in 7m46s
ci / images (pull_request) Successful in 13m11s
to fc2872ba4e
All checks were successful
ci / nexus (pull_request) Successful in 7m41s
ci / images (pull_request) Successful in 8m20s
2026-09-03 01:10:56 +02:00
Compare
lz force-pushed feat/command-palette from fc2872ba4e
All checks were successful
ci / nexus (pull_request) Successful in 7m41s
ci / images (pull_request) Successful in 8m20s
to d164870f48
All checks were successful
ci / nexus (pull_request) Successful in 8m13s
ci / images (pull_request) Successful in 8m44s
pr-image-cleanup / delete-pr-images (pull_request) Successful in 9s
2026-09-03 14:58:04 +02:00
Compare
lz changed target branch from feat/target-menu to main 2026-09-04 17:24:39 +02:00
lz manually merged commit 830567fdfb into main 2026-09-04 17:24:58 +02:00
Sign in to join this conversation.
No reviewers
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
lz/agent-nexus!101
No description provided.