import { readFile, readdir } from 'node:fs/promises'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; import { extractComponentsManifest, summarizeComponentsManifestForPrompt, } from '../packages/contracts/src/design-systems/components-manifest.ts'; const repoRoot = path.resolve(import.meta.dirname, '..'); const designSystemsRoot = path.join(repoRoot, 'design-systems'); const skippedDesignSystemDirectories = new Set(['_schema']); type BrandSources = { id: string; fixturePath: string; tokensCss: string; fixtureHtml: string; }; export async function checkComponentsManifestExtraction(): Promise { const sources = await discoverBrandSources(); const violations: string[] = []; let selectorCount = 0; let groupCount = 0; for (const source of sources) { try { const manifest = extractComponentsManifest({ brandId: source.id, fixtureHtml: source.fixtureHtml, tokensCss: source.tokensCss, }); const summary = summarizeComponentsManifestForPrompt(manifest); selectorCount += manifest.fixture.selectorCount; groupCount += manifest.groups.filter((group) => group.present).length; if (manifest.fixture.styleBlockCount === 0) { violations.push(`[${source.id}] ${toRepositoryPath(source.fixturePath)} has no