Skip to content

filesInScope

filesInScope(patterns, opts?): Promise<string[]>

The concrete on-disk files matching patterns — a scope’s context slice (DR-0011: build a headless-script’s working set).

ParameterTypeDescription
patternsPatternsThe scope to resolve (Patterns).
opts?FsOptionsFsOptions: matching semantics plus cwd / ignore / onlyFiles / absolute.

Promise<string[]>

The matching files, sorted; cwd-relative unless opts.absolute.

Same semantics as the pure layer — a bare path is an exact match and a subtree needs **. The globber only enumerates the tree; every include/exclude decision is the path API’s matches.

const context = await filesInScope(["src/api/**", "src/db/**"], { cwd: repoRoot });
// → ["src/api/routes/list.ts", "src/api/user.ts", "src/db/pool.ts"] (sorted, cwd-relative)