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

Function trackFileDeletion

source code/utils/commitAttribution.ts:455–482  ·  view source on GitHub ↗
(
  state: AttributionState,
  filePath: string,
  oldContent: string,
)

Source from the content-addressed store, hash-verified

453 * Used when Claude deletes a file through a non-tracked mechanism.
454 */
455export function trackFileDeletion(
456 state: AttributionState,
457 filePath: string,
458 oldContent: string,
459): AttributionState {
460 const normalizedPath = normalizeFilePath(filePath)
461 const existingState = state.fileStates.get(normalizedPath)
462 const existingContribution = existingState?.claudeContribution ?? 0
463 const deletedChars = oldContent.length
464
465 const newFileState: FileAttributionState = {
466 contentHash: '', // Empty hash for deleted files
467 claudeContribution: existingContribution + deletedChars,
468 mtime: Date.now(),
469 }
470
471 const newFileStates = new Map(state.fileStates)
472 newFileStates.set(normalizedPath, newFileState)
473
474 logForDebugging(
475 `Attribution: Tracked deletion of ${normalizedPath} (${deletedChars} chars removed, total contribution: ${newFileState.claudeContribution})`,
476 )
477
478 return {
479 ...state,
480 fileStates: newFileStates,
481 }
482}
483
484// --
485

Callers

nothing calls this directly

Calls 4

normalizeFilePathFunction · 0.85
logForDebuggingFunction · 0.85
setMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected