(content: string | null)
| 71 | |
| 72 | /** Extract the structural outline block from a read_file result, if present. */ |
| 73 | export function extractOutline(content: string | null): string | null { |
| 74 | if (!content) return null; |
| 75 | const idx = content.indexOf('OUTLINE'); |
| 76 | if (idx === -1) return null; |
| 77 | const tail = content.slice(idx); |
| 78 | const stop = tail.search(/\n\s*(HEAD\b|---|===|\.\.\.)/); |
| 79 | const block = (stop === -1 ? tail : tail.slice(0, stop)).trim(); |
| 80 | const lines = block.split('\n').slice(0, 40).join('\n').trim(); |
| 81 | return lines || null; |
| 82 | } |
| 83 | |
| 84 | function approxLineCount(content: string | null): number | null { |
| 85 | if (!content) return null; |
no test coverage detected