Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

Remove one-time migration script

LearningCircuit3e47bb8fe28e
diff --git a/scripts/migrate_themes.py b/scripts/migrate_themes.py
deleted file mode 100644
index 0508e5ac3e..0000000000
--- a/scripts/migrate_themes.py
+++ /dev/null
@@ -1,481 +0,0 @@
-#!/usr/bin/env python3
-"""
-Theme Migration Script
-
-Extracts themes from the monolithic themes.css file into individual
-theme files with TOML frontmatter in the new themes module structure.
-
-Run from project root:
- python scripts/migrate_themes.py
-"""
-
-import re
-from pathlib import Path
-
-# Project paths
-PROJECT_ROOT = Path(__file__).parent.parent
-THEMES_CSS = PROJECT_ROOT / "src/local_deep_research/web/static/css/themes.css"
-THEMES_DIR = PROJECT_ROOT / "src/local_deep_research/web/themes"
-
-# Theme metadata from the current theme_helper.py
-THEME_METADATA = {
- # Core themes
- "hashed": {
- "label": "Hashed",
- "icon": "fa-hashtag",
- "group": "core",
- "type": "dark",
- },
- "light": {
- "label": "Light",
- "icon": "fa-sun",
- "group": "core",
- "type": "light",
- },
- "sepia": {
- "label": "Sepia",
- "icon": "fa-book-open",
- "group": "core",
- "type": "light",
- },
- "high-contrast": {
- "label": "High Contrast",
- "icon": "fa-eye",
- "group": "core",
- "type": "dark",
- },
- "midnight": {
- "label": "Midnight",
- "icon": "fa-cloud-moon",
- "group": "core",
- "type": "dark",
- },
- # Nature themes
- "ocean": {
- "label": "Ocean",
- "icon": "fa-water",
- "group": "nature",
- "type": "dark",
- },
- "forest": {
- "label": "Forest",
- "icon": "fa-tree",
- "group": "nature",
- "type": "dark",
- },
- "sunset": {
- "label": "Sunset",
- "icon": "fa-sun",
- "group": "nature",
- "type": "dark",
- },
- "rose": {
- "label": "Rose",
- "icon": "fa-heart",
- "group": "nature",
- "type": "dark",
- },
- "lavender": {
- "label": "Lavender",
- "icon": "fa-spa",
- "group": "nature",
- "type": "dark",
- },
- # Developer themes
- "nord": {
- "label": "Nord",
- "icon": "fa-snowflake",
- "group": "dev",
- "type": "dark",
- },
- "dracula": {
- "label": "Dracula",
- "icon": "fa-ghost",
- "group": "dev",
- "type": "dark",
- },
- "monokai": {
- "label": "Monokai",
- "icon": "fa-code",
- "group": "dev",
- "type": "dark",
- },
- "solarized-dark": {
- "label": "Solarized Dark",
- "icon": "fa-adjust",
- "group": "dev",
- "type": "dark",
- },
- "solarized-light": {
- "label": "Solarized Light",
- "icon": "fa-circle",
- "group": "dev",
- "type": "light",
- },
- "gruvbox-dark": {
- "label": "Gruvbox Dark",
- "icon": "fa-square",
- "group": "dev",
- "type": "dark",
- },
- "gruvbox-light": {
- "label": "Gruvbox Light",
- "icon": "fa-square-full",
- "group": "dev",
- "type": "light",
- },
- "tokyo-night": {
- "label": "Tokyo Night",
- "icon": "fa-city",
- "group": "dev",
- "type": "dark",
- },
- "catppuccin": {
- "label": "Catppuccin",
- "icon": "fa-cat",
- "group": "dev",
- "type": "dark",
- },
- "one-dark": {
- "label": "One Dark",
- "icon": "fa-atom",
- "group": "dev",
- "type": "dark",
- },
- # Research-focused themes
- "flexoki-dark": {
- "label": "Flexoki Dark",
- "icon": "fa-pen-nib",
- "group": "research",
- "type": "dark",
- },
- "flexoki-light": {
- "label": "Flexoki Light",
- "icon": "fa-feather",
- "group": "research",
- "type": "light",
- },
- "rose-pine": {
- "label": "Rosé Pine",
- "icon": "fa-seedling",
- "group": "research",
- "type": "dark",
- },
- "rose-pine-dawn": {
- "label": "Rosé Pine Dawn",
- "icon": "fa-cloud-sun",
- "group": "research",
- "type": "light",
- },
- "everforest-dark": {
- "label": "Everforest Dark",
- "icon": "fa-leaf",
- "group": "research",
- "type": "dark",
- },
- "everforest-light": {
- "label": "Everforest Light",
- "icon": "fa-seedling",
- "group": "research",
- "type": "light",
- },
- "night-owl": {
- "label": "Night Owl",
- "icon": "fa-crow",
- "group": "research",
- "type": "dark",
- },
- "light-owl": {
- "label": "Light Owl",
- "icon": "fa-dove",
- "group": "research",
- "type": "light",
- },
- "ayu-mirage": {
- "label": "Ayu Mirage",
- "icon": "fa-mountain-sun",
- "group": "research",
- "type": "dark",
- },
- "kanagawa": {
- "label": "Kanagawa",
- "icon": "fa-torii-gate",
- "group": "research",
- "type": "dark",
- },
- "palenight": {
- "label": "Palenight",
- "icon": "fa-moon",
- "group": "research",
- "type": "dark",
- },
- "vesper": {
- "label": "Vesper",
- "icon": "fa-fire",
- "group": "research",
- "type": "dark",
- },
-}
-
-# Theme descriptions
-THEME_DESCRIPTIONS = {
- "hashed": "Purple accent on dark background, created by Hashed Viking",
- "light": "Clean and bright for well-lit environments",
- "sepia": "Eye-friendly reading inspired by Solarized",
- "high-contrast": "Maximum accessibility with WCAG AAA compliance",
- "midnight": "Deep blue aesthetic for night coding",
- "ocean": "Deep sea blues and teals",
- "forest": "Natural greens inspired by woodland",
- "sunset": "Warm orange and pink tones",
- "rose": "Soft pink and magenta hues",
- "lavender": "Soft purple hues for a calm feel",
- "nord": "Arctic, north-bluish color palette",
- "dracula": "Purple and pink dark theme",
- "monokai": "Vibrant colors on dark background",
- "solarized-dark": "Ethan Schoonover's precision color scheme (dark)",
- "solarized-light": "Ethan Schoonover's precision color scheme (light)",
- "gruvbox-dark": "Retro groove colors with warm tones (dark)",
- "gruvbox-light": "Retro groove colors with warm tones (light)",
- "tokyo-night": "Neon colors inspired by Tokyo lights",
- "catppuccin": "Soothing pastel theme (Mocha variant)",
- "one-dark": "Atom editor inspired dark theme",
- "flexoki-dark": "Ink-inspired theme for prose and code",
- "flexoki-light": "Paper-inspired warm reading tones",
- "rose-pine": "Warm and soft soho vibes",
- "rose-pine-dawn": "Rosé Pine for daylight",
- "everforest-dark": "Green-based theme for eye protection",
- "everforest-light": "Soft green warmth for daytime",
- "night-owl": "Accessibility-focused for low light",
- "light-owl": "Accessibility-focused for daylight",
- "ayu-mirage": "Modern minimalist twilight aesthetic",
- "kanagawa": "Japanese-inspired, The Great Wave palette",
- "palenight": "Material Design inspired purple tones",
- "vesper": "Warm peppermint and orange accents",
-}
-
-
-def extract_theme_blocks(css_content: str) -> dict[str, str]:
- """Extract individual theme blocks from the CSS content."""
- themes = {}
-
- # Pattern to match theme blocks: [data-theme="name"] { ... }
- # We need to handle nested braces, so we'll use a different approach
- lines = css_content.split("\n")
- current_theme = None
- current_block = []
- brace_depth = 0
- in_theme = False
-
- for line in lines:
- # Check for theme selector start
- theme_match = re.match(
- r'^(?::root,\s*)?\[data-theme="([^"]+)"\]\s*\{', line
- )
- if theme_match and brace_depth == 0:
- current_theme = theme_match.group(1)
- current_block = [line]
- brace_depth = line.count("{") - line.count("}")
- in_theme = True
- continue
-
- if in_theme:
- current_block.append(line)
- brace_depth += line.count("{") - line.count("}")
-
- if brace_depth <= 0:
- # End of theme block
- themes[current_theme] = "\n".join(current_block)
- current_theme = None
- current_block = []
- in_theme = False
- brace_depth = 0
-
- return themes
-
-
-def extract_theme_adjustments(css_content: str) -> dict[str, list[str]]:
- """Extract theme-specific adjustment rules."""
- adjustments = {}
-
- # Find the THEME-SPECIFIC ADJUSTMENTS section
- adjustment_start = css_content.find("/* THEME-SPECIFIC ADJUSTMENTS */")
- if adjustment_start == -1:
- adjustment_start = css_content.find("THEME-SPECIFIC ADJUSTMENTS")
-
- if adjustment_start == -1:
- return adjustments
-
- adjustment_section = css_content[adjustment_start:]
-
- # Find the TRANSITION section to know where adjustments end
- transition_start = adjustment_section.find(
- "/* TRANSITION FOR THEME SWITCHING */"
- )
- if transition_start == -1:
- transition_start = adjustment_section.find(
- "TRANSITION FOR THEME SWITCHING"
- )
-
- if transition_start != -1:
- adjustment_section = adjustment_section[:transition_start]
-
- # Extract rules for each theme
- lines = adjustment_section.split("\n")
- current_rules = []
- current_theme = None
- brace_depth = 0
-
- for line in lines:
- # Check for theme-specific rule
- theme_match = re.match(r'^\[data-theme="([^"]+)"\]', line)
- if theme_match and brace_depth == 0:
- if current_theme and current_rules:
- adjustments.setdefault(current_theme, []).extend(current_rules)
- current_theme = theme_match.group(1)
- current_rules = [line]
- brace_depth = line.count("{") - line.count("}")
- continue
-
- if current_theme:
- current_rules.append(line)
- brace_depth += line.count("{") - line.count("}")
-
- if brace_depth <= 0:
- adjustments.setdefault(current_theme, []).append(
- "\n".join(current_rules)
- )
- current_rules = []
- current_theme = None
- brace_depth = 0
-
- return adjustments
-
-
-def generate_frontmatter(theme_id: str) -> str:
- """Generate TOML frontmatter for a theme."""
- meta = THEME_METADATA.get(
- theme_id,
- {
- "label": theme_id.replace("-", " ").title(),
- "icon": "fa-palette",
- "group": "other",
- "type": "dark",
- },
- )
-
- description = THEME_DESCRIPTIONS.get(theme_id, "")
-
- lines = [
- "/*---",
- f'name = "{meta["label"]}"',
- f'label = "{meta["label"]}"',
- f'icon = "{meta["icon"]}"',
- f'group = "{meta["group"]}"',
- f'type = "{meta.get("type", "dark")}"',
- ]
-
- if description:
- lines.append(f'description = "{description}"')
-
- lines.append("---*/")
- lines.append("")
-
- return "\n".join(lines)
-
-
-def clean_theme_block(block: str, theme_id: str) -> str:
- """Clean up a theme block for the individual file."""
- # Remove any leading comments that are theme-specific
- lines = block.split("\n")
- result = []
-
- for line in lines:
- # Skip single-line comments before the selector
- if (
- line.strip().startswith("/*")
- and line.strip().endswith("*/")
- and not result
- ):
- continue
- result.append(line)
-
- return "\n".join(result)
-
-
-def write_theme_file(
- theme_id: str, css_block: str, adjustments: list[str] | None = None
-):
- """Write a theme to its individual file."""
- meta = THEME_METADATA.get(theme_id, {"group": "other"})
- group = meta.get("group", "other")
-
- # Determine output directory
- output_dir = THEMES_DIR / group
- output_dir.mkdir(parents=True, exist_ok=True)
-
- # Generate content
- frontmatter = generate_frontmatter(theme_id)
- css_content = clean_theme_block(css_block, theme_id)
-
- # Add adjustments if any
- if adjustments:
- css_content += "\n\n/* Theme-specific adjustments */\n"
- css_content += "\n".join(adjustments)
-
- full_content = frontmatter + css_content + "\n"
-
- # Write file
- output_file = output_dir / f"{theme_id}.css"
- output_file.write_text(full_content, encoding="utf-8")
- print(f" Created: {output_file.relative_to(PROJECT_ROOT)}")
-
-
-def main():
- """Main migration function."""
- print("Theme Migration Script")
- print("=" * 50)
-
- # Check source file exists
- if not THEMES_CSS.exists():
- print(f"Error: Source file not found: {THEMES_CSS}")
- return 1
-
- # Read source CSS
- print(f"\nReading: {THEMES_CSS.relative_to(PROJECT_ROOT)}")
- css_content = THEMES_CSS.read_text(encoding="utf-8")
-
- # Extract theme blocks
- print("\nExtracting theme blocks...")
- theme_blocks = extract_theme_blocks(css_content)
- print(f" Found {len(theme_blocks)} themes")
-
- # Extract adjustments
- print("\nExtracting theme-specific adjustments...")
- adjustments = extract_theme_adjustments(css_content)
- print(f" Found adjustments for {len(adjustments)} themes")
-
- # Create output directories
- print("\nCreating theme files...")
- for subdir in ["core", "nature", "dev", "research"]:
- (THEMES_DIR / subdir).mkdir(parents=True, exist_ok=True)
-
- # Write individual theme files
- for theme_id, css_block in sorted(theme_blocks.items()):
- theme_adjustments = adjustments.get(theme_id)
- write_theme_file(theme_id, css_block, theme_adjustments)
-
- # Summary
- print("\n" + "=" * 50)
- print(f"Migration complete! Created {len(theme_blocks)} theme files.")
- print(f"\nTheme files are in: {THEMES_DIR.relative_to(PROJECT_ROOT)}")
- print("\nNext steps:")
- print(" 1. Review generated files")
- print(" 2. Update theme_helper.py to use new ThemeRegistry")
- print(" 3. Update app_factory.py to generate combined CSS")
- print(" 4. Run tests to verify functionality")
-
- return 0
-
-
-if __name__ == "__main__":
- exit(main())