Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

feat(settings): add search matcher and navigation data

enes2ba9676b718b
diff --git a/src/renderer/components/settings/nav.test.ts b/src/renderer/components/settings/nav.test.ts
new file mode 100644
index 000000000..2108f57e5
--- /dev/null
+++ b/src/renderer/components/settings/nav.test.ts
@@ -0,0 +1,13 @@
+import { describe, it, expect } from 'vitest'
+import { SETTINGS_GROUPS, allSectionIds, FIRST_SECTION_ID } from './nav'
+
+describe('SETTINGS_GROUPS', () => {
+ it('lists exactly 13 sections with no duplicates', () => {
+ const ids = allSectionIds()
+ expect(ids).toHaveLength(13)
+ expect(new Set(ids).size).toBe(13)
+ })
+ it('starts at a section that exists in the groups', () => {
+ expect(allSectionIds()).toContain(FIRST_SECTION_ID)
+ })
+})
diff --git a/src/renderer/components/settings/nav.ts b/src/renderer/components/settings/nav.ts
new file mode 100644
index 000000000..84234ad46
--- /dev/null
+++ b/src/renderer/components/settings/nav.ts
@@ -0,0 +1,70 @@
+export type SettingsSectionId =
+ | 'terminal'
+ | 'shell'
+ | 'behavior'
+ | 'appearance'
+ | 'agents'
+ | 'custom-agents'
+ | 'notifications'
+ | 'commit'
+ | 'tmux'
+ | 'license'
+ | 'remote'
+ | 'updates'
+ | 'privacy'
+
+export interface SettingsGroup {
+ id: string
+ title: string
+ sections: { id: SettingsSectionId; title: string }[]
+}
+
+export const SETTINGS_GROUPS: SettingsGroup[] = [
+ {
+ id: 'general',
+ title: 'General',
+ sections: [
+ { id: 'terminal', title: 'Terminal' },
+ { id: 'shell', title: 'Shell' },
+ { id: 'behavior', title: 'Behavior' },
+ { id: 'appearance', title: 'Appearance' }
+ ]
+ },
+ {
+ id: 'agents',
+ title: 'Agents',
+ sections: [
+ { id: 'agents', title: 'Agents' },
+ { id: 'custom-agents', title: 'Custom agents' },
+ { id: 'notifications', title: 'Notifications' },
+ { id: 'commit', title: 'Commit messages' }
+ ]
+ },
+ {
+ id: 'sessions',
+ title: 'Sessions',
+ sections: [{ id: 'tmux', title: 'tmux' }]
+ },
+ {
+ id: 'account',
+ title: 'Account',
+ sections: [
+ { id: 'license', title: 'License' },
+ { id: 'remote', title: 'Remote access' }
+ ]
+ },
+ {
+ id: 'application',
+ title: 'Application',
+ sections: [
+ { id: 'updates', title: 'Updates' },
+ { id: 'privacy', title: 'Privacy' }
+ ]
+ }
+]
+
+export const FIRST_SECTION_ID: SettingsSectionId = 'terminal'
+
+export function allSectionIds(): SettingsSectionId[] {
+ return SETTINGS_GROUPS.flatMap((g) => g.sections.map((s) => s.id))
+}
diff --git a/src/renderer/components/settings/search.test.ts b/src/renderer/components/settings/search.test.ts
new file mode 100644
index 000000000..911ea4f00
--- /dev/null
+++ b/src/renderer/components/settings/search.test.ts
@@ -0,0 +1,21 @@
+import { describe, it, expect } from 'vitest'
+import { matchesQuery } from './search'
+
+describe('matchesQuery', () => {
+ it('matches everything when the query is empty or whitespace', () => {
+ expect(matchesQuery('', { title: 'Font size' })).toBe(true)
+ expect(matchesQuery(' ', { title: 'Font size' })).toBe(true)
+ })
+ it('matches the title case-insensitively', () => {
+ expect(matchesQuery('FONT', { title: 'Font size' })).toBe(true)
+ })
+ it('matches the description', () => {
+ expect(matchesQuery('blink', { title: 'Cursor', description: 'Cursor blink' })).toBe(true)
+ })
+ it('matches a keyword not present in the title', () => {
+ expect(matchesQuery('typeface', { title: 'Font family', keywords: ['typeface'] })).toBe(true)
+ })
+ it('returns false when nothing matches', () => {
+ expect(matchesQuery('zzz', { title: 'Font size', keywords: ['font'] })).toBe(false)
+ })
+})
diff --git a/src/renderer/components/settings/search.ts b/src/renderer/components/settings/search.ts
new file mode 100644
index 000000000..1029b9d0d
--- /dev/null
+++ b/src/renderer/components/settings/search.ts
@@ -0,0 +1,18 @@
+export interface SettingsSearchEntry {
+ title: string
+ description?: string
+ keywords?: string[]
+}
+
+/** Case-insensitive substring match over the entry's title, description, and keywords.
+ * An empty/whitespace query matches everything. */
+export function matchesQuery(query: string, entry: SettingsSearchEntry): boolean {
+ const q = query.trim().toLowerCase()
+ if (q === '') {
+ return true
+ }
+ const haystack = [entry.title, entry.description ?? '', ...(entry.keywords ?? [])]
+ .join(' ')
+ .toLowerCase()
+ return haystack.includes(q)
+}