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

Function getRelativePath

cli/src/utils/path-helpers.ts:29–38  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

27 * If already relative or project root unavailable, returns the path as-is
28 */
29export function getRelativePath(filePath: string): string {
30 // If it's already a relative path, return as-is
31 if (!filePath.startsWith('/')) return filePath
32
33 const projectRoot = getProjectRoot()
34 if (!projectRoot) return filePath
35
36 // Use Node's path.relative for proper relative path calculation
37 return path.relative(projectRoot, filePath)
38}

Callers 1

Calls 1

getProjectRootFunction · 0.90

Tested by

no test coverage detected