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

Method impactOf

src/mcp/tools.ts:3597–3630  ·  view source on GitHub ↗
(defNodes: Node[])

Source from the content-addressed store, hash-verified

3595 : '';
3596
3597 const impactOf = (defNodes: Node[]) => {
3598 const mergedNodes = new Map<string, Node>();
3599 const mergedEdges: Edge[] = [];
3600 const seenEdges = new Set<string>();
3601 let truncated = false;
3602 for (const node of defNodes) {
3603 const impact = cg.getImpactRadius(node.id, depth);
3604 truncated ||= impact.truncated === true;
3605 for (const [id, n] of impact.nodes) {
3606 if (!mergedNodes.has(id) && mergedNodes.size >= DEFAULT_IMPACT_MAX_NODES) {
3607 truncated = true;
3608 continue;
3609 }
3610 mergedNodes.set(id, n);
3611 answerPaths.add(n.filePath);
3612 }
3613 for (const e of impact.edges) {
3614 if (!mergedNodes.has(e.source) || !mergedNodes.has(e.target)) {
3615 truncated = true;
3616 continue;
3617 }
3618 const key = `${e.source}->${e.target}:${e.kind}`;
3619 if (!seenEdges.has(key)) {
3620 if (mergedEdges.length >= DEFAULT_IMPACT_MAX_EDGES) {
3621 truncated = true;
3622 continue;
3623 }
3624 seenEdges.add(key);
3625 mergedEdges.push(e);
3626 }
3627 }
3628 }
3629 return { nodes: mergedNodes, edges: mergedEdges, roots: defNodes.map((n) => n.id), truncated };
3630 };
3631
3632 // Single definition (or same-file overloads): the familiar merged report.
3633 if (groups.length === 1) {

Callers

nothing calls this directly

Calls 6

hasMethod · 0.80
pushMethod · 0.80
mapMethod · 0.80
getImpactRadiusMethod · 0.45
setMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected