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

Method groupDefinitions

src/mcp/tools.ts:1535–1560  ·  view source on GitHub ↗

* Group symbol matches into DISTINCT DEFINITIONS — one group per * (filePath, qualifiedName), so same-file overloads stay together while * unrelated same-named classes across a monorepo's apps (#764: one * `UserService` per NestJS app) are kept apart. Optionally narrowed by a * `file` pa

(
    nodes: Node[],
    fileFilter: string | undefined
  )

Source from the content-addressed store, hash-verified

1533 * `file` path/suffix first.
1534 */
1535 private groupDefinitions(
1536 nodes: Node[],
1537 fileFilter: string | undefined
1538 ): { groups: Node[][]; filteredOut: boolean } {
1539 let pool = nodes;
1540 let filteredOut = false;
1541 if (fileFilter) {
1542 const wanted = fileFilter.replace(/^\.\//, '');
1543 const narrowed = pool.filter(
1544 (n) => n.filePath === wanted || n.filePath.endsWith(wanted) || n.filePath.endsWith(`/${wanted}`)
1545 );
1546 if (narrowed.length > 0) {
1547 pool = narrowed;
1548 } else {
1549 filteredOut = true;
1550 }
1551 }
1552 const byDef = new Map<string, Node[]>();
1553 for (const n of pool) {
1554 const key = `${n.filePath}|${n.qualifiedName}`;
1555 const group = byDef.get(key);
1556 if (group) group.push(n);
1557 else byDef.set(key, [n]);
1558 }
1559 return { groups: [...byDef.values()], filteredOut };
1560 }
1561
1562 /** Section heading for one distinct definition in grouped output. */
1563 private definitionHeading(group: Node[]): string {

Callers 3

handleCallersMethod · 0.95
handleCalleesMethod · 0.95
handleImpactMethod · 0.95

Calls 2

getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected