Skip to content

Commit 400a665

Browse files
committed
feat: map more Cursor tools onto opencode native renderers
Generalize the edit→diff-viewer mapping into a table-driven adapter so more of Cursor's internal tool activity renders with opencode's native UI in blocks mode instead of generic cursor_* JSON blocks. Native mappings (provider-executed + dynamic, never re-run on disk): - shell→bash, read→read, write→write, glob→glob, grep→grep, ls→list, updateTodos→todowrite, task→task - web search (Cursor runs it as an MCP tool) → websearch Cleaner fallbacks for tools with no opencode counterpart: - readLints → formatted cursor_readLints diagnostics list - delete → one-line cursor_delete confirmation - any MCP tool's content[] flattened to readable text Arg shapes are translated to opencode's (path→filePath, globPattern→ pattern, fileText→content, …). Tools without a mapping, or results with an unexpected shape, still fall back to a safe cursor_* block.
1 parent ae75b3f commit 400a665

4 files changed

Lines changed: 1010 additions & 44 deletions

File tree

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,24 @@ All notable changes to this project will be documented in this file.
44

55
## [Unreleased]
66

7+
- **More Cursor tools map onto opencode's native tool renderers (blocks mode).**
8+
Following the `edit` → diff-viewer mapping, Cursor's `shell`, `read`, `write`,
9+
`glob`, `grep`, `ls`, `updateTodos`, and `task` tool activity is now surfaced
10+
under opencode's registered `bash`, `read`, `write`, `glob`, `grep`, `list`,
11+
`todowrite`, and `task` tools, and Cursor's web search (which runs as an MCP
12+
tool) maps onto opencode's `websearch` renderer — so opencode renders its
13+
native UI (shell console, file viewer, todo checklist, subagent card, search
14+
results, …) instead of generic `cursor_*` blocks. Cursor's arg shape is
15+
translated to opencode's (e.g. `path``filePath`, `globPattern``pattern`,
16+
`fileText``content`); calls stay provider-executed (display-only, never
17+
re-run on disk).
18+
- **Cleaner fallback blocks for tools without an opencode counterpart.**
19+
`readLints` and `delete` now render as formatted `cursor_*` blocks (a
20+
diagnostics list / a one-line confirmation) instead of raw JSON, and every MCP
21+
tool's `content` array is flattened to readable text. Anything else — or a
22+
result with an unexpected shape — still falls back to a safe `cursor_*` block
23+
with the raw payload.
24+
725
## [0.1.0] — 2026-06-10
826

927
> Pre-releases: `0.1.0-rc.1` and `0.1.0-rc.2` were published to the npm `next`

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,20 @@ that activity appears in opencode:
336336
and outputs. opencode skips execution for provider-executed calls (they're display-only), so
337337
Cursor's tools (`shell`, `mcp`, …) don't trigger an "unavailable tool" error. Requires a
338338
V3-native opencode host (1.16+).
339+
340+
Where a Cursor tool has a natural opencode counterpart, it's surfaced under opencode's
341+
**registered** tool name so its native renderer is used instead of a generic block: `edit`
342+
opencode's diff viewer (via `metadata.diff`), `shell``bash` console, `task` → the subagent
343+
card, web search (which Cursor runs as an MCP tool) → the `websearch` renderer, and
344+
`read`/`write`/`glob`/`grep`/`ls`/`updateTodos` → opencode's
345+
`read`/`write`/`glob`/`grep`/`list`/`todowrite` renderers. Cursor's arg shape is translated to
346+
opencode's (e.g. `path``filePath`); the call stays provider-executed, so it's display-only and
347+
never re-run on disk.
348+
349+
Tools with no opencode counterpart still get cleaned up: `readLints` and `delete` render as
350+
formatted `cursor_*` blocks (a diagnostics list / a one-line confirmation) rather than raw JSON,
351+
and any MCP tool's `content` is flattened to readable text. Anything else — or a result with an
352+
unexpected shape — falls back to a prefixed `cursor_*` block with the raw payload.
339353
- **`"reasoning"` (fallback)** — each tool call is shown as a compact reasoning line
340354
(`[tool] write {"path":…}`; failures as `[tool] x failed`). Robust on every host: no tool-call
341355
parts cross into opencode, so there's no dependency on how the host treats provider-executed

0 commit comments

Comments
 (0)