Module progress

Module progress 

Source
Expand description

Progress indicators and user interface utilities

This module provides a unified progress system for AGPM operations using the MultiPhaseProgress approach. All progress tracking goes through phases to ensure consistent user experience across different operations.

§Features

  • Unified progress: All operations use MultiPhaseProgress for consistency
  • Phase-based tracking: Installation/update operations broken into logical phases
  • CI/quiet mode support: Automatically disables in non-interactive environments
  • Thread safety: Safe to use across async tasks and parallel operations

§Concurrency Model

Progress updates use try_lock() with early return rather than blocking locks. This is intentional: UI updates are best-effort and non-blocking.

Under high concurrency, some progress updates may be silently dropped. This is acceptable because:

  • Progress bars are visual feedback only, not correctness-critical
  • Blocking on a UI lock would slow down actual work (file I/O, git operations)
  • The final completion state is always accurate (operations complete regardless)
  • Missing intermediate updates are imperceptible to users at high parallelism

§Configuration

Progress indicators are now controlled via the MultiPhaseProgress constructor parameter rather than environment variables for better thread safety.

§Examples

§Multi-Phase Progress

use agpm_cli::utils::progress::{MultiPhaseProgress, InstallationPhase};

let progress = MultiPhaseProgress::new(true);

// Start syncing phase
progress.start_phase(InstallationPhase::SyncingSources, Some("Fetching repositories"));
// ... do work ...
progress.complete_phase(Some("Synced 3 repositories"));

// Start resolving phase
progress.start_phase(InstallationPhase::ResolvingDependencies, None);
// ... do work ...
progress.complete_phase(Some("Resolved 25 dependencies"));

Structs§

MultiPhaseProgress
Multi-phase progress manager that displays multiple progress bars with completed phases showing as static messages

Enums§

InstallationPhase
Represents different phases of the installation process

Functions§

collect_dependency_names
Helper function to collect dependency names from a manifest