Skip to content

feat: map more Cursor tools onto opencode native renderers#14

Merged
justin-carper merged 1 commit into
mainfrom
cursor-tools-opencode-dif
Jun 11, 2026
Merged

feat: map more Cursor tools onto opencode native renderers#14
justin-carper merged 1 commit into
mainfrom
cursor-tools-opencode-dif

Conversation

@justin-carper

Copy link
Copy Markdown
Collaborator

What

Extends the edit → diff-viewer pattern (#12) into a table-driven adapter so more of Cursor's internal tool activity renders with opencode's native tool UI in blocks mode, instead of generic cursor_* JSON blocks.

Native mappings

Emitted under opencode's registered tool name, but kept providerExecuted + dynamic — display-only, never re-run on disk, and degrade to a generic block on hosts that don't register the tool.

Cursor tool opencode renderer
shell bash console
read read
write write (renders new content)
glob glob
grep grep
ls list
updateTodos todowrite checklist
task subagent card
web search (Cursor runs it as MCP) websearch

Arg shapes are translated to opencode's (pathfilePath, globPatternpattern, fileTextcontent, inProgressin_progress, …).

Cleaner fallbacks (no opencode counterpart)

  • readLints → formatted cursor_readLints diagnostics list (was raw JSON)
  • delete → one-line cursor_delete confirmation
  • any MCP tool's content[] flattened to readable text (fixes web-search/MCP blocks rendering blank)

Anything else — or a result with an unexpected shape — still falls back to a safe cursor_* block with the raw payload.

Test plan

  • npm run typecheck — clean
  • npm test146 passed (17 files); adds a native tool mapping (blocks) suite covering every mapping, the MCP/websearch path, format-only fallbacks, error results, and dangling calls
  • npm run build — success
  • Verified live in opencode 1.16+ against a local file:// provider build (native read/list/bash/diff/websearch blocks render)

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.
@justin-carper justin-carper merged commit 35b7101 into main Jun 11, 2026
6 checks passed
@justin-carper justin-carper deleted the cursor-tools-opencode-dif branch June 11, 2026 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant