rpi-cli 0.3.2

Terminal coding-agent CLI (the `rpi` binary) built on the rpi-* library crates — a Rust port of @earendil-works/pi-coding-agent's CLI surface
Documentation
//! Experimental feature gate.
//!
//! Port of native Pi's `packages/coding-agent/src/core/experimental.ts`.
//! Experimental surfaces (e.g. the extended footer) are only enabled when
//! `PI_EXPERIMENTAL=1` is set.

/// True when `PI_EXPERIMENTAL=1`. Evaluated once per process.
pub fn enabled() -> bool {
    static ENABLED: std::sync::OnceLock<bool> = std::sync::OnceLock::new();
    *ENABLED.get_or_init(|| {
        std::env::var("PI_EXPERIMENTAL")
            .map(|v| v == "1")
            .unwrap_or(false)
    })
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn gate_matches_env() {
        let expected = std::env::var("PI_EXPERIMENTAL")
            .map(|v| v == "1")
            .unwrap_or(false);
        assert_eq!(enabled(), expected);
    }
}