The open source coding agent.
TypeScript
docs: projects, find.files, notifications (#6438)
opencode-agent[bot]37da005a0141
diff --git a/packages/web/src/content/docs/keybinds.mdx b/packages/web/src/content/docs/keybinds.mdxindex 4f1b09d3f1b..04d03d0d849 100644--- a/packages/web/src/content/docs/keybinds.mdx+++ b/packages/web/src/content/docs/keybinds.mdx@@ -118,6 +118,29 @@ You can disable a keybind by adding the key to your config with a value of "none---+## Desktop prompt shortcuts++The OpenCode desktop app prompt input supports common Readline/Emacs-style shortcuts for editing text. These are built-in and currently not configurable via `opencode.json`.++| Shortcut | Action |+| -------- | ---------------------------------------- |+| `ctrl+a` | Move to start of current line |+| `ctrl+e` | Move to end of current line |+| `ctrl+b` | Move cursor back one character |+| `ctrl+f` | Move cursor forward one character |+| `alt+b` | Move cursor back one word |+| `alt+f` | Move cursor forward one word |+| `ctrl+d` | Delete character under cursor |+| `ctrl+k` | Kill to end of line |+| `ctrl+u` | Kill to start of line |+| `ctrl+w` | Kill previous word |+| `alt+d` | Kill next word |+| `ctrl+y` | Yank (paste) last killed text |+| `ctrl+t` | Transpose characters |+| `ctrl+g` | Cancel popovers / abort running response |++---+## Shift+EnterSome terminals don't send modifier keys with Enter by default. You may need to configure your terminal to send `Shift+Enter` as an escape sequence.diff --git a/packages/web/src/content/docs/plugins.mdx b/packages/web/src/content/docs/plugins.mdxindex ef2f1338d09..59a7010833d 100644--- a/packages/web/src/content/docs/plugins.mdx+++ b/packages/web/src/content/docs/plugins.mdx@@ -230,6 +230,10 @@ export const NotificationPlugin = async ({ project, client, $, directory, worktrWe are using `osascript` to run AppleScript on macOS. Here we are using it to send notifications.+:::note+If you’re using the OpenCode desktop app, it can send system notifications automatically when a response is ready or when a session errors.+:::+---### .env protectiondiff --git a/packages/web/src/content/docs/sdk.mdx b/packages/web/src/content/docs/sdk.mdxindex 1ff84310325..5fe738407c9 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({diff --git a/packages/web/src/content/docs/server.mdx b/packages/web/src/content/docs/server.mdxindex c63917f792e..2568ade35cb 100644--- a/packages/web/src/content/docs/server.mdx+++ b/packages/web/src/content/docs/server.mdx@@ -173,14 +173,22 @@ The opencode server exposes the following APIs.### Files-| Method | Path | Description | Response |-| ------ | ------------------------ | ---------------------------- | ------------------------------------------------------------------------------------------- |-| `GET` | `/find?pattern=<pat>` | Search for text in files | Array of match objects with `path`, `lines`, `line_number`, `absolute_offset`, `submatches` |-| `GET` | `/find/file?query=<q>` | Find files by name | `string[]` (file paths) |-| `GET` | `/find/symbol?query=<q>` | Find workspace symbols | <a href={typesUrl}><code>Symbol[]</code></a> |-| `GET` | `/file?path=<path>` | List files and directories | <a href={typesUrl}><code>FileNode[]</code></a> |-| `GET` | `/file/content?path=<p>` | Read a file | <a href={typesUrl}><code>FileContent</code></a> |-| `GET` | `/file/status` | Get status for tracked files | <a href={typesUrl}><code>File[]</code></a> |+| Method | Path | Description | Response |+| ------ | ------------------------ | ---------------------------------- | ------------------------------------------------------------------------------------------- |+| `GET` | `/find?pattern=<pat>` | Search for text in files | Array of match objects with `path`, `lines`, `line_number`, `absolute_offset`, `submatches` |+| `GET` | `/find/file?query=<q>` | Find files and directories by name | `string[]` (paths) |+| `GET` | `/find/symbol?query=<q>` | Find workspace symbols | <a href={typesUrl}><code>Symbol[]</code></a> |+| `GET` | `/file?path=<path>` | List files and directories | <a href={typesUrl}><code>FileNode[]</code></a> |+| `GET` | `/file/content?path=<p>` | Read a file | <a href={typesUrl}><code>FileContent</code></a> |+| `GET` | `/file/status` | Get status for tracked files | <a href={typesUrl}><code>File[]</code></a> |++#### `/find/file` query parameters++- `query` (required) — search string (fuzzy match)+- `type` (optional) — limit results to `"file"` or `"directory"`+- `directory` (optional) — override the project root for the search+- `limit` (optional) — max results (1–200)+- `dirs` (optional) — legacy flag (`"false"` returns only files)---