MCPcopy Index your code
hub / github.com/PatrickSys/codebase-context / formatProjectLabel

Function formatProjectLabel

src/index.ts:313–328  ·  view source on GitHub ↗
(rootPath: string)

Source from the content-addressed store, hash-verified

311}
312
313function formatProjectLabel(rootPath: string): string {
314 const knownRootLabel = getKnownRootLabel(rootPath);
315 if (knownRootLabel) {
316 return knownRootLabel;
317 }
318
319 const containingRoot = getContainingKnownRoot(rootPath);
320 if (containingRoot) {
321 const relativePath = path.relative(containingRoot, rootPath);
322 if (!relativePath) {
323 return getKnownRootLabel(containingRoot) ?? (path.basename(rootPath) || rootPath);
324 }
325 return relativePath.replace(/\\/g, '/');
326 }
327 return path.basename(rootPath) || rootPath;
328}
329
330function getRelativeProjectPath(rootPath: string): string | undefined {
331 const containingRoot = getContainingKnownRoot(rootPath);

Callers 1

buildProjectDescriptorFunction · 0.85

Calls 2

getKnownRootLabelFunction · 0.85
getContainingKnownRootFunction · 0.85

Tested by

no test coverage detected