Beautiful, AI-native markdown IDE and LLM wiki
TypeScript 2nd-brainagent-skillsclaudecodexcompany-braindocsknowledge-knowledge-baseknowledge-managementllmllm-wikillm-wiki-karpathymarkdownmarkdown-editormdmdxnotespkmsecond-brainskills
Refactor Cmd+K palette to render from a command registry (Phase 2a) (#2714)
Andrew Mikofalvy8ecefc756da5
diff --git a/.changeset/command-palette-registry-phase-2a.md b/.changeset/command-palette-registry-phase-2a.mdnew file mode 100644index 000000000..9b899f0f0--- /dev/null+++ b/.changeset/command-palette-registry-phase-2a.md@@ -0,0 +1,5 @@+---+"@inkeep/open-knowledge": patch+---++Internal refactor of the Cmd+K command palette: the fixed command rows now render from a single command registry that also drives the palette/menu parity ratchets, replacing the per-command hand-wiring. No user-facing changes — the commands, their grouping, labels, shortcuts, and behavior are unchanged.diff --git a/packages/app/src/components/CommandPalette.dom.test.tsx b/packages/app/src/components/CommandPalette.dom.test.tsxindex fb3d27ff3..cdce3161c 100644--- a/packages/app/src/components/CommandPalette.dom.test.tsx+++ b/packages/app/src/components/CommandPalette.dom.test.tsx@@ -1,10 +1,6 @@import { afterEach, beforeEach, describe, expect, mock, test } from 'bun:test';import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react';import type { ReactNode } from 'react';-import {- PALETTE_COMMAND_IDS,- PRE_EXISTING_PALETTE_IDS,-} from '@/lib/command-menu-parity.test-helper';import {__resetLocalMenuActionBusForTests,subscribeLocalMenuAction,@@ -386,6 +382,30 @@ describe('CommandPalette DOM behavior', () => {);});+ test('new-file command closes the palette and opens the New Item dialog with kind file', async () => {+ const { onOpenChange } = await renderPalette({ bridge: null });++ fireEvent.click(screen.getByTestId('command-palette-new-file'));++ expect(onOpenChange).toHaveBeenCalledWith(false);+ const dialogKind = (kind: 'file' | 'folder') =>+ screen.getAllByTestId('new-item-dialog').find((el) => el.getAttribute('data-kind') === kind);+ await waitFor(() => expect(dialogKind('file')?.getAttribute('data-open')).toBe('true'));+ expect(dialogKind('folder')?.getAttribute('data-open')).toBe('false');+ });++ test('new-folder command closes the palette and opens the New Item dialog with kind folder', async () => {+ const { onOpenChange } = await renderPalette({ bridge: null });++ fireEvent.click(screen.getByTestId('command-palette-new-folder'));++ expect(onOpenChange).toHaveBeenCalledWith(false);+ const dialogKind = (kind: 'file' | 'folder') =>+ screen.getAllByTestId('new-item-dialog').find((el) => el.getAttribute('data-kind') === kind);+ await waitFor(() => expect(dialogKind('folder')?.getAttribute('data-open')).toBe('true'));+ expect(dialogKind('file')?.getAttribute('data-open')).toBe('false');+ });+test('settings command is searchable by preferences/config, closes the palette, and routes through the canonical hash', async () => {const { onOpenChange } = await renderPalette({ bridge: null });@@ -955,7 +975,14 @@ describe('Cmd+K menu-parity backfill', () => {// A future id classified into PALETTE_COMMAND_IDS with no rendered row — which// satisfies only Ratchets A/B — turns this red, closing the "classified but// unreachable" gap that the id ratchets alone cannot see.- test('Ratchet C: every classified palette-command id renders a row or is a pre-existing surface', () => {+ test('Ratchet C: every classified palette-command id renders a row or is a pre-existing surface', async () => {+ // Imported dynamically: the helper pulls in the command registry, and a+ // static import would evaluate the registry before the `mock.module`+ // calls above register — freezing real module bindings (e.g.+ // doc-panel-events) into it for every test in this file.+ const { PALETTE_COMMAND_IDS, PRE_EXISTING_PALETTE_IDS } = await import(+ '@/lib/command-menu-parity.test-helper'+ );const rendered = new Set(ID_BACKED.map((row) => row.id));const covered = new Set([...rendered, ...PRE_EXISTING_PALETTE_IDS]);const missing = [...PALETTE_COMMAND_IDS].filter((id) => !covered.has(id));@@ -1011,6 +1038,34 @@ describe('Cmd+K menu-parity backfill', () => {}});+ test('AC1: with no prop bridge, GitHub takes the web fallback and never the ambient window.okDesktop', async () => {+ // The palette's external-URL open is a pure function of the `bridge` prop:+ // a null prop bridge must take the web `window.open` path and must not+ // reach through to an ambient `window.okDesktop` global. Guards the+ // injected-bridge seam the shared opener relies on.+ const openSpy = mock(() => null);+ const ambientOpenExternal = mock(() => Promise.resolve());+ const originalOpen = window.open;+ window.open = openSpy as unknown as typeof window.open;+ (window as { okDesktop?: unknown }).okDesktop = {+ shell: { openExternal: ambientOpenExternal },+ };+ try {+ await renderPalette({ bridge: null });+ await setQuery('github');+ fireEvent.click(screen.getByTestId('command-palette-open-github'));+ expect(openSpy).toHaveBeenCalledWith(+ 'https://github.com/inkeep/open-knowledge',+ '_blank',+ 'noopener,noreferrer',+ );+ expect(ambientOpenExternal).not.toHaveBeenCalled();+ } finally {+ window.open = originalOpen;+ delete (window as { okDesktop?: unknown }).okDesktop;+ }+ });+test('AC3: web host shows host-agnostic toggles but hides desktop-only commands', async () => {await renderPalette({ bridge: null });diff --git a/packages/app/src/components/CommandPalette.tsx b/packages/app/src/components/CommandPalette.tsxindex 89df21a7d..e0f470017 100644--- a/packages/app/src/components/CommandPalette.tsx+++ b/packages/app/src/components/CommandPalette.tsx@@ -8,48 +8,12 @@* bridge is available.*/-import {- OPEN_KNOWLEDGE_GITHUB_URL,- SHOW_INSTALL_SKILL,- type WorktreeSelectorEntry,-} from '@inkeep/open-knowledge-core';+import type { WorktreeSelectorEntry } from '@inkeep/open-knowledge-core';import { Plural, Trans, useLingui } from '@lingui/react/macro';-import {- Blocks,- Bug,- Check,- Copy,- Download,- Eye,- FilePlus2,- FileText,- Folder,- FolderOpen,- FolderPlus,- FoldVertical,- GitBranch,- Hash,- LayoutGrid,- Loader2,- Network,- Package,- PanelLeft,- PanelRight,- Pencil,- Plus,- RefreshCw,- Settings,- Sparkles,- SpellCheck,- SquareTerminal,- Trash2,- UnfoldVertical,- X,-} from 'lucide-react';+import { Check, FileText, Folder, GitBranch, Hash, Loader2, Sparkles } from 'lucide-react';import {type Dispatch,type KeyboardEvent as ReactKeyboardEvent,- type ReactNode,type SetStateAction,useDeferredValue,useEffect,@@ -57,6 +21,12 @@ import {useState,} from 'react';import { CreateProjectDialog } from '@/components/CreateProjectDialog';+import {+ PALETTE_COMMANDS,+ type PaletteCommandContext,+ type PaletteCommandGroup,+ projectContextualTargetKind,+} from '@/components/command-palette-commands';import {filterOmnibarRecents,loadOmnibarRecents,@@ -85,12 +55,9 @@ import {TAG_QUERY_PREFIX,type TagDocEntry,} from '@/components/command-palette-tag-search';-import { requestDocPanelTab } from '@/components/doc-panel-events';import { FileEntryIcon } from '@/components/file-entry-icon';import { defaultInitialDir } from '@/components/file-tree-utils';-import { GithubIcon } from '@/components/icons/github';import { NewItemDialog } from '@/components/NewItemDialog';-import type { ResolvedNavigationTarget } from '@/components/navigation-targets';import { usePageList } from '@/components/PageListContext';import { ReportBugDialog } from '@/components/ReportBugDialog';import { SeedDialog } from '@/components/SeedDialog';@@ -111,11 +78,11 @@ import { useWorktrees } from '@/hooks/use-worktrees';import type { OkDesktopBridge, OkMenuAction, RecentProjectEntry } from '@/lib/desktop-bridge-types';import { hashFromDocName } from '@/lib/doc-hash';import { runWithToast as runWithToastBase } from '@/lib/error-state';+import { openExternalUrl as openExternalUrlViaHost } from '@/lib/external-link';import { VISIBLE_TARGETS } from '@/lib/handoff/targets';import { formatShortcut, matchesKeyboardShortcut } from '@/lib/keyboard-shortcuts';import { emitLocalMenuAction } from '@/lib/local-menu-action-bus';import { useSingleFileMode } from '@/lib/single-file-mode';-import { SETTINGS_OPEN_HASH } from '@/lib/use-settings-route';import { useWorkspace } from '@/lib/use-workspace';import { cn } from '@/lib/utils.ts';import { useViewMenuState } from '@/lib/view-menu-state-store';@@ -152,53 +119,6 @@ interface CommandPaletteProps {onOpenChange: Dispatch<SetStateAction<boolean>>;}-/**- * A backfilled Cmd+K command. Rendered search-only so the empty-- * open state is unchanged. `run` dispatches through the smallest existing seam —- * the local menu-action bus (id-backed), a bridge invoke (main-side), or a- * direct renderer call — so no handler is re-implemented here.- */-interface BackfillCommandRow {- testid: string;- label: string;- keywords: string[];- icon: ReactNode;- group: 'file' | 'view' | 'terminal' | 'app';- available: boolean;- /** Trailing check indicator for checkbox-style View toggles (state reflection). */- checked?: boolean;- /** Accelerator glyphs for commands whose native menu item carries one. */- shortcut?: string;- run: () => void;-}--/**- * Project the palette's 7-kind {@link ResolvedNavigationTarget} onto the 4-kind- * gating the native File menu uses for contextual commands: doc-like and folder- * allow every contextual command (folder still allows Duplicate); asset-like- * (asset / skill-file / large-file) disables Duplicate; a missing / absent- * target hides them all.- */-type ContextualTargetKind = 'doc' | 'folder' | 'asset' | 'none';-function projectContextualTargetKind(- target: ResolvedNavigationTarget | null,-): ContextualTargetKind {- if (target === null) return 'none';- switch (target.kind) {- case 'doc':- case 'folder-index':- return 'doc';- case 'folder':- return 'folder';- case 'asset':- case 'skill-file':- case 'large-file':- return 'asset';- case 'missing':- return 'none';- }-}-function navigateToDocHash(docName: string): void {window.location.assign(hashFromDocName(docName));}@@ -881,55 +801,6 @@ export function CommandPalette({ bridge = null, open, onOpenChange }: CommandPalsearchStatus === 'loading' &&!showNavigation &&!showSearchPreparing;- const showCreateFile =- !inExclusiveMode && matchesCommandQuery(t`New file`, deferredQuery, ['create file']);- const showCreateFolder =- !inExclusiveMode && matchesCommandQuery(t`New folder`, deferredQuery, ['create folder']);- const showGraphCommand =- !inExclusiveMode &&- activeDocName !== null &&- matchesCommandQuery(t`Open graph`, deferredQuery, ['graph panel network']);- const showInitializeStarterPack =- !inExclusiveMode &&- matchesCommandQuery(t`Initialize starter pack`, deferredQuery, [- 'scaffold',- 'seed',- 'pack',- 'starter',- ]);- // Desktop-only — opens the same CreateProjectDialog the File → Create New- // Project… menu action and the ProjectSwitcher dropdown reach. Gated on- // `bridge !== null` so the web host never surfaces it.- const showCreateProject =- !inExclusiveMode &&- bridge !== null &&- matchesCommandQuery(t`New project`, deferredQuery, ['create new project scaffold']);- const showProjectOpenFolder =- !inExclusiveMode &&- bridge !== null &&- matchesCommandQuery(t`Open folder on disk`, deferredQuery, ['project']);- const showProjectSwitch =- !inExclusiveMode &&- !singleFile &&- bridge !== null &&- matchesCommandQuery(t`Switch project`, deferredQuery, ['switch project navigator projects']);- const showSettings =- !inExclusiveMode &&- !singleFile &&- matchesCommandQuery(t`Settings`, deferredQuery, ['preferences config']);- const showInstallClaudeDesktop =- SHOW_INSTALL_SKILL &&- !inExclusiveMode &&- matchesCommandQuery(t`Install for Claude Chat & Cowork (Desktop App)`, deferredQuery, [- 'claude desktop install cowork',- ]);- // Desktop-only (bundle creation runs over the Electron bridge). Not gated- // on `singleFile`: with no project open the report degrades to the- // system-wide bundle, so the command stays available.- const showReportBug =- !inExclusiveMode &&- bridge !== null &&- matchesCommandQuery(t`Report a bug`, deferredQuery, ['bug report issue feedback problem']);const showProjectRecents =!inExclusiveMode &&bridge !== null &&@@ -965,285 +836,102 @@ export function CommandPalette({ bridge = null, open, onOpenChange }: CommandPalconst showTagDocsEmpty =paletteMode.kind === 'tag-docs' && tagDocsStatus === 'success' && tagDocs.length === 0;- // Backfilled Cmd+K commands. Rendered search-only (each row- // appears only under a matching query) so the empty-open state is unchanged.- // Dispatch via the smallest existing seam — the local menu-action bus- // (id-backed), a bridge invoke (main-side), or a direct renderer call — so no- // handler is re-implemented here. Host-agnostic rows (view/tree toggles,- // new-from-template, GitHub) stay available on the web host; desktop-only rows- // gate on `bridge !== null`.+ // The palette's fixed command rows render from the PALETTE_COMMANDS registry;+ // this context carries the availability inputs plus the dispatch seams+ // (menu-action bus, toast-wrapped bridge calls, dialog launchers) each+ // descriptor needs. Populations that are query/state-driven (search, tags,+ // semantic, recents, worktrees, the Open-with-AI group) stay bespoke below.const viewMenuState = useViewMenuState();- const contextualTargetKind = projectContextualTargetKind(activeTarget);- const contextualAvailable = bridge !== null && contextualTargetKind !== 'none';const runMenuAction = (action: OkMenuAction) => {onOpenChange(false);emitLocalMenuAction(action);};+ // Route through the shared opener (scheme gate + caught bridge rejection)+ // rather than an inline bridge/window.open fork. Always pass the `okDesktop`+ // key (the prop bridge, or an explicit `undefined`) so the open path is a pure+ // function of the prop: a null bridge takes the web `window.open` fallback and+ // never reaches through to the ambient `window.okDesktop` global.const openExternalUrl = (url: string) => {onOpenChange(false);- if (bridge) {- void bridge.shell.openExternal(url);- } else {- window.open(url, '_blank', 'noopener,noreferrer');+ openExternalUrlViaHost(+ url,+ bridge ? { okDesktop: { shell: bridge.shell } } : { okDesktop: undefined },+ );+ };+ const paletteCtx: PaletteCommandContext = {+ bridge,+ singleFile,+ activeDocName,+ contextualTargetKind: projectContextualTargetKind(activeTarget),+ viewMenuState,+ emitMenuAction: runMenuAction,+ runAction,+ openExternalUrl,+ closePalette: () => onOpenChange(false),+ openNewItemDialog: (kind) => setCreateDialogKind(kind),+ openSeedDialog: () => setSeedDialogOpen(true),+ openCreateProjectDialog: () => setCreateProjectOpen(true),+ openReportBugDialog: () => setReportBugOpen(true),+ };+ const visibleFixedCommands = inExclusiveMode+ ? []+ : PALETTE_COMMANDS.flatMap((cmd) => {+ if (!cmd.available(paletteCtx)) return [];+ // The search-only tier keeps the empty-open state lean; `always` rows+ // are still query-filtered once the user types.+ if (cmd.visibility === 'search-only' && trimmedDeferredQuery === '') return [];+ const label = cmd.label(paletteCtx);+ return matchesCommandQuery(label, deferredQuery, cmd.keywords) ? [{ cmd, label }] : [];+ });+ const hasVisibleFixedCommand = visibleFixedCommands.length > 0;+ // A function (not an eagerly-built record) so a heading's i18n lookup only+ // runs for groups that actually render — matching the pre-registry inline+ // `heading={t`…`}` evaluation.+ const commandGroupHeading = (group: PaletteCommandGroup): string => {+ switch (group) {+ case 'commands':+ return t`Commands`;+ case 'project':+ return t`Project`;+ case 'file':+ return t`File`;+ case 'view':+ return t`View`;+ case 'terminal':+ return t`Terminal`;+ case 'app':+ return t`Application`;}};- const backfillCommands: BackfillCommandRow[] = [- {- testid: 'command-palette-new-from-template',- label: t`New from template`,- keywords: ['template', 'create', 'new'],- icon: <FilePlus2 />,- group: 'file',- available: !singleFile,- run: () => runMenuAction('new-from-template'),- },- {- testid: 'command-palette-rename',- label: t`Rename`,- keywords: ['rename', 'file', 'folder'],- icon: <Pencil />,- group: 'file',- available: contextualAvailable,- run: () => runMenuAction('rename'),- },- {- testid: 'command-palette-duplicate',- label: t`Duplicate`,- keywords: ['duplicate', 'copy', 'file', 'folder'],- icon: <Copy />,- group: 'file',- available:- bridge !== null && (contextualTargetKind === 'doc' || contextualTargetKind === 'folder'),- shortcut: formatShortcut('file-tree-duplicate'),- run: () => runMenuAction('duplicate'),- },- {- testid: 'command-palette-move-to-trash',- label: t`Move to Trash`,- keywords: ['delete', 'trash', 'remove'],- icon: <Trash2 />,- group: 'file',- available: contextualAvailable,- shortcut: formatShortcut('file-tree-delete'),- run: () => runMenuAction('move-to-trash'),- },- {- testid: 'command-palette-reveal-in-finder',- label: t`Reveal in Finder`,- keywords: ['finder', 'reveal', 'show', 'file'],- icon: <FolderOpen />,- group: 'file',- available: contextualAvailable,- run: () => runMenuAction('reveal-in-finder'),- },- {- testid: 'command-palette-copy-full-path',- label: t`Copy full path`,- keywords: ['copy', 'path', 'absolute', 'full'],- icon: <Copy />,- group: 'file',- available: contextualAvailable,- run: () => runMenuAction('copy-full-path'),- },- {- testid: 'command-palette-copy-relative-path',- label: t`Copy relative path`,- keywords: ['copy', 'path', 'relative'],- icon: <Copy />,- group: 'file',- available: contextualAvailable,- run: () => runMenuAction('copy-relative-path'),- },- {- testid: 'command-palette-close-tab',- label: t`Close tab`,- keywords: ['close', 'tab', 'window'],- icon: <X />,- group: 'file',- available: bridge !== null,- run: () => runMenuAction('close-active-tab-or-window'),- },- {- testid: 'command-palette-new-worktree',- label: t`New worktree`,- keywords: ['worktree', 'branch', 'new'],- icon: <GitBranch />,- group: 'file',- available: bridge !== null,- run: () => runMenuAction('new-worktree'),- },- {- testid: 'command-palette-switch-worktree',- label: t`Switch worktree`,- keywords: ['worktree', 'switch', 'branch'],- icon: <GitBranch />,- group: 'file',- available: bridge !== null,- run: () => runMenuAction('switch-worktree'),- },- {- testid: 'command-palette-toggle-sidebar',- label: viewMenuState.sidebarVisible ? t`Hide sidebar` : t`Show sidebar`,- keywords: ['sidebar', 'files', 'panel', 'toggle'],- icon: <PanelLeft />,- group: 'view',- available: true,- shortcut: formatShortcut('toggle-files-sidebar'),- run: () => runMenuAction('toggle-sidebar'),- },- {- testid: 'command-palette-toggle-doc-panel',- label: viewMenuState.docPanelVisible ? t`Hide document panel` : t`Show document panel`,- keywords: ['document', 'panel', 'info', 'toggle'],- icon: <PanelRight />,- group: 'view',- available: true,- shortcut: formatShortcut('toggle-document-panel'),- run: () => runMenuAction('toggle-doc-panel'),- },- {- testid: 'command-palette-toggle-terminal',- label: viewMenuState.terminalVisible ? t`Hide Terminal` : t`Show Terminal`,- keywords: ['terminal', 'shell', 'console', 'toggle'],- icon: <SquareTerminal />,- group: 'view',- available: bridge !== null,- shortcut: formatShortcut('toggle-terminal-panel'),- run: () => runMenuAction('toggle-terminal'),- },- {- testid: 'command-palette-toggle-show-hidden-files',- label: t`Show hidden files`,- keywords: ['hidden', 'dotfiles', 'files', 'show'],- icon: <Eye />,- group: 'view',- available: true,- checked: viewMenuState.showHiddenFiles === true,- run: () => runMenuAction('toggle-show-hidden-files'),- },- {- testid: 'command-palette-toggle-show-ok-folders',- label: t`Show .ok folders`,- keywords: ['ok', 'folders', 'hidden', 'show'],- icon: <Folder />,- group: 'view',- available: true,- checked: viewMenuState.showOkFolders === true,- run: () => runMenuAction('toggle-show-ok-folders'),- },- {- testid: 'command-palette-toggle-show-only-markdown-files',- label: t`Show only markdown files`,- keywords: ['markdown', 'filter', 'files', 'only'],- icon: <FileText />,- group: 'view',- available: true,- checked: viewMenuState.showOnlyMarkdownFiles === true,- run: () => runMenuAction('toggle-show-only-markdown-files'),- },- {- testid: 'command-palette-toggle-show-skills-section',- label: t`Show skills section`,- keywords: ['skills', 'section', 'sidebar', 'show'],- icon: <Sparkles />,- group: 'view',- available: true,- checked: viewMenuState.showSkillsSection === true,- run: () => runMenuAction('toggle-show-skills-section'),- },- {- testid: 'command-palette-expand-all-tree',- label: t`Expand all`,- keywords: ['expand', 'tree', 'folders', 'all'],- icon: <UnfoldVertical />,- group: 'view',- // Mirror the native menu's smart-hide (visible: canExpandAll ?? true):- // suppress the row when the tree is already fully expanded, so searching- // "expand" doesn't surface a pure no-op. Unknown (web/pre-push) stays available.- available: viewMenuState.canExpandAll !== false,- run: () => runMenuAction('expand-all-tree'),- },- {- testid: 'command-palette-collapse-all-tree',- label: t`Collapse all`,- keywords: ['collapse', 'tree', 'folders', 'all'],- icon: <FoldVertical />,- group: 'view',- // Mirror the native menu's smart-hide (visible: canCollapseAll ?? true).- available: viewMenuState.canCollapseAll !== false,- run: () => runMenuAction('collapse-all-tree'),- },- {- testid: 'command-palette-new-terminal',- label: t`New Terminal`,- keywords: ['terminal', 'shell', 'new', 'tab'],- icon: <SquareTerminal />,- group: 'terminal',- available: bridge !== null,- run: () => runMenuAction('new-terminal'),- },- {- testid: 'command-palette-kill-terminal',- label: t`Kill Terminal`,- keywords: ['terminal', 'kill', 'close', 'session'],- icon: <SquareTerminal />,- group: 'terminal',- available: bridge !== null && viewMenuState.terminalLive === true,- run: () => runMenuAction('kill-terminal'),- },- {- testid: 'command-palette-check-for-updates',- label: t`Check for updates`,- keywords: ['update', 'upgrade', 'version', 'check'],- icon: <RefreshCw />,- group: 'app',- available: bridge !== null,- run: () =>- runAction(async () => {- await bridge?.update.checkNow();- }),- },- {- testid: 'command-palette-set-up-integrations',- label: t`Set up OpenKnowledge integrations`,- keywords: ['integrations', 'mcp', 'setup', 'claude', 'configure'],- icon: <Blocks />,- group: 'app',- available: bridge !== null,- run: () =>- runAction(async () => {- await bridge?.mcpWiring.reconfigure();- }),- },- {- testid: 'command-palette-toggle-spell-check',- label: t`Check spelling while typing`,- keywords: ['spell', 'spelling', 'check', 'typing'],- icon: <SpellCheck />,- group: 'app',- available: bridge !== null,- run: () =>- runAction(async () => {- await bridge?.spellcheck.toggle();- }),- },- {- testid: 'command-palette-open-github',- label: t`OpenKnowledge on GitHub`,- keywords: ['github', 'source', 'repository', 'code'],- icon: <GithubIcon />,- group: 'app',- available: true,- run: () => openExternalUrl(OPEN_KNOWLEDGE_GITHUB_URL),- },- ];- const visibleBackfillCommands = backfillCommands.filter(- (cmd) =>- cmd.available &&- trimmedDeferredQuery !== '' &&- matchesCommandQuery(cmd.label, deferredQuery, cmd.keywords),- );- const hasBackfillCommand = visibleBackfillCommands.length > 0;+ const renderCommandGroup = (group: PaletteCommandGroup) => {+ const rows = visibleFixedCommands.filter((row) => row.cmd.group === group);+ if (rows.length === 0) return null;+ return (+ <CommandGroup key={group} heading={commandGroupHeading(group)}>+ {rows.map(({ cmd, label }) => {+ const shortcut =+ cmd.shortcutId !== undefined && (cmd.shortcutDesktopOnly !== true || bridge !== null)+ ? formatShortcut(cmd.shortcutId)+ : null;+ return (+ <CommandItem+ key={cmd.id}+ value={`${label} ${cmd.keywords.join(' ')}`}+ onSelect={() => cmd.dispatch(paletteCtx)}+ data-testid={`command-palette-${cmd.id}`}+ >+ <cmd.icon />+ <span>{label}</span>+ {cmd.checked?.(paletteCtx) ? (+ <Check className="ml-auto text-muted-foreground" aria-hidden="true" />+ ) : null}+ {shortcut ? <CommandShortcut>{shortcut}</CommandShortcut> : null}+ </CommandItem>+ );+ })}+ </CommandGroup>+ );+ };const hasAnyResults =inExclusiveMode ||@@ -1251,19 +939,9 @@ export function CommandPalette({ bridge = null, open, onOpenChange }: CommandPalshowNavigation ||showSearchLoading ||showSearchPreparing ||- showCreateFile ||- showCreateFolder ||- showGraphCommand ||- showInitializeStarterPack ||- showCreateProject ||- showProjectOpenFolder ||- showProjectSwitch ||- showSettings ||- showInstallClaudeDesktop ||- showReportBug ||showProjectRecents ||showAgentGroup ||- hasBackfillCommand;+ hasVisibleFixedCommand;function navigateToTagDocs(tagName: string) {setQuery(`${TAG_QUERY_PREFIX}${tagName}`);@@ -1696,75 +1374,7 @@ export function CommandPalette({ bridge = null, open, onOpenChange }: CommandPal</CommandGroup>) : null}- {showCreateFile || showCreateFolder || showGraphCommand || showInitializeStarterPack ? (- <CommandGroup heading={t`Commands`}>- {showCreateFile ? (- <CommandItem- value="new file create file"- onSelect={() => {- onOpenChange(false);- setCreateDialogKind('file');- }}- data-testid="command-palette-new-file"- >- <FilePlus2 />- <span>- <Trans>New file</Trans>- </span>- <CommandShortcut>{formatShortcut('new-item')}</CommandShortcut>- </CommandItem>- ) : null}- {showCreateFolder ? (- <CommandItem- value="new folder create folder"- onSelect={() => {- onOpenChange(false);- setCreateDialogKind('folder');- }}- data-testid="command-palette-new-folder"- >- <FolderPlus />- <span>- <Trans>New folder</Trans>- </span>- {bridge ? (- <CommandShortcut>{formatShortcut('new-folder')}</CommandShortcut>- ) : null}- </CommandItem>- ) : null}- {showGraphCommand ? (- <CommandItem- value="open graph graph panel network"- onSelect={() => {- if (!activeDocName) return;- onOpenChange(false);- requestDocPanelTab('graph');- }}- data-testid="command-palette-open-graph"- >- <Network />- <span>- <Trans>Open graph</Trans>- </span>- </CommandItem>- ) : null}- {showInitializeStarterPack ? (- <CommandItem- value="initialize starter pack scaffold seed"- onSelect={() => {- onOpenChange(false);- setSeedDialogOpen(true);- }}- data-testid="command-palette-initialize-starter-pack"- >- <Package />- <span>- <Trans>Initialize starter pack</Trans>- </span>- </CommandItem>- ) : null}- </CommandGroup>- ) : null}+ {renderCommandGroup('commands')}{showAgentGroup ? (<CommandGroup heading={t`Open with AI`}>@@ -1831,116 +1441,7 @@ export function CommandPalette({ bridge = null, open, onOpenChange }: CommandPal</CommandGroup>) : null}- {showCreateProject ||- showProjectOpenFolder ||- showProjectSwitch ||- showSettings ||- showInstallClaudeDesktop ||- showReportBug ? (- <CommandGroup heading={t`Project`}>- {showCreateProject && bridge ? (- <CommandItem- value="new project create scaffold"- onSelect={() => {- onOpenChange(false);- setCreateProjectOpen(true);- }}- data-testid="command-palette-new-project"- >- <Plus />- <span>- <Trans>New project</Trans>- </span>- </CommandItem>- ) : null}- {showProjectOpenFolder && bridge ? (- <CommandItem- value="open folder on disk project"- onSelect={() =>- runAction(async () => {- const path = await bridge.dialog.openFolder();- if (!path) return;- await bridge.project.open({- path,- target: 'new-window',- entryPoint: 'pick-existing',- });- })- }- data-testid="command-palette-open-folder"- >- <FolderOpen />- <span>- <Trans>Open folder on disk</Trans>- </span>- <CommandShortcut>{formatShortcut('open-folder')}</CommandShortcut>- </CommandItem>- ) : null}- {showProjectSwitch && bridge ? (- <CommandItem- value="switch-project navigator projects"- onSelect={() =>- runAction(() => bridge.navigator.open(), t`Failed to open Project Navigator.`)- }- data-testid="command-palette-switch-project"- >- <LayoutGrid />- <span>- <Trans>Switch project</Trans>- </span>- <CommandShortcut>{formatShortcut('switch-project')}</CommandShortcut>- </CommandItem>- ) : null}- {showSettings ? (- <CommandItem- value="settings preferences config"- onSelect={() => {- onOpenChange(false);- if (window.location.hash !== SETTINGS_OPEN_HASH) {- window.location.hash = SETTINGS_OPEN_HASH;- }- }}- data-testid="command-palette-settings"- >- <Settings />- <span>- <Trans>Settings</Trans>- </span>- <CommandShortcut>{formatShortcut('settings')}</CommandShortcut>- </CommandItem>- ) : null}- {showInstallClaudeDesktop ? (- <CommandItem- value="install claude desktop cowork app"- onSelect={() => {- onOpenChange(false);- window.location.hash = '#install-claude-desktop';- }}- data-testid="command-palette-install-claude-desktop"- >- <Download />- <span>- <Trans>Install for Claude Chat & Cowork (Desktop App)</Trans>- </span>- </CommandItem>- ) : null}- {showReportBug ? (- <CommandItem- value="report a bug issue feedback"- onSelect={() => {- onOpenChange(false);- setReportBugOpen(true);- }}- data-testid="command-palette-report-bug"- >- <Bug />- <span>- <Trans>Report a bug</Trans>- </span>- </CommandItem>- ) : null}- </CommandGroup>- ) : null}+ {renderCommandGroup('project')}{showProjectRecents && bridge ? (<CommandGroup heading={t`Open recent project`}>@@ -2025,37 +1526,9 @@ export function CommandPalette({ bridge = null, open, onOpenChange }: CommandPal</CommandGroup>) : null}- {(['file', 'view', 'terminal', 'app'] as const).map((groupKey) => {- const rows = visibleBackfillCommands.filter((cmd) => cmd.group === groupKey);- if (rows.length === 0) return null;- const heading =- groupKey === 'file'- ? t`File`- : groupKey === 'view'- ? t`View`- : groupKey === 'terminal'- ? t`Terminal`- : t`Application`;- return (- <CommandGroup key={groupKey} heading={heading}>- {rows.map((cmd) => (- <CommandItem- key={cmd.testid}- value={`${cmd.label} ${cmd.keywords.join(' ')}`}- onSelect={cmd.run}- data-testid={cmd.testid}- >- {cmd.icon}- <span>{cmd.label}</span>- {cmd.checked ? (- <Check className="ml-auto text-muted-foreground" aria-hidden="true" />- ) : null}- {cmd.shortcut ? <CommandShortcut>{cmd.shortcut}</CommandShortcut> : null}- </CommandItem>- ))}- </CommandGroup>- );- })}+ {(['file', 'view', 'terminal', 'app'] as const).map((groupKey) =>+ renderCommandGroup(groupKey),+ )}{showNavigation ? (<CommandGroup heading={t`Search`}>@@ -2103,8 +1576,8 @@ export function CommandPalette({ bridge = null, open, onOpenChange }: CommandPalinitialDir={initialCreateDir}/><SeedDialog open={seedDialogOpen} onOpenChange={setSeedDialogOpen} />- {/* Desktop-only — `showCreateProject` gates the launching command on- `bridge !== null`, so the dialog only mounts when the bridge exists. */}+ {/* Desktop-only — the registry gates the launching "New project" command+ on `bridge !== null`, so the dialog only mounts when the bridge exists. */}{bridge ? (<CreateProjectDialogopen={createProjectOpen}@@ -2112,8 +1585,8 @@ export function CommandPalette({ bridge = null, open, onOpenChange }: CommandPalbridge={bridge}/>) : null}- {/* Desktop-only — `showReportBug` gates the launching command on- `bridge !== null`, so the dialog only mounts when the bridge exists. */}+ {/* Desktop-only — the registry gates the launching "Report a bug" command+ on `bridge !== null`, so the dialog only mounts when the bridge exists. */}{bridge ? <ReportBugDialog open={reportBugOpen} onOpenChange={setReportBugOpen} /> : null}</>);diff --git a/packages/app/src/components/command-palette-commands.ts b/packages/app/src/components/command-palette-commands.tsnew file mode 100644index 000000000..9ab4922db--- /dev/null+++ b/packages/app/src/components/command-palette-commands.ts@@ -0,0 +1,615 @@+import { OPEN_KNOWLEDGE_GITHUB_URL, SHOW_INSTALL_SKILL } from '@inkeep/open-knowledge-core';+import { t } from '@lingui/core/macro';+import {+ Blocks,+ Bug,+ Copy,+ Download,+ Eye,+ FilePlus2,+ FileText,+ Folder,+ FolderOpen,+ FolderPlus,+ FoldVertical,+ GitBranch,+ LayoutGrid,+ Network,+ Package,+ PanelLeft,+ PanelRight,+ Pencil,+ Plus,+ RefreshCw,+ Settings,+ Sparkles,+ SpellCheck,+ SquareTerminal,+ Trash2,+ UnfoldVertical,+ X,+} from 'lucide-react';+import type { ComponentType } from 'react';+import { requestDocPanelTab } from '@/components/doc-panel-events';+import { GithubIcon } from '@/components/icons/github';+import type { ResolvedNavigationTarget } from '@/components/navigation-targets';+import type { OkDesktopBridge, OkMenuAction } from '@/lib/desktop-bridge-types';+import type { KeyboardShortcutId } from '@/lib/keyboard-shortcuts';+import { SETTINGS_OPEN_HASH } from '@/lib/use-settings-route';+import type { ViewMenuState } from '@/lib/view-menu-state-store';++/**+ * The command registry for the Cmd+K palette's FIXED command rows — the single+ * source of truth the palette renders from, and the source the parity ratchets+ * derive their palette-reachable id classification from+ * (`command-menu-parity.test-helper.ts`).+ *+ * Fixed commands only. The palette's query/state-driven populations stay+ * bespoke in `CommandPalette.tsx` and are deliberately NOT registry entries:+ * search results, tag mode, semantic ("by meaning"), recents, the recent-project+ * and worktree-switch lists, and the per-target Open-with-AI group (`send-to-ai`+ * is one install-gated row per agent target, which a single descriptor cannot+ * represent).+ *+ * The native menu stays hand-authored (`packages/desktop/src/main/menu.ts`);+ * Ratchet B classifies its leaves against this registry's id space. Rendering+ * the menu from the registry is a separate step gated on where labels and+ * availability predicates can live (the menu runs in the Electron main process,+ * outside the Lingui macro pipeline).+ */++/**+ * Projection of the palette's 7-kind {@link ResolvedNavigationTarget} onto the+ * 4-kind gating the native File menu uses for contextual commands: doc-like and+ * folder allow every contextual command (folder still allows Duplicate);+ * asset-like (asset / skill-file / large-file) disables Duplicate; a missing /+ * absent target hides them all.+ */+export type ContextualTargetKind = 'doc' | 'folder' | 'asset' | 'none';++export function projectContextualTargetKind(+ target: ResolvedNavigationTarget | null,+): ContextualTargetKind {+ if (target === null) return 'none';+ switch (target.kind) {+ case 'doc':+ case 'folder-index':+ return 'doc';+ case 'folder':+ return 'folder';+ case 'asset':+ case 'skill-file':+ case 'large-file':+ return 'asset';+ case 'missing':+ return 'none';+ }+}++/**+ * Everything a command needs to decide availability and to dispatch. The+ * palette component assembles this per render: state snapshots for+ * `available` / `label` / `checked`, and dispatch seams that reuse the existing+ * handlers (the local menu-action bus, toast-wrapped bridge calls, and the+ * palette's own dialog launchers) so no handler logic is re-implemented here.+ */+export interface PaletteCommandContext {+ bridge: OkDesktopBridge | null;+ /** No-project single-file session: project-scoped commands are hidden. */+ singleFile: boolean;+ activeDocName: string | null;+ contextualTargetKind: ContextualTargetKind;+ viewMenuState: ViewMenuState;+ /** Close the palette and emit the id on the local menu-action bus. */+ emitMenuAction(action: OkMenuAction): void;+ /** Close the palette and run `fn` with rejection surfaced as a toast. */+ runAction(fn: () => Promise<void> | void, fallback?: string): void;+ /** Close the palette and open `url` via the bridge shell (or window.open on web). */+ openExternalUrl(url: string): void;+ closePalette(): void;+ openNewItemDialog(kind: 'file' | 'folder'): void;+ openSeedDialog(): void;+ openCreateProjectDialog(): void;+ openReportBugDialog(): void;+}++/** Render-order buckets; the palette renders each group under its own heading. */+export type PaletteCommandGroup = 'commands' | 'project' | 'file' | 'view' | 'terminal' | 'app';++export interface PaletteCommand {+ /** Stable row id; the DOM testid is `command-palette-${id}`. */+ id: string;+ /**+ * The `OkMenuAction` this row makes palette-reachable, feeding the derived+ * `PALETTE_COMMAND_IDS` classification (Ratchets A/C). Two roles:+ * - `busDispatch` rows: this IS the id `dispatch` emits on the menu-action+ * bus, and the DOM suite's `ID_BACKED` loop pins that emission, so the two+ * cannot drift.+ * - dialog rows (whose `dispatch` opens a dialog instead of calling+ * `emitMenuAction`): a classification-only annotation. Dispatch emits+ * nothing, so no dispatch test guards it; set it by hand to the matching+ * native menu leaf's action.+ * Absent for commands with no menu-action id (Settings, Open graph, …).+ */+ menuActionId?: OkMenuAction;+ /**+ * Localized label, resolved at render time so it tracks the active locale+ * and can reflect state (Show/Hide toggles read `ctx.viewMenuState`).+ */+ label(ctx: PaletteCommandContext): string;+ /** Extra `matchesCommandQuery` tokens beyond the label. Not localized. */+ keywords: readonly string[];+ icon: ComponentType<{ className?: string }>;+ group: PaletteCommandGroup;+ /**+ * `always` rows render on empty open (query-filtered once the user types);+ * `search-only` rows render only under a matching non-empty query, keeping+ * the empty-open state lean.+ */+ visibility: 'always' | 'search-only';+ /** Accelerator glyphs rendered via `formatShortcut(shortcutId)`. */+ shortcutId?: KeyboardShortcutId;+ /**+ * The binding only fires through a native-menu accelerator, so the glyphs+ * render on the desktop host only.+ */+ shortcutDesktopOnly?: boolean;+ /** Trailing check indicator for checkbox-style View toggles. */+ checked?(ctx: PaletteCommandContext): boolean;+ available(ctx: PaletteCommandContext): boolean;+ dispatch(ctx: PaletteCommandContext): void;+}++const contextualAvailable = (ctx: PaletteCommandContext): boolean =>+ ctx.bridge !== null && ctx.contextualTargetKind !== 'none';++/**+ * Fields for a command whose dispatch is exactly "emit this id on the local+ * menu-action bus": one action literal produces BOTH the classification+ * (`menuActionId`) and the dispatch that emits it, so the two cannot drift.+ */+const busDispatch = (action: OkMenuAction): Pick<PaletteCommand, 'menuActionId' | 'dispatch'> => ({+ menuActionId: action,+ dispatch: (ctx) => ctx.emitMenuAction(action),+});++export const PALETTE_COMMANDS: readonly PaletteCommand[] = [+ // ── Commands ──────────────────────────────────────────────────────────────+ {+ id: 'new-file',+ menuActionId: 'new-doc',+ label: () => t`New file`,+ keywords: ['create file'],+ icon: FilePlus2,+ group: 'commands',+ visibility: 'always',+ shortcutId: 'new-item',+ available: () => true,+ dispatch: (ctx) => {+ ctx.closePalette();+ ctx.openNewItemDialog('file');+ },+ },+ {+ id: 'new-folder',+ menuActionId: 'new-folder',+ label: () => t`New folder`,+ keywords: ['create folder'],+ icon: FolderPlus,+ group: 'commands',+ visibility: 'always',+ shortcutId: 'new-folder',+ // The ⇧⌘N chord is a native-menu accelerator with no web keydown handler.+ shortcutDesktopOnly: true,+ available: () => true,+ dispatch: (ctx) => {+ ctx.closePalette();+ ctx.openNewItemDialog('folder');+ },+ },+ {+ id: 'open-graph',+ label: () => t`Open graph`,+ keywords: ['graph panel network'],+ icon: Network,+ group: 'commands',+ visibility: 'always',+ available: (ctx) => ctx.activeDocName !== null,+ dispatch: (ctx) => {+ ctx.closePalette();+ requestDocPanelTab('graph');+ },+ },+ {+ id: 'initialize-starter-pack',+ label: () => t`Initialize starter pack`,+ keywords: ['scaffold', 'seed', 'pack', 'starter'],+ icon: Package,+ group: 'commands',+ visibility: 'always',+ available: () => true,+ dispatch: (ctx) => {+ ctx.closePalette();+ ctx.openSeedDialog();+ },+ },+ // ── Project ───────────────────────────────────────────────────────────────+ {+ id: 'new-project',+ menuActionId: 'new-project',+ label: () => t`New project`,+ keywords: ['create new project scaffold'],+ icon: Plus,+ group: 'project',+ visibility: 'always',+ available: (ctx) => ctx.bridge !== null,+ dispatch: (ctx) => {+ ctx.closePalette();+ ctx.openCreateProjectDialog();+ },+ },+ {+ id: 'open-folder',+ label: () => t`Open folder on disk`,+ keywords: ['project'],+ icon: FolderOpen,+ group: 'project',+ visibility: 'always',+ shortcutId: 'open-folder',+ available: (ctx) => ctx.bridge !== null,+ dispatch: (ctx) => {+ const bridge = ctx.bridge;+ if (!bridge) return;+ ctx.runAction(async () => {+ const path = await bridge.dialog.openFolder();+ if (!path) return;+ await bridge.project.open({+ path,+ target: 'new-window',+ entryPoint: 'pick-existing',+ });+ });+ },+ },+ {+ id: 'switch-project',+ label: () => t`Switch project`,+ keywords: ['switch project navigator projects'],+ icon: LayoutGrid,+ group: 'project',+ visibility: 'always',+ shortcutId: 'switch-project',+ available: (ctx) => ctx.bridge !== null && !ctx.singleFile,+ dispatch: (ctx) => {+ const bridge = ctx.bridge;+ if (!bridge) return;+ ctx.runAction(() => bridge.navigator.open(), t`Failed to open Project Navigator.`);+ },+ },+ {+ id: 'settings',+ label: () => t`Settings`,+ keywords: ['preferences config'],+ icon: Settings,+ group: 'project',+ visibility: 'always',+ shortcutId: 'settings',+ available: (ctx) => !ctx.singleFile,+ dispatch: (ctx) => {+ ctx.closePalette();+ if (window.location.hash !== SETTINGS_OPEN_HASH) {+ window.location.hash = SETTINGS_OPEN_HASH;+ }+ },+ },+ {+ id: 'install-claude-desktop',+ label: () => t`Install for Claude Chat & Cowork (Desktop App)`,+ keywords: ['claude desktop install cowork'],+ icon: Download,+ group: 'project',+ visibility: 'always',+ available: () => SHOW_INSTALL_SKILL,+ dispatch: (ctx) => {+ ctx.closePalette();+ window.location.hash = '#install-claude-desktop';+ },+ },+ {+ id: 'report-bug',+ menuActionId: 'report-bug',+ label: () => t`Report a bug`,+ keywords: ['bug report issue feedback problem'],+ icon: Bug,+ group: 'project',+ visibility: 'always',+ // Bundle creation runs over the Electron bridge. Not gated on `singleFile`:+ // with no project open the report degrades to the system-wide bundle.+ available: (ctx) => ctx.bridge !== null,+ dispatch: (ctx) => {+ ctx.closePalette();+ ctx.openReportBugDialog();+ },+ },+ // ── File ──────────────────────────────────────────────────────────────────+ {+ id: 'new-from-template',+ ...busDispatch('new-from-template'),+ label: () => t`New from template`,+ keywords: ['template', 'create', 'new'],+ icon: FilePlus2,+ group: 'file',+ visibility: 'search-only',+ available: (ctx) => !ctx.singleFile,+ },+ {+ id: 'rename',+ ...busDispatch('rename'),+ label: () => t`Rename`,+ keywords: ['rename', 'file', 'folder'],+ icon: Pencil,+ group: 'file',+ visibility: 'search-only',+ available: contextualAvailable,+ },+ {+ id: 'duplicate',+ ...busDispatch('duplicate'),+ label: () => t`Duplicate`,+ keywords: ['duplicate', 'copy', 'file', 'folder'],+ icon: Copy,+ group: 'file',+ visibility: 'search-only',+ shortcutId: 'file-tree-duplicate',+ available: (ctx) =>+ ctx.bridge !== null &&+ (ctx.contextualTargetKind === 'doc' || ctx.contextualTargetKind === 'folder'),+ },+ {+ id: 'move-to-trash',+ ...busDispatch('move-to-trash'),+ label: () => t`Move to Trash`,+ keywords: ['delete', 'trash', 'remove'],+ icon: Trash2,+ group: 'file',+ visibility: 'search-only',+ shortcutId: 'file-tree-delete',+ available: contextualAvailable,+ },+ {+ id: 'reveal-in-finder',+ ...busDispatch('reveal-in-finder'),+ label: () => t`Reveal in Finder`,+ keywords: ['finder', 'reveal', 'show', 'file'],+ icon: FolderOpen,+ group: 'file',+ visibility: 'search-only',+ available: contextualAvailable,+ },+ {+ id: 'copy-full-path',+ ...busDispatch('copy-full-path'),+ label: () => t`Copy full path`,+ keywords: ['copy', 'path', 'absolute', 'full'],+ icon: Copy,+ group: 'file',+ visibility: 'search-only',+ available: contextualAvailable,+ },+ {+ id: 'copy-relative-path',+ ...busDispatch('copy-relative-path'),+ label: () => t`Copy relative path`,+ keywords: ['copy', 'path', 'relative'],+ icon: Copy,+ group: 'file',+ visibility: 'search-only',+ available: contextualAvailable,+ },+ {+ id: 'close-tab',+ ...busDispatch('close-active-tab-or-window'),+ label: () => t`Close tab`,+ keywords: ['close', 'tab', 'window'],+ icon: X,+ group: 'file',+ visibility: 'search-only',+ available: (ctx) => ctx.bridge !== null,+ },+ {+ id: 'new-worktree',+ ...busDispatch('new-worktree'),+ label: () => t`New worktree`,+ keywords: ['worktree', 'branch', 'new'],+ icon: GitBranch,+ group: 'file',+ visibility: 'search-only',+ available: (ctx) => ctx.bridge !== null,+ },+ {+ id: 'switch-worktree',+ ...busDispatch('switch-worktree'),+ label: () => t`Switch worktree`,+ keywords: ['worktree', 'switch', 'branch'],+ icon: GitBranch,+ group: 'file',+ visibility: 'search-only',+ available: (ctx) => ctx.bridge !== null,+ },+ // ── View ──────────────────────────────────────────────────────────────────+ {+ id: 'toggle-sidebar',+ ...busDispatch('toggle-sidebar'),+ label: (ctx) => (ctx.viewMenuState.sidebarVisible ? t`Hide sidebar` : t`Show sidebar`),+ keywords: ['sidebar', 'files', 'panel', 'toggle'],+ icon: PanelLeft,+ group: 'view',+ visibility: 'search-only',+ shortcutId: 'toggle-files-sidebar',+ available: () => true,+ },+ {+ id: 'toggle-doc-panel',+ ...busDispatch('toggle-doc-panel'),+ label: (ctx) =>+ ctx.viewMenuState.docPanelVisible ? t`Hide document panel` : t`Show document panel`,+ keywords: ['document', 'panel', 'info', 'toggle'],+ icon: PanelRight,+ group: 'view',+ visibility: 'search-only',+ shortcutId: 'toggle-document-panel',+ available: () => true,+ },+ {+ id: 'toggle-terminal',+ ...busDispatch('toggle-terminal'),+ label: (ctx) => (ctx.viewMenuState.terminalVisible ? t`Hide Terminal` : t`Show Terminal`),+ keywords: ['terminal', 'shell', 'console', 'toggle'],+ icon: SquareTerminal,+ group: 'view',+ visibility: 'search-only',+ shortcutId: 'toggle-terminal-panel',+ available: (ctx) => ctx.bridge !== null,+ },+ {+ id: 'toggle-show-hidden-files',+ ...busDispatch('toggle-show-hidden-files'),+ label: () => t`Show hidden files`,+ keywords: ['hidden', 'dotfiles', 'files', 'show'],+ icon: Eye,+ group: 'view',+ visibility: 'search-only',+ checked: (ctx) => ctx.viewMenuState.showHiddenFiles === true,+ available: () => true,+ },+ {+ id: 'toggle-show-ok-folders',+ ...busDispatch('toggle-show-ok-folders'),+ label: () => t`Show .ok folders`,+ keywords: ['ok', 'folders', 'hidden', 'show'],+ icon: Folder,+ group: 'view',+ visibility: 'search-only',+ checked: (ctx) => ctx.viewMenuState.showOkFolders === true,+ available: () => true,+ },+ {+ id: 'toggle-show-only-markdown-files',+ ...busDispatch('toggle-show-only-markdown-files'),+ label: () => t`Show only markdown files`,+ keywords: ['markdown', 'filter', 'files', 'only'],+ icon: FileText,+ group: 'view',+ visibility: 'search-only',+ checked: (ctx) => ctx.viewMenuState.showOnlyMarkdownFiles === true,+ available: () => true,+ },+ {+ id: 'toggle-show-skills-section',+ ...busDispatch('toggle-show-skills-section'),+ label: () => t`Show skills section`,+ keywords: ['skills', 'section', 'sidebar', 'show'],+ icon: Sparkles,+ group: 'view',+ visibility: 'search-only',+ checked: (ctx) => ctx.viewMenuState.showSkillsSection === true,+ available: () => true,+ },+ {+ id: 'expand-all-tree',+ ...busDispatch('expand-all-tree'),+ label: () => t`Expand all`,+ keywords: ['expand', 'tree', 'folders', 'all'],+ icon: UnfoldVertical,+ group: 'view',+ visibility: 'search-only',+ // Mirror the native menu's smart-hide (visible: canExpandAll ?? true):+ // suppress the row when the tree is already fully expanded, so searching+ // "expand" doesn't surface a pure no-op. Unknown (web/pre-push) stays available.+ available: (ctx) => ctx.viewMenuState.canExpandAll !== false,+ },+ {+ id: 'collapse-all-tree',+ ...busDispatch('collapse-all-tree'),+ label: () => t`Collapse all`,+ keywords: ['collapse', 'tree', 'folders', 'all'],+ icon: FoldVertical,+ group: 'view',+ visibility: 'search-only',+ // Mirror the native menu's smart-hide (visible: canCollapseAll ?? true).+ available: (ctx) => ctx.viewMenuState.canCollapseAll !== false,+ },+ // ── Terminal ──────────────────────────────────────────────────────────────+ {+ id: 'new-terminal',+ ...busDispatch('new-terminal'),+ label: () => t`New Terminal`,+ keywords: ['terminal', 'shell', 'new', 'tab'],+ icon: SquareTerminal,+ group: 'terminal',+ visibility: 'search-only',+ available: (ctx) => ctx.bridge !== null,+ },+ {+ id: 'kill-terminal',+ ...busDispatch('kill-terminal'),+ label: () => t`Kill Terminal`,+ keywords: ['terminal', 'kill', 'close', 'session'],+ icon: SquareTerminal,+ group: 'terminal',+ visibility: 'search-only',+ available: (ctx) => ctx.bridge !== null && ctx.viewMenuState.terminalLive === true,+ },+ // ── Application ───────────────────────────────────────────────────────────+ {+ id: 'check-for-updates',+ label: () => t`Check for updates`,+ keywords: ['update', 'upgrade', 'version', 'check'],+ icon: RefreshCw,+ group: 'app',+ visibility: 'search-only',+ available: (ctx) => ctx.bridge !== null,+ dispatch: (ctx) =>+ ctx.runAction(async () => {+ await ctx.bridge?.update.checkNow();+ }),+ },+ {+ id: 'set-up-integrations',+ label: () => t`Set up OpenKnowledge integrations`,+ keywords: ['integrations', 'mcp', 'setup', 'claude', 'configure'],+ icon: Blocks,+ group: 'app',+ visibility: 'search-only',+ available: (ctx) => ctx.bridge !== null,+ dispatch: (ctx) =>+ ctx.runAction(async () => {+ await ctx.bridge?.mcpWiring.reconfigure();+ }),+ },+ {+ id: 'toggle-spell-check',+ label: () => t`Check spelling while typing`,+ keywords: ['spell', 'spelling', 'check', 'typing'],+ icon: SpellCheck,+ group: 'app',+ visibility: 'search-only',+ // App-wide flag owned by the Electron main process (not view-menu-state):+ // the invoke reads + toggles it there, so the row carries no checkmark.+ available: (ctx) => ctx.bridge !== null,+ dispatch: (ctx) =>+ ctx.runAction(async () => {+ await ctx.bridge?.spellcheck.toggle();+ }),+ },+ {+ id: 'open-github',+ label: () => t`OpenKnowledge on GitHub`,+ keywords: ['github', 'source', 'repository', 'code'],+ icon: GithubIcon,+ group: 'app',+ visibility: 'search-only',+ available: () => true,+ dispatch: (ctx) => ctx.openExternalUrl(OPEN_KNOWLEDGE_GITHUB_URL),+ },+];diff --git a/packages/app/src/lib/command-menu-parity.test-helper.ts b/packages/app/src/lib/command-menu-parity.test-helper.tsindex c36c380c7..9b1128790 100644--- a/packages/app/src/lib/command-menu-parity.test-helper.ts+++ b/packages/app/src/lib/command-menu-parity.test-helper.ts@@ -8,35 +8,17 @@* suite red instead of silently satisfying only the id-classification ratchets.*/-// Ids reachable from Cmd+K after Phase 1 (backfilled or already present).-// `send-to-ai` is palette-present via the per-target Open-with-AI group.+import { PALETTE_COMMANDS } from '@/components/command-palette-commands';++// Ids reachable from Cmd+K — derived from the palette's command registry+// (every descriptor that declares a `menuActionId`), not a parallel+// hand-maintained list, so a registry row automatically classifies its id.+// `send-to-ai` is the one addition the registry cannot carry: it is+// palette-present via the bespoke per-target Open-with-AI group, which is not a+// fixed command row.export const PALETTE_COMMAND_IDS = new Set<string>([- 'new-doc',- 'new-folder',- 'new-project',- 'new-from-template',- 'rename',- 'duplicate',- 'move-to-trash',- 'reveal-in-finder',+ ...PALETTE_COMMANDS.flatMap((cmd) => (cmd.menuActionId ? [cmd.menuActionId] : [])),'send-to-ai',- 'copy-full-path',- 'copy-relative-path',- 'toggle-sidebar',- 'toggle-show-hidden-files',- 'toggle-show-ok-folders',- 'toggle-show-only-markdown-files',- 'toggle-show-skills-section',- 'expand-all-tree',- 'collapse-all-tree',- 'toggle-doc-panel',- 'toggle-terminal',- 'new-terminal',- 'kill-terminal',- 'new-worktree',- 'switch-worktree',- 'close-active-tab-or-window',- 'report-bug',]);// Ids deliberately NOT palette rows — each with a stated reason.@@ -49,15 +31,15 @@ export const APP_RESERVED_IDS = new Map<string, string>([['focus-command-palette', 'focus-routing id; self-referential inside the palette'],]);-// Palette-command ids that reach Cmd+K through a PRE-EXISTING surface rather than-// a backfilled id-backed row, so they carry no `ID_BACKED` entry in the DOM-// suite. Each has its own rendered palette row/group (verified below), so Ratchet-// C treats them as covered:-// new-doc → the pre-existing "New file" row (testid command-palette-new-file)-// new-folder → the pre-existing "New folder" row-// new-project → the pre-existing "New project" row-// send-to-ai → the per-target "Open with AI" group-// report-bug → the pre-existing "Report a Bug" row+// Palette-command ids that reach Cmd+K through a surface other than a+// bus-dispatched registry row, so they carry no `ID_BACKED` entry in the DOM+// suite. Each has its own rendered palette row/group (verified there), so+// Ratchet C treats them as covered:+// new-doc → the registry "New file" row (opens NewItemDialog)+// new-folder → the registry "New folder" row (opens NewItemDialog)+// new-project → the registry "New project" row (opens CreateProjectDialog)+// send-to-ai → the bespoke per-target "Open with AI" group+// report-bug → the registry "Report a bug" row (opens ReportBugDialog)export const PRE_EXISTING_PALETTE_IDS = new Set<string>(['new-doc','new-folder',diff --git a/packages/app/src/lib/command-menu-parity.test.ts b/packages/app/src/lib/command-menu-parity.test.tsindex f0475e4bc..f9c4ee5b7 100644--- a/packages/app/src/lib/command-menu-parity.test.ts+++ b/packages/app/src/lib/command-menu-parity.test.ts@@ -18,6 +18,7 @@import { describe, expect, test } from 'bun:test';import { readdirSync, readFileSync } from 'node:fs';import { join, relative } from 'node:path';+import { PALETTE_COMMANDS } from '@/components/command-palette-commands';import { APP_RESERVED_IDS, PALETTE_COMMAND_IDS } from '@/lib/command-menu-parity.test-helper';import { formatShortcut, type KeyboardShortcutId } from '@/lib/keyboard-shortcuts';import { OK_MENU_ACTIONS } from '@/lib/ok-menu-actions';@@ -237,6 +238,19 @@ describe('command-menu parity ratchet', () => {expect(stale).toEqual([]);});+ // The classification derives from the registry, so a duplicate row id (two+ // rows fighting over one testid) or a duplicate menuActionId (two rows+ // claiming to cover the same menu action) would silently collapse in the+ // derived Set. Pin uniqueness here instead.+ test('registry invariants: command ids and menu-action ids are unique', () => {+ const ids = PALETTE_COMMANDS.map((cmd) => cmd.id);+ expect(new Set(ids).size).toBe(ids.length);+ const menuActionIds = PALETTE_COMMANDS.flatMap((cmd) =>+ cmd.menuActionId ? [cmd.menuActionId] : [],+ );+ expect(new Set(menuActionIds).size).toBe(menuActionIds.length);+ });+test('Ratchet B: every actionable menu leaf is classified across both platforms', () => {const leaves = [...collectLeavesForPlatform('darwin'), ...collectLeavesForPlatform('win32')];const untracked = leaves.filter((leaf) => {@@ -247,6 +261,29 @@ describe('command-menu parity ratchet', () => {expect(untracked.map((l) => l.role ?? normalizeLabel(l.label))).toEqual([]);});+ // A hand-authored menu can place the same command in two sections of the same+ // platform's menu bar (the macOS App-menu + Help-menu "Check for updates…"+ // dupe was the live case, fixed via platform-XOR). Fail structurally when a+ // non-role leaf label appears more than once in one platform's template, so+ // the class cannot recur. A future deliberate multi-placement earns an entry+ // in the allowlist below with its reason.+ const DECLARED_MULTI_PLACEMENT = new Set<string>([]);++ test('Ratchet B: no menu leaf label appears twice in the same platform menu', () => {+ for (const platform of ['darwin', 'win32'] as const) {+ const counts = new Map<string, number>();+ for (const leaf of collectLeavesForPlatform(platform)) {+ if (leaf.role) continue;+ const label = normalizeLabel(leaf.label);+ counts.set(label, (counts.get(label) ?? 0) + 1);+ }+ const dupes = [...counts]+ .filter(([label, count]) => count > 1 && !DECLARED_MULTI_PLACEMENT.has(label))+ .map(([label]) => label);+ expect({ platform, dupes }).toEqual({ platform, dupes: [] });+ }+ });+test('Ratchet B sanity: the sweep actually found the backfilled leaves', () => {const labels = new Set(collectLeavesForPlatform('darwin').map((l) => normalizeLabel(l.label)));// A few representative backfilled palette leaves must be present, or the sweep is inert.diff --git a/packages/app/src/locales/en/messages.po b/packages/app/src/locales/en/messages.poindex 84a5829fd..0486384cf 100644--- a/packages/app/src/locales/en/messages.po+++ b/packages/app/src/locales/en/messages.po@@ -1396,7 +1396,7 @@ msgstr "Cancelled"msgid "Cannot upload: no document is open"msgstr "Cannot upload: no document is open"-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.tsmsgid "Check for updates"msgstr "Check for updates"@@ -1408,7 +1408,7 @@ msgstr "Check out remote branch"msgid "Check out worktree"msgstr "Check out worktree"-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.tsmsgid "Check spelling while typing"msgstr "Check spelling while typing"@@ -1610,7 +1610,7 @@ msgstr "Close new tab"msgid "Close others"msgstr "Close others"-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.tsmsgid "Close tab"msgstr "Close tab"@@ -1671,7 +1671,7 @@ msgstr "Collapse {docName}"msgid "Collapse {keyName}"msgstr "Collapse {keyName}"-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/FileSidebar.tsx#: src/components/FileTree.tsxmsgid "Collapse all"@@ -1967,7 +1967,7 @@ msgstr "Copy code {userCode}"msgid "Copy command"msgstr "Copy command"-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/FileSidebar.tsxmsgid "Copy full path"msgstr "Copy full path"@@ -1984,7 +1984,7 @@ msgstr "Copy path"msgid "Copy Path"msgstr "Copy Path"-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.tsmsgid "Copy relative path"msgstr "Copy relative path"@@ -2910,7 +2910,7 @@ msgstr "Drag {patternText} to reorder"msgid "Drag item {0} to reorder"msgstr "Drag item {0} to reorder"-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/FileTree.tsx#: src/components/skill-actions.tsxmsgid "Duplicate"@@ -3211,7 +3211,7 @@ msgstr "Expand {docName}"msgid "Expand {keyName}"msgstr "Expand {keyName}"-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/FileSidebar.tsx#: src/components/FileTree.tsxmsgid "Expand all"@@ -3423,7 +3423,7 @@ msgstr "Failed to open cloned project."msgid "Failed to open folder."msgstr "Failed to open folder."-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/ProjectSwitcher.tsxmsgid "Failed to open Project Navigator."msgstr "Failed to open Project Navigator."@@ -3959,7 +3959,7 @@ msgstr "Hide"msgid "Hide advanced"msgstr "Hide advanced"-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.tsmsgid "Hide document panel"msgstr "Hide document panel"@@ -4007,11 +4007,11 @@ msgstr "Hide replace"msgid "Hide selection preview"msgstr "Hide selection preview"-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.tsmsgid "Hide sidebar"msgstr "Hide sidebar"-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.tsmsgid "Hide Terminal"msgstr "Hide Terminal"@@ -4187,7 +4187,7 @@ msgstr "Initialize and open"msgid "Initialize failed: {errorDetail}"msgstr "Initialize failed: {errorDetail}"-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.tsmsgid "Initialize starter pack"msgstr "Initialize starter pack"@@ -4256,7 +4256,7 @@ msgstr "Install an AI agent to create with AI"msgid "Install for Claude Chat & Cowork"msgstr "Install for Claude Chat & Cowork"-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.tsmsgid "Install for Claude Chat & Cowork (Desktop App)"msgstr "Install for Claude Chat & Cowork (Desktop App)"@@ -4385,7 +4385,7 @@ msgstr "Key ending in {keyHint}"msgid "Keyboard shortcuts available in the editor and workspace."msgstr "Keyboard shortcuts available in the editor and workspace."-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.tsmsgid "Kill Terminal"msgstr "Kill Terminal"@@ -4818,7 +4818,7 @@ msgstr "Move to the next visual-editor find result."msgid "Move to the previous visual-editor find result."msgstr "Move to the previous visual-editor find result."-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.tsmsgid "Move to Trash"msgstr "Move to Trash"@@ -4954,7 +4954,7 @@ msgstr "New branch <0>{trimmed}</0> will be created from the current commit, inmsgid "New chat"msgstr "New chat"-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/FileSidebar.tsx#: src/components/FileTree.tsx#: src/components/NewItemDialog.tsx@@ -4970,7 +4970,7 @@ msgstr "New file from template \"{displayTitle}\" ({fileName}) in {targetLabel}"msgid "New file from template \"{displayTitle}\" ({fileName}) in the project root"msgstr "New file from template \"{displayTitle}\" ({fileName}) in the project root"-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/FileSidebar.tsx#: src/components/FileTree.tsx#: src/components/NewItemDialog.tsx@@ -4978,7 +4978,7 @@ msgstr "New file from template \"{displayTitle}\" ({fileName}) in the project romsgid "New folder"msgstr "New folder"-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/FileSidebar.tsx#: src/components/FileTree.tsxmsgid "New from template"@@ -4988,7 +4988,7 @@ msgstr "New from template"msgid "New ignore pattern"msgstr "New ignore pattern"-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/ProjectSwitcher.tsxmsgid "New project"msgstr "New project"@@ -5018,7 +5018,7 @@ msgstr "New template"msgid "New terminal"msgstr "New terminal"-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.tsmsgid "New Terminal"msgstr "New Terminal"@@ -5026,7 +5026,7 @@ msgstr "New Terminal"msgid "New terminal tab"msgstr "New terminal tab"-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/NewWorktreeDialog.tsx#: src/components/ProjectSwitcher.tsxmsgid "New worktree"@@ -5560,12 +5560,12 @@ msgstr "Open file"msgid "Open folder"msgstr "Open folder"-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/NavigatorApp.tsxmsgid "Open folder on disk"msgstr "Open folder on disk"-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.tsmsgid "Open graph"msgstr "Open graph"@@ -5720,7 +5720,7 @@ msgstr "OpenKnowledge is using a GitHub account provided by the gh CLI. There'smsgid "OpenKnowledge is using this GitHub account."msgstr "OpenKnowledge is using this GitHub account."-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.tsmsgid "OpenKnowledge on GitHub"msgstr "OpenKnowledge on GitHub"@@ -6388,7 +6388,7 @@ msgstr "Removes this skill from your editors."msgid "Removing"msgstr "Removing"-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/FileTree.tsx#: src/components/skill-actions.tsx#: src/components/SkillRenameDialog.tsx@@ -6477,7 +6477,7 @@ msgstr "Replace key"msgid "Replace the active match from the replace field."msgstr "Replace the active match from the replace field."-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/HelpPopover.tsx#: src/components/ReportBugDialogBody.tsxmsgid "Report a bug"@@ -6654,7 +6654,7 @@ msgstr "Reveal in File Explorer"msgid "Reveal in File Explorer, {hint}"msgstr "Reveal in File Explorer, {hint}"-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/FileSidebar.tsx#: src/components/FileTree.tsx#: src/components/ReportBugDialogBody.tsx@@ -7014,7 +7014,7 @@ msgstr "Set identity"msgid "Set the auto-sync default for users opening this project for the first time. This setting is committed to your repository."msgstr "Set the auto-sync default for users opening this project for the first time. This setting is committed to your repository."-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.tsmsgid "Set up OpenKnowledge integrations"msgstr "Set up OpenKnowledge integrations"@@ -7030,7 +7030,7 @@ msgstr "Set where pasted and dropped files are stored for this project."msgid "Setting up"msgstr "Setting up"-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/settings/SettingsDialogShell.tsx#: src/components/SettingsButton.tsx#: src/lib/keyboard-shortcuts.ts@@ -7118,7 +7118,7 @@ msgstr "Sharing a doc needs a GitHub repository. Create one for this project."msgid "Show"msgstr "Show"-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/FileSidebar.tsxmsgid "Show .ok folders"msgstr "Show .ok folders"@@ -7145,7 +7145,7 @@ msgstr "Show advanced"msgid "Show diagram"msgstr "Show diagram"-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.tsmsgid "Show document panel"msgstr "Show document panel"@@ -7169,7 +7169,7 @@ msgstr "Show Files ({sidebarShortcut})"msgid "Show Files ({sidebarShortcutLabel})"msgstr "Show Files ({sidebarShortcutLabel})"-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/FileSidebar.tsx#: src/components/NotInSidebarIndicator.tsxmsgid "Show hidden files"@@ -7183,7 +7183,7 @@ msgstr "Show HTML preview"msgid "Show less"msgstr "Show less"-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/FileSidebar.tsxmsgid "Show only markdown files"msgstr "Show only markdown files"@@ -7216,11 +7216,11 @@ msgstr "Show replace"msgid "Show selection preview"msgstr "Show selection preview"-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.tsmsgid "Show sidebar"msgstr "Show sidebar"-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/FileSidebar.tsxmsgid "Show skills section"msgstr "Show skills section"@@ -7233,7 +7233,7 @@ msgstr "Show source"msgid "Show terminal"msgstr "Show terminal"-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.tsmsgid "Show Terminal"msgstr "Show Terminal"@@ -7530,7 +7530,7 @@ msgstr "Switch and update branch"msgid "Switch branch"msgstr "Switch branch"-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/ProjectSwitcher.tsx#: src/lib/keyboard-shortcuts.tsmsgid "Switch project"@@ -7540,7 +7540,7 @@ msgstr "Switch project"msgid "Switch to local-only refused"msgstr "Switch to local-only refused"-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.tsmsgid "Switch worktree"msgstr "Switch worktree"diff --git a/packages/app/src/locales/pseudo/messages.po b/packages/app/src/locales/pseudo/messages.poindex 130c3fbf3..f12a24424 100644--- a/packages/app/src/locales/pseudo/messages.po+++ b/packages/app/src/locales/pseudo/messages.po@@ -1392,7 +1392,7 @@ msgstr ""msgid "Cannot upload: no document is open"msgstr ""-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.tsmsgid "Check for updates"msgstr ""@@ -1404,7 +1404,7 @@ msgstr ""msgid "Check out worktree"msgstr ""-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.tsmsgid "Check spelling while typing"msgstr ""@@ -1606,7 +1606,7 @@ msgstr ""msgid "Close others"msgstr ""-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.tsmsgid "Close tab"msgstr ""@@ -1667,7 +1667,7 @@ msgstr ""msgid "Collapse {keyName}"msgstr ""-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/FileSidebar.tsx#: src/components/FileTree.tsxmsgid "Collapse all"@@ -1963,7 +1963,7 @@ msgstr ""msgid "Copy command"msgstr ""-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/FileSidebar.tsxmsgid "Copy full path"msgstr ""@@ -1980,7 +1980,7 @@ msgstr ""msgid "Copy Path"msgstr ""-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.tsmsgid "Copy relative path"msgstr ""@@ -2906,7 +2906,7 @@ msgstr ""msgid "Drag item {0} to reorder"msgstr ""-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/FileTree.tsx#: src/components/skill-actions.tsxmsgid "Duplicate"@@ -3207,7 +3207,7 @@ msgstr ""msgid "Expand {keyName}"msgstr ""-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/FileSidebar.tsx#: src/components/FileTree.tsxmsgid "Expand all"@@ -3419,7 +3419,7 @@ msgstr ""msgid "Failed to open folder."msgstr ""-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/ProjectSwitcher.tsxmsgid "Failed to open Project Navigator."msgstr ""@@ -3955,7 +3955,7 @@ msgstr ""msgid "Hide advanced"msgstr ""-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.tsmsgid "Hide document panel"msgstr ""@@ -4003,11 +4003,11 @@ msgstr ""msgid "Hide selection preview"msgstr ""-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.tsmsgid "Hide sidebar"msgstr ""-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.tsmsgid "Hide Terminal"msgstr ""@@ -4183,7 +4183,7 @@ msgstr ""msgid "Initialize failed: {errorDetail}"msgstr ""-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.tsmsgid "Initialize starter pack"msgstr ""@@ -4252,7 +4252,7 @@ msgstr ""msgid "Install for Claude Chat & Cowork"msgstr ""-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.tsmsgid "Install for Claude Chat & Cowork (Desktop App)"msgstr ""@@ -4381,7 +4381,7 @@ msgstr ""msgid "Keyboard shortcuts available in the editor and workspace."msgstr ""-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.tsmsgid "Kill Terminal"msgstr ""@@ -4814,7 +4814,7 @@ msgstr ""msgid "Move to the previous visual-editor find result."msgstr ""-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.tsmsgid "Move to Trash"msgstr ""@@ -4950,7 +4950,7 @@ msgstr ""msgid "New chat"msgstr ""-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/FileSidebar.tsx#: src/components/FileTree.tsx#: src/components/NewItemDialog.tsx@@ -4966,7 +4966,7 @@ msgstr ""msgid "New file from template \"{displayTitle}\" ({fileName}) in the project root"msgstr ""-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/FileSidebar.tsx#: src/components/FileTree.tsx#: src/components/NewItemDialog.tsx@@ -4974,7 +4974,7 @@ msgstr ""msgid "New folder"msgstr ""-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/FileSidebar.tsx#: src/components/FileTree.tsxmsgid "New from template"@@ -4984,7 +4984,7 @@ msgstr ""msgid "New ignore pattern"msgstr ""-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/ProjectSwitcher.tsxmsgid "New project"msgstr ""@@ -5014,7 +5014,7 @@ msgstr ""msgid "New terminal"msgstr ""-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.tsmsgid "New Terminal"msgstr ""@@ -5022,7 +5022,7 @@ msgstr ""msgid "New terminal tab"msgstr ""-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/NewWorktreeDialog.tsx#: src/components/ProjectSwitcher.tsxmsgid "New worktree"@@ -5556,12 +5556,12 @@ msgstr ""msgid "Open folder"msgstr ""-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/NavigatorApp.tsxmsgid "Open folder on disk"msgstr ""-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.tsmsgid "Open graph"msgstr ""@@ -5716,7 +5716,7 @@ msgstr ""msgid "OpenKnowledge is using this GitHub account."msgstr ""-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.tsmsgid "OpenKnowledge on GitHub"msgstr ""@@ -6384,7 +6384,7 @@ msgstr ""msgid "Removing"msgstr ""-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/FileTree.tsx#: src/components/skill-actions.tsx#: src/components/SkillRenameDialog.tsx@@ -6473,7 +6473,7 @@ msgstr ""msgid "Replace the active match from the replace field."msgstr ""-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/HelpPopover.tsx#: src/components/ReportBugDialogBody.tsxmsgid "Report a bug"@@ -6650,7 +6650,7 @@ msgstr ""msgid "Reveal in File Explorer, {hint}"msgstr ""-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/FileSidebar.tsx#: src/components/FileTree.tsx#: src/components/ReportBugDialogBody.tsx@@ -7010,7 +7010,7 @@ msgstr ""msgid "Set the auto-sync default for users opening this project for the first time. This setting is committed to your repository."msgstr ""-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.tsmsgid "Set up OpenKnowledge integrations"msgstr ""@@ -7026,7 +7026,7 @@ msgstr ""msgid "Setting up"msgstr ""-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/settings/SettingsDialogShell.tsx#: src/components/SettingsButton.tsx#: src/lib/keyboard-shortcuts.ts@@ -7114,7 +7114,7 @@ msgstr ""msgid "Show"msgstr ""-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/FileSidebar.tsxmsgid "Show .ok folders"msgstr ""@@ -7141,7 +7141,7 @@ msgstr ""msgid "Show diagram"msgstr ""-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.tsmsgid "Show document panel"msgstr ""@@ -7165,7 +7165,7 @@ msgstr ""msgid "Show Files ({sidebarShortcutLabel})"msgstr ""-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/FileSidebar.tsx#: src/components/NotInSidebarIndicator.tsxmsgid "Show hidden files"@@ -7179,7 +7179,7 @@ msgstr ""msgid "Show less"msgstr ""-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/FileSidebar.tsxmsgid "Show only markdown files"msgstr ""@@ -7212,11 +7212,11 @@ msgstr ""msgid "Show selection preview"msgstr ""-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.tsmsgid "Show sidebar"msgstr ""-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/FileSidebar.tsxmsgid "Show skills section"msgstr ""@@ -7229,7 +7229,7 @@ msgstr ""msgid "Show terminal"msgstr ""-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.tsmsgid "Show Terminal"msgstr ""@@ -7526,7 +7526,7 @@ msgstr ""msgid "Switch branch"msgstr ""-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.ts#: src/components/ProjectSwitcher.tsx#: src/lib/keyboard-shortcuts.tsmsgid "Switch project"@@ -7536,7 +7536,7 @@ msgstr ""msgid "Switch to local-only refused"msgstr ""-#: src/components/CommandPalette.tsx+#: src/components/command-palette-commands.tsmsgid "Switch worktree"msgstr ""diff --git a/packages/server/src/mcp/tools/lint.test.ts b/packages/server/src/mcp/tools/lint.test.tsindex 4450a108d..e569818b6 100644--- a/packages/server/src/mcp/tools/lint.test.ts+++ b/packages/server/src/mcp/tools/lint.test.ts@@ -11,6 +11,7 @@ import { mkdtemp, rm } from 'node:fs/promises';import { tmpdir } from 'node:os';import { resolve } from 'node:path';import { type Config, ConfigSchema } from '../../config/schema.ts';+import { type FetchTestServer, startFetchTestServer } from './fetch-test-server.test-helper.ts';import {AUDIT_FILE_CAP,AUDIT_FILE_DIAGNOSTIC_CAP,@@ -75,7 +76,7 @@ function makeDeps(serverUrl: string | undefined, cwdDir: string): LintDeps {return { serverUrl, config: BASE_CONFIG, resolveCwd: async () => cwdDir };}-let testServer: ReturnType<typeof Bun.serve>;+let testServer: FetchTestServer;let baseUrl: string;let tmpDir: string;const seenRequests: string[] = [];@@ -105,8 +106,8 @@ function auditPayloadOf(fileCount: number, diagnosticsPerFile: number) {};}-beforeAll(() => {- testServer = Bun.serve({+beforeAll(async () => {+ testServer = await startFetchTestServer({port: 0,hostname: '127.0.0.1',fetch(req) {