Module common

Module common 

Source
Expand description

Common utilities and shared functionality for CLI commands.

This module provides reusable infrastructure for install and update commands:

§Core Components

  • CommandExecutor trait: Standardized command execution pattern
  • CommandContext: Manifest and lockfile management utilities
  • OperationMode enum: Distinguishes install vs update for shared logic

§Shared Display Helpers

  • display_dry_run_results(): Rich dry-run output with CI exit codes
  • display_no_changes(): Context-appropriate “no changes” messages

§Legacy Support

  • handle_legacy_ccpm_migration(): CCPM to AGPM migration utilities
  • check_for_legacy_ccpm_files(): Detects old CCPM installations

§Lockfile Management

  • load_lockfile(): Loads lockfile with automatic regeneration
  • save_lockfile(): Saves lockfile with error handling
  • backup_and_regenerate_lockfile(): Recovery from corrupted lockfiles

Structs§

CommandContext
Common context for CLI commands that need manifest and project information

Enums§

OperationMode
Determines the type of operation being performed for user-facing messages.

Traits§

CommandExecutor
Common trait for CLI command execution pattern

Functions§

check_for_legacy_ccpm_files
Check for legacy CCPM files and return a migration message if found.
display_dry_run_results
Display dry-run results with rich categorization of changes.
display_no_changes
Display “no changes” message appropriate for the operation mode.
handle_legacy_ccpm_migration
Handle legacy CCPM files by offering interactive migration.