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

Method impactOf

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

Source from the content-addressed store, hash-verified

3613 : '';
3614
3615 const impactOf = (defNodes: Node[]) => {
3616 const mergedNodes = new Map<string, Node>();
3617 const mergedEdges: Edge[] = [];
3618 const seenEdges = new Set<string>();
3619 let truncated = false;
3620 for (const node of defNodes) {
3621 const impact = cg.getImpactRadius(node.id, depth);
3622 truncated ||= impact.truncated === true;
3623 for (const [id, n] of impact.nodes) {
3624 if (!mergedNodes.has(id) && mergedNodes.size >= DEFAULT_IMPACT_MAX_NODES) {
3625 truncated = true;
3626 continue;
3627 }
3628 mergedNodes.set(id, n);
3629 answerPaths.add(n.filePath);
3630 }
3631 for (const e of impact.edges) {
3632 if (!mergedNodes.has(e.source) || !mergedNodes.has(e.target)) {
3633 truncated = true;
3634 continue;
3635 }
3636 const key = `${e.source}->${e.target}:${e.kind}`;
3637 if (!seenEdges.has(key)) {
3638 if (mergedEdges.length >= DEFAULT_IMPACT_MAX_EDGES) {
3639 truncated = true;
3640 continue;
3641 }
3642 seenEdges.add(key);
3643 mergedEdges.push(e);
3644 }
3645 }
3646 }
3647 return { nodes: mergedNodes, edges: mergedEdges, roots: defNodes.map((n) => n.id), truncated };
3648 };
3649
3650 // Single definition (or same-file overloads): the familiar merged report.
3651 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