Skip to content

Commit 736a903

Browse files
committed
docs: Describe filesystem search exclusions
Document the shared relative-glob exclusion behavior for find and grep, and add release metadata for the large-tree performance changes.
1 parent 95028a0 commit 736a903

5 files changed

Lines changed: 18 additions & 11 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cloudflare/computer": minor
3+
---
4+
5+
Add subtree exclusions to filesystem searches and reduce database and RPC work for sync, Worker shell tree walks, grep, and scoped Git diffs.

docs/04_filesystem_interface.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ interface GrepOptions {
392392
limit?: number;
393393
offset?: number;
394394
include?: string;
395+
exclude?: string[];
395396
}
396397

397398
interface WorkspaceGrepContextLine {
@@ -417,8 +418,9 @@ grep(
417418
Matching is literal and case-sensitive by default. Set `regex: true` to
418419
interpret `pattern` as a regular expression and `ignoreCase: true` to ignore
419420
letter case. `context` adds that many lines before and after each match.
420-
`include` is a glob relative to a searched directory. `limit` and `offset`
421-
paginate matching lines.
421+
`include` and `exclude` are globs relative to a searched directory. Exclusions
422+
use the same rules as `find` and prune matching directories before reading
423+
their contents. `limit` and `offset` paginate matching lines.
422424

423425
`path` may be a directory or a single file. Directory searches return matches
424426
in deterministic depth-first discovery order, then line order within each

docs/09_tool_interface.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ The AI tool defaults to literal, case-sensitive matching. Set `regex: true` to i
197197

198198
The tool passes `include`, `limit`, and `offset` through one `workspace.fs.grep` call. The storage search pages matching files and stops after the requested matches, so an included search does not build the full file or match list in the tool layer. Directory searches return matches in deterministic depth-first discovery order, then line order within each file. They are not globally sorted by full path.
199199

200-
The lower-level `workspace.fs.grep` uses the same literal, case-sensitive defaults. Its options also accept `limit`, `offset`, `include`, `context`, `regex`, and `ignoreCase`.
200+
The lower-level `workspace.fs.grep` uses the same literal, case-sensitive defaults. Its options also accept `limit`, `offset`, `include`, `exclude`, `context`, `regex`, and `ignoreCase`. `exclude` uses the same relative exclusion globs as `find` and prunes matching directories before reading their contents.
201201

202202
## `write`
203203

packages/dofs/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ export class WorkspaceDO extends DurableObject {
4747
- All filesystem primitives listed above are implemented and unit-tested.
4848
`readdir` returns size and modification time and supports stable
4949
`limit`/`offset` pages, including files held in pending write buffers.
50-
`find` supports `*`, `**`, and `?` globs. `grep` supports bounded pages,
50+
`find` supports `*`, `**`, and `?` globs. `find` and `grep` can prune
51+
directories with relative exclusion globs. `grep` supports bounded pages,
5152
regular expressions or fixed strings, explicit case handling, and numbered
5253
context lines.
5354
- `SQLiteWorkspaceProvider` (the `@platformatic/vfs` adapter) implemented and exported from the package entrypoint; consumed by `@cloudflare/computerd`.

packages/dofs/src/fs/grep.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,9 @@ export interface GrepOptions {
3232
/** Glob relative to a searched directory that limits files. */
3333
include?: string;
3434
/**
35-
* Whole-segment names to skip during traversal. Excluded directories
36-
* are never descended into, so their files are never read. Unlike
37-
* `include`, which filters files after the walk has already visited
38-
* them, this prunes the walk itself.
35+
* Globs relative to the searched directory that exclude entries.
36+
* Matching directories are never descended into, so their files are
37+
* not read. Exclusions use the same glob syntax as `include`.
3938
*/
4039
exclude?: string[];
4140
}
@@ -125,9 +124,9 @@ function normalizeOptions(options: GrepOptions): {
125124

126125
interface ScanTarget {
127126
path: string;
128-
// Undefined when the caller grepped a single file directly: that
129-
// path still needs a normal resolve. Traversal-produced targets
130-
// carry the inode the walk already read.
127+
// Targets normally carry the inode and size already read during path
128+
// resolution or traversal. The optional fields keep the streaming
129+
// path available to callers that only have a path.
131130
inode?: number;
132131
size?: number;
133132
}

0 commit comments

Comments
 (0)