MCPcopy
hub / github.com/claude-code-best/claude-code / parseShortstat

Function parseShortstat

src/utils/gitDiff.ts:371–382  ·  view source on GitHub ↗
(stdout: string)

Source from the content-addressed store, hash-verified

369 * loading all content. Used as a quick probe before expensive operations.
370 */
371export function parseShortstat(stdout: string): GitDiffStats | null {
372 // Match: "N files changed" with optional ", N insertions(+)" and ", N deletions(-)"
373 const match = stdout.match(
374 /(\d+)\s+files?\s+changed(?:,\s+(\d+)\s+insertions?\(\+\))?(?:,\s+(\d+)\s+deletions?\(-\))?/,
375 )
376 if (!match) return null
377 return {
378 filesCount: parseInt(match[1] ?? '0', 10),
379 linesAdded: parseInt(match[2] ?? '0', 10),
380 linesRemoved: parseInt(match[3] ?? '0', 10),
381 }
382}
383
384const SINGLE_FILE_DIFF_TIMEOUT_MS = 3000
385

Callers 2

gitDiff.test.tsFile · 0.90
fetchGitDiffFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected