Skip to main content

osp_cli/dsl/
rollout.rs

1use anyhow::Result;
2
3use crate::core::output_model::OutputResult;
4
5use super::engine;
6
7/// Execution mode for the document-first DSL.
8///
9/// The legacy/compare rollout has been retired. We keep the enum so existing
10/// callers and tests have a stable type to reference, but there is now a
11/// single production mode.
12#[derive(Debug, Clone, Copy, PartialEq, Eq)]
13pub enum Dsl2Mode {
14    /// Use the canonical document-first DSL engine.
15    Enabled,
16}
17
18impl Dsl2Mode {
19    #[cfg(test)]
20    pub(super) fn parse(raw: &str) -> Option<Self> {
21        match raw.trim().to_ascii_lowercase().as_str() {
22            "" | "0" | "off" | "false" | "legacy" | "1" | "on" | "true" | "enabled" | "dsl2"
23            | "ab" | "compare" | "shadow" => Some(Self::Enabled),
24            _ => None,
25        }
26    }
27}
28
29/// Returns the configured DSL mode.
30///
31/// The unified DSL is the only engine now, so this is intentionally
32/// unconditional.
33pub fn configured_mode() -> Dsl2Mode {
34    Dsl2Mode::Enabled
35}
36
37/// Applies a pipeline using the canonical DSL engine.
38pub fn apply_output_pipeline_with_mode(
39    output: OutputResult,
40    stages: &[String],
41) -> Result<OutputResult> {
42    engine::apply_output_pipeline(output, stages)
43}