@jamiefutch/pi-backup 1.1.10 → 1.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -17
- package/backup-pi.ps1 +5 -4
- package/backup-pi.sh +6 -5
- package/extensions/pi-backup-manager.ts +5 -5
- package/package.json +1 -1
- package/pi-clean-reinstall.ps1 +1 -1
- package/pi-clean-reinstall.sh +1 -1
- package/restore-pi.ps1 +6 -5
- package/restore-pi.sh +6 -5
package/README.md
CHANGED
|
@@ -75,7 +75,7 @@ Opens the **Pi Backup Manager** interactive menu:
|
|
|
75
75
|
|
|
76
76
|
```
|
|
77
77
|
Pi Backup Manager — 8 backups (1 internal, 7 external)
|
|
78
|
-
External dir: ~/
|
|
78
|
+
External dir: ~/pi-backups
|
|
79
79
|
|
|
80
80
|
→ 📦 Create internal backup (~/.pi/backups/ — quick rollback)
|
|
81
81
|
💾 Create external backup (survives reinstall)
|
|
@@ -135,7 +135,7 @@ Backup: pi-backup-20260812-112019.7z
|
|
|
135
135
|
| Location | Path | Survives Clean Reinstall? | Format |
|
|
136
136
|
|----------|------|---------------------------|--------|
|
|
137
137
|
| **Internal** | `~/.pi/backups/` | ❌ NO (wiped by `rm -rf ~/.pi`) | Uncompressed dirs |
|
|
138
|
-
| **External** | `~/
|
|
138
|
+
| **External** | `~/pi-backups/` | ✅ YES | Compressed (.7z/.zip) |
|
|
139
139
|
|
|
140
140
|
> **Key point**: Always create an **external backup** before a clean reinstall. Internal backups are for quick rollbacks during normal use only.
|
|
141
141
|
|
|
@@ -143,17 +143,17 @@ Backup: pi-backup-20260812-112019.7z
|
|
|
143
143
|
|
|
144
144
|
#### 1. Backup (before reinstall)
|
|
145
145
|
```bash
|
|
146
|
-
|
|
146
|
+
./backup-pi.sh
|
|
147
147
|
```
|
|
148
148
|
|
|
149
149
|
#### 2. Clean Reinstall
|
|
150
150
|
```bash
|
|
151
|
-
|
|
151
|
+
./pi-clean-reinstall.sh
|
|
152
152
|
```
|
|
153
153
|
|
|
154
154
|
#### 3. Restore a directory, `.7z` archive, or `.zip` archive
|
|
155
155
|
```bash
|
|
156
|
-
|
|
156
|
+
./restore-pi.sh ~/pi-backups/pi-backup-20260811-143000.7z
|
|
157
157
|
```
|
|
158
158
|
|
|
159
159
|
#### 4. Reinstall npm deps + verify
|
|
@@ -167,7 +167,7 @@ pi --version
|
|
|
167
167
|
|
|
168
168
|
### Windows (PowerShell)
|
|
169
169
|
|
|
170
|
-
On Windows, use the `.ps1` scripts from PowerShell 7 (`pwsh`). The backup data directory defaults to `~/
|
|
170
|
+
On Windows, use the `.ps1` scripts from PowerShell 7 (`pwsh`). The backup data directory defaults to `~/pi-backups`.
|
|
171
171
|
|
|
172
172
|
```powershell
|
|
173
173
|
# 1. Backup (before reinstall)
|
|
@@ -177,7 +177,7 @@ On Windows, use the `.ps1` scripts from PowerShell 7 (`pwsh`). The backup data d
|
|
|
177
177
|
.\pi-clean-reinstall.ps1
|
|
178
178
|
|
|
179
179
|
# 3. Restore
|
|
180
|
-
.\restore-pi.ps1 ~\
|
|
180
|
+
.\restore-pi.ps1 ~\pi-backups\pi-backup-20260811-143000
|
|
181
181
|
|
|
182
182
|
# 4. Reinstall npm deps + verify
|
|
183
183
|
cd ~\.pi\agent; npm install
|
|
@@ -201,7 +201,7 @@ $env:PI_ROOT='C:\Users\you\.pi'; $env:BACKUP_ROOT='D:\pi-backups'; .\backup-pi.p
|
|
|
201
201
|
| **Extension configs** | `pi-hermes-memory-cleanup/scoped-memory.json`, `loop-police.json`, `pi-rtk/config.json`, `context-mode/config.json`, `pi-timeout/config.json`, `pi-context-viewer/config.json`, `pix-optimizer/config.json`, `pi-nvidia-nim/config.json` |
|
|
202
202
|
| **Global skills** | `~/.pi/agent/skills/` |
|
|
203
203
|
| **Project skills & memory** | `~/.pi/agent/projects-memory/<project>/` |
|
|
204
|
-
| **Local extension source** |
|
|
204
|
+
| **Local extension source** | `$LOCAL_EXT_ROOT/pi-timeout/`, `pi-chunk/`, `pi-hermes-memory-cleanup/`, `pi-context-docs/` (defaults to `~/projects/`) |
|
|
205
205
|
| **npm manifests** | `package.json`, `package-lock.json`, `npm-shrinkwrap.json` from `~/.pi/agent/npm/` |
|
|
206
206
|
| **Hermes memory (active)** | `MEMORY.md`, `USER.md`, `failures.md`, `retired-*.md` |
|
|
207
207
|
| **Cleanup backups** | Last 5 from `~/.pi/agent/hermes-cleanup/` |
|
|
@@ -211,11 +211,11 @@ The backup script output:
|
|
|
211
211
|
════════════════════════════════════════════════════════════
|
|
212
212
|
Pi Complete Backup
|
|
213
213
|
════════════════════════════════════════════════════════════
|
|
214
|
-
Source:
|
|
215
|
-
Destination: ~/
|
|
214
|
+
Source: ~/.pi
|
|
215
|
+
Destination: ~/pi-backups/pi-backup-20260811-143000
|
|
216
216
|
...
|
|
217
217
|
Backup complete!
|
|
218
|
-
Location: ~/
|
|
218
|
+
Location: ~/pi-backups/pi-backup-20260811-143000
|
|
219
219
|
Size: 12M
|
|
220
220
|
Files: 347
|
|
221
221
|
```
|
|
@@ -235,7 +235,7 @@ Files: 347
|
|
|
235
235
|
## Backup Location
|
|
236
236
|
|
|
237
237
|
```
|
|
238
|
-
~/
|
|
238
|
+
~/pi-backups/
|
|
239
239
|
├── pi-backup-20260811-143000/
|
|
240
240
|
│ ├── MANIFEST.txt
|
|
241
241
|
│ ├── settings.json
|
|
@@ -261,7 +261,7 @@ The external backup location is resolved in this priority order:
|
|
|
261
261
|
|
|
262
262
|
1. **`BACKUP_ROOT`** environment variable (highest priority)
|
|
263
263
|
2. **`externalBackupDir`** key in `~/.pi/agent/settings.json`
|
|
264
|
-
3. **Default**: `~/
|
|
264
|
+
3. **Default**: `~/pi-backups/`
|
|
265
265
|
|
|
266
266
|
```json
|
|
267
267
|
// ~/.pi/agent/settings.json
|
|
@@ -292,13 +292,14 @@ If the default directory already contains backups, it is treated as configured a
|
|
|
292
292
|
| Variable | Default | Purpose |
|
|
293
293
|
|----------|---------|---------|
|
|
294
294
|
| `PI_ROOT` | `~/.pi` | Override Pi root directory |
|
|
295
|
-
| `BACKUP_ROOT` | `~/
|
|
295
|
+
| `BACKUP_ROOT` | `~/pi-backups` | Override backup destination (highest priority for the TUI too) |
|
|
296
|
+
| `LOCAL_EXT_ROOT` | `~/projects` | Override the directory containing local extension source repositories |
|
|
296
297
|
| `KEEP_UNCOMPRESSED` | `0` | Keep the uncompressed staging directory after external backup; the TUI sets this automatically for internal backups |
|
|
297
298
|
| `PKG_MANAGER` | `bun` | Package manager used by the clean-reinstall scripts (`bun`, `npm`, etc.) |
|
|
298
299
|
|
|
299
300
|
```bash
|
|
300
301
|
# Custom locations
|
|
301
|
-
PI_ROOT=/custom/.pi BACKUP_ROOT=/mnt/backups
|
|
302
|
+
PI_ROOT=/custom/.pi BACKUP_ROOT=/mnt/backups ./backup-pi.sh
|
|
302
303
|
```
|
|
303
304
|
|
|
304
305
|
---
|
|
@@ -307,10 +308,10 @@ PI_ROOT=/custom/.pi BACKUP_ROOT=/mnt/backups ~/projects/personal/pi-backup/backu
|
|
|
307
308
|
|
|
308
309
|
```bash
|
|
309
310
|
# Daily backup at 3 AM
|
|
310
|
-
0 3 * * *
|
|
311
|
+
0 3 * * * ./backup-pi.sh >> ~/pi-backup.log 2>&1
|
|
311
312
|
|
|
312
313
|
# Keep last 30 backups
|
|
313
|
-
0 4 * * * find ~/
|
|
314
|
+
0 4 * * * find ~/pi-backups -maxdepth 1 -type d -name 'pi-backup-*' -mtime +30 -exec rm -rf {} \;
|
|
314
315
|
```
|
|
315
316
|
|
|
316
317
|
---
|
package/backup-pi.ps1
CHANGED
|
@@ -15,7 +15,8 @@ $ErrorActionPreference = 'Stop'
|
|
|
15
15
|
|
|
16
16
|
# ─── Config ────────────────────────────────────────────────
|
|
17
17
|
$PiRoot = if ($env:PI_ROOT) { $env:PI_ROOT } else { Join-Path $HOME '.pi' }
|
|
18
|
-
$BackupRoot = if ($env:BACKUP_ROOT) { $env:BACKUP_ROOT } else { Join-Path $HOME '
|
|
18
|
+
$BackupRoot = if ($env:BACKUP_ROOT) { $env:BACKUP_ROOT } else { Join-Path $HOME 'pi-backups' }
|
|
19
|
+
$LocalExtRoot = if ($env:LOCAL_EXT_ROOT) { $env:LOCAL_EXT_ROOT } else { Join-Path $HOME 'projects' }
|
|
19
20
|
$Timestamp = Get-Date -Format 'yyyyMMdd-HHmmss'
|
|
20
21
|
$ArchiveBase = "pi-backup-$Timestamp"
|
|
21
22
|
$ArchiveDir = Join-Path $BackupRoot $ArchiveBase
|
|
@@ -127,7 +128,7 @@ if (Test-Path -LiteralPath $projMem) {
|
|
|
127
128
|
Log "5/8 Local extension source code..."
|
|
128
129
|
$localExts = @('pi-timeout', 'pi-chunk', 'pi-hermes-memory-cleanup', 'pi-context-docs')
|
|
129
130
|
foreach ($ext in $localExts) {
|
|
130
|
-
$src = Join-Path $
|
|
131
|
+
$src = Join-Path $LocalExtRoot $ext
|
|
131
132
|
if (Test-Path -LiteralPath $src) {
|
|
132
133
|
$dst = Join-Path $ArchiveDir "local-extensions\$ext"
|
|
133
134
|
$extDstDir = Join-Path $ArchiveDir 'local-extensions'
|
|
@@ -136,7 +137,7 @@ foreach ($ext in $localExts) {
|
|
|
136
137
|
Copy-Tree $src $dst -excludeDirs @('node_modules','dist','build','coverage','.git') -excludeFiles @('*.log')
|
|
137
138
|
OK " $ext/ (source only)"
|
|
138
139
|
} else {
|
|
139
|
-
Warn " $ext - not found at
|
|
140
|
+
Warn " $ext - not found at $LocalExtRoot/$ext"
|
|
140
141
|
}
|
|
141
142
|
}
|
|
142
143
|
|
|
@@ -241,5 +242,5 @@ if ($archivePath) {
|
|
|
241
242
|
if ($KeepUncompressed) { Log "Staging: $ArchiveDir" }
|
|
242
243
|
Write-Host ""
|
|
243
244
|
Log "To restore after reinstall:"
|
|
244
|
-
Log "
|
|
245
|
+
Log " .\restore-pi.ps1 $archivePath"
|
|
245
246
|
Write-Host ""
|
package/backup-pi.sh
CHANGED
|
@@ -7,7 +7,8 @@ set -euo pipefail
|
|
|
7
7
|
|
|
8
8
|
# ─── Config ──────────────────────────────────────────────────────
|
|
9
9
|
PI_ROOT="${PI_ROOT:-$HOME/.pi}"
|
|
10
|
-
BACKUP_ROOT="${BACKUP_ROOT:-$HOME/
|
|
10
|
+
BACKUP_ROOT="${BACKUP_ROOT:-$HOME/pi-backups}"
|
|
11
|
+
LOCAL_EXT_ROOT="${LOCAL_EXT_ROOT:-$HOME/projects}"
|
|
11
12
|
TIMESTAMP="$(date +%Y%m%d-%H%M%S)"
|
|
12
13
|
BACKUP_DIR="$BACKUP_ROOT/pi-backup-$TIMESTAMP" # staging dir (compressed into archive below)
|
|
13
14
|
KEEP_UNCOMPRESSED="${KEEP_UNCOMPRESSED:-0}" # set to 1 to keep the staging dir after archiving
|
|
@@ -131,14 +132,14 @@ main() {
|
|
|
131
132
|
"pi-context-docs"
|
|
132
133
|
)
|
|
133
134
|
for ext in "${local_exts[@]}"; do
|
|
134
|
-
if [[ -d "$
|
|
135
|
+
if [[ -d "$LOCAL_EXT_ROOT/$ext" ]]; then
|
|
135
136
|
mkdir -p "$BACKUP_DIR/local-extensions/$ext"
|
|
136
137
|
# Copy source, exclude node_modules, dist, build, .git, coverage
|
|
137
138
|
rsync -a --exclude 'node_modules' --exclude 'dist' --exclude 'build' --exclude '.git' --exclude 'coverage' --exclude '*.log' \
|
|
138
|
-
"$
|
|
139
|
+
"$LOCAL_EXT_ROOT/$ext/" "$BACKUP_DIR/local-extensions/$ext/"
|
|
139
140
|
ok " $ext/ (source only)"
|
|
140
141
|
else
|
|
141
|
-
warn " $ext — not found at
|
|
142
|
+
warn " $ext — not found at $LOCAL_EXT_ROOT/$ext"
|
|
142
143
|
fi
|
|
143
144
|
done
|
|
144
145
|
|
|
@@ -223,7 +224,7 @@ EOF
|
|
|
223
224
|
[[ "$KEEP_UNCOMPRESSED" == "1" ]] && log "Staging: $BACKUP_DIR"
|
|
224
225
|
echo
|
|
225
226
|
log "To restore after reinstall:"
|
|
226
|
-
log "
|
|
227
|
+
log " ./restore-pi.sh $ARCHIVE"
|
|
227
228
|
echo
|
|
228
229
|
}
|
|
229
230
|
|
|
@@ -9,7 +9,7 @@ const IS_WINDOWS = process.platform === "win32";
|
|
|
9
9
|
const PI_ROOT = join(HOME_DIR, ".pi");
|
|
10
10
|
const INTERNAL_BACKUP_DIR = join(PI_ROOT, "backups");
|
|
11
11
|
const SETTINGS_FILE = join(PI_ROOT, "agent", "settings.json");
|
|
12
|
-
const DEFAULT_EXTERNAL_DIR = join(HOME_DIR, "
|
|
12
|
+
const DEFAULT_EXTERNAL_DIR = join(HOME_DIR, "pi-backups");
|
|
13
13
|
const PACKAGE_ROOT = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
14
14
|
|
|
15
15
|
interface BackupInfo {
|
|
@@ -542,7 +542,7 @@ The external backup directory is resolved in this order:
|
|
|
542
542
|
|
|
543
543
|
1. **BACKUP_ROOT** environment variable (highest priority)
|
|
544
544
|
2. **settings.json** → \`externalBackupDir\`
|
|
545
|
-
3. **Default**: \`~/
|
|
545
|
+
3. **Default**: \`~/pi-backups/\`
|
|
546
546
|
|
|
547
547
|
Use **⚙️ Configure external backup directory** in the main menu to change the settings.json value.
|
|
548
548
|
|
|
@@ -567,13 +567,13 @@ Use **⚙️ Configure external backup directory** in the main menu to change th
|
|
|
567
567
|
|
|
568
568
|
\`\`\`bash
|
|
569
569
|
# Create external backup (uses BACKUP_ROOT or default)
|
|
570
|
-
|
|
570
|
+
./backup-pi.sh
|
|
571
571
|
|
|
572
572
|
# Override backup location
|
|
573
|
-
BACKUP_ROOT=/mnt/backups
|
|
573
|
+
BACKUP_ROOT=/mnt/backups ./backup-pi.sh
|
|
574
574
|
|
|
575
575
|
# Restore from external
|
|
576
|
-
|
|
576
|
+
./restore-pi.sh ~/pi-backups/pi-backup-20260811-143000
|
|
577
577
|
\`\`\`
|
|
578
578
|
|
|
579
579
|
## What Gets Backed Up
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jamiefutch/pi-backup",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.11",
|
|
4
4
|
"description": "Pi package: Pi backup/restore scripts and TUI extension. Back up and restore all Pi config, skills, extensions, and memory; /pi-backup interactive manager.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
package/pi-clean-reinstall.ps1
CHANGED
|
@@ -73,7 +73,7 @@ Log "================================================================"
|
|
|
73
73
|
OK "Clean reinstall complete!"
|
|
74
74
|
Write-Host ""
|
|
75
75
|
Log "Next steps:"
|
|
76
|
-
Log " 1. Restore:
|
|
76
|
+
Log " 1. Restore: ./restore-pi.ps1 <backup-dir>"
|
|
77
77
|
Log " 2. Reinstall npm deps: cd ~/.pi/agent && npm install"
|
|
78
78
|
Log " 3. Verify: pi --version, /ctx-doctor, /loop-police-status, /scoped-memory-status"
|
|
79
79
|
Write-Host ""
|
package/pi-clean-reinstall.sh
CHANGED
|
@@ -85,7 +85,7 @@ main() {
|
|
|
85
85
|
ok "Clean reinstall complete!"
|
|
86
86
|
echo
|
|
87
87
|
log "Next steps:"
|
|
88
|
-
log " 1. Restore:
|
|
88
|
+
log " 1. Restore: ./restore-pi.sh <backup-dir>"
|
|
89
89
|
log " 2. Reinstall npm deps: cd ~/.pi/agent && npm install"
|
|
90
90
|
log " 3. Verify: pi --version, /ctx-doctor, /loop-police-status, /scoped-memory-status"
|
|
91
91
|
echo
|
package/restore-pi.ps1
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
#
|
|
5
5
|
# Usage:
|
|
6
6
|
# .\restore-pi.ps1 <backup-directory-or-archive>
|
|
7
|
-
# .\restore-pi.ps1 ~\
|
|
8
|
-
# .\restore-pi.ps1 ~\
|
|
7
|
+
# .\restore-pi.ps1 ~\pi-backups\pi-backup-20260811-143000
|
|
8
|
+
# .\restore-pi.ps1 ~\pi-backups\pi-backup-20260811-143000.zip
|
|
9
9
|
# =============================================================
|
|
10
10
|
[CmdletBinding()]
|
|
11
11
|
param(
|
|
@@ -17,6 +17,7 @@ $ErrorActionPreference = 'Stop'
|
|
|
17
17
|
|
|
18
18
|
# ─── Config ────────────────────────────────────────────────
|
|
19
19
|
$PiRoot = if ($env:PI_ROOT) { $env:PI_ROOT } else { Join-Path $HOME '.pi' }
|
|
20
|
+
$LocalExtRoot = if ($env:LOCAL_EXT_ROOT) { $env:LOCAL_EXT_ROOT } else { Join-Path $HOME 'projects' }
|
|
20
21
|
|
|
21
22
|
function Log { Write-Host "[INFO] $args" -ForegroundColor Cyan }
|
|
22
23
|
function OK { Write-Host "[OK] $args" -ForegroundColor Green }
|
|
@@ -30,8 +31,8 @@ Usage: $($MyInvocation.MyCommand.Name) <backup-directory-or-archive>
|
|
|
30
31
|
Restores a Pi backup created by backup-pi.ps1
|
|
31
32
|
|
|
32
33
|
Examples:
|
|
33
|
-
.\$($MyInvocation.MyCommand.Name) ~\
|
|
34
|
-
.\$($MyInvocation.MyCommand.Name) ~\
|
|
34
|
+
.\$($MyInvocation.MyCommand.Name) ~\pi-backups\pi-backup-20260811-143000
|
|
35
|
+
.\$($MyInvocation.MyCommand.Name) ~\pi-backups\pi-backup-20260811-143000.zip
|
|
35
36
|
|
|
36
37
|
Accepts either an uncompressed backup directory or a compressed zip/7z archive
|
|
37
38
|
(as produced by backup-pi.ps1).
|
|
@@ -202,7 +203,7 @@ Log "5/8 Local extension source code..."
|
|
|
202
203
|
$localSrc = Join-Path $BackupDir 'local-extensions'
|
|
203
204
|
if (Test-Path -LiteralPath $localSrc -PathType Container) {
|
|
204
205
|
foreach ($ext in Get-ChildItem -LiteralPath $localSrc -Directory) {
|
|
205
|
-
$dst = Join-Path $
|
|
206
|
+
$dst = Join-Path $LocalExtRoot $ext.Name
|
|
206
207
|
New-Item -ItemType Directory -Path $dst -Force | Out-Null
|
|
207
208
|
Copy-Tree $ext.FullName $dst
|
|
208
209
|
OK " $($ext.Name)/ restored"
|
package/restore-pi.sh
CHANGED
|
@@ -6,6 +6,7 @@ set -euo pipefail
|
|
|
6
6
|
|
|
7
7
|
# ─── Config ──────────────────────────────────────────────────────
|
|
8
8
|
PI_ROOT="${PI_ROOT:-$HOME/.pi}"
|
|
9
|
+
LOCAL_EXT_ROOT="${LOCAL_EXT_ROOT:-$HOME/projects}"
|
|
9
10
|
|
|
10
11
|
# ─── Colors ──────────────────────────────────────────────────────
|
|
11
12
|
RED='\033[0;31m'
|
|
@@ -27,9 +28,9 @@ Usage: $0 <backup-directory-or-archive>
|
|
|
27
28
|
Restores a Pi backup created by backup-pi.sh
|
|
28
29
|
|
|
29
30
|
Examples:
|
|
30
|
-
$0 ~/
|
|
31
|
-
$0 ~/
|
|
32
|
-
$0 ~/
|
|
31
|
+
$0 ~/pi-backups/pi-backup-20260811-143000
|
|
32
|
+
$0 ~/pi-backups/pi-backup-20260811-143000.7z
|
|
33
|
+
$0 ~/pi-backups/pi-backup-20260811-143000.zip
|
|
33
34
|
|
|
34
35
|
Accepts either an uncompressed backup directory or a compressed
|
|
35
36
|
zip/7z archive (as produced by backup-pi.sh).
|
|
@@ -171,8 +172,8 @@ main() {
|
|
|
171
172
|
for ext in "$BACKUP_DIR/local-extensions"/*/; do
|
|
172
173
|
[[ -d "$ext" ]] || continue
|
|
173
174
|
name="$(basename "$ext")"
|
|
174
|
-
mkdir -p "$
|
|
175
|
-
rsync -a "$ext/" "$
|
|
175
|
+
mkdir -p "$LOCAL_EXT_ROOT/$name"
|
|
176
|
+
rsync -a "$ext/" "$LOCAL_EXT_ROOT/$name/"
|
|
176
177
|
ok " $name/ restored"
|
|
177
178
|
done
|
|
178
179
|
else
|