import { writeFileSync } from 'node:fs'; import { buildAssessmentContext } from '../../src/assessment-context/context-engine'; import { RELEASED_ASSESSMENT_CONTEXT_CATALOG } from '../../src/assessment-context/context-catalog'; import { publishContextReport } from '../../src/assessment-context/context-report-publication'; import { buildReportProjection } from '../../src/reporting/report-projection'; import { buildContextManagementHtml } from '../../src/reporting/context-management-report'; import type { UnifiedResultProjection } from '../../src/domain/unified-result'; // Explicitly synthetic preview; uses production Context publication and Report renderers, no customer reads. const results = [ ['purple-knight', 'SI000095', 'AD CS web enrollment'], ['purple-knight', 'SI000154', 'SMB server signing not required'], ['purple-knight', 'SI000147', 'Smart card password rotation disabled'], ['maester', 'MT.1024.adminMFAV2', 'Require multifactor authentication for administrative roles'], ['maester', 'MT.1024', 'Entra Recommendation - .'] ].map(([tool, rule, title], index) => ({ resultProjectionId: `synthetic-result-${index}`, sourceKind: 'scanner-finding', sourceResultId: `synthetic-occurrence-${index}`, projectId: 'synthetic-client', assessmentId: 'synthetic-slot', scanRunId: 'synthetic-run', collectionRunId: 'synthetic-run', sourceTool: tool, sourceRuleId: rule, outcomeNormalized: 'fail', isDeviation: true, severityNormalized: 'unknown', title, recommendation: 'Synthetic original recommendation for technical verification.', categories: [], frameworkReferences: [] } as unknown as UnifiedResultProjection)); const context = buildAssessmentContext({ projectId: 'synthetic-client', assessmentIds: ['synthetic-slot'], scanRunIds: ['synthetic-run'], repositoryRevision: 1, generatedAt: '2026-10-02T12:00:00Z', observations: [], analyses: [], scannerFindings: results, catalog: RELEASED_ASSESSMENT_CONTEXT_CATALOG }); const projection = buildReportProjection({ project: { id: 'synthetic-client', name: 'Synthetisches Beispiel ยท keine Kundendaten' }, generatedAt: '2026-10-02T12:00:00Z', overallScore: 62.4, results, domains: [{ id: 'identity', label: 'Identity & Account Hygiene' }], domainOf: () => 'identity', environment: [{ key: 'Domain', value: 'synthetic.example' }, { key: 'Domain Controller', value: '1' }] }); projection.context = publishContextReport(context); writeFileSync(process.argv[2] ?? 'tests/reporting/management-preview.html', buildContextManagementHtml(projection));