feat: add automated konsolerc geometry sanitization and git backup integration
- Implement [MainWindow] section stripping in backup and restore scripts to prevent screen geometry/monitor layout noise across devices - Add robust hostname detection and customizable archive naming in backup.sh - Add optional interactive git commit and push prompt upon successful backup - Update restore.sh diff preview and extraction to respect sanitized konsolerc - Add AGENTS.md documentation detailing script architecture and conventions
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
# AGENTS.md
|
||||
|
||||
## Overview
|
||||
Lightweight Bash utility scripts for KDE Konsole configuration backup, cross-device synchronization, and restoration.
|
||||
|
||||
## Key Features & Commands
|
||||
|
||||
- **Backup**: `./backup.sh`
|
||||
- Automatically strips device-specific screen geometry / monitor layouts (`[MainWindow]` section in `konsolerc`) to ensure clean cross-device sync.
|
||||
- Staged in `backups/` with default naming format: `konsole_backup_<hostname>_YYYYMMDD_HHMMSS.zip`.
|
||||
- Prompts user to confirm or edit the backup archive filename before saving.
|
||||
- Enforces a retention policy of max 10 backups (older ones deleted and removed via `git rm` if inside a git repository).
|
||||
- Prompts to commit and push the new backup to git remote.
|
||||
|
||||
- **Restore**: `./restore.sh [optional_zip_path]`
|
||||
- Supports positional arguments, stdin piping (`echo "file.zip" | ./restore.sh`), and an interactive selection menu if no input is provided.
|
||||
- Sanitizes `konsolerc` to avoid overwriting the target machine's window/screen geometry.
|
||||
- Supports file-by-file diff preview (`[d]`) using `git diff --no-index` or `diff`.
|
||||
- Reads interactive prompts safely from `/dev/tty` when stdin is redirected.
|
||||
|
||||
## Target Paths (Relative to `$HOME`)
|
||||
- `.config/konsolerc` (sanitized of `[MainWindow]` geometry)
|
||||
- `.local/share/konsole` (profiles, color schemes, bookmarks, keytabs)
|
||||
- `.local/share/kxmlgui5/konsole` (UI toolbars / actions)
|
||||
- `.config/konsole.notifyrc`
|
||||
- `.config/konsolesshconfig`
|
||||
|
||||
## Implementation Details & Conventions
|
||||
- **Shell**: Pure Bash 4+ with `set -euo pipefail`.
|
||||
- **Safety**: Uses `mktemp -d` for temporary staging directories with `trap ... EXIT` cleanup.
|
||||
- **Verification**: Run `bash -n backup.sh restore.sh` to check syntax.
|
||||
Reference in New Issue
Block a user