Documentation
¶
Overview ¶
Package claudecli runs reviews by shelling out to the Claude Code CLI in headless mode (claude -p, stream-json output, structured output schema). It is the only package that knows the claude binary exists.
Index ¶
- Variables
- type Backend
- func (b *Backend) Chat(ctx context.Context, req review.ChatRequest, onEvent func(review.Event)) (*review.ChatReply, error)
- func (b *Backend) CheckAvailable(ctx context.Context) error
- func (b *Backend) Name() string
- func (b *Backend) Review(ctx context.Context, req review.Request, onEvent func(review.Event)) (*review.Result, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var MinVersion = [2]int{2, 0}
MinVersion is the oldest claude CLI this backend is tested against.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct {
// ClaudePath is the binary to run ("claude" resolved on PATH by default).
ClaudePath string
Provider string // anthropic | bedrock
Model string
Bare bool
// UseAgents grants the Task tool so the reviewer can delegate to
// Claude Code subagents; write/exec tools stay denied throughout.
UseAgents bool
// MCPServers are passed to claude as an inline --mcp-config and
// allow-listed by name; --strict-mcp-config stays on so nothing
// beyond this explicit grant is ever loaded.
MCPServers map[string]config.MCPServer
// AllowedDomains/AllowedCommands are the global (config-level) fallback
// grants; a request's own fields (set per run from the GUI picker) win
// when non-empty, mirroring how Model falls back to b.Model.
AllowedDomains []string
AllowedCommands []string
Bedrock config.Bedrock
ExtraEnv map[string]string
// DumpDir receives raw stream transcripts for debugging; empty disables.
DumpDir string
// LookupEnv defaults to os.LookupEnv; injectable for tests.
LookupEnv func(string) (string, bool)
}
Backend implements review.Reviewer via the claude CLI.
func (*Backend) Chat ¶ added in v1.21.0
func (b *Backend) Chat(ctx context.Context, req review.ChatRequest, onEvent func(review.Event)) (*review.ChatReply, error)
Chat runs one conversation turn in req.RepoPath. The first turn sends the full MR context; later turns resume the CLI session (which lives with the checkout directory, so RepoPath must not change mid-conversation).
func (*Backend) CheckAvailable ¶
CheckAvailable verifies the claude binary exists and is new enough.
Click to show internal directories.
Click to hide internal directories.