MCPcopy Index your code
hub / github.com/codeaashu/claude-code / isFileEditResult

Function isFileEditResult

src/hooks/useTurnDiffs.ts:36–47  ·  view source on GitHub ↗
(result: unknown)

Source from the content-addressed store, hash-verified

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

Callers 1

useTurnDiffsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected