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

Function computePathProximity

src/resolution/name-matcher.ts:2037–2041  ·  view source on GitHub ↗

* Compute directory proximity between two file paths. * Returns a score based on the number of shared directory segments.

(filePath1: string, filePath2: string)

Source from the content-addressed store, hash-verified

2035 * Returns a score based on the number of shared directory segments.
2036 */
2037function computePathProximity(filePath1: string, filePath2: string): number {
2038 const dir1 = filePath1.split('/');
2039 dir1.pop();
2040 return pathProximityFromDirs(dir1, filePath2);
2041}
2042
2043/**
2044 * Find the best matching node when there are multiple candidates

Callers 2

pickClosestFileNodeFunction · 0.85
matchByExactNameFunction · 0.85

Calls 1

pathProximityFromDirsFunction · 0.85

Tested by

no test coverage detected