tcrm_monitor/monitor/mod.rs
1//! Task monitoring and execution module.
2//!
3//! This module provides the core functionality for managing and executing tasks with dependency relationships.
4//! It includes configuration types, error handling, event monitoring, and execution strategies.
5//!
6//! ## Core Components
7//!
8//! - [`tasks::TaskMonitor`]: Main struct for managing task execution
9//! - [`config::TaskSpec`]: Task configuration with dependencies and execution options
10//! - [`config::TaskShell`]: Cross-platform shell configuration
11//! - [`event::TaskMonitorEvent`]: Event types for monitoring task execution
12//! - [`error::TaskMonitorError`]: Error types for task monitoring operations
13//! - [`executor`]: Task execution strategies (currently direct execution)
14//!
15//! ## Usage
16//!
17//! The typical workflow involves:
18//!
19//! 1. Create task specifications with dependencies
20//! 2. Build a `TaskMonitor` with the task collection
21//! 3. Execute tasks either directly or with event monitoring
22//!
23//! ```rust
24//! use std::collections::HashMap;
25//! use tcrm_monitor::monitor::{tasks::TaskMonitor, config::{TaskSpec, TaskShell}};
26//! use tcrm_task::tasks::config::TaskConfig;
27//!
28//! # #[tokio::main]
29//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
30//! let mut tasks = HashMap::new();
31//!
32//! tasks.insert(
33//! "compile".to_string(),
34//! TaskSpec::new(TaskConfig::new("cargo").args(["build"]))
35//! .shell(TaskShell::Auto)
36//! );
37//!
38//! let mut monitor = TaskMonitor::new(tasks)?;
39//! monitor.execute_all_direct(None).await;
40//! # Ok(())
41//! # }
42//! ```
43
44pub mod config;
45pub mod depend;
46pub mod error;
47pub mod event;
48pub mod executor;
49pub mod tasks;
50
51// Re-export key types for easier access
52pub use tasks::TaskMonitor;