fix(mcp): use local sqlite scene storage

This commit is contained in:
Aymeric Rabot
2026-04-24 13:32:04 -07:00
parent 06d00566f0
commit b3d1f663f6
119 changed files with 1086 additions and 23694 deletions
+7 -19
View File
@@ -1,29 +1,17 @@
import type { SceneStore } from './types'
export * from './slug'
export * from './sqlite-scene-store'
export * from './types'
/**
* Factory that picks the correct `SceneStore` backend based on env:
* - If `SUPABASE_URL` and `SUPABASE_SERVICE_ROLE_KEY` are both set → Supabase.
* - Otherwise → filesystem.
* Factory for Pascal's local-first scene store.
*
* Implementations are loaded via dynamic `import()` so consumers only pay the
* cost of the backend they actually use.
* The store is backed by the runtime's built-in SQLite driver. By default it
* writes to `~/.pascal/data/pascal.db`; set `PASCAL_DB_PATH` for an exact file
* path or `PASCAL_DATA_DIR` for a directory containing `pascal.db`.
*/
export async function createSceneStore(env?: NodeJS.ProcessEnv): Promise<SceneStore> {
const resolved = env ?? (typeof process !== 'undefined' ? process.env : undefined)
const supabaseUrl = resolved?.SUPABASE_URL
const supabaseKey = resolved?.SUPABASE_SERVICE_ROLE_KEY
if (supabaseUrl && supabaseKey) {
const mod = await import('./supabase-scene-store')
return new mod.SupabaseSceneStore({
url: supabaseUrl,
serviceRoleKey: supabaseKey,
})
}
const mod = await import('./filesystem-scene-store')
return new mod.FilesystemSceneStore()
const mod = await import('./sqlite-scene-store')
return new mod.SqliteSceneStore({ env })
}