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

Function targetsOf

__tests__/sync-object-members.test.ts:78–87  ·  view source on GitHub ↗

Where each call through `refName` landed: ` -> :: `.

(graph: CodeGraph, refName: string)

Source from the content-addressed store, hash-verified

76
77/** Where each call through `refName` landed: `<caller> -> <target kind> <file>::<qualified name>`. */
78function targetsOf(graph: CodeGraph, refName: string): string[] {
79 const ids = graph.getFiles().flatMap((file) => graph.getNodesInFile(file.path)).map((n) => n.id);
80 return graph.getOutgoingEdgesFrom(ids)
81 .filter((e) => e.metadata?.refName === refName && e.kind !== 'imports')
82 .map((e) => {
83 const target = graph.getNode(e.target)!;
84 return `${graph.getNode(e.source)!.name} -> ${target.kind} ${target.filePath}::${target.qualifiedName}`;
85 })
86 .sort();
87}
88
89/** Index `before`, write `after` over it, sync; return the graph and what a full index of `after` holds. */
90async function syncEdit(before: Files, after: Files): Promise<{ root: string; graph: CodeGraph; full: string[] }> {

Callers 1

Calls 5

mapMethod · 0.80
getFilesMethod · 0.80
getNodeMethod · 0.80
getNodesInFileMethod · 0.65
getOutgoingEdgesFromMethod · 0.45

Tested by

no test coverage detected