Problem
IFileSystem.getAllPaths() is the only async-incompatible method in the interface (besides the pure resolvePath):
// Every other method returns Promise<...>
getAllPaths(): string[]; // ← sync only
This makes it impossible for remote filesystem implementations (Dropbox, S3, Google Drive, etc.) to support glob expansion (*.txt, /projects/*.md) without an upfront prefetch of the entire file tree.
Commands like find and grep -r work fine — they walk the tree via readdir() which is async. But glob patterns in word expansion call getAllPaths() synchronously, so remote backends must either:
- Return
[] (globs silently match nothing)
- Require users to call a prefetch method before any glob — surprising and easy to forget
Proposal
Make getAllPaths() accept async implementations:
getAllPaths(): string[] | Promise<string[]>;
This is backwards-compatible — existing sync implementations (InMemoryFs, OverlayFs, ReadWriteFs) continue returning string[]. The glob expansion code in the interpreter just needs to await the result (it's already in an async context).
Context
This came up while building just-bash-dropbox, a Dropbox HTTP API backend for IFileSystem. Everything works except globs — find . -name "*.md" works (uses readdir), but cat *.md doesn't (uses getAllPaths).
Tracking issue: manishrc/just-bash-dropbox#1
Problem
IFileSystem.getAllPaths()is the only async-incompatible method in the interface (besides the pureresolvePath):This makes it impossible for remote filesystem implementations (Dropbox, S3, Google Drive, etc.) to support glob expansion (
*.txt,/projects/*.md) without an upfront prefetch of the entire file tree.Commands like
findandgrep -rwork fine — they walk the tree viareaddir()which is async. But glob patterns in word expansion callgetAllPaths()synchronously, so remote backends must either:[](globs silently match nothing)Proposal
Make
getAllPaths()accept async implementations:This is backwards-compatible — existing sync implementations (InMemoryFs, OverlayFs, ReadWriteFs) continue returning
string[]. The glob expansion code in the interpreter just needs toawaitthe result (it's already in an async context).Context
This came up while building just-bash-dropbox, a Dropbox HTTP API backend for IFileSystem. Everything works except globs —
find . -name "*.md"works (uses readdir), butcat *.mddoesn't (uses getAllPaths).Tracking issue: manishrc/just-bash-dropbox#1