* 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)
| 551 | * Returns an array of file paths (may have duplicates if same file is read multiple times in one grouped message). |
| 552 | */ |
| 553 | function getFilePathsFromReadMessage(msg: RenderableMessage): string[] { |
| 554 | const paths: string[] = [] |
| 555 | |
| 556 | if (msg.type === 'assistant') { |
| 557 | const content = msg.message.content[0] |
| 558 | if (content?.type === 'tool_use') { |
| 559 | const input = content.input as { file_path?: string } | undefined |
| 560 | if (input?.file_path) { |
| 561 | paths.push(input.file_path) |
| 562 | } |
| 563 | } |
| 564 | } else if (msg.type === 'grouped_tool_use') { |
| 565 | for (const m of msg.messages) { |
| 566 | const content = m.message.content[0] |
| 567 | if (content?.type === 'tool_use') { |
| 568 | const input = content.input as { file_path?: string } | undefined |
| 569 | if (input?.file_path) { |
| 570 | paths.push(input.file_path) |
| 571 | } |
| 572 | } |
| 573 | } |
| 574 | } |
| 575 | |
| 576 | return paths |
| 577 | } |
| 578 | |
| 579 | /** |
| 580 | * Scan a bash tool result for commit SHAs and PR URLs and push them into the |
no outgoing calls
no test coverage detected