Expand description
Progress feedback infrastructure for debtmap analysis.
This module provides two complementary progress reporting systems:
-
Effects-based progress (new):
ProgressSinktrait withHasProgressenvironment extension for composable, testable progress reporting. -
Legacy progress (existing):
ProgressManagerusingindicatiffor direct progress bar management.
§Effects-Based Progress (Recommended)
The effects-based system follows the “Pure Core, Imperative Shell” principle:
ⓘ
use debtmap::effects::progress::{with_stage, traverse_with_progress};
use debtmap::progress::implementations::RecordingProgressSink;
// Pure analysis function wrapped with progress reporting
fn analyze_files(files: Vec<PathBuf>) -> AnalysisEffect<Vec<FileMetrics>> {
traverse_with_progress(files, "File Analysis", |path| {
analyze_file_effect(path)
})
}
// In tests, use RecordingProgressSink to verify behavior
let recorder = Arc::new(RecordingProgressSink::new());
let env = RealEnv::with_progress(config, recorder.clone());
let result = analyze_files(files).run(&env).await?;
assert!(recorder.stages().contains(&"File Analysis".to_string()));§Progress Sink Implementations
| Implementation | Use Case |
|---|---|
SilentProgressSink | Testing, CI, benchmarks |
CliProgressSink | Command-line tools |
RecordingProgressSink | Test assertions |
§Legacy Progress System
The ProgressManager provides direct control over indicatif progress bars.
This is still used for TUI integration and will be gradually migrated to
the effects-based system.
use debtmap::progress::{ProgressConfig, ProgressManager, TEMPLATE_CALL_GRAPH};
let config = ProgressConfig::from_env(false, 0);
let manager = ProgressManager::new(config);
let progress = manager.create_bar(100, TEMPLATE_CALL_GRAPH);
progress.set_message("Building call graph");
for _i in 0..100 {
progress.inc(1);
}
progress.finish_with_message("Call graph complete");§Progress Behavior
- Quiet Mode: No progress output (respects
DEBTMAP_QUIETenv var and--quietflag) - Non-TTY: Gracefully disables progress bars in CI and piped output
- Verbosity Levels:
- Level 0 (default): Main progress bars only
- Level 1 (-v): Sub-phase progress and timing
- Level 2 (-vv): Detailed per-phase metrics
Re-exports§
pub use implementations::CliProgressSink;pub use implementations::ProgressEvent;pub use implementations::RecordingProgressSink;pub use implementations::SilentProgressSink;pub use traits::HasProgress;pub use traits::ProgressSink;
Modules§
- implementations
- Progress sink implementations for different output modes.
- traits
- Progress sink trait definitions for effects-based progress reporting.
Structs§
- Progress
Config - Configuration for progress display behavior
- Progress
Manager - Centralized progress manager for coordinating multiple progress bars