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
yesis true, adds entries without prompting
§Arguments
validation- TheConfigValidationresult containing missing entriesproject_dir- Path to the project directoryyes- When true, automatically accept without prompting
§Returns
Ok(true)if entries were added successfullyOk(false)if no entries were added (user declined, non-interactive, or empty)Errif 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?;