Skip to content

fix: register oc_* aliases for local tool hooks#84

Open
14tinchov wants to merge 1 commit into
Nomadcxx:mainfrom
14tinchov:fix/oc-tool-aliases
Open

fix: register oc_* aliases for local tool hooks#84
14tinchov wants to merge 1 commit into
Nomadcxx:mainfrom
14tinchov:fix/oc-tool-aliases

Conversation

@14tinchov

Copy link
Copy Markdown

Fixes #83

Problem

System prompt instructs models to use oc_edit, but the tool hook only exposes edit.

Changes

  • Register oc_${t.id} alias for each local tool in buildToolHookEntries (same pattern as bashshell)
  • Add ocedit/strreplace/ocwrite/ocread/ocgrep aliases in TOOL_NAME_ALIASES

Test plan

  • bun test tests/unit/plugin-tools-hook.test.ts — 8 pass
  • Manual: OpenCode + cursor-acp/auto, ask for a small file edit, confirm oc_edit succeeds

How to verify locally

git checkout fix/oc-tool-aliases
bun install
bun test tests/unit/plugin-tools-hook.test.ts
bun run build
ln -sf "$(pwd)/dist/plugin-entry.js" ~/.config/opencode/plugin/cursor-acp.js
# restart OpenCode, then:
opencode run "edit a file with a one-word change" --model cursor-acp/auto

The system prompt instructs models to call oc_edit/oc_write, but
buildToolHookEntries only registered unprefixed names. Add oc_${id}
aliases (same pattern as bash→shell) and normalize ocedit/strreplace
in TOOL_NAME_ALIASES.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

oc_edit / oc_write not registered in tool hook despite system prompt instructing model to use them

1 participant