MCPcopy
hub / github.com/coder/mux / findDeepestTopLevelParentProject

Function findDeepestTopLevelParentProject

src/node/services/projectService.ts:336–353  ·  view source on GitHub ↗
(
  candidatePath: string,
  projects: Map<string, ProjectConfig>
)

Source from the content-addressed store, hash-verified

334}
335
336function findDeepestTopLevelParentProject(
337 candidatePath: string,
338 projects: Map<string, ProjectConfig>
339): string | null {
340 let parentPath: string | null = null;
341 for (const [projectPath, projectConfig] of projects) {
342 if (projectConfig.parentProjectPath || projectPath === candidatePath) {
343 continue;
344 }
345 if (!isPathDescendant(projectPath, candidatePath)) {
346 continue;
347 }
348 if (!parentPath || projectPath.length > parentPath.length) {
349 parentPath = projectPath;
350 }
351 }
352 return parentPath;
353}
354
355function hasRegisteredSubProjectAncestor(
356 candidatePath: string,

Callers 2

createMethod · 0.85

Calls 1

isPathDescendantFunction · 0.90

Tested by

no test coverage detected