vibe-action 0.0.4

Command router — execute shell commands and LLM prompts via simple YAML actions.
//! ActionsModel validation.
//! Validates all flows, checks for duplicate names and tags.

use std::collections::HashSet;

use anyhow::Result;

use crate::{models::actions::FlowsModel, validate::ValidateTrait};

impl ValidateTrait for FlowsModel {
    /// Validate all flows: each flow internally, plus duplicate names across flows.
    fn validate(&self) -> Result<()> {
        for flow in &self.flows {
            flow.validate()?;
        }
        // Check for duplicate names.
        let mut names: HashSet<&str> = HashSet::new();
        for flow in &self.flows {
            if !names.insert(flow.name.as_str()) {
                anyhow::bail!("Duplicate action name '{}' across flows", flow.name);
            }
        }
        Ok(())
    }
}