Skip to content

Fix Sandpack compatibility - #3

Merged
emilio-balda merged 4 commits into
mainfrom
fix/sandpack-compatibility
Sep 2, 2026
Merged

emilio-balda merged 4 commits into
mainfrom
fix/sandpack-compatibility

Conversation

@emilio-balda

Copy link
Copy Markdown
Collaborator

Summary

  • rename the viewer source directory to src
  • add separate Vite and Sandpack entry points
  • load brain Markdown files through Sandpack BrowserFS
  • replace the Markdown renderer with a Sandpack-safe dependency

Checks

  • npm test — 22 tests passed
  • npm run build — passed
  • .venv/bin/python -m pytest — 22 tests passed
  • .venv/bin/python -m okf_tools check brain — passed

Emilio's Codex and others added 4 commits September 2, 2026 11:49
Co-Authored-By: Emilio's Codex <noreply@animaapp.com>
Agent-Id: agent_761b01d97593f92f81195daa
Anima-Actor-Type: agent
Anima-Actor-Id: agent_761b01d97593f92f81195daa
Copilot AI lite review requested due to automatic review settings September 2, 2026 08:52
@emilio-balda
emilio-balda merged commit 4c837ed into main Sep 2, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The Sandpack/Vite split, BrowserFS loading path, and markdown renderer swap are cohesive and are backed by focused new tests for the new bundle/navigation/file-loading behavior.

Pull request overview

This PR updates the React/Vite viewer to run both as a normal Vite app and inside Sandpack, by splitting entry points and switching file-loading/rendering paths to be Sandpack-safe.

Changes:

  • Moved viewer source under src/ and updated Vite/Vitest and index.html to use the new Vite entry (src/vite-main.jsx).
  • Added a Sandpack entry (src/main.jsx) that reads /brain markdown via BrowserFS and builds the bundle at runtime.
  • Replaced the markdown renderer with markdown-to-jsx and introduced/expanded bundle + navigation utilities with accompanying tests.
File summaries
File Description
vite.config.js Updates Vitest include glob to src/**/*.test.js.
src/vite-main.jsx Vite-only entry that renders the pre-bundled brain import.
src/main.jsx Sandpack entry that reads BrowserFS and builds a bundle at runtime.
src/render.jsx Extracts rendering into renderBundle(bundle) for reuse by both entry points.
src/brain-files.js Loads markdown via import.meta.glob(...?raw) for the Vite build path.
src/sandpack-files.js Reads /brain markdown recursively from Sandpack BrowserFS.
src/sandpack-files.test.js Tests BrowserFS-based markdown discovery and error behavior.
src/brain.js Implements bundle building, parsing, link resolution, and graph edge derivation.
src/brain.test.js Tests document parsing, link resolution, graph building, trust/freshness logic.
src/navigation.js Adds folder-tree building and concept filtering for sidebar/search.
src/navigation.test.js Tests folder grouping/sorting and filter behavior.
src/App.jsx Provides the app shell, filtering, theme handling, and lazy-loaded panels.
src/Sidebar.jsx Implements searchable, filterable sidebar UI for concepts/folders.
src/Graph.jsx Implements Cytoscape-based graph visualization and controls.
src/Detail.jsx Switches markdown rendering to markdown-to-jsx with internal link overrides.
src/Detail.test.js Verifies GFM-ish rendering (bold/table) and internal link preservation.
src/theme.js Adds storage/media-safe theme helpers for Sandpack and tests.
src/styles.css Introduces the viewer’s CSS under src/.
index.html Points the Vite entry script to /src/vite-main.jsx.
README.md Updates repository layout docs and clarifies Vite vs Sandpack file loading.
package.json Adds markdown-to-jsx and removes react-markdown/remark-gfm.
package-lock.json Lockfile updates reflecting dependency changes.
Review details
  • Files reviewed: 11/22 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants