MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / trackFileModification

Function trackFileModification

source code/utils/commitAttribution.ts:404–435  ·  view source on GitHub ↗
(
  state: AttributionState,
  filePath: string,
  oldContent: string,
  newContent: string,
  _userModified: boolean,
  mtime: number = Date.now(),
)

Source from the content-addressed store, hash-verified

402 * Called after Edit/Write tool completes.
403 */
404export function trackFileModification(
405 state: AttributionState,
406 filePath: string,
407 oldContent: string,
408 newContent: string,
409 _userModified: boolean,
410 mtime: number = Date.now(),
411): AttributionState {
412 const normalizedPath = normalizeFilePath(filePath)
413 const newFileState = computeFileModificationState(
414 state.fileStates,
415 filePath,
416 oldContent,
417 newContent,
418 mtime,
419 )
420 if (!newFileState) {
421 return state
422 }
423
424 const newFileStates = new Map(state.fileStates)
425 newFileStates.set(normalizedPath, newFileState)
426
427 logForDebugging(
428 `Attribution: Tracked ${newFileState.claudeContribution} chars for ${normalizedPath}`,
429 )
430
431 return {
432 ...state,
433 fileStates: newFileStates,
434 }
435}
436
437/**
438 * Track a file creation by Claude (e.g., via bash command).

Callers 1

trackFileCreationFunction · 0.85

Calls 4

normalizeFilePathFunction · 0.85
logForDebuggingFunction · 0.85
setMethod · 0.80

Tested by

no test coverage detected