clawdb-cli 0.1.0

Command-line interface for the ClawDB cognitive database.
use thiserror::Error;

pub type CliResult<T> = Result<T, CliError>;

#[derive(Debug, Error)]
pub enum CliError {
    #[error("Unauthorized — {0}")]
    Unauthorized(String),

    #[error("Permission denied — {0}")]
    PermissionDenied(String),

    #[error("Not found: {0}")]
    NotFound(String),

    #[error("Rate limited (retry after {retry_after_secs}s)")]
    RateLimited { retry_after_secs: u64 },

    #[error("Service unavailable")]
    ServiceUnavailable,

    #[error("API error {status}: {message}")]
    Api { status: u16, message: String },

    #[error("Connection error: {0}")]
    Connection(String),

    #[error("Config error: {0}")]
    Config(String),

    #[error(transparent)]
    Io(#[from] std::io::Error),

    #[error(transparent)]
    Json(#[from] serde_json::Error),

    #[error("TOML parse error: {0}")]
    TomlDe(#[from] toml::de::Error),

    #[error("TOML serialize error: {0}")]
    TomlSer(#[from] toml::ser::Error),

    #[error("{0}")]
    Other(String),
}