| 91 | * Combines diff with a pass/fail gate. |
| 92 | */ |
| 93 | export async function verifyAgainstMockup( |
| 94 | mockupPath: string, |
| 95 | screenshotPath: string, |
| 96 | ): Promise<{ pass: boolean; matchScore: number; diff: DiffResult }> { |
| 97 | const diff = await diffMockups(mockupPath, screenshotPath); |
| 98 | |
| 99 | // Pass if matchScore >= 70 and no high-severity differences |
| 100 | const highSeverity = diff.differences.filter(d => d.severity === "high"); |
| 101 | const pass = diff.matchScore >= 70 && highSeverity.length === 0; |
| 102 | |
| 103 | return { pass, matchScore: diff.matchScore, diff }; |
| 104 | } |