import assert from "node:assert/strict"; import { readFileSync } from "node:fs"; import { dirname, resolve } from "node:path"; import { fileURLToPath } from "node:url"; const desktopRoot = process.env.FAMILIAROS_DESKTOP_ROOT ?? resolve(dirname(fileURLToPath(import.meta.url)), ".."); const pluginSdkBridgeSource = readFileSync(resolve(desktopRoot, "src/plugin-sdk-bridge.ts"), "utf8"); const pluginSdkApiBuilderSource = readFileSync(resolve(desktopRoot, "src/plugin-sdk-api-builder.ts"), "utf8"); const pluginSdkApiBuilderPlatformSource = readFileSync(resolve(desktopRoot, "src/plugin-sdk-api-builder-platform.ts"), "utf8"); const pluginSdkFamiliarSurfaceSource = readFileSync(resolve(desktopRoot, "src/plugin-sdk-familiar-surface.ts"), "utf8"); assert.match(pluginSdkBridgeSource, /from "\.\/plugin-sdk-api-builder(?:\.js)?"/, "Plugin SDK bridge must import the extracted API builder seam."); assert.match(pluginSdkApiBuilderSource, /export function createPluginSdkApi/, "Plugin SDK API builder seam must export the bridge API builder."); assert.match(pluginSdkApiBuilderSource, /export const pluginEventNames/, "Plugin SDK API builder seam must export the plugin event names surface."); assert.match(pluginSdkApiBuilderSource, /from "\.\/plugin-sdk-api-builder-platform(?:\.js)?"/, "Plugin SDK API builder seam must compose the extracted platform builder."); assert.match(pluginSdkApiBuilderPlatformSource, /export function createPluginSdkPlatformApis/, "Plugin SDK platform seam must export the platform namespace builder."); assert.match(pluginSdkApiBuilderSource, /createPluginFamiliarSurface/, "Plugin SDK API builder seam must compose the extracted familiar surface helper."); assert.match(pluginSdkFamiliarSurfaceSource, /export function createPluginFamiliarSurface/, "Plugin SDK familiar surface seam must export the familiar/schedule surface helper."); assert.match(pluginSdkApiBuilderSource, /createPluginUiApi/, "Plugin SDK API builder seam must compose the extracted UI surface helper."); assert.match(pluginSdkApiBuilderSource, /createPluginStorageApi/, "Plugin SDK API builder seam must compose the extracted storage surface helper."); assert.match(pluginSdkApiBuilderSource, /createPluginBusApi/, "Plugin SDK API builder seam must compose the extracted bus surface helper."); console.error("Plugin SDK API builder validation passed.");