MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / resolveFilePathWithinProject

Function resolveFilePathWithinProject

sdk/src/tools/path-utils.ts:16–31  ·  view source on GitHub ↗
(
  projectRoot: string,
  filePath: string,
)

Source from the content-addressed store, hash-verified

14}
15
16export function resolveFilePathWithinProject(
17 projectRoot: string,
18 filePath: string,
19): ResolvedProjectPath | null {
20 const resolvedRoot = path.resolve(projectRoot)
21 const fullPath = path.isAbsolute(filePath)
22 ? path.resolve(filePath)
23 : path.resolve(resolvedRoot, filePath)
24 const relativePath = path.relative(resolvedRoot, fullPath)
25
26 if (relativePath === '' || escapesProject(relativePath)) {
27 return null
28 }
29
30 return { fullPath, relativePath }
31}
32
33export function getProjectPathLookupKeys(
34 projectRoot: string,

Callers 4

changeFileFunction · 0.90
getFilesFunction · 0.90
path-utils.test.tsFile · 0.90
getProjectPathLookupKeysFunction · 0.85

Calls 1

escapesProjectFunction · 0.85

Tested by

no test coverage detected