* Build a compact structural outline of a container symbol from its * indexed children (methods, fields, properties, …) — name, kind, * line number, and signature — so the agent gets the shape of a class * without the full source of every method. Returns '' when the container * has no in
(cg: CodeGraph, node: Node)
| 4651 | * has no indexed children, so the caller can fall back to full source. |
| 4652 | */ |
| 4653 | private buildContainerOutline(cg: CodeGraph, node: Node): string { |
| 4654 | const children = cg.getChildren(node.id) |
| 4655 | .filter(c => c.kind !== 'import' && c.kind !== 'export') |
| 4656 | .sort((a, b) => (a.startLine ?? 0) - (b.startLine ?? 0)); |
| 4657 | if (children.length === 0) return ''; |
| 4658 | |
| 4659 | const lines = [`**Members (${children.length}):**`, '']; |
| 4660 | for (const c of children) { |
| 4661 | const loc = c.startLine ? `:${c.startLine}` : ''; |
| 4662 | const sig = c.signature ? ` — \`${c.signature}\`` : ''; |
| 4663 | lines.push(`- ${c.name} (${c.kind})${loc}${sig}`); |
| 4664 | } |
| 4665 | return lines.join('\n'); |
| 4666 | } |
| 4667 | |
| 4668 | private formatNodeDetails(node: Node, code: string | null, outline?: string | null): string { |
| 4669 | const location = node.startLine ? `:${node.startLine}` : ''; |
no test coverage detected