(summary: string)
| 309 | * @returns The formatted summary with analysis stripped and summary tags replaced by headers |
| 310 | */ |
| 311 | export function formatCompactSummary(summary: string): string { |
| 312 | let formattedSummary = summary |
| 313 | |
| 314 | // Strip analysis section — it's a drafting scratchpad that improves summary |
| 315 | // quality but has no informational value once the summary is written. |
| 316 | formattedSummary = formattedSummary.replace( |
| 317 | /<analysis>[\s\S]*?<\/analysis>/, |
| 318 | '', |
| 319 | ) |
| 320 | |
| 321 | // Extract and format summary section |
| 322 | const summaryMatch = formattedSummary.match(/<summary>([\s\S]*?)<\/summary>/) |
| 323 | if (summaryMatch) { |
| 324 | const content = summaryMatch[1] || '' |
| 325 | formattedSummary = formattedSummary.replace( |
| 326 | /<summary>[\s\S]*?<\/summary>/, |
| 327 | `Summary:\n${content.trim()}`, |
| 328 | ) |
| 329 | } |
| 330 | |
| 331 | // Clean up extra whitespace between sections |
| 332 | formattedSummary = formattedSummary.replace(/\n\n+/g, '\n\n') |
| 333 | |
| 334 | return formattedSummary.trim() |
| 335 | } |
| 336 | |
| 337 | export function getCompactUserSummaryMessage( |
| 338 | summary: string, |
no outgoing calls
no test coverage detected