| 76 | const skip = new Set(["node_modules", ".git", "build", "dist", ".mcp_data"]); |
| 77 | |
| 78 | async function walk(dir: string): Promise<void> { |
| 79 | const entries = await readdir(dir, { withFileTypes: true }); |
| 80 | for (const entry of entries) { |
| 81 | if (skip.has(entry.name)) continue; |
| 82 | const full = join(dir, entry.name); |
| 83 | |
| 84 | if (entry.isDirectory()) { |
| 85 | await walk(full); |
| 86 | } else if (entry.name.endsWith(".md")) { |
| 87 | const content = await readFile(full, "utf-8"); |
| 88 | if (WIKILINK_RE.test(content)) { |
| 89 | hubs.push(relative(rootDir, full).replace(/\\/g, "/")); |
| 90 | WIKILINK_RE.lastIndex = 0; |
| 91 | } |
| 92 | } |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | await walk(rootDir); |
| 97 | return hubs.sort(); |