pub struct CliBackend {
pub command: String,
pub args: Vec<String>,
pub prompt_mode: PromptMode,
pub prompt_flag: Option<String>,
pub output_format: OutputFormat,
}Expand description
A CLI backend configuration for executing prompts.
Fields§
§command: StringThe command to execute.
args: Vec<String>Additional arguments before the prompt.
prompt_mode: PromptModeHow to pass the prompt.
prompt_flag: Option<String>Argument flag for prompt (if prompt_mode is Arg).
output_format: OutputFormatOutput format emitted by this backend.
Implementations§
Source§impl CliBackend
impl CliBackend
Sourcepub fn from_config(config: &CliConfig) -> Result<Self, CustomBackendError>
pub fn from_config(config: &CliConfig) -> Result<Self, CustomBackendError>
Creates a backend from configuration.
§Errors
Returns CustomBackendError if backend is “custom” but no command is specified.
Sourcepub fn claude() -> Self
pub fn claude() -> Self
Creates the Claude backend.
Uses -p flag for headless/print mode execution. This runs Claude
in non-interactive mode where it executes the prompt and exits.
For interactive mode, stdin is used instead (handled in build_command).
Emits --output-format stream-json for NDJSON streaming output.
Note: --verbose is required when using --output-format stream-json with -p.
Sourcepub fn claude_tui() -> Self
pub fn claude_tui() -> Self
Creates the Claude TUI backend for interactive mode.
Runs Claude in full interactive mode (no -p flag), allowing Claude’s native TUI to render. The prompt is passed as a positional argument.
Unlike the standard claude() backend:
- No
-pflag (enters interactive TUI mode) - No
--output-format stream-json(raw terminal output) - Prompt is a positional argument, not a flag value
Sourcepub fn kiro() -> Self
pub fn kiro() -> Self
Creates the Kiro backend.
Uses kiro-cli in headless mode with all tools trusted.
Sourcepub fn kiro_with_agent(agent: String) -> Self
pub fn kiro_with_agent(agent: String) -> Self
Creates the Kiro backend with a specific agent.
Uses kiro-cli with –agent flag to select a specific agent.
Sourcepub fn from_name(name: &str) -> Result<Self, CustomBackendError>
pub fn from_name(name: &str) -> Result<Self, CustomBackendError>
Creates a backend from a named backend string.
§Errors
Returns error if the backend name is invalid.
Sourcepub fn from_hat_backend(
hat_backend: &HatBackend,
) -> Result<Self, CustomBackendError>
pub fn from_hat_backend( hat_backend: &HatBackend, ) -> Result<Self, CustomBackendError>
Creates a backend from a HatBackend configuration.
§Errors
Returns error if the backend configuration is invalid.
Sourcepub fn custom(config: &CliConfig) -> Result<Self, CustomBackendError>
pub fn custom(config: &CliConfig) -> Result<Self, CustomBackendError>
Creates a custom backend from configuration.
§Errors
Returns CustomBackendError if no command is specified.
Sourcepub fn build_command(
&self,
prompt: &str,
interactive: bool,
) -> (String, Vec<String>, Option<String>, Option<NamedTempFile>)
pub fn build_command( &self, prompt: &str, interactive: bool, ) -> (String, Vec<String>, Option<String>, Option<NamedTempFile>)
Builds the full command with arguments for execution.
§Arguments
prompt- The prompt text to pass to the agentinteractive- Whether to run in interactive mode (affects agent flags)
Trait Implementations§
Source§impl Clone for CliBackend
impl Clone for CliBackend
Source§fn clone(&self) -> CliBackend
fn clone(&self) -> CliBackend
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for CliBackend
impl RefUnwindSafe for CliBackend
impl Send for CliBackend
impl Sync for CliBackend
impl Unpin for CliBackend
impl UnwindSafe for CliBackend
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.