diff --git a/REMEDIATION_REPORT.md b/REMEDIATION_REPORT.md new file mode 100644 index 00000000..6ecc33cc --- /dev/null +++ b/REMEDIATION_REPORT.md @@ -0,0 +1,45 @@ +# Daily Design System Audit Report + +Headline: ⚠️ 16 violations found + +## CSS +Total count: 0 + + +## Hex Colors +Total count: 16 + +| File | Line | Snippet | +|---|---|---| +| ./js/themeController.js | 7 | `dark: "#0f172a",` | +| ./js/themeController.js | 8 | `light: "#f8fafc",` | +| ./js/ui/ambientBackground.js | 34 | `return "#000000";` | +| ./js/ui/loginModalController.js | 1303 | `let qrLightColor = "#ffffff";` | +| ./js/ui/loginModalController.js | 1304 | `let qrDarkColor = "#000000";` | +| ./js/ui/components/VideoModal.js | 2168 | `return "#000000";` | +| ./config/validate-config.js | 97 | `THEME_ACCENT_OVERRIDES.${theme}.${token} must be ...` | +| ./config/instance-config.js | 291 | `* Operators can provide hex color strings (e.g., ...` | +| ./config/instance-config.js | 299 | `accent: "#540011",` | +| ./config/instance-config.js | 300 | `accentStrong: "#fe0032",` | +... and 6 more. + +## Inline Styles +Total count: 0 + + +## Raw Lengths +Total count: 0 + + +## Bracket Utilities +Total count: 0 + + +## Tailwind Palette +Total count: 0 + + +## Next Steps +- [ ] Review violations +- [ ] Apply auto-fixes (if safe) +- [ ] Open remediation PR diff --git a/scripts/check-hex.js b/scripts/check-hex.js index c0a7b181..a56d6486 100755 --- a/scripts/check-hex.js +++ b/scripts/check-hex.js @@ -2,19 +2,34 @@ import { spawnSync } from "node:child_process"; -const SEARCH_PATTERN = '\\b#[0-9a-fA-F]{3,8}\\b'; +// Use PCRE2 lookbehind to avoid: +// 1. Matches preceded by a word character (e.g. `Issue#123`) +// 2. Matches preceded by `&` (e.g. HTML entities `'`) +const SEARCH_PATTERN = '(? 0) { + report += "| File | Line | Snippet |\n"; + report += "|---|---|---|\n"; + // Top 10 + const top10 = list.slice(0, 10); + for (const v of top10) { + let snippet = v.snippet; + if (snippet && snippet.length > 50) snippet = snippet.substring(0, 50) + "..."; + snippet = snippet ? "`" + snippet.replace(/`/g, "") + "`" : ""; + report += `| ${v.file} | ${v.line} | ${snippet} |\n`; + } + if (list.length > 10) { + report += `... and ${list.length - 10} more.\n`; + } + } + report += "\n"; + } + + report += "## Next Steps\n"; + report += "- [ ] Review violations\n"; + report += "- [ ] Apply auto-fixes (if safe)\n"; + report += "- [ ] Open remediation PR\n"; + + return report; +} + +async function main() { + for (const check of CHECKS) { + const { success, output } = runCheck(check); + if (!success) { + const violations = parseOutput(check.name, output); + VIOLATIONS[check.name] = violations; + } + } + + const report = generateReport(VIOLATIONS); + writeFileSync(REPORT_FILE, report); + console.log(`Report generated at ${REPORT_FILE}`); + + const totalViolations = Object.values(VIOLATIONS).reduce((acc, list) => acc + list.length, 0); + process.exit(totalViolations > 0 ? 1 : 0); +} + +main().catch(err => { + console.error(err); + process.exit(1); +});