feat: map more Cursor tools onto opencode native renderers#14
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 inblocksmode, instead of genericcursor_*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.shellbashconsolereadreadwritewrite(renders new content)globglobgrepgreplslistupdateTodostodowritechecklisttaskwebsearchArg shapes are translated to opencode's (
path→filePath,globPattern→pattern,fileText→content,inProgress→in_progress, …).Cleaner fallbacks (no opencode counterpart)
readLints→ formattedcursor_readLintsdiagnostics list (was raw JSON)delete→ one-linecursor_deleteconfirmationcontent[]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— cleannpm test— 146 passed (17 files); adds anative tool mapping (blocks)suite covering every mapping, the MCP/websearch path, format-only fallbacks, error results, and dangling callsnpm run build— successfile://provider build (nativeread/list/bash/diff/websearch blocks render)