Module operation_context

Module operation_context 

Source
Expand description

Operation-scoped context for cross-module state management.

Provides a context object that flows through CLI operations, enabling features like warning deduplication without global state.

§Overview

The OperationContext is created at the start of CLI command execution and passed through the call chain to coordinate behavior across modules. This enables:

  • Warning deduplication during dependency resolution
  • Operation-scoped state without global variables
  • Better test isolation (each test creates its own context)

§Example

use agpm_cli::core::OperationContext;
use std::path::Path;

let ctx = OperationContext::new();

// First warning for a file
assert!(ctx.should_warn_file(Path::new("test.md")));

// Subsequent warnings deduplicated
assert!(!ctx.should_warn_file(Path::new("test.md")));

Structs§

OperationContext
Context for a single CLI operation (install, update, validate, etc.)