MCPcopy Create free account
hub / github.com/codeaashu/claude-code / getWrittenFilePath

Function getWrittenFilePath

src/services/extractMemories/extractMemories.ts:232–249  ·  view source on GitHub ↗

* Extract file_path from a tool_use block's input, if present. * Returns undefined when the block is not an Edit/Write tool use or has no file_path.

(block: {
  type: string
  name?: string
  input?: unknown
})

Source from the content-addressed store, hash-verified

230 * Returns undefined when the block is not an Edit/Write tool use or has no file_path.
231 */
232function getWrittenFilePath(block: {
233 type: string
234 name?: string
235 input?: unknown
236}): string | undefined {
237 if (
238 block.type !== 'tool_use' ||
239 (block.name !== FILE_EDIT_TOOL_NAME && block.name !== FILE_WRITE_TOOL_NAME)
240 ) {
241 return undefined
242 }
243 const input = block.input
244 if (typeof input === 'object' && input !== null && 'file_path' in input) {
245 const fp = (input as { file_path: unknown }).file_path
246 return typeof fp === 'string' ? fp : undefined
247 }
248 return undefined
249}
250
251function extractWrittenPaths(agentMessages: Message[]): string[] {
252 const paths: string[] = []

Callers 2

hasMemoryWritesSinceFunction · 0.85
extractWrittenPathsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected