Documentation
¶
Index ¶
- func AllowUnsafeAgents() bool
- func AnthropicAPIKey() string
- func Available() []string
- func IsAvailable(name string) bool
- func Register(a Agent)
- func SetAllowUnsafeAgents(allow bool)
- func SetAnthropicAPIKey(key string)
- type Agent
- type ClaudeAgent
- func (a *ClaudeAgent) CommandName() string
- func (a *ClaudeAgent) Name() string
- func (a *ClaudeAgent) Review(ctx context.Context, repoPath, commitSHA, prompt string, output io.Writer) (string, error)
- func (a *ClaudeAgent) WithAgentic(agentic bool) Agent
- func (a *ClaudeAgent) WithModel(model string) Agent
- func (a *ClaudeAgent) WithReasoning(level ReasoningLevel) Agent
- type CodexAgent
- func (a *CodexAgent) CommandName() string
- func (a *CodexAgent) Name() string
- func (a *CodexAgent) Review(ctx context.Context, repoPath, commitSHA, prompt string, output io.Writer) (string, error)
- func (a *CodexAgent) WithAgentic(agentic bool) Agent
- func (a *CodexAgent) WithModel(model string) Agent
- func (a *CodexAgent) WithReasoning(level ReasoningLevel) Agent
- type CommandAgent
- type CopilotAgent
- func (a *CopilotAgent) CommandName() string
- func (a *CopilotAgent) Name() string
- func (a *CopilotAgent) Review(ctx context.Context, repoPath, commitSHA, prompt string, output io.Writer) (string, error)
- func (a *CopilotAgent) WithAgentic(agentic bool) Agent
- func (a *CopilotAgent) WithModel(model string) Agent
- func (a *CopilotAgent) WithReasoning(level ReasoningLevel) Agent
- type DroidAgent
- func (a *DroidAgent) CommandName() string
- func (a *DroidAgent) Name() string
- func (a *DroidAgent) Review(ctx context.Context, repoPath, commitSHA, prompt string, output io.Writer) (string, error)
- func (a *DroidAgent) WithAgentic(agentic bool) Agent
- func (a *DroidAgent) WithModel(model string) Agent
- func (a *DroidAgent) WithReasoning(level ReasoningLevel) Agent
- type GeminiAgent
- func (a *GeminiAgent) CommandName() string
- func (a *GeminiAgent) Name() string
- func (a *GeminiAgent) Review(ctx context.Context, repoPath, commitSHA, prompt string, output io.Writer) (string, error)
- func (a *GeminiAgent) WithAgentic(agentic bool) Agent
- func (a *GeminiAgent) WithModel(model string) Agent
- func (a *GeminiAgent) WithReasoning(level ReasoningLevel) Agent
- type OpenCodeAgent
- func (a *OpenCodeAgent) CommandName() string
- func (a *OpenCodeAgent) Name() string
- func (a *OpenCodeAgent) Review(ctx context.Context, repoPath, commitSHA, prompt string, output io.Writer) (string, error)
- func (a *OpenCodeAgent) WithAgentic(agentic bool) Agent
- func (a *OpenCodeAgent) WithModel(model string) Agent
- func (a *OpenCodeAgent) WithReasoning(level ReasoningLevel) Agent
- type ReasoningLevel
- type TestAgent
- func (a *TestAgent) Name() string
- func (a *TestAgent) Review(ctx context.Context, repoPath, commitSHA, prompt string, output io.Writer) (string, error)
- func (a *TestAgent) WithAgentic(agentic bool) Agent
- func (a *TestAgent) WithModel(model string) Agent
- func (a *TestAgent) WithReasoning(level ReasoningLevel) Agent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllowUnsafeAgents ¶
func AllowUnsafeAgents() bool
func AnthropicAPIKey ¶
func AnthropicAPIKey() string
AnthropicAPIKey returns the configured Anthropic API key, or empty string if not set
func IsAvailable ¶
IsAvailable checks if an agent's command is installed on the system Supports aliases like "claude" for "claude-code"
func SetAllowUnsafeAgents ¶
func SetAllowUnsafeAgents(allow bool)
func SetAnthropicAPIKey ¶
func SetAnthropicAPIKey(key string)
SetAnthropicAPIKey sets the Anthropic API key for Claude Code
Types ¶
type Agent ¶
type Agent interface {
// Name returns the agent identifier (e.g., "codex", "claude-code")
Name() string
// Review runs a code review and returns the output.
// If output is non-nil, agent progress is streamed to it in real-time.
Review(ctx context.Context, repoPath, commitSHA, prompt string, output io.Writer) (result string, err error)
// WithReasoning returns a copy of the agent configured with the specified reasoning level.
// Agents that don't support reasoning levels may return themselves unchanged.
WithReasoning(level ReasoningLevel) Agent
// WithAgentic returns a copy of the agent configured for agentic mode.
// In agentic mode, agents can edit files and run commands.
// If false, agents operate in read-only review mode.
WithAgentic(agentic bool) Agent
// WithModel returns a copy of the agent configured to use the specified model.
// Agents that don't support model selection may return themselves unchanged.
// For opencode, the model format is "provider/model" (e.g., "anthropic/claude-sonnet-4-20250514").
WithModel(model string) Agent
}
Agent defines the interface for code review agents
func GetAvailable ¶
GetAvailable returns an available agent, trying the requested one first, then falling back to alternatives. Returns error only if no agents available. Supports aliases like "claude" for "claude-code"
type ClaudeAgent ¶
type ClaudeAgent struct {
Command string // The claude command to run (default: "claude")
Model string // Model to use (e.g., "opus", "sonnet", or full name)
Reasoning ReasoningLevel // Reasoning level (for future extended thinking support)
Agentic bool // Whether agentic mode is enabled (allow file edits)
}
ClaudeAgent runs code reviews using Claude Code CLI
func NewClaudeAgent ¶
func NewClaudeAgent(command string) *ClaudeAgent
NewClaudeAgent creates a new Claude Code agent
func (*ClaudeAgent) CommandName ¶
func (a *ClaudeAgent) CommandName() string
func (*ClaudeAgent) Name ¶
func (a *ClaudeAgent) Name() string
func (*ClaudeAgent) WithAgentic ¶
func (a *ClaudeAgent) WithAgentic(agentic bool) Agent
WithAgentic returns a copy of the agent configured for agentic mode.
func (*ClaudeAgent) WithModel ¶ added in v0.17.0
func (a *ClaudeAgent) WithModel(model string) Agent
WithModel returns a copy of the agent configured to use the specified model.
func (*ClaudeAgent) WithReasoning ¶
func (a *ClaudeAgent) WithReasoning(level ReasoningLevel) Agent
WithReasoning returns a copy of the agent with the model preserved (reasoning not yet supported).
type CodexAgent ¶
type CodexAgent struct {
Command string // The codex command to run (default: "codex")
Model string // Model to use (e.g., "o3", "o4-mini")
Reasoning ReasoningLevel // Reasoning level for the agent
Agentic bool // Whether agentic mode is enabled (allow file edits)
}
CodexAgent runs code reviews using the Codex CLI
func NewCodexAgent ¶
func NewCodexAgent(command string) *CodexAgent
NewCodexAgent creates a new Codex agent with standard reasoning
func (*CodexAgent) CommandName ¶
func (a *CodexAgent) CommandName() string
func (*CodexAgent) Name ¶
func (a *CodexAgent) Name() string
func (*CodexAgent) WithAgentic ¶
func (a *CodexAgent) WithAgentic(agentic bool) Agent
WithAgentic returns a copy of the agent configured for agentic mode.
func (*CodexAgent) WithModel ¶ added in v0.17.0
func (a *CodexAgent) WithModel(model string) Agent
WithModel returns a copy of the agent configured to use the specified model.
func (*CodexAgent) WithReasoning ¶
func (a *CodexAgent) WithReasoning(level ReasoningLevel) Agent
WithReasoning returns a copy of the agent with the specified reasoning level
type CommandAgent ¶
type CommandAgent interface {
Agent
// CommandName returns the executable command name
CommandName() string
}
CommandAgent is an agent that uses an external command
type CopilotAgent ¶
type CopilotAgent struct {
Command string // The copilot command to run (default: "copilot")
Model string // Model to use
Reasoning ReasoningLevel // Reasoning level (for future support)
Agentic bool // Whether agentic mode is enabled (note: Copilot requires manual approval for actions)
}
CopilotAgent runs code reviews using the GitHub Copilot CLI
func NewCopilotAgent ¶
func NewCopilotAgent(command string) *CopilotAgent
NewCopilotAgent creates a new Copilot agent
func (*CopilotAgent) CommandName ¶
func (a *CopilotAgent) CommandName() string
func (*CopilotAgent) Name ¶
func (a *CopilotAgent) Name() string
func (*CopilotAgent) WithAgentic ¶
func (a *CopilotAgent) WithAgentic(agentic bool) Agent
WithAgentic returns a copy of the agent configured for agentic mode. Note: Copilot CLI requires manual approval for all actions and does not support automated unsafe execution. The agentic flag is tracked but has no effect on Copilot's behavior.
func (*CopilotAgent) WithModel ¶ added in v0.17.0
func (a *CopilotAgent) WithModel(model string) Agent
WithModel returns a copy of the agent configured to use the specified model.
func (*CopilotAgent) WithReasoning ¶
func (a *CopilotAgent) WithReasoning(level ReasoningLevel) Agent
WithReasoning returns a copy of the agent with the model preserved (reasoning not yet supported).
type DroidAgent ¶ added in v0.15.0
type DroidAgent struct {
Command string // The droid command to run (default: "droid")
Reasoning ReasoningLevel // Reasoning level for the agent
Agentic bool // Whether agentic mode is enabled (allow file edits)
}
DroidAgent runs code reviews using Factory's Droid CLI
func NewDroidAgent ¶ added in v0.15.0
func NewDroidAgent(command string) *DroidAgent
NewDroidAgent creates a new Droid agent with standard reasoning
func (*DroidAgent) CommandName ¶ added in v0.15.0
func (a *DroidAgent) CommandName() string
func (*DroidAgent) Name ¶ added in v0.15.0
func (a *DroidAgent) Name() string
func (*DroidAgent) WithAgentic ¶ added in v0.15.0
func (a *DroidAgent) WithAgentic(agentic bool) Agent
WithAgentic returns a copy of the agent configured for agentic mode.
func (*DroidAgent) WithModel ¶ added in v0.17.0
func (a *DroidAgent) WithModel(model string) Agent
WithModel returns the agent unchanged (model selection not supported for droid).
func (*DroidAgent) WithReasoning ¶ added in v0.15.0
func (a *DroidAgent) WithReasoning(level ReasoningLevel) Agent
WithReasoning returns a copy of the agent with the specified reasoning level
type GeminiAgent ¶
type GeminiAgent struct {
Command string // The gemini command to run (default: "gemini")
Model string // Model to use (e.g., "gemini-2.5-pro")
Reasoning ReasoningLevel // Reasoning level (for future support)
Agentic bool // Whether agentic mode is enabled (allow file edits)
}
GeminiAgent runs code reviews using the Gemini CLI
func NewGeminiAgent ¶
func NewGeminiAgent(command string) *GeminiAgent
NewGeminiAgent creates a new Gemini agent
func (*GeminiAgent) CommandName ¶
func (a *GeminiAgent) CommandName() string
func (*GeminiAgent) Name ¶
func (a *GeminiAgent) Name() string
func (*GeminiAgent) WithAgentic ¶
func (a *GeminiAgent) WithAgentic(agentic bool) Agent
WithAgentic returns a copy of the agent configured for agentic mode.
func (*GeminiAgent) WithModel ¶ added in v0.17.0
func (a *GeminiAgent) WithModel(model string) Agent
WithModel returns a copy of the agent configured to use the specified model.
func (*GeminiAgent) WithReasoning ¶
func (a *GeminiAgent) WithReasoning(level ReasoningLevel) Agent
WithReasoning returns a copy of the agent with the model preserved (reasoning not yet supported).
type OpenCodeAgent ¶
type OpenCodeAgent struct {
Command string // The opencode command to run (default: "opencode")
Model string // Model to use (provider/model format, e.g., "anthropic/claude-sonnet-4-20250514")
Reasoning ReasoningLevel // Reasoning level (for future support)
Agentic bool // Whether agentic mode is enabled (OpenCode auto-approves in non-interactive mode)
}
OpenCodeAgent runs code reviews using the OpenCode CLI
func NewOpenCodeAgent ¶
func NewOpenCodeAgent(command string) *OpenCodeAgent
NewOpenCodeAgent creates a new OpenCode agent
func (*OpenCodeAgent) CommandName ¶
func (a *OpenCodeAgent) CommandName() string
func (*OpenCodeAgent) Name ¶
func (a *OpenCodeAgent) Name() string
func (*OpenCodeAgent) WithAgentic ¶
func (a *OpenCodeAgent) WithAgentic(agentic bool) Agent
WithAgentic returns a copy of the agent configured for agentic mode. Note: OpenCode's `run` command auto-approves all permissions in non-interactive mode, so agentic mode is effectively always enabled when running through roborev.
func (*OpenCodeAgent) WithModel ¶ added in v0.17.0
func (a *OpenCodeAgent) WithModel(model string) Agent
WithModel returns a copy of the agent configured to use the specified model.
func (*OpenCodeAgent) WithReasoning ¶
func (a *OpenCodeAgent) WithReasoning(level ReasoningLevel) Agent
WithReasoning returns a copy of the agent with the model preserved (reasoning not yet supported).
type ReasoningLevel ¶
type ReasoningLevel string
ReasoningLevel controls how much reasoning/thinking an agent uses
const ( // ReasoningThorough uses maximum reasoning for deep analysis (slower) ReasoningThorough ReasoningLevel = "thorough" // ReasoningStandard uses balanced reasoning (default) ReasoningStandard ReasoningLevel = "standard" // ReasoningFast uses minimal reasoning for quick responses ReasoningFast ReasoningLevel = "fast" )
func ParseReasoningLevel ¶
func ParseReasoningLevel(s string) ReasoningLevel
ParseReasoningLevel converts a string to ReasoningLevel, defaulting to standard
type TestAgent ¶
type TestAgent struct {
Delay time.Duration // Simulated processing delay
Output string // Fixed output to return
Fail bool // If true, returns an error
Reasoning ReasoningLevel // Reasoning level (for testing)
}
TestAgent is a mock agent for testing that returns predictable output
func (*TestAgent) WithAgentic ¶
WithAgentic returns the agent unchanged (agentic mode not applicable for test agent)
func (*TestAgent) WithModel ¶ added in v0.17.0
WithModel returns the agent unchanged (model selection not supported for test agent).
func (*TestAgent) WithReasoning ¶
func (a *TestAgent) WithReasoning(level ReasoningLevel) Agent
WithReasoning returns a copy of the agent with the specified reasoning level