MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / shouldExpandDir

Function shouldExpandDir

src/context/tree.ts:131–138  ·  view source on GitHub ↗

Whether a directory should be EXPANDED (deep walk) vs SUMMARISED (one-line count).

(name: string, ctx: TreeContext)

Source from the content-addressed store, hash-verified

129
130/** Whether a directory should be EXPANDED (deep walk) vs SUMMARISED (one-line count). */
131function 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
140async function walk(dir: string, depth: number, prefix: string, ctx: TreeContext): Promise<void> {
141 if (depth > ctx.maxDepth || ctx.entryCount >= ctx.maxEntries || ctx.truncated) return;

Callers 1

walkFunction · 0.85

Calls 1

hasMethod · 0.45

Tested by

no test coverage detected