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

Function summarizeBlast

src/ui-server/api/node.ts:466–498  ·  view source on GitHub ↗

* What would need re-checking if this symbol changed. * * `getImpactRadius` at depth 3 is the engine's own answer to that question — * incoming dependencies only, `contains` excluded upward so a leaf symbol does * not explode into its whole class, container members expanded downward so * caller

(cg: CodeGraph, node: Node, direct: number)

Source from the content-addressed store, hash-verified

464 * callers of a class's methods count against the class.
465 */
466function summarizeBlast(cg: CodeGraph, node: Node, direct: number): WireBlastSummary | null {
467 let subgraph;
468 try {
469 subgraph = cg.getImpactRadius(node.id, BLAST_DEPTH);
470 } catch {
471 return null;
472 }
473
474 const perFile = new Map<string, number>();
475 let routes = 0;
476 for (const [id, dependent] of subgraph.nodes) {
477 if (id === node.id) continue;
478 const file = toPosixPath(dependent.filePath);
479 perFile.set(file, (perFile.get(file) ?? 0) + 1);
480 if (dependent.kind === ('route' as NodeKind)) routes++;
481 }
482
483 const testFiles = [...perFile.keys()].filter(isTestFile).length;
484 const topFiles = [...perFile.entries()]
485 .sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]))
486 .slice(0, 40)
487 .map(([file, symbols]) => ({ file, symbols, test: isTestFile(file) }));
488
489 return {
490 direct,
491 withinHops: Math.max(0, subgraph.nodes.size - 1),
492 hops: BLAST_DEPTH,
493 files: perFile.size,
494 testFiles,
495 routes,
496 topFiles,
497 };
498}
499
500// =============================================================================
501// Drift

Callers 1

buildNodeFunction · 0.85

Calls 5

isTestFileFunction · 0.90
mapMethod · 0.80
getMethod · 0.65
getImpactRadiusMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected