Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

feat(open-knowledge): settings scope badges and sidebar search (#2756)

serafin-garcia1fd3982faf58
diff --git a/.changeset/settings-scope-badges-and-search.md b/.changeset/settings-scope-badges-and-search.md
new file mode 100644
index 000000000..43c49def7
--- /dev/null
+++ b/.changeset/settings-scope-badges-and-search.md
@@ -0,0 +1,9 @@
+---
+"@inkeep/open-knowledge": minor
+---
+
+Settings now tells you where a plugin's changes are stored and lets you search across the whole dialog.
+
+Plugin panels carry a scope badge: markdownlint shows a "Project" badge (its rules are committed to config.yml and shared with your team) and Themes shows a "User" badge (personal to your device). Hover either badge for a one-line explanation of where the change is saved.
+
+A search box is pinned at the top of the settings sidebar. Type to find any section, any Preferences/Theme setting, or any markdownlint rule by name, id, or alias, then jump straight to it: a section result switches panels, a setting result scrolls to and briefly highlights the field, and a markdownlint rule result opens the markdownlint panel already filtered to that rule. markdownlint rules only appear in search while the plugin is enabled. The search box stays put while the section list scrolls beneath it.
diff --git a/packages/app/package.json b/packages/app/package.json
index 3517ef553..c9eed66ae 100644
--- a/packages/app/package.json
+++ b/packages/app/package.json
@@ -26,7 +26,7 @@
"measure:fuzz": "bash scripts/measure-fuzz.sh",
"measure:stress": "bash scripts/measure-stress.sh",
"perf:compare": "bash scripts/perf-compare.sh",
- "test:e2e": "playwright test tests/stress/ux-interactions.e2e.ts tests/stress/file-tree-create.e2e.ts tests/stress/file-tree-drag-to-root.e2e.ts tests/stress/file-tree-deselect-to-root.e2e.ts tests/stress/file-tree-compact-folders.e2e.ts tests/stress/create-then-rename-editable.e2e.ts tests/stress/find-replace.e2e.ts tests/stress/editor-tabs.e2e.ts tests/stress/crdt-stress.e2e.ts tests/stress/slash-command.e2e.ts tests/stress/paste-fidelity.e2e.ts tests/stress/fr-7a-disconnect-source-mode.e2e.ts tests/stress/docs-open.e2e.ts tests/stress/frozen-table-headers.e2e.ts tests/stress/asset-embed.e2e.ts tests/stress/asset-embed-advanced.e2e.ts tests/stress/asset-click-dispatch.e2e.ts tests/stress/handoff.e2e.ts tests/stress/multi-agent-presence.e2e.ts tests/stress/editor-mode-persistence.e2e.ts tests/stress/lint-config-toggle.e2e.ts tests/stress/sidebar-search-pill.e2e.ts tests/stress/command-palette-semantic.e2e.ts tests/stress/agent-activity-panel.e2e.ts tests/stress/drop-pipeline-auto-open.e2e.ts tests/stress/command-palette-flicker.e2e.ts tests/stress/cm6-list-hanging-indent.e2e.ts tests/stress/ng7-rapid-nav-coherence.e2e.ts tests/stress/reveal-on-activate.e2e.ts tests/stress/selection-indicator.e2e.ts tests/stress/new-file-cross-doc-bleed.e2e.ts tests/stress/editor-mode-flip-cross-doc-bleed.e2e.ts tests/stress/editor-area-viewport-resize.e2e.ts tests/stress/qa-sidebar-responsive.e2e.ts tests/stress/prd-6955-reassertion-repro.e2e.ts tests/stress/prd-6955-reassertion-wedge.e2e.ts tests/stress/prd-6914-repro.e2e.ts tests/stress/showall-lazy-tree.e2e.ts tests/stress/tabs-component-strip.e2e.ts tests/stress/source-find-scroll.e2e.ts tests/stress/harness-app-warmth.e2e.ts tests/stress/qa-canary-authoring-both-modes.e2e.ts tests/stress/qa-canary-live-typing.e2e.ts tests/stress/keystroke-cadence-danger-space.e2e.ts tests/stress/jsx-unregistered-backspace-delete.e2e.ts tests/stress/jsx-unregistered-ime-concurrent.e2e.ts tests/stress/jsx-backspace-delete.e2e.ts tests/stress/link-authoring-bytes.e2e.ts tests/stress/link-authoring-apex.e2e.ts tests/stress/command-palette-parity.e2e.ts",
+ "test:e2e": "playwright test tests/stress/ux-interactions.e2e.ts tests/stress/file-tree-create.e2e.ts tests/stress/file-tree-drag-to-root.e2e.ts tests/stress/file-tree-deselect-to-root.e2e.ts tests/stress/file-tree-compact-folders.e2e.ts tests/stress/create-then-rename-editable.e2e.ts tests/stress/find-replace.e2e.ts tests/stress/editor-tabs.e2e.ts tests/stress/crdt-stress.e2e.ts tests/stress/slash-command.e2e.ts tests/stress/paste-fidelity.e2e.ts tests/stress/fr-7a-disconnect-source-mode.e2e.ts tests/stress/docs-open.e2e.ts tests/stress/frozen-table-headers.e2e.ts tests/stress/asset-embed.e2e.ts tests/stress/asset-embed-advanced.e2e.ts tests/stress/asset-click-dispatch.e2e.ts tests/stress/handoff.e2e.ts tests/stress/multi-agent-presence.e2e.ts tests/stress/editor-mode-persistence.e2e.ts tests/stress/lint-config-toggle.e2e.ts tests/stress/sidebar-search-pill.e2e.ts tests/stress/command-palette-semantic.e2e.ts tests/stress/agent-activity-panel.e2e.ts tests/stress/drop-pipeline-auto-open.e2e.ts tests/stress/command-palette-flicker.e2e.ts tests/stress/cm6-list-hanging-indent.e2e.ts tests/stress/ng7-rapid-nav-coherence.e2e.ts tests/stress/reveal-on-activate.e2e.ts tests/stress/selection-indicator.e2e.ts tests/stress/new-file-cross-doc-bleed.e2e.ts tests/stress/editor-mode-flip-cross-doc-bleed.e2e.ts tests/stress/editor-area-viewport-resize.e2e.ts tests/stress/qa-sidebar-responsive.e2e.ts tests/stress/prd-6955-reassertion-repro.e2e.ts tests/stress/prd-6955-reassertion-wedge.e2e.ts tests/stress/prd-6914-repro.e2e.ts tests/stress/showall-lazy-tree.e2e.ts tests/stress/tabs-component-strip.e2e.ts tests/stress/source-find-scroll.e2e.ts tests/stress/harness-app-warmth.e2e.ts tests/stress/qa-canary-authoring-both-modes.e2e.ts tests/stress/qa-canary-live-typing.e2e.ts tests/stress/keystroke-cadence-danger-space.e2e.ts tests/stress/jsx-unregistered-backspace-delete.e2e.ts tests/stress/jsx-unregistered-ime-concurrent.e2e.ts tests/stress/jsx-backspace-delete.e2e.ts tests/stress/link-authoring-bytes.e2e.ts tests/stress/link-authoring-apex.e2e.ts tests/stress/command-palette-parity.e2e.ts tests/stress/settings-search.e2e.ts",
"test:e2e:install-browsers": "playwright install chromium webkit firefox",
"test:visual": "playwright test --config playwright.visual.config.ts",
"test:visual:update": "playwright test --config playwright.visual.config.ts --update-snapshots",
diff --git a/packages/app/src/components/settings/LintingSection.dom.test.tsx b/packages/app/src/components/settings/LintingSection.dom.test.tsx
index fc19c22c4..709d1a0d4 100644
--- a/packages/app/src/components/settings/LintingSection.dom.test.tsx
+++ b/packages/app/src/components/settings/LintingSection.dom.test.tsx
@@ -5,10 +5,10 @@
* editor's write calls + gated visibility of controls.
*/
-import { afterEach, beforeEach, describe, expect, mock, test } from 'bun:test';
import type { Config, ConfigBinding } from '@inkeep/open-knowledge-core';
import { cleanup, render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
+import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest';
import { TooltipProvider } from '@/components/ui/tooltip';
// Radix primitives reach for DOM globals the jsdom preload doesn't expose;
@@ -36,7 +36,7 @@ let mockProjectConfig: Config | null = null;
let mockProjectSynced = true;
let mockProjectBinding: ConfigBinding | null = null;
-mock.module('@/lib/config-provider', () => ({
+vi.doMock('@/lib/config-provider', () => ({
useConfigContext: () => ({
userBinding: null,
userSynced: false,
@@ -73,7 +73,7 @@ function projectDataWithMarkdownlintRules(
},
};
}
-mock.module('@/editor/lint-config-client', () => ({
+vi.doMock('@/editor/lint-config-client', () => ({
emitLintConfigChanged: () => {},
subscribeToLintConfigChanged: () => () => {},
runLintAudit: async () => null,
@@ -198,6 +198,9 @@ describe('MarkdownlintPluginSection', () => {
expect(screen.getByTestId('settings-linting-markdownlint-rules')).toBeDefined();
expect(screen.getByTestId('markdownlint-rule-search')).toBeDefined();
expect(screen.getByTestId('markdownlint-rule-row-MD001')).toBeDefined();
+ // markdownlint is a project-scope plugin — the header carries a Project badge.
+ expect(screen.getByTestId('settings-scope-badge-project')).toBeDefined();
+ expect(screen.queryByTestId('settings-scope-badge-user')).toBeNull();
});
test('names the project config file in the description when one is present', () => {
diff --git a/packages/app/src/components/settings/LintingSection.tsx b/packages/app/src/components/settings/LintingSection.tsx
index b4cfde86a..040ddf396 100644
--- a/packages/app/src/components/settings/LintingSection.tsx
+++ b/packages/app/src/components/settings/LintingSection.tsx
@@ -24,6 +24,7 @@ import { useConfigContext } from '@/lib/config-provider';
import { dispatchExternalLinkClick } from '@/lib/external-link';
import { LINT_PLUGIN_META } from './lint-plugin-meta';
import { MarkdownlintRuleBrowser } from './markdownlint-rule-browser';
+import { ScopeBadge } from './ScopeBadge';
/** Project-scope content-rules config + a `contentRules`-patch writer. Shared by the sections. */
function useLinterConfig() {
@@ -194,31 +195,46 @@ export function UserPluginsManageSection({ userBinding }: { userBinding: ConfigB
function PluginSectionHeader({
titleId,
title,
+ scope,
children,
}: {
titleId: string;
title: string;
+ /** When set, renders a User/Project scope badge beside the title. */
+ scope?: 'user' | 'project';
children: ReactNode;
}) {
return (
<div className="space-y-1">
- <h3 id={titleId} className="text-base font-semibold">
- {title}
- </h3>
+ <div className="flex items-center gap-2">
+ <h3 id={titleId} className="text-base font-semibold">
+ {title}
+ </h3>
+ {scope ? <ScopeBadge scope={scope} /> : null}
+ </div>
<p className="text-sm text-muted-foreground">{children}</p>
</div>
);
}
/** markdownlint plugin: the full-catalog rule browser. */
-export function MarkdownlintPluginSection() {
+export function MarkdownlintPluginSection({
+ initialRuleQuery,
+}: {
+ /** Seeds the rule browser's search when the settings search jumps to a rule. */
+ initialRuleQuery?: { query: string; nonce: number } | null;
+} = {}) {
return (
<section
aria-labelledby="settings-plugin-markdownlint-title"
className="space-y-4"
data-testid="settings-plugin-markdownlint"
>
- <PluginSectionHeader titleId="settings-plugin-markdownlint-title" title="markdownlint">
+ <PluginSectionHeader
+ titleId="settings-plugin-markdownlint-title"
+ title="markdownlint"
+ scope="project"
+ >
<Trans>
Flag common markdown issues in the editor. Powered by{' '}
<a
@@ -239,7 +255,7 @@ export function MarkdownlintPluginSection() {
.
</Trans>
</PluginSectionHeader>
- <MarkdownlintRuleBrowser />
+ <MarkdownlintRuleBrowser initialRuleQuery={initialRuleQuery} />
</section>
);
}
diff --git a/packages/app/src/components/settings/ScopeBadge.dom.test.tsx b/packages/app/src/components/settings/ScopeBadge.dom.test.tsx
new file mode 100644
index 000000000..442b76a3e
--- /dev/null
+++ b/packages/app/src/components/settings/ScopeBadge.dom.test.tsx
@@ -0,0 +1,70 @@
+/**
+ * DOM tests for ScopeBadge — the User/Project indicator shown in plugin panel
+ * headers. Asserts the visible label and the scope-specific tooltip copy.
+ */
+
+import { cleanup, render, screen, within } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+import { afterEach, describe, expect, test } from 'vitest';
+import { TooltipProvider } from '@/components/ui/tooltip';
+import { ScopeBadge } from './ScopeBadge';
+
+// Radix Tooltip reaches for globals jsdom's preload doesn't expose.
+type GlobalWithShims = typeof globalThis & { ResizeObserver?: unknown };
+const g = globalThis as GlobalWithShims;
+if (g.ResizeObserver === undefined) {
+ class NoopResizeObserver {
+ observe() {}
+ unobserve() {}
+ disconnect() {}
+ }
+ g.ResizeObserver = NoopResizeObserver;
+}
+
+function renderBadge(scope: 'user' | 'project') {
+ return render(
+ <TooltipProvider>
+ <ScopeBadge scope={scope} />
+ </TooltipProvider>,
+ );
+}
+
+describe('ScopeBadge', () => {
+ afterEach(() => cleanup());
+
+ test('user scope renders a "User" badge', () => {
+ renderBadge('user');
+ const badge = screen.getByTestId('settings-scope-badge-user');
+ expect(badge.textContent).toBe('User');
+ expect(screen.queryByTestId('settings-scope-badge-project')).toBeNull();
+ });
+
+ test('project scope renders a "Project" badge', () => {
+ renderBadge('project');
+ const badge = screen.getByTestId('settings-scope-badge-project');
+ expect(badge.textContent).toBe('Project');
+ expect(screen.queryByTestId('settings-scope-badge-user')).toBeNull();
+ });
+
+ test('user tooltip explains it is stored in user config', async () => {
+ renderBadge('user');
+ await userEvent.hover(screen.getByTestId('settings-scope-badge-user'));
+ const tooltip = await screen.findAllByRole('tooltip');
+ expect(within(tooltip[0]).getByText(/user config/i)).toBeDefined();
+ });
+
+ test('project tooltip explains it is shared via git', async () => {
+ renderBadge('project');
+ await userEvent.hover(screen.getByTestId('settings-scope-badge-project'));
+ const tooltip = await screen.findAllByRole('tooltip');
+ expect(within(tooltip[0]).getByText(/config\.yml/i)).toBeDefined();
+ });
+
+ test('badge is keyboard-focusable and focus opens the tooltip', async () => {
+ renderBadge('user');
+ await userEvent.tab();
+ expect(document.activeElement).toBe(screen.getByTestId('settings-scope-badge-user'));
+ const tooltip = await screen.findAllByRole('tooltip');
+ expect(within(tooltip[0]).getByText(/user config/i)).toBeDefined();
+ });
+});
diff --git a/packages/app/src/components/settings/ScopeBadge.tsx b/packages/app/src/components/settings/ScopeBadge.tsx
new file mode 100644
index 000000000..d37585198
--- /dev/null
+++ b/packages/app/src/components/settings/ScopeBadge.tsx
@@ -0,0 +1,39 @@
+/**
+ * User/Project scope indicator for a plugin settings panel header. The
+ * "Plugins" sidebar group mixes scopes — markdownlint is project-scope (shared
+ * via config.yml + the native `.markdownlint.*`), Themes is user-scope
+ * (personal, device-local) — so the panel header alone can't tell you where a
+ * change lands. This badge makes the scope (and, via its tooltip, where the
+ * change is stored) explicit. Used ONLY in plugin panel headers; the other
+ * settings sections are already categorized by their labeled sidebar group.
+ */
+import { Trans } from '@lingui/react/macro';
+import { Badge } from '@/components/ui/badge';
+import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
+
+export function ScopeBadge({ scope }: { scope: 'user' | 'project' }) {
+ return (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ {/* tabIndex makes the badge keyboard-focusable so the tooltip's
+ storage/sharing explanation is reachable without a pointer (Radix
+ opens tooltips on focus and wires aria-describedby). */}
+ <Badge
+ variant="gray"
+ tabIndex={0}
+ className="focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ data-testid={`settings-scope-badge-${scope}`}
+ >
+ {scope === 'user' ? <Trans>User</Trans> : <Trans>Project</Trans>}
+ </Badge>
+ </TooltipTrigger>
+ <TooltipContent>
+ {scope === 'user' ? (
+ <Trans>Personal to this device — stored in your user config, not shared.</Trans>
+ ) : (
+ <Trans>Shared with everyone on this project — committed to config.yml via git.</Trans>
+ )}
+ </TooltipContent>
+ </Tooltip>
+ );
+}
diff --git a/packages/app/src/components/settings/SettingsDialogBody.dom.test.tsx b/packages/app/src/components/settings/SettingsDialogBody.dom.test.tsx
index 516ef9c18..954538609 100644
--- a/packages/app/src/components/settings/SettingsDialogBody.dom.test.tsx
+++ b/packages/app/src/components/settings/SettingsDialogBody.dom.test.tsx
@@ -1,4 +1,3 @@
-import { afterEach, describe, expect, test } from 'bun:test';
import {
CONFIG_DOC_NAME_PROJECT,
CONFIG_DOC_NAME_USER,
@@ -11,6 +10,7 @@ import { act, cleanup, render, screen, waitFor, within } from '@testing-library/
import userEvent from '@testing-library/user-event';
import { ThemeProvider, useTheme } from 'next-themes';
import type { ReactNode } from 'react';
+import { afterEach, describe, expect, test } from 'vitest';
import { TooltipProvider } from '@/components/ui/tooltip';
import { ConfigContext, type ConfigContextValue } from '@/lib/config-context';
import { emitConfigValidationRejected } from '@/lib/config-validation-events';
@@ -366,6 +366,13 @@ describe('SettingsDialogBody color-palette picker — optimistic mode flip', ()
cleanup();
});
+ test('the Themes plugin header shows a User scope badge (user-scope plugin)', () => {
+ const { binding } = makeBinding();
+ renderThemePluginWithTheme(binding);
+ expect(screen.getByTestId('settings-scope-badge-user')).toBeDefined();
+ expect(screen.queryByTestId('settings-scope-badge-project')).toBeNull();
+ });
+
test('selecting a light palette (Catppuccin Latte) flips next-themes to light', async () => {
const user = userEvent.setup();
const { binding } = makeBinding();
diff --git a/packages/app/src/components/settings/SettingsDialogBody.sections.dom.test.tsx b/packages/app/src/components/settings/SettingsDialogBody.sections.dom.test.tsx
index 89f76505a..30bdd11f8 100644
--- a/packages/app/src/components/settings/SettingsDialogBody.sections.dom.test.tsx
+++ b/packages/app/src/components/settings/SettingsDialogBody.sections.dom.test.tsx
@@ -1,6 +1,6 @@
-import { beforeEach, describe, expect, mock, test } from 'bun:test';
import { act, cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react';
import { createContext, type ReactNode, use, useState } from 'react';
+import { beforeEach, describe, expect, test, vi } from 'vitest';
import { renderLinguiTemplate } from '@/test-utils/lingui-mock';
type SyncStatus = {
@@ -49,12 +49,12 @@ const actualCore = await import('@inkeep/open-knowledge-core');
import * as actualLinguiMacro from '@lingui/react/macro';
-mock.module('@inkeep/open-knowledge-core', () => ({
+vi.doMock('@inkeep/open-knowledge-core', () => ({
...actualCore,
SHOW_INSTALL_SKILL: true,
}));
-mock.module('@lingui/react/macro', () => ({
+vi.doMock('@lingui/react/macro', () => ({
...actualLinguiMacro,
Plural: ({ value, one, other }: { value: number; one: string; other: string }) => (
<>{(value === 1 ? one : other).replace('#', String(value))}</>
@@ -63,7 +63,7 @@ mock.module('@lingui/react/macro', () => ({
useLingui: () => ({ t: renderLinguiTemplate }),
}));
-mock.module('@lingui/core/macro', () => ({
+vi.doMock('@lingui/core/macro', () => ({
...actualLinguiMacro,
msg: renderLinguiTemplate,
plural: (value: number, options: { one: string; other: string }) =>
@@ -71,7 +71,7 @@ mock.module('@lingui/core/macro', () => ({
t: renderLinguiTemplate,
}));
-mock.module('@/components/ui/button', () => ({
+vi.doMock('@/components/ui/button', () => ({
Button: ({ children, ...props }: { children?: ReactNode; [key: string]: unknown }) => (
<button type="button" {...props}>
{children}
@@ -79,13 +79,13 @@ mock.module('@/components/ui/button', () => ({
),
}));
-mock.module('@/components/ui/collapsible', () => ({
+vi.doMock('@/components/ui/collapsible', () => ({
Collapsible: ({ children }: { children?: ReactNode }) => <div>{children}</div>,
CollapsibleContent: ({ children }: { children?: ReactNode }) => <div>{children}</div>,
CollapsibleTrigger: ({ children }: { children?: ReactNode }) => <>{children}</>,
}));
-mock.module('@/components/ui/switch', () => ({
+vi.doMock('@/components/ui/switch', () => ({
Switch: ({
checked,
disabled,
@@ -108,11 +108,11 @@ mock.module('@/components/ui/switch', () => ({
),
}));
-mock.module('@/components/ui/skeleton', () => ({
+vi.doMock('@/components/ui/skeleton', () => ({
Skeleton: ({ className }: { className?: string }) => <div className={className} />,
}));
-mock.module('@/components/ui/form', () => ({
+vi.doMock('@/components/ui/form', () => ({
Form: ({ children }: { children?: ReactNode }) => <form>{children}</form>,
FormControl: ({ children }: { children?: ReactNode }) => <>{children}</>,
FormDescription: ({ children }: { children?: ReactNode }) => <p>{children}</p>,
@@ -122,12 +122,12 @@ mock.module('@/components/ui/form', () => ({
FormMessage: () => null,
}));
-mock.module('@/components/ui/input', () => ({
+vi.doMock('@/components/ui/input', () => ({
Input: (props: React.InputHTMLAttributes<HTMLInputElement>) => <input {...props} />,
}));
const SelectHandlerCtx = createContext<((value: string) => void) | undefined>(undefined);
-mock.module('@/components/ui/select', () => ({
+vi.doMock('@/components/ui/select', () => ({
Select: ({
children,
value,
@@ -169,7 +169,7 @@ mock.module('@/components/ui/select', () => ({
}));
const ToggleGroupHandlerCtx = createContext<((value: string) => void) | undefined>(undefined);
-mock.module('@/components/ui/toggle-group', () => ({
+vi.doMock('@/components/ui/toggle-group', () => ({
ToggleGroup: ({
children,
value,
@@ -207,21 +207,21 @@ mock.module('@/components/ui/toggle-group', () => ({
},
}));
-mock.module('@/components/ui/tooltip', () => ({
+vi.doMock('@/components/ui/tooltip', () => ({
TooltipProvider: ({ children }: { children?: ReactNode }) => <>{children}</>,
Tooltip: ({ children }: { children?: ReactNode }) => <>{children}</>,
TooltipContent: ({ children }: { children?: ReactNode }) => <div>{children}</div>,
TooltipTrigger: ({ children }: { children?: ReactNode }) => <>{children}</>,
}));
-mock.module('@/components/PublishToGitHubDialog', () => ({
+vi.doMock('@/components/PublishToGitHubDialog', () => ({
PublishToGitHubDialog: (props: { open: boolean }) => {
publishDialogProps.push(props);
return <div data-open={String(props.open)} data-testid="publish-dialog" />;
},
}));
-mock.module('@/components/InstallInClaudeDesktopDialog', () => ({
+vi.doMock('@/components/InstallInClaudeDesktopDialog', () => ({
InstallInClaudeDesktopDialog: (props: {
open: boolean;
onOpenChange: (open: boolean) => void;
@@ -238,23 +238,23 @@ mock.module('@/components/InstallInClaudeDesktopDialog', () => ({
},
}));
-mock.module('./OkignoreSection', () => ({
+vi.doMock('./OkignoreSection', () => ({
OkignoreSection: (props: { binding: unknown; synced: boolean }) => {
okignoreProps.push(props);
return <div data-testid="okignore-section">okignore synced: {String(props.synced)}</div>;
},
}));
-mock.module('./ProjectTemplatesSection', () => ({
+vi.doMock('./ProjectTemplatesSection', () => ({
ProjectTemplatesSection: () => <div data-testid="project-templates-section" />,
}));
-mock.module('@/hooks/use-git-sync-status', () => ({
+vi.doMock('@/hooks/use-git-sync-status', () => ({
useGitSyncStatus: () => syncStatus,
useGitSyncStatusDetailed: () => ({ status: syncStatus, fetchError: null }),
}));
-mock.module('@/lib/config-provider', () => ({
+vi.doMock('@/lib/config-provider', () => ({
useConfigContext: () => ({
projectBinding,
projectConfig,
@@ -264,7 +264,7 @@ mock.module('@/lib/config-provider', () => ({
}),
}));
-mock.module('@/hooks/use-enable-sync-with-confirm', () => ({
+vi.doMock('@/hooks/use-enable-sync-with-confirm', () => ({
useSyncEnabledWriter: () => ({
write: (enabled: boolean) => {
syncWriterCalls.push(enabled);
@@ -296,7 +296,7 @@ mock.module('@/hooks/use-enable-sync-with-confirm', () => ({
EnableSyncConfirmDialog: () => null,
}));
-mock.module('@/components/EnableSyncConfirmDialog', () => ({
+vi.doMock('@/components/EnableSyncConfirmDialog', () => ({
EnableSyncConfirmDialog: ({ open, onConfirm }: { open: boolean; onConfirm: () => void }) => (
<div data-open={String(open)} data-testid="sync-confirm-dialog">
<button type="button" onClick={onConfirm}>
@@ -306,7 +306,7 @@ mock.module('@/components/EnableSyncConfirmDialog', () => ({
),
}));
-mock.module('@/lib/handoff/use-claude-desktop-integration', () => ({
+vi.doMock('@/lib/handoff/use-claude-desktop-integration', () => ({
useClaudeDesktopIntegration: () => ({
desktopPresent: true,
skillInstalled: claudeSkillInstalled,
@@ -387,6 +387,12 @@ describe('SettingsDialogBody section runtime dispatch', () => {
expect(screen.getAllByText('Workspace').length).toBeGreaterThan(0);
});
+ test('preferences shows no user/project scope badge (badges are plugin-panel-only)', async () => {
+ await renderBody({ activeId: 'preferences' });
+ expect(screen.queryByTestId('settings-scope-badge-user')).toBeNull();
+ expect(screen.queryByTestId('settings-scope-badge-project')).toBeNull();
+ });
+
test('preferences includes attachments controls mapped to content.attachmentFolderPath', async () => {
projectConfig = {
autoSync: { default: null },
diff --git a/packages/app/src/components/settings/SettingsDialogBody.tsx b/packages/app/src/components/settings/SettingsDialogBody.tsx
index 75f7c47bc..8a3bb85e9 100644
--- a/packages/app/src/components/settings/SettingsDialogBody.tsx
+++ b/packages/app/src/components/settings/SettingsDialogBody.tsx
@@ -44,8 +44,6 @@ import {
type OkignoreBinding,
SHOW_INSTALL_SKILL,
} from '@inkeep/open-knowledge-core';
-import type { MessageDescriptor } from '@lingui/core';
-import { msg } from '@lingui/core/macro';
import { Trans, useLingui } from '@lingui/react/macro';
import { ArrowUpRight, Check, ChevronRight, RotateCcw } from 'lucide-react';
import { useTheme } from 'next-themes';
@@ -114,11 +112,16 @@ import { ColorThemePicker } from './ColorThemePicker';
import { CustomThemeEditor } from './CustomThemeEditor';
import { EmbeddingsKeySection } from './EmbeddingsKeySection';
import { LinkPreviewsSection } from './LinkPreviewsSection';
-import { ProjectPluginsManageSection, UserPluginsManageSection } from './LintingSection';
+import {
+ MarkdownlintPluginSection,
+ ProjectPluginsManageSection,
+ UserPluginsManageSection,
+} from './LintingSection';
import { LINT_PLUGIN_UI } from './lint-plugins';
import { OkignoreSection } from './OkignoreSection';
import { ProjectAiToolsSection } from './ProjectAiToolsSection';
import { ProjectTemplatesSection } from './ProjectTemplatesSection';
+import { ScopeBadge } from './ScopeBadge';
import { SearchSection } from './SearchSection';
import { SkillsManagerSection } from './SkillsManagerSection';
import {
@@ -127,6 +130,7 @@ import {
getLeafTypeTag,
resolveLeafSchema,
} from './schema-walker';
+import { FIELDS_THEME_PLUGIN, FIELDS_USER_PREFERENCES, type FieldDef } from './settings-fields';
import type { SlotForwardedProps } from './slot-forwarded-props';
import { TerminalSection } from './TerminalSection';
import { pickFirstIssueForPath, useConfigForm } from './use-config-form';
@@ -139,49 +143,6 @@ import { pickFirstIssueForPath, useConfigForm } from './use-config-form';
*/
type Scope = 'user' | 'project';
-interface FieldDef {
- path: string[];
- label: MessageDescriptor;
- description?: MessageDescriptor;
- /**
- * Optional override: 'enum-toggle' renders enum as a ToggleGroup;
- * 'theme-tiles' renders the IDE color-palette tile picker; default is a
- * select-style toggle.
- */
- control?: 'enum-toggle' | 'theme-tiles';
-}
-
-const FIELDS_USER_PREFERENCES: FieldDef[] = [
- {
- path: ['appearance', 'theme'],
- label: msg`Theme`,
- description: msg`Light, dark, or follow the OS.`,
- control: 'enum-toggle',
- },
- {
- path: ['editor', 'wordWrap'],
- label: msg`Word wrap`,
- description: msg`Wrap long lines in the markdown source editor.`,
- },
- {
- path: ['appearance', 'preview', 'autoOpen'],
- label: msg`Open preview when agent edits`,
- description: msg`When enabled, the agent opens or refreshes the preview after each edit. Disable if you manage your own preview window (OK Desktop, a browser tab on another display, etc.).`,
- },
-];
-
-// The color-theme picker is a theme "plugin": it lives in the Plugins menu
-// (Settings → Plugins → Themes) as a peer of the lint plugins, not in
-// Preferences. `appearance.theme` (light/dark/system) stays in Preferences.
-const FIELDS_THEME_PLUGIN: FieldDef[] = [
- {
- path: ['appearance', 'colorTheme'],
- label: msg`Color theme`,
- description: msg`Pick a built-in IDE palette. The dark IDE themes override the light/dark setting in Preferences.`,
- control: 'theme-tiles',
- },
-];
-
// The selected committed-default option uses the app's primary blue (the same
// token as the Button default variant), not the muted ToggleGroup default, so
// the active stance reads as clearly chosen and matches the accent used
@@ -194,6 +155,12 @@ interface SettingsDialogBodyProps {
userBinding: ConfigBinding | null;
okignoreBinding: OkignoreBinding | null;
okignoreSynced: boolean;
+ /**
+ * Set when the settings search navigated to a markdownlint rule — seeds the
+ * rule browser's own search so the panel opens filtered to that rule. The
+ * nonce lets a repeat navigation to the same rule re-seed.
+ */
+ markdownlintRuleQuery?: { query: string; nonce: number } | null;
}
export function SettingsDialogBody({
@@ -201,6 +168,7 @@ export function SettingsDialogBody({
userBinding,
okignoreBinding,
okignoreSynced,
+ markdownlintRuleQuery,
}: SettingsDialogBodyProps) {
const { t } = useLingui();
if (activeId === 'preferences') {
@@ -264,6 +232,11 @@ export function SettingsDialogBody({
// lint plugin (it owns no `contentRules` slice). Its config is user-scope.
return userBinding ? <ThemePluginSection userBinding={userBinding} /> : <SectionSkeleton />;
}
+ if (activeId === 'plugin:markdownlint') {
+ // Dedicated branch (above the generic plugin fallthrough) so the settings
+ // search can seed the panel's own rule search when it navigates to a rule.
+ return <MarkdownlintPluginSection initialRuleQuery={markdownlintRuleQuery ?? null} />;
+ }
if (activeId.startsWith('plugin:')) {
// One enabled lint plugin's settings panel.
const pluginId = activeId.slice('plugin:'.length);
@@ -457,6 +430,12 @@ interface BoundSchemaSectionProps {
scope: Scope;
binding: ConfigBinding;
fields: FieldDef[];
+ /**
+ * When set, renders a User/Project scope badge beside the title. Opt-in
+ * (distinct from `scope`, which routes config binding) so only the plugin
+ * panels show a badge — Preferences uses `scope="user"` too but must not.
+ */
+ scopeBadge?: Scope;
}
/**
@@ -478,6 +457,7 @@ function BoundSchemaSection({
scope,
binding,
fields,
+ scopeBadge,
}: BoundSchemaSectionProps) {
const { form, commitField } = useConfigForm(binding);
const [flashedPath, setFlashedPath] = useState<string | null>(null);
@@ -527,6 +507,7 @@ function BoundSchemaSection({
title={title}
description={description}
scope={scope}
+ scopeBadge={scopeBadge}
fields={fields}
commitField={commitField}
flashedPath={flashedPath}
@@ -549,6 +530,7 @@ function ThemePluginSection({ userBinding }: { userBinding: ConfigBinding }) {
title={t`Themes`}
description={t`Pick a built-in IDE color palette, or define your own.`}
scope="user"
+ scopeBadge="user"
binding={userBinding}
fields={FIELDS_THEME_PLUGIN}
/>
@@ -561,6 +543,8 @@ interface SchemaSectionProps {
title: string;
description: string;
scope: Scope;
+ /** When set, renders a User/Project scope badge beside the title (plugin panels only). */
+ scopeBadge?: Scope;
fields: FieldDef[];
commitField: (name: FieldPath<Config>) => boolean;
flashedPath: string | null;
@@ -570,6 +554,7 @@ function SchemaSection({
title,
description,
scope,
+ scopeBadge,
fields,
commitField,
flashedPath,
@@ -578,9 +563,12 @@ function SchemaSection({
return (
<section aria-labelledby={titleId} className="space-y-3">
<div className="space-y-1">
- <h3 id={titleId} className="text-base font-semibold">
- {title}
- </h3>
+ <div className="flex items-center gap-2">
+ <h3 id={titleId} className="text-base font-semibold">
+ {title}
+ </h3>
+ {scopeBadge ? <ScopeBadge scope={scopeBadge} /> : null}
+ </div>
<p className="text-sm text-muted-foreground">{description}</p>
</div>
<div className="space-y-10">
diff --git a/packages/app/src/components/settings/SettingsDialogShell.dom.test.tsx b/packages/app/src/components/settings/SettingsDialogShell.dom.test.tsx
index 669816987..8cda4894b 100644
--- a/packages/app/src/components/settings/SettingsDialogShell.dom.test.tsx
+++ b/packages/app/src/components/settings/SettingsDialogShell.dom.test.tsx
@@ -20,10 +20,10 @@
* when `userSynced` is false and the real binding when true.
*/
-import { afterEach, beforeEach, describe, expect, mock, spyOn, test } from 'bun:test';
import type { ConfigBinding, OkignoreBinding } from '@inkeep/open-knowledge-core';
import { cleanup, render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
+import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest';
// Radix UI primitives (used by shadcn `Dialog`) reach for DOM globals at
// mount time that `tests/dom/jsdom-preload.ts` does not expose. Hoist the
@@ -91,13 +91,17 @@ let mockShowInstallSkill = true;
// project that has enabled it, so the Plugins group lists its panel.
let mockProjectConfig: unknown = { contentRules: { markdownlint: { enabled: true } } };
-mock.module('@inkeep/open-knowledge-core', () => ({
+vi.doMock('@inkeep/open-knowledge-core', () => ({
get SHOW_INSTALL_SKILL() {
return mockShowInstallSkill;
},
+ // The shell builds its search index from the rule catalog when markdownlint
+ // is an enabled plugin; an empty catalog keeps these nav/gating cases (which
+ // don't exercise rule search) from tripping the mock's missing-export guard.
+ MARKDOWNLINT_RULE_CATALOG: [],
}));
-mock.module('@/components/settings/SettingsDialogBodyLazy', () => ({
+vi.doMock('@/components/settings/SettingsDialogBodyLazy', () => ({
SettingsDialogBodyLazy: (props: BodyProps) => {
if (mockBodyMode === 'suspend') throw pendingBodyChunk;
if (mockBodyMode === 'throw') throw new Error('settings chunk failed');
@@ -106,12 +110,12 @@ mock.module('@/components/settings/SettingsDialogBodyLazy', () => ({
},
}));
-mock.module('@/editor/DocumentContext', () => ({
+vi.doMock('@/editor/DocumentContext', () => ({
useDocumentContext: () => ({ collabUrl: mockCollabUrl }),
DocumentProvider: ({ children }: { children: React.ReactNode }) => children,
}));
-mock.module('@/lib/config-provider', () => ({
+vi.doMock('@/lib/config-provider', () => ({
useConfigContext: () => ({
userBinding: mockUserBinding,
userSynced: mockUserSynced,
@@ -127,7 +131,7 @@ mock.module('@/lib/config-provider', () => ({
}),
}));
-mock.module('@/lib/handoff/use-claude-desktop-integration', () => ({
+vi.doMock('@/lib/handoff/use-claude-desktop-integration', () => ({
useClaudeDesktopIntegration: () => ({
desktopPresent: mockDesktopPresent,
skillInstalled: false,
@@ -150,7 +154,7 @@ const SENTINEL_USER_BINDING = {
} as unknown as ConfigBinding;
describe('SettingsDialogShell userBinding gating (Tier-3 mount)', () => {
- let consoleErrorSpy: ReturnType<typeof spyOn>;
+ let consoleErrorSpy: ReturnType<typeof vi.spyOn>;
beforeEach(() => {
resetProbe();
@@ -163,7 +167,7 @@ describe('SettingsDialogShell userBinding gating (Tier-3 mount)', () => {
mockBodyMode = 'probe';
mockShowInstallSkill = true;
mockProjectConfig = { contentRules: { markdownlint: { enabled: true } } };
- consoleErrorSpy = spyOn(console, 'error').mockImplementation(() => {});
+ consoleErrorSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
});
afterEach(() => {
diff --git a/packages/app/src/components/settings/SettingsDialogShell.install-flag.dom.test.tsx b/packages/app/src/components/settings/SettingsDialogShell.install-flag.dom.test.tsx
index 4db1cb565..ba5ba278c 100644
--- a/packages/app/src/components/settings/SettingsDialogShell.install-flag.dom.test.tsx
+++ b/packages/app/src/components/settings/SettingsDialogShell.install-flag.dom.test.tsx
@@ -1,13 +1,14 @@
-import { afterEach, describe, expect, mock, test } from 'bun:test';
import * as actualLinguiMacro from '@lingui/react/macro';
import { cleanup, render, screen } from '@testing-library/react';
import type { ReactNode } from 'react';
+import { afterEach, describe, expect, test, vi } from 'vitest';
-mock.module('@inkeep/open-knowledge-core', () => ({
+vi.doMock('@inkeep/open-knowledge-core', () => ({
SHOW_INSTALL_SKILL: false,
+ MARKDOWNLINT_RULE_CATALOG: [],
}));
-mock.module('@lingui/react/macro', () => ({
+vi.doMock('@lingui/react/macro', () => ({
...actualLinguiMacro,
Trans: ({ children }: { children?: ReactNode }) => <>{children}</>,
useLingui: () => ({
@@ -22,11 +23,11 @@ mock.module('@lingui/react/macro', () => ({
}),
}));
-mock.module('@/components/settings/SettingsDialogBodyLazy', () => ({
+vi.doMock('@/components/settings/SettingsDialogBodyLazy', () => ({
SettingsDialogBodyLazy: () => <div data-testid="settings-body-probe" />,
}));
-mock.module('@/components/ui/dialog', () => ({
+vi.doMock('@/components/ui/dialog', () => ({
Dialog: ({ children, open }: { children?: ReactNode; open?: boolean }) =>
open ? <div role="dialog">{children}</div> : null,
DialogContent: ({ children, ...props }: { children?: ReactNode; [key: string]: unknown }) => (
@@ -38,15 +39,15 @@ mock.module('@/components/ui/dialog', () => ({
),
}));
-mock.module('@/components/ui/skeleton', () => ({
+vi.doMock('@/components/ui/skeleton', () => ({
Skeleton: ({ className }: { className?: string }) => <div className={className} />,
}));
-mock.module('@/editor/DocumentContext', () => ({
+vi.doMock('@/editor/DocumentContext', () => ({
useDocumentContext: () => ({ collabUrl: 'ws://test.invalid' }),
}));
-mock.module('@/lib/config-provider', () => ({
+vi.doMock('@/lib/config-provider', () => ({
useConfigContext: () => ({
userBinding: null,
userSynced: false,
@@ -55,7 +56,7 @@ mock.module('@/lib/config-provider', () => ({
}),
}));
-mock.module('@/lib/handoff/use-claude-desktop-integration', () => ({
+vi.doMock('@/lib/handoff/use-claude-desktop-integration', () => ({
useClaudeDesktopIntegration: () => ({
desktopPresent: true,
}),
diff --git a/packages/app/src/components/settings/SettingsDialogShell.link-previews.dom.test.tsx b/packages/app/src/components/settings/SettingsDialogShell.link-previews.dom.test.tsx
index 1d788d4b7..dd6638928 100644
--- a/packages/app/src/components/settings/SettingsDialogShell.link-previews.dom.test.tsx
+++ b/packages/app/src/components/settings/SettingsDialogShell.link-previews.dom.test.tsx
@@ -11,21 +11,25 @@
* `isFileProtocolPage` helper seam instead — the same mock.module capability
* faking the terminal desktop-only test uses for the Electron bridge.
*/
-import { afterEach, beforeEach, describe, expect, mock, test } from 'bun:test';
+
+import * as actualLinguiMacro from '@lingui/react/macro';
import { cleanup, render, screen } from '@testing-library/react';
import type { ReactNode } from 'react';
+import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest';
let fileProtocolPage = false;
-mock.module('@/lib/file-protocol-page', () => ({
+vi.doMock('@/lib/file-protocol-page', () => ({
isFileProtocolPage: () => fileProtocolPage,
}));
-mock.module('@inkeep/open-knowledge-core', () => ({
+vi.doMock('@inkeep/open-knowledge-core', () => ({
SHOW_INSTALL_SKILL: false,
+ MARKDOWNLINT_RULE_CATALOG: [],
}));
-mock.module('@lingui/react/macro', () => ({
+vi.doMock('@lingui/react/macro', () => ({
+ ...actualLinguiMacro,
Trans: ({ children }: { children?: ReactNode }) => <>{children}</>,
useLingui: () => ({
t: (strings: TemplateStringsArray | string, ...values: unknown[]) => {
@@ -39,11 +43,11 @@ mock.module('@lingui/react/macro', () => ({
}),
}));
-mock.module('@/components/settings/SettingsDialogBodyLazy', () => ({
+vi.doMock('@/components/settings/SettingsDialogBodyLazy', () => ({
SettingsDialogBodyLazy: () => <div data-testid="settings-body-probe" />,
}));
-mock.module('@/components/ui/dialog', () => ({
+vi.doMock('@/components/ui/dialog', () => ({
Dialog: ({ children, open }: { children?: ReactNode; open?: boolean }) =>
open ? <div role="dialog">{children}</div> : null,
DialogContent: ({ children, ...props }: { children?: ReactNode; [key: string]: unknown }) => (
@@ -55,15 +59,15 @@ mock.module('@/components/ui/dialog', () => ({
),
}));
-mock.module('@/components/ui/skeleton', () => ({
+vi.doMock('@/components/ui/skeleton', () => ({
Skeleton: ({ className }: { className?: string }) => <div className={className} />,
}));
-mock.module('@/editor/DocumentContext', () => ({
+vi.doMock('@/editor/DocumentContext', () => ({
useDocumentContext: () => ({ collabUrl: 'ws://test.invalid' }),
}));
-mock.module('@/lib/config-provider', () => ({
+vi.doMock('@/lib/config-provider', () => ({
useConfigContext: () => ({
userBinding: null,
userSynced: false,
@@ -72,7 +76,7 @@ mock.module('@/lib/config-provider', () => ({
}),
}));
-mock.module('@/lib/handoff/use-claude-desktop-integration', () => ({
+vi.doMock('@/lib/handoff/use-claude-desktop-integration', () => ({
useClaudeDesktopIntegration: () => ({ desktopPresent: false }),
}));
diff --git a/packages/app/src/components/settings/SettingsDialogShell.search.dom.test.tsx b/packages/app/src/components/settings/SettingsDialogShell.search.dom.test.tsx
new file mode 100644
index 000000000..730f2cbc2
--- /dev/null
+++ b/packages/app/src/components/settings/SettingsDialogShell.search.dom.test.tsx
@@ -0,0 +1,231 @@
+/**
+ * DOM tests for the settings-dialog search surface: the sidebar
+ * search box, its result navigation, the enabled-plugin gating of rule results,
+ * and the scroll-to-flash of a navigated field.
+ *
+ * Mirrors the mock harness in `SettingsDialogShell.dom.test.tsx`: the lazy body
+ * is a synchronous probe that records the props it receives (so we can assert
+ * `activeId` / `markdownlintRuleQuery` navigation) and renders a `[data-field]`
+ * node for the active section (so the Shell's flash effect has a target).
+ */
+
+import type { ConfigBinding, OkignoreBinding } from '@inkeep/open-knowledge-core';
+import { cleanup, render, screen, waitFor } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest';
+
+// Radix/cmdk reach for DOM globals the jsdom preload doesn't expose; hoist the
+// same shims the sibling shell test uses.
+type WindowGlobals = { MutationObserver?: typeof MutationObserver; NodeFilter?: typeof NodeFilter };
+type GlobalWithDomShims = typeof globalThis &
+ WindowGlobals & { window?: WindowGlobals; ResizeObserver?: unknown };
+const globalWithDomShims = globalThis as GlobalWithDomShims;
+if (
+ globalWithDomShims.MutationObserver === undefined &&
+ globalWithDomShims.window?.MutationObserver !== undefined
+) {
+ globalWithDomShims.MutationObserver = globalWithDomShims.window.MutationObserver;
+}
+if (
+ globalWithDomShims.NodeFilter === undefined &&
+ globalWithDomShims.window?.NodeFilter !== undefined
+) {
+ globalWithDomShims.NodeFilter = globalWithDomShims.window.NodeFilter;
+}
+if (globalWithDomShims.ResizeObserver === undefined) {
+ class NoopResizeObserver {
+ observe() {}
+ unobserve() {}
+ disconnect() {}
+ }
+ globalWithDomShims.ResizeObserver = NoopResizeObserver;
+}
+// jsdom does not implement scrollIntoView; the flash effect calls it.
+if (typeof HTMLElement.prototype.scrollIntoView !== 'function') {
+ HTMLElement.prototype.scrollIntoView = () => {};
+}
+
+interface BodyProps {
+ activeId: string;
+ userBinding: ConfigBinding | null;
+ okignoreBinding: OkignoreBinding | null;
+ okignoreSynced: boolean;
+ markdownlintRuleQuery?: { query: string; nonce: number } | null;
+}
+const probeProps: BodyProps[] = [];
+
+let mockCollabUrl: string | null = 'ws://test.invalid';
+let mockProjectConfig: unknown = { contentRules: { markdownlint: { enabled: true } } };
+
+// A minimal fake catalog — the index reads only id/alias/aliases/name.
+const FAKE_RULE_CATALOG = [
+ {
+ id: 'MD013',
+ alias: 'line-length',
+ aliases: ['line-length'],
+ name: 'Line length',
+ docUrl: '',
+ tags: [],
+ options: [],
+ },
+ {
+ id: 'MD001',
+ alias: 'heading-increment',
+ aliases: ['heading-increment'],
+ name: 'Heading levels increment',
+ docUrl: '',
+ tags: [],
+ options: [],
+ },
+];
+
+vi.doMock('@inkeep/open-knowledge-core', () => ({
+ get SHOW_INSTALL_SKILL() {
+ return true;
+ },
+ MARKDOWNLINT_RULE_CATALOG: FAKE_RULE_CATALOG,
+}));
+
+// The probe records props AND renders a `[data-field]` node for the active
+// preferences section so the Shell's imperative flash effect finds a target.
+vi.doMock('@/components/settings/SettingsDialogBodyLazy', () => ({
+ SettingsDialogBodyLazy: (props: BodyProps) => {
+ probeProps.push(props);
+ return (
+ <div data-testid="settings-body-probe">
+ {props.activeId === 'preferences' ? <div data-field="editor.wordWrap" /> : null}
+ </div>
+ );
+ },
+}));
+
+vi.doMock('@/editor/DocumentContext', () => ({
+ useDocumentContext: () => ({ collabUrl: mockCollabUrl }),
+ DocumentProvider: ({ children }: { children: React.ReactNode }) => children,
+}));
+
+vi.doMock('@/lib/config-provider', () => ({
+ useConfigContext: () => ({
+ userBinding: null,
+ userSynced: true,
+ projectBinding: null,
+ projectLocalBinding: null,
+ okignoreBinding: null,
+ okignoreSynced: false,
+ userConfig: null,
+ projectConfig: mockProjectConfig,
+ projectLocalConfig: null,
+ projectLocalSynced: false,
+ merged: null,
+ }),
+}));
+
+vi.doMock('@/lib/handoff/use-claude-desktop-integration', () => ({
+ useClaudeDesktopIntegration: () => ({
+ desktopPresent: false,
+ skillInstalled: false,
+ refresh: () => {},
+ }),
+}));
+
+const { SettingsDialogShell } = await import('./SettingsDialogShell');
+
+function latestProbe(): BodyProps | undefined {
+ return probeProps[probeProps.length - 1];
+}
+
+describe('settings dialog search', () => {
+ let consoleErrorSpy: ReturnType<typeof vi.spyOn>;
+
+ beforeEach(() => {
+ probeProps.length = 0;
+ mockCollabUrl = 'ws://test.invalid';
+ mockProjectConfig = { contentRules: { markdownlint: { enabled: true } } };
+ consoleErrorSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
+ });
+
+ afterEach(() => {
+ cleanup();
+ consoleErrorSpy.mockRestore();
+ });
+
+ test('empty query shows the plain group nav, no results list', () => {
+ render(<SettingsDialogShell open={true} onOpenChange={() => {}} />);
+ expect(screen.getByTestId('settings-sidebar-item-preferences')).toBeDefined();
+ expect(screen.queryByTestId('settings-search-results')).toBeNull();
+ });
+
+ test('typing a section name filters to a result that navigates on click', async () => {
+ const user = userEvent.setup();
+ render(<SettingsDialogShell open={true} onOpenChange={() => {}} />);
+
+ await user.type(screen.getByTestId('settings-search-input'), 'Sync');
+ const result = await screen.findByTestId('settings-search-result-section:sync');
+ // While searching, the plain group nav is hidden.
+ expect(screen.queryByTestId('settings-sidebar-item-preferences')).toBeNull();
+
+ await user.click(result);
+ expect(latestProbe()?.activeId).toBe('sync');
+ // Query cleared → group nav restored.
+ expect(screen.getByTestId('settings-sidebar-item-preferences')).toBeDefined();
+ });
+
+ test('a markdownlint rule is searchable when the plugin is enabled', async () => {
+ const user = userEvent.setup();
+ render(<SettingsDialogShell open={true} onOpenChange={() => {}} />);
+
+ await user.type(screen.getByTestId('settings-search-input'), 'MD013');
+ const result = await screen.findByTestId('settings-search-result-rule:MD013');
+
+ await user.click(result);
+ expect(latestProbe()?.activeId).toBe('plugin:markdownlint');
+ expect(latestProbe()?.markdownlintRuleQuery?.query).toBe('MD013');
+ });
+
+ test('markdownlint rules are NOT indexed when the plugin is disabled', async () => {
+ mockProjectConfig = { contentRules: { markdownlint: { enabled: false } } };
+ const user = userEvent.setup();
+ render(<SettingsDialogShell open={true} onOpenChange={() => {}} />);
+
+ await user.type(screen.getByTestId('settings-search-input'), 'MD013');
+ // No rule result; the panel item is gone from the sidebar too.
+ await waitFor(() => {
+ expect(screen.getByTestId('settings-search-empty')).toBeDefined();
+ });
+ expect(screen.queryByTestId('settings-search-result-rule:MD013')).toBeNull();
+ });
+
+ test('a no-match query renders the empty state', async () => {
+ const user = userEvent.setup();
+ render(<SettingsDialogShell open={true} onOpenChange={() => {}} />);
+
+ await user.type(screen.getByTestId('settings-search-input'), 'zzzznomatch');
+ await waitFor(() => {
+ expect(screen.getByTestId('settings-search-empty')).toBeDefined();
+ });
+ // The polite live region announces the (zero) result count to SR users.
+ expect(screen.getByTestId('settings-search-result-count').textContent).toContain('0');
+ });
+
+ test('navigating to a field flashes and scrolls its [data-field] node', async () => {
+ const scrollSpy = vi
+ .spyOn(HTMLElement.prototype, 'scrollIntoView')
+ .mockImplementation(() => {});
+ const user = userEvent.setup();
+ render(<SettingsDialogShell open={true} onOpenChange={() => {}} />);
+
+ await user.type(screen.getByTestId('settings-search-input'), 'Word wrap');
+ const result = await screen.findByTestId(
+ 'settings-search-result-field:preferences:editor.wordWrap',
+ );
+ await user.click(result);
+
+ expect(latestProbe()?.activeId).toBe('preferences');
+ await waitFor(() => {
+ const field = document.querySelector('[data-field="editor.wordWrap"]');
+ expect(field?.classList.contains('animate-settings-nav-flash')).toBe(true);
+ });
+ expect(scrollSpy).toHaveBeenCalled();
+ scrollSpy.mockRestore();
+ });
+});
diff --git a/packages/app/src/components/settings/SettingsDialogShell.terminal.dom.test.tsx b/packages/app/src/components/settings/SettingsDialogShell.terminal.dom.test.tsx
index 827f467bc..1a478067f 100644
--- a/packages/app/src/components/settings/SettingsDialogShell.terminal.dom.test.tsx
+++ b/packages/app/src/components/settings/SettingsDialogShell.terminal.dom.test.tsx
@@ -3,16 +3,18 @@
* web host, so its per-project revoke toggle must only be reachable under the
* Electron preload (`window.okDesktop`).
*/
-import { afterEach, beforeEach, describe, expect, mock, test } from 'bun:test';
+
import * as actualLinguiMacro from '@lingui/react/macro';
import { cleanup, render, screen } from '@testing-library/react';
import type { ReactNode } from 'react';
+import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest';
-mock.module('@inkeep/open-knowledge-core', () => ({
+vi.doMock('@inkeep/open-knowledge-core', () => ({
SHOW_INSTALL_SKILL: false,
+ MARKDOWNLINT_RULE_CATALOG: [],
}));
-mock.module('@lingui/react/macro', () => ({
+vi.doMock('@lingui/react/macro', () => ({
...actualLinguiMacro,
Trans: ({ children }: { children?: ReactNode }) => <>{children}</>,
useLingui: () => ({
@@ -27,11 +29,11 @@ mock.module('@lingui/react/macro', () => ({
}),
}));
-mock.module('@/components/settings/SettingsDialogBodyLazy', () => ({
+vi.doMock('@/components/settings/SettingsDialogBodyLazy', () => ({
SettingsDialogBodyLazy: () => <div data-testid="settings-body-probe" />,
}));
-mock.module('@/components/ui/dialog', () => ({
+vi.doMock('@/components/ui/dialog', () => ({
Dialog: ({ children, open }: { children?: ReactNode; open?: boolean }) =>
open ? <div role="dialog">{children}</div> : null,
DialogContent: ({ children, ...props }: { children?: ReactNode; [key: string]: unknown }) => (
@@ -43,15 +45,15 @@ mock.module('@/components/ui/dialog', () => ({
),
}));
-mock.module('@/components/ui/skeleton', () => ({
+vi.doMock('@/components/ui/skeleton', () => ({
Skeleton: ({ className }: { className?: string }) => <div className={className} />,
}));
-mock.module('@/editor/DocumentContext', () => ({
+vi.doMock('@/editor/DocumentContext', () => ({
useDocumentContext: () => ({ collabUrl: 'ws://test.invalid' }),
}));
-mock.module('@/lib/config-provider', () => ({
+vi.doMock('@/lib/config-provider', () => ({
useConfigContext: () => ({
userBinding: null,
userSynced: false,
@@ -60,7 +62,7 @@ mock.module('@/lib/config-provider', () => ({
}),
}));
-mock.module('@/lib/handoff/use-claude-desktop-integration', () => ({
+vi.doMock('@/lib/handoff/use-claude-desktop-integration', () => ({
useClaudeDesktopIntegration: () => ({ desktopPresent: false }),
}));
diff --git a/packages/app/src/components/settings/SettingsDialogShell.tsx b/packages/app/src/components/settings/SettingsDialogShell.tsx
index 4ce5dfeca..ff60908b7 100644
--- a/packages/app/src/components/settings/SettingsDialogShell.tsx
+++ b/packages/app/src/components/settings/SettingsDialogShell.tsx
@@ -29,11 +29,20 @@
*/
import { SHOW_INSTALL_SKILL } from '@inkeep/open-knowledge-core';
-import { Trans, useLingui } from '@lingui/react/macro';
+import { Plural, Trans, useLingui } from '@lingui/react/macro';
import { ArrowUpRight } from 'lucide-react';
-import { Suspense, useEffect, useState } from 'react';
+import { Suspense, useEffect, useRef, useState } from 'react';
+import { matchesCommandQuery, splitTextByQueryMatches } from '@/components/command-palette-search';
import { SettingsDialogBodyLazy } from '@/components/settings/SettingsDialogBodyLazy';
import { SettingsDialogErrorBoundary } from '@/components/settings/SettingsDialogErrorBoundary';
+import {
+ Command,
+ CommandEmpty,
+ CommandGroup,
+ CommandInput,
+ CommandItem,
+ CommandList,
+} from '@/components/ui/command';
import { Dialog, DialogContent, DialogDescription, DialogTitle } from '@/components/ui/dialog';
import { Skeleton } from '@/components/ui/skeleton';
import { useDocumentContext } from '@/editor/DocumentContext';
@@ -42,6 +51,8 @@ import { isFileProtocolPage } from '@/lib/file-protocol-page';
import { useClaudeDesktopIntegration } from '@/lib/handoff/use-claude-desktop-integration';
import { cn } from '@/lib/utils';
import { LINT_PLUGIN_META } from './lint-plugin-meta';
+import { buildSettingsSearchIndex, type SettingsSearchEntry } from './settings-search-index';
+import type { SidebarGroup, SidebarItem } from './settings-sidebar-types';
/**
* GitHub Releases tag URL — mirrors `releaseUrlFor` in the desktop main
@@ -55,23 +66,6 @@ function releaseNotesUrl(version: string): string {
return `https://github.com/inkeep/open-knowledge/releases/tag/v${encodeURIComponent(version)}`;
}
-interface SidebarItem {
- id: string;
- label: string;
-}
-
-interface SidebarGroup {
- id: 'user' | 'project' | 'plugins' | 'integrations';
- label: string;
- /**
- * `false` renders the group disabled (no-project state for THIS
- * PROJECT). Items are visible but not focusable; group label gets
- * an explanatory caption announced via aria-describedby.
- */
- enabled: boolean;
- items: SidebarItem[];
-}
-
interface SettingsDialogShellProps {
open: boolean;
onOpenChange: (open: boolean) => void;
@@ -87,10 +81,68 @@ export function SettingsDialogShell({ open, onOpenChange }: SettingsDialogShellP
// Always default to USER → Preferences on each fresh open. No
// in-session memory of last-viewed section.
const [activeId, setActiveId] = useState('preferences');
+ const [searchQuery, setSearchQuery] = useState('');
+ // Navigation tokens set by a search-result click. fieldFlash re-fires its
+ // consuming effect via object identity alone (each click sets a fresh
+ // object, same path or not). ruleQuery carries a nonce because its consumer
+ // (the markdownlint browser) keys its re-seed effect on primitive values
+ // threaded through props — identical query strings need the nonce to re-fire.
+ const [fieldFlash, setFieldFlash] = useState<{ path: string } | null>(null);
+ const [ruleQuery, setRuleQuery] = useState<{ query: string; nonce: number } | null>(null);
+ const navNonceRef = useRef(0);
+ const contentRef = useRef<HTMLElement | null>(null);
+
useEffect(() => {
- if (open) setActiveId('preferences');
+ if (open) {
+ setActiveId('preferences');
+ setSearchQuery('');
+ }
}, [open]);
+ // Imperative scroll-to-flash for a field the search navigated to. The target
+ // renders inside the lazily-loaded body and, for schema sections, only once
+ // its config binding has synced — so it can appear well after this effect
+ // fires. Rather than a fixed-frame retry (which can expire before the field
+ // mounts), watch the content subtree with a capped MutationObserver and flash
+ // the moment the `[data-field]` node appears. Uses a dedicated one-shot class
+ // no field's React `className` owns, so a re-render can't strip it mid-flash.
+ useEffect(() => {
+ if (!fieldFlash) return;
+ const container = contentRef.current;
+ if (!container) return;
+ const FLASH_CLASS = 'animate-settings-nav-flash';
+ let flashed: HTMLElement | null = null;
+ let removeTimer: ReturnType<typeof setTimeout> | null = null;
+ let giveUpTimer: ReturnType<typeof setTimeout> | null = null;
+ let observer: MutationObserver | null = null;
+
+ const tryFlash = (): boolean => {
+ const el = container.querySelector<HTMLElement>(`[data-field="${fieldFlash.path}"]`);
+ if (!el) return false;
+ el.scrollIntoView({ block: 'center' });
+ el.classList.add(FLASH_CLASS);
+ flashed = el;
+ removeTimer = setTimeout(() => el.classList.remove(FLASH_CLASS), 750);
+ return true;
+ };
+
+ if (!tryFlash()) {
+ // Field not mounted yet — watch for it, capped so we never observe forever.
+ observer = new MutationObserver(() => {
+ if (tryFlash()) observer?.disconnect();
+ });
+ observer.observe(container, { childList: true, subtree: true });
+ giveUpTimer = setTimeout(() => observer?.disconnect(), 4000);
+ }
+
+ return () => {
+ observer?.disconnect();
+ if (removeTimer) clearTimeout(removeTimer);
+ if (giveUpTimer) clearTimeout(giveUpTimer);
+ flashed?.classList.remove(FLASH_CLASS);
+ };
+ }, [fieldFlash]);
+
// hasProject signals whether the project-scope binding is a valid
// editing target. In current OK the editor UI always has a project
// when `collabUrl` is set; the disabled-THIS-PROJECT branch is
@@ -186,6 +238,26 @@ export function SettingsDialogShell({ open, onOpenChange }: SettingsDialogShellP
},
];
+ // Deep search corpus, derived from `groups` so every enablement gate
+ // (disabled THIS-PROJECT, absent/disabled plugins, desktop-only items) is
+ // inherited — disabled-plugin rules never surface. `t` resolves the FieldDef
+ // `MessageDescriptor` labels, the same call the body renders them with.
+ const searchEntries = buildSettingsSearchIndex({ groups, translate: t });
+
+ function handleNavigate(entry: SettingsSearchEntry) {
+ navNonceRef.current += 1;
+ const nonce = navNonceRef.current;
+ setActiveId(entry.sectionId);
+ if (entry.kind === 'field' && entry.targetField) {
+ setFieldFlash({ path: entry.targetField });
+ } else if (entry.kind === 'rule' && entry.ruleId) {
+ setRuleQuery({ query: entry.ruleId, nonce });
+ }
+ // Clearing the query collapses the results and restores the plain group nav
+ // on the now-active section.
+ setSearchQuery('');
+ }
+
return (
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent
@@ -198,8 +270,17 @@ export function SettingsDialogShell({ open, onOpenChange }: SettingsDialogShellP
<DialogDescription className="sr-only">
<Trans>Configure user, project, and integration settings.</Trans>
</DialogDescription>
- <SettingsSidebar groups={groups} activeId={activeId} onSelect={setActiveId} />
+ <SettingsSidebar
+ groups={groups}
+ activeId={activeId}
+ onSelect={setActiveId}
+ entries={searchEntries}
+ searchQuery={searchQuery}
+ onSearchChange={setSearchQuery}
+ onNavigate={handleNavigate}
+ />
<section
+ ref={contentRef}
aria-label={t`Settings content`}
className="min-h-0 flex-1 overflow-y-auto overscroll-contain subtle-scrollbar p-6"
// biome-ignore lint/a11y/noNoninteractiveTabindex: this scrollable content section must be focusable so keyboard users can scroll long settings pages.
@@ -212,6 +293,7 @@ export function SettingsDialogShell({ open, onOpenChange }: SettingsDialogShellP
userBinding={userSynced ? userBinding : null}
okignoreBinding={okignoreBinding}
okignoreSynced={okignoreSynced}
+ markdownlintRuleQuery={ruleQuery}
/>
</Suspense>
</SettingsDialogErrorBoundary>
@@ -225,10 +307,31 @@ interface SettingsSidebarProps {
groups: SidebarGroup[];
activeId: string;
onSelect: (id: string) => void;
+ entries: SettingsSearchEntry[];
+ searchQuery: string;
+ onSearchChange: (value: string) => void;
+ onNavigate: (entry: SettingsSearchEntry) => void;
}
-function SettingsSidebar({ groups, activeId, onSelect }: SettingsSidebarProps) {
+function SettingsSidebar({
+ groups,
+ activeId,
+ onSelect,
+ entries,
+ searchQuery,
+ onSearchChange,
+ onNavigate,
+}: SettingsSidebarProps) {
const { t } = useLingui();
+ const query = searchQuery.trim();
+ const results =
+ query === ''
+ ? []
+ : entries.filter((entry) => matchesCommandQuery(entry.label, query, entry.keywords));
+ const sectionResults = results.filter((entry) => entry.kind === 'section');
+ const fieldResults = results.filter((entry) => entry.kind === 'field');
+ const ruleResults = results.filter((entry) => entry.kind === 'rule');
+
// Single navigation landmark with an explicit label. A complementary
// landmark wrapping an unlabeled navigation produced two nested
// landmarks for one sidebar — landmark navigation surfaced both
@@ -239,21 +342,129 @@ function SettingsSidebar({ groups, activeId, onSelect }: SettingsSidebarProps) {
return (
<nav
aria-label={t`Settings sections`}
- className="flex shrink-0 gap-x-3 overflow-x-auto overscroll-contain subtle-scrollbar scroll-fade-mask-x-max-sm border-b bg-muted/30 px-3 py-2 max-sm:pt-10 sm:h-full sm:flex-col sm:gap-0 sm:overflow-x-visible sm:overflow-y-auto sm:border-r sm:border-b-0 sm:py-4"
+ className="flex shrink-0 gap-x-3 overflow-x-auto overscroll-contain subtle-scrollbar scroll-fade-mask-x-max-sm border-b bg-muted/30 px-3 py-2 max-sm:pt-10 sm:h-full sm:min-h-0 sm:flex-col sm:gap-0 sm:overflow-x-visible sm:border-r sm:border-b-0 sm:py-4"
>
- {groups.map((group) => (
- <SettingsSidebarGroup
- key={group.id}
- group={group}
- activeId={activeId}
- onSelect={onSelect}
+ {/* cmdk surface wraps ONLY the search input + results — its roving focus
+ never touches the plain-button group nav below (which keeps its
+ aria-current + disabled-group semantics). The popover-styled base
+ classes are reset so it sits flush as a plain sidebar search box. */}
+ <Command
+ shouldFilter={false}
+ className="h-auto w-full shrink-0 rounded-md border bg-transparent sm:mb-3"
+ data-testid="settings-search"
+ >
+ <CommandInput
+ value={searchQuery}
+ onValueChange={onSearchChange}
+ placeholder={t`Search settings`}
+ data-testid="settings-search-input"
/>
- ))}
- <SettingsSidebarVersion />
+ {/* Polite result-count announcement — cmdk's listbox semantics don't
+ tell SR users how many results a keystroke produced. Always mounted
+ (empty when idle) so the live region exists before it updates. */}
+ <span aria-live="polite" className="sr-only" data-testid="settings-search-result-count">
+ {query !== '' ? <Plural value={results.length} one="# result" other="# results" /> : null}
+ </span>
+ {query !== '' ? (
+ <CommandList data-testid="settings-search-results">
+ <CommandEmpty data-testid="settings-search-empty">
+ <Trans>No settings found</Trans>
+ </CommandEmpty>
+ {sectionResults.length > 0 ? (
+ <CommandGroup heading={t`Sections`}>
+ {sectionResults.map((entry) => (
+ <SettingsSearchResultItem
+ key={entry.id}
+ entry={entry}
+ query={query}
+ onNavigate={onNavigate}
+ />
+ ))}
+ </CommandGroup>
+ ) : null}
+ {fieldResults.length > 0 ? (
+ <CommandGroup heading={t`Settings`}>
+ {fieldResults.map((entry) => (
+ <SettingsSearchResultItem
+ key={entry.id}
+ entry={entry}
+ query={query}
+ onNavigate={onNavigate}
+ />
+ ))}
+ </CommandGroup>
+ ) : null}
+ {ruleResults.length > 0 ? (
+ <CommandGroup heading={t`markdownlint rules`}>
+ {ruleResults.map((entry) => (
+ <SettingsSearchResultItem
+ key={entry.id}
+ entry={entry}
+ query={query}
+ onNavigate={onNavigate}
+ />
+ ))}
+ </CommandGroup>
+ ) : null}
+ </CommandList>
+ ) : null}
+ </Command>
+
+ {/* Scroll region — keeps the search box above pinned in view while the
+ group list scrolls. `contents` on mobile leaves the group chips in the
+ nav's horizontal row unchanged; sm+ it becomes the vertical scroller. */}
+ <div className="contents subtle-scrollbar sm:flex sm:min-h-0 sm:flex-1 sm:flex-col sm:overflow-y-auto sm:overscroll-contain">
+ {/* Plain group nav — the sole content when not searching. */}
+ {query === ''
+ ? groups.map((group) => (
+ <SettingsSidebarGroup
+ key={group.id}
+ group={group}
+ activeId={activeId}
+ onSelect={onSelect}
+ />
+ ))
+ : null}
+ <SettingsSidebarVersion />
+ </div>
</nav>
);
}
+/**
+ * One search result row. The label's matched substrings are emphasized via the
+ * command-palette's `splitTextByQueryMatches` helper (reused, not reinvented).
+ */
+function SettingsSearchResultItem({
+ entry,
+ query,
+ onNavigate,
+}: {
+ entry: SettingsSearchEntry;
+ query: string;
+ onNavigate: (entry: SettingsSearchEntry) => void;
+}) {
+ return (
+ <CommandItem
+ value={entry.id}
+ onSelect={() => onNavigate(entry)}
+ data-testid={`settings-search-result-${entry.id}`}
+ >
+ <span className="truncate">
+ {splitTextByQueryMatches(entry.label, query).map((segment) =>
+ segment.match ? (
+ <span key={segment.start} className="font-semibold text-foreground">
+ {segment.text}
+ </span>
+ ) : (
+ <span key={segment.start}>{segment.text}</span>
+ ),
+ )}
+ </span>
+ </CommandItem>
+ );
+}
+
/**
* Bottom-pinned version + release-notes link. `mt-auto` works in the
* sm+ vertical flex-col layout; in the max-sm horizontal layout the
diff --git a/packages/app/src/components/settings/markdownlint-rule-browser.dom.test.tsx b/packages/app/src/components/settings/markdownlint-rule-browser.dom.test.tsx
index f580776d6..75c20a777 100644
--- a/packages/app/src/components/settings/markdownlint-rule-browser.dom.test.tsx
+++ b/packages/app/src/components/settings/markdownlint-rule-browser.dom.test.tsx
@@ -422,3 +422,40 @@ describe('MarkdownlintRuleBrowser — severity strings and disclosure', () => {
expect(screen.queryByRole('tooltip')).toBeNull();
});
});
+
+describe('MarkdownlintRuleBrowser — initialRuleQuery seeding (settings-search jump)', () => {
+ test('opens pre-filtered to the seeded rule, re-seeds on a new nonce, stays editable', async () => {
+ const { rerender } = render(
+ <TooltipProvider>
+ <MarkdownlintRuleBrowser initialRuleQuery={{ query: 'MD013', nonce: 1 }} />
+ </TooltipProvider>,
+ );
+ // The panel opens filtered to the seeded rule.
+ expect((screen.getByTestId('markdownlint-rule-search') as HTMLInputElement).value).toBe(
+ 'MD013',
+ );
+ expect(ruleRows().map((row) => row.getAttribute('data-testid'))).toEqual([
+ 'markdownlint-rule-row-MD013',
+ ]);
+
+ // A later navigation (new nonce) re-seeds even though the panel didn't remount.
+ rerender(
+ <TooltipProvider>
+ <MarkdownlintRuleBrowser initialRuleQuery={{ query: 'MD025', nonce: 2 }} />
+ </TooltipProvider>,
+ );
+ expect((screen.getByTestId('markdownlint-rule-search') as HTMLInputElement).value).toBe(
+ 'MD025',
+ );
+ expect(ruleRows().map((row) => row.getAttribute('data-testid'))).toEqual([
+ 'markdownlint-rule-row-MD025',
+ ]);
+
+ // The seeded value stays fully user-editable.
+ const search = screen.getByTestId('markdownlint-rule-search');
+ await userEvent.clear(search);
+ await userEvent.type(search, 'MD013');
+ expect(screen.getByTestId('markdownlint-rule-row-MD013')).toBeDefined();
+ expect(screen.queryByTestId('markdownlint-rule-row-MD025')).toBeNull();
+ });
+});
diff --git a/packages/app/src/components/settings/markdownlint-rule-browser.tsx b/packages/app/src/components/settings/markdownlint-rule-browser.tsx
index abd7f4b28..39239cd8a 100644
--- a/packages/app/src/components/settings/markdownlint-rule-browser.tsx
+++ b/packages/app/src/components/settings/markdownlint-rule-browser.tsx
@@ -22,7 +22,7 @@ import {
} from '@inkeep/open-knowledge-core';
import { Plural, Trans, useLingui } from '@lingui/react/macro';
import { ArrowUpRight, ChevronRight, Info, RotateCcw } from 'lucide-react';
-import { useState } from 'react';
+import { useEffect, useState } from 'react';
import { toast } from 'sonner';
import { Badge } from '@/components/ui/badge';
import { Button } from '@/components/ui/button';
@@ -50,18 +50,33 @@ interface MarkdownlintRuleBrowserProps {
* there. The Settings dialog (no file context) leaves it on.
*/
hideConfigSourceNote?: boolean;
+ /** When the settings search jumps to a rule, seed (and re-seed) this browser's search. */
+ initialRuleQuery?: { query: string; nonce: number } | null;
}
export function MarkdownlintRuleBrowser({
hideConfigSourceNote = false,
+ initialRuleQuery,
}: MarkdownlintRuleBrowserProps = {}) {
const { t } = useLingui();
const { data } = useProjectLintConfig();
const ready = data !== null;
const rules: RuleValues = data?.effective.plugins.markdownlint.rules ?? {};
const configFile = data?.configFile ?? null;
- const [search, setSearch] = useState('');
+ const [search, setSearch] = useState(initialRuleQuery?.query ?? '');
const [onlyModified, setOnlyModified] = useState(false);
+
+ // Re-seed the search on a later navigation to a rule — the panel does not
+ // remount between rule jumps (its `key` is the constant section id), so the
+ // initial `useState` seed only covers the first mount. `nonce` re-fires even
+ // when the same rule is chosen twice. The value stays fully user-editable
+ // afterwards via `setSearch` (the same handler the input uses).
+ const seedNonce = initialRuleQuery?.nonce;
+ const seedQuery = initialRuleQuery?.query;
+ useEffect(() => {
+ if (seedNonce === undefined || seedQuery === undefined) return;
+ setSearch(seedQuery);
+ }, [seedNonce, seedQuery]);
const [collapsed, setCollapsed] = useState<readonly RuleDisplayCategory[]>([]);
function setRule(ruleId: string, value: MarkdownlintRuleWriteValue | null) {
diff --git a/packages/app/src/components/settings/settings-fields.ts b/packages/app/src/components/settings/settings-fields.ts
new file mode 100644
index 000000000..7a060d874
--- /dev/null
+++ b/packages/app/src/components/settings/settings-fields.ts
@@ -0,0 +1,73 @@
+/**
+ * Schema-driven settings field definitions, extracted from the heavy lazy
+ * `SettingsDialogBody` so the main-chunk settings SEARCH index can read field
+ * labels without pulling the form harness (RHF, ConfigSchema, schema-walker)
+ * into the main bundle. Deps here are intentionally light: the `MessageDescriptor`
+ * type + the `msg` macro only.
+ *
+ * The body imports these back for rendering; `INDEXED_FIELD_GROUPS` maps each
+ * FieldDef array to the `activeId` section it renders under, so the search index
+ * can attribute a field hit to a navigable section.
+ */
+import type { MessageDescriptor } from '@lingui/core';
+import { msg } from '@lingui/core/macro';
+
+export interface FieldDef {
+ path: string[];
+ label: MessageDescriptor;
+ description?: MessageDescriptor;
+ /**
+ * Optional override: 'enum-toggle' renders enum as a ToggleGroup;
+ * 'theme-tiles' renders the IDE color-palette tile picker; default is a
+ * select-style toggle.
+ */
+ control?: 'enum-toggle' | 'theme-tiles';
+}
+
+export const FIELDS_USER_PREFERENCES: FieldDef[] = [
+ {
+ path: ['appearance', 'theme'],
+ label: msg`Theme`,
+ description: msg`Light, dark, or follow the OS.`,
+ control: 'enum-toggle',
+ },
+ {
+ path: ['editor', 'wordWrap'],
+ label: msg`Word wrap`,
+ description: msg`Wrap long lines in the markdown source editor.`,
+ },
+ {
+ path: ['appearance', 'preview', 'autoOpen'],
+ label: msg`Open preview when agent edits`,
+ description: msg`When enabled, the agent opens or refreshes the preview after each edit. Disable if you manage your own preview window (OK Desktop, a browser tab on another display, etc.).`,
+ },
+];
+
+// The color-theme picker is a theme "plugin": it lives in the Plugins menu
+// (Settings → Plugins → Themes) as a peer of the lint plugins, not in
+// Preferences. `appearance.theme` (light/dark/system) stays in Preferences.
+export const FIELDS_THEME_PLUGIN: FieldDef[] = [
+ {
+ path: ['appearance', 'colorTheme'],
+ label: msg`Color theme`,
+ description: msg`Pick a built-in IDE palette. The dark IDE themes override the light/dark setting in Preferences.`,
+ control: 'theme-tiles',
+ },
+];
+
+/** A settings section's `activeId` paired with the schema fields it renders. */
+export interface IndexedFieldGroup {
+ sectionId: string;
+ fields: FieldDef[];
+}
+
+/**
+ * The schema-field groups the settings search indexes, keyed to the section id
+ * a field hit navigates to. Only the two declarative `FieldDef` arrays are
+ * indexed at field granularity; bespoke non-schema sections are reachable via
+ * their section-level entry.
+ */
+export const INDEXED_FIELD_GROUPS: IndexedFieldGroup[] = [
+ { sectionId: 'preferences', fields: FIELDS_USER_PREFERENCES },
+ { sectionId: 'plugin:theme', fields: FIELDS_THEME_PLUGIN },
+];
diff --git a/packages/app/src/components/settings/settings-search-index.test.ts b/packages/app/src/components/settings/settings-search-index.test.ts
new file mode 100644
index 000000000..3fab29fab
--- /dev/null
+++ b/packages/app/src/components/settings/settings-search-index.test.ts
@@ -0,0 +1,134 @@
+import { MARKDOWNLINT_RULE_CATALOG } from '@inkeep/open-knowledge-core';
+import { describe, expect, test } from 'vitest';
+import { matchesCommandQuery } from '@/components/command-palette-search';
+import { buildSettingsSearchIndex } from './settings-search-index';
+import type { SidebarGroup } from './settings-sidebar-types';
+
+// A translate stub — the FieldDef labels are Lingui MessageDescriptors; the
+// real Shell passes `useLingui().t`. For the index we only need a string.
+const translate = (message: { id?: string }) => message.id ?? '';
+
+function groupsFixture(opts: {
+ projectEnabled?: boolean;
+ markdownlintVisible?: boolean;
+ themeVisible?: boolean;
+}): SidebarGroup[] {
+ const { projectEnabled = true, markdownlintVisible = true, themeVisible = true } = opts;
+ const pluginItems = [
+ ...(markdownlintVisible ? [{ id: 'plugin:markdownlint', label: 'markdownlint' }] : []),
+ ...(themeVisible ? [{ id: 'plugin:theme', label: 'Themes' }] : []),
+ ];
+ return [
+ {
+ id: 'user',
+ label: 'User',
+ enabled: true,
+ items: [{ id: 'preferences', label: 'Preferences' }],
+ },
+ {
+ id: 'project',
+ label: 'This project',
+ enabled: projectEnabled,
+ items: [{ id: 'sync', label: 'Sync' }],
+ },
+ { id: 'plugins', label: 'Plugins', enabled: true, items: pluginItems },
+ ];
+}
+
+describe('buildSettingsSearchIndex', () => {
+ test('emits a section entry per item of an ENABLED group only', () => {
+ const enabled = buildSettingsSearchIndex({
+ groups: groupsFixture({ projectEnabled: true }),
+ translate,
+ });
+ expect(enabled.some((e) => e.kind === 'section' && e.sectionId === 'sync')).toBe(true);
+
+ const disabled = buildSettingsSearchIndex({
+ groups: groupsFixture({ projectEnabled: false }),
+ translate,
+ });
+ // The disabled THIS-PROJECT group contributes no section entries.
+ expect(disabled.some((e) => e.sectionId === 'sync')).toBe(false);
+ expect(disabled.some((e) => e.sectionId === 'preferences')).toBe(true);
+ });
+
+ test('indexes preferences fields (visible section) with description keywords + targetField', () => {
+ const entries = buildSettingsSearchIndex({ groups: groupsFixture({}), translate });
+ const fieldEntries = entries.filter((e) => e.kind === 'field' && e.sectionId === 'preferences');
+ expect(fieldEntries.length).toBeGreaterThan(0);
+ const wordWrap = fieldEntries.find((e) => e.targetField === 'editor.wordWrap');
+ expect(wordWrap).toBeDefined();
+ expect(wordWrap?.kind).toBe('field');
+ expect(wordWrap?.sectionId).toBe('preferences');
+ });
+
+ test('theme field indexed only when the theme plugin is a visible section', () => {
+ const withTheme = buildSettingsSearchIndex({
+ groups: groupsFixture({ themeVisible: true }),
+ translate,
+ });
+ expect(withTheme.some((e) => e.targetField === 'appearance.colorTheme')).toBe(true);
+
+ const withoutTheme = buildSettingsSearchIndex({
+ groups: groupsFixture({ themeVisible: false }),
+ translate,
+ });
+ expect(withoutTheme.some((e) => e.targetField === 'appearance.colorTheme')).toBe(false);
+ });
+
+ test('markdownlint rules indexed only when the panel is visible (disabled plugin excluded)', () => {
+ const enabled = buildSettingsSearchIndex({
+ groups: groupsFixture({ markdownlintVisible: true }),
+ translate,
+ });
+ const ruleEntries = enabled.filter((e) => e.kind === 'rule');
+ expect(ruleEntries.length).toBe(MARKDOWNLINT_RULE_CATALOG.length);
+ expect(ruleEntries.every((e) => e.sectionId === 'plugin:markdownlint')).toBe(true);
+
+ const disabled = buildSettingsSearchIndex({
+ groups: groupsFixture({ markdownlintVisible: false }),
+ translate,
+ });
+ expect(disabled.some((e) => e.kind === 'rule')).toBe(false);
+ });
+
+ test('a rule entry carries id + alias + aliases as keywords', () => {
+ const entries = buildSettingsSearchIndex({ groups: groupsFixture({}), translate });
+ const sample = MARKDOWNLINT_RULE_CATALOG[0];
+ const entry = entries.find((e) => e.kind === 'rule' && e.ruleId === sample.id);
+ expect(entry).toBeDefined();
+ expect(entry?.keywords).toContain(sample.id);
+ expect(entry?.keywords).toContain(sample.alias);
+ for (const alias of sample.aliases) {
+ expect(entry?.keywords).toContain(alias);
+ }
+ });
+});
+
+// Pins the settings-specific search SEMANTICS: the entries this module produces,
+// filtered by the same `matchesCommandQuery` the sidebar uses, resolve the
+// queries a user actually types. (Field label matching is covered end-to-end at
+// real-locale fidelity by the e2e; here we pin rule + section matching, which is
+// deterministic without the Lingui runtime.)
+describe('buildSettingsSearchIndex + matchesCommandQuery', () => {
+ const entries = buildSettingsSearchIndex({ groups: groupsFixture({}), translate });
+ const find = (query: string) =>
+ entries.filter((entry) => matchesCommandQuery(entry.label, query, entry.keywords));
+
+ test('a markdownlint rule is found by upstream name, id (case-insensitive), and alias', () => {
+ const md013 = MARKDOWNLINT_RULE_CATALOG.find((rule) => rule.id === 'MD013');
+ expect(md013).toBeDefined();
+ if (!md013) return;
+ expect(find(md013.name).some((e) => e.ruleId === 'MD013')).toBe(true);
+ expect(find('md013').some((e) => e.ruleId === 'MD013')).toBe(true);
+ expect(find(md013.alias).some((e) => e.ruleId === 'MD013')).toBe(true);
+ });
+
+ test('a section is found by its label', () => {
+ expect(find('Sync').some((e) => e.kind === 'section' && e.sectionId === 'sync')).toBe(true);
+ });
+
+ test('a query matching nothing returns no entries', () => {
+ expect(find('zzzznomatch')).toHaveLength(0);
+ });
+});
diff --git a/packages/app/src/components/settings/settings-search-index.ts b/packages/app/src/components/settings/settings-search-index.ts
new file mode 100644
index 000000000..60233831d
--- /dev/null
+++ b/packages/app/src/components/settings/settings-search-index.ts
@@ -0,0 +1,98 @@
+/**
+ * Pure builder for the Settings dialog search index. The index is derived from
+ * the SAME `groups` array the sidebar renders, so every enablement gate (a
+ * disabled THIS-PROJECT group, an absent/disabled plugin, desktop-only items)
+ * is inherited for free — a section (and its fields/rules) is indexed only when
+ * it is actually reachable. In particular, markdownlint rules are indexed only
+ * when the markdownlint panel is a visible sidebar item, which is exactly the
+ * "plugin enabled + project open" predicate. No gating logic is duplicated here.
+ *
+ * Filtering at render time reuses `matchesCommandQuery` (the same substring
+ * matcher the ⌘K command palette uses), so this module only shapes the corpus.
+ */
+import { MARKDOWNLINT_RULE_CATALOG } from '@inkeep/open-knowledge-core';
+import type { MessageDescriptor } from '@lingui/core';
+import { INDEXED_FIELD_GROUPS } from './settings-fields';
+import type { SidebarGroup } from './settings-sidebar-types';
+
+type SettingsSearchKind = 'section' | 'field' | 'rule';
+
+export interface SettingsSearchEntry {
+ /** Stable, unique key — also the cmdk CommandItem `value`. */
+ id: string;
+ kind: SettingsSearchKind;
+ /** `activeId` this result navigates to. */
+ sectionId: string;
+ /** Primary display + search text. */
+ label: string;
+ /** Extra search terms (group label, description, rule id/aliases). */
+ keywords: string[];
+ /** Dotted config path — field entries only. Drives the scroll-to-flash. */
+ targetField?: string;
+ /** markdownlint rule id — rule entries only. Seeds the rule browser's search. */
+ ruleId?: string;
+}
+
+/**
+ * Build the flat, navigable search corpus for the current dialog state.
+ * `translate` resolves a Lingui `MessageDescriptor` (the FieldDef labels) to a
+ * string — pass `useLingui().t`, the same call the body uses to render them.
+ */
+export function buildSettingsSearchIndex(input: {
+ groups: readonly SidebarGroup[];
+ translate: (message: MessageDescriptor) => string;
+}): SettingsSearchEntry[] {
+ const { groups, translate } = input;
+ const entries: SettingsSearchEntry[] = [];
+
+ // Visible, navigable sections = items of ENABLED groups only.
+ const visibleSectionIds = new Set<string>();
+ for (const group of groups) {
+ if (!group.enabled) continue;
+ for (const item of group.items) {
+ visibleSectionIds.add(item.id);
+ entries.push({
+ id: `section:${item.id}`,
+ kind: 'section',
+ sectionId: item.id,
+ label: item.label,
+ keywords: [group.label],
+ });
+ }
+ }
+
+ // Schema fields — only for a section that is actually reachable (auto-drops
+ // the theme field when the theme plugin is off, since `plugin:theme` won't be
+ // a visible item).
+ for (const fieldGroup of INDEXED_FIELD_GROUPS) {
+ if (!visibleSectionIds.has(fieldGroup.sectionId)) continue;
+ for (const field of fieldGroup.fields) {
+ const path = field.path.join('.');
+ entries.push({
+ id: `field:${fieldGroup.sectionId}:${path}`,
+ kind: 'field',
+ sectionId: fieldGroup.sectionId,
+ label: translate(field.label),
+ keywords: field.description ? [translate(field.description)] : [],
+ targetField: path,
+ });
+ }
+ }
+
+ // markdownlint rules — only when the panel is a visible section (inherits the
+ // enabled + project-open gate). This satisfies "disabled plugins excluded".
+ if (visibleSectionIds.has('plugin:markdownlint')) {
+ for (const rule of MARKDOWNLINT_RULE_CATALOG) {
+ entries.push({
+ id: `rule:${rule.id}`,
+ kind: 'rule',
+ sectionId: 'plugin:markdownlint',
+ label: rule.name,
+ keywords: [rule.id, rule.alias, ...rule.aliases],
+ ruleId: rule.id,
+ });
+ }
+ }
+
+ return entries;
+}
diff --git a/packages/app/src/components/settings/settings-sidebar-types.ts b/packages/app/src/components/settings/settings-sidebar-types.ts
new file mode 100644
index 000000000..2243fd0d1
--- /dev/null
+++ b/packages/app/src/components/settings/settings-sidebar-types.ts
@@ -0,0 +1,24 @@
+/**
+ * Sidebar group/item shape for the Settings dialog. Lifted out of
+ * `SettingsDialogShell` so the pure settings-search index can consume the same
+ * `groups` the sidebar renders (its enablement gates are the single source of
+ * "which sections are reachable") without importing the Shell — which would
+ * create a cycle.
+ */
+
+export interface SidebarItem {
+ id: string;
+ label: string;
+}
+
+export interface SidebarGroup {
+ id: 'user' | 'project' | 'plugins' | 'integrations';
+ label: string;
+ /**
+ * `false` renders the group disabled (no-project state for THIS
+ * PROJECT). Items are visible but not focusable; group label gets
+ * an explanatory caption announced via aria-describedby.
+ */
+ enabled: boolean;
+ items: SidebarItem[];
+}
diff --git a/packages/app/src/globals.css b/packages/app/src/globals.css
index b06fbe751..7e771fb6c 100644
--- a/packages/app/src/globals.css
+++ b/packages/app/src/globals.css
@@ -276,6 +276,28 @@
}
--animate-settings-flash: settings-flash 600ms ease-out;
+
+ /* Navigation highlight — played once when the settings search jumps to a
+ field. Neutral primary outline (not the destructive red of settings-flash,
+ which signals a validation error). A dedicated one-shot class so the
+ imperative classList toggle can't collide with a field's own React
+ className. */
+ @keyframes settings-nav-flash {
+ 0% {
+ outline: 2px solid hsl(var(--primary) / 0);
+ outline-offset: 2px;
+ }
+ 25% {
+ outline: 2px solid hsl(var(--primary) / 0.7);
+ outline-offset: 2px;
+ }
+ 100% {
+ outline: 2px solid hsl(var(--primary) / 0);
+ outline-offset: 2px;
+ }
+ }
+
+ --animate-settings-nav-flash: settings-nav-flash 700ms ease-out;
}
/* Push-mode pulse hint — plays once when an in-sidebar action (file pick,
@@ -292,6 +314,9 @@
.animate-settings-flash {
animation: none;
}
+ .animate-settings-nav-flash {
+ animation: none;
+ }
}
/* Dialog/Sheet overlays carry a viewport-sized `backdrop-filter: blur` over
diff --git a/packages/app/src/locales/en/messages.json b/packages/app/src/locales/en/messages.json
index 70843f10f..e84ee4948 100644
--- a/packages/app/src/locales/en/messages.json
+++ b/packages/app/src/locales/en/messages.json
@@ -94,6 +94,7 @@
"170Js2": ["Hide panel"],
"1AumWo": ["Push failed — check the server logs for details."],
"1CalO6": ["Style"],
+ "1DahsC": ["Search settings"],
"1EcCom": [["keyName"], " value"],
"1FLarN": ["Describe what you want to create to continue"],
"1GhYxC": ["of ", ["totalPages"]],
@@ -221,6 +222,7 @@
],
"484LKL": ["Remove link"],
"48uGTI": ["Failed to load docs. Press Escape and re-open to retry."],
+ "494br3": ["Shared with everyone on this project — committed to config.yml via git."],
"4A3Yzu": ["Code block"],
"4BITzH": ["Error:"],
"4CfgPM": ["Project folder created, but git init failed. Try again."],
@@ -1256,6 +1258,7 @@
],
"R0jJzV": ["Paste URL, owner/repo, or search your repos"],
"R3y75Z": ["Edit source"],
+ "R4OWFD": ["Sections"],
"R65q-K": [
"A real shell is off for this project. Turning it on runs commands with the full access of your macOS user account."
],
@@ -1339,6 +1342,7 @@
"TJnkyf": ["ok ui responded but server.lock has no port yet"],
"TKQ7K-": ["Install"],
"TLIO3j": ["Toggle italic formatting."],
+ "TQJCR6": [["0", "plural", { "one": ["#", " result"], "other": ["#", " results"] }]],
"TUzThQ": ["Share skills"],
"T_R-Qz": ["Primary"],
"T_wG4n": ["We couldn't check your GitHub connection."],
@@ -1689,6 +1693,7 @@
["folderName"],
"/ and all files inside? This action cannot be undone."
],
+ "a7P3nH": ["Personal to this device — stored in your user config, not shared."],
"a9OzSn": ["No pages found for \"", ["trimmedQuery"], "\""],
"aBgwis": ["Scope"],
"aByJ8j": ["How does sharing work?"],
@@ -2181,6 +2186,7 @@
"lb_UU4": ["Sync now"],
"lbkOif": ["Undo or redo visual-editor changes through TipTap collaboration history."],
"lhjq3G": ["Reset ", ["labelText"], " to default"],
+ "ljFWEt": ["No settings found"],
"ljHjfg": ["That branch is already open in another worktree."],
"lkYioO": ["Show or hide document panel"],
"ll2yNl": ["Content directory"],
@@ -2606,6 +2612,7 @@
"uynXup": [["tokens", "plural", { "one": ["token"], "other": ["tokens"] }]],
"v-h2hx": ["Delete ", ["targetGitPath"]],
"v2ZW0K": ["Enable terminal"],
+ "v2a04T": ["markdownlint rules"],
"v41fCm": ["File not found"],
"v75Em9": [
[
diff --git a/packages/app/src/locales/en/messages.po b/packages/app/src/locales/en/messages.po
index 719df6b9a..d7bfd8d51 100644
--- a/packages/app/src/locales/en/messages.po
+++ b/packages/app/src/locales/en/messages.po
@@ -156,6 +156,11 @@ msgstr "{0, plural, one {# option set} other {# options set}}"
msgid "{0, plural, one {# request blocked by the preview's security policy} other {# requests blocked by the preview's security policy}}"
msgstr "{0, plural, one {# request blocked by the preview's security policy} other {# requests blocked by the preview's security policy}}"
+#. placeholder {0}: results.length
+#: src/components/settings/SettingsDialogShell.tsx
+msgid "{0, plural, one {# result} other {# results}}"
+msgstr "{0, plural, one {# result} other {# results}}"
+
#. placeholder {0}: folder.templateCount
#: src/components/CreatedItemsList.tsx
msgid "{0, plural, one {# template} other {# templates}}"
@@ -1717,7 +1722,7 @@ msgstr "Collapse terminal"
msgid "Collapsible section with a clickable summary."
msgstr "Collapsible section with a clickable summary."
-#: src/components/settings/SettingsDialogBody.tsx
+#: src/components/settings/settings-fields.ts
msgid "Color theme"
msgstr "Color theme"
@@ -4481,7 +4486,7 @@ msgstr "Level"
msgid "Light"
msgstr "Light"
-#: src/components/settings/SettingsDialogBody.tsx
+#: src/components/settings/settings-fields.ts
msgid "Light, dark, or follow the OS."
msgstr "Light, dark, or follow the OS."
@@ -4744,6 +4749,10 @@ msgstr "Markdown"
msgid "Markdown source"
msgstr "Markdown source"
+#: src/components/settings/SettingsDialogShell.tsx
+msgid "markdownlint rules"
+msgstr "markdownlint rules"
+
#: src/editor/find-replace/FindReplaceBar.tsx
msgid "Match case"
msgstr "Match case"
@@ -5322,6 +5331,10 @@ msgstr "No results"
msgid "No rules match your filters."
msgstr "No rules match your filters."
+#: src/components/settings/SettingsDialogShell.tsx
+msgid "No settings found"
+msgstr "No settings found"
+
#: src/components/SkillsSidebarSection.tsx
msgid "No skills yet."
msgstr "No skills yet."
@@ -5680,7 +5693,7 @@ msgstr "Open Navigator"
msgid "Open or close visual-editor find."
msgstr "Open or close visual-editor find."
-#: src/components/settings/SettingsDialogBody.tsx
+#: src/components/settings/settings-fields.ts
msgid "Open preview when agent edits"
msgstr "Open preview when agent edits"
@@ -6029,6 +6042,10 @@ msgstr "Permanently deletes <0>{targetGitPath}</0> and all its git history. Work
msgid "Permission denied"
msgstr "Permission denied"
+#: src/components/settings/ScopeBadge.tsx
+msgid "Personal to this device — stored in your user config, not shared."
+msgstr "Personal to this device — stored in your user config, not shared."
+
#: src/components/settings/CustomThemeEditor.tsx
msgid "Pick “Custom” above to use this palette."
msgstr "Pick “Custom” above to use this palette."
@@ -6041,7 +6058,7 @@ msgstr "Pick <0>openknowledge.skill</0> from your <1>Downloads</1> folder. It en
msgid "Pick a built-in IDE color palette, or define your own."
msgstr "Pick a built-in IDE color palette, or define your own."
-#: src/components/settings/SettingsDialogBody.tsx
+#: src/components/settings/settings-fields.ts
msgid "Pick a built-in IDE palette. The dark IDE themes override the light/dark setting in Preferences."
msgstr "Pick a built-in IDE palette. The dark IDE themes override the light/dark setting in Preferences."
@@ -6155,6 +6172,7 @@ msgstr "project"
#: src/components/CommandPalette.tsx
#: src/components/PanelScopeHeader.tsx
+#: src/components/settings/ScopeBadge.tsx
#: src/lib/skill-scope.ts
msgid "Project"
msgstr "Project"
@@ -6958,6 +6976,10 @@ msgstr "Search rules"
msgid "Search rules by id, alias, or name"
msgstr "Search rules by id, alias, or name"
+#: src/components/settings/SettingsDialogShell.tsx
+msgid "Search settings"
+msgstr "Search settings"
+
#: src/components/settings/SearchSection.tsx
msgid "Search settings not yet loaded — try again in a moment"
msgstr "Search settings not yet loaded — try again in a moment"
@@ -6999,6 +7021,10 @@ msgstr "Secrets like API keys and tokens are redacted automatically."
msgid "Section <0>(optional heading anchor)</0>"
msgstr "Section <0>(optional heading anchor)</0>"
+#: src/components/settings/SettingsDialogShell.tsx
+msgid "Sections"
+msgstr "Sections"
+
#: src/editor/slash-command/component-items.tsx
msgid "See <0>#design-docs</0> for the latest specs."
msgstr "See <0>#design-docs</0> for the latest specs."
@@ -7232,6 +7258,10 @@ msgstr "Shared repositories"
msgid "Shared via git with everyone working on this project."
msgstr "Shared via git with everyone working on this project."
+#: src/components/settings/ScopeBadge.tsx
+msgid "Shared with everyone on this project — committed to config.yml via git."
+msgstr "Shared with everyone on this project — committed to config.yml via git."
+
#: src/components/PublishToGitHubDialog.tsx
msgid "Sharing a doc needs a GitHub repository. Create one for this project."
msgstr "Sharing a doc needs a GitHub repository. Create one for this project."
@@ -8043,7 +8073,7 @@ msgstr "The terminal session ended."
msgid "The terminal stopped unexpectedly."
msgstr "The terminal stopped unexpectedly."
-#: src/components/settings/SettingsDialogBody.tsx
+#: src/components/settings/settings-fields.ts
msgid "Theme"
msgstr "Theme"
@@ -8669,6 +8699,7 @@ msgstr "Use lowercase letters, digits, and hyphens only."
msgid "Use the default OpenAI endpoint or override it with an OpenAI-compatible base URL for Azure or a self-hosted provider."
msgstr "Use the default OpenAI endpoint or override it with an OpenAI-compatible base URL for Azure or a self-hosted provider."
+#: src/components/settings/ScopeBadge.tsx
#: src/components/settings/SettingsDialogShell.tsx
msgid "User"
msgstr "User"
@@ -8833,7 +8864,7 @@ msgstr "What would you like to create?"
msgid "What's new"
msgstr "What's new"
-#: src/components/settings/SettingsDialogBody.tsx
+#: src/components/settings/settings-fields.ts
msgid "When enabled, the agent opens or refreshes the preview after each edit. Disable if you manage your own preview window (OK Desktop, a browser tab on another display, etc.)."
msgstr "When enabled, the agent opens or refreshes the preview after each edit. Disable if you manage your own preview window (OK Desktop, a browser tab on another display, etc.)."
@@ -8890,7 +8921,7 @@ msgstr "Will be saved as <0>{sanitized}</0>."
msgid "Will replace existing OpenKnowledge entry"
msgstr "Will replace existing OpenKnowledge entry"
-#: src/components/settings/SettingsDialogBody.tsx
+#: src/components/settings/settings-fields.ts
msgid "Word wrap"
msgstr "Word wrap"
@@ -8920,7 +8951,7 @@ msgstr "worktree of {worktreeOf}"
msgid "Worktrees"
msgstr "Worktrees"
-#: src/components/settings/SettingsDialogBody.tsx
+#: src/components/settings/settings-fields.ts
msgid "Wrap long lines in the markdown source editor."
msgstr "Wrap long lines in the markdown source editor."
diff --git a/packages/app/src/locales/pseudo/messages.json b/packages/app/src/locales/pseudo/messages.json
index ca4732529..51616af66 100644
--- a/packages/app/src/locales/pseudo/messages.json
+++ b/packages/app/src/locales/pseudo/messages.json
@@ -94,6 +94,7 @@
"170Js2": ["Ĥĩďē ƥàńēĺ"],
"1AumWo": ["Ƥũśĥ ƒàĩĺēď — ćĥēćķ ţĥē śēŕvēŕ ĺōĝś ƒōŕ ďēţàĩĺś."],
"1CalO6": ["Śţŷĺē"],
+ "1DahsC": ["Śēàŕćĥ śēţţĩńĝś"],
"1EcCom": [["keyName"], " vàĺũē"],
"1FLarN": ["Ďēśćŕĩƀē ŵĥàţ ŷōũ ŵàńţ ţō ćŕēàţē ţō ćōńţĩńũē"],
"1GhYxC": ["ōƒ ", ["totalPages"]],
@@ -221,6 +222,7 @@
],
"484LKL": ["Ŕēḿōvē ĺĩńķ"],
"48uGTI": ["Ƒàĩĺēď ţō ĺōàď ďōćś. Ƥŕēśś Ēśćàƥē àńď ŕē-ōƥēń ţō ŕēţŕŷ."],
+ "494br3": ["Śĥàŕēď ŵĩţĥ ēvēŕŷōńē ōń ţĥĩś ƥŕōĴēćţ — ćōḿḿĩţţēď ţō ćōńƒĩĝ.ŷḿĺ vĩà ĝĩţ."],
"4A3Yzu": ["Ćōďē ƀĺōćķ"],
"4BITzH": ["Ēŕŕōŕ:"],
"4CfgPM": ["ƤŕōĴēćţ ƒōĺďēŕ ćŕēàţēď, ƀũţ ĝĩţ ĩńĩţ ƒàĩĺēď. Ţŕŷ àĝàĩń."],
@@ -1256,6 +1258,7 @@
],
"R0jJzV": ["Ƥàśţē ŨŔĹ, ōŵńēŕ/ŕēƥō, ōŕ śēàŕćĥ ŷōũŕ ŕēƥōś"],
"R3y75Z": ["Ēďĩţ śōũŕćē"],
+ "R4OWFD": ["Śēćţĩōńś"],
"R65q-K": [
"À ŕēàĺ śĥēĺĺ ĩś ōƒƒ ƒōŕ ţĥĩś ƥŕōĴēćţ. Ţũŕńĩńĝ ĩţ ōń ŕũńś ćōḿḿàńďś ŵĩţĥ ţĥē ƒũĺĺ àććēśś ōƒ ŷōũŕ ḿàćŌŚ ũśēŕ àććōũńţ."
],
@@ -1339,6 +1342,7 @@
"TJnkyf": ["ōķ ũĩ ŕēśƥōńďēď ƀũţ śēŕvēŕ.ĺōćķ ĥàś ńō ƥōŕţ ŷēţ"],
"TKQ7K-": ["Ĩńśţàĺĺ"],
"TLIO3j": ["Ţōĝĝĺē ĩţàĺĩć ƒōŕḿàţţĩńĝ."],
+ "TQJCR6": [["0", "plural", { "one": ["#", " ŕēśũĺţ"], "other": ["#", " ŕēśũĺţś"] }]],
"TUzThQ": ["Śĥàŕē śķĩĺĺś"],
"T_R-Qz": ["Ƥŕĩḿàŕŷ"],
"T_wG4n": ["Ŵē ćōũĺďń'ţ ćĥēćķ ŷōũŕ ĜĩţĤũƀ ćōńńēćţĩōń."],
@@ -1689,6 +1693,7 @@
["folderName"],
"/ àńď àĺĺ ƒĩĺēś ĩńśĩďē? Ţĥĩś àćţĩōń ćàńńōţ ƀē ũńďōńē."
],
+ "a7P3nH": ["Ƥēŕśōńàĺ ţō ţĥĩś ďēvĩćē — śţōŕēď ĩń ŷōũŕ ũśēŕ ćōńƒĩĝ, ńōţ śĥàŕēď."],
"a9OzSn": ["Ńō ƥàĝēś ƒōũńď ƒōŕ \"", ["trimmedQuery"], "\""],
"aBgwis": ["Śćōƥē"],
"aByJ8j": ["Ĥōŵ ďōēś śĥàŕĩńĝ ŵōŕķ?"],
@@ -2181,6 +2186,7 @@
"lb_UU4": ["Śŷńć ńōŵ"],
"lbkOif": ["Ũńďō ōŕ ŕēďō vĩśũàĺ-ēďĩţōŕ ćĥàńĝēś ţĥŕōũĝĥ ŢĩƥŢàƥ ćōĺĺàƀōŕàţĩōń ĥĩśţōŕŷ."],
"lhjq3G": ["Ŕēśēţ ", ["labelText"], " ţō ďēƒàũĺţ"],
+ "ljFWEt": ["Ńō śēţţĩńĝś ƒōũńď"],
"ljHjfg": ["Ţĥàţ ƀŕàńćĥ ĩś àĺŕēàďŷ ōƥēń ĩń àńōţĥēŕ ŵōŕķţŕēē."],
"lkYioO": ["Śĥōŵ ōŕ ĥĩďē ďōćũḿēńţ ƥàńēĺ"],
"ll2yNl": ["Ćōńţēńţ ďĩŕēćţōŕŷ"],
@@ -2606,6 +2612,7 @@
"uynXup": [["tokens", "plural", { "one": ["ţōķēń"], "other": ["ţōķēńś"] }]],
"v-h2hx": ["Ďēĺēţē ", ["targetGitPath"]],
"v2ZW0K": ["Ēńàƀĺē ţēŕḿĩńàĺ"],
+ "v2a04T": ["ḿàŕķďōŵńĺĩńţ ŕũĺēś"],
"v41fCm": ["Ƒĩĺē ńōţ ƒōũńď"],
"v75Em9": [
[
diff --git a/packages/app/src/locales/pseudo/messages.po b/packages/app/src/locales/pseudo/messages.po
index f48e9eee4..028278dfc 100644
--- a/packages/app/src/locales/pseudo/messages.po
+++ b/packages/app/src/locales/pseudo/messages.po
@@ -156,6 +156,11 @@ msgstr ""
msgid "{0, plural, one {# request blocked by the preview's security policy} other {# requests blocked by the preview's security policy}}"
msgstr ""
+#. placeholder {0}: results.length
+#: src/components/settings/SettingsDialogShell.tsx
+msgid "{0, plural, one {# result} other {# results}}"
+msgstr ""
+
#. placeholder {0}: folder.templateCount
#: src/components/CreatedItemsList.tsx
msgid "{0, plural, one {# template} other {# templates}}"
@@ -1713,7 +1718,7 @@ msgstr ""
msgid "Collapsible section with a clickable summary."
msgstr ""
-#: src/components/settings/SettingsDialogBody.tsx
+#: src/components/settings/settings-fields.ts
msgid "Color theme"
msgstr ""
@@ -4477,7 +4482,7 @@ msgstr ""
msgid "Light"
msgstr ""
-#: src/components/settings/SettingsDialogBody.tsx
+#: src/components/settings/settings-fields.ts
msgid "Light, dark, or follow the OS."
msgstr ""
@@ -4740,6 +4745,10 @@ msgstr ""
msgid "Markdown source"
msgstr ""
+#: src/components/settings/SettingsDialogShell.tsx
+msgid "markdownlint rules"
+msgstr ""
+
#: src/editor/find-replace/FindReplaceBar.tsx
msgid "Match case"
msgstr ""
@@ -5318,6 +5327,10 @@ msgstr ""
msgid "No rules match your filters."
msgstr ""
+#: src/components/settings/SettingsDialogShell.tsx
+msgid "No settings found"
+msgstr ""
+
#: src/components/SkillsSidebarSection.tsx
msgid "No skills yet."
msgstr ""
@@ -5676,7 +5689,7 @@ msgstr ""
msgid "Open or close visual-editor find."
msgstr ""
-#: src/components/settings/SettingsDialogBody.tsx
+#: src/components/settings/settings-fields.ts
msgid "Open preview when agent edits"
msgstr ""
@@ -6025,6 +6038,10 @@ msgstr ""
msgid "Permission denied"
msgstr ""
+#: src/components/settings/ScopeBadge.tsx
+msgid "Personal to this device — stored in your user config, not shared."
+msgstr ""
+
#: src/components/settings/CustomThemeEditor.tsx
msgid "Pick “Custom” above to use this palette."
msgstr ""
@@ -6037,7 +6054,7 @@ msgstr ""
msgid "Pick a built-in IDE color palette, or define your own."
msgstr ""
-#: src/components/settings/SettingsDialogBody.tsx
+#: src/components/settings/settings-fields.ts
msgid "Pick a built-in IDE palette. The dark IDE themes override the light/dark setting in Preferences."
msgstr ""
@@ -6151,6 +6168,7 @@ msgstr ""
#: src/components/CommandPalette.tsx
#: src/components/PanelScopeHeader.tsx
+#: src/components/settings/ScopeBadge.tsx
#: src/lib/skill-scope.ts
msgid "Project"
msgstr ""
@@ -6954,6 +6972,10 @@ msgstr ""
msgid "Search rules by id, alias, or name"
msgstr ""
+#: src/components/settings/SettingsDialogShell.tsx
+msgid "Search settings"
+msgstr ""
+
#: src/components/settings/SearchSection.tsx
msgid "Search settings not yet loaded — try again in a moment"
msgstr ""
@@ -6995,6 +7017,10 @@ msgstr ""
msgid "Section <0>(optional heading anchor)</0>"
msgstr ""
+#: src/components/settings/SettingsDialogShell.tsx
+msgid "Sections"
+msgstr ""
+
#: src/editor/slash-command/component-items.tsx
msgid "See <0>#design-docs</0> for the latest specs."
msgstr ""
@@ -7228,6 +7254,10 @@ msgstr ""
msgid "Shared via git with everyone working on this project."
msgstr ""
+#: src/components/settings/ScopeBadge.tsx
+msgid "Shared with everyone on this project — committed to config.yml via git."
+msgstr ""
+
#: src/components/PublishToGitHubDialog.tsx
msgid "Sharing a doc needs a GitHub repository. Create one for this project."
msgstr ""
@@ -8039,7 +8069,7 @@ msgstr ""
msgid "The terminal stopped unexpectedly."
msgstr ""
-#: src/components/settings/SettingsDialogBody.tsx
+#: src/components/settings/settings-fields.ts
msgid "Theme"
msgstr ""
@@ -8665,6 +8695,7 @@ msgstr ""
msgid "Use the default OpenAI endpoint or override it with an OpenAI-compatible base URL for Azure or a self-hosted provider."
msgstr ""
+#: src/components/settings/ScopeBadge.tsx
#: src/components/settings/SettingsDialogShell.tsx
msgid "User"
msgstr ""
@@ -8829,7 +8860,7 @@ msgstr ""
msgid "What's new"
msgstr ""
-#: src/components/settings/SettingsDialogBody.tsx
+#: src/components/settings/settings-fields.ts
msgid "When enabled, the agent opens or refreshes the preview after each edit. Disable if you manage your own preview window (OK Desktop, a browser tab on another display, etc.)."
msgstr ""
@@ -8886,7 +8917,7 @@ msgstr ""
msgid "Will replace existing OpenKnowledge entry"
msgstr ""
-#: src/components/settings/SettingsDialogBody.tsx
+#: src/components/settings/settings-fields.ts
msgid "Word wrap"
msgstr ""
@@ -8916,7 +8947,7 @@ msgstr ""
msgid "Worktrees"
msgstr ""
-#: src/components/settings/SettingsDialogBody.tsx
+#: src/components/settings/settings-fields.ts
msgid "Wrap long lines in the markdown source editor."
msgstr ""
diff --git a/packages/app/tests/stress/settings-search.e2e.ts b/packages/app/tests/stress/settings-search.e2e.ts
new file mode 100644
index 000000000..7ed857b61
--- /dev/null
+++ b/packages/app/tests/stress/settings-search.e2e.ts
@@ -0,0 +1,135 @@
+/**
+ * E2E coverage for the Settings sidebar search + scope badges.
+ *
+ * These are the real-browser seams the jsdom DOM tests structurally cannot
+ * reach at fidelity:
+ * - The search box stays PINNED while the section list scrolls (real layout +
+ * scroll — jsdom has no layout).
+ * - A section result NAVIGATES the real composed dialog (real Shell → index →
+ * matchesCommandQuery → cmdk → onNavigate, over the real dev server).
+ * - A field result SCROLLS its target into view and FLASHES it — the flash is
+ * a real CSS keyframe here, not a jsdom classList assertion.
+ * - A markdownlint rule result opens the panel PRE-FILTERED to that rule, and
+ * rules are searchable only while the plugin is ENABLED (disabled-plugin
+ * exclusion), driven through the real enable/disable toggle.
+ * - The plugin panels carry the correct User/Project scope badge.
+ *
+ * Runnable via `pnpm exec playwright test tests/stress/settings-search.e2e.ts`;
+ * wired into the CI `test:e2e` subset (packages/app/package.json).
+ */
+
+import { expect, test } from './_helpers';
+
+async function openSettings(page: import('@playwright/test').Page) {
+ await page.goto('/#settings');
+ await expect(page.getByTestId('settings-dialog')).toBeVisible({ timeout: 10_000 });
+}
+
+test.describe('Settings search — navigation + pinned layout', () => {
+ test('the search box stays pinned while the section list scrolls', async ({ page }) => {
+ // Shrink the viewport so the dialog (max-h: 100dvh-4rem) is shorter than the
+ // section list — forcing the sidebar scroll region to actually overflow.
+ await page.setViewportSize({ width: 1000, height: 460 });
+ await openSettings(page);
+
+ const search = page.getByTestId('settings-search-input');
+ await expect(search).toBeVisible();
+ const before = await search.boundingBox();
+
+ // Scroll a bottom-of-list item into view — this scrolls the inner group
+ // region, NOT the pinned search box.
+ await page.getByTestId('settings-sidebar-item-sharing').scrollIntoViewIfNeeded();
+
+ const after = await search.boundingBox();
+ await expect(search).toBeInViewport();
+ // The search box has not moved: it is outside the scroll region.
+ expect(before).not.toBeNull();
+ expect(after).not.toBeNull();
+ expect(Math.round(after?.y ?? -1)).toBe(Math.round(before?.y ?? -2));
+ });
+
+ test('typing a section name filters to a result that navigates on click', async ({ page }) => {
+ await openSettings(page);
+
+ await page.getByTestId('settings-search-input').fill('Hotkeys');
+ const result = page.getByTestId('settings-search-result-section:hotkeys');
+ await expect(result).toBeVisible({ timeout: 5_000 });
+
+ await result.click();
+ // Real body swapped to the Hotkeys section; query cleared → group nav back.
+ await expect(page.getByTestId('settings-hotkeys')).toBeVisible({ timeout: 5_000 });
+ await expect(page.getByTestId('settings-sidebar-item-preferences')).toBeVisible();
+ });
+
+ test('a no-match query shows the empty state', async ({ page }) => {
+ await openSettings(page);
+ await page.getByTestId('settings-search-input').fill('zzzznomatch');
+ await expect(page.getByTestId('settings-search-empty')).toBeVisible({ timeout: 5_000 });
+ });
+
+ test('a field result scrolls its field into view and flashes it', async ({ page }) => {
+ await openSettings(page);
+
+ await page.getByTestId('settings-search-input').fill('Word wrap');
+ const result = page.getByTestId('settings-search-result-field:preferences:editor.wordWrap');
+ await expect(result).toBeVisible({ timeout: 5_000 });
+ await result.click();
+
+ const field = page.locator('[data-field="editor.wordWrap"]');
+ await expect(field).toBeVisible({ timeout: 5_000 });
+ // Rendered outcome: the field is scrolled into the viewport…
+ await expect(field).toBeInViewport();
+ // …and the real CSS flash keyframe is applied, then clears.
+ await expect(field).toHaveClass(/animate-settings-nav-flash/, { timeout: 2_000 });
+ await expect(field).not.toHaveClass(/animate-settings-nav-flash/, { timeout: 3_000 });
+ });
+});
+
+test.describe('Settings search — scope badges + markdownlint rules', () => {
+ test('the Themes plugin panel shows a User scope badge', async ({ page }) => {
+ await openSettings(page);
+ // Themes is a user-scope plugin, enabled by default.
+ await page.getByTestId('settings-sidebar-item-plugin:theme').click();
+ await expect(page.getByTestId('settings-scope-badge-user')).toBeVisible({ timeout: 5_000 });
+ await expect(page.getByTestId('settings-scope-badge-project')).toHaveCount(0);
+ });
+
+ test('markdownlint rules are searchable only while the plugin is enabled, and a rule result pre-filters the panel', async ({
+ page,
+ }) => {
+ await openSettings(page);
+
+ // Ensure markdownlint is ENABLED via the real project-plugins toggle.
+ await page.getByTestId('settings-sidebar-item-plugins-manage').click();
+ const toggle = page.getByTestId('settings-plugin-toggle-markdownlint');
+ await expect(toggle).toBeVisible({ timeout: 5_000 });
+ if ((await toggle.getAttribute('aria-checked')) !== 'true') {
+ await toggle.click();
+ }
+ await expect(toggle).toHaveAttribute('aria-checked', 'true', { timeout: 5_000 });
+
+ // A rule is now searchable from the sidebar search; the result opens the
+ // panel pre-filtered to that rule, and the header shows the Project badge.
+ await page.getByTestId('settings-search-input').fill('MD013');
+ const ruleResult = page.getByTestId('settings-search-result-rule:MD013');
+ await expect(ruleResult).toBeVisible({ timeout: 5_000 });
+ await ruleResult.click();
+
+ await expect(page.getByTestId('settings-plugin-markdownlint')).toBeVisible({ timeout: 5_000 });
+ await expect(page.getByTestId('settings-scope-badge-project')).toBeVisible();
+ await expect(page.getByTestId('markdownlint-rule-search')).toHaveValue('MD013');
+ await expect(page.getByTestId('markdownlint-rule-row-MD013')).toBeVisible();
+ await expect(page.getByTestId('markdownlint-rule-row-MD001')).toHaveCount(0);
+
+ // Now DISABLE markdownlint; its rules drop out of the search index.
+ await page.getByTestId('settings-sidebar-item-plugins-manage').click();
+ const toggleAgain = page.getByTestId('settings-plugin-toggle-markdownlint');
+ await expect(toggleAgain).toBeVisible({ timeout: 5_000 });
+ await toggleAgain.click();
+ await expect(toggleAgain).toHaveAttribute('aria-checked', 'false', { timeout: 5_000 });
+
+ await page.getByTestId('settings-search-input').fill('MD013');
+ await expect(page.getByTestId('settings-search-result-rule:MD013')).toHaveCount(0);
+ await expect(page.getByTestId('settings-search-empty')).toBeVisible({ timeout: 5_000 });
+ });
+});