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

Function findIndexedFile

src/ui-server/api/source.ts:70–84  ·  view source on GitHub ↗
(
  cg: CodeGraph,
  requested: string
)

Source from the content-addressed store, hash-verified

68 * itself handed us).
69 */
70export function findIndexedFile(
71 cg: CodeGraph,
72 requested: string
73): { record: FileRecord; storedPath: string } | null {
74 const posix = toRequestPath(requested);
75 const record = cg.getFile(posix);
76 if (record) return { record, storedPath: posix };
77
78 const native = posix.split('/').join(path.sep);
79 if (native !== posix) {
80 const legacy = cg.getFile(native);
81 if (legacy) return { record: legacy, storedPath: native };
82 }
83 return null;
84}
85
86/**
87 * Forward slashes and no leading `./` — the form indexed paths are stored in.

Callers 7

annotateWhenFunction · 0.90
resolveFunction · 0.90
loadFileFunction · 0.90
driftForFunction · 0.90
mentionsOfFunction · 0.90
resolveRequestedFileFunction · 0.85
readIndexedFileTextFunction · 0.85

Calls 3

toRequestPathFunction · 0.85
getFileMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected