handle_legacy_ccpm_migration

Function handle_legacy_ccpm_migration 

Source
pub async fn handle_legacy_ccpm_migration() -> Result<Option<PathBuf>>
Expand description

Handle legacy CCPM files by offering interactive migration.

This function searches for ccpm.toml and ccpm.lock files in the current directory and parent directories. If found, it prompts the user to migrate and performs the migration if they accept.

§Behavior

  • Interactive mode: Prompts user with Y/n confirmation (stdin is a TTY)
  • Non-interactive mode: Returns Ok(None) if stdin is not a TTY (e.g., CI/CD)
  • Search scope: Traverses from current directory to filesystem root

§Returns

  • Ok(Some(PathBuf)) with the path to agpm.toml if migration succeeded
  • Ok(None) if no legacy files were found OR user declined OR non-interactive mode
  • Err if migration failed

§Examples

use agpm_cli::cli::common::handle_legacy_ccpm_migration;

match handle_legacy_ccpm_migration().await? {
    Some(path) => println!("Migrated to: {}", path.display()),
    None => println!("No migration performed"),
}