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

Function extractFilePath

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

Source from the content-addressed store, hash-verified

217 * Extract file path from tool block.
218 */
219export function extractFilePath(toolBlock: ToolContentBlock): string | null {
220 const outputStr = typeof toolBlock.output === 'string' ? toolBlock.output : ''
221 const input = toolBlock.input as Record<string, unknown>
222
223 return (
224 extractValueForKey(outputStr, 'file') ||
225 (typeof input?.path === 'string' ? input.path : null) ||
226 (typeof input?.file_path === 'string' ? input.file_path : null)
227 )
228}
229
230/**
231 * Extract unified diff from tool output, or construct from input.

Callers 4

renderFunction · 0.90
getFileStatsFromBlocksFunction · 0.85
buildActivityTimelineFunction · 0.85

Calls 1

extractValueForKeyFunction · 0.85

Tested by

no test coverage detected