feat: add OpenCode support and fix hook basename detection#262
Open
itai-delphos wants to merge 2 commits intortk-ai:masterfrom
Open
feat: add OpenCode support and fix hook basename detection#262itai-delphos wants to merge 2 commits intortk-ai:masterfrom
itai-delphos wants to merge 2 commits intortk-ai:masterfrom
Conversation
**OpenCode Integration:** - Add platform abstraction layer (src/platform.rs) for Claude Code and OpenCode - New OpenCode plugin (hooks/rtk-rewrite.ts) with full command rewrite logic - OpenCode session provider for discover/learn commands (scans ~/.local/share/opencode/opencode.db) - Multi-platform support: discover/learn scan both platforms by default - Updated documentation (README, INSTALL, ARCHITECTURE, TROUBLESHOOTING) for dual-platform usage **Hook Fixes:** - Fix critical basename detection bug: pattern `*/rtk\ *` incorrectly matched `git -C /path/to/rtk status` - Changed to basename checking: only skip if first command word is literally 'rtk' - Add workaround for git -C/-c flags (not yet supported by RTK core) - Hooks now skip rewriting git commands with global options - Prevents "unexpected argument '-C' found" errors - Documented as known limitation in TROUBLESHOOTING.md **Testing:** - All 435 tests pass - Manual testing confirms hooks work in both platforms - Hook correctly rewrites: `git status` → `rtk git status` - Hook correctly skips: `git -C /path status` (no rewrite) - Hook correctly skips: `rtk git status` (already using rtk) **Files Changed:** - NEW: hooks/rtk-rewrite.ts (OpenCode plugin) - NEW: src/platform.rs (platform abstraction) - FIXED: hooks/rtk-rewrite.sh (basename detection + git -C skip) - UPDATED: src/discover/, src/init.rs, src/learn/ (multi-platform) - DOCS: README, INSTALL, ARCHITECTURE, TROUBLESHOOTING
…-fixes feat: add OpenCode support and fix hook basename detection
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.
Summary
hooks/rtk-rewrite.ts), platform abstraction layer (src/platform.rs), and OpenCode session provider fordiscover/learncommands.rtk-rewrite.shworks correctly across different shell environments.Changes
New Files
src/platform.rs— Platform abstraction layer for detecting and managing Claude Code vs OpenCode environmentshooks/rtk-rewrite.ts— OpenCode TypeScript plugin with full command rewrite logic (equivalent tortk-rewrite.shfor Claude Code)Modified Files
src/init.rs— Auto-detect platform (Claude Code or OpenCode), install appropriate hook/pluginsrc/discover/provider.rs— Add OpenCode session provider to scan OpenCode session historysrc/discover/mod.rs— Multi-platform support: discover scans both platforms by defaultsrc/learn/mod.rs— Multi-platform support: learn scans both platforms by defaultsrc/main.rs— Register platform module and new CLI optionshooks/rtk-rewrite.sh— Fix basename detection for broader shell compatibilityhooks/rtk-awareness.md— Updated for multi-platform contextDocumentation
README.md— Updated terminology from "Claude Code" to "AI agent" where applicable, added OpenCode referencesINSTALL.md— Updated installation instructions for both platformsARCHITECTURE.md— Updated hook architecture section for multi-platform supportdocs/TROUBLESHOOTING.md— Added OpenCode-specific troubleshooting guidanceStats