const path = require('path'); const { pathToFileURL } = require('url'); const { chromium } = require('playwright'); (async () => { const browser = await chromium.launch({ headless: true }); const page = await browser.newPage({ viewport: { width: 1000, height: 700 } }); await page.goto(pathToFileURL(path.join(process.cwd(), 'index.html')).href, { waitUntil: 'domcontentloaded' }); const required = ['AppShell', 'NavigationSidebar', 'MainContentArea', 'PromptResponseBlock', 'PromptInput', 'AIContentArea']; const names = await page.locator('[data-component-name]').evaluateAll(nodes => nodes.map(n => n.getAttribute('data-component-name'))); for (const name of required) { if (!names.includes(name)) throw new Error(`missing data-component-name ${name}`); } const duplicates = names.filter((name, index) => names.indexOf(name) !== index); if (duplicates.length) throw new Error(`component names should be stable and unique: ${duplicates.join(',')}`); const registry = await page.evaluate(() => window.componentRegistry || window.COMPONENT_REGISTRY || null); if (!registry || typeof registry !== 'object') throw new Error('component registry should be exposed for future component-name conversations'); for (const name of required) { if (!(name in registry)) throw new Error(`component registry missing ${name}`); } await browser.close(); })().catch(err => { console.error(err && err.stack || err); process.exit(1); });