* Collect diff stats and add to metadata * @returns Whether there were any changes
( metadata: Record<string, any>, )
| 29 | * @returns Whether there were any changes |
| 30 | */ |
| 31 | async function collectDiffStats( |
| 32 | metadata: Record<string, any>, |
| 33 | ): Promise<boolean> { |
| 34 | try { |
| 35 | const { diff, repoFound } = await getGitDiffSnapshot(); |
| 36 | if (repoFound && diff) { |
| 37 | const { additions, deletions } = calculateDiffStats(diff); |
| 38 | if (additions > 0 || deletions > 0) { |
| 39 | metadata.additions = additions; |
| 40 | metadata.deletions = deletions; |
| 41 | return true; |
| 42 | } |
| 43 | } |
| 44 | } catch (err) { |
| 45 | logger.debug("Failed to calculate diff stats (non-critical)", err as any); |
| 46 | } |
| 47 | return false; |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * Extract summary from conversation history and add to metadata |
no test coverage detected