bot-forge 1.0.2

Rust CLI for installing agent skills and developer tools from configurable forms.
Documentation
//! Error types returned by public bot-forge operations.

use std::error::Error;
use std::fmt::{self, Display};
use std::io;
use std::path::PathBuf;

#[derive(Debug)]
/// Failure categories exposed by configuration, planning, execution, and persistence APIs.
pub enum ForgeError {
    /// An I/O operation failed at the associated path.
    Io {
        /// Filesystem path associated with the failed operation.
        path: PathBuf,
        /// Underlying operating-system I/O error.
        source: io::Error,
    },
    /// Structured input or persisted state could not be parsed.
    Parse(String),
    /// Configuration or a validated state invariant was rejected.
    Config(String),
    /// An external command or managed process failed.
    Command(String),
    /// A network transfer or integrity verification failed.
    Network(String),
}

impl Display for ForgeError {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            ForgeError::Io { path, source } => write!(f, "{}: {}", path.display(), source),
            ForgeError::Parse(message) => write!(f, "parse error: {message}"),
            ForgeError::Config(message) => write!(f, "configuration error: {message}"),
            ForgeError::Command(message) => write!(f, "command error: {message}"),
            ForgeError::Network(message) => write!(f, "network or verification error: {message}"),
        }
    }
}

impl Error for ForgeError {
    fn source(&self) -> Option<&(dyn Error + 'static)> {
        match self {
            ForgeError::Io { source, .. } => Some(source),
            _ => None,
        }
    }
}