Vyasa Extension Refactor Audit and Execution Plan

File-Level Audit And Target OwnershipURL copied

vyasa/static/scripts.jsURL copied

Current:

  • 6310 lines.
  • Contains Tasks, Mermaid, D2, Cytograph, tabs, theme switching, sidebar, search, bookmarks, annotations, PDF focus, iframe fullscreen, JSON focus, headings, code copy, KaTeX, Highlight.js, HTMX swap handlers, mobile menus.

Target:

  • Keep only core shell bootstrap if needed.
  • Split per extension:
    • tasks/static/tasks.js
    • mermaid/static/mermaid.js
    • d2/static/d2.js
    • cytograph/static/cytograph.js
    • tabs/static/tabs.js
    • themes/static/theme-debug.js
    • default_layout/static/layout.js
    • default_search/static/search.js
    • bookmarks/static/bookmarks.js
    • annotations/static/annotations.js
    • documents/static/documents.js
    • pdf_document/static/pdf.js
    • iframe_embed/static/iframe.js
    • math/static/math.js
    • code_highlight/static/code-highlight.js

Action:

  • Cut sections with awk by function names and top-level sentinels.
  • Keep global event orchestration small:
    • vyasa:init
    • vyasa:after-swap
    • vyasa:theme-change
  • Extensions listen to these events in their own JS.