Skip to content

feat(tool): add tool-compat utility and refactor tool implementations#1252

Merged
MiMoHardFather merged 3 commits into
mainfrom
feat/tool-compat-refactor
Jun 23, 2026
Merged

feat(tool): add tool-compat utility and refactor tool implementations#1252
MiMoHardFather merged 3 commits into
mainfrom
feat/tool-compat-refactor

Conversation

@MiMoHardFather

Copy link
Copy Markdown
Collaborator

Summary

  • Add tool-compat.ts utility for unified tool compatibility handling across all tool implementations
  • Refactor tool implementations (edit, multiedit, read, write, apply_patch, notebook-edit, lsp) to use new compatibility layer
  • Update session/llm and session/prompt for improved tool integration
  • Add comprehensive tests for tool-compat functionality
  • Update TUI session routes for better permission handling

Changes

  • New utility: packages/opencode/src/util/tool-compat.ts
  • Refactored tools: edit.ts, multiedit.ts, read.ts, write.ts, apply_patch.ts, notebook-edit.ts, lsp.ts
  • Updated prompt files: edit.txt, multiedit.txt, read.txt, write.txt, bash.txt, notebook-edit.txt, lsp.txt
  • Session integration: llm.ts, prompt.ts
  • TUI updates: session/index.tsx, session/permission.tsx
  • Tests: tool-compat.test.ts, plus updated tests for all refactored tools

Testing

  • All existing tests updated and passing
  • New comprehensive test suite for tool-compat utility

- Add tool-compat.ts utility for unified tool compatibility handling
- Refactor tool implementations (edit, multiedit, read, write, apply_patch, notebook-edit, lsp) to use new compatibility layer
- Update session/llm and session/prompt for improved tool integration
- Add comprehensive tests for tool-compat functionality
- Update TUI session routes for better permission handling
- Add beforeEach/afterEach hooks to redirect ZDOTDIR to an empty temp
  directory, preventing developer-machine ~/.zshenv noise from leaking
  into bash tool stdout during tests.
- Pass `git: true` to tmpdir() in permission tests so each worktree is
  self-contained and project detection doesn't walk up to the repo root.
@MiMoHardFather MiMoHardFather merged commit d7b028c into main Jun 23, 2026
2 of 3 checks passed
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