//! Handler for the `status` command and pipeline status helpers.

mod labels;
mod render;

#[cfg(test)]
mod tests;

pub(super) use labels::{story_short_label, traffic_light_dot};
pub(super) use render::{build_pipeline_status, unmet_deps_from_items};

#[cfg(test)]
pub(super) use render::{build_status_from_items, display_section, first_non_empty_snippet};

use super::CommandContext;

/// Dispatch the `status` bot command.
///
/// With no arguments, renders the full pipeline status. With arguments,
/// delegates to the triage handler for per-story details.
pub(super) fn handle_status(ctx: &CommandContext) -> Option<String> {
    if ctx.args.trim().is_empty() {
        Some(build_pipeline_status(
            ctx.effective_root(),
            &ctx.services.agents,
        ))
    } else {
        super::triage::handle_triage(ctx)
    }
}
