feat(editor): expose useScene on window in dev for MCP-editor bridging

Adds window.__pascalScene = useScene in development builds so that a
running MCP process (which has its own Node-side in-memory store) can
inject a built scene into the browser editor for visual verification:

  fetch('/dev/casa-sol.json')
    .then(r => r.json())
    .then(s => window.__pascalScene.getState().setScene(s.nodes, s.rootNodeIds))

Also ships /public/dev/casa-sol.json as a reference scene — the
artefact exported from the MCP Casa del Sol test build.

Gated behind NODE_ENV !== 'production' so nothing leaks to prod.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Adrian Perez
2026-04-18 18:38:07 +02:00
co-authored by Claude Opus 4.7
parent a2e287144b
commit bdb47a6e5d
2 changed files with 1312 additions and 0 deletions
+7
View File
@@ -6,6 +6,13 @@ import {
ViewerToolbarLeft,
ViewerToolbarRight,
} from '@pascal-app/editor'
import { useScene } from '@pascal-app/core'
// Dev-only: expose the scene store on window so MCP can inject a built
// scene into the running editor for visual verification. No-op in prod.
if (typeof window !== 'undefined' && process.env.NODE_ENV !== 'production') {
;(window as unknown as { __pascalScene?: typeof useScene }).__pascalScene = useScene
}
const SIDEBAR_TABS: (SidebarTab & { component: React.ComponentType })[] = [
{
File diff suppressed because it is too large Load Diff