DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.
Python ai-agentsai-tutorclawbotcli-tooldeepresearchinteractive-learninglearningmulti-agent-systemsrag
style(web): apply prettier v4.0.0-alpha.8 formatting to code-block theme files
Dryice Liube39000688b4
diff --git a/web/app/(utility)/settings/appearance/page.tsx b/web/app/(utility)/settings/appearance/page.tsxindex 74f39c837..a27300cc5 100644--- a/web/app/(utility)/settings/appearance/page.tsx+++ b/web/app/(utility)/settings/appearance/page.tsx@@ -94,7 +94,10 @@ export default function AppearanceSettingsPage() {window.addEventListener(CODE_BLOCK_SETTINGS_EVENT, onCodeBlockSettings);return () => {window.removeEventListener("storage", onStorage);- window.removeEventListener(CODE_BLOCK_SETTINGS_EVENT, onCodeBlockSettings);+ window.removeEventListener(+ CODE_BLOCK_SETTINGS_EVENT,+ onCodeBlockSettings,+ );};}, []);@@ -195,7 +198,10 @@ export default function AppearanceSettingsPage() {<p className="mb-3 mt-1 text-[12px] leading-relaxed text-[var(--muted-foreground)]">{t("Updates live as you change the settings below.")}</p>- <RichCodeBlockPreview raw={CODE_BLOCK_PREVIEW_SNIPPET} lang="python" />+ <RichCodeBlockPreview+ raw={CODE_BLOCK_PREVIEW_SNIPPET}+ lang="python"+ /></div><SettingRow@@ -207,7 +213,9 @@ export default function AppearanceSettingsPage() {<selectvalue={codeBlockTheme}onChange={(event) =>- void updateCodeBlockTheme(event.target.value as CodeBlockThemeId)+ void updateCodeBlockTheme(+ event.target.value as CodeBlockThemeId,+ )}className={`${selectClass} min-w-[220px] pr-8`}>diff --git a/web/components/common/RichCodeBlock.tsx b/web/components/common/RichCodeBlock.tsxindex 9b6c26d94..438e42e75 100644--- a/web/components/common/RichCodeBlock.tsx+++ b/web/components/common/RichCodeBlock.tsx@@ -40,11 +40,8 @@ export default function RichCodeBlock({lang: string;className?: string;}) {- const {- codeBlockTheme,- codeBlockShowLineNumbers,- codeBlockWrapLongLines,- } = useAppShell();+ const { codeBlockTheme, codeBlockShowLineNumbers, codeBlockWrapLongLines } =+ useAppShell();const normalizedLang = (lang || "").toLowerCase();const isPlain = PLAIN_LANGS.has(normalizedLang);const syntaxTheme = getCodeBlockTheme(codeBlockTheme);diff --git a/web/components/common/code-block-themes.ts b/web/components/common/code-block-themes.tsindex 40dcabb2a..e9b6d3d5d 100644--- a/web/components/common/code-block-themes.ts+++ b/web/components/common/code-block-themes.ts@@ -122,11 +122,19 @@ export const CODE_BLOCK_THEME_OPTIONS: readonly CodeBlockThemeOption[] = [{ id: "a11yDark", label: "A11Y Dark", style: a11yDark },{ id: "a11yOneLight", label: "A11Y One Light", style: a11yOneLight },{ id: "atomDark", label: "Atom Dark", style: atomDark },- { id: "base16AteliersulphurpoolLight", label: "Base16 Atelier Sulphurpool Light", style: base16AteliersulphurpoolLight },+ {+ id: "base16AteliersulphurpoolLight",+ label: "Base16 Atelier Sulphurpool Light",+ style: base16AteliersulphurpoolLight,+ },{ id: "cb", label: "CB", style: cb },{ id: "coldarkCold", label: "Coldark Cold", style: coldarkCold },{ id: "coldarkDark", label: "Coldark Dark", style: coldarkDark },- { id: "coyWithoutShadows", label: "Coy Without Shadows", style: coyWithoutShadows },+ {+ id: "coyWithoutShadows",+ label: "Coy Without Shadows",+ style: coyWithoutShadows,+ },{ id: "coy", label: "Coy", style: coy },{ id: "darcula", label: "Darcula", style: darcula },{ id: "dark", label: "Dark", style: dark },@@ -155,7 +163,11 @@ export const CODE_BLOCK_THEME_OPTIONS: readonly CodeBlockThemeOption[] = [{ id: "pojoaque", label: "Pojoaque", style: pojoaque },{ id: "prism", label: "Prism", style: prism },{ id: "shadesOfPurple", label: "Shades of Purple", style: shadesOfPurple },- { id: "solarizedDarkAtom", label: "Solarized Dark Atom", style: solarizedDarkAtom },+ {+ id: "solarizedDarkAtom",+ label: "Solarized Dark Atom",+ style: solarizedDarkAtom,+ },{ id: "solarizedlight", label: "Solarized Light", style: solarizedlight },{ id: "synthwave84", label: "Synthwave 84", style: synthwave84 },{ id: "tomorrow", label: "Tomorrow", style: tomorrow },@@ -181,7 +193,9 @@ export function getCodeBlockTheme(id: string): PrismTheme {* Returns the background color if available, or undefined if not.* This is used for theme-derived background styling.*/-export function getCodeBlockThemeBackground(style: PrismTheme): string | undefined {+export function getCodeBlockThemeBackground(+ style: PrismTheme,+): string | undefined {const preStyle = style['pre[class*="language-"]'];if (preStyle && typeof preStyle === "object") {const backgroundColor = preStyle.backgroundColor;diff --git a/web/components/settings/SettingsContext.tsx b/web/components/settings/SettingsContext.tsxindex a6105eaf6..5ef2082f8 100644--- a/web/components/settings/SettingsContext.tsx+++ b/web/components/settings/SettingsContext.tsx@@ -33,13 +33,7 @@ import { setTheme as applyThemePreference } from "@/lib/theme";// ─── Domain types ─────────────────────────────────────────────────────────export type ServiceName =- | "llm"- | "embedding"- | "search"- | "tts"- | "stt"- | "imagegen"- | "videogen";+ "llm" | "embedding" | "search" | "tts" | "stt" | "imagegen" | "videogen";export type CatalogModel = {id: string;@@ -192,10 +186,7 @@ export type DiagnosticsResult = {};export type ServiceReadiness =- | "not_configured"- | "untested"- | "passed"- | "failed";+ "not_configured" | "untested" | "passed" | "failed";type SettingsPayload = {ui: UiSettings;@@ -723,32 +714,23 @@ export function SettingsProvider({ children }: { children: ReactNode }) {}, [diagnosticsResults]);// ── UI preferences ──────────────────────────────────────────────────────- const updateTheme = useCallback(- async (next: UiSettings["theme"]) => {- setTheme(next);- applyThemePreference(next);- await persistUiSettingsPatch({ theme: next });- },- [],- );+ const updateTheme = useCallback(async (next: UiSettings["theme"]) => {+ setTheme(next);+ applyThemePreference(next);+ await persistUiSettingsPatch({ theme: next });+ }, []);- const updateLanguage = useCallback(- async (next: UiSettings["language"]) => {- setLanguage(next);- writeStoredLanguage(next);- await persistUiSettingsPatch({ language: next });- },- [],- );+ const updateLanguage = useCallback(async (next: UiSettings["language"]) => {+ setLanguage(next);+ writeStoredLanguage(next);+ await persistUiSettingsPatch({ language: next });+ }, []);- const updateCodeBlockTheme = useCallback(- async (next: CodeBlockThemeId) => {- setCodeBlockTheme(next);- writeStoredCodeBlockTheme(next);- await persistUiSettingsPatch({ code_block_theme: next });- },- [],- );+ const updateCodeBlockTheme = useCallback(async (next: CodeBlockThemeId) => {+ setCodeBlockTheme(next);+ writeStoredCodeBlockTheme(next);+ await persistUiSettingsPatch({ code_block_theme: next });+ }, []);const updateCodeBlockShowLineNumbers = useCallback(async (next: boolean) => {setCodeBlockShowLineNumbers(next);diff --git a/web/context/AppShellContext.tsx b/web/context/AppShellContext.tsxindex 2c2f05726..fda2c06e9 100644--- a/web/context/AppShellContext.tsx+++ b/web/context/AppShellContext.tsx@@ -157,7 +157,9 @@ export function AppShellProvider({ children }: { children: React.ReactNode }) {setCodeBlockThemeState(normalizeCodeBlockTheme(detail.codeBlockTheme));}if (detail?.codeBlockShowLineNumbers !== undefined) {- setCodeBlockShowLineNumbersState(Boolean(detail.codeBlockShowLineNumbers));+ setCodeBlockShowLineNumbersState(+ Boolean(detail.codeBlockShowLineNumbers),+ );}if (detail?.codeBlockWrapLongLines !== undefined) {setCodeBlockWrapLongLinesState(Boolean(detail.codeBlockWrapLongLines));@@ -175,7 +177,10 @@ export function AppShellProvider({ children }: { children: React.ReactNode }) {window.removeEventListener(LANGUAGE_EVENT, onLanguage);window.removeEventListener(ACTIVE_SESSION_EVENT, onActiveSession);window.removeEventListener(SIDEBAR_COLLAPSED_EVENT, onSidebarCollapsed);- window.removeEventListener(CODE_BLOCK_SETTINGS_EVENT, onCodeBlockSettings);+ window.removeEventListener(+ CODE_BLOCK_SETTINGS_EVENT,+ onCodeBlockSettings,+ );};}, []);diff --git a/web/context/app-shell-storage.ts b/web/context/app-shell-storage.tsindex 3f938bae9..44c6b0d5b 100644--- a/web/context/app-shell-storage.ts+++ b/web/context/app-shell-storage.ts@@ -189,7 +189,8 @@ export function normalizeCodeBlockShowLineNumbers(}export function readStoredCodeBlockShowLineNumbers(): boolean {- if (typeof window === "undefined") return DEFAULT_CODE_BLOCK_SHOW_LINE_NUMBERS;+ if (typeof window === "undefined")+ return DEFAULT_CODE_BLOCK_SHOW_LINE_NUMBERS;try {const raw = window.localStorage.getItem(CODE_BLOCK_SHOW_LINE_NUMBERS_STORAGE_KEY,diff --git a/web/tests/app-shell-storage-code-block.test.ts b/web/tests/app-shell-storage-code-block.test.tsindex 3433b58cc..614f4e989 100644--- a/web/tests/app-shell-storage-code-block.test.ts+++ b/web/tests/app-shell-storage-code-block.test.ts@@ -155,4 +155,4 @@ test("app-shell-storage: write dispatches CODE_BLOCK_SETTINGS_EVENT", () => {assert.equal(dispatchedEvents.length, 3);assert.equal(dispatchedEvents[2].type, CODE_BLOCK_SETTINGS_EVENT);assert.equal(dispatchedEvents[2].detail.codeBlockWrapLongLines, false);-});\ No newline at end of file+});diff --git a/web/tests/code-block-themes.test.ts b/web/tests/code-block-themes.test.tsindex 6c1270a1e..cf9cceb6e 100644--- a/web/tests/code-block-themes.test.ts+++ b/web/tests/code-block-themes.test.ts@@ -43,7 +43,9 @@ test("code-block-themes: every option has a non-empty label", () => {});test("code-block-themes: getCodeBlockTheme returns the correct style for valid IDs", () => {- const oneDarkOption = CODE_BLOCK_THEME_OPTIONS.find((opt) => opt.id === "oneDark");+ const oneDarkOption = CODE_BLOCK_THEME_OPTIONS.find(+ (opt) => opt.id === "oneDark",+ );assert.ok(oneDarkOption, "oneDark option should exist");const style = getCodeBlockTheme("oneDark");@@ -58,7 +60,9 @@ test("code-block-themes: getCodeBlockTheme returns the correct style for valid I});test("code-block-themes: getCodeBlockTheme falls back to oneDark for invalid IDs", () => {- const oneDarkStyle = CODE_BLOCK_THEME_OPTIONS.find((opt) => opt.id === "oneDark")?.style;+ const oneDarkStyle = CODE_BLOCK_THEME_OPTIONS.find(+ (opt) => opt.id === "oneDark",+ )?.style;assert.ok(oneDarkStyle, "oneDark style should exist");const invalidStyle = getCodeBlockTheme("non-existent-theme");@@ -72,7 +76,9 @@ test("code-block-themes: getCodeBlockTheme falls back to oneDark for invalid IDs});test("code-block-themes: getCodeBlockThemeBackground extracts background color", () => {- const oneDarkOption = CODE_BLOCK_THEME_OPTIONS.find((opt) => opt.id === "oneDark");+ const oneDarkOption = CODE_BLOCK_THEME_OPTIONS.find(+ (opt) => opt.id === "oneDark",+ );assert.ok(oneDarkOption, "oneDark option should exist");const background = getCodeBlockThemeBackground(oneDarkOption.style);@@ -95,7 +101,11 @@ test("code-block-themes: getCodeBlockThemeBackground handles backgroundColor-onl} as any;const background = getCodeBlockThemeBackground(backgroundColorOnlyStyle);- assert.strictEqual(background, "#fdf6e3", "backgroundColor-only themes should return their backgroundColor");+ assert.strictEqual(+ background,+ "#fdf6e3",+ "backgroundColor-only themes should return their backgroundColor",+ );});test("code-block-themes: getCodeBlockThemeBackground prefers backgroundColor over background", () => {@@ -107,7 +117,11 @@ test("code-block-themes: getCodeBlockThemeBackground prefers backgroundColor ove} as any;const background = getCodeBlockThemeBackground(bothPropertiesStyle);- assert.strictEqual(background, "#fdf6e3", "backgroundColor should take precedence over background");+ assert.strictEqual(+ background,+ "#fdf6e3",+ "backgroundColor should take precedence over background",+ );});test("code-block-themes: all 46 theme IDs are from the installed Prism files", () => {@@ -161,7 +175,11 @@ test("code-block-themes: all 46 theme IDs are from the installed Prism files", (];const actualIds = CODE_BLOCK_THEME_OPTIONS.map((opt) => opt.id).sort();- assert.deepStrictEqual(actualIds, expectedIds.sort(), "Theme IDs should match expected list");+ assert.deepStrictEqual(+ actualIds,+ expectedIds.sort(),+ "Theme IDs should match expected list",+ );});test("code-block-themes: every theme in expected list has a style", () => {diff --git a/web/tests/markdown-renderer-code-fallback.test.ts b/web/tests/markdown-renderer-code-fallback.test.tsindex 9cd647723..2afdd122a 100644--- a/web/tests/markdown-renderer-code-fallback.test.ts+++ b/web/tests/markdown-renderer-code-fallback.test.ts@@ -20,10 +20,7 @@ test("rich-markdown-renderer: non-rich multiline fallback documents settings bou});test("simple-markdown-renderer: compatibility fallback documents settings boundary", () => {- assert.match(- simpleRendererSource,- /compatibility fallback/i,- );+ assert.match(simpleRendererSource, /compatibility fallback/i);assert.match(simpleRendererSource,/does not consume the[\s\S]*code-block theme registry/i,diff --git a/web/tests/rich-code-block.test.ts b/web/tests/rich-code-block.test.tsindex 6ff34c45e..08ba84e78 100644--- a/web/tests/rich-code-block.test.ts+++ b/web/tests/rich-code-block.test.ts@@ -81,12 +81,16 @@ test("rich-code-block: highlighted blocks use selected theme background insteadmockSessionStorage = {};const html = renderCodeBlock("const value = 1;", "js");- const oneLightBackground = getCodeBlockThemeBackground(getCodeBlockTheme("oneLight"));+ const oneLightBackground = getCodeBlockThemeBackground(+ getCodeBlockTheme("oneLight"),+ );assert.ok(oneLightBackground, "oneLight should expose a background color");assert.match(html,- new RegExp(`background(?:-color)?:${oneLightBackground.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`),+ new RegExp(+ `background(?:-color)?:${oneLightBackground.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`,+ ),);assert.doesNotMatch(html, /background:#1f2937/);});diff --git a/web/tests/settings-context-boolean-hydration.test.ts b/web/tests/settings-context-boolean-hydration.test.tsindex 899d924c1..35ba26b5a 100644--- a/web/tests/settings-context-boolean-hydration.test.ts+++ b/web/tests/settings-context-boolean-hydration.test.ts@@ -3,7 +3,12 @@ import assert from "node:assert/strict";import fs from "node:fs";import path from "node:path";-import { readStoredCodeBlockShowLineNumbers, readStoredCodeBlockWrapLongLines, writeStoredCodeBlockShowLineNumbers, writeStoredCodeBlockWrapLongLines } from "@/context/app-shell-storage";+import {+ readStoredCodeBlockShowLineNumbers,+ readStoredCodeBlockWrapLongLines,+ writeStoredCodeBlockShowLineNumbers,+ writeStoredCodeBlockWrapLongLines,+} from "@/context/app-shell-storage";const settingsContextPath = path.join(process.cwd(),@@ -19,7 +24,8 @@ function readSettingsContextSource() {function mockWindow() {global.window = {localStorage: {- getItem: (key: string) => (global.window as any).localStorage._storage[key] ?? null,+ getItem: (key: string) =>+ (global.window as any).localStorage._storage[key] ?? null,setItem: (key: string, value: string) => {(global.window as any).localStorage._storage[key] = value;},@@ -46,12 +52,20 @@ test("readStoredCodeBlockWrapLongLines returns true when localStorage has stringtest("readStoredCodeBlockShowLineNumbers returns false when localStorage is undefined (SSR)", () => {(global.window as any) = undefined as any;- assert.equal(readStoredCodeBlockShowLineNumbers(), false, "Should return default false when window is undefined");+ assert.equal(+ readStoredCodeBlockShowLineNumbers(),+ false,+ "Should return default false when window is undefined",+ );});test("readStoredCodeBlockWrapLongLines returns false when localStorage is undefined (SSR)", () => {(global.window as any) = undefined as any;- assert.equal(readStoredCodeBlockWrapLongLines(), false, "Should return default false when window is undefined");+ assert.equal(+ readStoredCodeBlockWrapLongLines(),+ false,+ "Should return default false when window is undefined",+ );});test("settings-context: code-block boolean switches hydrate after first render", () => {diff --git a/web/tests/settings-context-ui-sync.test.ts b/web/tests/settings-context-ui-sync.test.tsindex 2643184b0..a6d9553a8 100644--- a/web/tests/settings-context-ui-sync.test.ts+++ b/web/tests/settings-context-ui-sync.test.ts@@ -148,9 +148,21 @@ test("settings-context: boolean values survive reload cycle from localStorage",assert.equal(readStoredCodeBlockShowLineNumbers(), true);assert.equal(readStoredCodeBlockWrapLongLines(), true);- assert.equal(readStoredCodeBlockTheme(), "dracula", "Theme should persist across reload");- assert.equal(readStoredCodeBlockShowLineNumbers(), true, "Show line numbers should persist across reload");- assert.equal(readStoredCodeBlockWrapLongLines(), true, "Wrap long lines should persist across reload");+ assert.equal(+ readStoredCodeBlockTheme(),+ "dracula",+ "Theme should persist across reload",+ );+ assert.equal(+ readStoredCodeBlockShowLineNumbers(),+ true,+ "Show line numbers should persist across reload",+ );+ assert.equal(+ readStoredCodeBlockWrapLongLines(),+ true,+ "Wrap long lines should persist across reload",+ );const secondSync = sync({code_block_theme: "dracula",@@ -158,8 +170,16 @@ test("settings-context: boolean values survive reload cycle from localStorage",code_block_wrap_long_lines: true,});- assert.equal(secondSync.code_block_show_line_numbers, true, "Show line numbers should remain true after backend sync");- assert.equal(secondSync.code_block_wrap_long_lines, true, "Wrap long lines should remain true after backend sync");+ assert.equal(+ secondSync.code_block_show_line_numbers,+ true,+ "Show line numbers should remain true after backend sync",+ );+ assert.equal(+ secondSync.code_block_wrap_long_lines,+ true,+ "Wrap long lines should remain true after backend sync",+ );});test("settings-context: syncLoadedCodeBlockSettingsToAppShell handles string boolean representations from backend", () => {@@ -173,10 +193,26 @@ test("settings-context: syncLoadedCodeBlockSettingsToAppShell handles string boocode_block_wrap_long_lines: "true",});- assert.equal(result.code_block_show_line_numbers, true, "String 'True' should be normalized to boolean true");- assert.equal(result.code_block_wrap_long_lines, true, "String 'true' should be normalized to boolean true");- assert.equal(readStoredCodeBlockShowLineNumbers(), true, "Line numbers should be stored as true");- assert.equal(readStoredCodeBlockWrapLongLines(), true, "Wrap long lines should be stored as true");+ assert.equal(+ result.code_block_show_line_numbers,+ true,+ "String 'True' should be normalized to boolean true",+ );+ assert.equal(+ result.code_block_wrap_long_lines,+ true,+ "String 'true' should be normalized to boolean true",+ );+ assert.equal(+ readStoredCodeBlockShowLineNumbers(),+ true,+ "Line numbers should be stored as true",+ );+ assert.equal(+ readStoredCodeBlockWrapLongLines(),+ true,+ "Wrap long lines should be stored as true",+ );});test("settings-context: backend values override localStorage values during sync", () => {@@ -197,14 +233,38 @@ test("settings-context: backend values override localStorage values during sync"});// Verify backend values win- assert.equal(result.code_block_show_line_numbers, true, "Backend true should override localStorage false");- assert.equal(result.code_block_wrap_long_lines, true, "Backend true should override localStorage false");- assert.equal(result.code_block_theme, "dracula", "Backend theme should override localStorage theme");+ assert.equal(+ result.code_block_show_line_numbers,+ true,+ "Backend true should override localStorage false",+ );+ assert.equal(+ result.code_block_wrap_long_lines,+ true,+ "Backend true should override localStorage false",+ );+ assert.equal(+ result.code_block_theme,+ "dracula",+ "Backend theme should override localStorage theme",+ );// Verify localStorage is updated to backend values- assert.equal(readStoredCodeBlockShowLineNumbers(), true, "localStorage should be updated to backend true");- assert.equal(readStoredCodeBlockWrapLongLines(), true, "localStorage should be updated to backend true");- assert.equal(readStoredCodeBlockTheme(), "dracula", "localStorage theme should be updated to backend value");+ assert.equal(+ readStoredCodeBlockShowLineNumbers(),+ true,+ "localStorage should be updated to backend true",+ );+ assert.equal(+ readStoredCodeBlockWrapLongLines(),+ true,+ "localStorage should be updated to backend true",+ );+ assert.equal(+ readStoredCodeBlockTheme(),+ "dracula",+ "localStorage theme should be updated to backend value",+ );// This test would fail if a post-mount effect re-read from localStorage,// as it would overwrite the backend-loaded true values with the old false values.