use std::collections::HashSet;
use std::sync::LazyLock;
static CONFIRM_SET: LazyLock<HashSet<String>> = LazyLock::new(|| {
skilllite_core::config::load_dotenv();
let raw =
std::env::var(skilllite_core::config::env_keys::high_risk::SKILLLITE_HIGH_RISK_CONFIRM)
.unwrap_or_else(|_| "write_key_path,run_command,network".to_string());
let raw = raw.trim().to_lowercase();
if raw == "none" {
return HashSet::new();
}
if raw == "all" || raw.is_empty() {
return HashSet::from([
"write_key_path".to_string(),
"run_command".to_string(),
"network".to_string(),
]);
}
raw.split(',')
.map(|s| s.trim().to_string())
.filter(|s| !s.is_empty())
.collect()
});
pub fn confirm_write_key_path() -> bool {
CONFIRM_SET.contains("write_key_path")
}
pub fn confirm_run_command() -> bool {
CONFIRM_SET.contains("run_command")
}
pub fn confirm_network() -> bool {
CONFIRM_SET.contains("network")
}