MCPcopy Index your code
hub / github.com/liuup/claude-code-analysis / getFilePathsFromReadMessage

Function getFilePathsFromReadMessage

src/utils/collapseReadSearch.ts:524–548  ·  view source on GitHub ↗

* Extract file paths from read tool inputs in a message. * Returns an array of file paths (may have duplicates if same file is read multiple times in one grouped message).

(msg: RenderableMessage)

Source from the content-addressed store, hash-verified

522 * Returns an array of file paths (may have duplicates if same file is read multiple times in one grouped message).
523 */
524function getFilePathsFromReadMessage(msg: RenderableMessage): string[] {
525 const paths: string[] = []
526
527 if (msg.type === 'assistant') {
528 const content = msg.message.content[0]
529 if (content?.type === 'tool_use') {
530 const input = content.input as { file_path?: string } | undefined
531 if (input?.file_path) {
532 paths.push(input.file_path)
533 }
534 }
535 } else if (msg.type === 'grouped_tool_use') {
536 for (const m of msg.messages) {
537 const content = m.message.content[0]
538 if (content?.type === 'tool_use') {
539 const input = content.input as { file_path?: string } | undefined
540 if (input?.file_path) {
541 paths.push(input.file_path)
542 }
543 }
544 }
545 }
546
547 return paths
548}
549
550/**
551 * Scan a bash tool result for commit SHAs and PR URLs and push them into the

Callers 1

collapseReadSearchGroupsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected