handle_missing_gitignore_entries

Function handle_missing_gitignore_entries 

Source
pub async fn handle_missing_gitignore_entries(
    validation: &ConfigValidation,
    project_dir: &Path,
    yes: bool,
) -> Result<bool>
Expand description

Handle missing gitignore entries by offering to add them interactively.

When missing gitignore entries are detected, this function offers to add the standard AGPM managed paths section to the project’s .gitignore file. It follows the same interactive pattern as the legacy migration handlers.

§Behavior

  • Interactive mode (TTY): Prompts user with Y/n confirmation
  • Non-interactive mode (CI/CD): Prints warning and returns
  • Auto-accept mode: When yes is true, adds entries without prompting

§Arguments

  • validation - The ConfigValidation result containing missing entries
  • project_dir - Path to the project directory
  • yes - When true, automatically accept without prompting

§Returns

  • Ok(true) if entries were added successfully
  • Ok(false) if no entries were added (user declined, non-interactive, or empty)
  • Err if write operation failed

§Examples

use agpm_cli::cli::common::handle_missing_gitignore_entries;
use agpm_cli::installer::ConfigValidation;
use std::path::Path;

let validation = ConfigValidation::default();

// Interactive mode
let added = handle_missing_gitignore_entries(&validation, Path::new("."), false).await?;

// Auto-accept mode (for CI/scripts with --yes flag)
let added = handle_missing_gitignore_entries(&validation, Path::new("."), true).await?;