Skip to main content

ralph_workflow/cli/handlers/
mod.rs

1//! CLI command handlers.
2//!
3//! Contains handler functions for CLI commands like --list-agents,
4//! --diagnose, and --dry-run.
5//!
6//! # Module Structure
7//!
8//! - [`baseline`]: Baseline state display commands
9//! - [`boundary`]: I/O boundary module for console output handlers
10//! - [`dry_run`]: Validation without running agents
11//! - [`list`]: Agent listing commands
12//! - [`template_mgmt`]: Template management commands (validate, list, show, variables, render)
13//! - [`template_selection`]: Interactive template selection when PROMPT.md is missing
14
15pub mod baseline;
16#[path = "boundary.rs"]
17pub mod boundary;
18pub mod dry_run;
19pub mod list;
20pub mod template_mgmt;
21
22// Re-export handlers at module level for convenience
23pub use baseline::handle_show_baseline;
24pub use dry_run::handle_dry_run;
25pub use list::{handle_list_agents, handle_list_available_agents};
26pub use template_mgmt::handle_template_commands;
27
28pub fn handle_diagnose<W: std::io::Write>(
29    writer: W,
30    colors: crate::logger::Colors,
31    config: &crate::config::Config,
32    registry: &crate::agents::AgentRegistry,
33    config_info: boundary::ConfigInfo<'_>,
34    executor: &dyn crate::executor::ProcessExecutor,
35    workspace: &dyn crate::workspace::Workspace,
36) {
37    boundary::handle_diagnose(
38        writer,
39        colors,
40        config,
41        registry,
42        config_info,
43        executor,
44        workspace,
45    );
46}
47
48pub fn create_prompt_from_template(
49    template_name: &str,
50    colors: crate::logger::Colors,
51) -> anyhow::Result<()> {
52    boundary::create_prompt_from_template(template_name, colors)
53}
54
55#[must_use]
56pub fn prompt_template_selection(colors: crate::logger::Colors) -> Option<String> {
57    boundary::prompt_template_selection(colors)
58}