Skip to content

Surface recently-used commands in the Command Palette (⌘K)#57

Open
DragonnZhang wants to merge 3 commits into
mainfrom
loop/command-palette-recents
Open

Surface recently-used commands in the Command Palette (⌘K)#57
DragonnZhang wants to merge 3 commits into
mainfrom
loop/command-palette-recents

Conversation

@DragonnZhang

Copy link
Copy Markdown
Collaborator

Closes #56

What & why

OpenWork's command palette (⌘K / Ctrl+K, shipped in #42) lists every registered
action grouped by category but keeps no memory of what you run — you
re-search even for the command you ran seconds ago. Every mature palette (VS
Code ⌘⇧P, Raycast, Linear ⌘K, Claude Code Desktop's command menu) pins a
"Recently used" section to the top so your frequent actions are one
keystroke away. This adds it.

Changes

  • Persisted recents (apps/electron/src/renderer/components/command-palette-recents.ts):
    a small module storing the most-recently-run action IDs in the renderer's
    localStorage (newest first, de-duplicated, capped at 6) via the shared
    lib/local-storage.ts helper (one new key, command-palette-recents). The
    ordering (pushRecent: dedupe → prepend → cap) is a pure function.
  • Palette integration (CommandPalette.tsx): record each action run from
    the palette; render a "Recently used" CommandGroup above the categories
    only when the query is empty, and hide it while searching so cmdk's
    relevance filtering takes over. Recents are filtered to actions that still
    exist, aren't excluded, and can run right now (canExecute) — never a stale
    or dead row.
  • i18n: one new key commands.recent added to all 7 locales.
  • Tests: command-palette-recents.test.ts (pure pushRecent: dedupe,
    move-to-front, cap, immutability) + e2e/assertions/command-palette-recents.assert.ts.

Frontend-only — no qwen-code backend change, no new IPC, no main-process change.

Verification

  • bun run typecheck:allzero delta vs main (identical error hash/count;
    the 11 pre-existing apps/electron errors are unrelated to this change;
    packages/shared and packages/ui are clean).
  • bun testzero delta vs main (56 pre-existing baseline failures on
    both main and this branch, 0 new); the new pushRecent unit suite is
    6/6 pass.
  • bun run electron:build:renderer — ✅ builds cleanly (the renderer bundle
    contains the palette change).
  • CDP assertion could not run in this environment (same block as prior loop
    rounds): the sandbox's egress policy prevents fetching the Electron binary and
    the libsignal GitHub dependency (WhatsApp worker), so electron:build:main
    and app launch fail here. The assertion is written and self-contained for CI /
    reviewer validation.

What the CDP assertion checks (command-palette-recents.assert.ts)

Drives the real built app over CDP in the draft (no-session) state; the palette
reads recents fresh from localStorage on each open:

  1. Seed localStorage['craft-command-palette-recents'] = ['app.toggleTheme'],
    open the palette → a "Recently used" group renders exactly one row
    (Toggle Theme), above the first category row.
  2. Type sidebar → the recents group hides (0 recent rows) while filtering
    still surfaces a Toggle Sidebar match; clearing the query brings recents back.
  3. Run a new, not-yet-recent action (Toggle Sidebar) from the palette, then
    reopen → the recents group now has two rows with Toggle Sidebar
    first, Toggle Theme second — proving the palette persists what you run
    and orders newest-first.

Generated by Claude Code

claude added 2 commits July 5, 2026 01:37
The command palette (⌘K) listed every action grouped by category but kept
no memory of what you run — you re-search even for the command you ran
seconds ago. Add a "Recently used" group pinned to the top, the standard
command-palette convention (VS Code, Raycast, Linear).

- Persist the most-recently-run action IDs in localStorage (newest first,
  de-duplicated, capped at 6) via the shared local-storage helper.
- Record each action run from the palette; show the recents in a dedicated
  "Recently used" group above the categories when the query is empty, and
  hide it while searching so relevance ranking takes over.
- Filter recents to actions that still exist, aren't excluded, and can run
  right now, so the group never surfaces a stale or dead command.
- Extract the ordering into a pure `pushRecent` module with unit tests.
- Add the `commands.recent` heading key across all 7 locales.
- Add a CDP assertion driving the full lifecycle (seed → render → hide on
  search → record on run → newest-first on reopen).
Resolve merge conflict in docs/loop/feature-ledger.md (append-only ledger)
by keeping the branch's reconciled superset, which already includes the
reduce-motion (#51) row. Locale files auto-merged cleanly; i18n parity verified.
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.

Surface recently-used commands in the Command Palette (⌘K)

2 participants