use std::path::PathBuf;
use thiserror::Error;
pub type CliResult<T> = Result<T, CliError>;
#[derive(Debug, Error)]
pub enum CliError {
#[error("Configuration file not found: {path}")]
ConfigFileNotFound { path: PathBuf },
#[error("Invalid YAML syntax in configuration file")]
InvalidYaml {
path: PathBuf,
source: serde_yaml::Error,
},
#[error("Configuration validation failed: {message}")]
ValidationError { message: String },
#[error("Missing required field: {field}. {message}")]
MissingRequiredField { field: String, message: String },
#[error("Invalid value for field '{field}': {message}")]
InvalidFieldValue { field: String, message: String },
#[error("Missing API key for {provider}. Please set {env_var}")]
MissingApiKey { provider: String, env_var: String },
#[error("File already exists: {path}")]
FileAlreadyExists { path: PathBuf },
#[error("IO error: {message}")]
IoError {
message: String,
#[source]
source: std::io::Error,
},
#[error("Operation cancelled by user")]
Cancelled,
#[error("LLM execution error: {message}")]
LlmError { message: String },
#[error("LLM provider error: {message}")]
LlmProviderError { message: String },
#[error("Paladin execution error: {message}")]
ExecutionError { message: String },
#[error("Battalion execution error: {message}")]
BattalionError { message: String },
#[error("Tool execution error: {message}")]
ToolError { message: String },
#[error("MCP connection error: {message}")]
McpConnectionError { message: String },
#[error("Serialization error: {message}")]
SerializationError { message: String },
#[error("Invalid file path '{path}': {message}")]
InvalidFilePath { path: String, message: String },
#[error("Unsupported format '{format}'. Supported formats: {supported}")]
UnsupportedFormat { format: String, supported: String },
#[error("Failed to read file '{path}': {message}")]
FileReadError { path: String, message: String },
#[error("Vision processing error: {message}")]
VisionProcessingError { message: String },
#[error("Document processing error: {message}")]
DocumentProcessingError { message: String },
#[error("Garrison configuration error: {message}")]
GarrisonConfigError { message: String },
#[error("Arsenal configuration error: {message}")]
ArsenalConfigError { message: String },
#[error("Network error: {0}")]
NetworkError(String),
#[error("User input error: {0}")]
UserInputError(String),
#[error("JSON parsing error: {0}")]
JsonError(String),
#[error("{0}")]
Other(String),
}