(r: RunReceipt)
| 120 | |
| 121 | /** Compact, scannable receipt for a chat message. PURE. */ |
| 122 | export function formatReceipt(r: RunReceipt): string { |
| 123 | const lines = ['🧾 Receipt']; |
| 124 | const icon = r.status === 'opened' ? '✅ opened' : r.status === 'done' ? '✅ done' : r.status === 'blocked' ? '⛔ blocked' : '❌ failed'; |
| 125 | lines.push(`status: ${icon}`); |
| 126 | if (r.prUrl) lines.push(`PR: ${r.prUrl}`); |
| 127 | if (r.branch) lines.push(`branch: ${r.branch}`); |
| 128 | if (r.verification?.length) { |
| 129 | lines.push('verified: ' + r.verification.map(c => `${c.passed ? '✓' : '✗'} ${c.command}`).join(' · ')); |
| 130 | } |
| 131 | if (r.filesChanged?.length) { |
| 132 | const shown = r.filesChanged.slice(0, 4).join(', '); |
| 133 | lines.push(`files: ${shown}${r.filesChanged.length > 4 ? ` (+${r.filesChanged.length - 4})` : ''}`); |
| 134 | } |
| 135 | if (r.status !== 'opened' && r.reason) lines.push(`reason: ${r.reason}`); |
| 136 | return lines.join('\n'); |
| 137 | } |
no test coverage detected