Skip to main content

ralph_workflow/app/
context.rs

1//! Pipeline context types.
2//!
3//! This module defines the context structures used throughout the pipeline execution.
4
5use crate::agents::AgentRegistry;
6use crate::cli::Args;
7use crate::config::Config;
8use crate::logger::Colors;
9use crate::logger::Logger;
10use crate::prompts::template_context::TemplateContext;
11use crate::workspace::Workspace;
12
13/// Context for running the pipeline.
14///
15/// Groups together the various parameters needed to run the development/review/commit
16/// pipeline, reducing function parameter count and improving maintainability.
17pub struct PipelineContext {
18    pub args: Args,
19    pub config: Config,
20    pub registry: AgentRegistry,
21    pub developer_agent: String,
22    pub reviewer_agent: String,
23    pub developer_display: String,
24    pub reviewer_display: String,
25    pub repo_root: std::path::PathBuf,
26    /// Workspace for explicit path resolution (no CWD dependency).
27    ///
28    /// Uses `Arc<dyn Workspace>` for proper dependency injection:
29    /// - Production code passes `Arc::new(WorkspaceFs::new(...))`
30    /// - Tests can pass `Arc::new(MemoryWorkspace::new(...))`
31    pub workspace: std::sync::Arc<dyn Workspace>,
32    pub logger: Logger,
33    pub colors: Colors,
34    pub template_context: TemplateContext,
35    pub executor: std::sync::Arc<dyn crate::executor::ProcessExecutor>,
36}