Skip to main content

Module backup

Module backup 

Source
Expand description

Backup session management for undo safety net.

Before any --apply write, commands save the original content of each affected file to .patchloom/backups/<timestamp>/. The patchloom undo command restores the most recent (or a chosen) backup.

Structs§

BackupSession
An active backup session that collects originals before writes.
Manifest
The manifest for a backup session.
ManifestEntry
A single file entry in the backup manifest.

Enums§

FileAction
What the apply operation did to a file.

Constants§

BACKUP_DIR
Directory name under the project root.

Functions§

backup_write_files
Back up files, write new content atomically, and finalize the backup session. All originals are saved before any writes begin, ensuring consistency.
list_sessions
List available backup sessions, most recent first.
prune_old_backups
Prune backup sessions older than 7 days.
remove_session
Remove a consumed backup session directory so subsequent undo calls reach older sessions instead of replaying the same one.
restore_session
Restore a specific backup session, returning the number of files restored.