design-system-enforcer 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/cli.ts","../src/config/loader.ts","../src/config/presets/berserk.ts","../src/config/presets/default.ts","../src/config/presets/python.ts","../src/detector/index.ts","../src/detector/ignores.ts","../src/rules/runner.ts","../src/parser/ast.ts","../src/rules/ast-rules.ts","../src/tokens/index.ts","../src/rules/regex-rules.ts","../src/rules/python-rules.ts","../src/formatters/stylish.ts","../src/formatters/json.ts","../src/scaffold/index.ts","../src/scaffold/templates/tokens.ts","../src/scaffold/templates/css.ts","../src/scaffold/templates/components.ts","../src/export-rules/index.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { Command } from \"commander\";\nimport pc from \"picocolors\";\nimport { loadConfig } from \"./config/loader.js\";\nimport { runDseScan } from \"./rules/runner.js\";\nimport { formatStylish } from \"./formatters/stylish.js\";\nimport { formatJson } from \"./formatters/json.js\";\nimport {\n scaffoldConfig,\n scaffoldTokens,\n scaffoldComponent,\n scaffoldAllPrimitives,\n COMPONENT_TEMPLATES,\n} from \"./scaffold/index.js\";\nimport { generateMarkdownRules } from \"./export-rules/index.js\";\nimport { detectProject } from \"./detector/index.js\";\n\n\nconst program = new Command();\n\nprogram\n .name(\"dse\")\n .description(\"Design System Enforcer (DSE) - AST-based Linter and Scaffold Engine\")\n .version(\"1.0.0\");\n\n// ---------------------------------------------------------------------------\n// COMMAND: check (default)\n// ---------------------------------------------------------------------------\nprogram\n .command(\"check [targetDir]\", { isDefault: true })\n .description(\"Scan codebase and enforce Design System rules\")\n .option(\"-c, --config <path>\", \"Path to custom dse.config.js / dse.config.json\")\n .option(\"-f, --format <format>\", \"Output format: 'stylish' | 'json'\", \"stylish\")\n .option(\"--strict\", \"Treat warnings as errors\", false)\n .action(async (targetDirArg, options) => {\n try {\n const cwd = targetDirArg ? path.resolve(process.cwd(), targetDirArg) : process.cwd();\n const config = await loadConfig(cwd, options.config);\n const result = await runDseScan(config, cwd);\n\n if (options.format === \"json\") {\n console.log(formatJson(result));\n } else {\n console.log(formatStylish(result));\n }\n\n const totalErrors = options.strict\n ? result.errorCount + result.warningCount\n : result.errorCount;\n\n if (totalErrors > 0) {\n process.exit(1);\n }\n } catch (err) {\n console.error(pc.red(\"Error running DSE scan:\"), err);\n process.exit(1);\n }\n });\n\n// ---------------------------------------------------------------------------\n// COMMAND: init\n// ---------------------------------------------------------------------------\nprogram\n .command(\"init\")\n .description(\"Initialize DSE configuration and optionally scaffold base primitives\")\n .option(\"--preset <name>\", \"Preset to use: 'berserk' | 'recommended' | 'python'\")\n .option(\"--with-primitives\", \"Scaffold full base primitives and tokens suite\", false)\n .action((options) => {\n const cwd = process.cwd();\n console.log(pc.bold(pc.cyan(\"\\nInitializing Design System Enforcer (DSE)...\")));\n\n const isPythonProject =\n fs.existsSync(path.resolve(cwd, \"requirements.txt\")) ||\n fs.existsSync(path.resolve(cwd, \"pyproject.toml\")) ||\n fs.existsSync(path.resolve(cwd, \".streamlit\"));\n\n const preset = options.preset || (isPythonProject ? \"python\" : \"berserk\");\n\n // 1. Create config\n const configPath = scaffoldConfig(cwd, preset);\n console.log(pc.green(\"✔ Created config:\"), pc.bold(path.relative(cwd, configPath)), pc.dim(`(preset: ${preset})`));\n\n // 2. Add \"dse\": \"dse\" to package.json if present\n const pkgPath = path.resolve(cwd, \"package.json\");\n if (fs.existsSync(pkgPath)) {\n try {\n const pkg = JSON.parse(fs.readFileSync(pkgPath, \"utf-8\"));\n pkg.scripts = pkg.scripts || {};\n if (!pkg.scripts.dse) {\n pkg.scripts.dse = \"dse\";\n fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + \"\\n\", \"utf-8\");\n console.log(pc.green(\"✔ Added script 'dse' to package.json\"));\n }\n } catch (err) {\n console.warn(pc.yellow(\"⚠ Could not update package.json:\"), err);\n }\n }\n\n // 3. Optionally scaffold primitives\n if (options.withPrimitives) {\n console.log(pc.cyan(\"Scaffolding primitives and theme tokens...\"));\n const created = scaffoldAllPrimitives(cwd);\n created.forEach((file) => {\n console.log(pc.green(\"✔ Created:\"), pc.dim(path.relative(cwd, file)));\n });\n } else {\n console.log(\n pc.dim(\"\\nTip: Run 'npx dse scaffold' to generate rule-compliant base primitives and tokens anytime.\")\n );\n }\n\n console.log(pc.bold(pc.green(\"\\n✔ DSE setup complete! Run 'npm run dse' to verify your project.\\n\")));\n });\n\n// ---------------------------------------------------------------------------\n// COMMAND: add <components...>\n// ---------------------------------------------------------------------------\nprogram\n .command(\"add <components...>\")\n .description(\"Scaffold specific rule-compliant design system primitives (button, chip, input, table, tabs, card, checkbox, dropdown, skeleton)\")\n .action((components: string[]) => {\n const cwd = process.cwd();\n console.log(pc.bold(pc.cyan(\"\\nScaffolding requested components...\")));\n\n for (const comp of components) {\n const filePath = scaffoldComponent(comp, cwd);\n if (filePath) {\n console.log(pc.green(\"✔ Created:\"), pc.bold(path.relative(cwd, filePath)));\n } else {\n console.log(\n pc.yellow(`⚠ Unknown component '${comp}'. Available: ${Object.keys(COMPONENT_TEMPLATES).join(\", \")}`)\n );\n }\n }\n console.log(\"\");\n });\n\n// ---------------------------------------------------------------------------\n// COMMAND: scaffold\n// ---------------------------------------------------------------------------\nprogram\n .command(\"scaffold\")\n .description(\"Scaffold all base primitives and HSL tokens into src/components/ui/ and src/lib/\")\n .action(() => {\n const cwd = process.cwd();\n console.log(pc.bold(pc.cyan(\"\\nScaffolding full design system suite...\")));\n const created = scaffoldAllPrimitives(cwd);\n created.forEach((file) => {\n console.log(pc.green(\"✔ Created:\"), pc.bold(path.relative(cwd, file)));\n });\n console.log(pc.bold(pc.green(\"\\n✔ All design system primitives scaffolded successfully!\\n\")));\n });\n\n// ---------------------------------------------------------------------------\n// COMMAND: export-rules\n// ---------------------------------------------------------------------------\nprogram\n .command(\"export-rules\")\n .description(\"Export rules in Markdown format for AI coding assistants (AGENTS.md, .cursorrules, CLAUDE.md)\")\n .option(\"-w, --write <file>\", \"Write directly to target file (e.g. AGENTS.md)\")\n .action(async (options) => {\n const cwd = process.cwd();\n const config = await loadConfig(cwd);\n const rulesMd = generateMarkdownRules(config);\n\n if (options.write) {\n const targetFile = path.resolve(cwd, options.write);\n if (fs.existsSync(targetFile)) {\n let existing = fs.readFileSync(targetFile, \"utf-8\");\n const startTag = \"<!-- BEGIN:design-system-enforcer-rules -->\";\n const endTag = \"<!-- END:design-system-enforcer-rules -->\";\n\n if (existing.includes(startTag) && existing.includes(endTag)) {\n const regex = new RegExp(`${startTag}[\\\\s\\\\S]*?${endTag}`, \"g\");\n existing = existing.replace(regex, rulesMd.trim());\n } else {\n existing = `${existing.trim()}\\n\\n${rulesMd.trim()}\\n`;\n }\n fs.writeFileSync(targetFile, existing, \"utf-8\");\n console.log(pc.green(`✔ Updated rules in ${options.write}`));\n } else {\n fs.writeFileSync(targetFile, rulesMd, \"utf-8\");\n console.log(pc.green(`✔ Created ${options.write} with design system rules`));\n }\n } else {\n console.log(rulesMd);\n }\n });\n\n// ---------------------------------------------------------------------------\n// COMMAND: detect (autonomous diagnostics)\n// ---------------------------------------------------------------------------\nprogram\n .command(\"detect [targetDir]\")\n .description(\"Inspect project architecture, framework, libraries, and design tokens autonomously\")\n .action((targetDirArg) => {\n const cwd = targetDirArg ? path.resolve(process.cwd(), targetDirArg) : process.cwd();\n const info = detectProject(cwd);\n\n console.log(pc.bold(pc.cyan(\"\\n🔍 DSE Autonomous Project Diagnostics\\n\")));\n console.log(` ${pc.bold(\"Target Directory:\")} ${info.root}`);\n console.log(` ${pc.bold(\"Framework:\")} ${pc.green(info.framework)}`);\n console.log(` ${pc.bold(\"Monorepo:\")} ${info.isMonorepo ? pc.yellow(\"Yes\") : \"No\"}`);\n if (info.isMonorepo && info.monorepoWorkspaces.length > 0) {\n console.log(` ${pc.bold(\"Workspaces:\")} ${info.monorepoWorkspaces.join(\", \")}`);\n }\n console.log(` ${pc.bold(\"Libraries:\")} ${info.libraries.length ? pc.magenta(info.libraries.join(\", \")) : \"None\"}`);\n console.log(` ${pc.bold(\"Tailwind CSS:\")} ${info.hasTailwind ? pc.green(info.tailwindVersion || \"Yes\") : \"No\"}`);\n console.log(` ${pc.bold(\"TypeScript:\")} ${info.hasTypeScript ? \"Yes\" : \"No\"}`);\n console.log(` ${pc.bold(\"Tokens File:\")} ${info.tokensFile ? pc.cyan(info.tokensFile) : pc.dim(\"None (using preset defaults)\")}`);\n console.log(` ${pc.bold(\"Default Preset:\")} ${pc.yellow(info.preset)}`);\n console.log(` ${pc.bold(\"Auto Includes:\")} ${info.suggestedIncludes.join(\", \")}`);\n console.log(` ${pc.bold(\"Auto Ignores:\")} ${info.suggestedIgnores.slice(0, 5).join(\", \")} (+${Math.max(0, info.suggestedIgnores.length - 5)} more)`);\n console.log(\"\");\n });\n\nprogram.parse(process.argv);\n\n\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport type { DseConfig } from \"./types.js\";\nimport { berserkPreset } from \"./presets/berserk.js\";\nimport { defaultPreset } from \"./presets/default.js\";\nimport { pythonPreset } from \"./presets/python.js\";\nimport { detectProject } from \"../detector/index.js\";\n\nconst CONFIG_FILES = [\n \"dse.config.js\",\n \"dse.config.mjs\",\n \"dse.config.cjs\",\n \"dse.config.ts\",\n \"dse.config.json\",\n \".dserc.json\",\n \".dserc\",\n];\n\nexport function defineConfig(config: DseConfig): DseConfig {\n return config;\n}\n\nexport async function loadConfig(cwd = process.cwd(), customPath?: string): Promise<DseConfig> {\n const detected = detectProject(cwd);\n let userConfig: Partial<DseConfig> = {};\n let foundConfigPath: string | null = null;\n\n\n if (customPath) {\n const resolved = path.resolve(cwd, customPath);\n if (fs.existsSync(resolved)) {\n foundConfigPath = resolved;\n }\n } else {\n for (const filename of CONFIG_FILES) {\n const candidate = path.resolve(cwd, filename);\n if (fs.existsSync(candidate)) {\n foundConfigPath = candidate;\n break;\n }\n }\n }\n\n if (foundConfigPath) {\n if (foundConfigPath.endsWith(\".json\") || foundConfigPath.endsWith(\".dserc\")) {\n const content = fs.readFileSync(foundConfigPath, \"utf-8\");\n try {\n userConfig = JSON.parse(content);\n } catch (err) {\n console.error(`Failed to parse JSON config at ${foundConfigPath}:`, err);\n }\n } else {\n try {\n const fileUrl = pathToFileURL(foundConfigPath).href;\n const mod = await import(fileUrl);\n userConfig = mod.default || mod;\n } catch {\n // Fallback for CommonJS/eval if import fails\n try {\n const content = fs.readFileSync(foundConfigPath, \"utf-8\");\n // Handle standard module.exports or export default\n const cjsReq = createCjsEvaluator(foundConfigPath, content);\n userConfig = cjsReq;\n } catch (innerErr) {\n console.warn(`Could not load config file at ${foundConfigPath}, using default preset.`, innerErr);\n }\n }\n }\n }\n\n // Determine base preset (auto-detect python if requirements.txt / pyproject.toml present)\n let presetName = userConfig.preset || detected.preset;\n\n let basePreset = berserkPreset;\n if (presetName === \"python\") {\n basePreset = pythonPreset;\n } else if (presetName === \"recommended\") {\n basePreset = defaultPreset;\n }\n\n // Merge detected autonomous defaults (include globs, smart ignores)\n const autonomousDefaults: Partial<DseConfig> = {\n include: detected.suggestedIncludes,\n exclude: detected.suggestedIgnores,\n };\n\n const withAutonomous = mergeConfigs(basePreset, autonomousDefaults);\n return mergeConfigs(withAutonomous, userConfig);\n}\n\nfunction createCjsEvaluator(filePath: string, content: string): any {\n // If it's a simple export default or module.exports\n if (content.includes(\"export default\")) {\n // Basic extraction or leave as empty\n return {};\n }\n return {};\n}\n\nfunction mergeConfigs(base: DseConfig, overrides: Partial<DseConfig>): DseConfig {\n return {\n ...base,\n ...overrides,\n preset: overrides.preset || base.preset,\n targetDir: overrides.targetDir || base.targetDir,\n include: overrides.include || base.include,\n exclude: [...(base.exclude || []), ...(overrides.exclude || [])],\n tokens: {\n typography: {\n ...(base.tokens?.typography || {}),\n ...(overrides.tokens?.typography || {}),\n },\n geometry: {\n ...(base.tokens?.geometry || {}),\n ...(overrides.tokens?.geometry || {}),\n radiiExceptions: {\n ...(base.tokens?.geometry?.radiiExceptions || {}),\n ...(overrides.tokens?.geometry?.radiiExceptions || {}),\n },\n },\n colors: {\n ...(base.tokens?.colors || {}),\n ...(overrides.tokens?.colors || {}),\n },\n },\n components: {\n disallowRawHtml: {\n ...(base.components?.disallowRawHtml || {}),\n ...(overrides.components?.disallowRawHtml || {}),\n },\n disallowPseudoChips: overrides.components?.disallowPseudoChips ?? base.components?.disallowPseudoChips,\n requiredInventory: overrides.components?.requiredInventory || base.components?.requiredInventory,\n },\n rules: {\n ...(base.rules || {}),\n ...(overrides.rules || {}),\n },\n };\n}\n\n","import type { DseConfig } from \"../types.js\";\n\nexport const berserkPreset: DseConfig = {\n preset: \"berserk\",\n targetDir: \"src\",\n include: [\"**/*.{tsx,jsx,ts,js}\"],\n exclude: [\n \"**/node_modules/**\",\n \"**/.next/**\",\n \"**/public/**\",\n \"**/.git/**\",\n \"**/dist/**\",\n \"src/lib/primitives.ts\",\n \"src/lib/tokens.ts\",\n \"src/lib/dse-scanner.ts\",\n \"src/app/globals.css\",\n \"src/components/ui/badge.tsx\",\n \"src/components/ui/button.tsx\",\n \"src/components/ui/buttony-icon.tsx\",\n \"src/components/ui/card.tsx\",\n \"src/components/ui/checkbox.tsx\",\n \"src/components/ui/chip.tsx\",\n \"src/components/ui/dropdown.tsx\",\n \"src/components/ui/floating-action-bar.tsx\",\n \"src/components/ui/folder-combobox.tsx\",\n \"src/components/ui/icon-button.tsx\",\n \"src/components/ui/input.tsx\",\n \"src/components/ui/portal.tsx\",\n \"src/components/ui/skeleton.tsx\",\n \"src/components/ui/spinner.tsx\",\n \"src/components/ui/table.tsx\",\n \"src/components/ui/tabs.tsx\",\n \"src/components/ui/textarea.tsx\",\n \"src/components/ui/toggle.tsx\",\n \"src/components/ui/tooltip.tsx\",\n \"src/components/design-system/**\",\n \"src/db/**\",\n \"src/app/api/**\",\n \"src/engine/**\",\n \"src/services/**\",\n \"src/lib/auth/two-factor.ts\",\n ],\n tokens: {\n typography: {\n minFontSize: \"14px\",\n maxFontSize: \"32px\",\n maxFontWeight: 500,\n disallowArbitrarySizes: true,\n disallowUppercase: true,\n allowXsOn: [],\n },\n geometry: {\n maxControlHeight: 36,\n allowedRadii: [\"0\", \"0px\", \"8px\", \"12px\", \"16px\", \"9999px\", \"100%\"],\n radiiExceptions: {\n Checkbox: [\"0\", \"0px\", \"4px\", \"0.25rem\", \"8px\", \"12px\", \"16px\", \"9999px\", \"100%\"],\n },\n },\n colors: {\n bannedColorFamilies: [\n \"slate\", \"gray\", \"zinc\", \"stone\",\n \"orange\", \"yellow\", \"lime\", \"green\",\n \"teal\", \"cyan\", \"sky\", \"indigo\",\n \"violet\", \"purple\", \"fuchsia\", \"pink\", \"rose\"\n ],\n disallowRawHex: true,\n disallowButtonChipColors: true,\n disallowSaturatedGradients: true,\n },\n },\n components: {\n disallowRawHtml: {\n button: { replaceWith: \"Button\", importFrom: \"@/components/ui/button\", checkRawElement: true },\n select: { replaceWith: \"Dropdown\", importFrom: \"@/components/ui/dropdown\", checkRawElement: true },\n textarea: { replaceWith: \"Textarea\", importFrom: \"@/components/ui/textarea\", checkRawElement: true },\n progress: { replaceWith: \"ProgressBar\", importFrom: \"@/components/ui/progress\", checkRawElement: true },\n dialog: { replaceWith: \"Modal or Dialog\", importFrom: \"@/components/ui/modal\", checkRawElement: true },\n table: { replaceWith: \"Table\", importFrom: \"@/components/ui/table\", checkRawElement: true },\n thead: { replaceWith: \"TableHeader\", importFrom: \"@/components/ui/table\", checkRawElement: true },\n tbody: { replaceWith: \"TableBody\", importFrom: \"@/components/ui/table\", checkRawElement: true },\n tr: { replaceWith: \"TableRow\", importFrom: \"@/components/ui/table\", checkRawElement: true },\n th: { replaceWith: \"TableHead\", importFrom: \"@/components/ui/table\", checkRawElement: true },\n td: { replaceWith: \"TableCell\", importFrom: \"@/components/ui/table\", checkRawElement: true },\n },\n disallowPseudoChips: true,\n requiredInventory: [\n { name: \"Button\", componentName: \"Button\", importPath: \"@/components/ui/button\" },\n { name: \"Input\", componentName: \"Input\", importPath: \"@/components/ui/input\" },\n { name: \"Chip\", altNames: [\"Chip\", \"Badge\"], componentName: \"Chip\", importPath: \"@/components/ui/chip\" },\n { name: \"Card\", componentName: \"Card\", importPath: \"@/components/ui/card\" },\n { name: \"Dropdown\", componentName: \"Dropdown\", importPath: \"@/components/ui/dropdown\" },\n { name: \"FloatingActionBar\", componentName: \"FloatingActionBar\", importPath: \"@/components/ui/floating-action-bar\" },\n { name: \"FolderCombobox\", componentName: \"FolderCombobox\", importPath: \"@/components/ui/folder-combobox\" },\n { name: \"IconButton\", altNames: [\"ButtonyIcon\", \"IconButton\"], componentName: \"IconButton\", importPath: \"@/components/ui/icon-button\" },\n { name: \"Skeleton\", altNames: [\"Skeleton\", \"CardSkeleton\", \"TableSkeleton\", \"MetricsGridSkeleton\"], componentName: \"Skeleton\", importPath: \"@/components/ui/skeleton\" },\n { name: \"Table\", altNames: [\"Table\", \"DataTableContainer\", \"DataTableScrollArea\", \"TableHeader\", \"TableBody\", \"TableRow\", \"TableCell\", \"TableHead\"], componentName: \"Table\", importPath: \"@/components/ui/table\" },\n { name: \"Tabs\", altNames: [\"Tabs\"], componentName: \"Tabs\", importPath: \"@/components/ui/tabs\" },\n { name: \"Checkbox\", altNames: [\"Checkbox\"], componentName: \"Checkbox\", importPath: \"@/components/ui/checkbox\" },\n { name: \"Toggle\", altNames: [\"Toggle\"], componentName: \"Toggle\", importPath: \"@/components/ui/toggle\" },\n { name: \"Textarea\", altNames: [\"Textarea\"], componentName: \"Textarea\", importPath: \"@/components/ui/textarea\" },\n ],\n },\n rules: {\n \"font-size-min\": \"error\",\n \"font-size-max\": \"error\",\n \"font-weight-max\": \"error\",\n \"no-arbitrary-text-size\": \"error\",\n \"no-uppercase-text\": \"error\",\n \"control-height-max\": \"error\",\n \"corner-radius-allowed\": \"error\",\n \"no-banned-colors\": \"error\",\n \"no-raw-hex-colors\": \"error\",\n \"no-raw-html-elements\": \"error\",\n \"no-pseudo-chips\": \"error\",\n \"no-chip-colored-buttons\": \"error\",\n \"no-text-arrows\": \"error\",\n \"no-backdrop-blur\": \"error\",\n \"no-unapproved-gradients\": \"error\",\n \"modal-backdrop-standard\": \"error\",\n \"table-resizable-required\": \"error\",\n \"table-head-icon-required\": \"error\",\n \"table-single-border\": \"error\",\n \"table-no-divide-y\": \"error\",\n \"table-uniform-typography\": \"error\",\n \"table-no-cell-stacking\": \"error\",\n \"table-no-horizontal-stacking\": \"error\",\n \"table-windowed-pagination\": \"error\",\n \"tabs-component-required\": \"error\",\n \"component-inventory-active\": \"error\",\n \"no-wrapping-compact-elements\": \"error\",\n },\n};\n\n","import type { DseConfig } from \"../types.js\";\n\nexport const defaultPreset: DseConfig = {\n preset: \"recommended\",\n targetDir: \"src\",\n include: [\"**/*.{tsx,jsx,ts,js}\"],\n exclude: [\n \"**/node_modules/**\",\n \"**/.next/**\",\n \"**/public/**\",\n \"**/.git/**\",\n \"**/dist/**\",\n ],\n tokens: {\n typography: {\n minFontSize: \"14px\",\n maxFontSize: \"36px\",\n maxFontWeight: 600,\n disallowArbitrarySizes: false,\n disallowUppercase: true,\n allowXsOn: [],\n },\n geometry: {\n maxControlHeight: 40,\n allowedRadii: [\"0\", \"0px\", \"4px\", \"6px\", \"8px\", \"12px\", \"16px\", \"9999px\", \"100%\"],\n },\n colors: {\n disallowRawHex: false,\n disallowButtonChipColors: true,\n },\n },\n components: {\n disallowRawHtml: {\n button: { replaceWith: \"Button\", importFrom: \"@/components/ui/button\", checkRawElement: true },\n select: { replaceWith: \"Dropdown\", importFrom: \"@/components/ui/dropdown\", checkRawElement: true },\n textarea: { replaceWith: \"Textarea\", importFrom: \"@/components/ui/textarea\", checkRawElement: true },\n progress: { replaceWith: \"ProgressBar\", importFrom: \"@/components/ui/progress\", checkRawElement: true },\n dialog: { replaceWith: \"Modal or Dialog\", importFrom: \"@/components/ui/modal\", checkRawElement: true },\n },\n disallowPseudoChips: true,\n },\n rules: {\n \"font-size-min\": \"error\",\n \"no-uppercase-text\": \"warn\",\n \"no-raw-html-elements\": \"error\",\n \"no-pseudo-chips\": \"warn\",\n \"no-chip-colored-buttons\": \"error\",\n \"no-text-arrows\": \"error\",\n \"no-backdrop-blur\": \"warn\",\n \"no-wrapping-compact-elements\": \"warn\",\n },\n};\n\n","import type { DseConfig } from \"../types.js\";\n\nexport const pythonPreset: DseConfig = {\n preset: \"recommended\",\n targetDir: \".\",\n include: [\"**/*.{py,html,jinja,jinja2,css,tsx,jsx,js,ts}\"],\n exclude: [\n \"**/.venv/**\",\n \"**/venv/**\",\n \"**/__pycache__/**\",\n \"**/.pytest_cache/**\",\n \"**/.mypy_cache/**\",\n \"**/.git/**\",\n \"**/node_modules/**\",\n \"**/dist/**\",\n \"**/build/**\",\n \"**/*.egg-info/**\",\n ],\n tokens: {\n typography: {\n minFontSize: \"14px\",\n maxFontSize: \"32px\",\n maxFontWeight: 500,\n disallowArbitrarySizes: true,\n disallowUppercase: true,\n allowXsOn: [],\n },\n geometry: {\n maxControlHeight: 36,\n allowedRadii: [\"0px\", \"8px\", \"12px\", \"16px\", \"9999px\"],\n },\n colors: {\n disallowRawHex: true,\n disallowButtonChipColors: true,\n },\n },\n components: {\n disallowRawHtml: {},\n requiredInventory: [],\n },\n rules: {\n \"font-size-min\": \"error\",\n \"font-size-max\": \"error\",\n \"font-weight-max\": \"error\",\n \"no-uppercase-text\": \"warn\",\n \"no-raw-hex-colors\": \"off\",\n \"no-text-arrows\": \"error\",\n \"no-backdrop-blur\": \"error\",\n \"table-resizable-required\": \"off\",\n \"table-head-icon-required\": \"off\",\n \"table-single-border\": \"off\",\n \"table-no-divide-y\": \"off\",\n \"table-uniform-typography\": \"off\",\n \"table-no-cell-stacking\": \"off\",\n \"table-no-horizontal-stacking\": \"off\",\n \"table-windowed-pagination\": \"off\",\n \"tabs-component-required\": \"off\",\n \"component-inventory-active\": \"off\",\n },\n};\n\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport type { ComponentLibrary, Framework, ProjectInfo } from \"./types.js\";\nimport { getSmartIgnores } from \"./ignores.js\";\n\ninterface PackageJson {\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n workspaces?: string[] | { packages?: string[] };\n}\n\nfunction safeReadJson<T>(filePath: string): T | null {\n try {\n if (fs.existsSync(filePath)) {\n const raw = fs.readFileSync(filePath, \"utf-8\");\n return JSON.parse(raw) as T;\n }\n } catch {\n // ignore\n }\n return null;\n}\n\n/**\n * Autonomously inspects a project root offline to detect framework, libraries,\n * UI file locations, design tokens, and appropriate presets.\n */\nexport function detectProject(cwd = process.cwd()): ProjectInfo {\n const pkg = safeReadJson<PackageJson>(path.resolve(cwd, \"package.json\"));\n const deps = { ...(pkg?.dependencies || {}), ...(pkg?.devDependencies || {}) };\n\n // 1. Detect Python vs JS/TS\n const hasRequirements = fs.existsSync(path.resolve(cwd, \"requirements.txt\"));\n const hasPyproject = fs.existsSync(path.resolve(cwd, \"pyproject.toml\"));\n const hasPython = hasRequirements || hasPyproject || fs.existsSync(path.resolve(cwd, \"setup.py\"));\n\n // Check if streamlit\n let isStreamlit = false;\n if (hasPython) {\n if (hasRequirements) {\n try {\n const reqContent = fs.readFileSync(path.resolve(cwd, \"requirements.txt\"), \"utf-8\");\n if (reqContent.toLowerCase().includes(\"streamlit\")) {\n isStreamlit = true;\n }\n } catch {}\n }\n }\n\n // 2. Detect Monorepo\n const isPnpmMonorepo = fs.existsSync(path.resolve(cwd, \"pnpm-workspace.yaml\"));\n const isTurbo = fs.existsSync(path.resolve(cwd, \"turbo.json\"));\n let monorepoWorkspaces: string[] = [];\n if (Array.isArray(pkg?.workspaces)) {\n monorepoWorkspaces = pkg.workspaces;\n } else if (pkg?.workspaces?.packages) {\n monorepoWorkspaces = pkg.workspaces.packages;\n }\n const isMonorepo = isPnpmMonorepo || isTurbo || monorepoWorkspaces.length > 0;\n\n // 3. Detect Framework\n let framework: Framework = \"unknown\";\n if (deps[\"next\"]) {\n framework = \"nextjs\";\n } else if (deps[\"vite\"]) {\n framework = \"vite\";\n } else if (deps[\"@remix-run/react\"]) {\n framework = \"remix\";\n } else if (deps[\"astro\"]) {\n framework = \"astro\";\n } else if (deps[\"react-scripts\"]) {\n framework = \"react-cra\";\n } else if (isStreamlit) {\n framework = \"streamlit\";\n } else if (hasPython) {\n framework = \"python-general\";\n }\n\n // 4. Detect Component Libraries & Icons\n const libraries: ComponentLibrary[] = [];\n const hasShadcnConfig = fs.existsSync(path.resolve(cwd, \"components.json\"));\n if (hasShadcnConfig || deps[\"@radix-ui/react-slot\"]) {\n libraries.push(\"shadcn\");\n }\n if (Object.keys(deps).some((d) => d.startsWith(\"@radix-ui/\"))) {\n if (!libraries.includes(\"shadcn\")) libraries.push(\"radix\");\n }\n if (deps[\"tailwindcss\"]) {\n libraries.push(\"tailwind\");\n }\n if (deps[\"lucide-react\"] || deps[\"lucide\"]) {\n libraries.push(\"lucide\");\n }\n if (deps[\"@mui/material\"] || deps[\"@material-ui/core\"]) {\n libraries.push(\"mui\");\n }\n if (deps[\"@chakra-ui/react\"]) {\n libraries.push(\"chakra\");\n }\n\n // 5. Detect Tailwind details\n const hasTailwind = Boolean(deps[\"tailwindcss\"] || fs.existsSync(path.resolve(cwd, \"tailwind.config.js\")) || fs.existsSync(path.resolve(cwd, \"tailwind.config.ts\")));\n let tailwindVersion: \"v3\" | \"v4\" | undefined;\n if (hasTailwind) {\n const rawVersion = deps[\"tailwindcss\"] || \"\";\n if (rawVersion.includes(\"^4\") || rawVersion.includes(\"~4\") || rawVersion.startsWith(\"4\")) {\n tailwindVersion = \"v4\";\n } else {\n tailwindVersion = \"v3\";\n }\n }\n\n // 6. Detect TypeScript\n const hasTypeScript = Boolean(deps[\"typescript\"] || fs.existsSync(path.resolve(cwd, \"tsconfig.json\")));\n\n // 7. Auto-detect UI directories & includes\n const suggestedIncludes: string[] = [];\n const extGroup = hasTypeScript ? \"{tsx,jsx,ts,js}\" : \"{jsx,js}\";\n\n // Subfolder checks (e.g. frontend/src or apps/web/src or simple src/)\n const candidateDirs = [\n \"frontend/src\",\n \"frontend\",\n \"apps/web/src\",\n \"apps/web\",\n \"client/src\",\n \"client\",\n \"src\",\n \"app\",\n \"pages\",\n \"components\",\n ];\n\n let foundUiDir = false;\n for (const dir of candidateDirs) {\n if (fs.existsSync(path.resolve(cwd, dir))) {\n // Avoid adding broad 'frontend' if 'frontend/src' exists\n if (dir === \"frontend\" && fs.existsSync(path.resolve(cwd, \"frontend/src\"))) continue;\n if (dir === \"client\" && fs.existsSync(path.resolve(cwd, \"client/src\"))) continue;\n if (dir === \"apps/web\" && fs.existsSync(path.resolve(cwd, \"apps/web/src\"))) continue;\n\n suggestedIncludes.push(`${dir}/**/*.${extGroup}`);\n foundUiDir = true;\n break;\n }\n }\n\n // If no standard folder found and has python files\n if (hasPython) {\n suggestedIncludes.push(\"**/*.py\");\n } else if (!foundUiDir) {\n suggestedIncludes.push(`**/*.${extGroup}`);\n }\n\n // 8. Auto-detect Ignores\n const suggestedIgnores = getSmartIgnores(cwd);\n // If shadcn is installed, auto-ignore the raw generated primitives components/ui\n if (hasShadcnConfig || libraries.includes(\"shadcn\")) {\n suggestedIgnores.push(\"**/components/ui/**\");\n }\n\n // 9. Auto-detect Token Files\n const tokenCandidates = [\n \"frontend/src/lib/tokens.ts\",\n \"frontend/src/tokens.ts\",\n \"src/lib/tokens.ts\",\n \"src/tokens.ts\",\n \"src/design/tokens.ts\",\n \"styles/tokens.css\",\n \"src/app/globals.css\",\n \"frontend/src/index.css\",\n \"src/index.css\",\n ];\n\n let tokensFile: string | undefined;\n for (const candidate of tokenCandidates) {\n if (fs.existsSync(path.resolve(cwd, candidate))) {\n tokensFile = candidate;\n break;\n }\n }\n\n // 10. Decide Preset\n let preset: \"berserk\" | \"default\" | \"python\" = \"berserk\";\n if (framework === \"streamlit\" || framework === \"python-general\") {\n preset = \"python\";\n }\n\n return {\n root: cwd,\n isMonorepo,\n monorepoWorkspaces,\n framework,\n libraries,\n hasTailwind,\n tailwindVersion,\n hasTypeScript,\n hasPython,\n suggestedIncludes,\n suggestedIgnores,\n tokensFile,\n preset,\n };\n}\n\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\nconst DEFAULT_IGNORES = [\n \"**/node_modules/**\",\n \"**/.next/**\",\n \"**/dist/**\",\n \"**/build/**\",\n \"**/out/**\",\n \"**/.turbo/**\",\n \"**/.git/**\",\n \"**/coverage/**\",\n \"**/.venv/**\",\n \"**/venv/**\",\n \"**/env/**\",\n \"**/__pycache__/**\",\n \"**/.pytest_cache/**\",\n \"**/*.pyc\",\n // Non-UI code\n \"**/api/**\",\n \"**/*.test.*\",\n \"**/*.spec.*\",\n \"**/__tests__/**\",\n \"**/*.stories.*\",\n \"**/generated/**\",\n];\n\n/**\n * Parses local .gitignore if present and merges with sensible UI linter ignores.\n */\nexport function getSmartIgnores(cwd: string): string[] {\n const result = new Set<string>(DEFAULT_IGNORES);\n\n const gitignorePath = path.resolve(cwd, \".gitignore\");\n if (fs.existsSync(gitignorePath)) {\n try {\n const content = fs.readFileSync(gitignorePath, \"utf-8\");\n const lines = content.split(/\\r?\\n/);\n for (let line of lines) {\n line = line.trim();\n if (!line || line.startsWith(\"#\")) continue;\n\n // Strip leading slash if any\n if (line.startsWith(\"/\")) {\n line = line.substring(1);\n }\n\n // Strip trailing slash if directory\n if (line.endsWith(\"/\")) {\n line = line.slice(0, -1);\n }\n\n if (line) {\n result.add(`**/${line}/**`);\n result.add(`**/${line}`);\n }\n }\n } catch {\n // Ignore reading error, proceed with defaults\n }\n }\n\n return Array.from(result);\n}\n\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport fg from \"fast-glob\";\nimport type { DseConfig, ScanResult, Violation } from \"../config/types.js\";\nimport { parseTsx, getFileImports } from \"../parser/ast.js\";\nimport { runAstRules } from \"./ast-rules.js\";\nimport { runRegexRules } from \"./regex-rules.js\";\nimport { runPythonRules } from \"./python-rules.js\";\nimport type { AddViolationFn } from \"./types.js\";\n\nexport async function runDseScan(config: DseConfig, cwd = process.cwd()): Promise<ScanResult> {\n let targetDir = path.resolve(cwd, config.targetDir || \"src\");\n if (!fs.existsSync(targetDir)) {\n targetDir = cwd;\n }\n\n const includePatterns = config.include || [\"**/*.{tsx,jsx,ts,js}\"];\n const excludePatterns = config.exclude || [\n \"**/node_modules/**\",\n \"**/.next/**\",\n \"**/public/**\",\n \"**/.git/**\",\n ];\n\n // Component inventory setup\n const inventoryCounts: Record<string, number> = {};\n const inventoryDef = config.components?.requiredInventory || [];\n inventoryDef.forEach((comp) => {\n inventoryCounts[comp.name] = 0;\n });\n\n const rawFiles = await fg(includePatterns, {\n cwd: targetDir,\n absolute: true,\n });\n\n const files = rawFiles.filter((filePath) => {\n const normalized = filePath.replace(/\\\\/g, \"/\");\n for (const pattern of excludePatterns) {\n const clean = pattern.replace(/^\\*\\*?\\//, \"\").replace(/\\/\\*\\*?$/, \"\").replace(/\\\\/g, \"/\");\n if (clean && normalized.includes(clean)) {\n return false;\n }\n }\n return true;\n });\n\n const violations: Violation[] = [];\n const seenViolationKeys = new Set<string>();\n\n const addViolation: AddViolationFn = (file, line, col, rule, message, snippet) => {\n const normFile = path.relative(cwd, file).replace(/\\\\/g, \"/\");\n const key = `${normFile}:${line}:${rule}`;\n if (seenViolationKeys.has(key)) return;\n seenViolationKeys.add(key);\n\n const severity = config.rules?.[rule as keyof typeof config.rules] || \"error\";\n if (severity === \"off\") return;\n\n violations.push({\n file: normFile,\n line: line || 0,\n col: col || 0,\n rule,\n severity: severity === \"warn\" ? \"warn\" : \"error\",\n message,\n snippet: snippet ? snippet.trim() : undefined,\n });\n };\n\n let scannedJsxFiles = false;\n\n for (const filePath of files) {\n const content = fs.readFileSync(filePath, \"utf-8\");\n const isJsx = filePath.endsWith(\".tsx\") || filePath.endsWith(\".jsx\") || filePath.endsWith(\".ts\") || filePath.endsWith(\".js\");\n const isPythonOrTemplate = filePath.endsWith(\".py\") || filePath.endsWith(\".html\") || filePath.endsWith(\".jinja\") || filePath.endsWith(\".jinja2\") || filePath.endsWith(\".css\");\n\n if (isJsx) {\n scannedJsxFiles = true;\n // Track component inventory\n inventoryDef.forEach((comp) => {\n const names = [comp.componentName || comp.name, ...(comp.altNames || [])];\n const pattern = new RegExp(`<(?:${names.join(\"|\")})\\\\b`, \"g\");\n if (pattern.test(content)) {\n inventoryCounts[comp.name] = (inventoryCounts[comp.name] || 0) + 1;\n }\n });\n\n const sourceFile = parseTsx(filePath, content);\n const fileImports = getFileImports(sourceFile);\n runAstRules(sourceFile, filePath, addViolation, fileImports, config);\n runRegexRules(content, filePath, addViolation, config);\n } else if (isPythonOrTemplate) {\n runPythonRules(content, filePath, addViolation, config);\n } else {\n runRegexRules(content, filePath, addViolation, config);\n }\n }\n\n // Component inventory verification (only if JSX/TSX components are in scope)\n if (scannedJsxFiles && inventoryDef.length > 0 && config.rules?.[\"component-inventory-active\"] !== \"off\") {\n inventoryDef.forEach((comp) => {\n const count = inventoryCounts[comp.name] || 0;\n if (count === 0) {\n violations.push({\n file: \"GLOBAL\",\n line: 0,\n col: 0,\n rule: \"component-inventory-active\",\n severity: \"error\",\n message: `Required design system component '<${comp.name}>' is defined in the design system but never utilized anywhere across the application!`,\n });\n }\n });\n }\n\n const errorCount = violations.filter((v) => v.severity === \"error\").length;\n const warningCount = violations.filter((v) => v.severity === \"warn\").length;\n\n const componentInventoryReport: Record<string, { active: boolean; fileCount: number }> = {};\n if (scannedJsxFiles && inventoryDef.length > 0) {\n inventoryDef.forEach((comp) => {\n const count = inventoryCounts[comp.name] || 0;\n componentInventoryReport[comp.name] = {\n active: count > 0,\n fileCount: count,\n };\n });\n }\n\n return {\n violations,\n scannedFilesCount: files.length,\n errorCount,\n warningCount,\n componentInventory: componentInventoryReport,\n };\n}\n","import ts from \"typescript\";\n\nexport interface NodePosition {\n line: number;\n col: number;\n}\n\nexport interface ExtractedClass {\n text: string;\n node: ts.Node;\n}\n\nexport interface AttributeInfo {\n node: ts.JsxAttribute | ts.JsxSpreadAttribute;\n initializer?: ts.Expression | null;\n rawText: string;\n isSpread?: boolean;\n}\n\n/**\n * Parses file content into a TypeScript SourceFile AST.\n */\nexport function parseTsx(filePath: string, content: string): ts.SourceFile {\n const isTsx = filePath.endsWith(\".tsx\") || filePath.endsWith(\".jsx\");\n const kind = isTsx ? ts.ScriptKind.TSX : ts.ScriptKind.TS;\n return ts.createSourceFile(\n filePath,\n content,\n ts.ScriptTarget.Latest,\n true, // setParentNodes = true for parent traversal\n kind\n );\n}\n\n/**\n * Gets 1-indexed line and column for any AST node.\n */\nexport function getNodePosition(sourceFile: ts.SourceFile, node: ts.Node): NodePosition {\n const start = node.getStart(sourceFile);\n const { line, character } = sourceFile.getLineAndCharacterOfPosition(start);\n return { line: line + 1, col: character + 1 };\n}\n\n/**\n * Gets the clean tag name of a JSX element or self-closing element.\n */\nexport function getJsxTagName(node: ts.Node, sourceFile: ts.SourceFile): string | null {\n if (ts.isJsxElement(node)) {\n return node.openingElement.tagName.getText(sourceFile);\n }\n if (ts.isJsxSelfClosingElement(node)) {\n return node.tagName.getText(sourceFile);\n }\n if (ts.isJsxOpeningElement(node)) {\n return node.tagName.getText(sourceFile);\n }\n return null;\n}\n\n/**\n * Gets JSX attributes as a structured map.\n */\nexport function getJsxAttributes(node: ts.Node, sourceFile: ts.SourceFile): Record<string, AttributeInfo> {\n const attributes: Record<string, AttributeInfo> = {};\n const propContainer = ts.isJsxElement(node)\n ? node.openingElement.attributes\n : ts.isJsxSelfClosingElement(node) || ts.isJsxOpeningElement(node)\n ? node.attributes\n : null;\n\n if (!propContainer) return attributes;\n\n propContainer.properties.forEach((prop) => {\n if (ts.isJsxAttribute(prop)) {\n const name = prop.name.getText(sourceFile);\n attributes[name] = {\n node: prop,\n initializer: prop.initializer || null,\n rawText: prop.getText(sourceFile),\n };\n } else if (ts.isJsxSpreadAttribute(prop)) {\n attributes[`__spread_${prop.getStart(sourceFile)}`] = {\n node: prop,\n isSpread: true,\n rawText: prop.getText(sourceFile),\n };\n }\n });\n\n return attributes;\n}\n\n/**\n * Recursively extracts all class strings from a JSX attribute initializer.\n */\nexport function extractClassNames(initializer: ts.Expression | null | undefined, sourceFile: ts.SourceFile): ExtractedClass[] {\n const result: ExtractedClass[] = [];\n if (!initializer) return result;\n\n function collectStrings(node: ts.Node | undefined) {\n if (!node) return;\n\n if (ts.isStringLiteral(node) || ts.isNoSubstitutionTemplateLiteral(node)) {\n result.push({ text: node.text, node });\n return;\n }\n\n if (ts.isTemplateExpression(node)) {\n if (node.head.text) {\n result.push({ text: node.head.text, node: node.head });\n }\n for (const span of node.templateSpans) {\n collectStrings(span.expression);\n if (span.literal.text) {\n result.push({ text: span.literal.text, node: span.literal });\n }\n }\n return;\n }\n\n if (ts.isJsxExpression(node)) {\n collectStrings(node.expression);\n return;\n }\n\n if (ts.isParenthesizedExpression(node)) {\n collectStrings(node.expression);\n return;\n }\n\n if (ts.isBinaryExpression(node)) {\n collectStrings(node.left);\n collectStrings(node.right);\n return;\n }\n\n if (ts.isConditionalExpression(node)) {\n collectStrings(node.whenTrue);\n collectStrings(node.whenFalse);\n return;\n }\n\n if (ts.isArrayLiteralExpression(node)) {\n for (const element of node.elements) {\n collectStrings(element);\n }\n return;\n }\n\n if (ts.isCallExpression(node)) {\n for (const arg of node.arguments) {\n collectStrings(arg);\n }\n return;\n }\n\n if (ts.isObjectLiteralExpression(node)) {\n for (const prop of node.properties) {\n if (ts.isPropertyAssignment(prop)) {\n if (ts.isStringLiteral(prop.name) || ts.isIdentifier(prop.name)) {\n result.push({ text: prop.name.text, node: prop.name });\n }\n }\n }\n return;\n }\n }\n\n collectStrings(initializer);\n return result;\n}\n\n/**\n * Gets all imports in a SourceFile mapped by imported identifier to module specifier.\n */\nexport function getFileImports(sourceFile: ts.SourceFile): Record<string, string> {\n const imports: Record<string, string> = {};\n\n ts.forEachChild(sourceFile, (node) => {\n if (ts.isImportDeclaration(node) && node.importClause) {\n const moduleSpecifier = ts.isStringLiteral(node.moduleSpecifier)\n ? node.moduleSpecifier.text\n : \"\";\n\n if (node.importClause.name) {\n imports[node.importClause.name.text] = moduleSpecifier;\n }\n\n if (node.importClause.namedBindings) {\n if (ts.isNamedImports(node.importClause.namedBindings)) {\n node.importClause.namedBindings.elements.forEach((spec) => {\n const localName = spec.name.text;\n imports[localName] = moduleSpecifier;\n });\n } else if (ts.isNamespaceImport(node.importClause.namedBindings)) {\n imports[node.importClause.namedBindings.name.text] = moduleSpecifier;\n }\n }\n }\n });\n\n return imports;\n}\n\n","import ts from \"typescript\";\nimport type { DseConfig } from \"../config/types.js\";\nimport {\n getJsxTagName,\n getJsxAttributes,\n extractClassNames,\n getNodePosition,\n type ExtractedClass,\n} from \"../parser/ast.js\";\nimport {\n splitClassString,\n decomposeToken,\n evaluateTypographyToken,\n evaluateGeometryToken,\n evaluateColorToken,\n} from \"../tokens/index.js\";\nimport type { AddViolationFn } from \"./types.js\";\n\nexport function runAstRules(\n sourceFile: ts.SourceFile,\n filePath: string,\n addViolation: AddViolationFn,\n fileImports: Record<string, string>,\n config: DseConfig\n): void {\n const isTsx = filePath.endsWith(\".tsx\") || filePath.endsWith(\".jsx\");\n if (!isTsx) return;\n\n const content = sourceFile.getFullText();\n const fileLines = content.split(\"\\n\");\n\n let hasTable = false;\n let hasTableHeader = false;\n let hasTableHead = false;\n let hasTableBody = false;\n let hasTableRow = false;\n let hasTableCell = false;\n\n let usesColumnHeader = false;\n let usesResizeDivider = false;\n let usesResizableHook = false;\n\n function visitNode(node: ts.Node, parent: ts.Node | null, ancestors: ts.Node[]) {\n if (ts.isJsxElement(node) || ts.isJsxSelfClosingElement(node)) {\n const tagName = getJsxTagName(node, sourceFile);\n if (!tagName) return;\n\n const attributes = getJsxAttributes(node, sourceFile);\n const pos = getNodePosition(sourceFile, node);\n const lineSnippet = fileLines[pos.line - 1] || \"\";\n\n if (lineSnippet.includes(\"dse-ignore\") || (pos.line > 1 && fileLines[pos.line - 2]?.includes(\"dse-ignore\"))) {\n return;\n }\n\n // Track table components\n if (tagName === \"Table\") hasTable = true;\n else if (tagName === \"TableHeader\") hasTableHeader = true;\n else if (tagName === \"TableHead\") hasTableHead = true;\n else if (tagName === \"TableBody\") hasTableBody = true;\n else if (tagName === \"TableRow\") hasTableRow = true;\n else if (tagName === \"TableCell\") hasTableCell = true;\n else if (tagName === \"TableColumnHeader\") usesColumnHeader = true;\n else if (tagName === \"TableResizeDivider\") usesResizeDivider = true;\n\n // 1. Raw HTML Elements Check\n if (config.rules?.[\"no-raw-html-elements\"] !== \"off\") {\n checkRawHtmlElements(tagName, attributes, pos, filePath, addViolation, lineSnippet, config);\n }\n\n // 2. Button Invariants Check\n checkButtonInvariants(tagName, attributes, pos, filePath, addViolation, lineSnippet, config);\n\n // 3. TableHead Invariants\n if (tagName === \"TableHead\") {\n checkTableHeadInvariants(node, attributes, pos, filePath, addViolation, lineSnippet, sourceFile, config);\n }\n\n // 4. TableBody Invariants\n if (tagName === \"TableBody\" && config.rules?.[\"table-no-divide-y\"] !== \"off\") {\n checkTableBodyInvariants(attributes, pos, filePath, addViolation, lineSnippet, sourceFile);\n }\n\n // 5. TableCell Invariants\n if (tagName === \"TableCell\") {\n checkTableCellInvariants(node, attributes, pos, filePath, addViolation, lineSnippet, sourceFile, config);\n }\n\n // 6. Tabs Invariants\n if (tagName === \"Tabs\" && config.rules?.[\"tabs-component-required\"] !== \"off\") {\n checkTabsElement(attributes, pos, filePath, addViolation, lineSnippet, fileImports);\n }\n\n // 7. Pseudo-Chips\n if ((tagName === \"span\" || tagName === \"div\") && config.rules?.[\"no-pseudo-chips\"] !== \"off\") {\n checkPseudoChips(tagName, attributes, pos, filePath, addViolation, lineSnippet, sourceFile);\n }\n\n // 8. Element classes (tokens)\n checkElementClasses(node, tagName, attributes, pos, filePath, addViolation, sourceFile, config);\n }\n\n if (ts.isCallExpression(node)) {\n const fnName = node.expression.getText(sourceFile);\n if (fnName === \"useResizableColumns\") {\n usesResizableHook = true;\n }\n }\n }\n\n function walk(node: ts.Node, parent: ts.Node | null, ancestors: ts.Node[]) {\n visitNode(node, parent, ancestors);\n ancestors.push(node);\n ts.forEachChild(node, (child) => walk(child, node, ancestors));\n ancestors.pop();\n }\n\n walk(sourceFile, null, []);\n\n // Global file-level table checks\n checkTableFileInvariants(\n filePath,\n content,\n addViolation,\n fileImports,\n hasTable,\n hasTableHeader,\n hasTableHead,\n hasTableBody,\n hasTableRow,\n hasTableCell,\n usesColumnHeader,\n usesResizeDivider,\n usesResizableHook,\n config\n );\n}\n\nfunction checkRawHtmlElements(\n tagName: string,\n attributes: Record<string, any>,\n pos: { line: number; col: number },\n filePath: string,\n addViolation: AddViolationFn,\n lineSnippet: string,\n config: DseConfig\n) {\n // Only check lowercase raw HTML elements (e.g. <button>, <select>, <table>), NOT uppercase React components (<Button>, <Table>)\n if (tagName[0] !== tagName[0].toLowerCase()) {\n return;\n }\n\n const replacements = config.components?.disallowRawHtml || {};\n const configEntry = replacements[tagName.toLowerCase()];\n\n if (configEntry) {\n addViolation(\n filePath,\n pos.line,\n pos.col,\n \"no-raw-html-elements\",\n `Raw '<${tagName}>' element detected. Use standard design system '<${configEntry.replaceWith}>' component${configEntry.importFrom ? ` from '${configEntry.importFrom}'` : \"\"}.`,\n lineSnippet\n );\n return;\n }\n\n if (tagName === \"input\") {\n const typeAttr = attributes.type;\n const typeVal = typeAttr && typeAttr.initializer ? typeAttr.initializer.getText().replace(/['\"]/g, \"\") : \"text\";\n\n if (typeVal === \"checkbox\") {\n addViolation(\n filePath,\n pos.line,\n pos.col,\n \"no-raw-html-elements\",\n `Raw browser default '<input type=\"checkbox\">' detected. Never use unstyled browser checkboxes. Use standard design system '<Checkbox>' or '<Toggle>'.`,\n lineSnippet\n );\n } else if (typeVal === \"radio\") {\n addViolation(\n filePath,\n pos.line,\n pos.col,\n \"no-raw-html-elements\",\n `Raw browser default '<input type=\"radio\">' detected. Never use unstyled browser radio buttons. Use standard design system '<RadioGroup>' or styled toggle.`,\n lineSnippet\n );\n } else if (typeVal === \"range\") {\n addViolation(\n filePath,\n pos.line,\n pos.col,\n \"no-raw-html-elements\",\n `Raw browser default '<input type=\"range\">' detected. Never use unstyled browser sliders. Use standard design system '<Slider>'.`,\n lineSnippet\n );\n } else if (typeVal === \"file\") {\n addViolation(\n filePath,\n pos.line,\n pos.col,\n \"no-raw-html-elements\",\n `Raw browser default '<input type=\"file\">' detected. Never display native unstyled file picker inputs. Use a custom styled dropzone or trigger.`,\n lineSnippet\n );\n } else if (typeVal === \"color\") {\n addViolation(\n filePath,\n pos.line,\n pos.col,\n \"no-raw-html-elements\",\n `Raw browser default '<input type=\"color\">' detected. Never use native browser color pickers. Use a custom color picker component.`,\n lineSnippet\n );\n } else if ([\"text\", \"email\", \"search\", \"password\", \"number\", \"tel\", \"url\"].includes(typeVal)) {\n addViolation(\n filePath,\n pos.line,\n pos.col,\n \"no-raw-html-elements\",\n `Raw browser default '<input type=\"${typeVal}\">' element detected. Use standard design system '<Input>' component.`,\n lineSnippet\n );\n }\n }\n\n}\n\nfunction checkButtonInvariants(\n tagName: string,\n attributes: Record<string, any>,\n pos: { line: number; col: number },\n filePath: string,\n addViolation: AddViolationFn,\n lineSnippet: string,\n config: DseConfig\n) {\n const isButton = [\"Button\", \"IconButton\", \"ButtonyIcon\", \"FloatingActionButton\"].includes(tagName);\n if (!isButton) return;\n\n if (config.rules?.[\"no-chip-colored-buttons\"] !== \"off\" && attributes.variant && attributes.variant.initializer) {\n const varVal = attributes.variant.initializer.getText().replace(/['\"]/g, \"\");\n if ([\"danger\", \"success\", \"warning\", \"error\"].includes(varVal)) {\n addViolation(\n filePath,\n pos.line,\n pos.col,\n \"no-chip-colored-buttons\",\n `Button uses semantic chip variant '${varVal}'. Buttons must use neutral variants ('primary', 'outline', 'secondary', 'ghost'). Semantic colors are reserved for <Chip>.`,\n lineSnippet\n );\n }\n }\n}\n\nfunction checkTableHeadInvariants(\n node: ts.Node,\n attributes: Record<string, any>,\n pos: { line: number; col: number },\n filePath: string,\n addViolation: AddViolationFn,\n lineSnippet: string,\n sourceFile: ts.SourceFile,\n config: DseConfig\n) {\n const hasIconProp = Boolean(attributes.icon);\n const rawChildren = node.getText(sourceFile);\n\n const isCheckboxCol =\n /<(?:Checkbox\\b|input[^>]*type=[\"']checkbox[\"'])/i.test(rawChildren) ||\n /toggleSelect/i.test(rawChildren) ||\n /selectedEmails|selectedIds|selectedLeadIds/i.test(rawChildren) ||\n (attributes.resizable?.initializer?.getText(sourceFile) === \"{false}\" && /checkbox/i.test(rawChildren));\n\n if (config.rules?.[\"table-head-icon-required\"] !== \"off\" && !hasIconProp && !isCheckboxCol) {\n addViolation(\n filePath,\n pos.line,\n pos.col,\n \"table-head-icon-required\",\n \"<TableHead> is missing mandatory 'icon' prop (e.g. icon={<SomeIcon size={20} />}). All table headers must provide an icon component via the 'icon' prop.\",\n lineSnippet\n );\n }\n\n if (config.rules?.[\"table-resizable-required\"] !== \"off\" && attributes.resizable && attributes.resizable.initializer) {\n const resizableVal = attributes.resizable.initializer.getText(sourceFile);\n if (resizableVal === \"{false}\" && !isCheckboxCol) {\n addViolation(\n filePath,\n pos.line,\n pos.col,\n \"table-resizable-required\",\n \"Table column header '<TableHead>' has disabled resizable columns with 'resizable={false}'. All data table columns must support column resizing.\",\n lineSnippet\n );\n }\n }\n\n if (config.rules?.[\"table-no-horizontal-stacking\"] !== \"off\") {\n if (/(?:email\\s*(?:&|\\/)\\s*deliverability|deliverability\\s*(?:&|\\/)\\s*email|pages\\s*(?:&|\\/)\\s*dupes|warmup\\s*(?:&|\\/)\\s*deliverability)/i.test(rawChildren)) {\n addViolation(\n filePath,\n pos.line,\n pos.col,\n \"table-no-horizontal-stacking\",\n \"Combined column header detected in '<TableHead>'. Distinct metadata attributes must each reside in their own dedicated, resizable column with a distinct icon.\",\n lineSnippet\n );\n }\n }\n}\n\nfunction checkTableBodyInvariants(\n attributes: Record<string, any>,\n pos: { line: number; col: number },\n filePath: string,\n addViolation: AddViolationFn,\n lineSnippet: string,\n sourceFile: ts.SourceFile\n) {\n if (attributes.className) {\n const classStrings = extractClassNames(attributes.className.initializer, sourceFile);\n classStrings.forEach(({ text }) => {\n if (/\\bdivide-y\\b/.test(text)) {\n addViolation(\n filePath,\n pos.line,\n pos.col,\n \"table-no-divide-y\",\n \"Disallowed 'divide-y' detected on '<TableBody>'. In our design system, TableRow natively implements single 'border-b border-neutral-200'. Using 'divide-y' produces double stroke borders.\",\n lineSnippet\n );\n }\n });\n }\n}\n\nfunction checkTableCellInvariants(\n node: ts.Node,\n attributes: Record<string, any>,\n pos: { line: number; col: number },\n filePath: string,\n addViolation: AddViolationFn,\n lineSnippet: string,\n sourceFile: ts.SourceFile,\n config: DseConfig\n) {\n if (attributes && attributes.colSpan) return;\n\n const childrenText = node.getText(sourceFile);\n let hasVerticalStack = false;\n let directBlockCount = 0;\n\n if ((node as any).children) {\n (node as any).children.forEach((child: ts.Node) => {\n if (ts.isJsxElement(child) || ts.isJsxSelfClosingElement(child)) {\n const tag = getJsxTagName(child, sourceFile);\n if (tag && [\"div\", \"p\", \"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\"].includes(tag)) {\n directBlockCount++;\n }\n }\n });\n }\n\n function inspectCellDescendant(child: ts.Node) {\n if (ts.isJsxElement(child) || ts.isJsxSelfClosingElement(child)) {\n const childTag = getJsxTagName(child, sourceFile);\n const childAttrs = getJsxAttributes(child, sourceFile);\n\n if (childAttrs.className) {\n const classes = extractClassNames(childAttrs.className.initializer, sourceFile);\n classes.forEach(({ text }) => {\n if (/\\b(?:flex-col|grid-cols-1|space-y-\\d+)\\b/.test(text)) {\n hasVerticalStack = true;\n }\n });\n }\n\n if (config.rules?.[\"table-uniform-typography\"] !== \"off\") {\n const isExempt = childTag && [\"Button\", \"IconButton\", \"ButtonyIcon\", \"Chip\", \"Badge\", \"Input\", \"Skeleton\"].includes(childTag);\n if (!isExempt && childAttrs.className) {\n const classes = extractClassNames(childAttrs.className.initializer, sourceFile);\n classes.forEach(({ text }) => {\n const tokens = splitClassString(text);\n tokens.forEach((t) => {\n const dec = decomposeToken(t);\n if (!dec) return;\n\n if (/^text-neutral-(?:400|500|600|700|800)$/.test(dec.core)) {\n const childPos = getNodePosition(sourceFile, child);\n addViolation(\n filePath,\n childPos.line,\n childPos.col,\n \"table-uniform-typography\",\n `Mismatched table text styling '${dec.core}' inside '<TableCell>'. Text in tables must use uniform styling ('text-text-primary').`,\n lineSnippet\n );\n }\n\n if (/^text-(?:xs|2xs|base|lg|xl|2xl|3xl|4xl|5xl|\\[[0-9]+px\\])$/.test(dec.core)) {\n const childPos = getNodePosition(sourceFile, child);\n addViolation(\n filePath,\n childPos.line,\n childPos.col,\n \"table-uniform-typography\",\n `Mismatched table text size '${dec.core}' inside '<TableCell>'. In tables, all fonts must have standard 14px size ('text-sm').`,\n lineSnippet\n );\n }\n });\n });\n }\n }\n }\n ts.forEachChild(child, inspectCellDescendant);\n }\n\n if ((node as any).children) {\n (node as any).children.forEach(inspectCellDescendant);\n }\n\n if (config.rules?.[\"table-no-cell-stacking\"] !== \"off\") {\n if (hasVerticalStack || directBlockCount > 1) {\n if (!childrenText.includes(\"dse-ignore-stack\")) {\n addViolation(\n filePath,\n pos.line,\n pos.col,\n \"table-no-cell-stacking\",\n \"Stacked text or metadata items detected inside '<TableCell>'. In our design system, vertical stacking of metadata inside table rows is prohibited. Every piece of metadata must reside in its own dedicated column.\",\n lineSnippet\n );\n }\n }\n }\n\n if (config.rules?.[\"table-no-horizontal-stacking\"] !== \"off\") {\n if (\n /(?:flex\\s+items-center|inline-flex|flex-row|items-center\\s+gap)/.test(childrenText) &&\n /<(?:Chip|Badge)\\b/.test(childrenText) &&\n /<(?:span|div|p)\\b[^>]*>(?:(?!<\\/(?:span|div|p)>)[\\s\\S])*?(?:email|\\.email|\\{cEmail\\}|\\{item\\.email\\}|@)[^<]*?<\\/(?:span|div|p)>/i.test(childrenText) &&\n !childrenText.includes(\"dse-ignore-stack\")\n ) {\n addViolation(\n filePath,\n pos.line,\n pos.col,\n \"table-no-horizontal-stacking\",\n \"Horizontal stacking of primary text and metadata status chip detected inside '<TableCell>'. Distinct metadata must reside in dedicated columns.\",\n lineSnippet\n );\n }\n }\n}\n\nfunction checkTableFileInvariants(\n filePath: string,\n content: string,\n addViolation: AddViolationFn,\n fileImports: Record<string, string>,\n hasTable: boolean,\n hasTableHeader: boolean,\n hasTableHead: boolean,\n hasTableBody: boolean,\n hasTableRow: boolean,\n hasTableCell: boolean,\n usesColumnHeader: boolean,\n usesResizeDivider: boolean,\n usesResizableHook: boolean,\n config: DseConfig\n) {\n if (config.rules?.[\"table-resizable-required\"] !== \"off\") {\n const usesTablePrimitivesWithoutTable = (usesColumnHeader || usesResizeDivider || usesResizableHook) && !hasTable;\n if (usesTablePrimitivesWithoutTable) {\n addViolation(\n filePath,\n 1,\n 1,\n \"table-resizable-required\",\n \"Ad-hoc div table detected. Constructing custom data grids without using the official '<Table>' suite is prohibited. Use <Table>, <TableHeader>, <TableHead>, <TableBody>, <TableRow>, and <TableCell>.\",\n \"\"\n );\n }\n }\n\n if (hasTable && config.rules?.[\"table-single-border\"] !== \"off\") {\n if (/<div\\b[^>]*\\b(?:border\\b|border-stroke|border-neutral)\\b[^>]*>\\s*<Table\\b/.test(content)) {\n addViolation(\n filePath,\n 1,\n 1,\n \"table-single-border\",\n \"Redundant outer border wrapper detected immediately surrounding '<Table>'. The '<Table>' component natively provides the official standard container. Remove redundant outer border wrapper.\",\n \"\"\n );\n }\n }\n\n if (hasTable && config.rules?.[\"table-windowed-pagination\"] !== \"off\") {\n const normFilePath = filePath.replace(/\\\\/g, \"/\");\n const isExcludedFromPagination =\n normFilePath.includes(\"components/ui/table.tsx\") ||\n normFilePath.includes(\"components/settings/\") ||\n normFilePath.includes(\"app/(dashboard)/settings\") ||\n normFilePath.includes(\"lead-import-modal.tsx\") ||\n content.includes(\"dse-ignore-pagination\");\n\n if (!isExcludedFromPagination) {\n const hasPagination =\n /paginate|safe[A-Z0-9_]*Page|currentPage|leadPage|sessionPage|campPage|total[A-Z0-9_]*Pages|pageSize|Dropdown[^>]*options=.*(?:10|25|50|100)/i.test(content) ||\n /Showing\\s+[\\s\\S]*?\\bto\\b[\\s\\S]*?\\bof\\b/i.test(content);\n\n if (!hasPagination) {\n addViolation(\n filePath,\n 1,\n 1,\n \"table-windowed-pagination\",\n \"Data table in '<Table>' is missing windowed pagination controls. Tables rendering collections must support pagination with page size selector, Previous/Next buttons, and range indicator.\",\n \"\"\n );\n }\n }\n }\n}\n\nfunction checkTabsElement(\n attributes: Record<string, any>,\n pos: { line: number; col: number },\n filePath: string,\n addViolation: AddViolationFn,\n lineSnippet: string,\n fileImports: Record<string, string>\n) {\n const normPath = filePath.replace(/\\\\/g, \"/\");\n if (normPath.endsWith(\"components/ui/tabs.tsx\")) return;\n\n if (!attributes.items) {\n addViolation(\n filePath,\n pos.line,\n pos.col,\n \"tabs-component-required\",\n \"<Tabs> is missing mandatory 'items' prop. All Tabs components must provide an array of items [{ id, label, icon?, badge?, count?, disabled? }].\",\n lineSnippet\n );\n }\n}\n\nfunction checkPseudoChips(\n tagName: string,\n attributes: Record<string, any>,\n pos: { line: number; col: number },\n filePath: string,\n addViolation: AddViolationFn,\n lineSnippet: string,\n sourceFile: ts.SourceFile\n) {\n const normPath = filePath.replace(/\\\\/g, \"/\");\n if (normPath.endsWith(\"components/ui/chip.tsx\") || normPath.endsWith(\"components/ui/badge.tsx\")) return;\n\n if (!attributes.className) return;\n\n const classStrings = extractClassNames(attributes.className.initializer, sourceFile);\n classStrings.forEach(({ text }) => {\n const tokens = text.split(/\\s+/);\n const hasStaticBg = tokens.some((t) => /^(?:dark:)?bg-(?:neutral|emerald|amber|red|blue)-\\d+/.test(t));\n const hasRadius = tokens.some((t) => /^(?:rounded-md|rounded-full)$/.test(t));\n const hasPadding = tokens.some((t) => /^(?:px-(?:1|1\\.5|2|2\\.5|3)|p-(?:0\\.5|1))$/.test(t));\n\n if (hasStaticBg && hasRadius && hasPadding && !lineSnippet.includes(\"dse-ignore-chip\")) {\n addViolation(\n filePath,\n pos.line,\n pos.col,\n \"no-pseudo-chips\",\n `Pseudo-chip detected on '<${tagName}>'. Never use raw <span> or <div> elements styled with background fills and rounded corners to emulate chips. Use the standard '<Chip>' component.`,\n lineSnippet\n );\n }\n });\n}\n\nfunction checkElementClasses(\n node: ts.Node,\n tagName: string,\n attributes: Record<string, any>,\n pos: { line: number; col: number },\n filePath: string,\n addViolation: AddViolationFn,\n sourceFile: ts.SourceFile,\n config: DseConfig\n) {\n if (!attributes.className) return;\n\n const isButton = [\"Button\", \"IconButton\", \"ButtonyIcon\", \"FloatingActionButton\"].includes(tagName);\n const isChip = [\"Chip\", \"Badge\", \"Tag\", \"StatusBadge\"].includes(tagName);\n const isTab = [\"Tab\", \"TabTrigger\", \"TabsTrigger\"].includes(tagName);\n const isCompactElement = isButton || isChip || isTab;\n\n const isCheckbox =\n\n tagName === \"Checkbox\" ||\n attributes.type?.initializer?.getText(sourceFile)?.includes(\"checkbox\") ||\n attributes.role?.initializer?.getText(sourceFile)?.includes(\"checkbox\") ||\n Boolean(attributes[\"aria-checked\"]) ||\n (attributes.className && /\\b(?:size-5|w-5\\s+h-5)\\b/.test(attributes.className.rawText));\n\n const lineSnippet = sourceFile.getFullText().split(\"\\n\")[pos.line - 1] || \"\";\n const classStrings = extractClassNames(attributes.className.initializer, sourceFile);\n\n classStrings.forEach(({ text, node: stringNode }) => {\n const tokens = splitClassString(text);\n tokens.forEach((rawToken) => {\n const dec = decomposeToken(rawToken);\n if (!dec) return;\n\n const nodePos = stringNode ? getNodePosition(sourceFile, stringNode) : pos;\n\n // Typography checks\n const typoViolations = evaluateTypographyToken(dec.core, config.tokens?.typography);\n typoViolations.forEach((v) => {\n if (config.rules?.[v.rule as keyof typeof config.rules] !== \"off\") {\n addViolation(filePath, nodePos.line, nodePos.col, v.rule, v.message, lineSnippet);\n }\n });\n\n // Geometry checks\n const geoViolations = evaluateGeometryToken(dec.core, config.tokens?.geometry, isCheckbox);\n geoViolations.forEach((v) => {\n if (config.rules?.[v.rule as keyof typeof config.rules] !== \"off\") {\n addViolation(filePath, nodePos.line, nodePos.col, v.rule, v.message, lineSnippet);\n }\n });\n\n // Color checks\n const colorViolations = evaluateColorToken(dec.core, config.tokens?.colors);\n colorViolations.forEach((v) => {\n if (config.rules?.[v.rule as keyof typeof config.rules] !== \"off\") {\n addViolation(filePath, nodePos.line, nodePos.col, v.rule, v.message, lineSnippet);\n }\n });\n\n // Control height check (Buttons, Controls)\n if (isButton && config.rules?.[\"control-height-max\"] !== \"off\") {\n if (/\\bh-(?:10|11|12|14|16|\\[(?:3[8-9]|[4-9][0-9]|[1-9][0-9]{2,})px\\])\\b/.test(dec.core)) {\n addViolation(\n filePath,\n nodePos.line,\n nodePos.col,\n \"control-height-max\",\n `Disallowed button height '${dec.core}'. Interactive buttons and controls must standardise on max 36px height ('h-[36px]' or 'h-9').`,\n lineSnippet\n );\n }\n }\n\n // Disallow multi-line text wrapping on compact controls (Buttons, Chips, Badges, Tabs)\n if (isCompactElement && config.rules?.[\"no-wrapping-compact-elements\"] !== \"off\") {\n if (dec.core === \"flex-wrap\" || dec.core === \"whitespace-normal\" || dec.core === \"whitespace-pre-wrap\") {\n addViolation(\n filePath,\n nodePos.line,\n nodePos.col,\n \"no-wrapping-compact-elements\",\n `Disallowed text wrapping class '${dec.core}' on <${tagName}>. Compact interactive elements (buttons, chips, badges, tabs) must never wrap text across multiple lines.`,\n lineSnippet\n );\n }\n }\n });\n });\n\n // TableHead wrap check\n if (tagName === \"TableHead\" && config.rules?.[\"no-wrapping-compact-elements\"] !== \"off\") {\n const rawClass = attributes.className?.rawText || \"\";\n if (/\\b(?:flex-wrap|whitespace-normal|whitespace-pre-wrap)\\b/.test(rawClass)) {\n addViolation(\n filePath,\n pos.line,\n pos.col,\n \"no-wrapping-compact-elements\",\n `Disallowed text wrapping on <TableHead>. Column headers must remain single-line ('whitespace-nowrap') to preserve table column alignment.`,\n lineSnippet\n );\n }\n }\n}\n","import type { TypographyConfig, GeometryConfig, ColorsConfig } from \"../config/types.js\";\n\nexport interface DecomposedToken {\n raw: string;\n core: string;\n variants: string[];\n}\n\nexport interface TokenViolation {\n rule: string;\n message: string;\n}\n\n/**\n * Splits a class string (including multiline whitespace) into distinct token strings.\n */\nexport function splitClassString(str?: string | null): string[] {\n if (!str || typeof str !== \"string\") return [];\n return str.split(/\\s+/).filter(Boolean);\n}\n\n/**\n * Decomposes a Tailwind token into variants and core token.\n * e.g. \"hover:focus:md:text-xs\" -> { variants: [\"hover\", \"focus\", \"md\"], core: \"text-xs\" }\n */\nexport function decomposeToken(rawToken?: string | null): DecomposedToken | null {\n if (!rawToken || typeof rawToken !== \"string\") return null;\n\n const parts: string[] = [];\n let bracketDepth = 0;\n let current = \"\";\n\n for (let i = 0; i < rawToken.length; i++) {\n const char = rawToken[i];\n if (char === \"[\" || char === \"(\") {\n bracketDepth++;\n current += char;\n } else if (char === \"]\" || char === \")\") {\n bracketDepth = Math.max(0, bracketDepth - 1);\n current += char;\n } else if (char === \":\" && bracketDepth === 0) {\n parts.push(current);\n current = \"\";\n } else {\n current += char;\n }\n }\n if (current) parts.push(current);\n\n const core = parts.pop() || \"\";\n const variants = parts;\n\n return { raw: rawToken, core, variants };\n}\n\n/**\n * Checks a core token for typography violations.\n */\nexport function evaluateTypographyToken(core: string, config?: TypographyConfig): TokenViolation[] {\n const violations: TokenViolation[] = [];\n const minFont = config?.minFontSize || \"14px\";\n const maxFont = config?.maxFontSize || \"32px\";\n const maxWeight = config?.maxFontWeight ?? 500;\n const disallowArbitrary = config?.disallowArbitrarySizes ?? true;\n const disallowUppercase = config?.disallowUppercase ?? true;\n\n // 1. Font size < 14px (or configured min)\n if (/^text-(?:xs|2xs)$/.test(core)) {\n violations.push({\n rule: \"font-size-min\",\n message: `Disallowed font size '${core}' is smaller than ${minFont}. Primary body font must strictly be standard ${minFont} ('text-sm').`,\n });\n }\n\n // 2. Arbitrary bracket sizes: text-[...]\n const arbitrarySizeMatch = core.match(/^text-\\[(\\d+(?:\\.\\d+)?)(px|rem|em)\\]$/);\n if (arbitrarySizeMatch) {\n const num = parseFloat(arbitrarySizeMatch[1]);\n const unit = arbitrarySizeMatch[2];\n const pxVal = unit === \"rem\" || unit === \"em\" ? num * 16 : num;\n\n if (pxVal < 14) {\n violations.push({\n rule: \"font-size-min\",\n message: `Disallowed arbitrary font size '${core}' (${pxVal}px) is below minimum allowed size (${minFont}).`,\n });\n } else if (pxVal > 32) {\n violations.push({\n rule: \"font-size-max\",\n message: `Disallowed arbitrary font size '${core}' (${pxVal}px) exceeds maximum allowed heading size (${maxFont}).`,\n });\n } else if (disallowArbitrary) {\n violations.push({\n rule: \"no-arbitrary-text-size\",\n message: `Arbitrary font size '${core}' is prohibited. Use standard typography tokens ('text-sm', 'text-base', 'text-lg', 'text-xl', 'text-2xl').`,\n });\n }\n }\n\n // 3. Font sizes exceeding 32px\n if (/^text-(?:3xl|4xl|5xl|6xl|7xl|8xl|9xl)$/.test(core)) {\n violations.push({\n rule: \"font-size-max\",\n message: `Disallowed font size '${core}' exceeds maximum allowed heading cap of ${maxFont}.`,\n });\n }\n\n // 4. Font weight exceeding Medium (500)\n if (maxWeight <= 500) {\n if (/^font-(?:semibold|bold|extrabold|black)$/.test(core)) {\n violations.push({\n rule: \"font-weight-max\",\n message: `Disallowed font weight '${core}' exceeds maximum allowed weight (500 / Medium).`,\n });\n }\n const arbitraryWeightMatch = core.match(/^font-\\[(\\d+)\\]$/);\n if (arbitraryWeightMatch) {\n const weight = parseInt(arbitraryWeightMatch[1], 10);\n if (weight > maxWeight) {\n violations.push({\n rule: \"font-weight-max\",\n message: `Disallowed arbitrary font weight '${core}' (${weight}) exceeds maximum allowed weight (${maxWeight} / Medium).`,\n });\n }\n }\n }\n\n // 5. Uppercase text transformation\n if (disallowUppercase && core === \"uppercase\") {\n violations.push({\n rule: \"no-uppercase-text\",\n message: `CSS text transformation '${core}' is disallowed. Use standard sentence case or title case.`,\n });\n }\n\n return violations;\n}\n\n/**\n * Checks a core token for geometry & corner radius violations.\n */\nexport function evaluateGeometryToken(core: string, config?: GeometryConfig, isCheckbox = false): TokenViolation[] {\n const violations: TokenViolation[] = [];\n const allowedRadii = new Set(config?.allowedRadii || [\"0\", \"0px\", \"8px\", \"12px\", \"16px\", \"9999px\", \"100%\"]);\n const checkboxRadii = new Set(config?.radiiExceptions?.Checkbox || [\"0\", \"0px\", \"4px\", \"0.25rem\", \"8px\", \"12px\", \"16px\", \"9999px\", \"100%\"]);\n\n // Standard corner radius classes\n if (/^rounded(?:-(?:xs|sm|md|lg|xl|2xl|3xl|none|full))?$/.test(core)) {\n if (core === \"rounded-xs\" || core === \"rounded\") {\n if (!isCheckbox) {\n violations.push({\n rule: \"corner-radius-allowed\",\n message: `4px corner radius ('${core}') is strictly reserved for checkboxes only. Standard components must use 'rounded-md' (8px) or 'rounded-lg' (12px).`,\n });\n }\n } else if (core === \"rounded-2xl\" || core === \"rounded-3xl\") {\n violations.push({\n rule: \"corner-radius-allowed\",\n message: `Oversized corner radius '${core}' is disallowed. Standard components must use 'rounded-md' (8px) or 'rounded-lg' (12px).`,\n });\n }\n }\n\n // Arbitrary radius: rounded-[...]\n const radiusMatch = core.match(/^rounded(?:-[trblse])?-\\[([^\\]]+)\\]$/);\n if (radiusMatch) {\n const val = radiusMatch[1].trim();\n const effectiveSet = isCheckbox ? checkboxRadii : allowedRadii;\n if (!effectiveSet.has(val)) {\n violations.push({\n rule: \"corner-radius-allowed\",\n message: `Disallowed arbitrary corner radius '${core}' (${val}). Allowed values: ${Array.from(effectiveSet).join(\", \")}.`,\n });\n }\n }\n\n return violations;\n}\n\n/**\n * Checks a core token for color palette violations.\n */\nexport function evaluateColorToken(core: string, config?: ColorsConfig): TokenViolation[] {\n const violations: TokenViolation[] = [];\n const bannedFamilies = new Set(config?.bannedColorFamilies || []);\n\n if (bannedFamilies.size > 0) {\n // Matches bg-purple-500, text-indigo-600, border-violet-400, from-purple-600, to-indigo-600, via-pink-500\n const colorMatch = core.match(/^(?:bg|text|border|ring|stroke|fill|from|to|via)-([a-z]+)-[0-9]{2,3}$/);\n if (colorMatch) {\n const family = colorMatch[1];\n if (bannedFamilies.has(family)) {\n violations.push({\n rule: \"no-banned-colors\",\n message: `Disallowed off-palette color class '${core}'. Color family '${family}' (purple, indigo, violet, etc.) is not permitted in our design system.`,\n });\n }\n }\n }\n\n // Cheesy AI Gradient Checks\n if (config?.disallowSaturatedGradients) {\n if (core === \"bg-clip-text\" || core === \"text-transparent\") {\n violations.push({\n rule: \"no-unapproved-gradients\",\n message: `Gradient text styling '${core}' detected. Cheesy AI gradient text is prohibited. Use standard high-contrast text typography.`,\n });\n }\n }\n\n return violations;\n}\n","import type { DseConfig } from \"../config/types.js\";\nimport type { AddViolationFn } from \"./types.js\";\n\nexport function runRegexRules(\n content: string,\n filePath: string,\n addViolation: AddViolationFn,\n config: DseConfig\n): void {\n const lines = content.split(\"\\n\");\n // Only match actual Unicode arrows and ASCII arrows like -> or <-, NOT JS arrow functions '=>'\n const unicodeArrowRegex = /[\\u2190-\\u2199\\u21D0-\\u21D9\\u2794-\\u27BF\\u21B0-\\u21B5\\u27F5-\\u27FF]|(?:->|<-)/gu;\n const hexColorRegex = /#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})\\b/g;\n const backdropBlurRegex = /\\bbackdrop-blur(?:-[a-z0-9]+)?\\b/g;\n\n // Track button tags across lines\n let inButtonTag = false;\n const disallowedButtonColorRegex = /(?:bg-(?:emerald|green|red|amber|rose|pink|purple|indigo)-[0-9]{2,3}|border-(?:emerald|green|red|amber|rose|pink|purple|indigo)-[0-9]{2,3})\\b|variant=[\"'](?:danger|success|warning|error)[\"']/g;\n const buttonOpenRegex = /<(?:Button|IconButton|FloatingActionButton|ButtonyIcon)\\b/g;\n const buttonCloseRegex = /<\\/(?:Button|IconButton|FloatingActionButton|ButtonyIcon)>/g;\n const buttonSelfCloseRegex = /<(?:Button|IconButton|FloatingActionButton|ButtonyIcon)\\b[^>]*\\/>/g;\n\n lines.forEach((line, idx) => {\n const lineNum = idx + 1;\n const trimmed = line.trim();\n\n if (\n line.includes(\"dse-ignore\") ||\n trimmed.startsWith(\"//\") ||\n trimmed.startsWith(\"/*\") ||\n trimmed.startsWith(\"*\") ||\n trimmed.startsWith(\"<!--\")\n ) {\n return;\n }\n\n // Strip inline comments before regex checks so comments like /* White (#ffffff) */ or <!-- ... --> are never flagged\n const codeOnlyLine = line\n .replace(/<!--[\\s\\S]*?-->/g, \"\")\n .replace(/\\/\\*[\\s\\S]*?\\*\\//g, \"\")\n .replace(/\\/\\/.*$/, \"\");\n\n // 1. Arrow symbols\n if (config.rules?.[\"no-text-arrows\"] !== \"off\") {\n unicodeArrowRegex.lastIndex = 0;\n let match: RegExpExecArray | null;\n while ((match = unicodeArrowRegex.exec(codeOnlyLine)) !== null) {\n addViolation(\n filePath,\n lineNum,\n match.index + 1,\n \"no-text-arrows\",\n `Raw text/ASCII arrow '${match[0]}' detected. Disallowed in UI; use design system icon components instead.`,\n line\n );\n }\n }\n\n // 2. Backdrop blur\n if (config.rules?.[\"no-backdrop-blur\"] !== \"off\") {\n // Don't flag rule config names like \"no-backdrop-blur\"\n if (!codeOnlyLine.includes(\"no-backdrop-blur\")) {\n backdropBlurRegex.lastIndex = 0;\n let match: RegExpExecArray | null;\n while ((match = backdropBlurRegex.exec(codeOnlyLine)) !== null) {\n addViolation(\n filePath,\n lineNum,\n match.index + 1,\n \"no-backdrop-blur\",\n `Disallowed backdrop blur '${match[0]}' detected. Backdrop blur is prohibited across the design system.`,\n line\n );\n }\n }\n }\n\n // 3. Raw hex colors\n if (config.rules?.[\"no-raw-hex-colors\"] !== \"off\") {\n hexColorRegex.lastIndex = 0;\n let match: RegExpExecArray | null;\n while ((match = hexColorRegex.exec(codeOnlyLine)) !== null) {\n const hex = match[0];\n // Allow pure black/white if explicitly permitted or in SVG data\n if (!codeOnlyLine.includes(\"svg\") && !codeOnlyLine.includes(\"xmlns\")) {\n addViolation(\n filePath,\n lineNum,\n match.index + 1,\n \"no-raw-hex-colors\",\n `Raw hex color '${hex}' detected. Use theme tokens or CSS variables instead of hardcoded hex values.`,\n line\n );\n }\n }\n }\n\n // 4. Button chip colors across multi-line tags\n if (config.rules?.[\"no-chip-colored-buttons\"] !== \"off\") {\n buttonOpenRegex.lastIndex = 0;\n if (buttonOpenRegex.test(line)) {\n inButtonTag = true;\n }\n\n if (inButtonTag) {\n disallowedButtonColorRegex.lastIndex = 0;\n let match: RegExpExecArray | null;\n while ((match = disallowedButtonColorRegex.exec(line)) !== null) {\n if (!line.includes(\"dse-ignore-button-color\")) {\n addViolation(\n filePath,\n lineNum,\n match.index + 1,\n \"no-chip-colored-buttons\",\n `Disallowed chip color '${match[0]}' applied to Button. Buttons must never use semantic chip colors.`,\n line\n );\n }\n }\n\n buttonCloseRegex.lastIndex = 0;\n buttonSelfCloseRegex.lastIndex = 0;\n if (buttonCloseRegex.test(line) || buttonSelfCloseRegex.test(line) || line.includes(\">\")) {\n inButtonTag = false;\n }\n }\n }\n });\n}\n","import type { DseConfig } from \"../config/types.js\";\nimport type { AddViolationFn } from \"./types.js\";\n\nfunction isInsidePythonString(line: string, index: number): boolean {\n let inSingle = false;\n let inDouble = false;\n for (let i = 0; i < index; i++) {\n const char = line[i];\n if (char === \"\\\\\") {\n i++;\n continue;\n }\n if (char === \"'\" && !inDouble) inSingle = !inSingle;\n if (char === '\"' && !inSingle) inDouble = !inDouble;\n }\n return inSingle || inDouble;\n}\n\n/**\n * Rules engine specifically adapted for Python (.py), HTML (.html, .jinja), and CSS (.css) files.\n */\nexport function runPythonRules(\n content: string,\n filePath: string,\n addViolation: AddViolationFn,\n config: DseConfig\n): void {\n const lines = content.split(\"\\n\");\n const isPython = filePath.endsWith(\".py\");\n const isCssOrHtml = filePath.endsWith(\".css\") || filePath.endsWith(\".html\") || filePath.endsWith(\".jinja\") || filePath.endsWith(\".jinja2\");\n\n const unicodeArrowRegex = /[\\u2190-\\u2199\\u21D0-\\u21D9\\u2794-\\u27BF\\u21B0-\\u21B5\\u27F5-\\u27FF]|(?:->|<-)/gu;\n const hexColorRegex = /#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})\\b/g;\n\n // Track if we are inside a CSS block or multiline string\n let inStyleBlock = false;\n\n lines.forEach((line, idx) => {\n const lineNum = idx + 1;\n const trimmed = line.trim();\n\n // Check ignore comments\n if (line.includes(\"dse-ignore\") || trimmed.startsWith(\"#\") || trimmed.startsWith(\"//\") || trimmed.startsWith(\"/*\")) {\n return;\n }\n\n // Strip inline comments before checks so #ff0000 in python comments or /* #fff */ is ignored\n const codeOnlyLine = isPython\n ? line.replace(/#.*$/, \"\")\n : line.replace(/\\/\\*[\\s\\S]*?\\*\\//g, \"\").replace(/\\/\\/.*$/, \"\");\n\n // Track <style> blocks (e.g. in Streamlit st.markdown(\"\"\"<style>...\"\"\") or HTML)\n if (line.includes(\"<style>\")) inStyleBlock = true;\n if (line.includes(\"</style>\")) inStyleBlock = false;\n\n // 1. Text Arrow Check\n if (config.rules?.[\"no-text-arrows\"] !== \"off\") {\n unicodeArrowRegex.lastIndex = 0;\n let match: RegExpExecArray | null;\n while ((match = unicodeArrowRegex.exec(codeOnlyLine)) !== null) {\n const arrow = match[0];\n\n // In Python files, '->' outside string literals is ALWAYS a function return type hint:\n // e.g. def foo() -> int:, ) -> list:, ) -> Groq:, Callable[..., Any] -> None\n if (isPython && arrow === \"->\" && !isInsidePythonString(line, match.index)) {\n continue; // Skip Python type annotations\n }\n\n // Only check arrows inside strings or UI copy\n addViolation(\n filePath,\n lineNum,\n match.index + 1,\n \"no-text-arrows\",\n `Raw text arrow '${arrow}' detected. Use design system icon components instead of raw arrows.`,\n line\n );\n }\n }\n\n // 2. CSS Invariant Checks (inside <style> blocks or .css files)\n if (inStyleBlock || isCssOrHtml) {\n // Font size checks: font-size: 11px\n const fontSizeMatch = line.match(/font-size\\s*:\\s*(\\d+(?:\\.\\d+)?)(px|rem)/i);\n if (fontSizeMatch) {\n const val = parseFloat(fontSizeMatch[1]);\n const unit = fontSizeMatch[2].toLowerCase();\n const px = unit === \"rem\" ? val * 16 : val;\n\n if (px < 14 && config.rules?.[\"font-size-min\"] !== \"off\") {\n addViolation(\n filePath,\n lineNum,\n fontSizeMatch.index || 1,\n \"font-size-min\",\n `Disallowed font-size '${fontSizeMatch[0]}' (${px}px) is smaller than 14px. Primary body font must strictly be standard 14px.`,\n line\n );\n } else if (px > 32 && config.rules?.[\"font-size-max\"] !== \"off\") {\n addViolation(\n filePath,\n lineNum,\n fontSizeMatch.index || 1,\n \"font-size-max\",\n `Disallowed font-size '${fontSizeMatch[0]}' (${px}px) exceeds maximum allowed heading cap of 32px.`,\n line\n );\n }\n }\n\n // Font weight checks: font-weight: 600 / bold\n const fontWeightMatch = line.match(/font-weight\\s*:\\s*([0-9]{3}|bold|bolder|semibold)/i);\n if (fontWeightMatch && config.rules?.[\"font-weight-max\"] !== \"off\") {\n const rawWeight = fontWeightMatch[1].toLowerCase();\n const weightNum = parseInt(rawWeight, 10);\n if (weightNum > 500 || [\"bold\", \"bolder\", \"semibold\"].includes(rawWeight)) {\n addViolation(\n filePath,\n lineNum,\n fontWeightMatch.index || 1,\n \"font-weight-max\",\n `Disallowed font-weight '${fontWeightMatch[0]}'. Font weight must not exceed Medium (500).`,\n line\n );\n }\n }\n\n // Backdrop blur\n if (config.rules?.[\"no-backdrop-blur\"] !== \"off\" && /backdrop-filter\\s*:\\s*blur/i.test(line)) {\n addViolation(\n filePath,\n lineNum,\n 1,\n \"no-backdrop-blur\",\n \"Disallowed backdrop blur filter detected in styles. Backdrop blur is prohibited across the design system.\",\n line\n );\n }\n }\n\n // 3. Raw Hex Color checks (in styling contexts or UI definitions)\n if (config.rules?.[\"no-raw-hex-colors\"] !== \"off\") {\n hexColorRegex.lastIndex = 0;\n let match: RegExpExecArray | null;\n while ((match = hexColorRegex.exec(line)) !== null) {\n const hex = match[0];\n // Flag hex colors in styling, CSS, or UI color definitions\n if (inStyleBlock || isCssOrHtml || /(?:color|background|bg|border|fill|stroke|theme)\\s*[:=]/i.test(line)) {\n addViolation(\n filePath,\n lineNum,\n match.index + 1,\n \"no-raw-hex-colors\",\n `Raw hex color '${hex}' detected. Centralize theme colors in configuration or CSS variables instead of hardcoded hex values.`,\n line\n );\n }\n }\n }\n });\n}\n\n","import pc from \"picocolors\";\nimport type { ScanResult } from \"../config/types.js\";\n\nexport function formatStylish(result: ScanResult): string {\n const output: string[] = [];\n\n output.push(\"\");\n output.push(pc.bold(pc.cyan(\"========================================================\")));\n output.push(pc.bold(pc.cyan(\" DESIGN SYSTEM ENFORCER (DSE) - SCAN REPORT \")));\n output.push(pc.bold(pc.cyan(\"========================================================\")));\n output.push(`Scanned ${pc.bold(result.scannedFilesCount)} files.`);\n output.push(\"\");\n\n // Component Inventory\n if (Object.keys(result.componentInventory).length > 0) {\n output.push(pc.bold(pc.dim(\"--- Design System Components Inventory ---\")));\n for (const [name, info] of Object.entries(result.componentInventory)) {\n const paddedName = `<${name}`.padEnd(22) + \">\";\n if (info.active) {\n output.push(` • ${pc.white(paddedName)} : ${pc.green(\"✔ active\")} (${info.fileCount} files)`);\n } else {\n output.push(` • ${pc.white(paddedName)} : ${pc.red(\"✖ UNUSED / DEAD COMPONENT\")}`);\n }\n }\n output.push(\"\");\n }\n\n // Violations grouped by file\n if (result.violations.length > 0) {\n output.push(pc.bold(pc.red(`Found ${result.errorCount} error(s) and ${result.warningCount} warning(s):`)));\n output.push(\"\");\n\n const grouped: Record<string, typeof result.violations> = {};\n for (const v of result.violations) {\n if (!grouped[v.file]) grouped[v.file] = [];\n grouped[v.file].push(v);\n }\n\n for (const [file, items] of Object.entries(grouped)) {\n output.push(pc.underline(pc.bold(file)));\n for (const item of items) {\n const badge = item.severity === \"error\" ? pc.red(\"error\") : pc.yellow(\"warning\");\n output.push(\n ` ${pc.dim(`${item.line}:${item.col}`)} ${badge} ${item.message} ${pc.dim(`(${item.rule})`)}`\n );\n if (item.snippet) {\n output.push(` ${pc.dim(\">\")} ${pc.italic(item.snippet)}`);\n }\n }\n output.push(\"\");\n }\n\n output.push(\n pc.bold(\n pc.red(\n `✖ Failed with ${result.errorCount} error(s). Please resolve all Design System Enforcer violations before committing or deploying.`\n )\n )\n );\n } else {\n output.push(pc.bold(pc.green(\"✔ PERFECT! All files strictly comply with the Design System Enforcer rules.\")));\n }\n\n output.push(\"\");\n return output.join(\"\\n\");\n}\n\n","import type { ScanResult } from \"../config/types.js\";\n\nexport function formatJson(result: ScanResult): string {\n return JSON.stringify(result, null, 2);\n}\n\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport pc from \"picocolors\";\nimport { tokensTemplate } from \"./templates/tokens.js\";\nimport { cssTemplate } from \"./templates/css.js\";\nimport {\n buttonTemplate,\n chipTemplate,\n inputTemplate,\n dropdownTemplate,\n tableTemplate,\n tabsTemplate,\n cardTemplate,\n checkboxTemplate,\n skeletonTemplate,\n} from \"./templates/components.js\";\n\nexport const COMPONENT_TEMPLATES: Record<string, { filename: string; content: string }> = {\n button: { filename: \"button.tsx\", content: buttonTemplate },\n chip: { filename: \"chip.tsx\", content: chipTemplate },\n badge: { filename: \"badge.tsx\", content: chipTemplate },\n input: { filename: \"input.tsx\", content: inputTemplate },\n dropdown: { filename: \"dropdown.tsx\", content: dropdownTemplate },\n table: { filename: \"table.tsx\", content: tableTemplate },\n tabs: { filename: \"tabs.tsx\", content: tabsTemplate },\n card: { filename: \"card.tsx\", content: cardTemplate },\n checkbox: { filename: \"checkbox.tsx\", content: checkboxTemplate },\n skeleton: { filename: \"skeleton.tsx\", content: skeletonTemplate },\n};\n\nexport function scaffoldConfig(cwd = process.cwd(), preset = \"berserk\"): string {\n if (preset === \"python\") {\n const jsonPath = path.resolve(cwd, \"dse.config.json\");\n if (fs.existsSync(jsonPath)) return jsonPath;\n\n const content = JSON.stringify(\n {\n preset: \"python\",\n targetDir: \".\",\n include: [\"**/*.{py,html,jinja,jinja2,css}\"],\n exclude: [\n \"**/.venv/**\",\n \"**/venv/**\",\n \"**/__pycache__/**\",\n \"**/.pytest_cache/**\",\n \"**/.git/**\",\n ],\n },\n null,\n 2\n ) + \"\\n\";\n fs.writeFileSync(jsonPath, content, \"utf-8\");\n return jsonPath;\n }\n\n const configPath = path.resolve(cwd, \"dse.config.js\");\n if (fs.existsSync(configPath)) {\n return configPath;\n }\n\n const content = `import { defineConfig } from \"design-system-enforcer\";\n\nexport default defineConfig({\n preset: \"${preset}\",\n targetDir: \"src\",\n include: [\"**/*.{tsx,jsx,ts,js}\"],\n exclude: [\n \"**/node_modules/**\",\n \"**/.next/**\",\n \"**/public/**\",\n \"**/.git/**\",\n \"src/lib/tokens.ts\",\n \"src/app/globals.css\",\n \"src/components/ui/button.tsx\",\n \"src/components/ui/chip.tsx\",\n \"src/components/ui/card.tsx\",\n \"src/components/ui/input.tsx\",\n \"src/components/ui/table.tsx\",\n \"src/components/ui/tabs.tsx\",\n \"src/components/ui/dropdown.tsx\",\n \"src/components/ui/checkbox.tsx\",\n \"src/components/ui/skeleton.tsx\",\n ],\n});\n`;\n\n fs.writeFileSync(configPath, content, \"utf-8\");\n return configPath;\n}\n\nexport function scaffoldTokens(cwd = process.cwd()): { tokensPath: string; cssPath: string } {\n const libDir = path.resolve(cwd, \"src/lib\");\n const appDir = path.resolve(cwd, \"src/app\");\n\n if (!fs.existsSync(libDir)) fs.mkdirSync(libDir, { recursive: true });\n if (!fs.existsSync(appDir)) fs.mkdirSync(appDir, { recursive: true });\n\n const tokensPath = path.join(libDir, \"tokens.ts\");\n if (!fs.existsSync(tokensPath)) {\n fs.writeFileSync(tokensPath, tokensTemplate, \"utf-8\");\n }\n\n const cssPath = path.join(appDir, \"globals.css\");\n if (!fs.existsSync(cssPath)) {\n fs.writeFileSync(cssPath, cssTemplate, \"utf-8\");\n }\n\n return { tokensPath, cssPath };\n}\n\nexport function scaffoldComponent(componentName: string, cwd = process.cwd()): string | null {\n const key = componentName.toLowerCase();\n const template = COMPONENT_TEMPLATES[key];\n if (!template) {\n return null;\n }\n\n const uiDir = path.resolve(cwd, \"src/components/ui\");\n if (!fs.existsSync(uiDir)) {\n fs.mkdirSync(uiDir, { recursive: true });\n }\n\n const targetPath = path.join(uiDir, template.filename);\n if (!fs.existsSync(targetPath)) {\n fs.writeFileSync(targetPath, template.content, \"utf-8\");\n }\n return targetPath;\n}\n\nexport function scaffoldAllPrimitives(cwd = process.cwd()): string[] {\n const created: string[] = [];\n const { tokensPath, cssPath } = scaffoldTokens(cwd);\n created.push(tokensPath, cssPath);\n\n for (const name of Object.keys(COMPONENT_TEMPLATES)) {\n const filePath = scaffoldComponent(name, cwd);\n if (filePath && !created.includes(filePath)) {\n created.push(filePath);\n }\n }\n\n return created;\n}\n\n","export const tokensTemplate = `/**\n * Design System Tokens\n * All colors are driven by CSS variables in HSL format for instant theme customization.\n * AI Agents or developers can update these values in globals.css.\n */\n\nexport const typographyTokens = {\n fontFamily: {\n sans: [\"var(--font-sans)\", \"system-ui\", \"-apple-system\", \"sans-serif\"],\n mono: [\"var(--font-mono)\", \"monospace\"],\n },\n fontSize: {\n xs: \"12px\",\n sm: \"14px\", // Primary body font standard\n base: \"16px\", // Large body font\n lg: \"18px\",\n xl: \"20px\",\n \"2xl\": \"24px\",\n \"3xl\": \"30px\", // Maximum heading cap\n },\n fontWeight: {\n regular: \"400\",\n medium: \"500\", // Standard for buttons and interactive controls\n semibold: \"600\",\n },\n lineHeight: {\n tight: \"1.25\",\n snug: \"1.375\",\n normal: \"1.5\",\n relaxed: \"1.625\",\n },\n} as const;\n\nexport const geometryTokens = {\n radius: {\n none: \"0px\",\n checkbox: \"4px\", // Strictly 4px for checkboxes only\n sm: \"8px\",\n md: \"8px\", // Standard for buttons, inputs, dropdowns, tabs\n lg: \"12px\", // Standard for cards and modal containers\n xl: \"16px\",\n full: \"9999px\",\n },\n controlHeight: {\n sm: \"30px\",\n md: \"36px\", // Standard control height (buttons, inputs, tabs)\n lg: \"40px\",\n },\n checkboxSize: \"20px\", // Standard size-5\n} as const;\n`;\n\n","export const cssTemplate = `@tailwind base;\n@tailwind components;\n@tailwind utilities;\n\n@layer base {\n :root {\n /* -------------------------------------------------------------------------\n * Design System Color Tokens (HSL)\n * Tip for AI Agents: Modify HSL values here to rebrand or customize themes!\n * ------------------------------------------------------------------------- */\n --background: 0 0% 100%; /* White (#ffffff) */\n --foreground: 0 0% 11%; /* Text Primary (#1c1c1c) */\n\n --muted: 0 0% 96%; /* Neutral 100 (#f5f5f5) */\n --muted-foreground: 0 0% 45%; /* Text Secondary (#737373) */\n\n --border: 0 0% 90%; /* Stroke Default (#e5e5e5) */\n --input: 0 0% 90%; /* Input Stroke */\n\n --primary: 0 0% 9%; /* Brand Dark (#171717) */\n --primary-foreground: 0 0% 98%;\n\n --secondary: 0 0% 96%;\n --secondary-foreground: 0 0% 9%;\n\n --accent: 0 0% 96%;\n --accent-foreground: 0 0% 9%;\n\n /* Semantic Status Tokens */\n --success: 142 71% 45%; /* Emerald */\n --success-foreground: 0 0% 100%;\n\n --warning: 38 92% 50%; /* Amber */\n --warning-foreground: 0 0% 100%;\n\n --destructive: 0 84% 60%; /* Red */\n --destructive-foreground: 0 0% 100%;\n\n /* Geometry Tokens */\n --radius-sm: 8px;\n --radius-md: 8px; /* Standard 8px for controls */\n --radius-lg: 12px; /* Standard 12px for cards */\n --control-height: 36px; /* Standard 36px */\n }\n\n .dark {\n --background: 0 0% 9%;\n --foreground: 0 0% 98%;\n\n --muted: 0 0% 15%;\n --muted-foreground: 0 0% 64%;\n\n --border: 0 0% 20%;\n --input: 0 0% 20%;\n\n --primary: 0 0% 98%;\n --primary-foreground: 0 0% 9%;\n\n --secondary: 0 0% 15%;\n --secondary-foreground: 0 0% 98%;\n\n --accent: 0 0% 15%;\n --accent-foreground: 0 0% 98%;\n }\n\n body {\n background-color: hsl(var(--background));\n color: hsl(var(--foreground));\n font-size: 14px;\n line-height: 1.5;\n }\n}\n`;\n\n","export const buttonTemplate = `import React from \"react\";\n\nexport interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n variant?: \"primary\" | \"secondary\" | \"outline\" | \"ghost\";\n size?: \"default\" | \"sm\" | \"icon\";\n children?: React.ReactNode;\n}\n\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className = \"\", variant = \"primary\", size = \"default\", children, ...props }, ref) => {\n // Standard 36px height, 8px radius, font-medium, strictly neutral palette\n const baseClasses =\n \"inline-flex items-center justify-center font-medium text-sm rounded-md whitespace-nowrap shrink-0 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-neutral-400 disabled:pointer-events-none disabled:opacity-50 select-none cursor-pointer\";\n\n\n const variantClasses = {\n primary: \"bg-neutral-900 text-white hover:bg-neutral-800 shadow-2xs\",\n secondary: \"bg-neutral-100 text-neutral-900 hover:bg-neutral-200\",\n outline: \"border border-neutral-200 bg-white text-neutral-900 hover:bg-neutral-50 shadow-2xs\",\n ghost: \"text-neutral-700 hover:bg-neutral-100 hover:text-neutral-900\",\n }[variant];\n\n const sizeClasses = {\n default: \"h-[36px] min-h-[36px] px-3.5 gap-2\",\n sm: \"h-[30px] min-h-[30px] px-2.5 text-sm gap-1.5\",\n icon: \"size-9 min-h-[36px] min-w-[36px] p-0\",\n }[size];\n\n return (\n <button ref={ref} className={\\`\\${baseClasses} \\${variantClasses} \\${sizeClasses} \\${className}\\`} {...props}>\n {children}\n </button>\n );\n }\n);\nButton.displayName = \"Button\";\n`;\n\nexport const chipTemplate = `import React from \"react\";\n\nexport interface ChipProps extends React.HTMLAttributes<HTMLDivElement> {\n variant?: \"neutral\" | \"success\" | \"warning\" | \"error\" | \"outline\";\n icon?: React.ReactNode;\n children: React.ReactNode;\n}\n\nexport const Chip: React.FC<ChipProps> = ({\n variant = \"neutral\",\n icon,\n children,\n className = \"\",\n ...props\n}) => {\n // Standard 36px height, 8px radius, 14px typography\n const baseClasses =\n \"inline-flex items-center h-[36px] min-h-[36px] px-3 rounded-md text-sm font-medium whitespace-nowrap shrink-0 gap-1.5 select-none\";\n\n\n const variantClasses = {\n neutral: \"bg-neutral-100 text-neutral-800 border border-neutral-200\",\n success: \"bg-emerald-50 text-emerald-700 border border-emerald-200\",\n warning: \"bg-amber-50 text-amber-700 border border-amber-200\",\n error: \"bg-red-50 text-red-700 border border-red-200\",\n outline: \"bg-white text-neutral-700 border border-neutral-200\",\n }[variant];\n\n return (\n <div className={\\`\\${baseClasses} \\${variantClasses} \\${className}\\`} {...props}>\n {icon && <span className=\"shrink-0\">{icon}</span>}\n <span>{children}</span>\n </div>\n );\n};\n`;\n\nexport const inputTemplate = `import React from \"react\";\n\nexport interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {\n icon?: React.ReactNode;\n}\n\nexport const Input = React.forwardRef<HTMLInputElement, InputProps>(\n ({ className = \"\", icon, type = \"text\", ...props }, ref) => {\n return (\n <div className=\"relative flex items-center w-full\">\n {icon && <div className=\"absolute left-3 text-neutral-400 pointer-events-none\">{icon}</div>}\n <input\n ref={ref}\n type={type}\n className={\\`w-full h-[36px] min-h-[36px] \\${icon ? \"pl-9\" : \"px-3\"} pr-3 rounded-md border border-neutral-200 bg-white text-sm text-neutral-900 placeholder:text-neutral-400 focus:outline-none focus:ring-2 focus:ring-neutral-400 focus:border-transparent transition-colors disabled:opacity-50 \\${className}\\`}\n {...props}\n />\n </div>\n );\n }\n);\nInput.displayName = \"Input\";\n`;\n\nexport const dropdownTemplate = `import React, { useState, useRef, useEffect } from \"react\";\n\nexport interface DropdownOption {\n value: string;\n label: string;\n icon?: React.ReactNode;\n disabled?: boolean;\n}\n\nexport interface DropdownProps {\n options: DropdownOption[];\n value?: string;\n onChange?: (value: string) => void;\n placeholder?: string;\n className?: string;\n disabled?: boolean;\n}\n\nexport const Dropdown: React.FC<DropdownProps> = ({\n options,\n value,\n onChange,\n placeholder = \"Select option...\",\n className = \"\",\n disabled = false,\n}) => {\n const [isOpen, setIsOpen] = useState(false);\n const containerRef = useRef<HTMLDivElement>(null);\n\n const selected = options.find((o) => o.value === value);\n\n useEffect(() => {\n function handleClickOutside(event: MouseEvent) {\n if (containerRef.current && !containerRef.current.contains(event.target as Node)) {\n setIsOpen(false);\n }\n }\n document.addEventListener(\"mousedown\", handleClickOutside);\n return () => document.removeEventListener(\"mousedown\", handleClickOutside);\n }, []);\n\n return (\n <div ref={containerRef} className={\\`relative inline-block w-full min-w-[140px] \\${className}\\`}>\n <button\n type=\"button\"\n disabled={disabled}\n onClick={() => setIsOpen(!isOpen)}\n className=\"w-full h-[36px] min-h-[36px] px-3 rounded-md border border-neutral-200 bg-white text-sm text-neutral-900 flex items-center justify-between gap-2 hover:bg-neutral-50 transition-colors focus:outline-none focus:ring-2 focus:ring-neutral-400 disabled:opacity-50\"\n >\n <span className=\"truncate\">{selected ? selected.label : placeholder}</span>\n <svg className=\"w-4 h-4 text-neutral-500 shrink-0\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M19 9l-7 7-7-7\" />\n </svg>\n </button>\n\n {isOpen && (\n <div className=\"absolute z-50 w-full mt-1 bg-white border border-neutral-200 rounded-md shadow-lg max-h-60 overflow-y-auto py-1\">\n {options.map((option) => (\n <button\n key={option.value}\n type=\"button\"\n disabled={option.disabled}\n onClick={() => {\n onChange?.(option.value);\n setIsOpen(false);\n }}\n className={\\`w-full px-3 py-2 text-sm text-left flex items-center gap-2 hover:bg-neutral-100 transition-colors \\${option.value === value ? \"bg-neutral-50 font-medium text-neutral-900\" : \"text-neutral-700\"} \\${option.disabled ? \"opacity-50 cursor-not-allowed\" : \"\"}\\`}\n >\n {option.icon}\n <span className=\"truncate\">{option.label}</span>\n </button>\n ))}\n </div>\n )}\n </div>\n );\n};\n`;\n\nexport const tableTemplate = `import React from \"react\";\n\nexport const Table = React.forwardRef<HTMLTableElement, React.HTMLAttributes<HTMLTableElement>>(\n ({ className = \"\", children, ...props }, ref) => (\n <div className=\"w-full rounded-md border border-neutral-200 bg-white shadow-2xs overflow-hidden\">\n <div className=\"overflow-x-auto\">\n <table ref={ref} className={\\`w-full text-sm text-left border-collapse \\${className}\\`} {...props}>\n {children}\n </table>\n </div>\n </div>\n )\n);\nTable.displayName = \"Table\";\n\nexport const TableHeader = React.forwardRef<HTMLTableSectionElement, React.HTMLAttributes<HTMLTableSectionElement>>(\n ({ className = \"\", children, ...props }, ref) => (\n <thead ref={ref} className={\\`bg-neutral-50/80 border-b border-neutral-200 text-neutral-900 font-medium \\${className}\\`} {...props}>\n {children}\n </thead>\n )\n);\nTableHeader.displayName = \"TableHeader\";\n\nexport const TableBody = React.forwardRef<HTMLTableSectionElement, React.HTMLAttributes<HTMLTableSectionElement>>(\n ({ className = \"\", children, ...props }, ref) => (\n <tbody ref={ref} className={\\`divide-none bg-white \\${className}\\`} {...props}>\n {children}\n </tbody>\n )\n);\nTableBody.displayName = \"TableBody\";\n\nexport const TableRow = React.forwardRef<HTMLTableRowElement, React.HTMLAttributes<HTMLTableRowElement>>(\n ({ className = \"\", children, ...props }, ref) => (\n <tr ref={ref} className={\\`border-b border-neutral-200 transition-colors hover:bg-neutral-50/60 last:border-b-0 \\${className}\\`} {...props}>\n {children}\n </tr>\n )\n);\nTableRow.displayName = \"TableRow\";\n\nexport interface TableHeadProps extends React.ThHTMLAttributes<HTMLTableCellElement> {\n icon?: React.ReactNode;\n resizable?: boolean;\n}\n\nexport const TableHead = React.forwardRef<HTMLTableCellElement, TableHeadProps>(\n ({ className = \"\", icon, resizable = true, children, ...props }, ref) => (\n <th\n ref={ref}\n className={\\`h-[36px] px-4 text-left font-medium text-sm text-neutral-900 select-none align-middle relative whitespace-nowrap \\${className}\\`}\n {...props}\n >\n <div className=\"flex items-center gap-2\">\n {icon && <span className=\"text-neutral-500 shrink-0\">{icon}</span>}\n <span className=\"whitespace-nowrap\">{children}</span>\n </div>\n </th>\n )\n);\nTableHead.displayName = \"TableHead\";\n\nexport const TableCell = React.forwardRef<HTMLTableCellElement, React.TdHTMLAttributes<HTMLTableCellElement>>(\n ({ className = \"\", children, ...props }, ref) => (\n <td ref={ref} className={\\`px-4 py-2.5 align-middle text-sm text-neutral-900 \\${className}\\`} {...props}>\n {children}\n </td>\n )\n);\nTableCell.displayName = \"TableCell\";\n`;\n\nexport const tabsTemplate = `import React from \"react\";\n\nexport interface TabItem {\n id: string;\n label: string;\n icon?: React.ReactNode;\n badge?: React.ReactNode;\n count?: number;\n disabled?: boolean;\n}\n\nexport interface TabsProps {\n items: TabItem[];\n activeId: string;\n onChange: (id: string) => void;\n className?: string;\n}\n\nexport const Tabs: React.FC<TabsProps> = ({ items, activeId, onChange, className = \"\" }) => {\n // Standard 36px height, 8px radius, font-medium\n return (\n <div className={\\`inline-flex h-[36px] min-h-[36px] items-center rounded-md bg-neutral-100 p-1 text-neutral-600 \\${className}\\`}>\n {items.map((tab) => {\n const isActive = tab.id === activeId;\n return (\n <button\n key={tab.id}\n type=\"button\"\n disabled={tab.disabled}\n onClick={() => onChange(tab.id)}\n className={\\`inline-flex h-[28px] items-center justify-center gap-1.5 rounded-sm px-3 text-sm font-medium whitespace-nowrap shrink-0 transition-all select-none \\${\n isActive\n ? \"bg-white text-neutral-900 shadow-2xs\"\n : \"text-neutral-600 hover:text-neutral-900 hover:bg-neutral-200/50\"\n } \\${tab.disabled ? \"opacity-50 cursor-not-allowed\" : \"\"}\\`}\n >\n {tab.icon && <span className=\"shrink-0\">{tab.icon}</span>}\n <span>{tab.label}</span>\n {tab.count !== undefined && (\n <span className=\"text-xs px-1.5 py-0.5 rounded-full bg-neutral-200 text-neutral-700\">\n {tab.count}\n </span>\n )}\n {tab.badge}\n </button>\n );\n })}\n </div>\n );\n};\n`;\n\nexport const cardTemplate = `import React from \"react\";\n\nexport const Card = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className = \"\", children, ...props }, ref) => (\n // Standard 12px corner radius (rounded-lg) for main content cards and containers\n <div\n ref={ref}\n className={\\`rounded-lg border border-neutral-200 bg-white p-5 shadow-xs text-neutral-900 \\${className}\\`}\n {...props}\n >\n {children}\n </div>\n )\n);\nCard.displayName = \"Card\";\n`;\n\nexport const checkboxTemplate = `import React from \"react\";\n\nexport interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, \"type\"> {\n label?: string;\n}\n\nexport const Checkbox = React.forwardRef<HTMLInputElement, CheckboxProps>(\n ({ className = \"\", label, id, ...props }, ref) => {\n return (\n <label htmlFor={id} className=\"inline-flex items-center gap-2 cursor-pointer select-none\">\n <input\n ref={ref}\n id={id}\n type=\"checkbox\"\n // Strictly 20px (size-5) and 4px radius (rounded-xs / rounded-[4px])\n className={\\`size-5 rounded-xs border border-neutral-300 text-neutral-900 focus:ring-2 focus:ring-neutral-400 focus:ring-offset-1 transition-colors cursor-pointer \\${className}\\`}\n {...props}\n />\n {label && <span className=\"text-sm font-medium text-neutral-900\">{label}</span>}\n </label>\n );\n }\n);\nCheckbox.displayName = \"Checkbox\";\n`;\n\nexport const skeletonTemplate = `import React from \"react\";\n\nexport const Skeleton: React.FC<React.HTMLAttributes<HTMLDivElement>> = ({\n className = \"\",\n ...props\n}) => {\n return (\n <div\n className={\\`animate-pulse rounded-md bg-neutral-200/70 \\${className}\\`}\n {...props}\n />\n );\n};\n`;\n","import type { DseConfig } from \"../config/types.js\";\n\nexport function generateMarkdownRules(config: DseConfig): string {\n const minFont = config.tokens?.typography?.minFontSize || \"14px\";\n const maxFont = config.tokens?.typography?.maxFontSize || \"32px\";\n const maxWeight = config.tokens?.typography?.maxFontWeight ?? 500;\n const maxControlHeight = config.tokens?.geometry?.maxControlHeight || \"36px\";\n\n return `<!-- BEGIN:design-system-enforcer-rules -->\n# Design System Rules & Constraints (Enforced by DSE)\n\n## Typography & Font Sizing Rules\n- **Primary Body Font**: Always use standard ${minFont} (\\`text-sm\\`) as the primary body font across all tables, lists, cards, form inputs, dialogs, and buttons.\n- **Large Body Font**: Use 16px (\\`text-base\\`) for large body text and emphasized copy.\n- **Maximum Heading Size**: Headings must never exceed ${maxFont} (\\`text-2xl\\`). Headings larger than ${maxFont} (\\`text-3xl\\`, \\`text-4xl\\`) are strictly prohibited.\n- **Prohibition on Font Sizes Below ${minFont}**: Font sizes smaller than ${minFont} (e.g. \\`text-xs\\`, \\`12px\\`, \\`10px\\`) are strictly prohibited.\n- **Font Weight Cap**: Standard text and interactive elements must not exceed Medium / ${maxWeight} (\\`font-medium\\`). \\`font-semibold\\` or \\`font-bold\\` are prohibited.\n- **No Uppercase Text**: Disallow \\`uppercase\\` or \\`capitalize\\` CSS transforms. Use standard sentence or title case.\n\n## UI Iconography & Symbols\n- **No Raw Text Arrows**: Never use raw unicode or ASCII arrows (→, ←, ↑, ↓, =>, ->). Use design system icon components instead.\n- **No Emojis in UI**: Do NOT use raw emojis in badges, chips, buttons, labels, or table headers.\n\n## Component Design & Primitives\n- **Button Component**: Always use \\`<Button>\\` from \\`@/components/ui/button\\`. Raw \\`<button>\\` HTML elements are strictly prohibited.\n - Height is strictly standard ${maxControlHeight} (\\`h-[36px] min-h-[36px]\\`) with 8px corner radius (\\`rounded-md\\`).\n - Font weight is strictly \\`font-medium\\`.\n - **No Chip-Colored Buttons**: Buttons must NEVER use semantic chip colors (\\`bg-emerald-*\\`, \\`bg-red-*\\`, \\`variant=\"danger\"\\`, \\`variant=\"success\"\\`).\n- **Chip Component**: \\`<Chip>\\` from \\`@/components/ui/chip\\` is the single source of truth for all tags, statuses, pills, and badges. Height is strictly standard ${maxControlHeight} with 8px radius.\n - **No Pseudo-Chips**: Never use raw \\`<span>\\` or \\`<div>\\` elements styled with fills and rounded corners to imitate chips.\n- **Input Component**: Always use \\`<Input>\\` from \\`@/components/ui/input\\`. Raw \\`<input type=\"text\">\\` is strictly prohibited.\n- **Dropdown Component**: Always use \\`<Dropdown>\\` from \\`@/components/ui/dropdown\\` instead of raw \\`<select>\\`.\n- **Checkbox Component**: Strictly 20px dimension (\\`size-5\\`) and 4px corner radius (\\`rounded-xs\\`). 4px radius is strictly reserved for checkboxes only.\n- **Cards & Containers**: Main content cards must strictly use 12px corner radius (\\`rounded-lg\\`).\n\n## Table Component Rules\n- **Mandatory Table Suite**: Always use \\`<Table>\\`, \\`<TableHeader>\\`, \\`<TableHead>\\`, \\`<TableBody>\\`, \\`<TableRow>\\`, and \\`<TableCell>\\` from \\`@/components/ui/table\\`. Raw HTML table elements (\\`<table>\\`, \\`<tr>\\`, \\`<td>\\`) are strictly prohibited.\n- **Mandatory TableHead Icons**: Every column header (\\`<TableHead>\\`) must provide an icon component via the \\`icon\\` prop (\\`icon={<MailIcon size={20} />}\\`). Only dedicated row selection checkbox columns are exempt.\n- **Mandatory Resizable Columns**: All data columns must support column resizing. Explicitly setting \\`resizable={false}\\` on data columns is strictly prohibited.\n- **Single Borders**: Never wrap \\`<Table>\\` in redundant outer bordered containers. Never apply \\`divide-y\\` to \\`<TableBody>\\`.\n- **Uniform Table Typography**: All fonts across all cells and headers must share standard 14px size and uniform color (\\`text-text-primary\\`).\n- **No Vertical Stacking**: Never vertically stack subtext or metadata inside \\`<TableCell>\\`. Every piece of metadata must reside in its own dedicated, resizable column.\n- **Windowed Pagination**: Data tables rendering dynamic collections must implement pagination (Previous/Next buttons, page size selector [25, 50, 100], and 'Showing X to Y of Z' range indicator).\n\n## Modals & Overlays\n- **No Backdrop Blur**: \\`backdrop-blur-*\\` is strictly prohibited. Modal backdrops must use standard neutral grey overlay (\\`bg-neutral-100/80\\`) without blur.\n<!-- END:design-system-enforcer-rules -->\n`;\n}\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,kBAAe;AACf,IAAAC,oBAAiB;AACjB,uBAAwB;AACxB,IAAAC,qBAAe;;;ACHf,IAAAC,kBAAe;AACf,IAAAC,oBAAiB;AACjB,sBAA8B;;;ACAvB,IAAM,gBAA2B;AAAA,EACtC,QAAQ;AAAA,EACR,WAAW;AAAA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fs","import_node_fs","import_node_path","ts","import_typescript","ts","path","fs","fg","pc","import_node_fs","import_node_path","path","fs","content","path","pc","fs"]}
1
+ {"version":3,"sources":["../src/cli.ts","../src/config/loader.ts","../src/config/presets/berserk.ts","../src/config/presets/default.ts","../src/config/presets/python.ts","../src/detector/index.ts","../src/detector/ignores.ts","../src/rules/runner.ts","../src/parser/ast.ts","../src/rules/ast-rules.ts","../src/tokens/index.ts","../src/rules/regex-rules.ts","../src/rules/python-rules.ts","../src/formatters/stylish.ts","../src/formatters/json.ts","../src/scaffold/index.ts","../src/scaffold/templates/tokens.ts","../src/scaffold/templates/css.ts","../src/scaffold/templates/components.ts","../src/export-rules/index.ts","../src/doctor/index.ts","../src/doctor/formatter.ts","../src/fixer/index.ts","../src/guardrails/index.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { Command } from \"commander\";\nimport pc from \"picocolors\";\nimport { loadConfig } from \"./config/loader.js\";\nimport { runDseScan } from \"./rules/runner.js\";\nimport { formatStylish } from \"./formatters/stylish.js\";\nimport { formatJson } from \"./formatters/json.js\";\nimport {\n scaffoldConfig,\n scaffoldTokens,\n scaffoldComponent,\n scaffoldAllPrimitives,\n COMPONENT_TEMPLATES,\n} from \"./scaffold/index.js\";\nimport { generateMarkdownRules } from \"./export-rules/index.js\";\nimport { detectProject } from \"./detector/index.js\";\nimport { computeDoctorScore } from \"./doctor/index.js\";\nimport { formatDoctorOutput } from \"./doctor/formatter.js\";\nimport { runDseFix } from \"./fixer/index.js\";\nimport { generateAgentInstructions, installPreCommitHook } from \"./guardrails/index.js\";\n\nconst program = new Command();\n\nprogram\n .name(\"dse\")\n .description(\"Design System Enforcer (DSE) - AST-based Linter and Scaffold Engine\")\n .version(\"1.0.4\");\n\n// ---------------------------------------------------------------------------\n// COMMAND: check (default)\n// ---------------------------------------------------------------------------\nprogram\n .command(\"check [targetDir]\", { isDefault: true })\n .description(\"Scan codebase and enforce Design System rules\")\n .option(\"-c, --config <path>\", \"Path to custom dse.config.js / dse.config.json\")\n .option(\"-f, --format <format>\", \"Output format: 'stylish' | 'json'\", \"stylish\")\n .option(\"--strict\", \"Treat warnings as errors\", false)\n .action(async (targetDirArg, options) => {\n try {\n const cwd = targetDirArg ? path.resolve(process.cwd(), targetDirArg) : process.cwd();\n const config = await loadConfig(cwd, options.config);\n const result = await runDseScan(config, cwd);\n\n if (options.format === \"json\") {\n console.log(formatJson(result));\n } else {\n console.log(formatStylish(result));\n }\n\n const totalErrors = options.strict\n ? result.errorCount + result.warningCount\n : result.errorCount;\n\n if (totalErrors > 0) {\n process.exit(1);\n }\n } catch (err: any) {\n console.error(pc.red(`\\n✖ Error running scan: ${err.message}`));\n process.exit(1);\n }\n });\n\n// ---------------------------------------------------------------------------\n// COMMAND: doctor (Visual Design Health Audit)\n// ---------------------------------------------------------------------------\nprogram\n .command(\"doctor [targetDir]\")\n .description(\"Perform a visual Design System health audit and compute compliance score\")\n .option(\"-c, --config <path>\", \"Path to custom dse.config.js / dse.config.json\")\n .action(async (targetDirArg, options) => {\n try {\n const cwd = targetDirArg ? path.resolve(process.cwd(), targetDirArg) : process.cwd();\n const config = await loadConfig(cwd, options.config);\n const result = await runDseScan(config, cwd);\n const report = computeDoctorScore(result);\n console.log(formatDoctorOutput(report));\n } catch (err: any) {\n console.error(pc.red(`\\n✖ Error generating health report: ${err.message}`));\n process.exit(1);\n }\n });\n\n// ---------------------------------------------------------------------------\n// COMMAND: fix (One-Click Auto-Remediation)\n// ---------------------------------------------------------------------------\nprogram\n .command(\"fix [targetDir]\")\n .description(\"Automatically remediate common Design System violations in place\")\n .option(\"-c, --config <path>\", \"Path to custom dse.config.js / dse.config.json\")\n .action(async (targetDirArg, options) => {\n try {\n const cwd = targetDirArg ? path.resolve(process.cwd(), targetDirArg) : process.cwd();\n const config = await loadConfig(cwd, options.config);\n console.log(pc.cyan(\"\\n🔧 Running Design System Enforcer Auto-Fixer...\\n\"));\n const fixReport = await runDseFix(config, cwd);\n\n if (fixReport.filesFixed === 0) {\n console.log(pc.green(\"✔ No auto-fixable violations found. Your codebase is clean!\"));\n } else {\n console.log(pc.bold(pc.green(`✔ Successfully fixed ${fixReport.totalModifications} issues across ${fixReport.filesFixed} files:\\n`)));\n fixReport.details.forEach((item) => {\n console.log(` ${pc.bold(pc.cyan(item.file))}:`);\n item.fixes.forEach((f) => console.log(` - ${pc.dim(f)}`));\n });\n }\n console.log(\"\");\n } catch (err: any) {\n console.error(pc.red(`\\n✖ Error during auto-fix: ${err.message}`));\n process.exit(1);\n }\n });\n\n// ---------------------------------------------------------------------------\n// COMMAND: detect (autonomous diagnostics)\n// ---------------------------------------------------------------------------\nprogram\n .command(\"detect [targetDir]\")\n .description(\"Inspect project architecture, framework, libraries, and design tokens autonomously\")\n .action((targetDirArg) => {\n const cwd = targetDirArg ? path.resolve(process.cwd(), targetDirArg) : process.cwd();\n const info = detectProject(cwd);\n\n console.log(pc.bold(pc.cyan(\"\\n🔍 DSE Autonomous Project Diagnostics\\n\")));\n console.log(` ${pc.bold(\"Target Directory:\")} ${info.root}`);\n console.log(` ${pc.bold(\"Framework:\")} ${pc.green(info.framework)}`);\n console.log(` ${pc.bold(\"Monorepo:\")} ${info.isMonorepo ? pc.yellow(\"Yes\") : \"No\"}`);\n if (info.isMonorepo && info.monorepoWorkspaces.length > 0) {\n console.log(` ${pc.bold(\"Workspaces:\")} ${info.monorepoWorkspaces.join(\", \")}`);\n }\n console.log(` ${pc.bold(\"Libraries:\")} ${info.libraries.length ? pc.magenta(info.libraries.join(\", \")) : \"None\"}`);\n console.log(` ${pc.bold(\"Tailwind CSS:\")} ${info.hasTailwind ? pc.green(info.tailwindVersion || \"Yes\") : \"No\"}`);\n console.log(` ${pc.bold(\"TypeScript:\")} ${info.hasTypeScript ? \"Yes\" : \"No\"}`);\n console.log(` ${pc.bold(\"Tokens File:\")} ${info.tokensFile ? pc.cyan(info.tokensFile) : pc.dim(\"None (using preset defaults)\")}`);\n console.log(` ${pc.bold(\"Default Preset:\")} ${pc.yellow(info.preset)}`);\n console.log(` ${pc.bold(\"Auto Includes:\")} ${info.suggestedIncludes.join(\", \")}`);\n console.log(` ${pc.bold(\"Auto Ignores:\")} ${info.suggestedIgnores.slice(0, 5).join(\", \")} (+${Math.max(0, info.suggestedIgnores.length - 5)} more)`);\n console.log(\"\");\n });\n\n// ---------------------------------------------------------------------------\n// COMMAND: export-agent (AI Coding Assistant Guardrails)\n// ---------------------------------------------------------------------------\nprogram\n .command(\"export-agent\")\n .description(\"Export ultra-compact prompt rules for Cursor, Claude, Antigravity, or Copilot\")\n .option(\"-w, --write <file>\", \"Target file to write/append into (e.g. .cursorrules, AGENTS.md)\")\n .action(async (options) => {\n const cwd = process.cwd();\n const config = await loadConfig(cwd);\n const instructions = generateAgentInstructions(config);\n\n if (options.write) {\n const targetPath = path.resolve(cwd, options.write);\n if (fs.existsSync(targetPath)) {\n let existing = fs.readFileSync(targetPath, \"utf-8\");\n const startTag = \"<!-- BEGIN:DSE-AGENT-RULES -->\";\n const endTag = \"<!-- END:DSE-AGENT-RULES -->\";\n\n if (existing.includes(startTag) && existing.includes(endTag)) {\n const regex = new RegExp(`${startTag}[\\\\s\\\\S]*?${endTag}`, \"g\");\n existing = existing.replace(regex, instructions.trim());\n } else {\n existing = `${existing.trim()}\\n\\n${instructions.trim()}\\n`;\n }\n fs.writeFileSync(targetPath, existing, \"utf-8\");\n console.log(pc.green(`✔ Updated AI guardrails in ${options.write}`));\n } else {\n fs.writeFileSync(targetPath, instructions, \"utf-8\");\n console.log(pc.green(`✔ Created ${options.write} with AI guardrails`));\n }\n } else {\n console.log(instructions);\n }\n });\n\n// ---------------------------------------------------------------------------\n// COMMAND: hook (Git Pre-Commit Enforcer)\n// ---------------------------------------------------------------------------\nprogram\n .command(\"hook [action]\")\n .description(\"Install or manage git pre-commit hooks to block non-compliant commits\")\n .action((action) => {\n if (action === \"install\" || !action) {\n try {\n installPreCommitHook(process.cwd());\n console.log(pc.bold(pc.green(\"\\n✔ Successfully installed pre-commit hook in .git/hooks/pre-commit!\")));\n console.log(pc.dim(\" Every git commit will now be checked with 'dse check --strict'.\\n\"));\n } catch (err: any) {\n console.error(pc.red(`\\n✖ Could not install hook: ${err.message}\\n`));\n }\n }\n });\n\n// ---------------------------------------------------------------------------\n// COMMAND: init\n// ---------------------------------------------------------------------------\nprogram\n .command(\"init\")\n .description(\"Initialize DSE configuration in current repository\")\n .option(\"-p, --preset <name>\", \"Preset: berserk | recommended | minimal | python\", \"berserk\")\n .action((options) => {\n scaffoldConfig(process.cwd(), options.preset);\n });\n\n// ---------------------------------------------------------------------------\n// COMMAND: scaffold-tokens\n// ---------------------------------------------------------------------------\nprogram\n .command(\"scaffold-tokens\")\n .description(\"Generate official design system tokens TypeScript/CSS file\")\n .action(() => {\n scaffoldTokens(process.cwd());\n });\n\n// ---------------------------------------------------------------------------\n// COMMAND: scaffold-primitives\n// ---------------------------------------------------------------------------\nprogram\n .command(\"scaffold-primitives\")\n .description(\"Scaffold all canonical zero-compromise design system UI primitives\")\n .action(() => {\n scaffoldAllPrimitives(process.cwd());\n });\n\n// ---------------------------------------------------------------------------\n// COMMAND: export-rules\n// ---------------------------------------------------------------------------\nprogram\n .command(\"export-rules\")\n .description(\"Export rules in Markdown format for AI coding assistants (AGENTS.md, .cursorrules, CLAUDE.md)\")\n .option(\"-w, --write <file>\", \"Write directly to target file (e.g. AGENTS.md)\")\n .action(async (options) => {\n const cwd = process.cwd();\n const config = await loadConfig(cwd);\n const rulesMd = generateMarkdownRules(config);\n\n if (options.write) {\n const targetFile = path.resolve(cwd, options.write);\n if (fs.existsSync(targetFile)) {\n let existing = fs.readFileSync(targetFile, \"utf-8\");\n const startTag = \"<!-- BEGIN:design-system-enforcer-rules -->\";\n const endTag = \"<!-- END:design-system-enforcer-rules -->\";\n\n if (existing.includes(startTag) && existing.includes(endTag)) {\n const regex = new RegExp(`${startTag}[\\\\s\\\\S]*?${endTag}`, \"g\");\n existing = existing.replace(regex, rulesMd.trim());\n } else {\n existing = `${existing.trim()}\\n\\n${rulesMd.trim()}\\n`;\n }\n fs.writeFileSync(targetFile, existing, \"utf-8\");\n console.log(pc.green(`✔ Updated rules in ${options.write}`));\n } else {\n fs.writeFileSync(targetFile, rulesMd, \"utf-8\");\n console.log(pc.green(`✔ Created ${options.write} with design system rules`));\n }\n } else {\n console.log(rulesMd);\n }\n });\n\nprogram.parse(process.argv);\n","import fs from \"node:fs\";\r\nimport path from \"node:path\";\r\nimport { pathToFileURL } from \"node:url\";\r\nimport type { DseConfig } from \"./types.js\";\r\nimport { berserkPreset } from \"./presets/berserk.js\";\r\nimport { defaultPreset } from \"./presets/default.js\";\r\nimport { pythonPreset } from \"./presets/python.js\";\r\nimport { detectProject } from \"../detector/index.js\";\r\n\r\nconst CONFIG_FILES = [\r\n \"dse.config.js\",\r\n \"dse.config.mjs\",\r\n \"dse.config.cjs\",\r\n \"dse.config.ts\",\r\n \"dse.config.json\",\r\n \".dserc.json\",\r\n \".dserc\",\r\n];\r\n\r\nexport function defineConfig(config: DseConfig): DseConfig {\r\n return config;\r\n}\r\n\r\nexport async function loadConfig(cwd = process.cwd(), customPath?: string): Promise<DseConfig> {\r\n const detected = detectProject(cwd);\r\n let userConfig: Partial<DseConfig> = {};\r\n let foundConfigPath: string | null = null;\r\n\r\n\r\n if (customPath) {\r\n const resolved = path.resolve(cwd, customPath);\r\n if (fs.existsSync(resolved)) {\r\n foundConfigPath = resolved;\r\n }\r\n } else {\r\n for (const filename of CONFIG_FILES) {\r\n const candidate = path.resolve(cwd, filename);\r\n if (fs.existsSync(candidate)) {\r\n foundConfigPath = candidate;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n if (foundConfigPath) {\r\n if (foundConfigPath.endsWith(\".json\") || foundConfigPath.endsWith(\".dserc\")) {\r\n const content = fs.readFileSync(foundConfigPath, \"utf-8\");\r\n try {\r\n userConfig = JSON.parse(content);\r\n } catch (err) {\r\n console.error(`Failed to parse JSON config at ${foundConfigPath}:`, err);\r\n }\r\n } else {\r\n try {\r\n const fileUrl = pathToFileURL(foundConfigPath).href;\r\n const mod = await import(fileUrl);\r\n userConfig = mod.default || mod;\r\n } catch {\r\n // Fallback for CommonJS/eval if import fails\r\n try {\r\n const content = fs.readFileSync(foundConfigPath, \"utf-8\");\r\n // Handle standard module.exports or export default\r\n const cjsReq = createCjsEvaluator(foundConfigPath, content);\r\n userConfig = cjsReq;\r\n } catch (innerErr) {\r\n console.warn(`Could not load config file at ${foundConfigPath}, using default preset.`, innerErr);\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Determine base preset (auto-detect python if requirements.txt / pyproject.toml present)\r\n let presetName = userConfig.preset || detected.preset;\r\n\r\n let basePreset = berserkPreset;\r\n if (presetName === \"python\") {\r\n basePreset = pythonPreset;\r\n } else if (presetName === \"recommended\") {\r\n basePreset = defaultPreset;\r\n }\r\n\r\n // Merge detected autonomous defaults (include globs, smart ignores)\r\n const autonomousDefaults: Partial<DseConfig> = {\r\n include: detected.suggestedIncludes,\r\n exclude: detected.suggestedIgnores,\r\n };\r\n\r\n const withAutonomous = mergeConfigs(basePreset, autonomousDefaults);\r\n return mergeConfigs(withAutonomous, userConfig);\r\n}\r\n\r\nfunction createCjsEvaluator(filePath: string, content: string): any {\r\n // If it's a simple export default or module.exports\r\n if (content.includes(\"export default\")) {\r\n // Basic extraction or leave as empty\r\n return {};\r\n }\r\n return {};\r\n}\r\n\r\nfunction mergeConfigs(base: DseConfig, overrides: Partial<DseConfig>): DseConfig {\r\n return {\r\n ...base,\r\n ...overrides,\r\n preset: overrides.preset || base.preset,\r\n targetDir: overrides.targetDir || base.targetDir,\r\n include: overrides.include || base.include,\r\n exclude: [...(base.exclude || []), ...(overrides.exclude || [])],\r\n tokens: {\r\n typography: {\r\n ...(base.tokens?.typography || {}),\r\n ...(overrides.tokens?.typography || {}),\r\n },\r\n geometry: {\r\n ...(base.tokens?.geometry || {}),\r\n ...(overrides.tokens?.geometry || {}),\r\n radiiExceptions: {\r\n ...(base.tokens?.geometry?.radiiExceptions || {}),\r\n ...(overrides.tokens?.geometry?.radiiExceptions || {}),\r\n },\r\n },\r\n colors: {\r\n ...(base.tokens?.colors || {}),\r\n ...(overrides.tokens?.colors || {}),\r\n },\r\n },\r\n components: {\r\n disallowRawHtml: {\r\n ...(base.components?.disallowRawHtml || {}),\r\n ...(overrides.components?.disallowRawHtml || {}),\r\n },\r\n disallowPseudoChips: overrides.components?.disallowPseudoChips ?? base.components?.disallowPseudoChips,\r\n requiredInventory: overrides.components?.requiredInventory || base.components?.requiredInventory,\r\n },\r\n rules: {\r\n ...(base.rules || {}),\r\n ...(overrides.rules || {}),\r\n },\r\n };\r\n}\r\n\r\n","import type { DseConfig } from \"../types.js\";\r\n\r\nexport const berserkPreset: DseConfig = {\r\n preset: \"berserk\",\r\n targetDir: \"src\",\r\n include: [\"**/*.{tsx,jsx,ts,js}\"],\r\n exclude: [\r\n \"**/node_modules/**\",\r\n \"**/.next/**\",\r\n \"**/public/**\",\r\n \"**/.git/**\",\r\n \"**/dist/**\",\r\n \"src/lib/primitives.ts\",\r\n \"src/lib/tokens.ts\",\r\n \"src/lib/dse-scanner.ts\",\r\n \"src/app/globals.css\",\r\n \"src/components/ui/badge.tsx\",\r\n \"src/components/ui/button.tsx\",\r\n \"src/components/ui/buttony-icon.tsx\",\r\n \"src/components/ui/card.tsx\",\r\n \"src/components/ui/checkbox.tsx\",\r\n \"src/components/ui/chip.tsx\",\r\n \"src/components/ui/dropdown.tsx\",\r\n \"src/components/ui/floating-action-bar.tsx\",\r\n \"src/components/ui/folder-combobox.tsx\",\r\n \"src/components/ui/icon-button.tsx\",\r\n \"src/components/ui/input.tsx\",\r\n \"src/components/ui/portal.tsx\",\r\n \"src/components/ui/skeleton.tsx\",\r\n \"src/components/ui/spinner.tsx\",\r\n \"src/components/ui/table.tsx\",\r\n \"src/components/ui/tabs.tsx\",\r\n \"src/components/ui/textarea.tsx\",\r\n \"src/components/ui/toggle.tsx\",\r\n \"src/components/ui/tooltip.tsx\",\r\n \"src/components/design-system/**\",\r\n \"src/db/**\",\r\n \"src/app/api/**\",\r\n \"src/engine/**\",\r\n \"src/services/**\",\r\n \"src/lib/auth/two-factor.ts\",\r\n ],\r\n tokens: {\r\n typography: {\r\n minFontSize: \"14px\",\r\n maxFontSize: \"32px\",\r\n maxFontWeight: 500,\r\n disallowArbitrarySizes: true,\r\n disallowUppercase: true,\r\n allowXsOn: [],\r\n },\r\n geometry: {\r\n maxControlHeight: 36,\r\n allowedRadii: [\"0\", \"0px\", \"8px\", \"12px\", \"16px\", \"9999px\", \"100%\"],\r\n radiiExceptions: {\r\n Checkbox: [\"0\", \"0px\", \"4px\", \"0.25rem\", \"8px\", \"12px\", \"16px\", \"9999px\", \"100%\"],\r\n },\r\n },\r\n colors: {\r\n bannedColorFamilies: [\r\n \"slate\", \"gray\", \"zinc\", \"stone\",\r\n \"orange\", \"yellow\", \"lime\", \"green\",\r\n \"teal\", \"cyan\", \"sky\", \"indigo\",\r\n \"violet\", \"purple\", \"fuchsia\", \"pink\", \"rose\"\r\n ],\r\n disallowRawHex: true,\r\n disallowButtonChipColors: true,\r\n disallowSaturatedGradients: true,\r\n },\r\n },\r\n components: {\r\n disallowRawHtml: {\r\n button: { replaceWith: \"Button\", importFrom: \"@/components/ui/button\", checkRawElement: true },\r\n select: { replaceWith: \"Dropdown\", importFrom: \"@/components/ui/dropdown\", checkRawElement: true },\r\n textarea: { replaceWith: \"Textarea\", importFrom: \"@/components/ui/textarea\", checkRawElement: true },\r\n progress: { replaceWith: \"ProgressBar\", importFrom: \"@/components/ui/progress\", checkRawElement: true },\r\n dialog: { replaceWith: \"Modal or Dialog\", importFrom: \"@/components/ui/modal\", checkRawElement: true },\r\n table: { replaceWith: \"Table\", importFrom: \"@/components/ui/table\", checkRawElement: true },\r\n thead: { replaceWith: \"TableHeader\", importFrom: \"@/components/ui/table\", checkRawElement: true },\r\n tbody: { replaceWith: \"TableBody\", importFrom: \"@/components/ui/table\", checkRawElement: true },\r\n tr: { replaceWith: \"TableRow\", importFrom: \"@/components/ui/table\", checkRawElement: true },\r\n th: { replaceWith: \"TableHead\", importFrom: \"@/components/ui/table\", checkRawElement: true },\r\n td: { replaceWith: \"TableCell\", importFrom: \"@/components/ui/table\", checkRawElement: true },\r\n },\r\n disallowPseudoChips: true,\r\n requiredInventory: [\r\n { name: \"Button\", componentName: \"Button\", importPath: \"@/components/ui/button\" },\r\n { name: \"Input\", componentName: \"Input\", importPath: \"@/components/ui/input\" },\r\n { name: \"Chip\", altNames: [\"Chip\", \"Badge\"], componentName: \"Chip\", importPath: \"@/components/ui/chip\" },\r\n { name: \"Card\", componentName: \"Card\", importPath: \"@/components/ui/card\" },\r\n { name: \"Dropdown\", componentName: \"Dropdown\", importPath: \"@/components/ui/dropdown\" },\r\n { name: \"FloatingActionBar\", componentName: \"FloatingActionBar\", importPath: \"@/components/ui/floating-action-bar\" },\r\n { name: \"FolderCombobox\", componentName: \"FolderCombobox\", importPath: \"@/components/ui/folder-combobox\" },\r\n { name: \"IconButton\", altNames: [\"ButtonyIcon\", \"IconButton\"], componentName: \"IconButton\", importPath: \"@/components/ui/icon-button\" },\r\n { name: \"Skeleton\", altNames: [\"Skeleton\", \"CardSkeleton\", \"TableSkeleton\", \"MetricsGridSkeleton\"], componentName: \"Skeleton\", importPath: \"@/components/ui/skeleton\" },\r\n { name: \"Table\", altNames: [\"Table\", \"DataTableContainer\", \"DataTableScrollArea\", \"TableHeader\", \"TableBody\", \"TableRow\", \"TableCell\", \"TableHead\"], componentName: \"Table\", importPath: \"@/components/ui/table\" },\r\n { name: \"Tabs\", altNames: [\"Tabs\"], componentName: \"Tabs\", importPath: \"@/components/ui/tabs\" },\r\n { name: \"Checkbox\", altNames: [\"Checkbox\"], componentName: \"Checkbox\", importPath: \"@/components/ui/checkbox\" },\r\n { name: \"Toggle\", altNames: [\"Toggle\"], componentName: \"Toggle\", importPath: \"@/components/ui/toggle\" },\r\n { name: \"Textarea\", altNames: [\"Textarea\"], componentName: \"Textarea\", importPath: \"@/components/ui/textarea\" },\r\n ],\r\n },\r\n rules: {\r\n \"font-size-min\": \"error\",\r\n \"font-size-max\": \"error\",\r\n \"font-weight-max\": \"error\",\r\n \"no-arbitrary-text-size\": \"error\",\r\n \"no-uppercase-text\": \"error\",\r\n \"control-height-max\": \"error\",\r\n \"corner-radius-allowed\": \"error\",\r\n \"no-banned-colors\": \"error\",\r\n \"no-raw-hex-colors\": \"error\",\r\n \"no-raw-html-elements\": \"error\",\r\n \"no-pseudo-chips\": \"error\",\r\n \"no-chip-colored-buttons\": \"error\",\r\n \"no-text-arrows\": \"error\",\r\n \"no-backdrop-blur\": \"error\",\r\n \"no-unapproved-gradients\": \"error\",\r\n \"modal-backdrop-standard\": \"error\",\r\n \"table-resizable-required\": \"error\",\r\n \"table-head-icon-required\": \"error\",\r\n \"table-single-border\": \"error\",\r\n \"table-no-divide-y\": \"error\",\r\n \"table-uniform-typography\": \"error\",\r\n \"table-no-cell-stacking\": \"error\",\r\n \"table-no-horizontal-stacking\": \"error\",\r\n \"table-windowed-pagination\": \"error\",\r\n \"tabs-component-required\": \"error\",\r\n \"component-inventory-active\": \"error\",\r\n \"no-wrapping-compact-elements\": \"error\",\r\n },\r\n};\r\n\r\n","import type { DseConfig } from \"../types.js\";\r\n\r\nexport const defaultPreset: DseConfig = {\r\n preset: \"recommended\",\r\n targetDir: \"src\",\r\n include: [\"**/*.{tsx,jsx,ts,js}\"],\r\n exclude: [\r\n \"**/node_modules/**\",\r\n \"**/.next/**\",\r\n \"**/public/**\",\r\n \"**/.git/**\",\r\n \"**/dist/**\",\r\n ],\r\n tokens: {\r\n typography: {\r\n minFontSize: \"14px\",\r\n maxFontSize: \"36px\",\r\n maxFontWeight: 600,\r\n disallowArbitrarySizes: false,\r\n disallowUppercase: true,\r\n allowXsOn: [],\r\n },\r\n geometry: {\r\n maxControlHeight: 40,\r\n allowedRadii: [\"0\", \"0px\", \"4px\", \"6px\", \"8px\", \"12px\", \"16px\", \"9999px\", \"100%\"],\r\n },\r\n colors: {\r\n disallowRawHex: false,\r\n disallowButtonChipColors: true,\r\n },\r\n },\r\n components: {\r\n disallowRawHtml: {\r\n button: { replaceWith: \"Button\", importFrom: \"@/components/ui/button\", checkRawElement: true },\r\n select: { replaceWith: \"Dropdown\", importFrom: \"@/components/ui/dropdown\", checkRawElement: true },\r\n textarea: { replaceWith: \"Textarea\", importFrom: \"@/components/ui/textarea\", checkRawElement: true },\r\n progress: { replaceWith: \"ProgressBar\", importFrom: \"@/components/ui/progress\", checkRawElement: true },\r\n dialog: { replaceWith: \"Modal or Dialog\", importFrom: \"@/components/ui/modal\", checkRawElement: true },\r\n },\r\n disallowPseudoChips: true,\r\n },\r\n rules: {\r\n \"font-size-min\": \"error\",\r\n \"no-uppercase-text\": \"warn\",\r\n \"no-raw-html-elements\": \"error\",\r\n \"no-pseudo-chips\": \"warn\",\r\n \"no-chip-colored-buttons\": \"error\",\r\n \"no-text-arrows\": \"error\",\r\n \"no-backdrop-blur\": \"warn\",\r\n \"no-wrapping-compact-elements\": \"warn\",\r\n },\r\n};\r\n\r\n","import type { DseConfig } from \"../types.js\";\n\nexport const pythonPreset: DseConfig = {\n preset: \"recommended\",\n targetDir: \".\",\n include: [\"**/*.{py,html,jinja,jinja2,css,tsx,jsx,js,ts}\"],\n exclude: [\n \"**/.venv/**\",\n \"**/venv/**\",\n \"**/__pycache__/**\",\n \"**/.pytest_cache/**\",\n \"**/.mypy_cache/**\",\n \"**/.git/**\",\n \"**/node_modules/**\",\n \"**/dist/**\",\n \"**/build/**\",\n \"**/*.egg-info/**\",\n ],\n tokens: {\n typography: {\n minFontSize: \"14px\",\n maxFontSize: \"32px\",\n maxFontWeight: 500,\n disallowArbitrarySizes: true,\n disallowUppercase: true,\n allowXsOn: [],\n },\n geometry: {\n maxControlHeight: 36,\n allowedRadii: [\"0px\", \"8px\", \"12px\", \"16px\", \"9999px\"],\n },\n colors: {\n disallowRawHex: true,\n disallowButtonChipColors: true,\n },\n },\n components: {\n disallowRawHtml: {},\n requiredInventory: [],\n },\n rules: {\n \"font-size-min\": \"error\",\n \"font-size-max\": \"error\",\n \"font-weight-max\": \"error\",\n \"no-uppercase-text\": \"warn\",\n \"no-raw-hex-colors\": \"off\",\n \"no-text-arrows\": \"error\",\n \"no-backdrop-blur\": \"error\",\n \"table-resizable-required\": \"off\",\n \"table-head-icon-required\": \"off\",\n \"table-single-border\": \"off\",\n \"table-no-divide-y\": \"off\",\n \"table-uniform-typography\": \"off\",\n \"table-no-cell-stacking\": \"off\",\n \"table-no-horizontal-stacking\": \"off\",\n \"table-windowed-pagination\": \"off\",\n \"tabs-component-required\": \"off\",\n \"component-inventory-active\": \"off\",\n },\n};\n\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport type { ComponentLibrary, Framework, ProjectInfo } from \"./types.js\";\nimport { getSmartIgnores } from \"./ignores.js\";\n\ninterface PackageJson {\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n workspaces?: string[] | { packages?: string[] };\n}\n\nfunction safeReadJson<T>(filePath: string): T | null {\n try {\n if (fs.existsSync(filePath)) {\n const raw = fs.readFileSync(filePath, \"utf-8\");\n return JSON.parse(raw) as T;\n }\n } catch {\n // ignore\n }\n return null;\n}\n\n/**\n * Autonomously inspects a project root offline to detect framework, libraries,\n * UI file locations, design tokens, and appropriate presets.\n */\nexport function detectProject(cwd = process.cwd()): ProjectInfo {\n const pkg = safeReadJson<PackageJson>(path.resolve(cwd, \"package.json\"));\n const deps = { ...(pkg?.dependencies || {}), ...(pkg?.devDependencies || {}) };\n\n // 1. Detect Python vs JS/TS\n const hasRequirements = fs.existsSync(path.resolve(cwd, \"requirements.txt\"));\n const hasPyproject = fs.existsSync(path.resolve(cwd, \"pyproject.toml\"));\n const hasPython = hasRequirements || hasPyproject || fs.existsSync(path.resolve(cwd, \"setup.py\"));\n\n // Check if streamlit\n let isStreamlit = false;\n if (hasPython) {\n if (hasRequirements) {\n try {\n const reqContent = fs.readFileSync(path.resolve(cwd, \"requirements.txt\"), \"utf-8\");\n if (reqContent.toLowerCase().includes(\"streamlit\")) {\n isStreamlit = true;\n }\n } catch {}\n }\n }\n\n // 2. Detect Monorepo\n const isPnpmMonorepo = fs.existsSync(path.resolve(cwd, \"pnpm-workspace.yaml\"));\n const isTurbo = fs.existsSync(path.resolve(cwd, \"turbo.json\"));\n let monorepoWorkspaces: string[] = [];\n if (Array.isArray(pkg?.workspaces)) {\n monorepoWorkspaces = pkg.workspaces;\n } else if (pkg?.workspaces?.packages) {\n monorepoWorkspaces = pkg.workspaces.packages;\n }\n const isMonorepo = isPnpmMonorepo || isTurbo || monorepoWorkspaces.length > 0;\n\n // 3. Detect Framework\n let framework: Framework = \"unknown\";\n if (deps[\"next\"]) {\n framework = \"nextjs\";\n } else if (deps[\"vite\"]) {\n framework = \"vite\";\n } else if (deps[\"@remix-run/react\"]) {\n framework = \"remix\";\n } else if (deps[\"astro\"]) {\n framework = \"astro\";\n } else if (deps[\"react-scripts\"]) {\n framework = \"react-cra\";\n } else if (isStreamlit) {\n framework = \"streamlit\";\n } else if (hasPython) {\n framework = \"python-general\";\n }\n\n // 4. Detect Component Libraries & Icons\n const libraries: ComponentLibrary[] = [];\n const hasShadcnConfig = fs.existsSync(path.resolve(cwd, \"components.json\"));\n if (hasShadcnConfig || deps[\"@radix-ui/react-slot\"]) {\n libraries.push(\"shadcn\");\n }\n if (Object.keys(deps).some((d) => d.startsWith(\"@radix-ui/\"))) {\n if (!libraries.includes(\"shadcn\")) libraries.push(\"radix\");\n }\n if (deps[\"tailwindcss\"]) {\n libraries.push(\"tailwind\");\n }\n if (deps[\"lucide-react\"] || deps[\"lucide\"]) {\n libraries.push(\"lucide\");\n }\n if (deps[\"@mui/material\"] || deps[\"@material-ui/core\"]) {\n libraries.push(\"mui\");\n }\n if (deps[\"@chakra-ui/react\"]) {\n libraries.push(\"chakra\");\n }\n\n // 5. Detect Tailwind details\n const hasTailwind = Boolean(deps[\"tailwindcss\"] || fs.existsSync(path.resolve(cwd, \"tailwind.config.js\")) || fs.existsSync(path.resolve(cwd, \"tailwind.config.ts\")));\n let tailwindVersion: \"v3\" | \"v4\" | undefined;\n if (hasTailwind) {\n const rawVersion = deps[\"tailwindcss\"] || \"\";\n if (rawVersion.includes(\"^4\") || rawVersion.includes(\"~4\") || rawVersion.startsWith(\"4\")) {\n tailwindVersion = \"v4\";\n } else {\n tailwindVersion = \"v3\";\n }\n }\n\n // 6. Detect TypeScript\n const hasTypeScript = Boolean(deps[\"typescript\"] || fs.existsSync(path.resolve(cwd, \"tsconfig.json\")));\n\n // 7. Auto-detect UI directories & includes\n const suggestedIncludes: string[] = [];\n const extGroup = hasTypeScript ? \"{tsx,jsx,ts,js}\" : \"{jsx,js}\";\n\n // Subfolder checks (e.g. frontend/src or apps/web/src or simple src/)\n const candidateDirs = [\n \"frontend/src\",\n \"frontend\",\n \"apps/web/src\",\n \"apps/web\",\n \"client/src\",\n \"client\",\n \"src\",\n \"app\",\n \"pages\",\n \"components\",\n ];\n\n let foundUiDir = false;\n for (const dir of candidateDirs) {\n if (fs.existsSync(path.resolve(cwd, dir))) {\n // Avoid adding broad 'frontend' if 'frontend/src' exists\n if (dir === \"frontend\" && fs.existsSync(path.resolve(cwd, \"frontend/src\"))) continue;\n if (dir === \"client\" && fs.existsSync(path.resolve(cwd, \"client/src\"))) continue;\n if (dir === \"apps/web\" && fs.existsSync(path.resolve(cwd, \"apps/web/src\"))) continue;\n\n suggestedIncludes.push(`${dir}/**/*.${extGroup}`);\n foundUiDir = true;\n break;\n }\n }\n\n // If no standard folder found and has python files\n if (hasPython) {\n suggestedIncludes.push(\"**/*.py\");\n } else if (!foundUiDir) {\n suggestedIncludes.push(`**/*.${extGroup}`);\n }\n\n // 8. Auto-detect Ignores\n const suggestedIgnores = getSmartIgnores(cwd);\n // If shadcn is installed, auto-ignore the raw generated primitives components/ui\n if (hasShadcnConfig || libraries.includes(\"shadcn\")) {\n suggestedIgnores.push(\"**/components/ui/**\");\n }\n\n // 9. Auto-detect Token Files\n const tokenCandidates = [\n \"frontend/src/lib/tokens.ts\",\n \"frontend/src/tokens.ts\",\n \"src/lib/tokens.ts\",\n \"src/tokens.ts\",\n \"src/design/tokens.ts\",\n \"styles/tokens.css\",\n \"src/app/globals.css\",\n \"frontend/src/index.css\",\n \"src/index.css\",\n ];\n\n let tokensFile: string | undefined;\n for (const candidate of tokenCandidates) {\n if (fs.existsSync(path.resolve(cwd, candidate))) {\n tokensFile = candidate;\n break;\n }\n }\n\n // 10. Decide Preset\n let preset: \"berserk\" | \"default\" | \"python\" = \"berserk\";\n if (framework === \"streamlit\" || framework === \"python-general\") {\n preset = \"python\";\n }\n\n return {\n root: cwd,\n isMonorepo,\n monorepoWorkspaces,\n framework,\n libraries,\n hasTailwind,\n tailwindVersion,\n hasTypeScript,\n hasPython,\n suggestedIncludes,\n suggestedIgnores,\n tokensFile,\n preset,\n };\n}\n\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\nconst DEFAULT_IGNORES = [\n \"**/node_modules/**\",\n \"**/.next/**\",\n \"**/dist/**\",\n \"**/build/**\",\n \"**/out/**\",\n \"**/.turbo/**\",\n \"**/.git/**\",\n \"**/coverage/**\",\n \"**/.venv/**\",\n \"**/venv/**\",\n \"**/env/**\",\n \"**/__pycache__/**\",\n \"**/.pytest_cache/**\",\n \"**/*.pyc\",\n // Non-UI code\n \"**/api/**\",\n \"**/*.test.*\",\n \"**/*.spec.*\",\n \"**/__tests__/**\",\n \"**/*.stories.*\",\n \"**/generated/**\",\n];\n\n/**\n * Parses local .gitignore if present and merges with sensible UI linter ignores.\n */\nexport function getSmartIgnores(cwd: string): string[] {\n const result = new Set<string>(DEFAULT_IGNORES);\n\n const gitignorePath = path.resolve(cwd, \".gitignore\");\n if (fs.existsSync(gitignorePath)) {\n try {\n const content = fs.readFileSync(gitignorePath, \"utf-8\");\n const lines = content.split(/\\r?\\n/);\n for (let line of lines) {\n line = line.trim();\n if (!line || line.startsWith(\"#\")) continue;\n\n // Strip leading slash if any\n if (line.startsWith(\"/\")) {\n line = line.substring(1);\n }\n\n // Strip trailing slash if directory\n if (line.endsWith(\"/\")) {\n line = line.slice(0, -1);\n }\n\n if (line) {\n result.add(`**/${line}/**`);\n result.add(`**/${line}`);\n }\n }\n } catch {\n // Ignore reading error, proceed with defaults\n }\n }\n\n return Array.from(result);\n}\n\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport fg from \"fast-glob\";\nimport type { DseConfig, ScanResult, Violation } from \"../config/types.js\";\nimport { parseTsx, getFileImports } from \"../parser/ast.js\";\nimport { runAstRules } from \"./ast-rules.js\";\nimport { runRegexRules } from \"./regex-rules.js\";\nimport { runPythonRules } from \"./python-rules.js\";\nimport type { AddViolationFn } from \"./types.js\";\n\nexport async function runDseScan(config: DseConfig, cwd = process.cwd()): Promise<ScanResult> {\n let targetDir = path.resolve(cwd, config.targetDir || \"src\");\n if (!fs.existsSync(targetDir)) {\n targetDir = cwd;\n }\n\n const includePatterns = config.include || [\"**/*.{tsx,jsx,ts,js}\"];\n const excludePatterns = config.exclude || [\n \"**/node_modules/**\",\n \"**/.next/**\",\n \"**/public/**\",\n \"**/.git/**\",\n ];\n\n // Component inventory setup\n const inventoryCounts: Record<string, number> = {};\n const inventoryDef = config.components?.requiredInventory || [];\n inventoryDef.forEach((comp) => {\n inventoryCounts[comp.name] = 0;\n });\n\n const rawFiles = await fg(includePatterns, {\n cwd: targetDir,\n absolute: true,\n });\n\n const files = rawFiles.filter((filePath) => {\n const normalized = filePath.replace(/\\\\/g, \"/\");\n for (const pattern of excludePatterns) {\n const clean = pattern.replace(/^\\*\\*?\\//, \"\").replace(/\\/\\*\\*?$/, \"\").replace(/\\\\/g, \"/\");\n if (clean && normalized.includes(clean)) {\n return false;\n }\n }\n return true;\n });\n\n const violations: Violation[] = [];\n const seenViolationKeys = new Set<string>();\n\n const addViolation: AddViolationFn = (file, line, col, rule, message, snippet) => {\n const normFile = path.relative(cwd, file).replace(/\\\\/g, \"/\");\n const key = `${normFile}:${line}:${rule}`;\n if (seenViolationKeys.has(key)) return;\n seenViolationKeys.add(key);\n\n const severity = config.rules?.[rule as keyof typeof config.rules] || \"error\";\n if (severity === \"off\") return;\n\n violations.push({\n file: normFile,\n line: line || 0,\n col: col || 0,\n rule,\n severity: severity === \"warn\" ? \"warn\" : \"error\",\n message,\n snippet: snippet ? snippet.trim() : undefined,\n });\n };\n\n let scannedJsxFiles = false;\n\n for (const filePath of files) {\n const content = fs.readFileSync(filePath, \"utf-8\");\n const isJsx = filePath.endsWith(\".tsx\") || filePath.endsWith(\".jsx\") || filePath.endsWith(\".ts\") || filePath.endsWith(\".js\");\n const isPythonOrTemplate = filePath.endsWith(\".py\") || filePath.endsWith(\".html\") || filePath.endsWith(\".jinja\") || filePath.endsWith(\".jinja2\") || filePath.endsWith(\".css\");\n\n if (isJsx) {\n scannedJsxFiles = true;\n // Track component inventory\n inventoryDef.forEach((comp) => {\n const names = [comp.componentName || comp.name, ...(comp.altNames || [])];\n const pattern = new RegExp(`<(?:${names.join(\"|\")})\\\\b`, \"g\");\n if (pattern.test(content)) {\n inventoryCounts[comp.name] = (inventoryCounts[comp.name] || 0) + 1;\n }\n });\n\n const sourceFile = parseTsx(filePath, content);\n const fileImports = getFileImports(sourceFile);\n runAstRules(sourceFile, filePath, addViolation, fileImports, config);\n runRegexRules(content, filePath, addViolation, config);\n } else if (isPythonOrTemplate) {\n runPythonRules(content, filePath, addViolation, config);\n } else {\n runRegexRules(content, filePath, addViolation, config);\n }\n }\n\n // Component inventory verification (only if JSX/TSX components are in scope)\n if (scannedJsxFiles && inventoryDef.length > 0 && config.rules?.[\"component-inventory-active\"] !== \"off\") {\n inventoryDef.forEach((comp) => {\n const count = inventoryCounts[comp.name] || 0;\n if (count === 0) {\n violations.push({\n file: \"GLOBAL\",\n line: 0,\n col: 0,\n rule: \"component-inventory-active\",\n severity: \"error\",\n message: `Required design system component '<${comp.name}>' is defined in the design system but never utilized anywhere across the application!`,\n });\n }\n });\n }\n\n const errorCount = violations.filter((v) => v.severity === \"error\").length;\n const warningCount = violations.filter((v) => v.severity === \"warn\").length;\n\n const componentInventoryReport: Record<string, { active: boolean; fileCount: number }> = {};\n if (scannedJsxFiles && inventoryDef.length > 0) {\n inventoryDef.forEach((comp) => {\n const count = inventoryCounts[comp.name] || 0;\n componentInventoryReport[comp.name] = {\n active: count > 0,\n fileCount: count,\n };\n });\n }\n\n return {\n violations,\n scannedFilesCount: files.length,\n errorCount,\n warningCount,\n componentInventory: componentInventoryReport,\n };\n}\n","import ts from \"typescript\";\n\nexport interface NodePosition {\n line: number;\n col: number;\n}\n\nexport interface ExtractedClass {\n text: string;\n node: ts.Node;\n}\n\nexport interface AttributeInfo {\n node: ts.JsxAttribute | ts.JsxSpreadAttribute;\n initializer?: ts.Expression | null;\n rawText: string;\n isSpread?: boolean;\n}\n\n/**\n * Parses file content into a TypeScript SourceFile AST.\n */\nexport function parseTsx(filePath: string, content: string): ts.SourceFile {\n const isTsx = filePath.endsWith(\".tsx\") || filePath.endsWith(\".jsx\");\n const kind = isTsx ? ts.ScriptKind.TSX : ts.ScriptKind.TS;\n return ts.createSourceFile(\n filePath,\n content,\n ts.ScriptTarget.Latest,\n true, // setParentNodes = true for parent traversal\n kind\n );\n}\n\n/**\n * Gets 1-indexed line and column for any AST node.\n */\nexport function getNodePosition(sourceFile: ts.SourceFile, node: ts.Node): NodePosition {\n const start = node.getStart(sourceFile);\n const { line, character } = sourceFile.getLineAndCharacterOfPosition(start);\n return { line: line + 1, col: character + 1 };\n}\n\n/**\n * Gets the clean tag name of a JSX element or self-closing element.\n */\nexport function getJsxTagName(node: ts.Node, sourceFile: ts.SourceFile): string | null {\n if (ts.isJsxElement(node)) {\n return node.openingElement.tagName.getText(sourceFile);\n }\n if (ts.isJsxSelfClosingElement(node)) {\n return node.tagName.getText(sourceFile);\n }\n if (ts.isJsxOpeningElement(node)) {\n return node.tagName.getText(sourceFile);\n }\n return null;\n}\n\n/**\n * Gets JSX attributes as a structured map.\n */\nexport function getJsxAttributes(node: ts.Node, sourceFile: ts.SourceFile): Record<string, AttributeInfo> {\n const attributes: Record<string, AttributeInfo> = {};\n const propContainer = ts.isJsxElement(node)\n ? node.openingElement.attributes\n : ts.isJsxSelfClosingElement(node) || ts.isJsxOpeningElement(node)\n ? node.attributes\n : null;\n\n if (!propContainer) return attributes;\n\n propContainer.properties.forEach((prop) => {\n if (ts.isJsxAttribute(prop)) {\n const name = prop.name.getText(sourceFile);\n attributes[name] = {\n node: prop,\n initializer: prop.initializer || null,\n rawText: prop.getText(sourceFile),\n };\n } else if (ts.isJsxSpreadAttribute(prop)) {\n attributes[`__spread_${prop.getStart(sourceFile)}`] = {\n node: prop,\n isSpread: true,\n rawText: prop.getText(sourceFile),\n };\n }\n });\n\n return attributes;\n}\n\n/**\n * Recursively extracts all class strings from a JSX attribute initializer.\n */\nexport function extractClassNames(initializer: ts.Expression | null | undefined, sourceFile: ts.SourceFile): ExtractedClass[] {\n const result: ExtractedClass[] = [];\n if (!initializer) return result;\n\n function collectStrings(node: ts.Node | undefined) {\n if (!node) return;\n\n if (ts.isStringLiteral(node) || ts.isNoSubstitutionTemplateLiteral(node)) {\n result.push({ text: node.text, node });\n return;\n }\n\n if (ts.isTemplateExpression(node)) {\n if (node.head.text) {\n result.push({ text: node.head.text, node: node.head });\n }\n for (const span of node.templateSpans) {\n collectStrings(span.expression);\n if (span.literal.text) {\n result.push({ text: span.literal.text, node: span.literal });\n }\n }\n return;\n }\n\n if (ts.isJsxExpression(node)) {\n collectStrings(node.expression);\n return;\n }\n\n if (ts.isParenthesizedExpression(node)) {\n collectStrings(node.expression);\n return;\n }\n\n if (ts.isBinaryExpression(node)) {\n collectStrings(node.left);\n collectStrings(node.right);\n return;\n }\n\n if (ts.isConditionalExpression(node)) {\n collectStrings(node.whenTrue);\n collectStrings(node.whenFalse);\n return;\n }\n\n if (ts.isArrayLiteralExpression(node)) {\n for (const element of node.elements) {\n collectStrings(element);\n }\n return;\n }\n\n if (ts.isCallExpression(node)) {\n for (const arg of node.arguments) {\n collectStrings(arg);\n }\n return;\n }\n\n if (ts.isObjectLiteralExpression(node)) {\n for (const prop of node.properties) {\n if (ts.isPropertyAssignment(prop)) {\n if (ts.isStringLiteral(prop.name) || ts.isIdentifier(prop.name)) {\n result.push({ text: prop.name.text, node: prop.name });\n }\n }\n }\n return;\n }\n }\n\n collectStrings(initializer);\n return result;\n}\n\n/**\n * Gets all imports in a SourceFile mapped by imported identifier to module specifier.\n */\nexport function getFileImports(sourceFile: ts.SourceFile): Record<string, string> {\n const imports: Record<string, string> = {};\n\n ts.forEachChild(sourceFile, (node) => {\n if (ts.isImportDeclaration(node) && node.importClause) {\n const moduleSpecifier = ts.isStringLiteral(node.moduleSpecifier)\n ? node.moduleSpecifier.text\n : \"\";\n\n if (node.importClause.name) {\n imports[node.importClause.name.text] = moduleSpecifier;\n }\n\n if (node.importClause.namedBindings) {\n if (ts.isNamedImports(node.importClause.namedBindings)) {\n node.importClause.namedBindings.elements.forEach((spec) => {\n const localName = spec.name.text;\n imports[localName] = moduleSpecifier;\n });\n } else if (ts.isNamespaceImport(node.importClause.namedBindings)) {\n imports[node.importClause.namedBindings.name.text] = moduleSpecifier;\n }\n }\n }\n });\n\n return imports;\n}\n\n","import ts from \"typescript\";\r\nimport type { DseConfig } from \"../config/types.js\";\r\nimport {\r\n getJsxTagName,\r\n getJsxAttributes,\r\n extractClassNames,\r\n getNodePosition,\r\n type ExtractedClass,\r\n} from \"../parser/ast.js\";\r\nimport {\r\n splitClassString,\r\n decomposeToken,\r\n evaluateTypographyToken,\r\n evaluateGeometryToken,\r\n evaluateColorToken,\r\n} from \"../tokens/index.js\";\r\nimport type { AddViolationFn } from \"./types.js\";\r\n\r\nexport function runAstRules(\r\n sourceFile: ts.SourceFile,\r\n filePath: string,\r\n addViolation: AddViolationFn,\r\n fileImports: Record<string, string>,\r\n config: DseConfig\r\n): void {\r\n const isTsx = filePath.endsWith(\".tsx\") || filePath.endsWith(\".jsx\");\r\n if (!isTsx) return;\r\n\r\n const content = sourceFile.getFullText();\r\n const fileLines = content.split(\"\\n\");\r\n\r\n let hasTable = false;\r\n let hasTableHeader = false;\r\n let hasTableHead = false;\r\n let hasTableBody = false;\r\n let hasTableRow = false;\r\n let hasTableCell = false;\r\n\r\n let usesColumnHeader = false;\r\n let usesResizeDivider = false;\r\n let usesResizableHook = false;\r\n\r\n function visitNode(node: ts.Node, parent: ts.Node | null, ancestors: ts.Node[]) {\r\n if (ts.isJsxElement(node) || ts.isJsxSelfClosingElement(node)) {\r\n const tagName = getJsxTagName(node, sourceFile);\r\n if (!tagName) return;\r\n\r\n const attributes = getJsxAttributes(node, sourceFile);\r\n const pos = getNodePosition(sourceFile, node);\r\n const lineSnippet = fileLines[pos.line - 1] || \"\";\r\n\r\n if (lineSnippet.includes(\"dse-ignore\") || (pos.line > 1 && fileLines[pos.line - 2]?.includes(\"dse-ignore\"))) {\r\n return;\r\n }\r\n\r\n // Track table components\r\n if (tagName === \"Table\") hasTable = true;\r\n else if (tagName === \"TableHeader\") hasTableHeader = true;\r\n else if (tagName === \"TableHead\") hasTableHead = true;\r\n else if (tagName === \"TableBody\") hasTableBody = true;\r\n else if (tagName === \"TableRow\") hasTableRow = true;\r\n else if (tagName === \"TableCell\") hasTableCell = true;\r\n else if (tagName === \"TableColumnHeader\") usesColumnHeader = true;\r\n else if (tagName === \"TableResizeDivider\") usesResizeDivider = true;\r\n\r\n // 1. Raw HTML Elements Check\r\n if (config.rules?.[\"no-raw-html-elements\"] !== \"off\") {\r\n checkRawHtmlElements(tagName, attributes, pos, filePath, addViolation, lineSnippet, config);\r\n }\r\n\r\n // 2. Button Invariants Check\r\n checkButtonInvariants(tagName, attributes, pos, filePath, addViolation, lineSnippet, config);\r\n\r\n // 3. TableHead Invariants\r\n if (tagName === \"TableHead\") {\r\n checkTableHeadInvariants(node, attributes, pos, filePath, addViolation, lineSnippet, sourceFile, config);\r\n }\r\n\r\n // 4. TableBody Invariants\r\n if (tagName === \"TableBody\" && config.rules?.[\"table-no-divide-y\"] !== \"off\") {\r\n checkTableBodyInvariants(attributes, pos, filePath, addViolation, lineSnippet, sourceFile);\r\n }\r\n\r\n // 5. TableCell Invariants\r\n if (tagName === \"TableCell\") {\r\n checkTableCellInvariants(node, attributes, pos, filePath, addViolation, lineSnippet, sourceFile, config);\r\n }\r\n\r\n // 6. Tabs Invariants\r\n if (tagName === \"Tabs\" && config.rules?.[\"tabs-component-required\"] !== \"off\") {\r\n checkTabsElement(attributes, pos, filePath, addViolation, lineSnippet, fileImports);\r\n }\r\n\r\n // 7. Pseudo-Chips\r\n if ((tagName === \"span\" || tagName === \"div\") && config.rules?.[\"no-pseudo-chips\"] !== \"off\") {\r\n checkPseudoChips(tagName, attributes, pos, filePath, addViolation, lineSnippet, sourceFile);\r\n }\r\n\r\n // 8. Element classes (tokens)\r\n checkElementClasses(node, tagName, attributes, pos, filePath, addViolation, sourceFile, config);\r\n }\r\n\r\n if (ts.isCallExpression(node)) {\r\n const fnName = node.expression.getText(sourceFile);\r\n if (fnName === \"useResizableColumns\") {\r\n usesResizableHook = true;\r\n }\r\n }\r\n }\r\n\r\n function walk(node: ts.Node, parent: ts.Node | null, ancestors: ts.Node[]) {\r\n visitNode(node, parent, ancestors);\r\n ancestors.push(node);\r\n ts.forEachChild(node, (child) => walk(child, node, ancestors));\r\n ancestors.pop();\r\n }\r\n\r\n walk(sourceFile, null, []);\r\n\r\n // Global file-level table checks\r\n checkTableFileInvariants(\r\n filePath,\r\n content,\r\n addViolation,\r\n fileImports,\r\n hasTable,\r\n hasTableHeader,\r\n hasTableHead,\r\n hasTableBody,\r\n hasTableRow,\r\n hasTableCell,\r\n usesColumnHeader,\r\n usesResizeDivider,\r\n usesResizableHook,\r\n config\r\n );\r\n}\r\n\r\nfunction checkRawHtmlElements(\r\n tagName: string,\r\n attributes: Record<string, any>,\r\n pos: { line: number; col: number },\r\n filePath: string,\r\n addViolation: AddViolationFn,\r\n lineSnippet: string,\r\n config: DseConfig\r\n) {\r\n // Only check lowercase raw HTML elements (e.g. <button>, <select>, <table>), NOT uppercase React components (<Button>, <Table>)\r\n if (tagName[0] !== tagName[0].toLowerCase()) {\r\n return;\r\n }\r\n\r\n const replacements = config.components?.disallowRawHtml || {};\r\n const configEntry = replacements[tagName.toLowerCase()];\r\n\r\n if (configEntry) {\r\n addViolation(\r\n filePath,\r\n pos.line,\r\n pos.col,\r\n \"no-raw-html-elements\",\r\n `Raw '<${tagName}>' element detected. Use standard design system '<${configEntry.replaceWith}>' component${configEntry.importFrom ? ` from '${configEntry.importFrom}'` : \"\"}.`,\r\n lineSnippet\r\n );\r\n return;\r\n }\r\n\r\n if (tagName === \"input\") {\r\n const typeAttr = attributes.type;\r\n const typeVal = typeAttr && typeAttr.initializer ? typeAttr.initializer.getText().replace(/['\"]/g, \"\") : \"text\";\r\n\r\n if (typeVal === \"checkbox\") {\r\n addViolation(\r\n filePath,\r\n pos.line,\r\n pos.col,\r\n \"no-raw-html-elements\",\r\n `Raw browser default '<input type=\"checkbox\">' detected. Never use unstyled browser checkboxes. Use standard design system '<Checkbox>' or '<Toggle>'.`,\r\n lineSnippet\r\n );\r\n } else if (typeVal === \"radio\") {\r\n addViolation(\r\n filePath,\r\n pos.line,\r\n pos.col,\r\n \"no-raw-html-elements\",\r\n `Raw browser default '<input type=\"radio\">' detected. Never use unstyled browser radio buttons. Use standard design system '<RadioGroup>' or styled toggle.`,\r\n lineSnippet\r\n );\r\n } else if (typeVal === \"range\") {\r\n addViolation(\r\n filePath,\r\n pos.line,\r\n pos.col,\r\n \"no-raw-html-elements\",\r\n `Raw browser default '<input type=\"range\">' detected. Never use unstyled browser sliders. Use standard design system '<Slider>'.`,\r\n lineSnippet\r\n );\r\n } else if (typeVal === \"file\") {\r\n addViolation(\r\n filePath,\r\n pos.line,\r\n pos.col,\r\n \"no-raw-html-elements\",\r\n `Raw browser default '<input type=\"file\">' detected. Never display native unstyled file picker inputs. Use a custom styled dropzone or trigger.`,\r\n lineSnippet\r\n );\r\n } else if (typeVal === \"color\") {\r\n addViolation(\r\n filePath,\r\n pos.line,\r\n pos.col,\r\n \"no-raw-html-elements\",\r\n `Raw browser default '<input type=\"color\">' detected. Never use native browser color pickers. Use a custom color picker component.`,\r\n lineSnippet\r\n );\r\n } else if ([\"text\", \"email\", \"search\", \"password\", \"number\", \"tel\", \"url\"].includes(typeVal)) {\r\n addViolation(\r\n filePath,\r\n pos.line,\r\n pos.col,\r\n \"no-raw-html-elements\",\r\n `Raw browser default '<input type=\"${typeVal}\">' element detected. Use standard design system '<Input>' component.`,\r\n lineSnippet\r\n );\r\n }\r\n }\r\n\r\n}\r\n\r\nfunction checkButtonInvariants(\r\n tagName: string,\r\n attributes: Record<string, any>,\r\n pos: { line: number; col: number },\r\n filePath: string,\r\n addViolation: AddViolationFn,\r\n lineSnippet: string,\r\n config: DseConfig\r\n) {\r\n const isButton = [\"Button\", \"IconButton\", \"ButtonyIcon\", \"FloatingActionButton\"].includes(tagName);\r\n if (!isButton) return;\r\n\r\n if (config.rules?.[\"no-chip-colored-buttons\"] !== \"off\" && attributes.variant && attributes.variant.initializer) {\r\n const varVal = attributes.variant.initializer.getText().replace(/['\"]/g, \"\");\r\n if ([\"danger\", \"success\", \"warning\", \"error\"].includes(varVal)) {\r\n addViolation(\r\n filePath,\r\n pos.line,\r\n pos.col,\r\n \"no-chip-colored-buttons\",\r\n `Button uses semantic chip variant '${varVal}'. Buttons must use neutral variants ('primary', 'outline', 'secondary', 'ghost'). Semantic colors are reserved for <Chip>.`,\r\n lineSnippet\r\n );\r\n }\r\n }\r\n}\r\n\r\nfunction checkTableHeadInvariants(\r\n node: ts.Node,\r\n attributes: Record<string, any>,\r\n pos: { line: number; col: number },\r\n filePath: string,\r\n addViolation: AddViolationFn,\r\n lineSnippet: string,\r\n sourceFile: ts.SourceFile,\r\n config: DseConfig\r\n) {\r\n const hasIconProp = Boolean(attributes.icon);\r\n const rawChildren = node.getText(sourceFile);\r\n\r\n const isCheckboxCol =\r\n /<(?:Checkbox\\b|input[^>]*type=[\"']checkbox[\"'])/i.test(rawChildren) ||\r\n /toggleSelect/i.test(rawChildren) ||\r\n /selectedEmails|selectedIds|selectedLeadIds/i.test(rawChildren) ||\r\n (attributes.resizable?.initializer?.getText(sourceFile) === \"{false}\" && /checkbox/i.test(rawChildren));\r\n\r\n if (config.rules?.[\"table-head-icon-required\"] !== \"off\" && !hasIconProp && !isCheckboxCol) {\r\n addViolation(\r\n filePath,\r\n pos.line,\r\n pos.col,\r\n \"table-head-icon-required\",\r\n \"<TableHead> is missing mandatory 'icon' prop (e.g. icon={<SomeIcon size={20} />}). All table headers must provide an icon component via the 'icon' prop.\",\r\n lineSnippet\r\n );\r\n }\r\n\r\n if (config.rules?.[\"table-resizable-required\"] !== \"off\" && attributes.resizable && attributes.resizable.initializer) {\r\n const resizableVal = attributes.resizable.initializer.getText(sourceFile);\r\n if (resizableVal === \"{false}\" && !isCheckboxCol) {\r\n addViolation(\r\n filePath,\r\n pos.line,\r\n pos.col,\r\n \"table-resizable-required\",\r\n \"Table column header '<TableHead>' has disabled resizable columns with 'resizable={false}'. All data table columns must support column resizing.\",\r\n lineSnippet\r\n );\r\n }\r\n }\r\n\r\n if (config.rules?.[\"table-no-horizontal-stacking\"] !== \"off\") {\r\n if (/(?:email\\s*(?:&|\\/)\\s*deliverability|deliverability\\s*(?:&|\\/)\\s*email|pages\\s*(?:&|\\/)\\s*dupes|warmup\\s*(?:&|\\/)\\s*deliverability)/i.test(rawChildren)) {\r\n addViolation(\r\n filePath,\r\n pos.line,\r\n pos.col,\r\n \"table-no-horizontal-stacking\",\r\n \"Combined column header detected in '<TableHead>'. Distinct metadata attributes must each reside in their own dedicated, resizable column with a distinct icon.\",\r\n lineSnippet\r\n );\r\n }\r\n }\r\n}\r\n\r\nfunction checkTableBodyInvariants(\r\n attributes: Record<string, any>,\r\n pos: { line: number; col: number },\r\n filePath: string,\r\n addViolation: AddViolationFn,\r\n lineSnippet: string,\r\n sourceFile: ts.SourceFile\r\n) {\r\n if (attributes.className) {\r\n const classStrings = extractClassNames(attributes.className.initializer, sourceFile);\r\n classStrings.forEach(({ text }) => {\r\n if (/\\bdivide-y\\b/.test(text)) {\r\n addViolation(\r\n filePath,\r\n pos.line,\r\n pos.col,\r\n \"table-no-divide-y\",\r\n \"Disallowed 'divide-y' detected on '<TableBody>'. In our design system, TableRow natively implements single 'border-b border-neutral-200'. Using 'divide-y' produces double stroke borders.\",\r\n lineSnippet\r\n );\r\n }\r\n });\r\n }\r\n}\r\n\r\nfunction checkTableCellInvariants(\r\n node: ts.Node,\r\n attributes: Record<string, any>,\r\n pos: { line: number; col: number },\r\n filePath: string,\r\n addViolation: AddViolationFn,\r\n lineSnippet: string,\r\n sourceFile: ts.SourceFile,\r\n config: DseConfig\r\n) {\r\n if (attributes && attributes.colSpan) return;\r\n\r\n const childrenText = node.getText(sourceFile);\r\n let hasVerticalStack = false;\r\n let directBlockCount = 0;\r\n\r\n if ((node as any).children) {\r\n (node as any).children.forEach((child: ts.Node) => {\r\n if (ts.isJsxElement(child) || ts.isJsxSelfClosingElement(child)) {\r\n const tag = getJsxTagName(child, sourceFile);\r\n if (tag && [\"div\", \"p\", \"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\"].includes(tag)) {\r\n directBlockCount++;\r\n }\r\n }\r\n });\r\n }\r\n\r\n function inspectCellDescendant(child: ts.Node) {\r\n if (ts.isJsxElement(child) || ts.isJsxSelfClosingElement(child)) {\r\n const childTag = getJsxTagName(child, sourceFile);\r\n const childAttrs = getJsxAttributes(child, sourceFile);\r\n\r\n if (childAttrs.className) {\r\n const classes = extractClassNames(childAttrs.className.initializer, sourceFile);\r\n classes.forEach(({ text }) => {\r\n if (/\\b(?:flex-col|grid-cols-1|space-y-\\d+)\\b/.test(text)) {\r\n hasVerticalStack = true;\r\n }\r\n });\r\n }\r\n\r\n if (config.rules?.[\"table-uniform-typography\"] !== \"off\") {\r\n const isExempt = childTag && [\"Button\", \"IconButton\", \"ButtonyIcon\", \"Chip\", \"Badge\", \"Input\", \"Skeleton\"].includes(childTag);\r\n if (!isExempt && childAttrs.className) {\r\n const classes = extractClassNames(childAttrs.className.initializer, sourceFile);\r\n classes.forEach(({ text }) => {\r\n const tokens = splitClassString(text);\r\n tokens.forEach((t) => {\r\n const dec = decomposeToken(t);\r\n if (!dec) return;\r\n\r\n if (/^text-neutral-(?:400|500|600|700|800)$/.test(dec.core)) {\r\n const childPos = getNodePosition(sourceFile, child);\r\n addViolation(\r\n filePath,\r\n childPos.line,\r\n childPos.col,\r\n \"table-uniform-typography\",\r\n `Mismatched table text styling '${dec.core}' inside '<TableCell>'. Text in tables must use uniform styling ('text-text-primary').`,\r\n lineSnippet\r\n );\r\n }\r\n\r\n if (/^text-(?:xs|2xs|base|lg|xl|2xl|3xl|4xl|5xl|\\[[0-9]+px\\])$/.test(dec.core)) {\r\n const childPos = getNodePosition(sourceFile, child);\r\n addViolation(\r\n filePath,\r\n childPos.line,\r\n childPos.col,\r\n \"table-uniform-typography\",\r\n `Mismatched table text size '${dec.core}' inside '<TableCell>'. In tables, all fonts must have standard 14px size ('text-sm').`,\r\n lineSnippet\r\n );\r\n }\r\n });\r\n });\r\n }\r\n }\r\n }\r\n ts.forEachChild(child, inspectCellDescendant);\r\n }\r\n\r\n if ((node as any).children) {\r\n (node as any).children.forEach(inspectCellDescendant);\r\n }\r\n\r\n if (config.rules?.[\"table-no-cell-stacking\"] !== \"off\") {\r\n if (hasVerticalStack || directBlockCount > 1) {\r\n if (!childrenText.includes(\"dse-ignore-stack\")) {\r\n addViolation(\r\n filePath,\r\n pos.line,\r\n pos.col,\r\n \"table-no-cell-stacking\",\r\n \"Stacked text or metadata items detected inside '<TableCell>'. In our design system, vertical stacking of metadata inside table rows is prohibited. Every piece of metadata must reside in its own dedicated column.\",\r\n lineSnippet\r\n );\r\n }\r\n }\r\n }\r\n\r\n if (config.rules?.[\"table-no-horizontal-stacking\"] !== \"off\") {\r\n if (\r\n /(?:flex\\s+items-center|inline-flex|flex-row|items-center\\s+gap)/.test(childrenText) &&\r\n /<(?:Chip|Badge)\\b/.test(childrenText) &&\r\n /<(?:span|div|p)\\b[^>]*>(?:(?!<\\/(?:span|div|p)>)[\\s\\S])*?(?:email|\\.email|\\{cEmail\\}|\\{item\\.email\\}|@)[^<]*?<\\/(?:span|div|p)>/i.test(childrenText) &&\r\n !childrenText.includes(\"dse-ignore-stack\")\r\n ) {\r\n addViolation(\r\n filePath,\r\n pos.line,\r\n pos.col,\r\n \"table-no-horizontal-stacking\",\r\n \"Horizontal stacking of primary text and metadata status chip detected inside '<TableCell>'. Distinct metadata must reside in dedicated columns.\",\r\n lineSnippet\r\n );\r\n }\r\n }\r\n}\r\n\r\nfunction checkTableFileInvariants(\r\n filePath: string,\r\n content: string,\r\n addViolation: AddViolationFn,\r\n fileImports: Record<string, string>,\r\n hasTable: boolean,\r\n hasTableHeader: boolean,\r\n hasTableHead: boolean,\r\n hasTableBody: boolean,\r\n hasTableRow: boolean,\r\n hasTableCell: boolean,\r\n usesColumnHeader: boolean,\r\n usesResizeDivider: boolean,\r\n usesResizableHook: boolean,\r\n config: DseConfig\r\n) {\r\n if (config.rules?.[\"table-resizable-required\"] !== \"off\") {\r\n const usesTablePrimitivesWithoutTable = (usesColumnHeader || usesResizeDivider || usesResizableHook) && !hasTable;\r\n if (usesTablePrimitivesWithoutTable) {\r\n addViolation(\r\n filePath,\r\n 1,\r\n 1,\r\n \"table-resizable-required\",\r\n \"Ad-hoc div table detected. Constructing custom data grids without using the official '<Table>' suite is prohibited. Use <Table>, <TableHeader>, <TableHead>, <TableBody>, <TableRow>, and <TableCell>.\",\r\n \"\"\r\n );\r\n }\r\n }\r\n\r\n if (hasTable && config.rules?.[\"table-single-border\"] !== \"off\") {\r\n if (/<div\\b[^>]*\\b(?:border\\b|border-stroke|border-neutral)\\b[^>]*>\\s*<Table\\b/.test(content)) {\r\n addViolation(\r\n filePath,\r\n 1,\r\n 1,\r\n \"table-single-border\",\r\n \"Redundant outer border wrapper detected immediately surrounding '<Table>'. The '<Table>' component natively provides the official standard container. Remove redundant outer border wrapper.\",\r\n \"\"\r\n );\r\n }\r\n }\r\n\r\n if (hasTable && config.rules?.[\"table-windowed-pagination\"] !== \"off\") {\r\n const normFilePath = filePath.replace(/\\\\/g, \"/\");\r\n const isExcludedFromPagination =\r\n normFilePath.includes(\"components/ui/table.tsx\") ||\r\n normFilePath.includes(\"components/settings/\") ||\r\n normFilePath.includes(\"app/(dashboard)/settings\") ||\r\n normFilePath.includes(\"lead-import-modal.tsx\") ||\r\n content.includes(\"dse-ignore-pagination\");\r\n\r\n if (!isExcludedFromPagination) {\r\n const hasPagination =\r\n /paginate|safe[A-Z0-9_]*Page|currentPage|leadPage|sessionPage|campPage|total[A-Z0-9_]*Pages|pageSize|Dropdown[^>]*options=.*(?:10|25|50|100)/i.test(content) ||\r\n /Showing\\s+[\\s\\S]*?\\bto\\b[\\s\\S]*?\\bof\\b/i.test(content);\r\n\r\n if (!hasPagination) {\r\n addViolation(\r\n filePath,\r\n 1,\r\n 1,\r\n \"table-windowed-pagination\",\r\n \"Data table in '<Table>' is missing windowed pagination controls. Tables rendering collections must support pagination with page size selector, Previous/Next buttons, and range indicator.\",\r\n \"\"\r\n );\r\n }\r\n }\r\n }\r\n}\r\n\r\nfunction checkTabsElement(\r\n attributes: Record<string, any>,\r\n pos: { line: number; col: number },\r\n filePath: string,\r\n addViolation: AddViolationFn,\r\n lineSnippet: string,\r\n fileImports: Record<string, string>\r\n) {\r\n const normPath = filePath.replace(/\\\\/g, \"/\");\r\n if (normPath.endsWith(\"components/ui/tabs.tsx\")) return;\r\n\r\n if (!attributes.items) {\r\n addViolation(\r\n filePath,\r\n pos.line,\r\n pos.col,\r\n \"tabs-component-required\",\r\n \"<Tabs> is missing mandatory 'items' prop. All Tabs components must provide an array of items [{ id, label, icon?, badge?, count?, disabled? }].\",\r\n lineSnippet\r\n );\r\n }\r\n}\r\n\r\nfunction checkPseudoChips(\r\n tagName: string,\r\n attributes: Record<string, any>,\r\n pos: { line: number; col: number },\r\n filePath: string,\r\n addViolation: AddViolationFn,\r\n lineSnippet: string,\r\n sourceFile: ts.SourceFile\r\n) {\r\n const normPath = filePath.replace(/\\\\/g, \"/\");\r\n if (normPath.endsWith(\"components/ui/chip.tsx\") || normPath.endsWith(\"components/ui/badge.tsx\")) return;\r\n\r\n if (!attributes.className) return;\r\n\r\n const classStrings = extractClassNames(attributes.className.initializer, sourceFile);\r\n classStrings.forEach(({ text }) => {\r\n const tokens = text.split(/\\s+/);\r\n const hasStaticBg = tokens.some((t) => /^(?:dark:)?bg-(?:neutral|emerald|amber|red|blue)-\\d+/.test(t));\r\n const hasRadius = tokens.some((t) => /^(?:rounded-md|rounded-full)$/.test(t));\r\n const hasPadding = tokens.some((t) => /^(?:px-(?:1|1\\.5|2|2\\.5|3)|p-(?:0\\.5|1))$/.test(t));\r\n\r\n if (hasStaticBg && hasRadius && hasPadding && !lineSnippet.includes(\"dse-ignore-chip\")) {\r\n addViolation(\r\n filePath,\r\n pos.line,\r\n pos.col,\r\n \"no-pseudo-chips\",\r\n `Pseudo-chip detected on '<${tagName}>'. Never use raw <span> or <div> elements styled with background fills and rounded corners to emulate chips. Use the standard '<Chip>' component.`,\r\n lineSnippet\r\n );\r\n }\r\n });\r\n}\r\n\r\nfunction checkElementClasses(\r\n node: ts.Node,\r\n tagName: string,\r\n attributes: Record<string, any>,\r\n pos: { line: number; col: number },\r\n filePath: string,\r\n addViolation: AddViolationFn,\r\n sourceFile: ts.SourceFile,\r\n config: DseConfig\r\n) {\r\n if (!attributes.className) return;\r\n\r\n const isButton = [\"Button\", \"IconButton\", \"ButtonyIcon\", \"FloatingActionButton\"].includes(tagName);\r\n const isChip = [\"Chip\", \"Badge\", \"Tag\", \"StatusBadge\"].includes(tagName);\r\n const isTab = [\"Tab\", \"TabTrigger\", \"TabsTrigger\"].includes(tagName);\r\n const isCompactElement = isButton || isChip || isTab;\r\n\r\n const isCheckbox =\r\n\r\n tagName === \"Checkbox\" ||\r\n attributes.type?.initializer?.getText(sourceFile)?.includes(\"checkbox\") ||\r\n attributes.role?.initializer?.getText(sourceFile)?.includes(\"checkbox\") ||\r\n Boolean(attributes[\"aria-checked\"]) ||\r\n (attributes.className && /\\b(?:size-5|w-5\\s+h-5)\\b/.test(attributes.className.rawText));\r\n\r\n const lineSnippet = sourceFile.getFullText().split(\"\\n\")[pos.line - 1] || \"\";\r\n const classStrings = extractClassNames(attributes.className.initializer, sourceFile);\r\n\r\n classStrings.forEach(({ text, node: stringNode }) => {\r\n const tokens = splitClassString(text);\r\n tokens.forEach((rawToken) => {\r\n const dec = decomposeToken(rawToken);\r\n if (!dec) return;\r\n\r\n const nodePos = stringNode ? getNodePosition(sourceFile, stringNode) : pos;\r\n\r\n // Typography checks\r\n const typoViolations = evaluateTypographyToken(dec.core, config.tokens?.typography);\r\n typoViolations.forEach((v) => {\r\n if (config.rules?.[v.rule as keyof typeof config.rules] !== \"off\") {\r\n addViolation(filePath, nodePos.line, nodePos.col, v.rule, v.message, lineSnippet);\r\n }\r\n });\r\n\r\n // Geometry checks\r\n const geoViolations = evaluateGeometryToken(dec.core, config.tokens?.geometry, isCheckbox);\r\n geoViolations.forEach((v) => {\r\n if (config.rules?.[v.rule as keyof typeof config.rules] !== \"off\") {\r\n addViolation(filePath, nodePos.line, nodePos.col, v.rule, v.message, lineSnippet);\r\n }\r\n });\r\n\r\n // Color checks\r\n const colorViolations = evaluateColorToken(dec.core, config.tokens?.colors);\r\n colorViolations.forEach((v) => {\r\n if (config.rules?.[v.rule as keyof typeof config.rules] !== \"off\") {\r\n addViolation(filePath, nodePos.line, nodePos.col, v.rule, v.message, lineSnippet);\r\n }\r\n });\r\n\r\n // Control height check (Buttons, Controls)\r\n if (isButton && config.rules?.[\"control-height-max\"] !== \"off\") {\r\n if (/\\bh-(?:10|11|12|14|16|\\[(?:3[8-9]|[4-9][0-9]|[1-9][0-9]{2,})px\\])\\b/.test(dec.core)) {\r\n addViolation(\r\n filePath,\r\n nodePos.line,\r\n nodePos.col,\r\n \"control-height-max\",\r\n `Disallowed button height '${dec.core}'. Interactive buttons and controls must standardise on max 36px height ('h-[36px]' or 'h-9').`,\r\n lineSnippet\r\n );\r\n }\r\n }\r\n\r\n // Disallow multi-line text wrapping on compact controls (Buttons, Chips, Badges, Tabs)\r\n if (isCompactElement && config.rules?.[\"no-wrapping-compact-elements\"] !== \"off\") {\r\n if (dec.core === \"flex-wrap\" || dec.core === \"whitespace-normal\" || dec.core === \"whitespace-pre-wrap\") {\r\n addViolation(\r\n filePath,\r\n nodePos.line,\r\n nodePos.col,\r\n \"no-wrapping-compact-elements\",\r\n `Disallowed text wrapping class '${dec.core}' on <${tagName}>. Compact interactive elements (buttons, chips, badges, tabs) must never wrap text across multiple lines.`,\r\n lineSnippet\r\n );\r\n }\r\n }\r\n });\r\n });\r\n\r\n // TableHead wrap check\r\n if (tagName === \"TableHead\" && config.rules?.[\"no-wrapping-compact-elements\"] !== \"off\") {\r\n const rawClass = attributes.className?.rawText || \"\";\r\n if (/\\b(?:flex-wrap|whitespace-normal|whitespace-pre-wrap)\\b/.test(rawClass)) {\r\n addViolation(\r\n filePath,\r\n pos.line,\r\n pos.col,\r\n \"no-wrapping-compact-elements\",\r\n `Disallowed text wrapping on <TableHead>. Column headers must remain single-line ('whitespace-nowrap') to preserve table column alignment.`,\r\n lineSnippet\r\n );\r\n }\r\n }\r\n}\r\n","import type { TypographyConfig, GeometryConfig, ColorsConfig } from \"../config/types.js\";\n\nexport interface DecomposedToken {\n raw: string;\n core: string;\n variants: string[];\n}\n\nexport interface TokenViolation {\n rule: string;\n message: string;\n}\n\n/**\n * Splits a class string (including multiline whitespace) into distinct token strings.\n */\nexport function splitClassString(str?: string | null): string[] {\n if (!str || typeof str !== \"string\") return [];\n return str.split(/\\s+/).filter(Boolean);\n}\n\n/**\n * Decomposes a Tailwind token into variants and core token.\n * e.g. \"hover:focus:md:text-xs\" -> { variants: [\"hover\", \"focus\", \"md\"], core: \"text-xs\" }\n */\nexport function decomposeToken(rawToken?: string | null): DecomposedToken | null {\n if (!rawToken || typeof rawToken !== \"string\") return null;\n\n const parts: string[] = [];\n let bracketDepth = 0;\n let current = \"\";\n\n for (let i = 0; i < rawToken.length; i++) {\n const char = rawToken[i];\n if (char === \"[\" || char === \"(\") {\n bracketDepth++;\n current += char;\n } else if (char === \"]\" || char === \")\") {\n bracketDepth = Math.max(0, bracketDepth - 1);\n current += char;\n } else if (char === \":\" && bracketDepth === 0) {\n parts.push(current);\n current = \"\";\n } else {\n current += char;\n }\n }\n if (current) parts.push(current);\n\n const core = parts.pop() || \"\";\n const variants = parts;\n\n return { raw: rawToken, core, variants };\n}\n\n/**\n * Checks a core token for typography violations.\n */\nexport function evaluateTypographyToken(core: string, config?: TypographyConfig): TokenViolation[] {\n const violations: TokenViolation[] = [];\n const minFont = config?.minFontSize || \"14px\";\n const maxFont = config?.maxFontSize || \"32px\";\n const maxWeight = config?.maxFontWeight ?? 500;\n const disallowArbitrary = config?.disallowArbitrarySizes ?? true;\n const disallowUppercase = config?.disallowUppercase ?? true;\n\n // 1. Font size < 14px (or configured min)\n if (/^text-(?:xs|2xs)$/.test(core)) {\n violations.push({\n rule: \"font-size-min\",\n message: `Disallowed font size '${core}' is smaller than ${minFont}. Primary body font must strictly be standard ${minFont} ('text-sm').`,\n });\n }\n\n // 2. Arbitrary bracket sizes: text-[...]\n const arbitrarySizeMatch = core.match(/^text-\\[(\\d+(?:\\.\\d+)?)(px|rem|em)\\]$/);\n if (arbitrarySizeMatch) {\n const num = parseFloat(arbitrarySizeMatch[1]);\n const unit = arbitrarySizeMatch[2];\n const pxVal = unit === \"rem\" || unit === \"em\" ? num * 16 : num;\n\n if (pxVal < 14) {\n violations.push({\n rule: \"font-size-min\",\n message: `Disallowed arbitrary font size '${core}' (${pxVal}px) is below minimum allowed size (${minFont}).`,\n });\n } else if (pxVal > 32) {\n violations.push({\n rule: \"font-size-max\",\n message: `Disallowed arbitrary font size '${core}' (${pxVal}px) exceeds maximum allowed heading size (${maxFont}).`,\n });\n } else if (disallowArbitrary) {\n violations.push({\n rule: \"no-arbitrary-text-size\",\n message: `Arbitrary font size '${core}' is prohibited. Use standard typography tokens ('text-sm', 'text-base', 'text-lg', 'text-xl', 'text-2xl').`,\n });\n }\n }\n\n // 3. Font sizes exceeding 32px\n if (/^text-(?:3xl|4xl|5xl|6xl|7xl|8xl|9xl)$/.test(core)) {\n violations.push({\n rule: \"font-size-max\",\n message: `Disallowed font size '${core}' exceeds maximum allowed heading cap of ${maxFont}.`,\n });\n }\n\n // 4. Font weight exceeding Medium (500)\n if (maxWeight <= 500) {\n if (/^font-(?:semibold|bold|extrabold|black)$/.test(core)) {\n violations.push({\n rule: \"font-weight-max\",\n message: `Disallowed font weight '${core}' exceeds maximum allowed weight (500 / Medium).`,\n });\n }\n const arbitraryWeightMatch = core.match(/^font-\\[(\\d+)\\]$/);\n if (arbitraryWeightMatch) {\n const weight = parseInt(arbitraryWeightMatch[1], 10);\n if (weight > maxWeight) {\n violations.push({\n rule: \"font-weight-max\",\n message: `Disallowed arbitrary font weight '${core}' (${weight}) exceeds maximum allowed weight (${maxWeight} / Medium).`,\n });\n }\n }\n }\n\n // 5. Uppercase text transformation\n if (disallowUppercase && core === \"uppercase\") {\n violations.push({\n rule: \"no-uppercase-text\",\n message: `CSS text transformation '${core}' is disallowed. Use standard sentence case or title case.`,\n });\n }\n\n return violations;\n}\n\n/**\n * Checks a core token for geometry & corner radius violations.\n */\nexport function evaluateGeometryToken(core: string, config?: GeometryConfig, isCheckbox = false): TokenViolation[] {\n const violations: TokenViolation[] = [];\n const allowedRadii = new Set(config?.allowedRadii || [\"0\", \"0px\", \"8px\", \"12px\", \"16px\", \"9999px\", \"100%\"]);\n const checkboxRadii = new Set(config?.radiiExceptions?.Checkbox || [\"0\", \"0px\", \"4px\", \"0.25rem\", \"8px\", \"12px\", \"16px\", \"9999px\", \"100%\"]);\n\n // Standard corner radius classes\n if (/^rounded(?:-(?:xs|sm|md|lg|xl|2xl|3xl|none|full))?$/.test(core)) {\n if (core === \"rounded-xs\" || core === \"rounded\") {\n if (!isCheckbox) {\n violations.push({\n rule: \"corner-radius-allowed\",\n message: `4px corner radius ('${core}') is strictly reserved for checkboxes only. Standard components must use 'rounded-md' (8px) or 'rounded-lg' (12px).`,\n });\n }\n } else if (core === \"rounded-2xl\" || core === \"rounded-3xl\") {\n violations.push({\n rule: \"corner-radius-allowed\",\n message: `Oversized corner radius '${core}' is disallowed. Standard components must use 'rounded-md' (8px) or 'rounded-lg' (12px).`,\n });\n }\n }\n\n // Arbitrary radius: rounded-[...]\n const radiusMatch = core.match(/^rounded(?:-[trblse])?-\\[([^\\]]+)\\]$/);\n if (radiusMatch) {\n const val = radiusMatch[1].trim();\n const effectiveSet = isCheckbox ? checkboxRadii : allowedRadii;\n if (!effectiveSet.has(val)) {\n violations.push({\n rule: \"corner-radius-allowed\",\n message: `Disallowed arbitrary corner radius '${core}' (${val}). Allowed values: ${Array.from(effectiveSet).join(\", \")}.`,\n });\n }\n }\n\n return violations;\n}\n\n/**\n * Checks a core token for color palette violations.\n */\nexport function evaluateColorToken(core: string, config?: ColorsConfig): TokenViolation[] {\n const violations: TokenViolation[] = [];\n const bannedFamilies = new Set(config?.bannedColorFamilies || []);\n\n if (bannedFamilies.size > 0) {\n // Matches bg-purple-500, text-indigo-600, border-violet-400, from-purple-600, to-indigo-600, via-pink-500\n const colorMatch = core.match(/^(?:bg|text|border|ring|stroke|fill|from|to|via)-([a-z]+)-[0-9]{2,3}$/);\n if (colorMatch) {\n const family = colorMatch[1];\n if (bannedFamilies.has(family)) {\n violations.push({\n rule: \"no-banned-colors\",\n message: `Disallowed off-palette color class '${core}'. Color family '${family}' (purple, indigo, violet, etc.) is not permitted in our design system.`,\n });\n }\n }\n }\n\n // Cheesy AI Gradient Checks\n if (config?.disallowSaturatedGradients) {\n if (core === \"bg-clip-text\" || core === \"text-transparent\") {\n violations.push({\n rule: \"no-unapproved-gradients\",\n message: `Gradient text styling '${core}' detected. Cheesy AI gradient text is prohibited. Use standard high-contrast text typography.`,\n });\n }\n }\n\n return violations;\n}\n","import type { DseConfig } from \"../config/types.js\";\nimport type { AddViolationFn } from \"./types.js\";\n\nexport function runRegexRules(\n content: string,\n filePath: string,\n addViolation: AddViolationFn,\n config: DseConfig\n): void {\n const lines = content.split(\"\\n\");\n // Only match actual Unicode arrows and ASCII arrows like -> or <-, NOT JS arrow functions '=>'\n const unicodeArrowRegex = /[\\u2190-\\u2199\\u21D0-\\u21D9\\u2794-\\u27BF\\u21B0-\\u21B5\\u27F5-\\u27FF]|(?:->|<-)/gu;\n const hexColorRegex = /#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})\\b/g;\n const backdropBlurRegex = /\\bbackdrop-blur(?:-[a-z0-9]+)?\\b/g;\n\n // Track button tags across lines\n let inButtonTag = false;\n const disallowedButtonColorRegex = /(?:bg-(?:emerald|green|red|amber|rose|pink|purple|indigo)-[0-9]{2,3}|border-(?:emerald|green|red|amber|rose|pink|purple|indigo)-[0-9]{2,3})\\b|variant=[\"'](?:danger|success|warning|error)[\"']/g;\n const buttonOpenRegex = /<(?:Button|IconButton|FloatingActionButton|ButtonyIcon)\\b/g;\n const buttonCloseRegex = /<\\/(?:Button|IconButton|FloatingActionButton|ButtonyIcon)>/g;\n const buttonSelfCloseRegex = /<(?:Button|IconButton|FloatingActionButton|ButtonyIcon)\\b[^>]*\\/>/g;\n\n lines.forEach((line, idx) => {\n const lineNum = idx + 1;\n const trimmed = line.trim();\n\n if (\n line.includes(\"dse-ignore\") ||\n trimmed.startsWith(\"//\") ||\n trimmed.startsWith(\"/*\") ||\n trimmed.startsWith(\"*\") ||\n trimmed.startsWith(\"<!--\")\n ) {\n return;\n }\n\n // Strip inline comments before regex checks so comments like /* White (#ffffff) */ or <!-- ... --> are never flagged\n const codeOnlyLine = line\n .replace(/<!--[\\s\\S]*?-->/g, \"\")\n .replace(/\\/\\*[\\s\\S]*?\\*\\//g, \"\")\n .replace(/\\/\\/.*$/, \"\");\n\n // 1. Arrow symbols\n if (config.rules?.[\"no-text-arrows\"] !== \"off\") {\n unicodeArrowRegex.lastIndex = 0;\n let match: RegExpExecArray | null;\n while ((match = unicodeArrowRegex.exec(codeOnlyLine)) !== null) {\n addViolation(\n filePath,\n lineNum,\n match.index + 1,\n \"no-text-arrows\",\n `Raw text/ASCII arrow '${match[0]}' detected. Disallowed in UI; use design system icon components instead.`,\n line\n );\n }\n }\n\n // 2. Backdrop blur\n if (config.rules?.[\"no-backdrop-blur\"] !== \"off\") {\n // Don't flag rule config names like \"no-backdrop-blur\"\n if (!codeOnlyLine.includes(\"no-backdrop-blur\")) {\n backdropBlurRegex.lastIndex = 0;\n let match: RegExpExecArray | null;\n while ((match = backdropBlurRegex.exec(codeOnlyLine)) !== null) {\n addViolation(\n filePath,\n lineNum,\n match.index + 1,\n \"no-backdrop-blur\",\n `Disallowed backdrop blur '${match[0]}' detected. Backdrop blur is prohibited across the design system.`,\n line\n );\n }\n }\n }\n\n // 3. Raw hex colors\n if (config.rules?.[\"no-raw-hex-colors\"] !== \"off\") {\n hexColorRegex.lastIndex = 0;\n let match: RegExpExecArray | null;\n while ((match = hexColorRegex.exec(codeOnlyLine)) !== null) {\n const hex = match[0];\n // Allow pure black/white if explicitly permitted or in SVG data\n if (!codeOnlyLine.includes(\"svg\") && !codeOnlyLine.includes(\"xmlns\")) {\n addViolation(\n filePath,\n lineNum,\n match.index + 1,\n \"no-raw-hex-colors\",\n `Raw hex color '${hex}' detected. Use theme tokens or CSS variables instead of hardcoded hex values.`,\n line\n );\n }\n }\n }\n\n // 4. Button chip colors across multi-line tags\n if (config.rules?.[\"no-chip-colored-buttons\"] !== \"off\") {\n buttonOpenRegex.lastIndex = 0;\n if (buttonOpenRegex.test(line)) {\n inButtonTag = true;\n }\n\n if (inButtonTag) {\n disallowedButtonColorRegex.lastIndex = 0;\n let match: RegExpExecArray | null;\n while ((match = disallowedButtonColorRegex.exec(line)) !== null) {\n if (!line.includes(\"dse-ignore-button-color\")) {\n addViolation(\n filePath,\n lineNum,\n match.index + 1,\n \"no-chip-colored-buttons\",\n `Disallowed chip color '${match[0]}' applied to Button. Buttons must never use semantic chip colors.`,\n line\n );\n }\n }\n\n buttonCloseRegex.lastIndex = 0;\n buttonSelfCloseRegex.lastIndex = 0;\n if (buttonCloseRegex.test(line) || buttonSelfCloseRegex.test(line) || line.includes(\">\")) {\n inButtonTag = false;\n }\n }\n }\n });\n}\n","import type { DseConfig } from \"../config/types.js\";\nimport type { AddViolationFn } from \"./types.js\";\n\nfunction isInsidePythonString(line: string, index: number): boolean {\n let inSingle = false;\n let inDouble = false;\n for (let i = 0; i < index; i++) {\n const char = line[i];\n if (char === \"\\\\\") {\n i++;\n continue;\n }\n if (char === \"'\" && !inDouble) inSingle = !inSingle;\n if (char === '\"' && !inSingle) inDouble = !inDouble;\n }\n return inSingle || inDouble;\n}\n\n/**\n * Rules engine specifically adapted for Python (.py), HTML (.html, .jinja), and CSS (.css) files.\n */\nexport function runPythonRules(\n content: string,\n filePath: string,\n addViolation: AddViolationFn,\n config: DseConfig\n): void {\n const lines = content.split(\"\\n\");\n const isPython = filePath.endsWith(\".py\");\n const isCssOrHtml = filePath.endsWith(\".css\") || filePath.endsWith(\".html\") || filePath.endsWith(\".jinja\") || filePath.endsWith(\".jinja2\");\n\n const unicodeArrowRegex = /[\\u2190-\\u2199\\u21D0-\\u21D9\\u2794-\\u27BF\\u21B0-\\u21B5\\u27F5-\\u27FF]|(?:->|<-)/gu;\n const hexColorRegex = /#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})\\b/g;\n\n // Track if we are inside a CSS block or multiline string\n let inStyleBlock = false;\n\n lines.forEach((line, idx) => {\n const lineNum = idx + 1;\n const trimmed = line.trim();\n\n // Check ignore comments\n if (line.includes(\"dse-ignore\") || trimmed.startsWith(\"#\") || trimmed.startsWith(\"//\") || trimmed.startsWith(\"/*\")) {\n return;\n }\n\n // Strip inline comments before checks so #ff0000 in python comments or /* #fff */ is ignored\n const codeOnlyLine = isPython\n ? line.replace(/#.*$/, \"\")\n : line.replace(/\\/\\*[\\s\\S]*?\\*\\//g, \"\").replace(/\\/\\/.*$/, \"\");\n\n // Track <style> blocks (e.g. in Streamlit st.markdown(\"\"\"<style>...\"\"\") or HTML)\n if (line.includes(\"<style>\")) inStyleBlock = true;\n if (line.includes(\"</style>\")) inStyleBlock = false;\n\n // 1. Text Arrow Check\n if (config.rules?.[\"no-text-arrows\"] !== \"off\") {\n unicodeArrowRegex.lastIndex = 0;\n let match: RegExpExecArray | null;\n while ((match = unicodeArrowRegex.exec(codeOnlyLine)) !== null) {\n const arrow = match[0];\n\n // In Python files, '->' outside string literals is ALWAYS a function return type hint:\n // e.g. def foo() -> int:, ) -> list:, ) -> Groq:, Callable[..., Any] -> None\n if (isPython && arrow === \"->\" && !isInsidePythonString(line, match.index)) {\n continue; // Skip Python type annotations\n }\n\n // Only check arrows inside strings or UI copy\n addViolation(\n filePath,\n lineNum,\n match.index + 1,\n \"no-text-arrows\",\n `Raw text arrow '${arrow}' detected. Use design system icon components instead of raw arrows.`,\n line\n );\n }\n }\n\n // 2. CSS Invariant Checks (inside <style> blocks or .css files)\n if (inStyleBlock || isCssOrHtml) {\n // Font size checks: font-size: 11px\n const fontSizeMatch = line.match(/font-size\\s*:\\s*(\\d+(?:\\.\\d+)?)(px|rem)/i);\n if (fontSizeMatch) {\n const val = parseFloat(fontSizeMatch[1]);\n const unit = fontSizeMatch[2].toLowerCase();\n const px = unit === \"rem\" ? val * 16 : val;\n\n if (px < 14 && config.rules?.[\"font-size-min\"] !== \"off\") {\n addViolation(\n filePath,\n lineNum,\n fontSizeMatch.index || 1,\n \"font-size-min\",\n `Disallowed font-size '${fontSizeMatch[0]}' (${px}px) is smaller than 14px. Primary body font must strictly be standard 14px.`,\n line\n );\n } else if (px > 32 && config.rules?.[\"font-size-max\"] !== \"off\") {\n addViolation(\n filePath,\n lineNum,\n fontSizeMatch.index || 1,\n \"font-size-max\",\n `Disallowed font-size '${fontSizeMatch[0]}' (${px}px) exceeds maximum allowed heading cap of 32px.`,\n line\n );\n }\n }\n\n // Font weight checks: font-weight: 600 / bold\n const fontWeightMatch = line.match(/font-weight\\s*:\\s*([0-9]{3}|bold|bolder|semibold)/i);\n if (fontWeightMatch && config.rules?.[\"font-weight-max\"] !== \"off\") {\n const rawWeight = fontWeightMatch[1].toLowerCase();\n const weightNum = parseInt(rawWeight, 10);\n if (weightNum > 500 || [\"bold\", \"bolder\", \"semibold\"].includes(rawWeight)) {\n addViolation(\n filePath,\n lineNum,\n fontWeightMatch.index || 1,\n \"font-weight-max\",\n `Disallowed font-weight '${fontWeightMatch[0]}'. Font weight must not exceed Medium (500).`,\n line\n );\n }\n }\n\n // Backdrop blur\n if (config.rules?.[\"no-backdrop-blur\"] !== \"off\" && /backdrop-filter\\s*:\\s*blur/i.test(line)) {\n addViolation(\n filePath,\n lineNum,\n 1,\n \"no-backdrop-blur\",\n \"Disallowed backdrop blur filter detected in styles. Backdrop blur is prohibited across the design system.\",\n line\n );\n }\n }\n\n // 3. Raw Hex Color checks (in styling contexts or UI definitions)\n if (config.rules?.[\"no-raw-hex-colors\"] !== \"off\") {\n hexColorRegex.lastIndex = 0;\n let match: RegExpExecArray | null;\n while ((match = hexColorRegex.exec(line)) !== null) {\n const hex = match[0];\n // Flag hex colors in styling, CSS, or UI color definitions\n if (inStyleBlock || isCssOrHtml || /(?:color|background|bg|border|fill|stroke|theme)\\s*[:=]/i.test(line)) {\n addViolation(\n filePath,\n lineNum,\n match.index + 1,\n \"no-raw-hex-colors\",\n `Raw hex color '${hex}' detected. Centralize theme colors in configuration or CSS variables instead of hardcoded hex values.`,\n line\n );\n }\n }\n }\n });\n}\n\n","import pc from \"picocolors\";\nimport type { ScanResult } from \"../config/types.js\";\n\nexport function formatStylish(result: ScanResult): string {\n const output: string[] = [];\n\n output.push(\"\");\n output.push(pc.bold(pc.cyan(\"========================================================\")));\n output.push(pc.bold(pc.cyan(\" DESIGN SYSTEM ENFORCER (DSE) - SCAN REPORT \")));\n output.push(pc.bold(pc.cyan(\"========================================================\")));\n output.push(`Scanned ${pc.bold(result.scannedFilesCount)} files.`);\n output.push(\"\");\n\n // Component Inventory\n if (Object.keys(result.componentInventory).length > 0) {\n output.push(pc.bold(pc.dim(\"--- Design System Components Inventory ---\")));\n for (const [name, info] of Object.entries(result.componentInventory)) {\n const paddedName = `<${name}`.padEnd(22) + \">\";\n if (info.active) {\n output.push(` • ${pc.white(paddedName)} : ${pc.green(\"✔ active\")} (${info.fileCount} files)`);\n } else {\n output.push(` • ${pc.white(paddedName)} : ${pc.red(\"✖ UNUSED / DEAD COMPONENT\")}`);\n }\n }\n output.push(\"\");\n }\n\n // Violations grouped by file\n if (result.violations.length > 0) {\n output.push(pc.bold(pc.red(`Found ${result.errorCount} error(s) and ${result.warningCount} warning(s):`)));\n output.push(\"\");\n\n const grouped: Record<string, typeof result.violations> = {};\n for (const v of result.violations) {\n if (!grouped[v.file]) grouped[v.file] = [];\n grouped[v.file].push(v);\n }\n\n for (const [file, items] of Object.entries(grouped)) {\n output.push(pc.underline(pc.bold(file)));\n for (const item of items) {\n const badge = item.severity === \"error\" ? pc.red(\"error\") : pc.yellow(\"warning\");\n output.push(\n ` ${pc.dim(`${item.line}:${item.col}`)} ${badge} ${item.message} ${pc.dim(`(${item.rule})`)}`\n );\n if (item.snippet) {\n output.push(` ${pc.dim(\">\")} ${pc.italic(item.snippet)}`);\n }\n }\n output.push(\"\");\n }\n\n output.push(\n pc.bold(\n pc.red(\n `✖ Failed with ${result.errorCount} error(s). Please resolve all Design System Enforcer violations before committing or deploying.`\n )\n )\n );\n } else {\n output.push(pc.bold(pc.green(\"✔ PERFECT! All files strictly comply with the Design System Enforcer rules.\")));\n }\n\n output.push(\"\");\n return output.join(\"\\n\");\n}\n\n","import type { ScanResult } from \"../config/types.js\";\n\nexport function formatJson(result: ScanResult): string {\n return JSON.stringify(result, null, 2);\n}\n\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport pc from \"picocolors\";\nimport { tokensTemplate } from \"./templates/tokens.js\";\nimport { cssTemplate } from \"./templates/css.js\";\nimport {\n buttonTemplate,\n chipTemplate,\n inputTemplate,\n dropdownTemplate,\n tableTemplate,\n tabsTemplate,\n cardTemplate,\n checkboxTemplate,\n skeletonTemplate,\n} from \"./templates/components.js\";\n\nexport const COMPONENT_TEMPLATES: Record<string, { filename: string; content: string }> = {\n button: { filename: \"button.tsx\", content: buttonTemplate },\n chip: { filename: \"chip.tsx\", content: chipTemplate },\n badge: { filename: \"badge.tsx\", content: chipTemplate },\n input: { filename: \"input.tsx\", content: inputTemplate },\n dropdown: { filename: \"dropdown.tsx\", content: dropdownTemplate },\n table: { filename: \"table.tsx\", content: tableTemplate },\n tabs: { filename: \"tabs.tsx\", content: tabsTemplate },\n card: { filename: \"card.tsx\", content: cardTemplate },\n checkbox: { filename: \"checkbox.tsx\", content: checkboxTemplate },\n skeleton: { filename: \"skeleton.tsx\", content: skeletonTemplate },\n};\n\nexport function scaffoldConfig(cwd = process.cwd(), preset = \"berserk\"): string {\n if (preset === \"python\") {\n const jsonPath = path.resolve(cwd, \"dse.config.json\");\n if (fs.existsSync(jsonPath)) return jsonPath;\n\n const content = JSON.stringify(\n {\n preset: \"python\",\n targetDir: \".\",\n include: [\"**/*.{py,html,jinja,jinja2,css}\"],\n exclude: [\n \"**/.venv/**\",\n \"**/venv/**\",\n \"**/__pycache__/**\",\n \"**/.pytest_cache/**\",\n \"**/.git/**\",\n ],\n },\n null,\n 2\n ) + \"\\n\";\n fs.writeFileSync(jsonPath, content, \"utf-8\");\n return jsonPath;\n }\n\n const configPath = path.resolve(cwd, \"dse.config.js\");\n if (fs.existsSync(configPath)) {\n return configPath;\n }\n\n const content = `import { defineConfig } from \"design-system-enforcer\";\n\nexport default defineConfig({\n preset: \"${preset}\",\n targetDir: \"src\",\n include: [\"**/*.{tsx,jsx,ts,js}\"],\n exclude: [\n \"**/node_modules/**\",\n \"**/.next/**\",\n \"**/public/**\",\n \"**/.git/**\",\n \"src/lib/tokens.ts\",\n \"src/app/globals.css\",\n \"src/components/ui/button.tsx\",\n \"src/components/ui/chip.tsx\",\n \"src/components/ui/card.tsx\",\n \"src/components/ui/input.tsx\",\n \"src/components/ui/table.tsx\",\n \"src/components/ui/tabs.tsx\",\n \"src/components/ui/dropdown.tsx\",\n \"src/components/ui/checkbox.tsx\",\n \"src/components/ui/skeleton.tsx\",\n ],\n});\n`;\n\n fs.writeFileSync(configPath, content, \"utf-8\");\n return configPath;\n}\n\nexport function scaffoldTokens(cwd = process.cwd()): { tokensPath: string; cssPath: string } {\n const libDir = path.resolve(cwd, \"src/lib\");\n const appDir = path.resolve(cwd, \"src/app\");\n\n if (!fs.existsSync(libDir)) fs.mkdirSync(libDir, { recursive: true });\n if (!fs.existsSync(appDir)) fs.mkdirSync(appDir, { recursive: true });\n\n const tokensPath = path.join(libDir, \"tokens.ts\");\n if (!fs.existsSync(tokensPath)) {\n fs.writeFileSync(tokensPath, tokensTemplate, \"utf-8\");\n }\n\n const cssPath = path.join(appDir, \"globals.css\");\n if (!fs.existsSync(cssPath)) {\n fs.writeFileSync(cssPath, cssTemplate, \"utf-8\");\n }\n\n return { tokensPath, cssPath };\n}\n\nexport function scaffoldComponent(componentName: string, cwd = process.cwd()): string | null {\n const key = componentName.toLowerCase();\n const template = COMPONENT_TEMPLATES[key];\n if (!template) {\n return null;\n }\n\n const uiDir = path.resolve(cwd, \"src/components/ui\");\n if (!fs.existsSync(uiDir)) {\n fs.mkdirSync(uiDir, { recursive: true });\n }\n\n const targetPath = path.join(uiDir, template.filename);\n if (!fs.existsSync(targetPath)) {\n fs.writeFileSync(targetPath, template.content, \"utf-8\");\n }\n return targetPath;\n}\n\nexport function scaffoldAllPrimitives(cwd = process.cwd()): string[] {\n const created: string[] = [];\n const { tokensPath, cssPath } = scaffoldTokens(cwd);\n created.push(tokensPath, cssPath);\n\n for (const name of Object.keys(COMPONENT_TEMPLATES)) {\n const filePath = scaffoldComponent(name, cwd);\n if (filePath && !created.includes(filePath)) {\n created.push(filePath);\n }\n }\n\n return created;\n}\n\n","export const tokensTemplate = `/**\n * Design System Tokens\n * All colors are driven by CSS variables in HSL format for instant theme customization.\n * AI Agents or developers can update these values in globals.css.\n */\n\nexport const typographyTokens = {\n fontFamily: {\n sans: [\"var(--font-sans)\", \"system-ui\", \"-apple-system\", \"sans-serif\"],\n mono: [\"var(--font-mono)\", \"monospace\"],\n },\n fontSize: {\n xs: \"12px\",\n sm: \"14px\", // Primary body font standard\n base: \"16px\", // Large body font\n lg: \"18px\",\n xl: \"20px\",\n \"2xl\": \"24px\",\n \"3xl\": \"30px\", // Maximum heading cap\n },\n fontWeight: {\n regular: \"400\",\n medium: \"500\", // Standard for buttons and interactive controls\n semibold: \"600\",\n },\n lineHeight: {\n tight: \"1.25\",\n snug: \"1.375\",\n normal: \"1.5\",\n relaxed: \"1.625\",\n },\n} as const;\n\nexport const geometryTokens = {\n radius: {\n none: \"0px\",\n checkbox: \"4px\", // Strictly 4px for checkboxes only\n sm: \"8px\",\n md: \"8px\", // Standard for buttons, inputs, dropdowns, tabs\n lg: \"12px\", // Standard for cards and modal containers\n xl: \"16px\",\n full: \"9999px\",\n },\n controlHeight: {\n sm: \"30px\",\n md: \"36px\", // Standard control height (buttons, inputs, tabs)\n lg: \"40px\",\n },\n checkboxSize: \"20px\", // Standard size-5\n} as const;\n`;\n\n","export const cssTemplate = `@tailwind base;\n@tailwind components;\n@tailwind utilities;\n\n@layer base {\n :root {\n /* -------------------------------------------------------------------------\n * Design System Color Tokens (HSL)\n * Tip for AI Agents: Modify HSL values here to rebrand or customize themes!\n * ------------------------------------------------------------------------- */\n --background: 0 0% 100%; /* White (#ffffff) */\n --foreground: 0 0% 11%; /* Text Primary (#1c1c1c) */\n\n --muted: 0 0% 96%; /* Neutral 100 (#f5f5f5) */\n --muted-foreground: 0 0% 45%; /* Text Secondary (#737373) */\n\n --border: 0 0% 90%; /* Stroke Default (#e5e5e5) */\n --input: 0 0% 90%; /* Input Stroke */\n\n --primary: 0 0% 9%; /* Brand Dark (#171717) */\n --primary-foreground: 0 0% 98%;\n\n --secondary: 0 0% 96%;\n --secondary-foreground: 0 0% 9%;\n\n --accent: 0 0% 96%;\n --accent-foreground: 0 0% 9%;\n\n /* Semantic Status Tokens */\n --success: 142 71% 45%; /* Emerald */\n --success-foreground: 0 0% 100%;\n\n --warning: 38 92% 50%; /* Amber */\n --warning-foreground: 0 0% 100%;\n\n --destructive: 0 84% 60%; /* Red */\n --destructive-foreground: 0 0% 100%;\n\n /* Geometry Tokens */\n --radius-sm: 8px;\n --radius-md: 8px; /* Standard 8px for controls */\n --radius-lg: 12px; /* Standard 12px for cards */\n --control-height: 36px; /* Standard 36px */\n }\n\n .dark {\n --background: 0 0% 9%;\n --foreground: 0 0% 98%;\n\n --muted: 0 0% 15%;\n --muted-foreground: 0 0% 64%;\n\n --border: 0 0% 20%;\n --input: 0 0% 20%;\n\n --primary: 0 0% 98%;\n --primary-foreground: 0 0% 9%;\n\n --secondary: 0 0% 15%;\n --secondary-foreground: 0 0% 98%;\n\n --accent: 0 0% 15%;\n --accent-foreground: 0 0% 98%;\n }\n\n body {\n background-color: hsl(var(--background));\n color: hsl(var(--foreground));\n font-size: 14px;\n line-height: 1.5;\n }\n}\n`;\n\n","export const buttonTemplate = `import React from \"react\";\r\n\r\nexport interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\r\n variant?: \"primary\" | \"secondary\" | \"outline\" | \"ghost\";\r\n size?: \"default\" | \"sm\" | \"icon\";\r\n children?: React.ReactNode;\r\n}\r\n\r\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\r\n ({ className = \"\", variant = \"primary\", size = \"default\", children, ...props }, ref) => {\r\n // Standard 36px height, 8px radius, font-medium, strictly neutral palette\r\n const baseClasses =\r\n \"inline-flex items-center justify-center font-medium text-sm rounded-md whitespace-nowrap shrink-0 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-neutral-400 disabled:pointer-events-none disabled:opacity-50 select-none cursor-pointer\";\r\n\r\n\r\n const variantClasses = {\r\n primary: \"bg-neutral-900 text-white hover:bg-neutral-800 shadow-2xs\",\r\n secondary: \"bg-neutral-100 text-neutral-900 hover:bg-neutral-200\",\r\n outline: \"border border-neutral-200 bg-white text-neutral-900 hover:bg-neutral-50 shadow-2xs\",\r\n ghost: \"text-neutral-700 hover:bg-neutral-100 hover:text-neutral-900\",\r\n }[variant];\r\n\r\n const sizeClasses = {\r\n default: \"h-[36px] min-h-[36px] px-3.5 gap-2\",\r\n sm: \"h-[30px] min-h-[30px] px-2.5 text-sm gap-1.5\",\r\n icon: \"size-9 min-h-[36px] min-w-[36px] p-0\",\r\n }[size];\r\n\r\n return (\r\n <button ref={ref} className={\\`\\${baseClasses} \\${variantClasses} \\${sizeClasses} \\${className}\\`} {...props}>\r\n {children}\r\n </button>\r\n );\r\n }\r\n);\r\nButton.displayName = \"Button\";\r\n`;\r\n\r\nexport const chipTemplate = `import React from \"react\";\r\n\r\nexport interface ChipProps extends React.HTMLAttributes<HTMLDivElement> {\r\n variant?: \"neutral\" | \"success\" | \"warning\" | \"error\" | \"outline\";\r\n icon?: React.ReactNode;\r\n children: React.ReactNode;\r\n}\r\n\r\nexport const Chip: React.FC<ChipProps> = ({\r\n variant = \"neutral\",\r\n icon,\r\n children,\r\n className = \"\",\r\n ...props\r\n}) => {\r\n // Standard 36px height, 8px radius, 14px typography\r\n const baseClasses =\r\n \"inline-flex items-center h-[36px] min-h-[36px] px-3 rounded-md text-sm font-medium whitespace-nowrap shrink-0 gap-1.5 select-none\";\r\n\r\n\r\n const variantClasses = {\r\n neutral: \"bg-neutral-100 text-neutral-800 border border-neutral-200\",\r\n success: \"bg-emerald-50 text-emerald-700 border border-emerald-200\",\r\n warning: \"bg-amber-50 text-amber-700 border border-amber-200\",\r\n error: \"bg-red-50 text-red-700 border border-red-200\",\r\n outline: \"bg-white text-neutral-700 border border-neutral-200\",\r\n }[variant];\r\n\r\n return (\r\n <div className={\\`\\${baseClasses} \\${variantClasses} \\${className}\\`} {...props}>\r\n {icon && <span className=\"shrink-0\">{icon}</span>}\r\n <span>{children}</span>\r\n </div>\r\n );\r\n};\r\n`;\r\n\r\nexport const inputTemplate = `import React from \"react\";\r\n\r\nexport interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {\r\n icon?: React.ReactNode;\r\n}\r\n\r\nexport const Input = React.forwardRef<HTMLInputElement, InputProps>(\r\n ({ className = \"\", icon, type = \"text\", ...props }, ref) => {\r\n return (\r\n <div className=\"relative flex items-center w-full\">\r\n {icon && <div className=\"absolute left-3 text-neutral-400 pointer-events-none\">{icon}</div>}\r\n <input\r\n ref={ref}\r\n type={type}\r\n className={\\`w-full h-[36px] min-h-[36px] \\${icon ? \"pl-9\" : \"px-3\"} pr-3 rounded-md border border-neutral-200 bg-white text-sm text-neutral-900 placeholder:text-neutral-400 focus:outline-none focus:ring-2 focus:ring-neutral-400 focus:border-transparent transition-colors disabled:opacity-50 \\${className}\\`}\r\n {...props}\r\n />\r\n </div>\r\n );\r\n }\r\n);\r\nInput.displayName = \"Input\";\r\n`;\r\n\r\nexport const dropdownTemplate = `import React, { useState, useRef, useEffect } from \"react\";\r\n\r\nexport interface DropdownOption {\r\n value: string;\r\n label: string;\r\n icon?: React.ReactNode;\r\n disabled?: boolean;\r\n}\r\n\r\nexport interface DropdownProps {\r\n options: DropdownOption[];\r\n value?: string;\r\n onChange?: (value: string) => void;\r\n placeholder?: string;\r\n className?: string;\r\n disabled?: boolean;\r\n}\r\n\r\nexport const Dropdown: React.FC<DropdownProps> = ({\r\n options,\r\n value,\r\n onChange,\r\n placeholder = \"Select option...\",\r\n className = \"\",\r\n disabled = false,\r\n}) => {\r\n const [isOpen, setIsOpen] = useState(false);\r\n const containerRef = useRef<HTMLDivElement>(null);\r\n\r\n const selected = options.find((o) => o.value === value);\r\n\r\n useEffect(() => {\r\n function handleClickOutside(event: MouseEvent) {\r\n if (containerRef.current && !containerRef.current.contains(event.target as Node)) {\r\n setIsOpen(false);\r\n }\r\n }\r\n document.addEventListener(\"mousedown\", handleClickOutside);\r\n return () => document.removeEventListener(\"mousedown\", handleClickOutside);\r\n }, []);\r\n\r\n return (\r\n <div ref={containerRef} className={\\`relative inline-block w-full min-w-[140px] \\${className}\\`}>\r\n <button\r\n type=\"button\"\r\n disabled={disabled}\r\n onClick={() => setIsOpen(!isOpen)}\r\n className=\"w-full h-[36px] min-h-[36px] px-3 rounded-md border border-neutral-200 bg-white text-sm text-neutral-900 flex items-center justify-between gap-2 hover:bg-neutral-50 transition-colors focus:outline-none focus:ring-2 focus:ring-neutral-400 disabled:opacity-50\"\r\n >\r\n <span className=\"truncate\">{selected ? selected.label : placeholder}</span>\r\n <svg className=\"w-4 h-4 text-neutral-500 shrink-0\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\r\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M19 9l-7 7-7-7\" />\r\n </svg>\r\n </button>\r\n\r\n {isOpen && (\r\n <div className=\"absolute z-50 w-full mt-1 bg-white border border-neutral-200 rounded-md shadow-lg max-h-60 overflow-y-auto py-1\">\r\n {options.map((option) => (\r\n <button\r\n key={option.value}\r\n type=\"button\"\r\n disabled={option.disabled}\r\n onClick={() => {\r\n onChange?.(option.value);\r\n setIsOpen(false);\r\n }}\r\n className={\\`w-full px-3 py-2 text-sm text-left flex items-center gap-2 hover:bg-neutral-100 transition-colors \\${option.value === value ? \"bg-neutral-50 font-medium text-neutral-900\" : \"text-neutral-700\"} \\${option.disabled ? \"opacity-50 cursor-not-allowed\" : \"\"}\\`}\r\n >\r\n {option.icon}\r\n <span className=\"truncate\">{option.label}</span>\r\n </button>\r\n ))}\r\n </div>\r\n )}\r\n </div>\r\n );\r\n};\r\n`;\r\n\r\nexport const tableTemplate = `import React from \"react\";\r\n\r\nexport const Table = React.forwardRef<HTMLTableElement, React.HTMLAttributes<HTMLTableElement>>(\r\n ({ className = \"\", children, ...props }, ref) => (\r\n <div className=\"w-full rounded-md border border-neutral-200 bg-white shadow-2xs overflow-hidden\">\r\n <div className=\"overflow-x-auto\">\r\n <table ref={ref} className={\\`w-full text-sm text-left border-collapse \\${className}\\`} {...props}>\r\n {children}\r\n </table>\r\n </div>\r\n </div>\r\n )\r\n);\r\nTable.displayName = \"Table\";\r\n\r\nexport const TableHeader = React.forwardRef<HTMLTableSectionElement, React.HTMLAttributes<HTMLTableSectionElement>>(\r\n ({ className = \"\", children, ...props }, ref) => (\r\n <thead ref={ref} className={\\`bg-neutral-50/80 border-b border-neutral-200 text-neutral-900 font-medium \\${className}\\`} {...props}>\r\n {children}\r\n </thead>\r\n )\r\n);\r\nTableHeader.displayName = \"TableHeader\";\r\n\r\nexport const TableBody = React.forwardRef<HTMLTableSectionElement, React.HTMLAttributes<HTMLTableSectionElement>>(\r\n ({ className = \"\", children, ...props }, ref) => (\r\n <tbody ref={ref} className={\\`divide-none bg-white \\${className}\\`} {...props}>\r\n {children}\r\n </tbody>\r\n )\r\n);\r\nTableBody.displayName = \"TableBody\";\r\n\r\nexport const TableRow = React.forwardRef<HTMLTableRowElement, React.HTMLAttributes<HTMLTableRowElement>>(\r\n ({ className = \"\", children, ...props }, ref) => (\r\n <tr ref={ref} className={\\`border-b border-neutral-200 transition-colors hover:bg-neutral-50/60 last:border-b-0 \\${className}\\`} {...props}>\r\n {children}\r\n </tr>\r\n )\r\n);\r\nTableRow.displayName = \"TableRow\";\r\n\r\nexport interface TableHeadProps extends React.ThHTMLAttributes<HTMLTableCellElement> {\r\n icon?: React.ReactNode;\r\n resizable?: boolean;\r\n}\r\n\r\nexport const TableHead = React.forwardRef<HTMLTableCellElement, TableHeadProps>(\r\n ({ className = \"\", icon, resizable = true, children, ...props }, ref) => (\r\n <th\r\n ref={ref}\r\n className={\\`h-[36px] px-4 text-left font-medium text-sm text-neutral-900 select-none align-middle relative whitespace-nowrap \\${className}\\`}\r\n {...props}\r\n >\r\n <div className=\"flex items-center gap-2\">\r\n {icon && <span className=\"text-neutral-500 shrink-0\">{icon}</span>}\r\n <span className=\"whitespace-nowrap\">{children}</span>\r\n </div>\r\n </th>\r\n )\r\n);\r\nTableHead.displayName = \"TableHead\";\r\n\r\nexport const TableCell = React.forwardRef<HTMLTableCellElement, React.TdHTMLAttributes<HTMLTableCellElement>>(\r\n ({ className = \"\", children, ...props }, ref) => (\r\n <td ref={ref} className={\\`px-4 py-2.5 align-middle text-sm text-neutral-900 \\${className}\\`} {...props}>\r\n {children}\r\n </td>\r\n )\r\n);\r\nTableCell.displayName = \"TableCell\";\r\n`;\r\n\r\nexport const tabsTemplate = `import React from \"react\";\r\n\r\nexport interface TabItem {\r\n id: string;\r\n label: string;\r\n icon?: React.ReactNode;\r\n badge?: React.ReactNode;\r\n count?: number;\r\n disabled?: boolean;\r\n}\r\n\r\nexport interface TabsProps {\r\n items: TabItem[];\r\n activeId: string;\r\n onChange: (id: string) => void;\r\n className?: string;\r\n}\r\n\r\nexport const Tabs: React.FC<TabsProps> = ({ items, activeId, onChange, className = \"\" }) => {\r\n // Standard 36px height, 8px radius, font-medium\r\n return (\r\n <div className={\\`inline-flex h-[36px] min-h-[36px] items-center rounded-md bg-neutral-100 p-1 text-neutral-600 \\${className}\\`}>\r\n {items.map((tab) => {\r\n const isActive = tab.id === activeId;\r\n return (\r\n <button\r\n key={tab.id}\r\n type=\"button\"\r\n disabled={tab.disabled}\r\n onClick={() => onChange(tab.id)}\r\n className={\\`inline-flex h-[28px] items-center justify-center gap-1.5 rounded-sm px-3 text-sm font-medium whitespace-nowrap shrink-0 transition-all select-none \\${\r\n isActive\r\n ? \"bg-white text-neutral-900 shadow-2xs\"\r\n : \"text-neutral-600 hover:text-neutral-900 hover:bg-neutral-200/50\"\r\n } \\${tab.disabled ? \"opacity-50 cursor-not-allowed\" : \"\"}\\`}\r\n >\r\n {tab.icon && <span className=\"shrink-0\">{tab.icon}</span>}\r\n <span>{tab.label}</span>\r\n {tab.count !== undefined && (\r\n <span className=\"text-xs px-1.5 py-0.5 rounded-full bg-neutral-200 text-neutral-700\">\r\n {tab.count}\r\n </span>\r\n )}\r\n {tab.badge}\r\n </button>\r\n );\r\n })}\r\n </div>\r\n );\r\n};\r\n`;\r\n\r\nexport const cardTemplate = `import React from \"react\";\r\n\r\nexport const Card = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\r\n ({ className = \"\", children, ...props }, ref) => (\r\n // Standard 12px corner radius (rounded-lg) for main content cards and containers\r\n <div\r\n ref={ref}\r\n className={\\`rounded-lg border border-neutral-200 bg-white p-5 shadow-xs text-neutral-900 \\${className}\\`}\r\n {...props}\r\n >\r\n {children}\r\n </div>\r\n )\r\n);\r\nCard.displayName = \"Card\";\r\n`;\r\n\r\nexport const checkboxTemplate = `import React from \"react\";\r\n\r\nexport interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, \"type\"> {\r\n label?: string;\r\n}\r\n\r\nexport const Checkbox = React.forwardRef<HTMLInputElement, CheckboxProps>(\r\n ({ className = \"\", label, id, ...props }, ref) => {\r\n return (\r\n <label htmlFor={id} className=\"inline-flex items-center gap-2 cursor-pointer select-none\">\r\n <input\r\n ref={ref}\r\n id={id}\r\n type=\"checkbox\"\r\n // Strictly 20px (size-5) and 4px radius (rounded-xs / rounded-[4px])\r\n className={\\`size-5 rounded-xs border border-neutral-300 text-neutral-900 focus:ring-2 focus:ring-neutral-400 focus:ring-offset-1 transition-colors cursor-pointer \\${className}\\`}\r\n {...props}\r\n />\r\n {label && <span className=\"text-sm font-medium text-neutral-900\">{label}</span>}\r\n </label>\r\n );\r\n }\r\n);\r\nCheckbox.displayName = \"Checkbox\";\r\n`;\r\n\r\nexport const skeletonTemplate = `import React from \"react\";\r\n\r\nexport const Skeleton: React.FC<React.HTMLAttributes<HTMLDivElement>> = ({\r\n className = \"\",\r\n ...props\r\n}) => {\r\n return (\r\n <div\r\n className={\\`animate-pulse rounded-md bg-neutral-200/70 \\${className}\\`}\r\n {...props}\r\n />\r\n );\r\n};\r\n`;\r\n","import type { DseConfig } from \"../config/types.js\";\n\nexport function generateMarkdownRules(config: DseConfig): string {\n const minFont = config.tokens?.typography?.minFontSize || \"14px\";\n const maxFont = config.tokens?.typography?.maxFontSize || \"32px\";\n const maxWeight = config.tokens?.typography?.maxFontWeight ?? 500;\n const maxControlHeight = config.tokens?.geometry?.maxControlHeight || \"36px\";\n\n return `<!-- BEGIN:design-system-enforcer-rules -->\n# Design System Rules & Constraints (Enforced by DSE)\n\n## Typography & Font Sizing Rules\n- **Primary Body Font**: Always use standard ${minFont} (\\`text-sm\\`) as the primary body font across all tables, lists, cards, form inputs, dialogs, and buttons.\n- **Large Body Font**: Use 16px (\\`text-base\\`) for large body text and emphasized copy.\n- **Maximum Heading Size**: Headings must never exceed ${maxFont} (\\`text-2xl\\`). Headings larger than ${maxFont} (\\`text-3xl\\`, \\`text-4xl\\`) are strictly prohibited.\n- **Prohibition on Font Sizes Below ${minFont}**: Font sizes smaller than ${minFont} (e.g. \\`text-xs\\`, \\`12px\\`, \\`10px\\`) are strictly prohibited.\n- **Font Weight Cap**: Standard text and interactive elements must not exceed Medium / ${maxWeight} (\\`font-medium\\`). \\`font-semibold\\` or \\`font-bold\\` are prohibited.\n- **No Uppercase Text**: Disallow \\`uppercase\\` or \\`capitalize\\` CSS transforms. Use standard sentence or title case.\n\n## UI Iconography & Symbols\n- **No Raw Text Arrows**: Never use raw unicode or ASCII arrows (→, ←, ↑, ↓, =>, ->). Use design system icon components instead.\n- **No Emojis in UI**: Do NOT use raw emojis in badges, chips, buttons, labels, or table headers.\n\n## Component Design & Primitives\n- **Button Component**: Always use \\`<Button>\\` from \\`@/components/ui/button\\`. Raw \\`<button>\\` HTML elements are strictly prohibited.\n - Height is strictly standard ${maxControlHeight} (\\`h-[36px] min-h-[36px]\\`) with 8px corner radius (\\`rounded-md\\`).\n - Font weight is strictly \\`font-medium\\`.\n - **No Chip-Colored Buttons**: Buttons must NEVER use semantic chip colors (\\`bg-emerald-*\\`, \\`bg-red-*\\`, \\`variant=\"danger\"\\`, \\`variant=\"success\"\\`).\n- **Chip Component**: \\`<Chip>\\` from \\`@/components/ui/chip\\` is the single source of truth for all tags, statuses, pills, and badges. Height is strictly standard ${maxControlHeight} with 8px radius.\n - **No Pseudo-Chips**: Never use raw \\`<span>\\` or \\`<div>\\` elements styled with fills and rounded corners to imitate chips.\n- **Input Component**: Always use \\`<Input>\\` from \\`@/components/ui/input\\`. Raw \\`<input type=\"text\">\\` is strictly prohibited.\n- **Dropdown Component**: Always use \\`<Dropdown>\\` from \\`@/components/ui/dropdown\\` instead of raw \\`<select>\\`.\n- **Checkbox Component**: Strictly 20px dimension (\\`size-5\\`) and 4px corner radius (\\`rounded-xs\\`). 4px radius is strictly reserved for checkboxes only.\n- **Cards & Containers**: Main content cards must strictly use 12px corner radius (\\`rounded-lg\\`).\n\n## Table Component Rules\n- **Mandatory Table Suite**: Always use \\`<Table>\\`, \\`<TableHeader>\\`, \\`<TableHead>\\`, \\`<TableBody>\\`, \\`<TableRow>\\`, and \\`<TableCell>\\` from \\`@/components/ui/table\\`. Raw HTML table elements (\\`<table>\\`, \\`<tr>\\`, \\`<td>\\`) are strictly prohibited.\n- **Mandatory TableHead Icons**: Every column header (\\`<TableHead>\\`) must provide an icon component via the \\`icon\\` prop (\\`icon={<MailIcon size={20} />}\\`). Only dedicated row selection checkbox columns are exempt.\n- **Mandatory Resizable Columns**: All data columns must support column resizing. Explicitly setting \\`resizable={false}\\` on data columns is strictly prohibited.\n- **Single Borders**: Never wrap \\`<Table>\\` in redundant outer bordered containers. Never apply \\`divide-y\\` to \\`<TableBody>\\`.\n- **Uniform Table Typography**: All fonts across all cells and headers must share standard 14px size and uniform color (\\`text-text-primary\\`).\n- **No Vertical Stacking**: Never vertically stack subtext or metadata inside \\`<TableCell>\\`. Every piece of metadata must reside in its own dedicated, resizable column.\n- **Windowed Pagination**: Data tables rendering dynamic collections must implement pagination (Previous/Next buttons, page size selector [25, 50, 100], and 'Showing X to Y of Z' range indicator).\n\n## Modals & Overlays\n- **No Backdrop Blur**: \\`backdrop-blur-*\\` is strictly prohibited. Modal backdrops must use standard neutral grey overlay (\\`bg-neutral-100/80\\`) without blur.\n<!-- END:design-system-enforcer-rules -->\n`;\n}\n\n","import type { ScanResult } from \"../config/types.js\";\n\nexport interface CategoryScore {\n name: string;\n category: \"typography\" | \"geometry\" | \"components\" | \"colors\" | \"wrapping\" | \"tables\";\n violations: number;\n score: number; // 0 - 100\n}\n\nexport interface DoctorReport {\n overallScore: number;\n grade: \"A+\" | \"A\" | \"B\" | \"C\" | \"D\" | \"F\";\n scannedFiles: number;\n totalViolations: number;\n categories: CategoryScore[];\n fileBreakdown: Array<{\n file: string;\n violations: number;\n }>;\n}\n\nexport function computeDoctorScore(result: ScanResult): DoctorReport {\n const categoryViolations = {\n typography: 0,\n geometry: 0,\n components: 0,\n colors: 0,\n wrapping: 0,\n tables: 0,\n };\n\n const fileCountMap: Record<string, number> = {};\n\n result.violations.forEach((v) => {\n fileCountMap[v.file] = (fileCountMap[v.file] || 0) + 1;\n\n if (v.rule.startsWith(\"font-\") || v.rule.includes(\"text-size\") || v.rule.includes(\"uppercase\")) {\n categoryViolations.typography++;\n } else if (v.rule.includes(\"wrapping\")) {\n categoryViolations.wrapping++;\n } else if (v.rule.startsWith(\"control-\") || v.rule.startsWith(\"corner-radius\")) {\n categoryViolations.geometry++;\n } else if (v.rule.includes(\"color\") || v.rule.includes(\"gradient\") || v.rule.includes(\"blur\")) {\n categoryViolations.colors++;\n } else if (v.rule.startsWith(\"table-\")) {\n categoryViolations.tables++;\n } else {\n categoryViolations.components++;\n }\n });\n\n const filesCount = Math.max(1, result.scannedFilesCount || 1);\n\n function calcScore(violations: number): number {\n const penaltyPerViolation = 100 / (filesCount * 2);\n return Math.max(0, Math.round(100 - violations * penaltyPerViolation));\n }\n\n const categories: CategoryScore[] = [\n { name: \"Typography Scale\", category: \"typography\", violations: categoryViolations.typography, score: calcScore(categoryViolations.typography) },\n { name: \"Geometry & Radii\", category: \"geometry\", violations: categoryViolations.geometry, score: calcScore(categoryViolations.geometry) },\n { name: \"Wrap Integrity\", category: \"wrapping\", violations: categoryViolations.wrapping, score: calcScore(categoryViolations.wrapping) },\n { name: \"Component Inventory\", category: \"components\", violations: categoryViolations.components, score: calcScore(categoryViolations.components) },\n { name: \"Color Purity\", category: \"colors\", violations: categoryViolations.colors, score: calcScore(categoryViolations.colors) },\n { name: \"Table Invariants\", category: \"tables\", violations: categoryViolations.tables, score: calcScore(categoryViolations.tables) },\n ];\n\n const totalScore = Math.round(categories.reduce((acc, c) => acc + c.score, 0) / categories.length);\n\n let grade: DoctorReport[\"grade\"] = \"F\";\n if (totalScore >= 98) grade = \"A+\";\n else if (totalScore >= 90) grade = \"A\";\n else if (totalScore >= 80) grade = \"B\";\n else if (totalScore >= 70) grade = \"C\";\n else if (totalScore >= 60) grade = \"D\";\n\n const fileBreakdown = Object.entries(fileCountMap)\n .map(([file, violations]) => ({ file, violations }))\n .sort((a, b) => b.violations - a.violations)\n .slice(0, 5);\n\n return {\n overallScore: totalScore,\n grade,\n scannedFiles: filesCount,\n totalViolations: result.violations.length,\n categories,\n fileBreakdown,\n };\n}\n\n","import pc from \"picocolors\";\nimport type { DoctorReport } from \"./index.js\";\n\nfunction renderProgressBar(percentage: number, width = 20): string {\n const filledChars = Math.round((percentage / 100) * width);\n const emptyChars = width - filledChars;\n\n let colorFn = pc.green;\n if (percentage < 70) colorFn = pc.red;\n else if (percentage < 90) colorFn = pc.yellow;\n\n const bar = colorFn(\"█\".repeat(filledChars)) + pc.dim(\"░\".repeat(emptyChars));\n return `${bar} ${colorFn(percentage.toString().padStart(3) + \"%\")}`;\n}\n\nexport function formatDoctorOutput(report: DoctorReport): string {\n const lines: string[] = [];\n\n lines.push(\"\");\n lines.push(pc.bold(pc.cyan(\"========================================================\")));\n lines.push(pc.bold(pc.cyan(\" DESIGN SYSTEM ENFORCER - HEALTH REPORT \")));\n lines.push(pc.bold(pc.cyan(\"========================================================\")));\n lines.push(\"\");\n\n let gradeColor = pc.green;\n if (report.grade === \"B\") gradeColor = pc.cyan;\n else if (report.grade === \"C\") gradeColor = pc.yellow;\n else if (report.grade === \"D\" || report.grade === \"F\") gradeColor = pc.red;\n\n lines.push(\n ` ${pc.bold(\"Overall Score:\")} ${gradeColor(pc.bold(report.overallScore + \"/100\"))} [${gradeColor(pc.bold(report.grade))}]`\n );\n lines.push(` ${pc.bold(\"Scanned Files:\")} ${pc.white(report.scannedFiles)}`);\n lines.push(` ${pc.bold(\"Total Issues:\")} ${report.totalViolations === 0 ? pc.green(\"0\") : pc.red(report.totalViolations)}`);\n lines.push(\"\");\n\n lines.push(pc.bold(\" Category Compliance:\"));\n report.categories.forEach((cat) => {\n const paddedName = cat.name.padEnd(22, \" \");\n const issueCount = cat.violations > 0 ? pc.dim(`(${cat.violations} issues)`) : \"\";\n lines.push(` ${pc.dim(paddedName)} ${renderProgressBar(cat.score)} ${issueCount}`);\n });\n lines.push(\"\");\n\n if (report.fileBreakdown.length > 0) {\n lines.push(pc.bold(pc.yellow(\" Top Offending Files:\")));\n report.fileBreakdown.forEach((item, idx) => {\n lines.push(` ${idx + 1}. ${pc.cyan(item.file)}: ${pc.red(item.violations + \" violations\")}`);\n });\n lines.push(\"\");\n lines.push(pc.dim(\" Run 'dse check' for detailed line-by-line violation reports.\"));\n lines.push(pc.dim(\" Run 'dse fix' to automatically remediate common violations.\"));\n } else {\n lines.push(pc.bold(pc.green(\" ✔ All design tokens and component invariants are 100% compliant!\")));\n }\n\n lines.push(\"\");\n return lines.join(\"\\n\");\n}\n\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport ts from \"typescript\";\nimport pc from \"picocolors\";\nimport type { DseConfig, Violation } from \"../config/types.js\";\nimport { runDseScan } from \"../rules/runner.js\";\n\nexport interface FixReport {\n filesFixed: number;\n totalModifications: number;\n details: Array<{\n file: string;\n fixes: string[];\n }>;\n}\n\n/**\n * Automatically remediates common Design System Enforcer violations\n */\nexport async function runDseFix(config: DseConfig, cwd = process.cwd()): Promise<FixReport> {\n const scanResult = await runDseScan(config, cwd);\n const violationsByFile: Record<string, Violation[]> = {};\n\n scanResult.violations.forEach((v) => {\n if (!violationsByFile[v.file]) {\n violationsByFile[v.file] = [];\n }\n violationsByFile[v.file].push(v);\n });\n\n const details: FixReport[\"details\"] = [];\n let totalModifications = 0;\n\n for (const [relPath, violations] of Object.entries(violationsByFile)) {\n const fullPath = path.resolve(cwd, relPath);\n if (!fs.existsSync(fullPath)) continue;\n\n let content = fs.readFileSync(fullPath, \"utf-8\");\n const originalContent = content;\n const fileFixes: string[] = [];\n\n // Fix 1: Add whitespace-nowrap & shrink-0 to Button and Chip if missing\n // Remove whitespace-normal or flex-wrap on compact elements\n if (violations.some((v) => v.rule === \"no-wrapping-compact-elements\")) {\n const before = content;\n content = content.replace(/(<(?:Button|IconButton|Chip|Badge)\\b[^>]*className=[\"'`][^\"'`]*?)\\b(?:whitespace-normal|whitespace-pre-wrap|flex-wrap)\\b([^\"'`]*?[\"'`])/g, (match, prefix, suffix) => {\n return `${prefix}whitespace-nowrap shrink-0${suffix}`;\n });\n\n if (before !== content) {\n fileFixes.push(\"Replaced wrapping classes with 'whitespace-nowrap shrink-0' on compact controls\");\n }\n }\n\n // Fix 2: Upgrade raw <button> to <Button>\n if (violations.some((v) => v.rule === \"no-raw-html-elements\" && v.message.includes(\"<button>\"))) {\n const before = content;\n content = content.replace(/<button(\\s|>)/g, \"<Button$1\");\n content = content.replace(/<\\/button>/g, \"</Button>\");\n\n if (before !== content) {\n // Ensure import exists\n if (!content.includes('import { Button }') && !content.includes('import Button') && !relPath.includes(\"components/ui/button\")) {\n content = `import { Button } from \"@/components/ui/button\";\\n` + content;\n }\n fileFixes.push(\"Upgraded raw <button> to <Button>\");\n }\n }\n\n // Fix 3: Upgrade raw <select> to <Dropdown>\n if (violations.some((v) => v.rule === \"no-raw-html-elements\" && v.message.includes(\"<select>\"))) {\n const before = content;\n content = content.replace(/<select(\\s|>)/g, \"<Dropdown$1\");\n content = content.replace(/<\\/select>/g, \"</Dropdown>\");\n\n if (before !== content) {\n if (!content.includes('import { Dropdown }') && !content.includes('import Dropdown') && !relPath.includes(\"components/ui/dropdown\")) {\n content = `import { Dropdown } from \"@/components/ui/dropdown\";\\n` + content;\n }\n fileFixes.push(\"Upgraded raw <select> to <Dropdown>\");\n }\n }\n\n // Fix 4: Upgrade raw <textarea> to <Textarea>\n if (violations.some((v) => v.rule === \"no-raw-html-elements\" && v.message.includes(\"<textarea>\"))) {\n const before = content;\n content = content.replace(/<textarea(\\s|>)/g, \"<Textarea$1\");\n content = content.replace(/<\\/textarea>/g, \"</Textarea>\");\n\n if (before !== content) {\n if (!content.includes('import { Textarea }') && !content.includes('import Textarea') && !relPath.includes(\"components/ui/textarea\")) {\n content = `import { Textarea } from \"@/components/ui/textarea\";\\n` + content;\n }\n fileFixes.push(\"Upgraded raw <textarea> to <Textarea>\");\n }\n }\n\n // Fix 5: Replace common arbitrary text sizes\n if (violations.some((v) => v.rule === \"no-arbitrary-text-size\")) {\n const before = content;\n content = content.replace(/\\btext-\\[(?:13|13\\.5|14|14\\.5|15|15\\.5)px\\]\\b/g, \"text-sm\");\n content = content.replace(/\\btext-\\[(?:11|11\\.5|12|12\\.5)px\\]\\b/g, \"text-xs\");\n content = content.replace(/\\btext-\\[(?:16|17)px\\]\\b/g, \"text-base\");\n\n if (before !== content) {\n fileFixes.push(\"Standardized arbitrary font sizes to compliant token scales\");\n }\n }\n\n // Fix 6: Remove backdrop blur\n if (violations.some((v) => v.rule === \"no-backdrop-blur\")) {\n const before = content;\n content = content.replace(/\\bbackdrop-blur(?:-(?:none|sm|md|lg|xl|2xl|3xl))?\\b/g, \"\");\n if (before !== content) {\n fileFixes.push(\"Removed non-compliant backdrop-blur classes\");\n }\n }\n\n if (content !== originalContent) {\n fs.writeFileSync(fullPath, content, \"utf-8\");\n totalModifications += fileFixes.length;\n details.push({\n file: relPath,\n fixes: fileFixes,\n });\n }\n }\n\n return {\n filesFixed: details.length,\n totalModifications,\n details,\n };\n}\n\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport pc from \"picocolors\";\nimport type { DseConfig } from \"../config/types.js\";\n\n/**\n * Generates AI-optimized instructions specifically tuned for LLMs and coding assistants.\n */\nexport function generateAgentInstructions(config: DseConfig): string {\n const allowedRadii = config.tokens?.geometry?.allowedRadii?.join(\", \") || \"0px, 8px, 12px, 16px, 9999px\";\n const maxControlHeight = config.tokens?.geometry?.maxControlHeight || 36;\n const bannedColors = config.tokens?.colors?.bannedColorFamilies?.join(\", \") || \"slate, gray, zinc, stone, etc.\";\n\n return `<!-- BEGIN:DSE-AGENT-RULES -->\n# DESIGN SYSTEM ENFORCER (DSE) - MANDATORY RULES\n\nYou MUST adhere to these design system invariants for all UI generation:\n\n1. COMPONENT INVARIANTS:\n - NEVER use raw HTML: <button>, <select>, <textarea>, <table>, <input type=\"checkbox\">, <input type=\"radio\">.\n - ALWAYS use standard primitives: <Button>, <Dropdown>, <Textarea>, <Table>, <Checkbox>, <Chip>.\n - Never create pseudo-chips using raw <div> or <span> with background fills and borders. Use <Chip>.\n\n2. WRAP INTEGRITY (COMPACT ELEMENTS):\n - Interactive compact elements (<Button>, <Chip>, <Badge>, <TableHead>, tabs) MUST NOT wrap text.\n - ALWAYS include 'whitespace-nowrap shrink-0' on compact interactive components.\n\n3. GEOMETRY & RADII:\n - Standard control height for buttons and inputs is strictly max ${maxControlHeight}px ('h-[36px]' or 'h-9').\n - Allowed corner radii tokens: ${allowedRadii}. Never use random arbitrary radii.\n\n4. COLOR SCALE & PURITY:\n - Strictly neutral palette for base surfaces and borders ('neutral-100' through 'neutral-900').\n - Banned arbitrary color families: ${bannedColors}.\n - Never use arbitrary inline hex colors ('#1a2b3c') in utility classes. Use design system CSS variables ('var(--primary)').\n\n5. BEFORE FINISHING UI EDITS:\n - Run 'npx dse check' to verify zero design system violations.\n<!-- END:DSE-AGENT-RULES -->\n`;\n}\n\n/**\n * Installs a git pre-commit hook in .git/hooks/pre-commit\n */\nexport function installPreCommitHook(cwd = process.cwd()): boolean {\n const gitDir = path.resolve(cwd, \".git\");\n if (!fs.existsSync(gitDir)) {\n throw new Error(\"No .git repository found in this directory.\");\n }\n\n const hooksDir = path.resolve(gitDir, \"hooks\");\n if (!fs.existsSync(hooksDir)) {\n fs.mkdirSync(hooksDir, { recursive: true });\n }\n\n const hookPath = path.resolve(hooksDir, \"pre-commit\");\n const hookScript = `#!/usr/bin/env sh\n# Design System Enforcer (DSE) Pre-Commit Hook\necho \"\\n🔍 Running Design System Enforcer pre-commit check...\"\n\nif command -v npx >/dev/null 2>&1; then\n npx dse check --strict\n RESULT=$?\n if [ $RESULT -ne 0 ]; then\n echo \"\\n❌ Commit rejected: Design System violations found.\"\n echo \"💡 Run 'npx dse fix' or 'npx dse check' to review issues.\\n\"\n exit 1\n fi\nfi\n`;\n\n fs.writeFileSync(hookPath, hookScript, { mode: 0o755 });\n return true;\n}\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,kBAAe;AACf,IAAAC,oBAAiB;AACjB,uBAAwB;AACxB,IAAAC,qBAAe;;;ACHf,IAAAC,kBAAe;AACf,IAAAC,oBAAiB;AACjB,sBAA8B;;;ACAvB,IAAM,gBAA2B;AAAA,EACtC,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,SAAS,CAAC,sBAAsB;AAAA,EAChC,SAAS;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;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BAAW,GAAG,SAAS,KAAK,CAAC;AAAA;AAAA,EAAO,QAAQ,KAAK,CAAC;AAAA;AAAA,MACpD;AACA,sBAAAA,QAAG,cAAc,YAAY,UAAU,OAAO;AAC9C,cAAQ,IAAI,mBAAAD,QAAG,MAAM,2BAAsB,QAAQ,KAAK,EAAE,CAAC;AAAA,IAC7D,OAAO;AACL,sBAAAC,QAAG,cAAc,YAAY,SAAS,OAAO;AAC7C,cAAQ,IAAI,mBAAAD,QAAG,MAAM,kBAAa,QAAQ,KAAK,2BAA2B,CAAC;AAAA,IAC7E;AAAA,EACF,OAAO;AACL,YAAQ,IAAI,OAAO;AAAA,EACrB;AACF,CAAC;AAEH,QAAQ,MAAM,QAAQ,IAAI;","names":["import_node_fs","import_node_path","import_picocolors","import_node_fs","import_node_path","import_node_fs","import_node_path","path","fs","fs","path","path","fs","import_node_fs","import_node_path","ts","import_typescript","ts","path","fs","fg","pc","import_node_fs","import_node_path","path","fs","content","import_picocolors","pc","import_node_fs","import_node_path","path","fs","import_node_fs","import_node_path","path","fs","path","pc","fs"]}