Skip to main content

ClaudeCliBackend

Struct ClaudeCliBackend 

Source
pub struct ClaudeCliBackend { /* private fields */ }
Expand description

AI backend that spawns claude -p in non-interactive mode.

Implementations§

Source§

impl ClaudeCliBackend

Source

pub fn new(config: &AiConfig) -> Self

Source

pub fn is_available() -> bool

Check if the claude CLI is available on PATH.

Source

pub fn check_auth() -> Result<(), CoreError>

Pre-flight auth check: sends a minimal prompt WITHOUT –json-schema (which returns immediately on auth failure) and checks is_error. This prevents the infinite StructuredOutput retry loop that occurs when –json-schema is used with an expired/missing auth token.

Source§

impl ClaudeCliBackend

Source

pub fn execute_agentic( &self, prompt: &str, cwd: Option<&str>, ) -> Result<BackendResponse, CoreError>

Execute an agentic prompt: unlimited turns, full tool access, raw markdown output.

Key differences from execute():

  • No --max-turns (unlimited turns for codebase exploration)
  • No --tools "" (model needs tool access)
  • No --json-schema (output is raw markdown)
  • Longer timeout: 600 seconds (10 minutes)
  • Result comes from result field (not structured_output)
  • Optional cwd to set the working directory for tool calls

Trait Implementations§

Source§

impl AnalysisBackend for ClaudeCliBackend

Source§

fn execute( &self, prompt: &str, json_schema: Option<&str>, ) -> Result<BackendResponse, CoreError>

Execute a prompt and return the response text and cost. When json_schema is provided, the backend passes it to --json-schema for constrained decoding (guaranteed valid JSON matching the schema).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.