MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / getDiffLineStats

Function getDiffLineStats

agents/e2e/base-deep.e2e.test.ts:175–199  ·  view source on GitHub ↗
(cwd: string)

Source from the content-addressed store, hash-verified

173 }
174
175 const getDiffLineStats = async (cwd: string) => {
176 const output = await $`git diff --numstat`.cwd(cwd).text()
177 const lines = output
178 .split('\n')
179 .map((line) => line.trim())
180 .filter(Boolean)
181
182 let added = 0
183 let deleted = 0
184 for (const line of lines) {
185 const [a, d] = line.split(/\s+/)
186 const addNum = Number(a)
187 const delNum = Number(d)
188 if (!Number.isNaN(addNum)) added += addNum
189 if (!Number.isNaN(delNum)) deleted += delNum
190 }
191
192 return {
193 added,
194 deleted,
195 total: added + deleted,
196 filesChanged: lines.length,
197 raw: output,
198 }
199 }
200
201 beforeAll(async () => {
202 await loadEnvFile(path.resolve(process.cwd(), '.env.local'))

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected