pub fn generate_backup_path(
config_path: &Path,
tool_name: &str,
) -> Result<PathBuf>Expand description
Generates a backup path for tool configuration files.
Creates backup paths in the format: .agpm/backups/<tool>/<filename>
at the project root level, not inside tool-specific directories.
§Arguments
config_path- Path to the configuration file being backed uptool_name- Name of the tool (e.g., “claude-code”, “opencode”)
§Returns
Full path to the backup file at project root level
§Examples
use std::path::Path;
use agpm_cli::utils::generate_backup_path;
// For .claude/settings.local.json with claude-code tool
let backup_path = generate_backup_path(
Path::new("/project/.claude/settings.local.json"),
"claude-code"
);
// Returns: /project/.agpm/backups/claude-code/settings.local.json
// For .mcp.json with claude-code tool
let backup_path = generate_backup_path(
Path::new("/project/.mcp.json"),
"claude-code"
);
// Returns: /project/.agpm/backups/claude-code/.mcp.json