Files
KArtSell.Aegis/scripts/validate-kbx-component-manifest.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

29 lines
1.7 KiB
JavaScript

import fs from 'node:fs'
import path from 'node:path'
const root = path.resolve(process.argv[process.argv.indexOf('--root') + 1] ?? 'frontend')
const manifestPath = path.join(root, 'src', 'shared', 'ui', 'component-manifest.json')
const failures = []
const allowedTiers = new Set(['L0', 'L1', 'L2', 'L3', 'L4'])
if (!fs.existsSync(manifestPath)) failures.push('missing component manifest')
else {
const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'))
if (manifest.schemaVersion !== '1.0') failures.push('unsupported manifest schema')
if (!Array.isArray(manifest.components) || manifest.components.length < 6) failures.push('golden component coverage is incomplete')
const ids = new Set()
const names = new Set()
for (const item of manifest.components ?? []) {
if (ids.has(item.id)) failures.push(`duplicate component id ${item.id}`)
if (names.has(item.name)) failures.push(`duplicate component name ${item.name}`)
ids.add(item.id); names.add(item.name)
if (!allowedTiers.has(item.tier)) failures.push(`${item.name}: invalid tier`)
if (!item.owner || !item.vendorPolicy || !item.requiredContracts?.length) failures.push(`${item.name}: incomplete governance fields`)
const source = path.join(root, 'src', 'shared', 'ui', 'components', path.basename(item.source))
if (!fs.existsSync(source)) failures.push(`${item.name}: missing source ${item.source}`)
if (item.name === 'KsDataGrid' && item.vendorPolicy !== 'strong-facade-no-raw-api') failures.push('KsDataGrid must be a strong facade')
}
}
console.log(`KBX_COMPONENT_MANIFEST failures=${failures.length}`)
for (const failure of failures) console.log(`FAIL ${failure}`)
process.exitCode = failures.length ? 1 : 0