feat: preserve local patches across GSD updates (#481)

When users modify GSD workflow files (e.g., adding bug workarounds),
those changes get wiped on every /gsd:update. This adds automatic
backup and guided restore:

**install.js changes:**
- Writes `gsd-file-manifest.json` after install with SHA256 hashes
  of every installed GSD file
- Before wiping on update, compares current files against manifest
  to detect user modifications
- Backs up modified files to `gsd-local-patches/` directory
- Reports backed-up patches after install completes

**New command: /gsd:reapply-patches**
- LLM-guided merge of backed-up modifications into new version
- Handles cases where upstream also changed the same file
- Reports merge status per file (merged/skipped/conflict)

**update.md changes:**
- Warning text now mentions automatic backup instead of manual
- New step after install to check for and report backed-up patches

Flow: modify GSD file → /gsd:update → modifications auto-backed up →
new version installed → /gsd:reapply-patches → modifications merged back

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
min-k-khant
2026-02-08 06:35:42 -08:00
committed by GitHub
parent ea0204bfc7
commit ca03a061a8
3 changed files with 271 additions and 1 deletions

View File

@@ -129,7 +129,7 @@ Your custom files in other locations are preserved:
- Custom hooks ✓
- Your CLAUDE.md files ✓
If you've modified any GSD files directly, back them up first.
If you've modified any GSD files directly, they'll be automatically backed up to `gsd-local-patches/` and can be reapplied with `/gsd:reapply-patches` after the update.
```
Use AskUserQuestion:
@@ -183,6 +183,21 @@ Format completion message (changelog was already shown in confirmation step):
```
</step>
<step name="check_local_patches">
After update completes, check if the installer detected and backed up any locally modified files:
Check for gsd-local-patches/backup-meta.json in the config directory.
**If patches found:**
```
Local patches were backed up before the update.
Run /gsd:reapply-patches to merge your modifications into the new version.
```
**If no patches:** Continue normally.
</step>
</process>
<success_criteria>