(node: Node, code: string | null, outline?: string | null)
| 9563 | } |
| 9564 | |
| 9565 | private formatNodeDetails(node: Node, code: string | null, outline?: string | null): string { |
| 9566 | const location = node.startLine ? `:${node.startLine}` : ''; |
| 9567 | const lines: string[] = [ |
| 9568 | `**${node.name}** (${node.kind})`, |
| 9569 | '', |
| 9570 | `**Location:** ${node.filePath}${location}`, |
| 9571 | ]; |
| 9572 | |
| 9573 | if (node.signature) { |
| 9574 | lines.push(`**Signature:** \`${node.signature}\``); |
| 9575 | } |
| 9576 | |
| 9577 | // Only include docstring if it's short and useful |
| 9578 | if (node.docstring && node.docstring.length < 200) { |
| 9579 | lines.push('', node.docstring); |
| 9580 | } |
| 9581 | |
| 9582 | if (outline) { |
| 9583 | lines.push('', outline, '', |
| 9584 | `> Structural outline only. Read \`${node.filePath}\` or call codegraph_node on a specific member for its body.`); |
| 9585 | } else if (code) { |
| 9586 | // Line-numbered (cat -n style, like codegraph_explore and Read) so the |
| 9587 | // agent can cite/edit exact lines without re-Reading the file for them. |
| 9588 | const numbered = node.startLine ? numberSourceLines(code, node.startLine) : code; |
| 9589 | lines.push('', '```' + node.language, numbered, '```'); |
| 9590 | } |
| 9591 | |
| 9592 | return lines.join('\n'); |
| 9593 | } |
| 9594 | |
| 9595 | private textResult(text: string): ToolResult { |
| 9596 | return { |
no test coverage detected