MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / formatImpact

Method formatImpact

src/mcp/tools.ts:9512–9541  ·  view source on GitHub ↗
(symbol: string, impact: Subgraph)

Source from the content-addressed store, hash-verified

9510 }
9511
9512 private formatImpact(symbol: string, impact: Subgraph): string {
9513 const nodeCount = impact.nodes.size;
9514
9515 // Compact format: just list affected symbols grouped by file
9516 const lines: string[] = [
9517 `**Impact: "${symbol}" affects ${nodeCount} symbols${impact.truncated ? ' (truncated at safety limit)' : ''}**`,
9518 '',
9519 ];
9520 if (impact.truncated) {
9521 lines.push('> Result truncated to protect the MCP process on a high-fanout graph. Narrow with `file` or reduce `depth`.', '');
9522 }
9523
9524 // Group by file
9525 const byFile = new Map<string, Node[]>();
9526 for (const node of impact.nodes.values()) {
9527 const existing = byFile.get(node.filePath) || [];
9528 existing.push(node);
9529 byFile.set(node.filePath, existing);
9530 }
9531
9532 for (const [file, nodes] of byFile) {
9533 lines.push(`**${file}:**`);
9534 // Compact: inline list
9535 const nodeList = nodes.map(n => `${n.name}:${n.startLine}`).join(', ');
9536 lines.push(nodeList);
9537 lines.push('');
9538 }
9539
9540 return lines.join('\n');
9541 }
9542
9543 /**
9544 * Build a compact structural outline of a container symbol from its

Callers 2

handleImpactMethod · 0.95
graph.test.tsFile · 0.80

Calls 5

pushMethod · 0.80
mapMethod · 0.80
getMethod · 0.65
setMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected