Beautiful, AI-native markdown IDE and LLM wiki
TypeScript 2nd-brainagent-skillsclaudecodexcompany-braindocsknowledge-knowledge-baseknowledge-managementllmllm-wikillm-wiki-karpathymarkdownmarkdown-editormdmdxnotespkmsecond-brainskills
refactor(app): split settings dialog body into per-section files (#2804)
Andrew Mikofalvy5bc200cdef01
diff --git a/biome-plugins/README.md b/biome-plugins/README.mdindex addded3bb..081927ce9 100644--- a/biome-plugins/README.md+++ b/biome-plugins/README.md@@ -225,7 +225,7 @@ Empirically verified (matches Biome 2.4 suppression-comment syntax):Current production suppressions:- `microcopy-ellipsis`: 2 sites (`AuthModal.tsx`, `Breadcrumb.tsx`)- `no-loosely-typed-webcontents-ipc`: 15 sites (`preload/index.ts` ×12, `shared/ipc-send.ts` ×1, `tests/smoke/theme-sync.e2e.ts` ×2)-- `no-raw-html-interactive-element`: 20 file-level `biome-ignore-all` headers in `packages/app/src/{components,presence}/**` (pre-rule backlog awaiting shadcn migration; see the rule's section above for the ratchet contract)+- `no-raw-html-interactive-element`: 19 file-level `biome-ignore-all` headers in `packages/app/src/{components,presence}/**` (pre-rule backlog awaiting shadcn migration; see the rule's section above for the ratchet contract)- `no-resolved-value-theme-source`: 0 sites- `no-roundtrip-identity-oracle`: 0 sites- `no-inline-tolerance-class`: 0 sitesdiff --git a/packages/app/src/components/settings/AttachmentsSection.tsx b/packages/app/src/components/settings/AttachmentsSection.tsxnew file mode 100644index 000000000..f15a83d37--- /dev/null+++ b/packages/app/src/components/settings/AttachmentsSection.tsx@@ -0,0 +1,266 @@+/**+ * Attachment-placement controls for the Preferences pane. The mode+ * select and folder input are one config leaf+ * (`content.attachmentFolderPath`), so this needs a small custom state+ * machine instead of the single-field schema-form path.+ */++import {+ CONFIG_DOC_NAME_PROJECT,+ type ConfigBinding,+ DEFAULT_ATTACHMENT_FOLDER_PATH,+ humanFormat,+ normalizeAttachmentFolderPath,+} from '@inkeep/open-knowledge-core';+import { Trans, useLingui } from '@lingui/react/macro';+import { useEffect, useRef, useState } from 'react';+import { toast } from 'sonner';+import { Input } from '@/components/ui/input';+import {+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+} from '@/components/ui/select';+import { useConfigContext } from '@/lib/config-provider';+import { subscribeToConfigValidationRejected } from '@/lib/config-validation-events';+import { cn } from '@/lib/utils';+import { firstIssuePath, SavedIndicator, SectionSkeleton } from './field-controls';+import { pickFirstIssueForPath } from './use-config-form';++type AttachmentPlacementMode =+ | 'same-folder'+ | 'content-root'+ | 'current-folder-subfolder'+ | 'content-root-folder';++const ATTACHMENT_FIELD_NAME = 'content.attachmentFolderPath';+const ATTACHMENT_FALLBACK_FOLDER = 'attachments';++function attachmentModeFromPath(path: string): AttachmentPlacementMode {+ const normalized = normalizeAttachmentFolderPath(path);+ if (normalized === DEFAULT_ATTACHMENT_FOLDER_PATH) return 'same-folder';+ if (normalized === '/') return 'content-root';+ if (normalized.startsWith('./')) return 'current-folder-subfolder';+ return 'content-root-folder';+}++function attachmentFolderTextFromPath(path: string): string {+ const normalized = normalizeAttachmentFolderPath(path);+ if (normalized === DEFAULT_ATTACHMENT_FOLDER_PATH || normalized === '/') {+ return ATTACHMENT_FALLBACK_FOLDER;+ }+ if (normalized.startsWith('./')) {+ return normalized.slice(2) || ATTACHMENT_FALLBACK_FOLDER;+ }+ return normalized;+}++function normalizeAttachmentFolderInput(value: string): string {+ return value+ .trim()+ .replace(/^(?:\.\/)+/, '')+ .replace(/\/{2,}/g, '/')+ .replace(/\/+$/g, '');+}++function attachmentPathFromMode(mode: AttachmentPlacementMode, folderText: string): string {+ const folder = normalizeAttachmentFolderInput(folderText) || ATTACHMENT_FALLBACK_FOLDER;+ if (mode === 'same-folder') return DEFAULT_ATTACHMENT_FOLDER_PATH;+ if (mode === 'content-root') return '/';+ if (mode === 'current-folder-subfolder') return `./${folder}`;+ return folder;+}++export function AttachmentsSection() {+ const { projectBinding, projectConfig, projectSynced } = useConfigContext();+ if (!projectBinding || !projectSynced || !projectConfig) {+ return <SectionSkeleton />;+ }+ const attachmentFolderPath =+ projectConfig.content.attachmentFolderPath ?? DEFAULT_ATTACHMENT_FOLDER_PATH;+ return (+ <AttachmentsSectionBody+ key={attachmentFolderPath}+ binding={projectBinding}+ value={attachmentFolderPath}+ />+ );+}++function AttachmentsSectionBody({ binding, value }: { binding: ConfigBinding; value: string }) {+ const { t } = useLingui();+ const [mode, setMode] = useState<AttachmentPlacementMode>(() => attachmentModeFromPath(value));+ const [folderText, setFolderText] = useState(() => attachmentFolderTextFromPath(value));+ const [error, setError] = useState<string | null>(null);+ const [savedTick, setSavedTick] = useState(false);+ const [flashed, setFlashed] = useState(false);+ const savedTickTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);+ const flashTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);++ useEffect(+ () => () => {+ if (savedTickTimerRef.current) clearTimeout(savedTickTimerRef.current);+ if (flashTimerRef.current) clearTimeout(flashTimerRef.current);+ },+ [],+ );++ useEffect(() => {+ const unsubscribe = subscribeToConfigValidationRejected((event) => {+ if (event.docName !== CONFIG_DOC_NAME_PROJECT) return;+ if (firstIssuePath(event.error) !== ATTACHMENT_FIELD_NAME) return;+ const issue = pickFirstIssueForPath(event.error, ATTACHMENT_FIELD_NAME);+ toast.error(humanFormat(event.error), { duration: 8000 });+ setError(issue);+ setFlashed(true);+ if (flashTimerRef.current) clearTimeout(flashTimerRef.current);+ flashTimerRef.current = setTimeout(() => {+ setFlashed(false);+ setError(null);+ }, 600);+ });+ return unsubscribe;+ }, []);++ const flashSavedTick = () => {+ setSavedTick(true);+ if (savedTickTimerRef.current) clearTimeout(savedTickTimerRef.current);+ savedTickTimerRef.current = setTimeout(() => setSavedTick(false), 1200);+ };++ const commitPath = (nextPath: string) => {+ const result = binding.patch({ content: { attachmentFolderPath: nextPath } });+ if (result.ok) {+ setError(null);+ flashSavedTick();+ return;+ }+ const detail = pickFirstIssueForPath(result.error, ATTACHMENT_FIELD_NAME);+ setError(detail);+ toast.error(t`Failed to update attachment location — ${detail}`);+ };++ const onModeChange = (next: string) => {+ if (+ next !== 'same-folder' &&+ next !== 'content-root' &&+ next !== 'current-folder-subfolder' &&+ next !== 'content-root-folder'+ ) {+ return;+ }+ const nextMode = next as AttachmentPlacementMode;+ const nextFolderText =+ nextMode === 'current-folder-subfolder' || nextMode === 'content-root-folder'+ ? folderText || ATTACHMENT_FALLBACK_FOLDER+ : folderText;+ setMode(nextMode);+ setFolderText(nextFolderText);+ commitPath(attachmentPathFromMode(nextMode, nextFolderText));+ };++ const commitFolderText = () => {+ const nextPath = attachmentPathFromMode(mode, folderText);+ setFolderText(attachmentFolderTextFromPath(nextPath));+ commitPath(nextPath);+ };++ const showsFolderInput = mode === 'current-folder-subfolder' || mode === 'content-root-folder';+ const labelId = 'settings-attachments-location-label';+ const inputId = 'settings-attachments-folder-input';++ return (+ <section+ aria-labelledby="settings-attachments-title"+ className="space-y-3"+ data-testid="settings-attachments"+ >+ <div className="space-y-1">+ <h3 id="settings-attachments-title" className="text-base font-semibold">+ <Trans>Attachments</Trans>+ </h3>+ <p className="text-sm text-muted-foreground">+ <Trans>Set where pasted and dropped files are stored for this project.</Trans>+ </p>+ </div>++ <div+ className={cn('rounded-md border p-3', flashed && 'animate-settings-flash')}+ data-field={ATTACHMENT_FIELD_NAME}+ data-scope="project"+ >+ <div className="grid gap-3 sm:grid-cols-[minmax(0,1fr)_minmax(16rem,18rem)] sm:items-start">+ <div className="space-y-0.5">+ <div className="text-sm font-medium" id={labelId}>+ <Trans>Default location for new attachments</Trans>+ </div>+ <p className="text-muted-foreground text-1sm">+ <Trans>Where newly added attachments are placed.</Trans>+ </p>+ </div>+ <Select value={mode} onValueChange={onModeChange}>+ <SelectTrigger+ aria-labelledby={labelId}+ data-testid="settings-attachments-mode"+ size="sm"+ >+ <SelectValue />+ </SelectTrigger>+ <SelectContent>+ <SelectItem value="same-folder">+ <Trans>Same folder as current file</Trans>+ </SelectItem>+ <SelectItem value="content-root">+ <Trans>Content root</Trans>+ </SelectItem>+ <SelectItem value="current-folder-subfolder">+ <Trans>Subfolder under current folder</Trans>+ </SelectItem>+ <SelectItem value="content-root-folder">+ <Trans>Fixed folder in content root</Trans>+ </SelectItem>+ </SelectContent>+ </Select>+ </div>++ {showsFolderInput ? (+ <div className="mt-3 max-w-sm space-y-1">+ <label className="text-sm font-medium" htmlFor={inputId}>+ <Trans>Folder</Trans>+ </label>+ <Input+ id={inputId}+ value={folderText}+ placeholder={t`e.g. assets/uploads`}+ onChange={(event) => setFolderText(event.target.value)}+ onBlur={commitFolderText}+ onKeyDown={(event) => {+ if (event.key === 'Enter') {+ event.preventDefault();+ commitFolderText();+ }+ }}+ className="h-8 text-sm"+ data-testid="settings-attachments-folder"+ />+ </div>+ ) : null}++ <div className="mt-2 flex min-h-5 items-center gap-2">+ {error ? (+ <p+ className="text-1sm text-destructive"+ data-field-error={ATTACHMENT_FIELD_NAME}+ role="alert"+ >+ {error}+ </p>+ ) : null}+ <SavedIndicator visible={savedTick} />+ </div>+ </div>+ </section>+ );+}diff --git a/packages/app/src/components/settings/HotkeysSection.tsx b/packages/app/src/components/settings/HotkeysSection.tsxnew file mode 100644index 000000000..a1049ad70--- /dev/null+++ b/packages/app/src/components/settings/HotkeysSection.tsx@@ -0,0 +1,131 @@+/**+ * Read-only listing of the keyboard shortcuts available in the editor+ * and workspace, grouped by category from the shared shortcut registry.+ */++import { Trans, useLingui } from '@lingui/react/macro';+import { Badge } from '@/components/ui/badge';+import { Kbd } from '@/components/ui/kbd';+import {+ formatShortcutBinding,+ formatShortcutTextLabel,+ KEYBOARD_SHORTCUTS,+ SHORTCUT_CATEGORY_LABELS,+ SHORTCUT_CATEGORY_ORDER,+ type ShortcutBinding,+} from '@/lib/keyboard-shortcuts';+import { cn } from '@/lib/utils';++function ShortcutBindingChips({ binding }: { binding: ShortcutBinding }) {+ return formatShortcutBinding(binding)+ .split(' / ')+ .map((part, index) =>+ index === 0 ? (+ <Kbd key={`kbd-${part}`} aria-label={formatShortcutTextLabel(part)}>+ {part}+ </Kbd>+ ) : (+ <span key={`or-${part}`} className="inline-flex items-center gap-1.5">+ <span className="sr-only">+ <Trans> or </Trans>+ </span>+ <span aria-hidden="true"> / </span>+ <Kbd aria-label={formatShortcutTextLabel(part)}>{part}</Kbd>+ </span>+ ),+ );+}++export function HotkeysSection() {+ const { t } = useLingui();+ const titleId = 'settings-hotkeys-title';+ return (+ <section aria-labelledby={titleId} className="space-y-5" data-testid="settings-hotkeys">+ <div className="space-y-1">+ <h3 id={titleId} className="text-base font-semibold">+ <Trans>Hotkeys</Trans>+ </h3>+ <p className="text-sm text-muted-foreground">+ <Trans>Keyboard shortcuts available in the editor and workspace.</Trans>+ </p>+ </div>++ <div className="space-y-6" data-testid="settings-hotkeys-list">+ {SHORTCUT_CATEGORY_ORDER.map((category) => {+ const shortcuts = KEYBOARD_SHORTCUTS.filter((shortcut) => shortcut.category === category);+ if (shortcuts.length === 0) return null;++ return (+ <section key={category} aria-labelledby={`settings-hotkeys-${category}`}>+ <h4+ id={`settings-hotkeys-${category}`}+ className="mb-2 font-mono text-muted-foreground text-xs uppercase tracking-wide"+ >+ {t(SHORTCUT_CATEGORY_LABELS[category])}+ </h4>+ <ul+ aria-labelledby={`settings-hotkeys-${category}`}+ className="m-0 list-none overflow-hidden rounded-md border p-0"+ >+ {shortcuts.map((shortcut) => {+ const shortcutTitleId = `settings-hotkey-${shortcut.id}-title`;+ const shortcutDescriptionId = `settings-hotkey-${shortcut.id}-description`;+ const bindingChipCount = shortcut.bindings.reduce(+ (count, binding) => count + formatShortcutBinding(binding).split(' / ').length,+ 0,+ );+ const hasDenseBindings = bindingChipCount > 4;++ return (+ <li+ key={shortcut.id}+ aria-describedby={shortcutDescriptionId}+ aria-labelledby={shortcutTitleId}+ className={cn(+ 'grid gap-2 border-border border-b px-3 py-3 last:border-b-0',+ hasDenseBindings+ ? 'sm:grid-cols-1'+ : 'sm:grid-cols-[minmax(0,1fr)_minmax(0,auto)]',+ )}+ data-testid={`settings-hotkey-${shortcut.id}`}+ >+ <div className="min-w-0 space-y-1">+ <div className="flex flex-wrap items-center gap-2">+ <p className="font-medium text-sm" id={shortcutTitleId}>+ {t(shortcut.title)}+ </p>+ <Badge variant="gray">+ <span className="sr-only">+ <Trans>Scope: </Trans>+ </span>+ {t(shortcut.scope)}+ </Badge>+ </div>+ <p className="text-muted-foreground text-sm" id={shortcutDescriptionId}>+ {t(shortcut.description)}+ </p>+ </div>+ <div+ className={cn(+ 'flex min-w-0 max-w-full self-start content-start flex-wrap items-start gap-1.5',+ hasDenseBindings ? 'sm:justify-start' : 'sm:max-w-[38rem] sm:justify-end',+ )}+ >+ {shortcut.bindings.map((binding) => (+ <ShortcutBindingChips+ key={`${shortcut.id}-${binding.mac}-${binding.windowsLinux}`}+ binding={binding}+ />+ ))}+ </div>+ </li>+ );+ })}+ </ul>+ </section>+ );+ })}+ </div>+ </section>+ );+}diff --git a/packages/app/src/components/settings/IntegrationsSection.tsx b/packages/app/src/components/settings/IntegrationsSection.tsxnew file mode 100644index 000000000..0b0af7f97--- /dev/null+++ b/packages/app/src/components/settings/IntegrationsSection.tsx@@ -0,0 +1,59 @@+/**+ * Integrations section — the "Install in Claude Desktop" row opens+ * `<InstallInClaudeDesktopDialog>` (its own internal Dialog).+ */++import { SHOW_INSTALL_SKILL } from '@inkeep/open-knowledge-core';+import { Trans } from '@lingui/react/macro';+import { useState } from 'react';+import { InstallInClaudeDesktopDialog } from '@/components/InstallInClaudeDesktopDialog';+import { Button } from '@/components/ui/button';+import { useClaudeDesktopIntegration } from '@/lib/handoff/use-claude-desktop-integration';++export function IntegrationsSection() {+ const [installOpen, setInstallOpen] = useState(false);+ const { skillInstalled, refresh } = useClaudeDesktopIntegration();+ if (!SHOW_INSTALL_SKILL) return null;++ return (+ <section aria-labelledby="settings-integrations-title" className="space-y-3">+ <div className="space-y-1">+ <h3 id="settings-integrations-title" className="text-base font-semibold">+ <Trans>Integrations</Trans>+ </h3>+ <p className="text-sm text-muted-foreground">+ <Trans>Connect OpenKnowledge to other tools you use.</Trans>+ </p>+ </div>+ <div className="rounded-md border p-3">+ <div className="flex items-center justify-between gap-3">+ <div>+ <div className="text-sm font-medium">+ <Trans>Install in Claude Desktop</Trans>+ </div>+ <p className="text-muted-foreground text-1sm">+ <Trans>Make this knowledge base available as a Claude Skill.</Trans>+ </p>+ </div>+ <Button+ variant="outline"+ size="sm"+ onClick={() => setInstallOpen(true)}+ data-testid="settings-install-claude-desktop"+ className="uppercase font-mono"+ >+ {skillInstalled ? <Trans>Reinstall</Trans> : <Trans>Install</Trans>}+ </Button>+ </div>+ </div>+ <InstallInClaudeDesktopDialog+ open={installOpen}+ onOpenChange={(next) => {+ setInstallOpen(next);+ if (!next) refresh();+ }}+ reinstall={skillInstalled}+ />+ </section>+ );+}diff --git a/packages/app/src/components/settings/SettingsDialogBody.tsx b/packages/app/src/components/settings/SettingsDialogBody.tsxindex 533e59e6b..4dbbe424c 100644--- a/packages/app/src/components/settings/SettingsDialogBody.tsx+++ b/packages/app/src/components/settings/SettingsDialogBody.tsx@@ -1,4 +1,3 @@-// biome-ignore-all lint/plugin/no-raw-html-interactive-element: pre-rule backlog — file uses raw <button>/<input>/<textarea> awaiting shadcn migration; tracked at https://github.com/inkeep/open-knowledge/blob/main/biome-plugins/README.md#no-raw-html-interactive-elementgrit/*** Lazy body for the Settings modal — pulled in as a separate chunk by* `SettingsDialogShell.tsx` via `React.lazy`. Receives the active@@ -7,112 +6,31 @@* components.** The shell ships Dialog/Sidebar/skeleton synchronously so the dialog- * frame paints immediately on Cmd-,; this file's ~330kB of schema-form+ * frame paints immediately on Cmd-,; this chunk's ~330kB of schema-form* harness (ConfigSchema, react-hook-form, schema-walker) + heavy* section bodies (Sync/Templates/Okignore/Integrations) loads in- * parallel and swaps in.+ * parallel and swaps in. The section bodies and the shared form-field+ * machinery live in sibling files (`field-controls.tsx`,+ * `schema-section.tsx`, `*Section.tsx`) that this dispatcher imports+ * statically, so they all land in the same lazy chunk.** The user-scope ConfigBinding is owned by ConfigProvider for the app* session — see `lib/config-provider.tsx`. The body is a pure consumer* of the props the shell passes (no provider creation, no per-open* teardown).- *- * Auto-save: per-control commits via `binding.patch`. Client-side L1- * validation gates writes. Per-field reset writes the schema default- * (or null per RFC 7396 for fields without a default).- *- * L3 rejection from non-pane writers (CLI, MCP, hand-edit) surfaces- * as a sonner toast + brief field flash on the matching scope's- * section (when mounted).- *- * The Integrations section's "Install in Claude Desktop" row opens- * `<InstallInClaudeDesktopDialog>` (its own internal Dialog).*/-import {- CONFIG_DOC_NAME_PROJECT,- CONFIG_DOC_NAME_USER,- type Config,- type ConfigBinding,- ConfigSchema,- type ConfigValidationError,- DEFAULT_ATTACHMENT_FOLDER_PATH,- getFieldMeta,- humanFormat,- isKnownConfigError,- normalizeAttachmentFolderPath,- type OkignoreBinding,- SHOW_INSTALL_SKILL,-} from '@inkeep/open-knowledge-core';-import { Trans, useLingui } from '@lingui/react/macro';-import { ArrowUpRight, Check, ChevronRight, RotateCcw } from 'lucide-react';-import { useTheme } from 'next-themes';-import { useEffect, useRef, useState } from 'react';-import { type ControllerRenderProps, type FieldPath, useFormContext } from 'react-hook-form';-import { toast } from 'sonner';-import { AuthModal } from '@/components/AuthModal';-import { EnableSyncConfirmDialog } from '@/components/EnableSyncConfirmDialog';-import { InstallInClaudeDesktopDialog } from '@/components/InstallInClaudeDesktopDialog';-import { PublishToGitHubDialog } from '@/components/PublishToGitHubDialog';-import {- formatPausedReason,- shouldDisableSyncSwitch,- shouldOfferReconnect,- shouldOfferSignInAgain,-} from '@/components/SyncStatusBadge';+import type { ConfigBinding, OkignoreBinding } from '@inkeep/open-knowledge-core';+import { useLingui } from '@lingui/react/macro';import { SharingSection } from '@/components/settings/SharingSection';-import { Badge } from '@/components/ui/badge';-import { Button } from '@/components/ui/button';-import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible';-import {- Form,- FormControl,- FormDescription,- FormField,- FormItem,- FormLabel,- FormMessage,-} from '@/components/ui/form';-import { Input } from '@/components/ui/input';-import { Kbd } from '@/components/ui/kbd';-import {- Select,- SelectContent,- SelectItem,- SelectTrigger,- SelectValue,-} from '@/components/ui/select';-import { Skeleton } from '@/components/ui/skeleton';-import { Switch } from '@/components/ui/switch';-import { ToggleGroup, ToggleGroupItem } from '@/components/ui/toggle-group';-import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';-import {- useEnableSyncWithConfirm,- useSyncDefaultWriter,- useSyncEnabledWriter,-} from '@/hooks/use-enable-sync-with-confirm';-import { useGitSyncStatus } from '@/hooks/use-git-sync-status';-import { colorThemeMode, customThemeKind, resolveCustomSeed } from '@/lib/color-themes';-import { useConfigContextOptional } from '@/lib/config-context';-import { useConfigContext } from '@/lib/config-provider';-import { subscribeToConfigValidationRejected } from '@/lib/config-validation-events';-import { useClaudeDesktopIntegration } from '@/lib/handoff/use-claude-desktop-integration';-import {- formatShortcutBinding,- formatShortcutTextLabel,- KEYBOARD_SHORTCUTS,- SHORTCUT_CATEGORY_LABELS,- SHORTCUT_CATEGORY_ORDER,- type ShortcutBinding,-} from '@/lib/keyboard-shortcuts';-import { applyColorThemeToDom } from '@/lib/use-apply-config-color-theme';-import { cn } from '@/lib/utils';import { AccountSection } from './AccountSection';import { AiToolsSection } from './AiToolsSection';-import { ColorThemePicker } from './ColorThemePicker';+import { AttachmentsSection } from './AttachmentsSection';import { ConfigureAgentsSection } from './ConfigureAgentsSection';-import { CustomThemeEditor } from './CustomThemeEditor';import { EmbeddingsKeySection } from './EmbeddingsKeySection';+import { SectionSkeleton } from './field-controls';+import { HotkeysSection } from './HotkeysSection';+import { IntegrationsSection } from './IntegrationsSection';import { LinkPreviewsSection } from './LinkPreviewsSection';import {MarkdownlintPluginSection,@@ -123,34 +41,13 @@ 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 {- getEnumOptions,- getFieldDefault,- 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 { SyncSection } from './SyncSection';+import { BoundSchemaSection } from './schema-section';+import { FIELDS_USER_PREFERENCES } from './settings-fields';import { TerminalSection } from './TerminalSection';-import { pickFirstIssueForPath, useConfigForm } from './use-config-form';--/**- * Internal scope tag for routing each section to its config binding.- * Not exposed to the user — there's no top-level scope toggle in the- * new design. Sections under USER use the user binding; sections under- * THIS PROJECT use the project binding.- */-type Scope = 'user' | 'project';--// 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-// elsewhere in the app.-const COMMITTED_DEFAULT_SELECTED_CLASS =- 'data-[state=on]:border-primary data-[state=on]:bg-primary data-[state=on]:text-primary-foreground data-[state=on]:hover:bg-primary/90';+import { ThemePluginSection } from './ThemePluginSection';interface SettingsDialogBodyProps {activeId: string;@@ -296,1391 +193,3 @@ export function SettingsDialogBody({}return null;}--function firstIssuePath(error: ConfigValidationError): string | null {- if (!isKnownConfigError(error) || error.code !== 'SCHEMA_INVALID') return null;- const first = error.issues[0];- if (!first || first.path.length === 0) return null;- return first.path.map(String).join('.');-}--function SectionSkeleton() {- return (- <div className="space-y-3">- <Skeleton className="h-5 w-32" />- <Skeleton className="h-4 w-64" />- <div className="space-y-2">- <Skeleton className="h-9 w-full" />- <Skeleton className="h-9 w-full" />- </div>- </div>- );-}--function ShortcutBindingChips({ binding }: { binding: ShortcutBinding }) {- return formatShortcutBinding(binding)- .split(' / ')- .map((part, index) =>- index === 0 ? (- <Kbd key={`kbd-${part}`} aria-label={formatShortcutTextLabel(part)}>- {part}- </Kbd>- ) : (- <span key={`or-${part}`} className="inline-flex items-center gap-1.5">- <span className="sr-only">- <Trans> or </Trans>- </span>- <span aria-hidden="true"> / </span>- <Kbd aria-label={formatShortcutTextLabel(part)}>{part}</Kbd>- </span>- ),- );-}--function HotkeysSection() {- const { t } = useLingui();- const titleId = 'settings-hotkeys-title';- return (- <section aria-labelledby={titleId} className="space-y-5" data-testid="settings-hotkeys">- <div className="space-y-1">- <h3 id={titleId} className="text-base font-semibold">- <Trans>Hotkeys</Trans>- </h3>- <p className="text-sm text-muted-foreground">- <Trans>Keyboard shortcuts available in the editor and workspace.</Trans>- </p>- </div>-- <div className="space-y-6" data-testid="settings-hotkeys-list">- {SHORTCUT_CATEGORY_ORDER.map((category) => {- const shortcuts = KEYBOARD_SHORTCUTS.filter((shortcut) => shortcut.category === category);- if (shortcuts.length === 0) return null;-- return (- <section key={category} aria-labelledby={`settings-hotkeys-${category}`}>- <h4- id={`settings-hotkeys-${category}`}- className="mb-2 font-mono text-muted-foreground text-xs uppercase tracking-wide"- >- {t(SHORTCUT_CATEGORY_LABELS[category])}- </h4>- <ul- aria-labelledby={`settings-hotkeys-${category}`}- className="m-0 list-none overflow-hidden rounded-md border p-0"- >- {shortcuts.map((shortcut) => {- const shortcutTitleId = `settings-hotkey-${shortcut.id}-title`;- const shortcutDescriptionId = `settings-hotkey-${shortcut.id}-description`;- const bindingChipCount = shortcut.bindings.reduce(- (count, binding) => count + formatShortcutBinding(binding).split(' / ').length,- 0,- );- const hasDenseBindings = bindingChipCount > 4;-- return (- <li- key={shortcut.id}- aria-describedby={shortcutDescriptionId}- aria-labelledby={shortcutTitleId}- className={cn(- 'grid gap-2 border-border border-b px-3 py-3 last:border-b-0',- hasDenseBindings- ? 'sm:grid-cols-1'- : 'sm:grid-cols-[minmax(0,1fr)_minmax(0,auto)]',- )}- data-testid={`settings-hotkey-${shortcut.id}`}- >- <div className="min-w-0 space-y-1">- <div className="flex flex-wrap items-center gap-2">- <p className="font-medium text-sm" id={shortcutTitleId}>- {t(shortcut.title)}- </p>- <Badge variant="gray">- <span className="sr-only">- <Trans>Scope: </Trans>- </span>- {t(shortcut.scope)}- </Badge>- </div>- <p className="text-muted-foreground text-sm" id={shortcutDescriptionId}>- {t(shortcut.description)}- </p>- </div>- <div- className={cn(- 'flex min-w-0 max-w-full self-start content-start flex-wrap items-start gap-1.5',- hasDenseBindings ? 'sm:justify-start' : 'sm:max-w-[38rem] sm:justify-end',- )}- >- {shortcut.bindings.map((binding) => (- <ShortcutBindingChips- key={`${shortcut.id}-${binding.mac}-${binding.windowsLinux}`}- binding={binding}- />- ))}- </div>- </li>- );- })}- </ul>- </section>- );- })}- </div>- </section>- );-}--interface BoundSchemaSectionProps {- title: string;- description: string;- 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;-}--/**- * Mounts the harness (`useConfigForm`) once per binding identity and- * wraps the body in shadcn's `<Form>` (RHF's `FormProvider`). One per- * scope; both scopes' sections live under the same dialog so each has- * its own form instance.- *- * Owns the CC1 `'config-validation-rejected'` subscription scoped to- * the matching docName, plus the per-field flash state — both need- * access to the form. The toast fires for any rejection on this scope;- * `setError` + `setFocus` + `flash` only fire when the field's section- * is the active one (the form is unmounted otherwise, so nothing to- * flash).- */-function BoundSchemaSection({- title,- description,- scope,- binding,- fields,- scopeBadge,-}: BoundSchemaSectionProps) {- const { form, commitField } = useConfigForm(binding);- const [flashedPath, setFlashedPath] = useState<string | null>(null);- const flashTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);-- useEffect(() => {- const docName = scope === 'project' ? CONFIG_DOC_NAME_PROJECT : CONFIG_DOC_NAME_USER;- const unsubscribe = subscribeToConfigValidationRejected((event) => {- if (event.docName !== docName) return;-- // Toast carries the full multi-line summary (humanFormat); the- // inline FormMessage shows only the path-matched issue so the- // field doesn't render a multi-line block with file paths and- // caret markers.- toast.error(humanFormat(event.error), { duration: 8000 });-- const path = firstIssuePath(event.error);- if (path) {- form.setError(path as FieldPath<Config>, {- type: 'config-validation-rejected',- message: pickFirstIssueForPath(event.error, path),- });- form.setFocus(path as FieldPath<Config>);- setFlashedPath(path);- if (flashTimerRef.current) clearTimeout(flashTimerRef.current);- flashTimerRef.current = setTimeout(() => {- setFlashedPath(null);- // Clear the inline error alongside the flash. The toast- // (8s) remains the persistent feedback channel; if the- // external writer corrected the value via Y.Text,- // `applyExternalUpdate` already updated the field — we- // don't want a stale red FormMessage lingering on a- // now-valid value.- form.clearErrors(path as FieldPath<Config>);- }, 600);- }- });- return () => {- unsubscribe();- if (flashTimerRef.current) clearTimeout(flashTimerRef.current);- };- }, [scope, form]);-- return (- <Form {...form}>- <SchemaSection- title={title}- description={description}- scope={scope}- scopeBadge={scopeBadge}- fields={fields}- commitField={commitField}- flashedPath={flashedPath}- />- </Form>- );-}--/**- * The theme "plugin" panel — the color-palette picker + custom-theme editor,- * rendered in the Plugins menu (Settings → Plugins → Themes) as a peer of the- * lint plugins. Reuses the same user-scope config-form machinery the Preferences- * pane uses.- */-function ThemePluginSection({ userBinding }: { userBinding: ConfigBinding }) {- const { t } = useLingui();- return (- <div className="space-y-6">- <BoundSchemaSection- 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}- />- <CustomThemeEditor userBinding={userBinding} />- </div>- );-}--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;-}--function SchemaSection({- title,- description,- scope,- scopeBadge,- fields,- commitField,- flashedPath,-}: SchemaSectionProps) {- const titleId = `settings-section-${scope}-title`;- return (- <section aria-labelledby={titleId} className="space-y-3">- <div className="space-y-1">- <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">- {fields.map((field) => (- <SettingsField- key={field.path.join('.')}- field={field}- scope={scope}- commitField={commitField}- isFlashed={flashedPath === field.path.join('.')}- />- ))}- </div>- </section>- );-}--type AttachmentPlacementMode =- | 'same-folder'- | 'content-root'- | 'current-folder-subfolder'- | 'content-root-folder';--const ATTACHMENT_FIELD_NAME = 'content.attachmentFolderPath';-const ATTACHMENT_FALLBACK_FOLDER = 'attachments';--function attachmentModeFromPath(path: string): AttachmentPlacementMode {- const normalized = normalizeAttachmentFolderPath(path);- if (normalized === DEFAULT_ATTACHMENT_FOLDER_PATH) return 'same-folder';- if (normalized === '/') return 'content-root';- if (normalized.startsWith('./')) return 'current-folder-subfolder';- return 'content-root-folder';-}--function attachmentFolderTextFromPath(path: string): string {- const normalized = normalizeAttachmentFolderPath(path);- if (normalized === DEFAULT_ATTACHMENT_FOLDER_PATH || normalized === '/') {- return ATTACHMENT_FALLBACK_FOLDER;- }- if (normalized.startsWith('./')) {- return normalized.slice(2) || ATTACHMENT_FALLBACK_FOLDER;- }- return normalized;-}--function normalizeAttachmentFolderInput(value: string): string {- return value- .trim()- .replace(/^(?:\.\/)+/, '')- .replace(/\/{2,}/g, '/')- .replace(/\/+$/g, '');-}--function attachmentPathFromMode(mode: AttachmentPlacementMode, folderText: string): string {- const folder = normalizeAttachmentFolderInput(folderText) || ATTACHMENT_FALLBACK_FOLDER;- if (mode === 'same-folder') return DEFAULT_ATTACHMENT_FOLDER_PATH;- if (mode === 'content-root') return '/';- if (mode === 'current-folder-subfolder') return `./${folder}`;- return folder;-}--// The mode select and folder input are one config leaf, so this needs a-// small custom state machine instead of the single-field BoundSchemaSection.-function AttachmentsSection() {- const { projectBinding, projectConfig, projectSynced } = useConfigContext();- if (!projectBinding || !projectSynced || !projectConfig) {- return <SectionSkeleton />;- }- const attachmentFolderPath =- projectConfig.content.attachmentFolderPath ?? DEFAULT_ATTACHMENT_FOLDER_PATH;- return (- <AttachmentsSectionBody- key={attachmentFolderPath}- binding={projectBinding}- value={attachmentFolderPath}- />- );-}--function AttachmentsSectionBody({ binding, value }: { binding: ConfigBinding; value: string }) {- const { t } = useLingui();- const [mode, setMode] = useState<AttachmentPlacementMode>(() => attachmentModeFromPath(value));- const [folderText, setFolderText] = useState(() => attachmentFolderTextFromPath(value));- const [error, setError] = useState<string | null>(null);- const [savedTick, setSavedTick] = useState(false);- const [flashed, setFlashed] = useState(false);- const savedTickTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);- const flashTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);-- useEffect(- () => () => {- if (savedTickTimerRef.current) clearTimeout(savedTickTimerRef.current);- if (flashTimerRef.current) clearTimeout(flashTimerRef.current);- },- [],- );-- useEffect(() => {- const unsubscribe = subscribeToConfigValidationRejected((event) => {- if (event.docName !== CONFIG_DOC_NAME_PROJECT) return;- if (firstIssuePath(event.error) !== ATTACHMENT_FIELD_NAME) return;- const issue = pickFirstIssueForPath(event.error, ATTACHMENT_FIELD_NAME);- toast.error(humanFormat(event.error), { duration: 8000 });- setError(issue);- setFlashed(true);- if (flashTimerRef.current) clearTimeout(flashTimerRef.current);- flashTimerRef.current = setTimeout(() => {- setFlashed(false);- setError(null);- }, 600);- });- return unsubscribe;- }, []);-- const flashSavedTick = () => {- setSavedTick(true);- if (savedTickTimerRef.current) clearTimeout(savedTickTimerRef.current);- savedTickTimerRef.current = setTimeout(() => setSavedTick(false), 1200);- };-- const commitPath = (nextPath: string) => {- const result = binding.patch({ content: { attachmentFolderPath: nextPath } });- if (result.ok) {- setError(null);- flashSavedTick();- return;- }- const detail = pickFirstIssueForPath(result.error, ATTACHMENT_FIELD_NAME);- setError(detail);- toast.error(t`Failed to update attachment location — ${detail}`);- };-- const onModeChange = (next: string) => {- if (- next !== 'same-folder' &&- next !== 'content-root' &&- next !== 'current-folder-subfolder' &&- next !== 'content-root-folder'- ) {- return;- }- const nextMode = next as AttachmentPlacementMode;- const nextFolderText =- nextMode === 'current-folder-subfolder' || nextMode === 'content-root-folder'- ? folderText || ATTACHMENT_FALLBACK_FOLDER- : folderText;- setMode(nextMode);- setFolderText(nextFolderText);- commitPath(attachmentPathFromMode(nextMode, nextFolderText));- };-- const commitFolderText = () => {- const nextPath = attachmentPathFromMode(mode, folderText);- setFolderText(attachmentFolderTextFromPath(nextPath));- commitPath(nextPath);- };-- const showsFolderInput = mode === 'current-folder-subfolder' || mode === 'content-root-folder';- const labelId = 'settings-attachments-location-label';- const inputId = 'settings-attachments-folder-input';-- return (- <section- aria-labelledby="settings-attachments-title"- className="space-y-3"- data-testid="settings-attachments"- >- <div className="space-y-1">- <h3 id="settings-attachments-title" className="text-base font-semibold">- <Trans>Attachments</Trans>- </h3>- <p className="text-sm text-muted-foreground">- <Trans>Set where pasted and dropped files are stored for this project.</Trans>- </p>- </div>-- <div- className={cn('rounded-md border p-3', flashed && 'animate-settings-flash')}- data-field={ATTACHMENT_FIELD_NAME}- data-scope="project"- >- <div className="grid gap-3 sm:grid-cols-[minmax(0,1fr)_minmax(16rem,18rem)] sm:items-start">- <div className="space-y-0.5">- <div className="text-sm font-medium" id={labelId}>- <Trans>Default location for new attachments</Trans>- </div>- <p className="text-muted-foreground text-1sm">- <Trans>Where newly added attachments are placed.</Trans>- </p>- </div>- <Select value={mode} onValueChange={onModeChange}>- <SelectTrigger- aria-labelledby={labelId}- data-testid="settings-attachments-mode"- size="sm"- >- <SelectValue />- </SelectTrigger>- <SelectContent>- <SelectItem value="same-folder">- <Trans>Same folder as current file</Trans>- </SelectItem>- <SelectItem value="content-root">- <Trans>Content root</Trans>- </SelectItem>- <SelectItem value="current-folder-subfolder">- <Trans>Subfolder under current folder</Trans>- </SelectItem>- <SelectItem value="content-root-folder">- <Trans>Fixed folder in content root</Trans>- </SelectItem>- </SelectContent>- </Select>- </div>-- {showsFolderInput ? (- <div className="mt-3 max-w-sm space-y-1">- <label className="text-sm font-medium" htmlFor={inputId}>- <Trans>Folder</Trans>- </label>- <Input- id={inputId}- value={folderText}- placeholder={t`e.g. assets/uploads`}- onChange={(event) => setFolderText(event.target.value)}- onBlur={commitFolderText}- onKeyDown={(event) => {- if (event.key === 'Enter') {- event.preventDefault();- commitFolderText();- }- }}- className="h-8 text-sm"- data-testid="settings-attachments-folder"- />- </div>- ) : null}-- <div className="mt-2 flex min-h-5 items-center gap-2">- {error ? (- <p- className="text-1sm text-destructive"- data-field-error={ATTACHMENT_FIELD_NAME}- role="alert"- >- {error}- </p>- ) : null}- <SavedIndicator visible={savedTick} />- </div>- </div>- </section>- );-}--/**- * Sync section — surface the git auto-sync toggle in Settings so users- * have a deliberate path to re-enable when the header badge is hidden- * (state === 'disabled' hides the badge).- *- * The toggle writes through the project-local ConfigBinding so the choice- * lands in `<projectDir>/.ok/local/config.yml`; the file watcher then drives- * the SyncEngine to match.- */-function SyncSection() {- const { t } = useLingui();- const status = useGitSyncStatus();- const { projectConfig, projectLocalConfig, projectLocalSynced, projectSynced } =- useConfigContext();- const writer = useSyncEnabledWriter();- const defaultWriter = useSyncDefaultWriter();- const { confirmOpen, setConfirmOpen, onToggleRequest, onConfirm } =- useEnableSyncWithConfirm(writer);- const [publishOpen, setPublishOpen] = useState(false);- // Local AuthModal control for the Sign-in-again affordance surfaced when- // the probe returns 401. The editor header has its own AuthModal — settings- // doesn't share it, so the section owns one locally (same pattern as- // AccountSection).- const [authModalOpen, setAuthModalOpen] = useState(false);-- // No git remote configured — instead of dead-ending on a CLI instruction,- // lead with the outcome (back up + share) and offer the existing- // Publish-to-GitHub wizard, which creates a repo and connects it with no- // terminal. The raw `git remote add` path stays as an Advanced disclosure- // for users who already have a repository.- if (status && !status.hasRemote && status.state === 'dormant') {- return (- <section- aria-labelledby="settings-sync-title"- className="space-y-4"- data-testid="settings-sync-empty"- >- <div className="space-y-1">- <h3 id="settings-sync-title" className="text-base font-semibold">- <Trans>Sync</Trans>- </h3>- <p className="text-sm text-muted-foreground">- <Trans>- This project lives only on this computer. Connect it to GitHub to back it up and share- it with other people.- </Trans>- </p>- </div>- <div className="flex items-center justify-between gap-3 rounded-md border p-3">- <div className="space-y-0.5">- <div className="text-sm font-medium">- <Trans>Connect to GitHub</Trans>- </div>- <p className="text-muted-foreground text-1sm">- <Trans>We'll create a repository and start syncing — no terminal needed.</Trans>- </p>- </div>- <Button onClick={() => setPublishOpen(true)} data-testid="settings-sync-setup">- <Trans>Set up syncing</Trans>- </Button>- </div>-- <Collapsible>- <CollapsibleTrigger asChild>- <Button variant="ghost" size="sm" className="group gap-1 px-1.5 text-muted-foreground">- <ChevronRight- className="size-3.5 transition-transform group-data-[state=open]:rotate-90"- aria-hidden- />- <Trans>Connect an existing repository</Trans>- </Button>- </CollapsibleTrigger>- <CollapsibleContent className="px-1.5 pt-2 text-sm text-muted-foreground">- <Trans>- Already have a git repository? Add it with{' '}- <code className="rounded bg-muted px-1 py-0.5 font-mono text-xs">- git remote add origin <url>- </code>{' '}- in this project's folder. This page updates automatically once a remote is detected.- </Trans>- </CollapsibleContent>- </Collapsible>-- <PublishToGitHubDialog open={publishOpen} onOpenChange={setPublishOpen} />- </section>- );- }-- // Read user intent from the synchronous local CRDT preference (the same- // binding `useSyncEnabledWriter` writes to). Don't read from the server's- // engine-state projection — that round-trips through ~2 s persistence- // debounce + chokidar settle + 100 ms CC1 debounce, making the Switch- // appear to lag every click.- const enabled = projectLocalConfig?.autoSync?.enabled ?? false;- // Mirrors the SyncStatusBadge popover so both surfaces gate identically.- // Disable on cold start OR on a denied probe; never disable on- // undefined / unknown / pending (preserves read+write parity).- const disabledControl = shouldDisableSyncSwitch(- projectLocalSynced,- status?.pushPermission?.checkStatus,- );- // Whether the body line should carry the no-permission copy inline (instead- // of the standard "your edits stay local" string + a redundant paragraph- // underneath). Fires for both the probe-`denied` path AND the in-memory- // pause path (autoSync was already enabled when probe came back denied —- // engine sets `pausedReason='no-push-permission'`).- const isPushDenied =- status?.pushPermission?.checkStatus === 'denied' ||- status?.pausedReason === 'no-push-permission';- const sectionMessage =- isPushDenied || !status?.pausedReason ? null : formatPausedReason(status.pausedReason);-- // Committed project default (`autoSync.default`) — the maintainer-facing,- // git-shared seed for everyone's first open. true/false/null map to the three- // ToggleGroup options; `null` (ask) is the absence of a committed seed.- const committedDefault = projectConfig?.autoSync?.default ?? null;- const committedDefaultValue =- committedDefault === true ? 'on' : committedDefault === false ? 'off' : 'ask';- function onCommittedDefaultChange(next: string) {- // Radix single ToggleGroup emits '' when the active item is re-pressed- // (deselect) — ignore it so there is always exactly one committed stance.- if (next !== 'ask' && next !== 'on' && next !== 'off') return;- if (defaultWriter === null) {- toast.error(t`Sync settings not yet loaded — try again in a moment`);- return;- }- // 'ask' writes null, which clears the committed key (RFC 7396 merge-patch) →- // unanswered machines see the onboarding prompt again.- const value = next === 'on' ? true : next === 'off' ? false : null;- const result = defaultWriter(value);- if (!result.ok) {- const detail = result.error;- toast.error(t`Failed to update the project sync default — ${detail}`);- }- }-- return (- <section aria-labelledby="settings-sync-title" className="space-y-3">- <div className="space-y-1">- <h3 id="settings-sync-title" className="text-base font-semibold">- <Trans>Sync</Trans>- </h3>- <p className="text-sm text-muted-foreground">- <Trans>- Auto-sync pushes/pulls commits to your git remote on intervals and on save. Toggling on- requires confirmation.- </Trans>- </p>- </div>- <div className="rounded-md border p-3">- <div className="flex items-center justify-between gap-3">- <div className="min-w-0">- <label htmlFor="settings-sync-toggle" className="text-sm font-medium">- <Trans>Git auto-sync</Trans>- </label>- <p className="text-muted-foreground text-1sm" data-testid="settings-sync-body">- {isPushDenied ? (- // Probe denied (or engine paused in-memory because autoSync was- // already on when probe denied). Replace the standard body copy- // with the permission-specific message — the redundant- // sectionMessage paragraph below is suppressed in this case.- // "Paused", not "off": the user's preference is still on (the- // toggle shows it), sync is just blocked. Signed-out vs genuine- // read-only get different remedies.- shouldOfferReconnect(status?.pushPermission) ? (- <Trans>Auto-sync is paused — sign in to resume.</Trans>- ) : (- <Trans>- Auto-sync is paused — you don't have permission to push to this repo.- </Trans>- )- ) : enabled ? (- <Trans>- Auto-sync is on — your commits push and remote changes pull on intervals.- </Trans>- ) : (- <Trans>- Auto-sync is off — your edits stay local until you commit and push manually.- </Trans>- )}- </p>- {status?.remote ? (- <p- className="text-muted-foreground text-1sm truncate"- data-testid="settings-sync-remote"- >- <Trans>Connected to</Trans>{' '}- {status.remote.webUrl ? (- <a- href={status.remote.webUrl}- target="_blank"- rel="noopener noreferrer"- className="text-foreground hover:text-primary hover:underline inline-flex items-center gap-0.5"- aria-label={t`Open ${status.remote.label} on GitHub (opens in a new tab)`}- data-testid="settings-sync-remote-link"- >- <span>{status.remote.label}</span>- <ArrowUpRight className="inline size-3.5" aria-hidden />- </a>- ) : (- <span- className="font-medium text-foreground"- data-testid="settings-sync-remote-label"- >- {status.remote.label}- </span>- )}- </p>- ) : null}- </div>- <Switch- id="settings-sync-toggle"- checked={enabled}- disabled={disabledControl}- onCheckedChange={onToggleRequest}- aria-label={- status?.pushPermission?.checkStatus === 'denied'- ? t`Sync disabled — you don't have permission to push`- : enabled- ? t`Disable git auto-sync`- : t`Enable git auto-sync`- }- data-testid="settings-sync-toggle"- />- </div>- {sectionMessage !== null && (- <p className="text-1sm text-muted-foreground mt-2" data-testid="settings-sync-reason">- {sectionMessage}- </p>- )}- {shouldOfferSignInAgain(status?.pushPermission) && (- // Probe-401 ('unknown/token-invalid') surfaces a Sign in again- // affordance without disabling sync. Mirrors the popover so both- // surfaces gate identically.- <div className="mt-2 flex items-start gap-2" data-testid="settings-sync-signin-again">- <p className="text-1sm text-muted-foreground flex-1 min-w-0">- <Trans>Your GitHub session expired — sign in again to verify push access.</Trans>- </p>- <Button- variant="outline"- size="xs"- className="self-start"- onClick={() => setAuthModalOpen(true)}- >- <Trans>Sign in</Trans>- </Button>- </div>- )}- {shouldOfferReconnect(status?.pushPermission) && (- // Signed-out denial ('denied/not-authenticated') — reconnecting- // resumes sync (the body copy above reads "sign in to resume"), so- // surface the button. Mirrors the popover's reconnect affordance.- <div className="mt-2 flex justify-start" data-testid="settings-sync-reconnect">- {/* Default size (not xs) to match the None/On/Off toggle row above:- both resolve to h-8 / px-2.5 / text-sm. */}- <Button variant="outline" onClick={() => setAuthModalOpen(true)}>- <Trans>Sign in</Trans>- </Button>- </div>- )}- </div>- <div className="rounded-md border p-3 space-y-2" data-testid="settings-sync-default">- <div className="space-y-0.5">- <div className="text-sm font-medium">- <Trans>Shared default</Trans>- </div>- <p className="text-muted-foreground text-1sm">- <Trans>- Set the auto-sync default for users opening this project for the first time. This- setting is committed to your repository.- </Trans>- </p>- </div>- <ToggleGroup- type="single"- variant="outline"- spacing={2}- value={committedDefaultValue}- onValueChange={onCommittedDefaultChange}- disabled={!projectSynced}- aria-label={t`Shared auto-sync default`}- data-testid="settings-sync-default-toggle"- >- <ToggleGroupItem- value="ask"- className={COMMITTED_DEFAULT_SELECTED_CLASS}- data-testid="settings-sync-default-ask"- >- <Trans>None</Trans>- </ToggleGroupItem>- <ToggleGroupItem- value="on"- className={COMMITTED_DEFAULT_SELECTED_CLASS}- data-testid="settings-sync-default-on"- >- <Trans>On</Trans>- </ToggleGroupItem>- <ToggleGroupItem- value="off"- className={COMMITTED_DEFAULT_SELECTED_CLASS}- data-testid="settings-sync-default-off"- >- <Trans>Off</Trans>- </ToggleGroupItem>- </ToggleGroup>- </div>- <EnableSyncConfirmDialog- open={confirmOpen}- onOpenChange={setConfirmOpen}- onConfirm={onConfirm}- />- <AuthModal- open={authModalOpen}- onOpenChange={setAuthModalOpen}- onSuccess={() => setAuthModalOpen(false)}- // Both affordances that open this modal are expired/signed-out- // recoveries (probe-401 "sign in again" and the signed-out reconnect),- // never a first connection — title accordingly.- reauth- />- </section>- );-}--interface SettingsFieldProps {- field: FieldDef;- scope: Scope;- commitField: (name: FieldPath<Config>) => boolean;- isFlashed: boolean;-}--function SettingsField({ field, scope, commitField, isFlashed }: SettingsFieldProps) {- // 'use no memo' — the FormField inline render-prop below destructures- // `ctl` (a ControllerRenderProps with a `ref` field), which the React- // Compiler heuristic flags as ref-access during render. Same rationale- // as FieldControlBody / control bodies.- 'use no memo';- const { t } = useLingui();- const form = useFormContext<Config>();- const leafSchema = resolveLeafSchema(ConfigSchema, field.path);- const typeTag = leafSchema ? getLeafTypeTag(leafSchema) : undefined;- const defaultValue = leafSchema ? getFieldDefault(leafSchema) : undefined;- const enumOptions = leafSchema ? getEnumOptions(leafSchema) : undefined;-- // Defensive cross-scope check — every FieldDef in the new design is- // routed to a section that matches its schema scope, so this should- // never fire. Keeping the meta lookup as a guard rail; we don't- // render a readonly note (the sidebar IA prevents the cross-scope- // case from being reachable).- const meta = leafSchema ? getFieldMeta(leafSchema) : undefined;- const scopeMismatch =- (meta?.scope === 'project' && scope !== 'project') ||- (meta?.scope === 'user' && scope !== 'user');-- const dottedName = field.path.join('.') as FieldPath<Config>;- const labelText = t(field.label);-- const [savedTick, setSavedTick] = useState(false);- // Tracks the SavedIndicator timeout so an unmount mid-flash doesn't fire- // `setSavedTick(false)` on a torn-down component (React warning).- const savedTickTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);- useEffect(- () => () => {- if (savedTickTimerRef.current) clearTimeout(savedTickTimerRef.current);- },- [],- );-- const flashSavedTick = () => {- setSavedTick(true);- if (savedTickTimerRef.current) clearTimeout(savedTickTimerRef.current);- savedTickTimerRef.current = setTimeout(() => setSavedTick(false), 1200);- };-- /**- * Run `commitField` (the harness-owned binding.patch + form.setError /- * form.clearErrors path) and flash the SavedIndicator on success. The- * value committed is whatever currently lives in the form at `name` —- * call sites are responsible for writing the desired value via- * `ctl.onChange` (per-control commits) or `form.setValue` (reset path)- * BEFORE invoking `runCommit`.- */- const runCommit = (): boolean => {- const ok = commitField(dottedName);- if (ok) flashSavedTick();- return ok;- };-- /**- * Per-interaction commit (blur/change/Enter). Skips no-op commits where- * the field is not dirty against its current `defaultValue` baseline —- * after a successful commit, `useConfigForm` re-baselines via- * `form.resetField(name, { defaultValue: value })`, so subsequent- * blurs on an unchanged field correctly report `isDirty: false` and- * the unconditional `binding.patch → Y.Text delete+insert` cycle is- * avoided. Returns true on no-op (no error to surface).- *- * The reset path bypasses this guard by calling `runCommit` directly:- * `form.setValue(name, target, { shouldDirty: false })` leaves the- * field non-dirty, but the commit is still intentional (the user- * clicked Reset).- */- const runCommitIfDirty = (): boolean => {- if (!form.getFieldState(dottedName).isDirty) return true;- return runCommit();- };-- /**- * Reset writes the schema default (or `null` for fields with no- * default — null-as-clear preserves RFC 7396 semantics) into form- * state, then commits via the harness. `shouldDirty: false` so the- * field doesn't end up flagged as dirty after reset.- */- const reset = () => {- const target = defaultValue === undefined ? null : defaultValue;- form.setValue(dottedName, target as never, { shouldDirty: false });- runCommit();- };-- const wrapperClass = cn('relative', isFlashed && 'animate-settings-flash');-- return (- <FormField- control={form.control}- name={dottedName}- render={({ field: ctl }) => {- // Reset-button visibility derives from the form's reactive value- // (`ctl.value`) so it updates in lockstep with user edits, external- // Y.Text updates, and resets.- const showResetButton =- !scopeMismatch && (defaultValue !== undefined || ctl.value !== undefined);-- return (- <FormItem className={wrapperClass} data-field={field.path.join('.')} data-scope={scope}>- <div className="flex items-center justify-between gap-2">- <FormLabel className="text-sm font-medium">{labelText}</FormLabel>- {showResetButton ? (- <Tooltip>- <TooltipTrigger asChild>- <Button- variant="ghost"- size="icon"- className="h-5 w-5 text-muted-foreground opacity-60 hover:opacity-100"- onClick={reset}- aria-label={t`Reset ${labelText} to default`}- >- <RotateCcw className="size-3.5" />- </Button>- </TooltipTrigger>- <TooltipContent>- <Trans>Reset to default</Trans>- </TooltipContent>- </Tooltip>- ) : null}- </div>- {field.description ? (- <FormDescription className="text-muted-foreground text-1sm">- {t(field.description)}- </FormDescription>- ) : null}- <div className="flex items-center gap-2">- <FormControl>- <FieldControlBody- field={field}- ctl={ctl}- typeTag={typeTag}- enumOptions={enumOptions}- onCommit={runCommitIfDirty}- />- </FormControl>- <SavedIndicator visible={savedTick} srOnly={field.control === 'theme-tiles'} />- </div>- <FormMessage data-field-error={field.path.join('.')} />- </FormItem>- );- }}- />- );-}--interface FieldControlBodyProps {- field: FieldDef;- ctl: ControllerRenderProps<Config, FieldPath<Config>>;- typeTag: string | undefined;- enumOptions: readonly string[] | undefined;- /**- * Commits the field's CURRENT form value via the harness's- * `commitField`. Call sites must write the desired value through- * `ctl.onChange` BEFORE invoking — the commit reads from form state.- */- onCommit: () => boolean;-}--/**- * Type-tag-driven dispatch for the inner control element. Returns a- * single React element so the wrapping `<FormControl>` (Radix Slot)- * can forward `id`, `aria-describedby`, and `aria-invalid` to the- * underlying DOM input. The Slot clones this component with those props;- * destructure + forward as `...slotForwarded` into each leaf — without- * this hop the a11y attributes hit FieldControlBody and stop, breaking- * screen-reader notification of L1 rejection (ARIA §4.10).- *- * `'use no memo'` opts out of React Compiler memoization because RHF's- * `ControllerRenderProps` exposes a `ref` field; the compiler heuristic- * flags every property access on objects with `ref` as ref-access during- * render. The control bodies below use the same opt-out for the same- * reason.- */-function FieldControlBody({- field,- ctl,- typeTag,- enumOptions,- onCommit,- ...slotForwarded-}: FieldControlBodyProps & SlotForwardedProps) {- 'use no memo';- const { t } = useLingui();- // Optimistic theme apply. next-themes' `useTheme` is safe to- // call unconditionally — it returns a no-op `setTheme` when no- // <ThemeProvider> is mounted (e.g. in unit harnesses), and the app always- // mounts one in `main.tsx`. The actual flip is gated to the theme field in- // the enum-toggle branch below, so non-theme controls are unaffected.- const { setTheme } = useTheme();- // Optional: the theme-tiles control reads the custom-theme seed from config,- // but FieldControlBody also renders in provider-less unit harnesses.- const merged = useConfigContextOptional()?.merged ?? null;- if (field.control === 'theme-tiles') {- const { id: forwardedId, ...wrapperSlotProps } = slotForwarded;- const customSeed = merged?.appearance?.customTheme;- return (- <ColorThemePicker- {...wrapperSlotProps}- id={forwardedId}- value={typeof ctl.value === 'string' ? ctl.value : 'default'}- customSeed={customSeed}- aria-label={t(field.label)}- onSelect={(next) => {- // Optimistic apply: paint the palette overlay synchronously and flip- // next-themes to the palette's forced mode so `dark:` variants land- // immediately. A built-in palette forces light (Catppuccin Latte) or- // dark; `custom` follows its seed. `default` is system-kind, so- // `colorThemeMode` returns undefined — no flip, and the ConfigProvider- // effect restores the user's saved light/dark mode on the round-trip.- applyColorThemeToDom(next, customSeed);- if (next === 'custom') {- setTheme(customThemeKind(resolveCustomSeed(customSeed)) === 'dark' ? 'dark' : 'light');- } else {- const mode = colorThemeMode(next);- if (mode) setTheme(mode);- }- ctl.onChange(next);- onCommit();- }}- />- );- }- if (typeTag === 'boolean') {- return (- <Switch- {...slotForwarded}- checked={Boolean(ctl.value)}- ref={ctl.ref}- onCheckedChange={(next) => {- ctl.onChange(next);- onCommit();- }}- onBlur={ctl.onBlur}- />- );- }- if (typeTag === 'enum' && enumOptions && enumOptions.length > 0) {- if (field.control === 'enum-toggle' || enumOptions.length <= 4) {- // Slot.Root forwards `id` onto its child; ToggleGroup root renders a- // <div>, which is not a labelable element — `<label htmlFor>` on a- // div doesn't focus its descendants on click. Pluck the id and put- // it on the first ToggleGroupItem (a <button>) so label-click moves- // focus into the group. aria-describedby/aria-invalid stay on the- // wrapper since they describe the group as a whole.- const { id: forwardedId, ...wrapperSlotProps } = slotForwarded;- // Theme is the one enum-toggle that flips app-wide appearance. Detect it- // by path so the optimistic next-themes write stays scoped to this field.- const isThemeField = field.path[0] === 'appearance' && field.path[1] === 'theme';- return (- <ToggleGroup- {...wrapperSlotProps}- type="single"- value={typeof ctl.value === 'string' ? ctl.value : ''}- ref={ctl.ref}- onValueChange={(next) => {- if (!next) return;- // Optimistic flip on the originating client: apply via next-themes- // synchronously so the UI changes on click instead of waiting for- // the patch -> user-config Y.Text -> ConfigProvider merged-effect- // round-trip (the perceived lag). `next` is forwarded verbatim —- // 'system' is the OS-tracking lever and must not be resolved here.- // The ConfigProvider merged-effect still drives cross-project /- // remote clients (via config.yml + file-watcher) and Electron- // native chrome, and no-ops here (same value -> next-themes- // state bailout), so there is no double-flip.- if (isThemeField) setTheme(next);- ctl.onChange(next);- onCommit();- }}- onBlur={ctl.onBlur}- variant="segmented"- size="sm"- spacing={1}- className="bg-muted dark:bg-background p-0.5 rounded-lg"- aria-label={t(field.label)}- >- {enumOptions.map((opt, idx) => (- <ToggleGroupItem- key={opt}- value={opt}- id={idx === 0 ? forwardedId : undefined}- className="text-1sm capitalize"- >- {opt}- </ToggleGroupItem>- ))}- </ToggleGroup>- );- }- }- if (typeTag === 'number' || typeTag === 'int') {- return <NumberControlBody ctl={ctl} onCommit={onCommit} {...slotForwarded} />;- }- if (typeTag === 'array') {- return <StringArrayControlBody ctl={ctl} onCommit={onCommit} {...slotForwarded} />;- }- return <StringControlBody ctl={ctl} onCommit={onCommit} {...slotForwarded} />;-}--/**- * String-typed text input. Form value IS the displayed text — no local- * presentation buffer needed. Commits on blur or Enter.- */-function StringControlBody({- ctl,- onCommit,- ...slotForwarded-}: {- ctl: ControllerRenderProps<Config, FieldPath<Config>>;- onCommit: () => boolean;-} & SlotForwardedProps) {- 'use no memo';- return (- <Input- {...slotForwarded}- value={typeof ctl.value === 'string' ? ctl.value : ''}- ref={ctl.ref}- onChange={(e) => ctl.onChange(e.target.value)}- onBlur={() => {- ctl.onBlur();- onCommit();- }}- onKeyDown={(e) => {- if (e.key === 'Enter') {- e.preventDefault();- onCommit();- }- }}- className="h-8 text-sm"- />- );-}--/**- * Number-typed input. Form value is a `number`; the textbox needs a- * string presentation buffer so the user can type intermediate text- * (`'1.'`, `'-'`) without it parsing prematurely. The local `pendingText`- * resyncs with `ctl.value` whenever the user isn't actively editing.- */-function NumberControlBody({- ctl,- onCommit,- ...slotForwarded-}: {- ctl: ControllerRenderProps<Config, FieldPath<Config>>;- onCommit: () => boolean;-} & SlotForwardedProps) {- 'use no memo';- const [pendingText, setPendingText] = useState(ctl.value === undefined ? '' : String(ctl.value));- const lastSyncedValueRef = useRef(ctl.value);-- useEffect(() => {- // Skip if ctl.value hasn't changed since the last sync (dedup —- // avoids resetting pendingText on unrelated re-renders). When- // ctl.value DOES change, refresh pendingText to track it.- if (lastSyncedValueRef.current === ctl.value) return;- setPendingText(ctl.value === undefined ? '' : String(ctl.value));- lastSyncedValueRef.current = ctl.value;- }, [ctl.value]);-- const commitText = () => {- const parsed = Number(pendingText);- if (!Number.isFinite(parsed)) {- // Let L1 reject + show a typed FormMessage error rather than silently swallow.- ctl.onChange(pendingText as unknown as number);- onCommit();- return;- }- ctl.onChange(parsed);- onCommit();- lastSyncedValueRef.current = parsed as unknown as Config[keyof Config];- };-- return (- <Input- {...slotForwarded}- type="number"- value={pendingText}- ref={ctl.ref}- onChange={(e) => setPendingText(e.target.value)}- onBlur={() => {- ctl.onBlur();- commitText();- }}- onKeyDown={(e) => {- if (e.key === 'Enter') {- e.preventDefault();- commitText();- }- }}- className="h-8 w-28 text-sm tabular-nums"- />- );-}--/**- * String-array textarea. Form value is `string[]`; the textarea displays- * a newline-joined string. Local `pendingText` resyncs with `ctl.value`- * whenever the user isn't actively editing. Commit splits on newlines,- * trims each entry, and filters empty lines.- */-function StringArrayControlBody({- ctl,- onCommit,- ...slotForwarded-}: {- ctl: ControllerRenderProps<Config, FieldPath<Config>>;- onCommit: () => boolean;-} & SlotForwardedProps) {- 'use no memo';- const initial = Array.isArray(ctl.value) ? (ctl.value as string[]).join('\n') : '';- const [pendingText, setPendingText] = useState(initial);- const lastSyncedRef = useRef(initial);-- useEffect(() => {- const incoming = Array.isArray(ctl.value) ? (ctl.value as string[]).join('\n') : '';- if (incoming === lastSyncedRef.current) return;- setPendingText(incoming);- lastSyncedRef.current = incoming;- }, [ctl.value]);-- const commitText = () => {- const parsed = pendingText- .split('\n')- .map((line) => line.trim())- .filter((line) => line.length > 0);- ctl.onChange(parsed);- onCommit();- lastSyncedRef.current = parsed.join('\n');- };-- return (- <textarea- {...slotForwarded}- value={pendingText}- ref={ctl.ref}- onChange={(e) => setPendingText(e.target.value)}- onBlur={() => {- ctl.onBlur();- commitText();- }}- rows={Math.max(2, Math.min(6, pendingText.split('\n').length))}- className="min-h-16 w-full rounded-md border border-input bg-background px-3 py-1.5 font-mono text-xs outline-none transition-colors focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40"- />- );-}--function SavedIndicator({ visible, srOnly = false }: { visible: boolean; srOnly?: boolean }) {- // Live region — auto-save replaces an explicit Save button, so this- // checkmark IS the save confirmation. Polite announcement so screen- // readers say "Saved" without interrupting other speech (WCAG 4.1.3).- // Always render the wrapper so the SR-only text node is present at- // mount time; the visible checkmark is the only thing that toggles.- // `srOnly` keeps the announcement but never paints the checkmark — for- // controls whose committed value is already visually self-evident (the- // theme tiles repaint the whole app) and whose full-width layout the- // appearing icon would momentarily compress.- return (- <span role="status" aria-live="polite" className="text-emerald-600">- {visible ? (- <>- {srOnly ? null : <Check aria-hidden="true" className="size-3.5" />}- <span className="sr-only">- <Trans>Saved</Trans>- </span>- </>- ) : null}- </span>- );-}--function IntegrationsSection() {- const [installOpen, setInstallOpen] = useState(false);- const { skillInstalled, refresh } = useClaudeDesktopIntegration();- if (!SHOW_INSTALL_SKILL) return null;-- return (- <section aria-labelledby="settings-integrations-title" className="space-y-3">- <div className="space-y-1">- <h3 id="settings-integrations-title" className="text-base font-semibold">- <Trans>Integrations</Trans>- </h3>- <p className="text-sm text-muted-foreground">- <Trans>Connect OpenKnowledge to other tools you use.</Trans>- </p>- </div>- <div className="rounded-md border p-3">- <div className="flex items-center justify-between gap-3">- <div>- <div className="text-sm font-medium">- <Trans>Install in Claude Desktop</Trans>- </div>- <p className="text-muted-foreground text-1sm">- <Trans>Make this knowledge base available as a Claude Skill.</Trans>- </p>- </div>- <Button- variant="outline"- size="sm"- onClick={() => setInstallOpen(true)}- data-testid="settings-install-claude-desktop"- className="uppercase font-mono"- >- {skillInstalled ? <Trans>Reinstall</Trans> : <Trans>Install</Trans>}- </Button>- </div>- </div>- <InstallInClaudeDesktopDialog- open={installOpen}- onOpenChange={(next) => {- setInstallOpen(next);- if (!next) refresh();- }}- reinstall={skillInstalled}- />- </section>- );-}diff --git a/packages/app/src/components/settings/SyncSection.tsx b/packages/app/src/components/settings/SyncSection.tsxnew file mode 100644index 000000000..3ead62020--- /dev/null+++ b/packages/app/src/components/settings/SyncSection.tsx@@ -0,0 +1,356 @@+/**+ * Sync section — surface the git auto-sync toggle in Settings so users+ * have a deliberate path to re-enable when the header badge is hidden+ * (state === 'disabled' hides the badge).+ *+ * The toggle writes through the project-local ConfigBinding so the choice+ * lands in `<projectDir>/.ok/local/config.yml`; the file watcher then drives+ * the SyncEngine to match.+ */++import { Trans, useLingui } from '@lingui/react/macro';+import { ArrowUpRight, ChevronRight } from 'lucide-react';+import { useState } from 'react';+import { toast } from 'sonner';+import { AuthModal } from '@/components/AuthModal';+import { EnableSyncConfirmDialog } from '@/components/EnableSyncConfirmDialog';+import { PublishToGitHubDialog } from '@/components/PublishToGitHubDialog';+import {+ formatPausedReason,+ shouldDisableSyncSwitch,+ shouldOfferReconnect,+ shouldOfferSignInAgain,+} from '@/components/SyncStatusBadge';+import { Button } from '@/components/ui/button';+import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible';+import { Switch } from '@/components/ui/switch';+import { ToggleGroup, ToggleGroupItem } from '@/components/ui/toggle-group';+import {+ useEnableSyncWithConfirm,+ useSyncDefaultWriter,+ useSyncEnabledWriter,+} from '@/hooks/use-enable-sync-with-confirm';+import { useGitSyncStatus } from '@/hooks/use-git-sync-status';+import { useConfigContext } from '@/lib/config-provider';++// 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+// elsewhere in the app.+const COMMITTED_DEFAULT_SELECTED_CLASS =+ 'data-[state=on]:border-primary data-[state=on]:bg-primary data-[state=on]:text-primary-foreground data-[state=on]:hover:bg-primary/90';++export function SyncSection() {+ const { t } = useLingui();+ const status = useGitSyncStatus();+ const { projectConfig, projectLocalConfig, projectLocalSynced, projectSynced } =+ useConfigContext();+ const writer = useSyncEnabledWriter();+ const defaultWriter = useSyncDefaultWriter();+ const { confirmOpen, setConfirmOpen, onToggleRequest, onConfirm } =+ useEnableSyncWithConfirm(writer);+ const [publishOpen, setPublishOpen] = useState(false);+ // Local AuthModal control for the Sign-in-again affordance surfaced when+ // the probe returns 401. The editor header has its own AuthModal — settings+ // doesn't share it, so the section owns one locally (same pattern as+ // AccountSection).+ const [authModalOpen, setAuthModalOpen] = useState(false);++ // No git remote configured — instead of dead-ending on a CLI instruction,+ // lead with the outcome (back up + share) and offer the existing+ // Publish-to-GitHub wizard, which creates a repo and connects it with no+ // terminal. The raw `git remote add` path stays as an Advanced disclosure+ // for users who already have a repository.+ if (status && !status.hasRemote && status.state === 'dormant') {+ return (+ <section+ aria-labelledby="settings-sync-title"+ className="space-y-4"+ data-testid="settings-sync-empty"+ >+ <div className="space-y-1">+ <h3 id="settings-sync-title" className="text-base font-semibold">+ <Trans>Sync</Trans>+ </h3>+ <p className="text-sm text-muted-foreground">+ <Trans>+ This project lives only on this computer. Connect it to GitHub to back it up and share+ it with other people.+ </Trans>+ </p>+ </div>+ <div className="flex items-center justify-between gap-3 rounded-md border p-3">+ <div className="space-y-0.5">+ <div className="text-sm font-medium">+ <Trans>Connect to GitHub</Trans>+ </div>+ <p className="text-muted-foreground text-1sm">+ <Trans>We'll create a repository and start syncing — no terminal needed.</Trans>+ </p>+ </div>+ <Button onClick={() => setPublishOpen(true)} data-testid="settings-sync-setup">+ <Trans>Set up syncing</Trans>+ </Button>+ </div>++ <Collapsible>+ <CollapsibleTrigger asChild>+ <Button variant="ghost" size="sm" className="group gap-1 px-1.5 text-muted-foreground">+ <ChevronRight+ className="size-3.5 transition-transform group-data-[state=open]:rotate-90"+ aria-hidden+ />+ <Trans>Connect an existing repository</Trans>+ </Button>+ </CollapsibleTrigger>+ <CollapsibleContent className="px-1.5 pt-2 text-sm text-muted-foreground">+ <Trans>+ Already have a git repository? Add it with{' '}+ <code className="rounded bg-muted px-1 py-0.5 font-mono text-xs">+ git remote add origin <url>+ </code>{' '}+ in this project's folder. This page updates automatically once a remote is detected.+ </Trans>+ </CollapsibleContent>+ </Collapsible>++ <PublishToGitHubDialog open={publishOpen} onOpenChange={setPublishOpen} />+ </section>+ );+ }++ // Read user intent from the synchronous local CRDT preference (the same+ // binding `useSyncEnabledWriter` writes to). Don't read from the server's+ // engine-state projection — that round-trips through ~2 s persistence+ // debounce + chokidar settle + 100 ms CC1 debounce, making the Switch+ // appear to lag every click.+ const enabled = projectLocalConfig?.autoSync?.enabled ?? false;+ // Mirrors the SyncStatusBadge popover so both surfaces gate identically.+ // Disable on cold start OR on a denied probe; never disable on+ // undefined / unknown / pending (preserves read+write parity).+ const disabledControl = shouldDisableSyncSwitch(+ projectLocalSynced,+ status?.pushPermission?.checkStatus,+ );+ // Whether the body line should carry the no-permission copy inline (instead+ // of the standard "your edits stay local" string + a redundant paragraph+ // underneath). Fires for both the probe-`denied` path AND the in-memory+ // pause path (autoSync was already enabled when probe came back denied —+ // engine sets `pausedReason='no-push-permission'`).+ const isPushDenied =+ status?.pushPermission?.checkStatus === 'denied' ||+ status?.pausedReason === 'no-push-permission';+ const sectionMessage =+ isPushDenied || !status?.pausedReason ? null : formatPausedReason(status.pausedReason);++ // Committed project default (`autoSync.default`) — the maintainer-facing,+ // git-shared seed for everyone's first open. true/false/null map to the three+ // ToggleGroup options; `null` (ask) is the absence of a committed seed.+ const committedDefault = projectConfig?.autoSync?.default ?? null;+ const committedDefaultValue =+ committedDefault === true ? 'on' : committedDefault === false ? 'off' : 'ask';+ function onCommittedDefaultChange(next: string) {+ // Radix single ToggleGroup emits '' when the active item is re-pressed+ // (deselect) — ignore it so there is always exactly one committed stance.+ if (next !== 'ask' && next !== 'on' && next !== 'off') return;+ if (defaultWriter === null) {+ toast.error(t`Sync settings not yet loaded — try again in a moment`);+ return;+ }+ // 'ask' writes null, which clears the committed key (RFC 7396 merge-patch) →+ // unanswered machines see the onboarding prompt again.+ const value = next === 'on' ? true : next === 'off' ? false : null;+ const result = defaultWriter(value);+ if (!result.ok) {+ const detail = result.error;+ toast.error(t`Failed to update the project sync default — ${detail}`);+ }+ }++ return (+ <section aria-labelledby="settings-sync-title" className="space-y-3">+ <div className="space-y-1">+ <h3 id="settings-sync-title" className="text-base font-semibold">+ <Trans>Sync</Trans>+ </h3>+ <p className="text-sm text-muted-foreground">+ <Trans>+ Auto-sync pushes/pulls commits to your git remote on intervals and on save. Toggling on+ requires confirmation.+ </Trans>+ </p>+ </div>+ <div className="rounded-md border p-3">+ <div className="flex items-center justify-between gap-3">+ <div className="min-w-0">+ <label htmlFor="settings-sync-toggle" className="text-sm font-medium">+ <Trans>Git auto-sync</Trans>+ </label>+ <p className="text-muted-foreground text-1sm" data-testid="settings-sync-body">+ {isPushDenied ? (+ // Probe denied (or engine paused in-memory because autoSync was+ // already on when probe denied). Replace the standard body copy+ // with the permission-specific message — the redundant+ // sectionMessage paragraph below is suppressed in this case.+ // "Paused", not "off": the user's preference is still on (the+ // toggle shows it), sync is just blocked. Signed-out vs genuine+ // read-only get different remedies.+ shouldOfferReconnect(status?.pushPermission) ? (+ <Trans>Auto-sync is paused — sign in to resume.</Trans>+ ) : (+ <Trans>+ Auto-sync is paused — you don't have permission to push to this repo.+ </Trans>+ )+ ) : enabled ? (+ <Trans>+ Auto-sync is on — your commits push and remote changes pull on intervals.+ </Trans>+ ) : (+ <Trans>+ Auto-sync is off — your edits stay local until you commit and push manually.+ </Trans>+ )}+ </p>+ {status?.remote ? (+ <p+ className="text-muted-foreground text-1sm truncate"+ data-testid="settings-sync-remote"+ >+ <Trans>Connected to</Trans>{' '}+ {status.remote.webUrl ? (+ <a+ href={status.remote.webUrl}+ target="_blank"+ rel="noopener noreferrer"+ className="text-foreground hover:text-primary hover:underline inline-flex items-center gap-0.5"+ aria-label={t`Open ${status.remote.label} on GitHub (opens in a new tab)`}+ data-testid="settings-sync-remote-link"+ >+ <span>{status.remote.label}</span>+ <ArrowUpRight className="inline size-3.5" aria-hidden />+ </a>+ ) : (+ <span+ className="font-medium text-foreground"+ data-testid="settings-sync-remote-label"+ >+ {status.remote.label}+ </span>+ )}+ </p>+ ) : null}+ </div>+ <Switch+ id="settings-sync-toggle"+ checked={enabled}+ disabled={disabledControl}+ onCheckedChange={onToggleRequest}+ aria-label={+ status?.pushPermission?.checkStatus === 'denied'+ ? t`Sync disabled — you don't have permission to push`+ : enabled+ ? t`Disable git auto-sync`+ : t`Enable git auto-sync`+ }+ data-testid="settings-sync-toggle"+ />+ </div>+ {sectionMessage !== null && (+ <p className="text-1sm text-muted-foreground mt-2" data-testid="settings-sync-reason">+ {sectionMessage}+ </p>+ )}+ {shouldOfferSignInAgain(status?.pushPermission) && (+ // Probe-401 ('unknown/token-invalid') surfaces a Sign in again+ // affordance without disabling sync. Mirrors the popover so both+ // surfaces gate identically.+ <div className="mt-2 flex items-start gap-2" data-testid="settings-sync-signin-again">+ <p className="text-1sm text-muted-foreground flex-1 min-w-0">+ <Trans>Your GitHub session expired — sign in again to verify push access.</Trans>+ </p>+ <Button+ variant="outline"+ size="xs"+ className="self-start"+ onClick={() => setAuthModalOpen(true)}+ >+ <Trans>Sign in</Trans>+ </Button>+ </div>+ )}+ {shouldOfferReconnect(status?.pushPermission) && (+ // Signed-out denial ('denied/not-authenticated') — reconnecting+ // resumes sync (the body copy above reads "sign in to resume"), so+ // surface the button. Mirrors the popover's reconnect affordance.+ <div className="mt-2 flex justify-start" data-testid="settings-sync-reconnect">+ {/* Default size (not xs) to match the None/On/Off toggle row above:+ both resolve to h-8 / px-2.5 / text-sm. */}+ <Button variant="outline" onClick={() => setAuthModalOpen(true)}>+ <Trans>Sign in</Trans>+ </Button>+ </div>+ )}+ </div>+ <div className="rounded-md border p-3 space-y-2" data-testid="settings-sync-default">+ <div className="space-y-0.5">+ <div className="text-sm font-medium">+ <Trans>Shared default</Trans>+ </div>+ <p className="text-muted-foreground text-1sm">+ <Trans>+ Set the auto-sync default for users opening this project for the first time. This+ setting is committed to your repository.+ </Trans>+ </p>+ </div>+ <ToggleGroup+ type="single"+ variant="outline"+ spacing={2}+ value={committedDefaultValue}+ onValueChange={onCommittedDefaultChange}+ disabled={!projectSynced}+ aria-label={t`Shared auto-sync default`}+ data-testid="settings-sync-default-toggle"+ >+ <ToggleGroupItem+ value="ask"+ className={COMMITTED_DEFAULT_SELECTED_CLASS}+ data-testid="settings-sync-default-ask"+ >+ <Trans>None</Trans>+ </ToggleGroupItem>+ <ToggleGroupItem+ value="on"+ className={COMMITTED_DEFAULT_SELECTED_CLASS}+ data-testid="settings-sync-default-on"+ >+ <Trans>On</Trans>+ </ToggleGroupItem>+ <ToggleGroupItem+ value="off"+ className={COMMITTED_DEFAULT_SELECTED_CLASS}+ data-testid="settings-sync-default-off"+ >+ <Trans>Off</Trans>+ </ToggleGroupItem>+ </ToggleGroup>+ </div>+ <EnableSyncConfirmDialog+ open={confirmOpen}+ onOpenChange={setConfirmOpen}+ onConfirm={onConfirm}+ />+ <AuthModal+ open={authModalOpen}+ onOpenChange={setAuthModalOpen}+ onSuccess={() => setAuthModalOpen(false)}+ // Both affordances that open this modal are expired/signed-out+ // recoveries (probe-401 "sign in again" and the signed-out reconnect),+ // never a first connection — title accordingly.+ reauth+ />+ </section>+ );+}diff --git a/packages/app/src/components/settings/ThemePluginSection.tsx b/packages/app/src/components/settings/ThemePluginSection.tsxnew file mode 100644index 000000000..6a4038f23--- /dev/null+++ b/packages/app/src/components/settings/ThemePluginSection.tsx@@ -0,0 +1,29 @@+/**+ * The theme "plugin" panel — the color-palette picker + custom-theme editor,+ * rendered in the Plugins menu (Settings → Plugins → Themes) as a peer of the+ * lint plugins. Reuses the same user-scope config-form machinery the Preferences+ * pane uses.+ */++import type { ConfigBinding } from '@inkeep/open-knowledge-core';+import { useLingui } from '@lingui/react/macro';+import { CustomThemeEditor } from './CustomThemeEditor';+import { BoundSchemaSection } from './schema-section';+import { FIELDS_THEME_PLUGIN } from './settings-fields';++export function ThemePluginSection({ userBinding }: { userBinding: ConfigBinding }) {+ const { t } = useLingui();+ return (+ <div className="space-y-6">+ <BoundSchemaSection+ 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}+ />+ <CustomThemeEditor userBinding={userBinding} />+ </div>+ );+}diff --git a/packages/app/src/components/settings/field-controls.tsx b/packages/app/src/components/settings/field-controls.tsxnew file mode 100644index 000000000..161e08959--- /dev/null+++ b/packages/app/src/components/settings/field-controls.tsx@@ -0,0 +1,574 @@+/**+ * Shared schema-form field machinery for the Settings dialog body: the+ * per-field wrapper (`SettingsField`), the type-tag-driven control+ * dispatch (`FieldControlBody` + the string/number/array control+ * bodies), and the small widgets the section files compose+ * (`SavedIndicator`, `SectionSkeleton`).+ *+ * Auto-save: per-control commits via the harness-owned `commitField`+ * (see `use-config-form.ts`). Client-side L1 validation gates writes.+ * Per-field reset writes the schema default (or null per RFC 7396 for+ * fields without a default).+ */++import {+ type Config,+ ConfigSchema,+ type ConfigValidationError,+ getFieldMeta,+ isKnownConfigError,+} from '@inkeep/open-knowledge-core';+import { Trans, useLingui } from '@lingui/react/macro';+import { Check, RotateCcw } from 'lucide-react';+import { useTheme } from 'next-themes';+import { useEffect, useRef, useState } from 'react';+import { type ControllerRenderProps, type FieldPath, useFormContext } from 'react-hook-form';+import { Button } from '@/components/ui/button';+import {+ FormControl,+ FormDescription,+ FormField,+ FormItem,+ FormLabel,+ FormMessage,+} from '@/components/ui/form';+import { Input } from '@/components/ui/input';+import { Skeleton } from '@/components/ui/skeleton';+import { Switch } from '@/components/ui/switch';+import { Textarea } from '@/components/ui/textarea';+import { ToggleGroup, ToggleGroupItem } from '@/components/ui/toggle-group';+import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';+import { colorThemeMode, customThemeKind, resolveCustomSeed } from '@/lib/color-themes';+import { useConfigContextOptional } from '@/lib/config-context';+import { applyColorThemeToDom } from '@/lib/use-apply-config-color-theme';+import { cn } from '@/lib/utils';+import { ColorThemePicker } from './ColorThemePicker';+import {+ getEnumOptions,+ getFieldDefault,+ getLeafTypeTag,+ resolveLeafSchema,+} from './schema-walker';+import type { FieldDef } from './settings-fields';+import type { SlotForwardedProps } from './slot-forwarded-props';++/**+ * Internal scope tag for routing each section to its config binding.+ * Not exposed to the user — there's no top-level scope toggle in the+ * new design. Sections under USER use the user binding; sections under+ * THIS PROJECT use the project binding.+ */+export type Scope = 'user' | 'project';++export function firstIssuePath(error: ConfigValidationError): string | null {+ if (!isKnownConfigError(error) || error.code !== 'SCHEMA_INVALID') return null;+ const first = error.issues[0];+ if (!first || first.path.length === 0) return null;+ return first.path.map(String).join('.');+}++export function SectionSkeleton() {+ return (+ <div className="space-y-3">+ <Skeleton className="h-5 w-32" />+ <Skeleton className="h-4 w-64" />+ <div className="space-y-2">+ <Skeleton className="h-9 w-full" />+ <Skeleton className="h-9 w-full" />+ </div>+ </div>+ );+}++interface SettingsFieldProps {+ field: FieldDef;+ scope: Scope;+ commitField: (name: FieldPath<Config>) => boolean;+ isFlashed: boolean;+}++export function SettingsField({ field, scope, commitField, isFlashed }: SettingsFieldProps) {+ // 'use no memo' — the FormField inline render-prop below destructures+ // `ctl` (a ControllerRenderProps with a `ref` field), which the React+ // Compiler heuristic flags as ref-access during render. Same rationale+ // as FieldControlBody / control bodies.+ 'use no memo';+ const { t } = useLingui();+ const form = useFormContext<Config>();+ const leafSchema = resolveLeafSchema(ConfigSchema, field.path);+ const typeTag = leafSchema ? getLeafTypeTag(leafSchema) : undefined;+ const defaultValue = leafSchema ? getFieldDefault(leafSchema) : undefined;+ const enumOptions = leafSchema ? getEnumOptions(leafSchema) : undefined;++ // Defensive cross-scope check — every FieldDef in the new design is+ // routed to a section that matches its schema scope, so this should+ // never fire. Keeping the meta lookup as a guard rail; we don't+ // render a readonly note (the sidebar IA prevents the cross-scope+ // case from being reachable).+ const meta = leafSchema ? getFieldMeta(leafSchema) : undefined;+ const scopeMismatch =+ (meta?.scope === 'project' && scope !== 'project') ||+ (meta?.scope === 'user' && scope !== 'user');++ const dottedName = field.path.join('.') as FieldPath<Config>;+ const labelText = t(field.label);++ const [savedTick, setSavedTick] = useState(false);+ // Tracks the SavedIndicator timeout so an unmount mid-flash doesn't fire+ // `setSavedTick(false)` on a torn-down component (React warning).+ const savedTickTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);+ useEffect(+ () => () => {+ if (savedTickTimerRef.current) clearTimeout(savedTickTimerRef.current);+ },+ [],+ );++ const flashSavedTick = () => {+ setSavedTick(true);+ if (savedTickTimerRef.current) clearTimeout(savedTickTimerRef.current);+ savedTickTimerRef.current = setTimeout(() => setSavedTick(false), 1200);+ };++ /**+ * Run `commitField` (the harness-owned binding.patch + form.setError /+ * form.clearErrors path) and flash the SavedIndicator on success. The+ * value committed is whatever currently lives in the form at `name` —+ * call sites are responsible for writing the desired value via+ * `ctl.onChange` (per-control commits) or `form.setValue` (reset path)+ * BEFORE invoking `runCommit`.+ */+ const runCommit = (): boolean => {+ const ok = commitField(dottedName);+ if (ok) flashSavedTick();+ return ok;+ };++ /**+ * Per-interaction commit (blur/change/Enter). Skips no-op commits where+ * the field is not dirty against its current `defaultValue` baseline —+ * after a successful commit, `useConfigForm` re-baselines via+ * `form.resetField(name, { defaultValue: value })`, so subsequent+ * blurs on an unchanged field correctly report `isDirty: false` and+ * the unconditional `binding.patch → Y.Text delete+insert` cycle is+ * avoided. Returns true on no-op (no error to surface).+ *+ * The reset path bypasses this guard by calling `runCommit` directly:+ * `form.setValue(name, target, { shouldDirty: false })` leaves the+ * field non-dirty, but the commit is still intentional (the user+ * clicked Reset).+ */+ const runCommitIfDirty = (): boolean => {+ if (!form.getFieldState(dottedName).isDirty) return true;+ return runCommit();+ };++ /**+ * Reset writes the schema default (or `null` for fields with no+ * default — null-as-clear preserves RFC 7396 semantics) into form+ * state, then commits via the harness. `shouldDirty: false` so the+ * field doesn't end up flagged as dirty after reset.+ */+ const reset = () => {+ const target = defaultValue === undefined ? null : defaultValue;+ form.setValue(dottedName, target as never, { shouldDirty: false });+ runCommit();+ };++ const wrapperClass = cn('relative', isFlashed && 'animate-settings-flash');++ return (+ <FormField+ control={form.control}+ name={dottedName}+ render={({ field: ctl }) => {+ // Reset-button visibility derives from the form's reactive value+ // (`ctl.value`) so it updates in lockstep with user edits, external+ // Y.Text updates, and resets.+ const showResetButton =+ !scopeMismatch && (defaultValue !== undefined || ctl.value !== undefined);++ return (+ <FormItem className={wrapperClass} data-field={field.path.join('.')} data-scope={scope}>+ <div className="flex items-center justify-between gap-2">+ <FormLabel className="text-sm font-medium">{labelText}</FormLabel>+ {showResetButton ? (+ <Tooltip>+ <TooltipTrigger asChild>+ <Button+ variant="ghost"+ size="icon"+ className="h-5 w-5 text-muted-foreground opacity-60 hover:opacity-100"+ onClick={reset}+ aria-label={t`Reset ${labelText} to default`}+ >+ <RotateCcw className="size-3.5" />+ </Button>+ </TooltipTrigger>+ <TooltipContent>+ <Trans>Reset to default</Trans>+ </TooltipContent>+ </Tooltip>+ ) : null}+ </div>+ {field.description ? (+ <FormDescription className="text-muted-foreground text-1sm">+ {t(field.description)}+ </FormDescription>+ ) : null}+ <div className="flex items-center gap-2">+ <FormControl>+ <FieldControlBody+ field={field}+ ctl={ctl}+ typeTag={typeTag}+ enumOptions={enumOptions}+ onCommit={runCommitIfDirty}+ />+ </FormControl>+ <SavedIndicator visible={savedTick} srOnly={field.control === 'theme-tiles'} />+ </div>+ <FormMessage data-field-error={field.path.join('.')} />+ </FormItem>+ );+ }}+ />+ );+}++interface FieldControlBodyProps {+ field: FieldDef;+ ctl: ControllerRenderProps<Config, FieldPath<Config>>;+ typeTag: string | undefined;+ enumOptions: readonly string[] | undefined;+ /**+ * Commits the field's CURRENT form value via the harness's+ * `commitField`. Call sites must write the desired value through+ * `ctl.onChange` BEFORE invoking — the commit reads from form state.+ */+ onCommit: () => boolean;+}++/**+ * Type-tag-driven dispatch for the inner control element. Returns a+ * single React element so the wrapping `<FormControl>` (Radix Slot)+ * can forward `id`, `aria-describedby`, and `aria-invalid` to the+ * underlying DOM input. The Slot clones this component with those props;+ * destructure + forward as `...slotForwarded` into each leaf — without+ * this hop the a11y attributes hit FieldControlBody and stop, breaking+ * screen-reader notification of L1 rejection (ARIA §4.10).+ *+ * `'use no memo'` opts out of React Compiler memoization because RHF's+ * `ControllerRenderProps` exposes a `ref` field; the compiler heuristic+ * flags every property access on objects with `ref` as ref-access during+ * render. The control bodies below use the same opt-out for the same+ * reason.+ */+function FieldControlBody({+ field,+ ctl,+ typeTag,+ enumOptions,+ onCommit,+ ...slotForwarded+}: FieldControlBodyProps & SlotForwardedProps) {+ 'use no memo';+ const { t } = useLingui();+ // Optimistic theme apply. next-themes' `useTheme` is safe to+ // call unconditionally — it returns a no-op `setTheme` when no+ // <ThemeProvider> is mounted (e.g. in unit harnesses), and the app always+ // mounts one in `main.tsx`. The actual flip is gated to the theme field in+ // the enum-toggle branch below, so non-theme controls are unaffected.+ const { setTheme } = useTheme();+ // Optional: the theme-tiles control reads the custom-theme seed from config,+ // but FieldControlBody also renders in provider-less unit harnesses.+ const merged = useConfigContextOptional()?.merged ?? null;+ if (field.control === 'theme-tiles') {+ const { id: forwardedId, ...wrapperSlotProps } = slotForwarded;+ const customSeed = merged?.appearance?.customTheme;+ return (+ <ColorThemePicker+ {...wrapperSlotProps}+ id={forwardedId}+ value={typeof ctl.value === 'string' ? ctl.value : 'default'}+ customSeed={customSeed}+ aria-label={t(field.label)}+ onSelect={(next) => {+ // Optimistic apply: paint the palette overlay synchronously and flip+ // next-themes to the palette's forced mode so `dark:` variants land+ // immediately. A built-in palette forces light (Catppuccin Latte) or+ // dark; `custom` follows its seed. `default` is system-kind, so+ // `colorThemeMode` returns undefined — no flip, and the ConfigProvider+ // effect restores the user's saved light/dark mode on the round-trip.+ applyColorThemeToDom(next, customSeed);+ if (next === 'custom') {+ setTheme(customThemeKind(resolveCustomSeed(customSeed)) === 'dark' ? 'dark' : 'light');+ } else {+ const mode = colorThemeMode(next);+ if (mode) setTheme(mode);+ }+ ctl.onChange(next);+ onCommit();+ }}+ />+ );+ }+ if (typeTag === 'boolean') {+ return (+ <Switch+ {...slotForwarded}+ checked={Boolean(ctl.value)}+ ref={ctl.ref}+ onCheckedChange={(next) => {+ ctl.onChange(next);+ onCommit();+ }}+ onBlur={ctl.onBlur}+ />+ );+ }+ if (typeTag === 'enum' && enumOptions && enumOptions.length > 0) {+ if (field.control === 'enum-toggle' || enumOptions.length <= 4) {+ // Slot.Root forwards `id` onto its child; ToggleGroup root renders a+ // <div>, which is not a labelable element — `<label htmlFor>` on a+ // div doesn't focus its descendants on click. Pluck the id and put+ // it on the first ToggleGroupItem (a <button>) so label-click moves+ // focus into the group. aria-describedby/aria-invalid stay on the+ // wrapper since they describe the group as a whole.+ const { id: forwardedId, ...wrapperSlotProps } = slotForwarded;+ // Theme is the one enum-toggle that flips app-wide appearance. Detect it+ // by path so the optimistic next-themes write stays scoped to this field.+ const isThemeField = field.path[0] === 'appearance' && field.path[1] === 'theme';+ return (+ <ToggleGroup+ {...wrapperSlotProps}+ type="single"+ value={typeof ctl.value === 'string' ? ctl.value : ''}+ ref={ctl.ref}+ onValueChange={(next) => {+ if (!next) return;+ // Optimistic flip on the originating client: apply via next-themes+ // synchronously so the UI changes on click instead of waiting for+ // the patch -> user-config Y.Text -> ConfigProvider merged-effect+ // round-trip (the perceived lag). `next` is forwarded verbatim —+ // 'system' is the OS-tracking lever and must not be resolved here.+ // The ConfigProvider merged-effect still drives cross-project /+ // remote clients (via config.yml + file-watcher) and Electron+ // native chrome, and no-ops here (same value -> next-themes+ // state bailout), so there is no double-flip.+ if (isThemeField) setTheme(next);+ ctl.onChange(next);+ onCommit();+ }}+ onBlur={ctl.onBlur}+ variant="segmented"+ size="sm"+ spacing={1}+ className="bg-muted dark:bg-background p-0.5 rounded-lg"+ aria-label={t(field.label)}+ >+ {enumOptions.map((opt, idx) => (+ <ToggleGroupItem+ key={opt}+ value={opt}+ id={idx === 0 ? forwardedId : undefined}+ className="text-1sm capitalize"+ >+ {opt}+ </ToggleGroupItem>+ ))}+ </ToggleGroup>+ );+ }+ }+ if (typeTag === 'number' || typeTag === 'int') {+ return <NumberControlBody ctl={ctl} onCommit={onCommit} {...slotForwarded} />;+ }+ if (typeTag === 'array') {+ return <StringArrayControlBody ctl={ctl} onCommit={onCommit} {...slotForwarded} />;+ }+ return <StringControlBody ctl={ctl} onCommit={onCommit} {...slotForwarded} />;+}++/**+ * String-typed text input. Form value IS the displayed text — no local+ * presentation buffer needed. Commits on blur or Enter.+ */+function StringControlBody({+ ctl,+ onCommit,+ ...slotForwarded+}: {+ ctl: ControllerRenderProps<Config, FieldPath<Config>>;+ onCommit: () => boolean;+} & SlotForwardedProps) {+ 'use no memo';+ return (+ <Input+ {...slotForwarded}+ value={typeof ctl.value === 'string' ? ctl.value : ''}+ ref={ctl.ref}+ onChange={(e) => ctl.onChange(e.target.value)}+ onBlur={() => {+ ctl.onBlur();+ onCommit();+ }}+ onKeyDown={(e) => {+ if (e.key === 'Enter') {+ e.preventDefault();+ onCommit();+ }+ }}+ className="h-8 text-sm"+ />+ );+}++/**+ * Number-typed input. Form value is a `number`; the textbox needs a+ * string presentation buffer so the user can type intermediate text+ * (`'1.'`, `'-'`) without it parsing prematurely. The local `pendingText`+ * resyncs with `ctl.value` whenever the user isn't actively editing.+ */+function NumberControlBody({+ ctl,+ onCommit,+ ...slotForwarded+}: {+ ctl: ControllerRenderProps<Config, FieldPath<Config>>;+ onCommit: () => boolean;+} & SlotForwardedProps) {+ 'use no memo';+ const [pendingText, setPendingText] = useState(ctl.value === undefined ? '' : String(ctl.value));+ const lastSyncedValueRef = useRef(ctl.value);++ useEffect(() => {+ // Skip if ctl.value hasn't changed since the last sync (dedup —+ // avoids resetting pendingText on unrelated re-renders). When+ // ctl.value DOES change, refresh pendingText to track it.+ if (lastSyncedValueRef.current === ctl.value) return;+ setPendingText(ctl.value === undefined ? '' : String(ctl.value));+ lastSyncedValueRef.current = ctl.value;+ }, [ctl.value]);++ const commitText = () => {+ const parsed = Number(pendingText);+ if (!Number.isFinite(parsed)) {+ // Let L1 reject + show a typed FormMessage error rather than silently swallow.+ ctl.onChange(pendingText as unknown as number);+ onCommit();+ return;+ }+ ctl.onChange(parsed);+ onCommit();+ lastSyncedValueRef.current = parsed as unknown as Config[keyof Config];+ };++ return (+ <Input+ {...slotForwarded}+ type="number"+ value={pendingText}+ ref={ctl.ref}+ onChange={(e) => setPendingText(e.target.value)}+ onBlur={() => {+ ctl.onBlur();+ commitText();+ }}+ onKeyDown={(e) => {+ if (e.key === 'Enter') {+ e.preventDefault();+ commitText();+ }+ }}+ className="h-8 w-28 text-sm tabular-nums"+ />+ );+}++/**+ * String-array textarea. Form value is `string[]`; the textarea displays+ * a newline-joined string. Local `pendingText` resyncs with `ctl.value`+ * whenever the user isn't actively editing. Commit splits on newlines,+ * trims each entry, and filters empty lines.+ */+function StringArrayControlBody({+ ctl,+ onCommit,+ ...slotForwarded+}: {+ ctl: ControllerRenderProps<Config, FieldPath<Config>>;+ onCommit: () => boolean;+} & SlotForwardedProps) {+ 'use no memo';+ const initial = Array.isArray(ctl.value) ? (ctl.value as string[]).join('\n') : '';+ const [pendingText, setPendingText] = useState(initial);+ const lastSyncedRef = useRef(initial);++ useEffect(() => {+ const incoming = Array.isArray(ctl.value) ? (ctl.value as string[]).join('\n') : '';+ if (incoming === lastSyncedRef.current) return;+ setPendingText(incoming);+ lastSyncedRef.current = incoming;+ }, [ctl.value]);++ const commitText = () => {+ const parsed = pendingText+ .split('\n')+ .map((line) => line.trim())+ .filter((line) => line.length > 0);+ ctl.onChange(parsed);+ onCommit();+ lastSyncedRef.current = parsed.join('\n');+ };++ return (+ // shadcn Textarea with overrides that keep the pre-migration rendering:+ // `field-sizing-fixed` restores rows-driven height (the base+ // `field-sizing-content` would auto-grow past the 6-row cap), and the+ // background/text overrides pin the monospace xs-size look across+ // breakpoints and color schemes.+ <Textarea+ {...slotForwarded}+ value={pendingText}+ ref={ctl.ref}+ onChange={(e) => setPendingText(e.target.value)}+ onBlur={() => {+ ctl.onBlur();+ commitText();+ }}+ rows={Math.max(2, Math.min(6, pendingText.split('\n').length))}+ className="field-sizing-fixed min-h-16 rounded-md bg-background px-3 py-1.5 font-mono text-xs md:text-xs dark:bg-background"+ />+ );+}++export function SavedIndicator({+ visible,+ srOnly = false,+}: {+ visible: boolean;+ srOnly?: boolean;+}) {+ // Live region — auto-save replaces an explicit Save button, so this+ // checkmark IS the save confirmation. Polite announcement so screen+ // readers say "Saved" without interrupting other speech (WCAG 4.1.3).+ // Always render the wrapper so the SR-only text node is present at+ // mount time; the visible checkmark is the only thing that toggles.+ // `srOnly` keeps the announcement but never paints the checkmark — for+ // controls whose committed value is already visually self-evident (the+ // theme tiles repaint the whole app) and whose full-width layout the+ // appearing icon would momentarily compress.+ return (+ <span role="status" aria-live="polite" className="text-emerald-600">+ {visible ? (+ <>+ {srOnly ? null : <Check aria-hidden="true" className="size-3.5" />}+ <span className="sr-only">+ <Trans>Saved</Trans>+ </span>+ </>+ ) : null}+ </span>+ );+}diff --git a/packages/app/src/components/settings/schema-section.tsx b/packages/app/src/components/settings/schema-section.tsxnew file mode 100644index 000000000..966c9c5e3--- /dev/null+++ b/packages/app/src/components/settings/schema-section.tsx@@ -0,0 +1,165 @@+/**+ * Schema-driven section harness for the Settings dialog body: mounts the+ * form machinery (`useConfigForm`) for one config binding and renders a+ * titled group of `SettingsField`s from a declarative `FieldDef` list.+ *+ * L3 rejection from non-pane writers (CLI, MCP, hand-edit) surfaces as a+ * sonner toast + brief field flash on the matching scope's section (when+ * mounted).+ */++import {+ CONFIG_DOC_NAME_PROJECT,+ CONFIG_DOC_NAME_USER,+ type Config,+ type ConfigBinding,+ humanFormat,+} from '@inkeep/open-knowledge-core';+import { useEffect, useRef, useState } from 'react';+import type { FieldPath } from 'react-hook-form';+import { toast } from 'sonner';+import { Form } from '@/components/ui/form';+import { subscribeToConfigValidationRejected } from '@/lib/config-validation-events';+import { firstIssuePath, type Scope, SettingsField } from './field-controls';+import { ScopeBadge } from './ScopeBadge';+import type { FieldDef } from './settings-fields';+import { pickFirstIssueForPath, useConfigForm } from './use-config-form';++interface BoundSchemaSectionProps {+ title: string;+ description: string;+ 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;+}++/**+ * Mounts the harness (`useConfigForm`) once per binding identity and+ * wraps the body in shadcn's `<Form>` (RHF's `FormProvider`). One per+ * scope; both scopes' sections live under the same dialog so each has+ * its own form instance.+ *+ * Owns the CC1 `'config-validation-rejected'` subscription scoped to+ * the matching docName, plus the per-field flash state — both need+ * access to the form. The toast fires for any rejection on this scope;+ * `setError` + `setFocus` + `flash` only fire when the field's section+ * is the active one (the form is unmounted otherwise, so nothing to+ * flash).+ */+export function BoundSchemaSection({+ title,+ description,+ scope,+ binding,+ fields,+ scopeBadge,+}: BoundSchemaSectionProps) {+ const { form, commitField } = useConfigForm(binding);+ const [flashedPath, setFlashedPath] = useState<string | null>(null);+ const flashTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);++ useEffect(() => {+ const docName = scope === 'project' ? CONFIG_DOC_NAME_PROJECT : CONFIG_DOC_NAME_USER;+ const unsubscribe = subscribeToConfigValidationRejected((event) => {+ if (event.docName !== docName) return;++ // Toast carries the full multi-line summary (humanFormat); the+ // inline FormMessage shows only the path-matched issue so the+ // field doesn't render a multi-line block with file paths and+ // caret markers.+ toast.error(humanFormat(event.error), { duration: 8000 });++ const path = firstIssuePath(event.error);+ if (path) {+ form.setError(path as FieldPath<Config>, {+ type: 'config-validation-rejected',+ message: pickFirstIssueForPath(event.error, path),+ });+ form.setFocus(path as FieldPath<Config>);+ setFlashedPath(path);+ if (flashTimerRef.current) clearTimeout(flashTimerRef.current);+ flashTimerRef.current = setTimeout(() => {+ setFlashedPath(null);+ // Clear the inline error alongside the flash. The toast+ // (8s) remains the persistent feedback channel; if the+ // external writer corrected the value via Y.Text,+ // `applyExternalUpdate` already updated the field — we+ // don't want a stale red FormMessage lingering on a+ // now-valid value.+ form.clearErrors(path as FieldPath<Config>);+ }, 600);+ }+ });+ return () => {+ unsubscribe();+ if (flashTimerRef.current) clearTimeout(flashTimerRef.current);+ };+ }, [scope, form]);++ return (+ <Form {...form}>+ <SchemaSection+ title={title}+ description={description}+ scope={scope}+ scopeBadge={scopeBadge}+ fields={fields}+ commitField={commitField}+ flashedPath={flashedPath}+ />+ </Form>+ );+}++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;+}++function SchemaSection({+ title,+ description,+ scope,+ scopeBadge,+ fields,+ commitField,+ flashedPath,+}: SchemaSectionProps) {+ const titleId = `settings-section-${scope}-title`;+ return (+ <section aria-labelledby={titleId} className="space-y-3">+ <div className="space-y-1">+ <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">+ {fields.map((field) => (+ <SettingsField+ key={field.path.join('.')}+ field={field}+ scope={scope}+ commitField={commitField}+ isFlashed={flashedPath === field.path.join('.')}+ />+ ))}+ </div>+ </section>+ );+}diff --git a/packages/app/src/locales/en/messages.po b/packages/app/src/locales/en/messages.poindex 5de378edd..05d33ed7d 100644--- a/packages/app/src/locales/en/messages.po+++ b/packages/app/src/locales/en/messages.po@@ -13,7 +13,7 @@ msgstr """Language-Team: \n""Plural-Forms: \n"-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/HotkeysSection.tsxmsgid " or "msgstr " or "@@ -1026,7 +1026,7 @@ msgstr "All tags"msgid "Already at {assetContentPath} — reusing."msgstr "Already at {assetContentPath} — reusing."-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "Already have a git repository? Add it with <0>git remote add origin <url></0> in this project's folder. This page updates automatically once a remote is detected."msgstr "Already have a git repository? Add it with <0>git remote add origin <url></0> in this project's folder. This page updates automatically once a remote is detected."@@ -1180,7 +1180,7 @@ msgstr "Asset: {title}"msgid "Attach the file in an email to <0/>"msgstr "Attach the file in an email to <0/>"-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/AttachmentsSection.tsxmsgid "Attachments"msgstr "Attachments"@@ -1213,7 +1213,7 @@ msgstr "Auto-denied"msgid "Auto-save"msgstr "Auto-save"-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "Auto-sync is off — your edits stay local until you commit and push manually."msgstr "Auto-sync is off — your edits stay local until you commit and push manually."@@ -1221,7 +1221,7 @@ msgstr "Auto-sync is off — your edits stay local until you commit and push manmsgid "Auto-sync is off for this worktree, inherited from {project}. Change it in Settings → Sync."msgstr "Auto-sync is off for this worktree, inherited from {project}. Change it in Settings → Sync."-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "Auto-sync is on — your commits push and remote changes pull on intervals."msgstr "Auto-sync is on — your commits push and remote changes pull on intervals."@@ -1229,11 +1229,11 @@ msgstr "Auto-sync is on — your commits push and remote changes pull on intervamsgid "Auto-sync is on for this worktree, inherited from {project}. Change it in Settings → Sync."msgstr "Auto-sync is on for this worktree, inherited from {project}. Change it in Settings → Sync."-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "Auto-sync is paused — sign in to resume."msgstr "Auto-sync is paused — sign in to resume."-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "Auto-sync is paused — you don't have permission to push to this repo."msgstr "Auto-sync is paused — you don't have permission to push to this repo."@@ -1241,7 +1241,7 @@ msgstr "Auto-sync is paused — you don't have permission to push to this repo."msgid "Auto-sync periodically fetches, pulls, and pushes commits to your remote git repository so your edits stay in sync across machines."msgstr "Auto-sync periodically fetches, pulls, and pushes commits to your remote git repository so your edits stay in sync across machines."-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "Auto-sync pushes/pulls commits to your git remote on intervals and on save. Toggling on requires confirmation."msgstr "Auto-sync pushes/pulls commits to your git remote on intervals and on save. Toggling on requires confirmation."@@ -1929,7 +1929,7 @@ msgstr "Connect"msgid "Connect a GitHub account to browse and sync your repositories."msgstr "Connect a GitHub account to browse and sync your repositories."-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "Connect an existing repository"msgstr "Connect an existing repository"@@ -1943,7 +1943,7 @@ msgstr "Connect GitHub"msgid "Connect GitHub to continue."msgstr "Connect GitHub to continue."-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/IntegrationsSection.tsxmsgid "Connect OpenKnowledge to other tools you use."msgstr "Connect OpenKnowledge to other tools you use."@@ -1961,7 +1961,7 @@ msgstr "Connect this project to GitHub to share."msgid "Connect to AI tools"msgstr "Connect to AI tools"-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "Connect to GitHub"msgstr "Connect to GitHub"@@ -1986,7 +1986,7 @@ msgstr "Connected as @{login}"msgid "Connected as <0>@{signedInLogin}</0>"msgstr "Connected as <0>@{signedInLogin}</0>"-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "Connected to"msgstr "Connected to"@@ -2032,7 +2032,7 @@ msgstr "Content directory"msgid "Content directory must be inside the project"msgstr "Content directory must be inside the project"-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/AttachmentsSection.tsxmsgid "Content root"msgstr "Content root"@@ -2755,7 +2755,7 @@ msgstr "Date"msgid "default"msgstr "default"-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/AttachmentsSection.tsxmsgid "Default location for new attachments"msgstr "Default location for new attachments"@@ -2963,7 +2963,7 @@ msgstr "Disable {0}"msgid "Disable external link previews"msgstr "Disable external link previews"-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "Disable git auto-sync"msgstr "Disable git auto-sync"@@ -3172,7 +3172,7 @@ msgstr "Duplicate the focused file-tree item when focus is in the Files sidebar.msgid "Duplicated to \"{0}\""msgstr "Duplicated to \"{0}\""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/AttachmentsSection.tsxmsgid "e.g. assets/uploads"msgstr "e.g. assets/uploads"@@ -3358,7 +3358,7 @@ msgstr "Enable auto-sync"msgid "Enable external link previews"msgstr "Enable external link previews"-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "Enable git auto-sync"msgstr "Enable git auto-sync"@@ -3740,7 +3740,7 @@ msgstr "Failed to save theme setting"msgid "Failed to store the token — try again"msgstr "Failed to store the token — try again"-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/AttachmentsSection.tsxmsgid "Failed to update attachment location — {detail}"msgstr "Failed to update attachment location — {detail}"@@ -3761,7 +3761,7 @@ msgstr "Failed to update the auto-approve setting — {detail}"msgid "Failed to update the embeddings endpoint — {detail}"msgstr "Failed to update the embeddings endpoint — {detail}"-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "Failed to update the project sync default — {detail}"msgstr "Failed to update the project sync default — {detail}"@@ -3903,7 +3903,7 @@ msgstr "Fix all ({count})"msgid "Fix all {count} fixable problems"msgstr "Fix all {count} fixable problems"-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/AttachmentsSection.tsxmsgid "Fixed folder in content root"msgstr "Fixed folder in content root"@@ -3938,7 +3938,7 @@ msgstr "Fold, unfold, fold all, or unfold all source ranges."msgid "folder"msgstr "folder"-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/AttachmentsSection.tsx#: src/components/share-metadata-rows.tsx#: src/editor/composer-mention/ComposerMentionMenu.tsx#: src/editor/extensions/InternalLinkPropPanel.tsx@@ -4052,7 +4052,7 @@ msgstr "Get product updates in your inbox."msgid "Get set up"msgstr "Get set up"-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "Git auto-sync"msgstr "Git auto-sync"@@ -4319,7 +4319,7 @@ msgstr "Horizontal pill strip + active panel below; click a pill to switch panelmsgid "Horizontal rule that divides sections."msgstr "Horizontal rule that divides sections."-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/HotkeysSection.tsx#: src/components/settings/SettingsDialogShell.tsxmsgid "Hotkeys"msgstr "Hotkeys"@@ -4531,7 +4531,7 @@ msgid "Insert, delete, move, copy, and indent source editor lines through CodeMimsgstr "Insert, delete, move, copy, and indent source editor lines through CodeMirror's default keymap."#: src/components/InstallInClaudeDesktopDialog.tsx-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/IntegrationsSection.tsx#: src/components/skill-actions.tsx#: src/components/SkillRow.tsxmsgid "Install"@@ -4554,7 +4554,7 @@ msgstr "Install for Claude Chat & Cowork (Desktop App)"msgid "Install handoff failed: {msg}"msgstr "Install handoff failed: {msg}"-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/IntegrationsSection.tsxmsgid "Install in Claude Desktop"msgstr "Install in Claude Desktop"@@ -4615,7 +4615,7 @@ msgstr "Installing {agentName}…"msgid "Instruction for the AI"msgstr "Instruction for the AI"-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/IntegrationsSection.tsx#: src/components/settings/SettingsDialogShell.tsxmsgid "Integrations"msgstr "Integrations"@@ -4690,7 +4690,7 @@ msgstr "Keep track of the people and companies you work with and the meetings yomsgid "Key ending in {keyHint}"msgstr "Key ending in {keyHint}"-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/HotkeysSection.tsxmsgid "Keyboard shortcuts available in the editor and workspace."msgstr "Keyboard shortcuts available in the editor and workspace."@@ -4960,7 +4960,7 @@ msgstr "Looking for <0>{lookingForUrl}</0>."msgid "Lost connection to \"{docName}\"."msgstr "Lost connection to \"{docName}\"."-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/IntegrationsSection.tsxmsgid "Make this knowledge base available as a Claude Skill."msgstr "Make this knowledge base available as a Claude Skill."@@ -5670,7 +5670,7 @@ msgstr "No templates yet. Add one to give new docs in this folder a ready-made smsgid "No workspace"msgstr "No workspace"-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "None"msgstr "None"@@ -5740,7 +5740,7 @@ msgstr "of {0}"msgid "of {totalPages}"msgstr "of {totalPages}"-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "Off"msgstr "Off"@@ -5764,7 +5764,7 @@ msgstr "OK Desktop"msgid "ok ui responded but server.lock has no port yet"msgstr "ok ui responded but server.lock has no port yet"-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "On"msgstr "On"@@ -5816,7 +5816,7 @@ msgid "Open"msgstr "Open"#. placeholder {0}: status.remote.label-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsx#: src/components/SyncStatusBadge.tsxmsgid "Open {0} on GitHub (opens in a new tab)"msgstr "Open {0} on GitHub (opens in a new tab)"@@ -6376,7 +6376,7 @@ msgstr "Pick “Custom” above to use this palette."msgid "Pick <0>openknowledge.skill</0> from your <1>Downloads</1> folder. It enables automatically."msgstr "Pick <0>openknowledge.skill</0> from your <1>Downloads</1> folder. It enables automatically."-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/ThemePluginSection.tsxmsgid "Pick a built-in IDE color palette, or define your own."msgstr "Pick a built-in IDE color palette, or define your own."@@ -6711,7 +6711,7 @@ msgid "Refresh audit"msgstr "Refresh audit"#: src/components/InstallInClaudeDesktopDialog.tsx-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/IntegrationsSection.tsxmsgid "Reinstall"msgstr "Reinstall"@@ -6992,12 +6992,12 @@ msgstr "Reset"msgid "Reset {0} to default"msgstr "Reset {0} to default"-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/field-controls.tsxmsgid "Reset {labelText} to default"msgstr "Reset {labelText} to default"+#: src/components/settings/field-controls.tsx#: src/components/settings/markdownlint-rule-browser.tsx-#: src/components/settings/SettingsDialogBody.tsxmsgid "Reset to default"msgstr "Reset to default"@@ -7206,7 +7206,7 @@ msgstr "running"msgid "Running project audit"msgstr "Running project audit"-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/AttachmentsSection.tsxmsgid "Same folder as current file"msgstr "Same folder as current file"@@ -7234,8 +7234,8 @@ msgstr "Save failed: {error}"msgid "Save resolution"msgstr "Save resolution"+#: src/components/settings/field-controls.tsx#: src/components/settings/OkignoreSection.tsx-#: src/components/settings/SettingsDialogBody.tsxmsgid "Saved"msgstr "Saved"@@ -7261,7 +7261,7 @@ msgstr "Saving"msgid "Scope"msgstr "Scope"-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/HotkeysSection.tsxmsgid "Scope: "msgstr "Scope: "@@ -7530,7 +7530,7 @@ msgstr "Set git identity"msgid "Set identity"msgstr "Set identity"-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "Set the auto-sync default for users opening this project for the first time. This setting is committed to your repository."msgstr "Set the auto-sync default for users opening this project for the first time. This setting is committed to your repository."@@ -7538,11 +7538,11 @@ msgstr "Set the auto-sync default for users opening this project for the first tmsgid "Set up OpenKnowledge integrations"msgstr "Set up OpenKnowledge integrations"-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "Set up syncing"msgstr "Set up syncing"-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/AttachmentsSection.tsxmsgid "Set where pasted and dropped files are stored for this project."msgstr "Set where pasted and dropped files are stored for this project."@@ -7615,11 +7615,11 @@ msgstr "Share URL"msgid "Shared"msgstr "Shared"-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "Shared auto-sync default"msgstr "Shared auto-sync default"-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "Shared default"msgstr "Shared default"@@ -7795,7 +7795,7 @@ msgid "Shows above the code body. Round-trips as `title=\"...\"` in markdown."msgstr "Shows above the code body. Round-trips as `title=\"...\"` in markdown."#: src/components/settings/AccountSection.tsx-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsx#: src/components/SyncStatusBadge.tsxmsgid "Sign in"msgstr "Sign in"@@ -8063,7 +8063,7 @@ msgstr "Style"msgid "Subfolder name"msgstr "Subfolder name"-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/AttachmentsSection.tsxmsgid "Subfolder under current folder"msgstr "Subfolder under current folder"@@ -8134,8 +8134,8 @@ msgstr "Symlink"msgid "Symlink to {targetPath}"msgstr "Symlink to {targetPath}"-#: src/components/settings/SettingsDialogBody.tsx#: src/components/settings/SettingsDialogShell.tsx+#: src/components/settings/SyncSection.tsxmsgid "Sync"msgstr "Sync"@@ -8143,7 +8143,7 @@ msgstr "Sync"msgid "Sync disabled"msgstr "Sync disabled"-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsx#: src/components/SyncStatusBadge.tsxmsgid "Sync disabled — you don't have permission to push"msgstr "Sync disabled — you don't have permission to push"@@ -8179,7 +8179,7 @@ msgid "Sync paused — you don't have permission to push to this repo"msgstr "Sync paused — you don't have permission to push to this repo"#: src/components/AutoSyncOnboardingDialog.tsx-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsx#: src/hooks/use-enable-sync-with-confirm.tsmsgid "Sync settings not yet loaded — try again in a moment"msgstr "Sync settings not yet loaded — try again in a moment"@@ -8510,8 +8510,8 @@ msgid "Theme"msgstr "Theme"#: src/components/settings/LintingSection.tsx-#: src/components/settings/SettingsDialogBody.tsx#: src/components/settings/SettingsDialogShell.tsx+#: src/components/settings/ThemePluginSection.tsxmsgid "Themes"msgstr "Themes"@@ -8700,7 +8700,7 @@ msgstr "This project is running an older version of OpenKnowledge (v{0}) than thmsgid "This project isn't a git repository, so worktrees aren't available."msgstr "This project isn't a git repository, so worktrees aren't available."-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "This project lives only on this computer. Connect it to GitHub to back it up and share it with other people."msgstr "This project lives only on this computer. Connect it to GitHub to back it up and share it with other people."@@ -9255,7 +9255,7 @@ msgstr "We couldn't clone this repository."msgid "We'll build <0>openknowledge.skill</0>, save it to <1>~/Downloads</1>, and open the Claude Desktop App for you."msgstr "We'll build <0>openknowledge.skill</0>, save it to <1>~/Downloads</1>, and open the Claude Desktop App for you."-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "We'll create a repository and start syncing — no terminal needed."msgstr "We'll create a repository and start syncing — no terminal needed."@@ -9341,7 +9341,7 @@ msgstr "When the agent runs its scheduled work."msgid "When you hover an external link, its URL is sent to the destination site to fetch the page's preview metadata — one request per previewed link."msgstr "When you hover an external link, its URL is sent to the destination site to fetch the page's preview metadata — one request per previewed link."-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/AttachmentsSection.tsxmsgid "Where newly added attachments are placed."msgstr "Where newly added attachments are placed."@@ -9525,7 +9525,7 @@ msgstr "Your current version is saved first, so this is reversible."msgid "Your embeddings provider API key, used only to create embeddings of your content for semantic search. Stored once for this machine in <0>~/.ok/secrets.yml</0> (readable only by your user account) and shared across all projects. Turn the feature on per project in This project → Search, where you can also override the endpoint."msgstr "Your embeddings provider API key, used only to create embeddings of your content for semantic search. Stored once for this machine in <0>~/.ok/secrets.yml</0> (readable only by your user account) and shared across all projects. Turn the feature on per project in This project → Search, where you can also override the endpoint."-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsx#: src/components/SyncStatusBadge.tsxmsgid "Your GitHub session expired — sign in again to verify push access."msgstr "Your GitHub session expired — sign in again to verify push access."diff --git a/packages/app/src/locales/pseudo/messages.po b/packages/app/src/locales/pseudo/messages.poindex 2325c1bdf..81ebb3b94 100644--- a/packages/app/src/locales/pseudo/messages.po+++ b/packages/app/src/locales/pseudo/messages.po@@ -13,7 +13,7 @@ msgstr """Language-Team: \n""Plural-Forms: \n"-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/HotkeysSection.tsxmsgid " or "msgstr ""@@ -1022,7 +1022,7 @@ msgstr ""msgid "Already at {assetContentPath} — reusing."msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "Already have a git repository? Add it with <0>git remote add origin <url></0> in this project's folder. This page updates automatically once a remote is detected."msgstr ""@@ -1176,7 +1176,7 @@ msgstr ""msgid "Attach the file in an email to <0/>"msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/AttachmentsSection.tsxmsgid "Attachments"msgstr ""@@ -1209,7 +1209,7 @@ msgstr ""msgid "Auto-save"msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "Auto-sync is off — your edits stay local until you commit and push manually."msgstr ""@@ -1217,7 +1217,7 @@ msgstr ""msgid "Auto-sync is off for this worktree, inherited from {project}. Change it in Settings → Sync."msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "Auto-sync is on — your commits push and remote changes pull on intervals."msgstr ""@@ -1225,11 +1225,11 @@ msgstr ""msgid "Auto-sync is on for this worktree, inherited from {project}. Change it in Settings → Sync."msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "Auto-sync is paused — sign in to resume."msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "Auto-sync is paused — you don't have permission to push to this repo."msgstr ""@@ -1237,7 +1237,7 @@ msgstr ""msgid "Auto-sync periodically fetches, pulls, and pushes commits to your remote git repository so your edits stay in sync across machines."msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "Auto-sync pushes/pulls commits to your git remote on intervals and on save. Toggling on requires confirmation."msgstr ""@@ -1925,7 +1925,7 @@ msgstr ""msgid "Connect a GitHub account to browse and sync your repositories."msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "Connect an existing repository"msgstr ""@@ -1939,7 +1939,7 @@ msgstr ""msgid "Connect GitHub to continue."msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/IntegrationsSection.tsxmsgid "Connect OpenKnowledge to other tools you use."msgstr ""@@ -1957,7 +1957,7 @@ msgstr ""msgid "Connect to AI tools"msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "Connect to GitHub"msgstr ""@@ -1982,7 +1982,7 @@ msgstr ""msgid "Connected as <0>@{signedInLogin}</0>"msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "Connected to"msgstr ""@@ -2028,7 +2028,7 @@ msgstr ""msgid "Content directory must be inside the project"msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/AttachmentsSection.tsxmsgid "Content root"msgstr ""@@ -2751,7 +2751,7 @@ msgstr ""msgid "default"msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/AttachmentsSection.tsxmsgid "Default location for new attachments"msgstr ""@@ -2959,7 +2959,7 @@ msgstr ""msgid "Disable external link previews"msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "Disable git auto-sync"msgstr ""@@ -3168,7 +3168,7 @@ msgstr ""msgid "Duplicated to \"{0}\""msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/AttachmentsSection.tsxmsgid "e.g. assets/uploads"msgstr ""@@ -3354,7 +3354,7 @@ msgstr ""msgid "Enable external link previews"msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "Enable git auto-sync"msgstr ""@@ -3736,7 +3736,7 @@ msgstr ""msgid "Failed to store the token — try again"msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/AttachmentsSection.tsxmsgid "Failed to update attachment location — {detail}"msgstr ""@@ -3757,7 +3757,7 @@ msgstr ""msgid "Failed to update the embeddings endpoint — {detail}"msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "Failed to update the project sync default — {detail}"msgstr ""@@ -3899,7 +3899,7 @@ msgstr ""msgid "Fix all {count} fixable problems"msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/AttachmentsSection.tsxmsgid "Fixed folder in content root"msgstr ""@@ -3934,7 +3934,7 @@ msgstr ""msgid "folder"msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/AttachmentsSection.tsx#: src/components/share-metadata-rows.tsx#: src/editor/composer-mention/ComposerMentionMenu.tsx#: src/editor/extensions/InternalLinkPropPanel.tsx@@ -4048,7 +4048,7 @@ msgstr ""msgid "Get set up"msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "Git auto-sync"msgstr ""@@ -4315,7 +4315,7 @@ msgstr ""msgid "Horizontal rule that divides sections."msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/HotkeysSection.tsx#: src/components/settings/SettingsDialogShell.tsxmsgid "Hotkeys"msgstr ""@@ -4527,7 +4527,7 @@ msgid "Insert, delete, move, copy, and indent source editor lines through CodeMimsgstr ""#: src/components/InstallInClaudeDesktopDialog.tsx-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/IntegrationsSection.tsx#: src/components/skill-actions.tsx#: src/components/SkillRow.tsxmsgid "Install"@@ -4550,7 +4550,7 @@ msgstr ""msgid "Install handoff failed: {msg}"msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/IntegrationsSection.tsxmsgid "Install in Claude Desktop"msgstr ""@@ -4611,7 +4611,7 @@ msgstr ""msgid "Instruction for the AI"msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/IntegrationsSection.tsx#: src/components/settings/SettingsDialogShell.tsxmsgid "Integrations"msgstr ""@@ -4686,7 +4686,7 @@ msgstr ""msgid "Key ending in {keyHint}"msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/HotkeysSection.tsxmsgid "Keyboard shortcuts available in the editor and workspace."msgstr ""@@ -4956,7 +4956,7 @@ msgstr ""msgid "Lost connection to \"{docName}\"."msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/IntegrationsSection.tsxmsgid "Make this knowledge base available as a Claude Skill."msgstr ""@@ -5666,7 +5666,7 @@ msgstr ""msgid "No workspace"msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "None"msgstr ""@@ -5736,7 +5736,7 @@ msgstr ""msgid "of {totalPages}"msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "Off"msgstr ""@@ -5760,7 +5760,7 @@ msgstr ""msgid "ok ui responded but server.lock has no port yet"msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "On"msgstr ""@@ -5812,7 +5812,7 @@ msgid "Open"msgstr ""#. placeholder {0}: status.remote.label-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsx#: src/components/SyncStatusBadge.tsxmsgid "Open {0} on GitHub (opens in a new tab)"msgstr ""@@ -6372,7 +6372,7 @@ msgstr ""msgid "Pick <0>openknowledge.skill</0> from your <1>Downloads</1> folder. It enables automatically."msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/ThemePluginSection.tsxmsgid "Pick a built-in IDE color palette, or define your own."msgstr ""@@ -6707,7 +6707,7 @@ msgid "Refresh audit"msgstr ""#: src/components/InstallInClaudeDesktopDialog.tsx-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/IntegrationsSection.tsxmsgid "Reinstall"msgstr ""@@ -6988,12 +6988,12 @@ msgstr ""msgid "Reset {0} to default"msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/field-controls.tsxmsgid "Reset {labelText} to default"msgstr ""+#: src/components/settings/field-controls.tsx#: src/components/settings/markdownlint-rule-browser.tsx-#: src/components/settings/SettingsDialogBody.tsxmsgid "Reset to default"msgstr ""@@ -7202,7 +7202,7 @@ msgstr ""msgid "Running project audit"msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/AttachmentsSection.tsxmsgid "Same folder as current file"msgstr ""@@ -7230,8 +7230,8 @@ msgstr ""msgid "Save resolution"msgstr ""+#: src/components/settings/field-controls.tsx#: src/components/settings/OkignoreSection.tsx-#: src/components/settings/SettingsDialogBody.tsxmsgid "Saved"msgstr ""@@ -7257,7 +7257,7 @@ msgstr ""msgid "Scope"msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/HotkeysSection.tsxmsgid "Scope: "msgstr ""@@ -7526,7 +7526,7 @@ msgstr ""msgid "Set identity"msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "Set the auto-sync default for users opening this project for the first time. This setting is committed to your repository."msgstr ""@@ -7534,11 +7534,11 @@ msgstr ""msgid "Set up OpenKnowledge integrations"msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "Set up syncing"msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/AttachmentsSection.tsxmsgid "Set where pasted and dropped files are stored for this project."msgstr ""@@ -7611,11 +7611,11 @@ msgstr ""msgid "Shared"msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "Shared auto-sync default"msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "Shared default"msgstr ""@@ -7791,7 +7791,7 @@ msgid "Shows above the code body. Round-trips as `title=\"...\"` in markdown."msgstr ""#: src/components/settings/AccountSection.tsx-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsx#: src/components/SyncStatusBadge.tsxmsgid "Sign in"msgstr ""@@ -8059,7 +8059,7 @@ msgstr ""msgid "Subfolder name"msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/AttachmentsSection.tsxmsgid "Subfolder under current folder"msgstr ""@@ -8130,8 +8130,8 @@ msgstr ""msgid "Symlink to {targetPath}"msgstr ""-#: src/components/settings/SettingsDialogBody.tsx#: src/components/settings/SettingsDialogShell.tsx+#: src/components/settings/SyncSection.tsxmsgid "Sync"msgstr ""@@ -8139,7 +8139,7 @@ msgstr ""msgid "Sync disabled"msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsx#: src/components/SyncStatusBadge.tsxmsgid "Sync disabled — you don't have permission to push"msgstr ""@@ -8175,7 +8175,7 @@ msgid "Sync paused — you don't have permission to push to this repo"msgstr ""#: src/components/AutoSyncOnboardingDialog.tsx-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsx#: src/hooks/use-enable-sync-with-confirm.tsmsgid "Sync settings not yet loaded — try again in a moment"msgstr ""@@ -8506,8 +8506,8 @@ msgid "Theme"msgstr ""#: src/components/settings/LintingSection.tsx-#: src/components/settings/SettingsDialogBody.tsx#: src/components/settings/SettingsDialogShell.tsx+#: src/components/settings/ThemePluginSection.tsxmsgid "Themes"msgstr ""@@ -8696,7 +8696,7 @@ msgstr ""msgid "This project isn't a git repository, so worktrees aren't available."msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "This project lives only on this computer. Connect it to GitHub to back it up and share it with other people."msgstr ""@@ -9251,7 +9251,7 @@ msgstr ""msgid "We'll build <0>openknowledge.skill</0>, save it to <1>~/Downloads</1>, and open the Claude Desktop App for you."msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsxmsgid "We'll create a repository and start syncing — no terminal needed."msgstr ""@@ -9337,7 +9337,7 @@ msgstr ""msgid "When you hover an external link, its URL is sent to the destination site to fetch the page's preview metadata — one request per previewed link."msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/AttachmentsSection.tsxmsgid "Where newly added attachments are placed."msgstr ""@@ -9521,7 +9521,7 @@ msgstr ""msgid "Your embeddings provider API key, used only to create embeddings of your content for semantic search. Stored once for this machine in <0>~/.ok/secrets.yml</0> (readable only by your user account) and shared across all projects. Turn the feature on per project in This project → Search, where you can also override the endpoint."msgstr ""-#: src/components/settings/SettingsDialogBody.tsx+#: src/components/settings/SyncSection.tsx#: src/components/SyncStatusBadge.tsxmsgid "Your GitHub session expired — sign in again to verify push access."msgstr ""