fix(installer): preserve USER-PROFILE.md and dev-preferences.md on re-install (#1945)

Running gsd-update (re-running the installer) silently deleted two
user-generated files:
- get-shit-done/USER-PROFILE.md (created by /gsd-profile-user)
- commands/gsd/dev-preferences.md (created by /gsd-profile-user)

Root causes:
1. copyWithPathReplacement() calls fs.rmSync(destDir, {recursive:true})
   before copying, wiping USER-PROFILE.md with no preserve allowlist.
2. The legacy commands/gsd/ cleanup at ~line 5211 rmSync'd the entire
   directory, wiping dev-preferences.md.
3. The backup path in profile-user.md pointed to the same directory
   that gets wiped, so the backup was also lost.

Fix:
- Add preserveUserArtifacts(destDir, fileNames) and restoreUserArtifacts()
  helpers that save/restore listed files around destructive wipes.
- Call them in install() before the get-shit-done/ copy (preserves
  USER-PROFILE.md) and before the legacy commands/gsd/ cleanup
  (preserves dev-preferences.md).
- Fix profile-user.md backup path from ~/.claude/get-shit-done/USER-PROFILE.backup.md
  to ~/.claude/USER-PROFILE.backup.md (outside the wiped directory).

Closes #1924

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Tom Boucher
2026-04-07 17:28:23 -04:00
committed by GitHub
parent 60fa2936dd
commit 13faf66132
3 changed files with 310 additions and 2 deletions

View File

@@ -46,7 +46,7 @@ If "Cancel": Display "No changes made." and exit.
Backup existing profile:
```bash
cp "$HOME/.claude/get-shit-done/USER-PROFILE.md" "$HOME/.claude/get-shit-done/USER-PROFILE.backup.md"
cp "$HOME/.claude/get-shit-done/USER-PROFILE.md" "$HOME/.claude/USER-PROFILE.backup.md"
```
Display: "Re-analyzing your sessions to update your profile."
@@ -381,7 +381,7 @@ Read both old backup and new analysis to compare dimension ratings/confidence.
Read the backed-up profile:
```bash
BACKUP_PATH="$HOME/.claude/get-shit-done/USER-PROFILE.backup.md"
BACKUP_PATH="$HOME/.claude/USER-PROFILE.backup.md"
```
Compare each dimension's rating and confidence between old and new. Display diff table showing only changed dimensions: