Documentation
¶
Index ¶
- func AllowUnsafeAgents() bool
- func AnthropicAPIKey() string
- func Available() []string
- func CanonicalName(name string) 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) CommandLine() string
- 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) CommandLine() string
- 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) CommandLine() string
- 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 CursorAgent
- func (a *CursorAgent) CommandLine() string
- func (a *CursorAgent) CommandName() string
- func (a *CursorAgent) Name() string
- func (a *CursorAgent) Review(ctx context.Context, repoPath, commitSHA, prompt string, output io.Writer) (string, error)
- func (a *CursorAgent) WithAgentic(agentic bool) Agent
- func (a *CursorAgent) WithModel(model string) Agent
- func (a *CursorAgent) WithReasoning(level ReasoningLevel) Agent
- type DroidAgent
- func (a *DroidAgent) CommandLine() string
- 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 FailingWriter
- type GeminiAgent
- func (a *GeminiAgent) CommandLine() string
- 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 MockCLIOpts
- type MockCLIResult
- type OpenCodeAgent
- func (a *OpenCodeAgent) CommandLine() string
- 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 ScriptBuilder
- type TestAgent
- func (a *TestAgent) CommandLine() string
- 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 CanonicalName ¶ added in v0.34.0
CanonicalName resolves an agent alias to its canonical name. Returns the name unchanged if it is not an alias.
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.
// If model is empty, the agent is returned unchanged (preserving any built-in default).
// 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
// CommandLine returns a representative command line for this agent (binary + flags).
// Runtime-specific arguments (repo path, output file, prompt) are excluded.
// Useful for debugging which binary, model, and flags were used.
CommandLine() string
}
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) CommandLine ¶ added in v0.28.0
func (a *ClaudeAgent) CommandLine() string
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) CommandLine ¶ added in v0.28.0
func (a *CodexAgent) CommandLine() string
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) CommandLine ¶ added in v0.28.0
func (a *CopilotAgent) CommandLine() string
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 CursorAgent ¶ added in v0.21.0
type CursorAgent struct {
Command string // The agent command to run (default: "agent")
Model string // Model to use
Reasoning ReasoningLevel // Reasoning level
Agentic bool // Whether agentic mode is enabled
}
CursorAgent runs code reviews using the Cursor agent CLI
func NewCursorAgent ¶ added in v0.21.0
func NewCursorAgent(command string) *CursorAgent
NewCursorAgent creates a new Cursor agent
func (*CursorAgent) CommandLine ¶ added in v0.28.0
func (a *CursorAgent) CommandLine() string
func (*CursorAgent) CommandName ¶ added in v0.21.0
func (a *CursorAgent) CommandName() string
func (*CursorAgent) Name ¶ added in v0.21.0
func (a *CursorAgent) Name() string
func (*CursorAgent) WithAgentic ¶ added in v0.21.0
func (a *CursorAgent) WithAgentic(agentic bool) Agent
func (*CursorAgent) WithModel ¶ added in v0.21.0
func (a *CursorAgent) WithModel(model string) Agent
func (*CursorAgent) WithReasoning ¶ added in v0.21.0
func (a *CursorAgent) WithReasoning(level ReasoningLevel) Agent
WithReasoning returns a copy with the reasoning level stored. The agent CLI has no reasoning flag; callers can map reasoning to model selection instead.
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) CommandLine ¶ added in v0.28.0
func (a *DroidAgent) CommandLine() string
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 FailingWriter ¶ added in v0.26.1
type FailingWriter struct {
Err error
}
FailingWriter always returns an error on Write.
type GeminiAgent ¶
type GeminiAgent struct {
Command string // The gemini command to run (default: "gemini")
Model string // Model to use (e.g., "gemini-3-pro-preview")
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) CommandLine ¶ added in v0.28.0
func (a *GeminiAgent) CommandLine() string
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 MockCLIOpts ¶ added in v0.21.0
type MockCLIOpts struct {
HelpOutput string // Output when --help is passed; empty means no --help handling
ExitCode int // Exit code for normal (non-help) invocations
CaptureArgs bool // Write "$@" to a capture file
CaptureStdin bool // Write stdin to a capture file
StdoutLines []string
StderrLines []string
}
MockCLIOpts controls the behavior of a mock agent CLI script.
type MockCLIResult ¶ added in v0.21.0
type MockCLIResult struct {
CmdPath string
ArgsFile string // Non-empty when CaptureArgs was set
StdinFile string // Non-empty when CaptureStdin was set
}
MockCLIResult holds paths to the mock command and any capture files.
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) CommandLine ¶ added in v0.28.0
func (a *OpenCodeAgent) CommandLine() string
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 ScriptBuilder ¶ added in v0.21.0
type ScriptBuilder struct {
// contains filtered or unexported fields
}
ScriptBuilder helps construct shell scripts for mocking CLI output in tests.
func NewScriptBuilder ¶ added in v0.21.0
func NewScriptBuilder() *ScriptBuilder
NewScriptBuilder creates a new ScriptBuilder with the shebang line.
func (*ScriptBuilder) AddOutput ¶ added in v0.21.0
func (b *ScriptBuilder) AddOutput(s string) *ScriptBuilder
AddOutput adds a line that echoes the given string to stdout.
func (*ScriptBuilder) AddRaw ¶ added in v0.21.0
func (b *ScriptBuilder) AddRaw(line string) *ScriptBuilder
AddRaw adds a raw shell line to the script.
func (*ScriptBuilder) AddToolCall ¶ added in v0.21.0
func (b *ScriptBuilder) AddToolCall(name string, args map[string]any) *ScriptBuilder
AddToolCall adds a line that prints a tool-call JSON object to stdout.
func (*ScriptBuilder) Build ¶ added in v0.21.0
func (b *ScriptBuilder) Build() string
Build returns the complete shell script as a string.
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) CommandLine ¶ added in v0.28.0
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