difflore-cli 0.1.0

Your AI coding agent, taught by your team's PR reviews — a local-first, open-source MCP server that turns past review comments into rules your agent follows automatically.
Documentation
use std::path::PathBuf;
use thiserror::Error;

use difflore_core::CoreError;

#[derive(Error, Debug)]
pub enum CliError {
    #[error("{0}")]
    Core(#[from] CoreError),

    #[error("{0}")]
    Io(#[from] std::io::Error),

    #[error("{0}")]
    Json(#[from] serde_json::Error),

    #[error("{0}")]
    Sqlx(#[from] sqlx::Error),

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

    #[error("config at {path}: {message}")]
    Config { path: PathBuf, message: String },
}

impl CliError {
    pub fn msg<S: Into<String>>(s: S) -> Self {
        Self::Message(s.into())
    }
}

impl From<String> for CliError {
    fn from(s: String) -> Self {
        Self::Message(s)
    }
}

impl From<&str> for CliError {
    fn from(s: &str) -> Self {
        Self::Message(s.to_owned())
    }
}

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