Skip to content

Add OpenCode agent support#5

Merged
wesm merged 6 commits intoroborev-dev:mainfrom
etothexipi:add-opencode-agent
Jan 8, 2026
Merged

Add OpenCode agent support#5
wesm merged 6 commits intoroborev-dev:mainfrom
etothexipi:add-opencode-agent

Conversation

@etothexipi
Copy link
Contributor

@etothexipi etothexipi commented Jan 7, 2026

Adds support for the OpenCode agent (https://opencode.ai), providing users with another powerful AI code review option. Enhances #2

Changes

  • Add opencode agent implementation using non-interactive CLI mode
  • Update fallback chain: codex → claude-code → gemini → copilot → opencode
  • Update tests, README, and CLI help text
  • Follows same pattern as gemini/copilot PR (Add gemini-cli, copilot CLI support #3)

Installation

npm install -g opencode-ai

Testing

  • go test ./... passes
  • go build ./... succeeds
  • Follows established contribution patterns

Notes

OpenCode is an open-source AI coding agent that supports multiple backends, including local LLMs.

Jonathan Sims and others added 4 commits January 6, 2026 19:33
- Add opencode agent using `opencode -c <repo> -p <prompt> -q` for non-interactive reviews
- Update fallback order to include opencode
- Update tests to verify all 6 agents are registered

Install with:
  curl -fsSL https://opencode.ai/install | bash

Or: npm install -g opencode-ai@latest

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add OpenCode to agent comparison table with install command
- Update fallback order documentation to include opencode
- Update config comment to list opencode as an option
- Update selection priority section with complete fallback chain

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@etothexipi etothexipi closed this Jan 7, 2026
Jonathan Sims added 2 commits January 6, 2026 20:57
- Update command arguments to use `opencode run` with the full prompt message.
- Set the working directory for the command to the repository path.
- Enhance error handling to include both stdout and stderr in failure messages.
@etothexipi etothexipi reopened this Jan 7, 2026
@etothexipi
Copy link
Contributor Author

Tested with configs:

  • .roborev.toml
agent = "opencode"    # codex, claude-code, gemini, copilot, or opencode
review_context_count = 5

# Project-specific review guidelines (multi-line string)
review_guidelines = """
We are not doing database migrations because there are no production databases yet.
Prefer composition over inheritance.
All public APIs must have documentation comments.
"""
  • config.toml
server_addr = "127.0.0.1:7373"
max_workers = 4
review_context_count = 3
default_agent = "opencode"
codex_cmd = "codex"
claude_code_cmd = "claude"

Test review output:

Review: 768150d (opencode)
                          


## Review: Commit 768150d

**No issues found.**

I reviewed this commit for bugs, security issues, testing gaps, regressions, and code quality
concerns.

### Summary

This commit refactors the OpenCode agent's review command to use the new `opencode run` headless
invocation instead of the previous flag-based approach. Key changes:

1. **Command structure**: Switched from `opencode -c <path> -p <prompt> -q` to `opencode run
--format default <prompt>`
2. **Working directory**: Now sets `cmd.Dir = repoPath` instead of passing `-c` flag
3. **Error handling**: Improved to include both stdout and stderr in error messages

The changes are well-documented with clear comments explaining the new approach and helpful
references. The error handling improvement is a good enhancement that will make debugging easier. No
security, testing, or regression concerns identified.

@wesm wesm merged commit 4fd5b10 into roborev-dev:main Jan 8, 2026
4 checks passed
@wesm
Copy link
Collaborator

wesm commented Jan 8, 2026

@etothexipi thanks!!

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.

2 participants