Files
KArtSell.Aegis/scripts/validate-ui-boundary.mjs
kjh2064 31b36ba226 V13-FE-005: consolidate approved UI governance and contract hardening
Consolidates KBX UI Boundary Governance framework with component manifest,
screen recipe registry, AI component gate, and exception lifecycle validation.

Evidence (evidence/V13-FE-005/*.log, 55+ files):
- Full frontend regression: 70 files / 180 tests PASS
- UI boundary gate: 37 files / 0 failures / 6 raw-color warnings (DEBT tracked)
- Component manifest validation: 0 failures
- Screen recipe governance: 0 failures
- AI component gate: 17 feature files / 23 known exports / 0 failures
- Accessibility E2E: 22 passed
- Production build: PASS (>500 kB chunk warning V13-FE-038 DECISION_REQUIRED)
- TypeCheck: PASS
- KBX validators: All 5 PASS (failures=0)

Added: 19 files (6 validator scripts, 6 test specs, 4 slice notes, 3 registries)
Modified: 9 files (CI workflow, WBS tracker, E2E specs, FE setup, Layout, TS configs)

Outstanding per V13-FE-005 note: AI prop-level validation, exception lifecycle,
browser/visual/AT/performance evidence. No completion overclaim.

AGENTS.md compliance: #9 (Traceability — evidence preserved), #11 (no placeholders),
#12 (right way, WBS execution completed).

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-08-14 10:35:15 +09:00

43 lines
1.7 KiB
JavaScript

import fs from 'node:fs'
import path from 'node:path'
const args = process.argv.slice(2)
const rootArg = args[args.indexOf('--root') + 1] ?? 'frontend'
const root = path.resolve(rootArg)
const featureRoot = path.join(root, 'src', 'features')
const files = []
const failures = []
const warnings = []
function walk(directory) {
if (!fs.existsSync(directory)) return
for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
const file = path.join(directory, entry.name)
if (entry.isDirectory()) walk(file)
else if (/\.(ts|tsx|vue|css|scss)$/.test(entry.name)) files.push(file)
}
}
function relative(file) {
return path.relative(process.cwd(), file).replaceAll('\\', '/')
}
walk(featureRoot)
const vendorImport = /(?:from|import\s*\(|import\s+)['"](?:primevue(?:\/|$)|ag-grid(?:-vue3)?(?:\/|$))/
const cssLeakage = /(?:\.p-[a-z0-9_-]+|\.ag-[a-z0-9_-]+|:deep\s*\([^)]*(?:\.p-|\.ag-)|!important)/i
const rawColor = /(?:#[0-9a-f]{3,8}\b|\brgba?\s*\(|\bhsl\s*\()/i
for (const file of files) {
const source = fs.readFileSync(file, 'utf8')
const name = relative(file)
if (vendorImport.test(source)) failures.push(`${name}: direct PrimeVue/AG Grid import`)
if (cssLeakage.test(source)) failures.push(`${name}: supplier CSS leakage or !important`)
if (rawColor.test(source)) warnings.push(`${name}: raw color requires token-debt classification`)
}
if (!fs.existsSync(featureRoot)) failures.push(`missing feature root: ${relative(featureRoot)}`)
console.log(`UI_BOUNDARY files=${files.length} failures=${failures.length} warnings=${warnings.length}`)
for (const warning of warnings) console.log(`WARN ${warning}`)
for (const failure of failures) console.log(`FAIL ${failure}`)
process.exitCode = failures.length ? 1 : 0