MCPcopy
hub / github.com/github/awesome-copilot / getCollectionRootPath

Function getCollectionRootPath

website/src/scripts/modal.ts:120–130  ·  view source on GitHub ↗
(
  filePath: string,
  collectionName: string
)

Source from the content-addressed store, hash-verified

118}
119
120function getCollectionRootPath(
121 filePath: string,
122 collectionName: string
123): string | null {
124 const segments = filePath.split("/");
125 const collectionIndex = segments.indexOf(collectionName);
126 if (collectionIndex === -1 || segments.length <= collectionIndex + 1) {
127 return null;
128 }
129 return segments.slice(0, collectionIndex + 2).join("/");
130}
131
132function getSkillRootPath(filePath: string): string | null {
133 return getCollectionRootPath(filePath, "skills");

Callers 2

resolveResourceTitleFunction · 0.85
getSkillRootPathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected