manage_backups
List, restore, purge, or snapshot automatic Word document backups stored in hidden .ks4w-backups folders, with dry-run reporting and atomic restore that rotates current content into prev for undoability.
Instructions
Manage the automatic backups under the hidden .ks4w-backups/ folder next to each mutated document: two stable slots per document, prev (state before the most recent mutation) and anchor (session start). action='list': slot files with sizes and mtimes, legacy .bak- files, and orphaned slot folders whose source document is gone; give file_path for one document or directory for a folder. action='restore': overwrite file_path with a backup; source is 'prev', 'anchor', or a legacy .bak- path. The current content rotates into prev FIRST, so a restore is itself undoable; the payload is validated before the atomic replace, and documents open in Word are refused. action='purge': delete backups; scope: 'legacy', 'orphans', or 'slots'. dry_run defaults to TRUE (report only); dry_run=False deletes. Exact paths and sizes are reported either way. action='snapshot': save a DTG-stamped permanent copy of file_path, YYYYMMDD_HHMM_.docx (an existing leading DTG is replaced, not stacked), optional short label suffix, optional dest_dir. Snapshots are permanent keepers: the slots rotate on every mutation, snapshots are never auto-pruned and no purge scope touches them. Never overwrites (collisions get a numeric suffix); the source document is not modified.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| label | No | ||
| scope | No | ||
| action | Yes | ||
| source | No | ||
| dry_run | No | ||
| dest_dir | No | ||
| directory | No | ||
| file_path | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||