(artifactId: string, version: number, report: ReviewReport)
| 140 | |
| 141 | /** Render the report as the text the parent model reads back. */ |
| 142 | export function formatReviewReport(artifactId: string, version: number, report: ReviewReport): string { |
| 143 | const lines: string[] = []; |
| 144 | const badge: Record<ReviewVerdict, string> = { |
| 145 | looks_good: '✓ LOOKS_GOOD', |
| 146 | needs_work: '✎ NEEDS_WORK', |
| 147 | broken: '✗ BROKEN', |
| 148 | unverified: '? UNVERIFIED', |
| 149 | }; |
| 150 | lines.push(`Review of "${artifactId}" v${version}: ${badge[report.verdict]}`); |
| 151 | lines.push(report.summary); |
| 152 | if (report.issues.length) { |
| 153 | lines.push('Issues:'); |
| 154 | for (const i of report.issues) lines.push(` - ${i}`); |
| 155 | } |
| 156 | if (report.verdict === 'needs_work' || report.verdict === 'broken') { |
| 157 | lines.push(`Fix with artifact_update id="${artifactId}" (new version), then artifact_review again.`); |
| 158 | } |
| 159 | return lines.join('\n'); |
| 160 | } |
no test coverage detected