MCPcopy Index your code
hub / github.com/forloopcodes/contextplus / findOrphanedFiles

Function findOrphanedFiles

src/core/hub.ts:100–118  ·  view source on GitHub ↗
(
  rootDir: string,
  allFilePaths: string[],
)

Source from the content-addressed store, hash-verified

98}
99
100export async function findOrphanedFiles(
101 rootDir: string,
102 allFilePaths: string[],
103): Promise<string[]> {
104 const hubs = await discoverHubs(rootDir);
105 const linkedFiles = new Set<string>();
106
107 for (const hubRelPath of hubs) {
108 const info = await parseHubFile(resolve(rootDir, hubRelPath));
109 for (const link of info.links) {
110 linkedFiles.add(link.target.replace(/\\/g, "/"));
111 }
112 linkedFiles.add(hubRelPath);
113 }
114
115 return allFilePaths
116 .filter((f) => !f.endsWith(".md"))
117 .filter((f) => !linkedFiles.has(f.replace(/\\/g, "/")));
118}
119
120export function formatHubLink(target: string, description: string): string {
121 return description

Callers 2

hub.test.mjsFile · 0.85
getFeatureHubFunction · 0.85

Calls 2

discoverHubsFunction · 0.85
parseHubFileFunction · 0.85

Tested by

no test coverage detected