systemprompt-models 0.5.0

Foundation data models for systemprompt.io AI governance infrastructure. Shared DTOs, config, and domain types consumed by every layer of the MCP governance pipeline.
Documentation
use std::path::PathBuf;
use thiserror::Error;

use super::GatewayProfileError;

pub type ProfileResult<T> = Result<T, ProfileError>;

#[derive(Debug, Error)]
pub enum ProfileError {
    #[error("Failed to read profile {path}: {source}")]
    ReadFile {
        path: PathBuf,
        #[source]
        source: std::io::Error,
    },

    #[error("Failed to parse profile {path}: {source}")]
    ParseYaml {
        path: PathBuf,
        #[source]
        source: serde_yaml::Error,
    },

    #[error("Failed to serialize profile: {0}")]
    SerializeYaml(#[source] serde_yaml::Error),

    #[error("Invalid profile path: {path}")]
    InvalidProfilePath { path: PathBuf },

    #[error(transparent)]
    Gateway(#[from] GatewayProfileError),

    #[error("Profile '{name}' validation failed:\n  - {}", errors.join("\n  - "))]
    Validation { name: String, errors: Vec<String> },

    #[error("Missing required environment variable: {name}")]
    MissingEnvVar { name: &'static str },

    #[error("Invalid environment variable {name}: {message}")]
    InvalidEnvVar { name: &'static str, message: String },
}