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

Function isFileEditResult

source code/hooks/useTurnDiffs.ts:38–49  ·  view source on GitHub ↗
(result: unknown)

Source from the content-addressed store, hash-verified

36}
37
38function isFileEditResult(result: unknown): result is FileEditResult {
39 if (!result || typeof result !== 'object') return false
40 const r = result as Record<string, unknown>
41 // FileEditTool: has structuredPatch with content
42 // FileWriteTool (update): has structuredPatch with content
43 // FileWriteTool (create): has type='create' and content (structuredPatch is empty)
44 const hasFilePath = typeof r.filePath === 'string'
45 const hasStructuredPatch =
46 Array.isArray(r.structuredPatch) && r.structuredPatch.length > 0
47 const isNewFile = r.type === 'create' && typeof r.content === 'string'
48 return hasFilePath && (hasStructuredPatch || isNewFile)
49}
50
51function isFileWriteOutput(result: FileEditResult): result is FileWriteOutput {
52 return (

Callers 1

useTurnDiffsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected