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

Function getFileChangeType

cli/src/utils/implementor-helpers.ts:519–534  ·  view source on GitHub ↗
(toolBlock: ToolContentBlock)

Source from the content-addressed store, hash-verified

517 * Determine file change type based on tool and context.
518 */
519export function getFileChangeType(toolBlock: ToolContentBlock): FileChangeType {
520 const baseToolName = getBaseToolName(toolBlock.toolName)
521 // write_file creating new file = Added
522 if (baseToolName === 'write_file') {
523 const isCreate = isCreateFile(toolBlock)
524 return isCreate ? 'A' : 'M'
525 }
526
527 // str_replace is always a modification
528 if (baseToolName === 'str_replace') {
529 return 'M'
530 }
531
532 // Default to modified
533 return 'M'
534}
535
536/**
537 * Get aggregated file stats from all edit blocks.

Callers 2

getFileStatsFromBlocksFunction · 0.85

Calls 2

getBaseToolNameFunction · 0.85
isCreateFileFunction · 0.85

Tested by

no test coverage detected