diff --git a/src/config/env.rs b/src/config/env.rs index 0ab221d1..6ad8e56c 100644 --- a/src/config/env.rs +++ b/src/config/env.rs @@ -5,10 +5,12 @@ mod catalog; pub mod dump; +pub mod joinir_dev; pub mod stage1; pub use catalog::{env_vars, AppliesTo, EnvVarMeta}; pub use dump::*; +pub use joinir_dev::*; pub use stage1::*; use std::collections::BTreeMap; diff --git a/src/config/env/joinir_dev.rs b/src/config/env/joinir_dev.rs new file mode 100644 index 00000000..e5164fd8 --- /dev/null +++ b/src/config/env/joinir_dev.rs @@ -0,0 +1,50 @@ +//! JoinIR development / experimental flags (SSOT). +//! Phase 72-C: Consolidate all NYASH_JOINIR_* dev flags through centralized helpers. + +use crate::config::env::env_bool; + +/// NYASH_JOINIR_LOWER_GENERIC=1 - Enable generic lowering path for JoinIR +/// (CRITICAL: 15 occurrences in codebase) +pub fn lower_generic_enabled() -> bool { + env_bool("NYASH_JOINIR_LOWER_GENERIC") +} + +/// NYASH_JOINIR_MAINLINE_DEBUG=1 - Debug output for mainline JoinIR lowering +pub fn mainline_debug_enabled() -> bool { + env_bool("NYASH_JOINIR_MAINLINE_DEBUG") +} + +/// NYASH_JOINIR_IF_MERGE=1 - Enable If-merge experimental mode +pub fn if_merge_enabled() -> bool { + env_bool("NYASH_JOINIR_IF_MERGE") +} + +/// NYASH_JOINIR_DEBUG=1 - General debug mode (deprecated, prefer mainline_debug) +pub fn debug_enabled() -> bool { + env_bool("NYASH_JOINIR_DEBUG") +} + +/// NYASH_JOINIR_VM_BRIDGE=1 - Enable VM bridge mode +pub fn vm_bridge_enabled() -> bool { + env_bool("NYASH_JOINIR_VM_BRIDGE") +} + +/// NYASH_JOINIR_STRICT=1 - Strict validation mode +pub fn strict_enabled() -> bool { + env_bool("NYASH_JOINIR_STRICT") +} + +/// NYASH_JOINIR_SNAPSHOT_GENERATE=1 - Generate snapshot for testing +pub fn snapshot_generate_enabled() -> bool { + env_bool("NYASH_JOINIR_SNAPSHOT_GENERATE") +} + +/// NYASH_JOINIR_SNAPSHOT_TEST=1 - Test using snapshot +pub fn snapshot_test_enabled() -> bool { + env_bool("NYASH_JOINIR_SNAPSHOT_TEST") +} + +/// NYASH_JOINIR_INPUT=* - Input source or mode +pub fn input_mode() -> Option { + std::env::var("NYASH_JOINIR_INPUT").ok() +}