(pairing: FeedbackPairing, diff: FeedbackDiff)
| 383 | * lesson has already been learned. |
| 384 | */ |
| 385 | export function formatLesson(pairing: FeedbackPairing, diff: FeedbackDiff): string { |
| 386 | const lines = [ |
| 387 | `### Review feedback · ${CHANNEL_LABEL[pairing.channel]}`, |
| 388 | '', |
| 389 | `- Source: draft [[${labelOf(pairing.draftPath)}]] → final [[${labelOf(pairing.finalPath)}]]`, |
| 390 | `- Length: ${diff.draftWords} → ${diff.finalWords} words (${deltaLabel(diff.wordDelta)})`, |
| 391 | ]; |
| 392 | if (diff.removed.length) { |
| 393 | lines.push(`- Removed: ${diff.removed.map((part) => `"${part}"`).join('; ')}`); |
| 394 | } |
| 395 | if (diff.added.length) { |
| 396 | lines.push(`- Added: ${diff.added.map((part) => `"${part}"`).join('; ')}`); |
| 397 | } |
| 398 | if (pairing.reviewReason) { |
| 399 | lines.push(`- Human note: ${pairing.reviewReason}`); |
| 400 | } |
| 401 | lines.push('', feedbackMarker(pairing.draftPath, pairing.finalPath)); |
| 402 | return lines.join('\n'); |
| 403 | } |
| 404 | |
| 405 | /** A fresh per-channel playbook, seeded with its first lesson (a `type: skill` note). */ |
| 406 | function newPlaybook(channel: FeedbackChannel, lesson: string): string { |
no test coverage detected