Skip to main content

ralph_workflow/app/
runner.rs

1//! Application entrypoint and pipeline orchestration.
2//!
3//! This module is the CLI layer operating **before** the repository root is known.
4//! It uses [`AppEffect`][effect::AppEffect] for side effects, which is distinct from
5//! [`Effect`][crate::reducer::effect::Effect] used after repo root discovery.
6//!
7//! # Two Effect Layers
8//!
9//! Ralph has two distinct effect types (see also [`crate`] documentation):
10//!
11//! | Layer | When | Filesystem Access |
12//! |-------|------|-------------------|
13//! | `AppEffect` (this module) | Before repo root known | `std::fs` directly |
14//! | `Effect` ([`crate::reducer`]) | After repo root known | Via [`Workspace`][crate::workspace::Workspace] |
15//!
16//! These layers must never mix: `AppEffect` handlers cannot use `Workspace`.
17//!
18//! # Responsibilities
19//!
20//! - CLI/config parsing and plumbing commands
21//! - Agent registry loading
22//! - Repo root discovery
23//! - Resume support and checkpoint management
24//! - Transition to pipeline execution via `crate::phases`
25//!
26//! # Module Structure
27//!
28//! - [`config_init`]: Configuration loading and agent registry initialization
29//! - [`effect`]: `AppEffect` definitions for pre-repo-root operations
30//! - [`effect_handler`]: Production handler for `AppEffect` execution
31//! - [`plumbing`]: Low-level git operations (show/apply commit messages)
32//! - [`validation`]: Agent validation and chain validation
33//! - [`resume`]: Checkpoint resume functionality
34//! - [`detection`]: Project stack detection
35//! - [`finalization`]: Pipeline cleanup and finalization
36
37// Include sub-modules
38pub mod command_handlers;
39pub mod pipeline_execution;
40pub mod setup_helpers;
41#[cfg(test)]
42pub mod tests;
43
44// Re-exports from pipeline_execution
45pub use pipeline_execution::run;
46
47// Re-exports from pipeline_execution (helpers is included via include!)
48pub use pipeline_execution::CommandExitCleanupGuard;
49
50// Re-exports from pipeline_execution (initialization is included via include!)
51pub use pipeline_execution::PipelinePreparationParams;
52
53// Re-export test entry points when the helpers feature is enabled.
54#[cfg(feature = "test-utils")]
55pub use pipeline_execution::{
56    run_pipeline_with_effect_handler, run_with_config, run_with_config_and_handlers,
57    run_with_config_and_resolver, RunWithHandlersParams,
58};
59
60// Re-exports from setup_helpers
61pub use setup_helpers::{validate_and_setup_agents, AgentSetupParams};