diff options
| author | opencode-agent[bot] <219766164+opencode-agent[bot]@users.noreply.github.com> | 2025-12-30 09:44:09 -0600 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-12-30 09:44:09 -0600 |
| commit | 37da005a0141b099bb72671b320991c85de8cd0f (patch) | |
| tree | c42dfb5fa54fe598c7409b45193baddc23b589a2 /packages/web/src/content/docs/sdk.mdx | |
| parent | 8b708242f1eb21e40af5ef24e6e3eb4b7683a45e (diff) | |
| download | opencode-37da005a0141b099bb72671b320991c85de8cd0f.tar.gz opencode-37da005a0141b099bb72671b320991c85de8cd0f.zip | |
docs: projects, find.files, notifications (#6438)
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
Diffstat (limited to 'packages/web/src/content/docs/sdk.mdx')
| -rw-r--r-- | packages/web/src/content/docs/sdk.mdx | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/packages/web/src/content/docs/sdk.mdx b/packages/web/src/content/docs/sdk.mdx index 1ff843103..5fe738407 100644 --- a/packages/web/src/content/docs/sdk.mdx +++ b/packages/web/src/content/docs/sdk.mdx @@ -283,13 +283,19 @@ await client.session.prompt({ ### Files -| Method | Description | Response | -| ------------------------- | ---------------------------- | ------------------------------------------------------------------------------------------- | -| `find.text({ query })` | Search for text in files | Array of match objects with `path`, `lines`, `line_number`, `absolute_offset`, `submatches` | -| `find.files({ query })` | Find files by name | `string[]` (file paths) | -| `find.symbols({ query })` | Find workspace symbols | <a href={typesUrl}><code>Symbol[]</code></a> | -| `file.read({ query })` | Read a file | `{ type: "raw" \| "patch", content: string }` | -| `file.status({ query? })` | Get status for tracked files | <a href={typesUrl}><code>File[]</code></a> | +| Method | Description | Response | +| ------------------------- | ---------------------------------- | ------------------------------------------------------------------------------------------- | +| `find.text({ query })` | Search for text in files | Array of match objects with `path`, `lines`, `line_number`, `absolute_offset`, `submatches` | +| `find.files({ query })` | Find files and directories by name | `string[]` (paths) | +| `find.symbols({ query })` | Find workspace symbols | <a href={typesUrl}><code>Symbol[]</code></a> | +| `file.read({ query })` | Read a file | `{ type: "raw" \| "patch", content: string }` | +| `file.status({ query? })` | Get status for tracked files | <a href={typesUrl}><code>File[]</code></a> | + +`find.files` supports a few optional query fields: + +- `type`: `"file"` or `"directory"` +- `directory`: override the project root for the search +- `limit`: max results (1–200) --- @@ -302,7 +308,11 @@ const textResults = await client.find.text({ }) const files = await client.find.files({ - query: { query: "*.ts" }, + query: { query: "*.ts", type: "file" }, +}) + +const directories = await client.find.files({ + query: { query: "packages", type: "directory", limit: 20 }, }) const content = await client.file.read({ |
