mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-12 14:16:28 +03:00
DRY refactor: - detect-antipatterns-core.mjs (297 lines): shared constants (SAFE_TAGS, OVERUSED_FONTS, GENERIC_FONTS, ANTIPATTERNS), color utilities (parseRgb, relativeLuminance, contrastRatio, hasChroma, getHue, colorToHex, isNeutralColor), and pure detection functions (checkBorders, checkColors, isCardLikeFromProps). - CLI (889 lines, was 1212): imports from core, keeps jsdom-specific resolveBackground, page-level analyzers, regex fallback, and CLI logic. - Browser wrapper (335 lines): template with browser-specific DOM adapters, highlighting, scan loop. Core is injected at build time. - build-browser-detector.js: reads core, strips exports, injects into wrapper, writes to public/js/detect-antipatterns-browser.js (generated). - Build step added to scripts/build.js (runs before Bun bundling). Source of truth for detection logic is now the core module. Browser script is generated — do not edit public/js/detect-antipatterns-browser.js directly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>