Whether a directory should be EXPANDED (deep walk) vs SUMMARISED (one-line count).
(name: string, ctx: TreeContext)
| 129 | |
| 130 | /** Whether a directory should be EXPANDED (deep walk) vs SUMMARISED (one-line count). */ |
| 131 | function shouldExpandDir(name: string, ctx: TreeContext): boolean { |
| 132 | if (!ctx.hasWeighting) return true; // no weighting → expand everything (legacy behaviour) |
| 133 | // Always expand if name matches the relevant set OR is a generic source folder |
| 134 | if (ctx.relevantFolders.has(name)) return true; |
| 135 | // src/lib/internal/core — usually generic, expand by default |
| 136 | if (['src', 'lib', 'internal', 'core', 'common', 'shared'].includes(name)) return true; |
| 137 | return false; |
| 138 | } |
| 139 | |
| 140 | async function walk(dir: string, depth: number, prefix: string, ctx: TreeContext): Promise<void> { |
| 141 | if (depth > ctx.maxDepth || ctx.entryCount >= ctx.maxEntries || ctx.truncated) return; |