import fs from 'node:fs' import path from 'node:path' const root=process.cwd(); const required=['OMS-CLM-001','ERP-PUR-001','ERP-INV-MOVE-001','WMS-REC-001','WMS-PUT-001','WMS-COUNT-001']; const manifest=JSON.parse(fs.readFileSync(path.join(root,'generated/screen-manifest.json'),'utf8')); const ids=new Set(manifest.map(x=>x.id)); const errors=[]; for(const id of required) if(!ids.has(id)) errors.push(`${id}: missing`); const wf=fs.readFileSync(path.join(root,'packages/kbx-contracts/src/workflow.ts'),'utf8'); if(!wf.includes('KbxWorkflowDefinition')) errors.push('workflow contract missing'); const ui=fs.readFileSync(path.join(root,'packages/kbx-ui/src/index.ts'),'utf8'); if(!ui.includes('KbxWorkflowBar')) errors.push('KbxWorkflowBar export missing'); const migration=fs.readFileSync(path.join(root,'backend/Database/Migrations/20260808_007_process_coverage.sql'),'utf8'); for(const token of ['oms.claims','erp.purchase_orders','erp.inventory_moves']) if(!migration.includes(token)) errors.push(`${token}: migration missing`); if(errors.length){console.error('KBX process coverage FAILED'); errors.forEach(x=>console.error(' - '+x)); process.exit(1)} console.log('KBX process coverage PASS ('+required.length+' reference screens)')