(messages: string[])
| 509 | } |
| 510 | |
| 511 | function extractDecisions(messages: string[]): string[] { |
| 512 | const decisions: string[] = []; |
| 513 | const patterns = [ |
| 514 | /(?:decided|choosing|using|going with|switched to|picked)\s+(.+?)(?:\.|$)/gi, |
| 515 | /(?:decision|chose|selected|opted for)\s*:?\s*(.+?)(?:\.|$)/gi, |
| 516 | ]; |
| 517 | |
| 518 | for (const msg of messages.slice(-10)) { |
| 519 | const sentences = msg.split(/[.!?]\s+/); |
| 520 | for (const sentence of sentences) { |
| 521 | // Use more flexible matching for decision verbs (decided, choosing, etc.) |
| 522 | if (sentence.match(/\b(decid|chos|opt|select|prefer|us(?:e|ing)|going with|approach|architect|pattern|instead of)/i)) { |
| 523 | const cleaned = sentence.trim(); |
| 524 | // Avoid very short fragments |
| 525 | if (cleaned.length > 20 && cleaned.length < 300 && !decisions.includes(cleaned)) { |
| 526 | decisions.push(cleaned); |
| 527 | } |
| 528 | } |
| 529 | } |
| 530 | } |
| 531 | |
| 532 | return decisions.slice(0, 10); |
| 533 | } |
| 534 | |
| 535 | function extractApproaches(messages: string[]): string[] { |
| 536 | const approaches: string[] = []; |
no outgoing calls
no test coverage detected