From 965321394cc8d5683810f81f94e5a2f9e22b6bdd Mon Sep 17 00:00:00 2001 From: sauldataman Date: Thu, 19 Mar 2026 20:50:17 -0700 Subject: [PATCH 1/6] feat: Add diff, backup --user-only, and upgrade commands for safe PAI upgrades MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add three new capabilities to BackupRestore.ts for safe upgrade workflows: - `diff --release `: Compare local installation against a release using SHA-256 hashes. Shows new files, unchanged files, and conflicts (locally modified system files). Automatically excludes PAI/USER/, MEMORY/, settings.json, PAI-Install/, and CLAUDE.md from conflict reporting since they are handled separately. - `backup --user-only --release `: Smart backup that saves only user data: always-backup dirs (PAI/USER/, MEMORY/), settings.json, CLAUDE.md, modified system files, and user-generated files not in the release. Excludes CC runtime dirs (debug/, telemetry/, etc.). Supports --exclude for fine-grained control. - `upgrade --release `: Automated upgrade cycle — checks for full backup, diffs, backs up user data, applies release via cp -r, restores user modifications, and rebuilds CLAUDE.md. Skips restoring CLAUDE.md (regenerated by BuildCLAUDE.ts) but restores settings.json before install.sh runs so its merge logic preserves user config. Ignore patterns are read from the repo's .gitignore rather than hardcoded. All existing commands (backup, restore, list, migrate) are completely unchanged. Co-Authored-By: Claude Opus 4.6 (1M context) --- Tools/BackupRestore.ts | 806 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 766 insertions(+), 40 deletions(-) diff --git a/Tools/BackupRestore.ts b/Tools/BackupRestore.ts index 745d1b9c7..ffdfe0535 100644 --- a/Tools/BackupRestore.ts +++ b/Tools/BackupRestore.ts @@ -1,28 +1,151 @@ #!/usr/bin/env bun /** - * BackupRestore - Backup and restore PAI installations + * BackupRestore - Backup, restore, and upgrade PAI installations * * Commands: - * backup [--name