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

Function summarizeOutsideIndex

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

* Calls and type mentions from this symbol that never resolved to a node — a * third-party package, a runtime builtin, a construct extraction doesn't model. * * Without this the callee rail would silently be shorter than the body's call * sites, which reads as "nothing else happens here". Saying

(
  cg: CodeGraph,
  nodeId: string
)

Source from the content-addressed store, hash-verified

408 * symbols outside the index" is the honest version of the same screen.
409 */
410function summarizeOutsideIndex(
411 cg: CodeGraph,
412 nodeId: string
413): {
414 total: number;
415 byKind: Record<string, number>;
416 samples: Array<{ name: string; kind: string; line: number; col: number }>;
417} {
418 let refs;
419 try {
420 refs = cg.getUnresolvedReferencesFrom(nodeId);
421 } catch {
422 return { total: 0, byKind: {}, samples: [] };
423 }
424
425 const byKind: Record<string, number> = {};
426 for (const ref of refs) byKind[ref.referenceKind] = (byKind[ref.referenceKind] ?? 0) + 1;
427
428 const samples = [...refs]
429 .sort((a, b) => a.line - b.line || a.column - b.column)
430 .slice(0, MAX_OUTSIDE_INDEX_SAMPLES)
431 .map((ref) => ({
432 name: ref.referenceName,
433 kind: ref.referenceKind,
434 line: ref.line,
435 col: ref.column,
436 }));
437
438 return { total: refs.length, byKind, samples };
439}
440
441// =============================================================================
442// Blast radius

Callers 1

buildNodeFunction · 0.85

Calls 2

mapMethod · 0.80

Tested by

no test coverage detected