tsafe-bitwarden 0.1.0

Bitwarden cloud-pull integration for tsafe — secret import via the bw CLI.
Documentation
use thiserror::Error;

/// Errors that can occur during a Bitwarden pull operation.
#[derive(Debug, Error)]
pub enum BitwError {
    /// The `bw` CLI binary was not found on `PATH`.
    #[error(
        "Bitwarden CLI `bw` not found on PATH — install it from https://bitwarden.com/help/cli/"
    )]
    CliNotFound,

    /// `bw login` exited with a non-zero status.
    #[error("bw login failed (exit {status}): {stderr}")]
    LoginFailed { status: i32, stderr: String },

    /// `bw unlock` exited with a non-zero status.
    #[error("bw unlock failed (exit {status}): {stderr}")]
    UnlockFailed { status: i32, stderr: String },

    /// `bw lock` (cleanup) exited with a non-zero status — non-fatal, logged only.
    #[error("bw lock failed (exit {status}): {stderr}")]
    LockFailed { status: i32, stderr: String },

    /// `bw list items` exited with a non-zero status.
    #[error("bw list items failed (exit {status}): {stderr}")]
    ListFailed { status: i32, stderr: String },

    /// The session token output from `bw unlock` could not be extracted.
    #[error("could not extract BW_SESSION token from `bw unlock` output")]
    SessionTokenMissing,

    /// The JSON output from `bw list items` could not be parsed.
    #[error("failed to parse `bw list items` JSON: {0}")]
    ParseError(String),

    /// A required configuration value (client_id, client_secret, password env) is missing.
    #[error("Bitwarden configuration error: {0}")]
    Config(String),
}