Add directory-entry listing and existence helpers to file discovery - #2355
Conversation
Extracted from the multi-agent staging branch (PR #2354) as standalone infrastructure: listDiscoveryDirectoryEntries lists immediate entries of a discovery directory and discoveryFileExists checks path existence, both fsAdapter-aware with Node fallback. No behavior changes to existing discovery.
|
Ran a structured review pass (quality / correctness / security) over this slice. Clean extraction overall — the fsAdapter/Node dual-path mirrors the existing
Nothing security-relevant in this slice. LGTM after #1. |
The fsAdapter branch already exposes boolean entry properties, so pass them through directly and add a no-adapter tempdir test for the Node Dirent fallback where the contract differs. Constraint: Review requested the fsAdapter path avoid masking contract mistakes and the Node fallback be covered.\nRejected: Keep Boolean() coercion | it hides adapter shape errors instead of surfacing them.\nConfidence: high\nScope-risk: narrow\nTested: deno test --no-check --allow-all src/discovery/file-discovery.test.ts\nNot-tested: Full repository suite
|
Addressed the sensible review items in |
Summary
Extracts the standalone file-discovery infrastructure from the multi-agent staging branch (#2354), per the agreed split (PR A):
listDiscoveryDirectoryEntries(immediate, non-recursive directory listing) anddiscoveryFileExists(path existence), both fsAdapter-aware with Node fallback.Purely additive — no behavior changes to existing discovery. First of the extraction series;
delegates:support (PR B) follows separately.Testing
deno test --no-check --allow-all src/discovery/file-discovery.test.ts— 3/3 passdeno test --no-check --allow-all src/discovery— full suite greenType of Change