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>
3.1 KiB
3.1 KiB
description, allowed-tools
| description | allowed-tools |
|---|---|
| Reapply local modifications after a GSD update | Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion |
Step 1: Detect backed-up patches
Check for local patches directory:
# Global install
PATCHES_DIR="${HOME}/.claude/gsd-local-patches"
# Local install fallback
if [ ! -d "$PATCHES_DIR" ]; then
PATCHES_DIR="./.claude/gsd-local-patches"
fi
Read backup-meta.json from the patches directory.
If no patches found:
No local patches found. Nothing to reapply.
Local patches are automatically saved when you run /gsd:update
after modifying any GSD workflow, command, or agent files.
Exit.
Step 2: Show patch summary
## Local Patches to Reapply
**Backed up from:** v{from_version}
**Current version:** {read VERSION file}
**Files modified:** {count}
| # | File | Status |
|---|------|--------|
| 1 | {file_path} | Pending |
| 2 | {file_path} | Pending |
Step 3: Merge each file
For each file in backup-meta.json:
-
Read the backed-up version (user's modified copy from
gsd-local-patches/) -
Read the newly installed version (current file after update)
-
Compare and merge:
- If the new file is identical to the backed-up file: skip (modification was incorporated upstream)
- If the new file differs: identify the user's modifications and apply them to the new version
Merge strategy:
- Read both versions fully
- Identify sections the user added or modified (look for additions, not just differences from path replacement)
- Apply user's additions/modifications to the new version
- If a section the user modified was also changed upstream: flag as conflict, show both versions, ask user which to keep
-
Write merged result to the installed location
-
Report status:
Merged— user modifications applied cleanlySkipped— modification already in upstreamConflict— user chose resolution
Step 4: Update manifest
After reapplying, regenerate the file manifest so future updates correctly detect these as user modifications:
# The manifest will be regenerated on next /gsd:update
# For now, just note which files were modified
Step 5: Cleanup option
Ask user:
- "Keep patch backups for reference?" → preserve
gsd-local-patches/ - "Clean up patch backups?" → remove
gsd-local-patches/directory
Step 6: Report
## Patches Reapplied
| # | File | Status |
|---|------|--------|
| 1 | {file_path} | ✓ Merged |
| 2 | {file_path} | ○ Skipped (already upstream) |
| 3 | {file_path} | ⚠ Conflict resolved |
{count} file(s) updated. Your local modifications are active again.
<success_criteria>
- All backed-up patches processed
- User modifications merged into new version
- Conflicts resolved with user input
- Status reported for each file </success_criteria>