Documentation
¶
Overview ¶
Package claudecli implements the Claude model adapter via `claude --print --output-format=text`. Prompts are piped via stdin per ADR 0007.
Package claudecli implements the Claude model adapter. Lands in M7.
Index ¶
- Constants
- type Adapter
- func (a *Adapter) Name() string
- func (a *Adapter) Preflight(_ context.Context) error
- func (a *Adapter) Review(ctx context.Context, input *review.ReviewInput) (*review.ModelReviewResult, error)
- func (a *Adapter) SetInputBudget(bytes int)
- func (a *Adapter) Synthesize(ctx context.Context, input *review.ReviewInput, ...) (*review.ModelReviewResult, error)
Constants ¶
const DefaultInputBudgetBytes = 1024 * 1024
DefaultInputBudgetBytes caps the prompt size sent to Claude. Originally calibrated by spike S9 at 256 KiB; raised to 1 MiB (diffsmith-uc1). See codexcli.DefaultInputBudgetBytes for the rationale — Claude shares the same envelope and the bump is intentionally uniform across all three adapters so users get consistent behavior regardless of which model they pick.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter implements the model.Model interface against the Claude CLI.
func New ¶
New constructs an Adapter. Passing nil uses provider.DefaultRunner; lookPath defaults to exec.LookPath. Tests override fields directly (the package is internal-only).
func (*Adapter) Name ¶
Name returns the model identifier surfaced to users via --model and attached to validated findings.
func (*Adapter) Preflight ¶
Preflight verifies the claude binary is on PATH. The model is never invoked when this fails; the user sees an actionable install hint instead of a stack trace from os/exec.
func (*Adapter) Review ¶
func (a *Adapter) Review(ctx context.Context, input *review.ReviewInput) (*review.ModelReviewResult, error)
Review invokes claude with --print --output-format=text. Stdin piping, JSON shape, and validation are prompt-engineered (see prompt-contract.md): the model is instructed to emit a {"findings":[...]} JSON object as its entire response, so text mode returns exactly that.
We deliberately do NOT use --output-format=json, which returns a JSON array of event records ({"type":"system",...}, {"type":"assistant",...}, {"type":"result","result":"<model text>",...}). That envelope would have to be unwrapped before parsing; text mode skips that step. Verified via spike M7a-followup (diffsmith-e2w).
func (*Adapter) SetInputBudget ¶ added in v0.1.7
SetInputBudget overrides the default prompt-size cap for this adapter. Values <= 0 are ignored so an unset flag can't silently disable enforcement.
func (*Adapter) Synthesize ¶
func (a *Adapter) Synthesize(ctx context.Context, input *review.ReviewInput, results []*review.ModelReviewResult) (*review.ModelReviewResult, error)
Synthesize runs claude against the synthesis prompt that combines the diff with N other reviewers' findings.