From ad1fe25e61b0747ce63ab0c681df5943e5a62fdb Mon Sep 17 00:00:00 2001 From: Idrees Kamal Date: Fri, 17 Jul 2026 13:32:37 -0500 Subject: [PATCH] =?UTF-8?q?fix(sources):=20audit=20walker=20inverted=20pru?= =?UTF-8?q?neDir=20=E2=80=94=20nested=20sources=20scanned=200=20files=20(#?= =?UTF-8?q?2678)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The audit walk in `gbrain sources audit` used `if (pruneDir(entry, dir)) continue;` but pruneDir() returns true = descend, false = prune (core/sync.ts). The inversion made the walker skip every legitimate subdirectory (any source with nested content reports 'Files scanned: 0 markdown files') while descending into exactly the trees it should skip (node_modules/, .git/, vendor/, .raw/). The walker's own comment says 'Mirror gbrain sync's descent rules' — this makes it actually do so. Repro on a real brain (v0.42.56/57): a comms source with per-contact subdirectories audits 0 files; a flat source audits correctly. Co-authored-by: Idrees Kamal Co-authored-by: Claude Fable 5 --- src/commands/sources.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/commands/sources.ts b/src/commands/sources.ts index 14891bdc5..38e4fe317 100644 --- a/src/commands/sources.ts +++ b/src/commands/sources.ts @@ -1147,7 +1147,8 @@ async function runAudit(engine: BrainEngine, args: string[]): Promise { continue; } if (stat.isDirectory()) { - if (pruneDir(entry, dir)) continue; + // pruneDir returns true = descend, false = prune (see core/sync.ts). + if (!pruneDir(entry, dir)) continue; walk(full); } else if (entry.endsWith('.md')) { files.push(full);