| 163 | } |
| 164 | |
| 165 | function parseGitStats(statsOutput: string): { |
| 166 | filesChanged: number |
| 167 | insertions: number |
| 168 | deletions: number |
| 169 | } { |
| 170 | const statsLine = statsOutput |
| 171 | .split('\n') |
| 172 | .find((line) => line.includes('files changed')) |
| 173 | |
| 174 | if (!statsLine) { |
| 175 | return { filesChanged: 0, insertions: 0, deletions: 0 } |
| 176 | } |
| 177 | |
| 178 | const filesChanged = parseInt( |
| 179 | statsLine.match(/(\d+) files? changed/)?.[1] || '0', |
| 180 | ) |
| 181 | const insertions = parseInt(statsLine.match(/(\d+) insertions?/)?.[1] || '0') |
| 182 | const deletions = parseInt(statsLine.match(/(\d+) deletions?/)?.[1] || '0') |
| 183 | |
| 184 | return { filesChanged, insertions, deletions } |
| 185 | } |
| 186 | |
| 187 | async function generateDiffFromCommit( |
| 188 | repoPath: string, |