* feat(#2790): consolidate 86 gsd-* skills to 59 — zero functional loss Closes #2790 - `capture.md` — absorbs add-todo (default), note (--note), add-backlog (--backlog), plant-seed (--seed), check-todos (--list) - `phase.md` — absorbs add-phase (default), insert-phase (--insert), remove-phase (--remove), edit-phase (--edit) - `config.md` — absorbs settings-advanced (--advanced), settings-integrations (--integrations), set-profile (--profile); settings.md retained as-is - `workspace.md` — absorbs new-workspace (--new), list-workspaces (--list), remove-workspace (--remove) - `update.md` — adds --sync (absorbs sync-skills) and --reapply (absorbs reapply-patches) - `sketch.md` — adds --wrap-up (absorbs sketch-wrap-up) - `spike.md` — adds --wrap-up (absorbs spike-wrap-up) - `map-codebase.md` — adds --fast (absorbs scan) and --query (absorbs intel) - `code-review.md` — adds --fix (absorbs code-review-fix) - `progress.md` — adds --next (absorbs next) and --do (absorbs do) join-discord, research-phase, session-report, from-gsd2, analyze-dependencies, list-phase-assumptions, plan-milestone-gaps autonomous.md: updated Skill(skill="gsd:code-review-fix") → Skill(skill="gsd:code-review", args="--fix --auto") to match the consolidated skill name - New: tests/enh-2790-skill-consolidation.test.cjs (48 tests) - Updated: 14 existing test files redirected from deleted command paths to their consolidated equivalents - docs/INVENTORY.md: Commands count 86→59, ghost rows removed, new consolidated rows added - docs/INVENTORY-MANIFEST.json: regenerated to match filesystem Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * docs(#2790): add CHANGELOG entry for skill consolidation * docs(#2790): update COMMANDS.md for 86→59 skill consolidation Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(#2790): address CodeRabbit review findings - CHANGELOG.md: add --next alongside --do in progress flag list - config.md: remove trailing space from --profile code span (MD038) - COMMANDS.md: add required descriptions to /gsd-phase examples; /gsd-phase without args errors, not interactive - COMMANDS.md: add --next and --do to /gsd-progress flags table + examples - test: convert content.includes('--reapply') to structural frontmatter parse; add allow-test-rule comment for workflow content assertions - test: replace redundant existsSync duplicate with assertion that verifies the full consolidated flag surface (--sync | --reapply) in argument-hint Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(#2790): restore reapply-patches workflow and strengthen test assertions - Create get-shit-done/workflows/reapply-patches.md: the #2790 consolidation deleted the 14K combined command+workflow file (reapply-patches.md) but update.md already referenced the workflow via execution_context_extended. Restoring it fixes a silent behavioral gap where --reapply had no workflow to load. Includes full three-way merge logic, hunk verification table (Step 4), and the Hunk Verification Gate (Step 5) that blocks cleanup until all user-added hunks are confirmed present in the merged output. - Fix update.md: /gsd-reapply-patches → /gsd-update --reapply (stale ref) - Fix reapply-verify-hunks.test.cjs: was checking existsSync(update.md) 8×; now points to the workflow file and asserts real behavioral content (Post-merge verification, Hunk presence check, Line-count check, backup reference, per-file tracking, structural ordering) - Fix reapply-patches.test.cjs: replace content.includes() stubs with frontmatter-parsed argument-hint assertions; replace 4 existsSync(update.md) no-ops with real assertions against the workflow content - Fix edit-phase.test.cjs: /gsd-edit-phase → /gsd-phase (COMMANDS.md now documents the consolidated command with --edit flag) - Fix next-safety-gates.test.cjs: split OR predicates into independent assertions — --next in progress.md and --force in next.md workflow - Fix workspace.test.cjs: add allow-test-rule comment for routing content checks (command routing text IS the deployed behavioral contract) - Fix bug-2439 test: strengthen pre-flight assertion to verify gsd-sdk is referenced (not just --profile) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: address CodeRabbit review findings (CR round 2) - INVENTORY.md: update sync-skills.md row to reference /gsd-update --sync instead of stale /gsd-sync-skills (absorbed in #2790) - enh-2380-sync-skills.test.cjs: align INVENTORY.md assertion with the corrected reference; was asserting the old /gsd-sync-skills name while the manifest test correctly asserted /gsd-update, creating conflicting expectations in the same suite - reapply-verify-hunks.test.cjs: add explicit notEqual(-1) assertions for all three anchors before the ordering check so a missing anchor produces a clear failure instead of a false positive (writeIdx=-1 < verifyIdx=5 is true) - bug-2439-set-profile-gsd-sdk-preflight.test.cjs: defer fs.readFileSync until after the existence assertion; eager describe-level read caused the suite to crash before the existence test could run, making it effectively dead code Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(#2790): address CR — INVENTORY routing + reapply test contract wording Two unresolved CodeRabbit findings (Major): - docs/INVENTORY.md: workflow-file table still pointed at obsolete /gsd-do, /gsd-next, /gsd-note, /gsd-add-todo, /gsd-add-backlog, /gsd-check-todos, /gsd-plant-seed slash commands. Re-route to the consolidated /gsd-progress (--next, --do) and /gsd-capture (--note, --backlog, --seed, --list) so the inventory is internally consistent. - tests/reapply-verify-hunks.test.cjs: 'verification tracks per-file status' asserted on phrasing that doesn't appear in reapply-patches.md (the 'per-file' substring only matched accidentally via 'sequential integer per file'). Switch to the actual contract text — Hunk Verification Table, one row per hunk per file, verified column. * test(#2790): update CR-INTEGRATION tests for consolidated --fix invocation After the merge of main (which carries #2843's hyphen-form fix), the consolidation in this branch absorbs gsd-code-review-fix into gsd-code-review as the --fix flag. Update the two CR-INTEGRATION tests that previously asserted on the standalone gsd-code-review-fix skill name to instead assert on a gsd-code-review invocation carrying --fix in its arg tokens. Tests still parse Skill() invocations structurally; only the asserted skill-name + arg-token shape changed. * test(#2790): scope success_criteria check to the <success_criteria> block CodeRabbit nitpick: 'success criteria includes verification' did a whole-file substring check, which can false-pass if the phrase appears elsewhere in the document. Extract the <success_criteria>...</success_criteria> block first via extractTagBlock() and assert against that scope only. * fix(#2790): post-rebase reconciliation with main - INVENTORY.md/JSON: add reapply-patches workflow row + bump count to 85 - autonomous.md: switch consolidated --fix invocation to hyphen Skill name - analyze-dependencies test: assert COMMANDS.md does NOT document the consolidated-away /gsd-analyze-dependencies entry (was: bare .includes()) * fix(#2790): address remaining CR findings — strengthen contract tests Doc-fixes: - INVENTORY.md: route transition.md & edit-phase.md rows to consolidated /gsd-progress --next and /gsd-phase --edit (was: deleted /gsd-next, /gsd-edit-phase) - config.md --profile branch: document #2439 pre-flight `command -v gsd-sdk` guard + install hint BEFORE the gsd-sdk invocation (closes opaque "command not found: gsd-sdk" regression path) Test discipline (no-source-grep contract): - bug-2439: replace bare `content.includes('gsd-sdk')` with structured parse of <context> block + --profile branch; assert pre-flight token, install hint, #2439 citation, and ordering vs gsd-sdk invocation - edit-phase: parse INVENTORY.md edit-phase.md row's "Invoked by" column and assert `/gsd-phase --edit` (not the deleted /gsd-edit-phase) - next-safety-gates: tighten `--next` documentation contract — require --next AND --force AND completeness routing (was OR-based, passed when only --next present) - reapply-patches: parse argument-hint flag list structurally; scan ALL <execution_context*> blocks for the @-include of reapply-patches.md; parse Hunk Verification Table header columns directly; locate Step 5 via heading parsing then assert (i) table reference, (ii) verified=no gate, (iii) STOP/halt directive, (iv) explicit absent-table halt path - workspace: parse frontmatter, tokenize argument-hint across multiple bracketed segments, parse @-include targets from <execution_context> rather than substring-matching the file body --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -371,8 +371,8 @@ Skill(skill="gsd-code-review", args="${PHASE_NUM}")
|
||||
```
|
||||
|
||||
Parse status from REVIEW.md frontmatter. If "clean" or "skipped": proceed to 3d. If findings found: auto-invoke:
|
||||
```text
|
||||
Skill(skill="gsd-code-review-fix", args="${PHASE_NUM} --auto")
|
||||
```
|
||||
Skill(skill="gsd-code-review", args="${PHASE_NUM} --fix --auto")
|
||||
```
|
||||
|
||||
**Error handling:** If either Skill fails, catch the error, display as non-blocking, and proceed to 3d.
|
||||
|
||||
327
get-shit-done/workflows/reapply-patches.md
Normal file
327
get-shit-done/workflows/reapply-patches.md
Normal file
@@ -0,0 +1,327 @@
|
||||
# Reapply Local Patches Workflow
|
||||
|
||||
Invoked by `/gsd-update --reapply` (`commands/gsd/update.md`).
|
||||
|
||||
After a GSD update wipes and reinstalls files, this workflow merges user's previously saved local modifications back into the new version. Uses three-way comparison (pristine baseline, user-modified backup, newly installed version) to reliably distinguish user customizations from version drift.
|
||||
|
||||
**Critical invariant:** Every file in `gsd-local-patches/` was backed up because the installer's hash comparison detected it was modified. The workflow must NEVER conclude "no custom content" for any backed-up file — that is a logical contradiction. When in doubt, classify as CONFLICT requiring user review, not SKIP.
|
||||
|
||||
<process>
|
||||
|
||||
## Step 1: Detect backed-up patches
|
||||
|
||||
Check for local patches directory:
|
||||
|
||||
```bash
|
||||
expand_home() {
|
||||
case "$1" in
|
||||
"~/"*) printf '%s/%s\n' "$HOME" "${1#~/}" ;;
|
||||
*) printf '%s\n' "$1" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
PATCHES_DIR=""
|
||||
|
||||
# Env overrides first — covers custom config directories used with --config-dir
|
||||
if [ -n "$KILO_CONFIG_DIR" ]; then
|
||||
candidate="$(expand_home "$KILO_CONFIG_DIR")/gsd-local-patches"
|
||||
if [ -d "$candidate" ]; then
|
||||
PATCHES_DIR="$candidate"
|
||||
fi
|
||||
elif [ -n "$KILO_CONFIG" ]; then
|
||||
candidate="$(dirname "$(expand_home "$KILO_CONFIG")")/gsd-local-patches"
|
||||
if [ -d "$candidate" ]; then
|
||||
PATCHES_DIR="$candidate"
|
||||
fi
|
||||
elif [ -n "$XDG_CONFIG_HOME" ]; then
|
||||
candidate="$(expand_home "$XDG_CONFIG_HOME")/kilo/gsd-local-patches"
|
||||
if [ -d "$candidate" ]; then
|
||||
PATCHES_DIR="$candidate"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$PATCHES_DIR" ] && [ -n "$OPENCODE_CONFIG_DIR" ]; then
|
||||
candidate="$(expand_home "$OPENCODE_CONFIG_DIR")/gsd-local-patches"
|
||||
if [ -d "$candidate" ]; then
|
||||
PATCHES_DIR="$candidate"
|
||||
fi
|
||||
elif [ -z "$PATCHES_DIR" ] && [ -n "$OPENCODE_CONFIG" ]; then
|
||||
candidate="$(dirname "$(expand_home "$OPENCODE_CONFIG")")/gsd-local-patches"
|
||||
if [ -d "$candidate" ]; then
|
||||
PATCHES_DIR="$candidate"
|
||||
fi
|
||||
elif [ -z "$PATCHES_DIR" ] && [ -n "$XDG_CONFIG_HOME" ]; then
|
||||
candidate="$(expand_home "$XDG_CONFIG_HOME")/opencode/gsd-local-patches"
|
||||
if [ -d "$candidate" ]; then
|
||||
PATCHES_DIR="$candidate"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$PATCHES_DIR" ] && [ -n "$GEMINI_CONFIG_DIR" ]; then
|
||||
candidate="$(expand_home "$GEMINI_CONFIG_DIR")/gsd-local-patches"
|
||||
if [ -d "$candidate" ]; then
|
||||
PATCHES_DIR="$candidate"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$PATCHES_DIR" ] && [ -n "$CODEX_HOME" ]; then
|
||||
candidate="$(expand_home "$CODEX_HOME")/gsd-local-patches"
|
||||
if [ -d "$candidate" ]; then
|
||||
PATCHES_DIR="$candidate"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$PATCHES_DIR" ] && [ -n "$CLAUDE_CONFIG_DIR" ]; then
|
||||
candidate="$(expand_home "$CLAUDE_CONFIG_DIR")/gsd-local-patches"
|
||||
if [ -d "$candidate" ]; then
|
||||
PATCHES_DIR="$candidate"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Global install — detect runtime config directory defaults
|
||||
if [ -z "$PATCHES_DIR" ]; then
|
||||
if [ -d "$HOME/.config/kilo/gsd-local-patches" ]; then
|
||||
PATCHES_DIR="$HOME/.config/kilo/gsd-local-patches"
|
||||
elif [ -d "$HOME/.config/opencode/gsd-local-patches" ]; then
|
||||
PATCHES_DIR="$HOME/.config/opencode/gsd-local-patches"
|
||||
elif [ -d "$HOME/.opencode/gsd-local-patches" ]; then
|
||||
PATCHES_DIR="$HOME/.opencode/gsd-local-patches"
|
||||
elif [ -d "$HOME/.gemini/gsd-local-patches" ]; then
|
||||
PATCHES_DIR="$HOME/.gemini/gsd-local-patches"
|
||||
elif [ -d "$HOME/.codex/gsd-local-patches" ]; then
|
||||
PATCHES_DIR="$HOME/.codex/gsd-local-patches"
|
||||
else
|
||||
PATCHES_DIR="$HOME/.claude/gsd-local-patches"
|
||||
fi
|
||||
fi
|
||||
# Local install fallback — check all runtime directories
|
||||
if [ ! -d "$PATCHES_DIR" ]; then
|
||||
for dir in .config/kilo .kilo .config/opencode .opencode .gemini .codex .claude; do
|
||||
if [ -d "./$dir/gsd-local-patches" ]; then
|
||||
PATCHES_DIR="./$dir/gsd-local-patches"
|
||||
break
|
||||
fi
|
||||
done
|
||||
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: Determine baseline for three-way comparison
|
||||
|
||||
The quality of the merge depends on having a **pristine baseline** — the original unmodified version of each file from the pre-update GSD release. This enables three-way comparison:
|
||||
- **Pristine baseline** (original GSD file before any user edits)
|
||||
- **User's version** (backed up in `gsd-local-patches/`)
|
||||
- **New version** (freshly installed after update)
|
||||
|
||||
Check for baseline sources in priority order:
|
||||
|
||||
### Option A: Pristine hash from backup-meta.json + git history (most reliable)
|
||||
If the config directory is a git repository:
|
||||
```bash
|
||||
CONFIG_DIR=$(dirname "$PATCHES_DIR")
|
||||
if git -C "$CONFIG_DIR" rev-parse --git-dir >/dev/null 2>&1; then
|
||||
HAS_GIT=true
|
||||
fi
|
||||
```
|
||||
When `HAS_GIT=true`, use the `pristine_hashes` recorded in `backup-meta.json` to locate the correct baseline commit. For each file, iterate commits that touched it and find the one whose blob SHA-256 matches the recorded pristine hash:
|
||||
```bash
|
||||
# Get the expected pristine SHA-256 from backup-meta.json
|
||||
PRISTINE_HASH=$(jq -r ".pristine_hashes[\"${file_path}\"] // empty" "$PATCHES_DIR/backup-meta.json")
|
||||
|
||||
BASELINE_COMMIT=""
|
||||
if [ -n "$PRISTINE_HASH" ]; then
|
||||
# Walk commits that touched this file, pick the one matching the pristine hash
|
||||
while IFS= read -r commit_hash; do
|
||||
blob_hash=$(git -C "$CONFIG_DIR" show "${commit_hash}:${file_path}" 2>/dev/null | sha256sum | cut -d' ' -f1)
|
||||
if [ "$blob_hash" = "$PRISTINE_HASH" ]; then
|
||||
BASELINE_COMMIT="$commit_hash"
|
||||
break
|
||||
fi
|
||||
done < <(git -C "$CONFIG_DIR" log --format="%H" -- "${file_path}")
|
||||
fi
|
||||
|
||||
# Fallback: if no pristine hash in backup-meta (older installer), use first-add commit
|
||||
if [ -z "$BASELINE_COMMIT" ]; then
|
||||
BASELINE_COMMIT=$(git -C "$CONFIG_DIR" log --diff-filter=A --format="%H" -- "${file_path}" | tail -1)
|
||||
fi
|
||||
```
|
||||
Extract the pristine version from the matched commit:
|
||||
```bash
|
||||
git -C "$CONFIG_DIR" show "${BASELINE_COMMIT}:${file_path}"
|
||||
```
|
||||
|
||||
**Why this matters:** `git log --diff-filter=A` returns the commit that *first added* the file, which is the wrong baseline on repos that have been through multiple GSD update cycles. The `pristine_hashes` field in `backup-meta.json` records the SHA-256 of the file as it existed in the pre-update GSD release — matching against it finds the correct baseline regardless of how many updates have occurred.
|
||||
|
||||
### Option B: Pristine snapshot directory
|
||||
Check if a `gsd-pristine/` directory exists alongside `gsd-local-patches/`:
|
||||
```bash
|
||||
PRISTINE_DIR="$CONFIG_DIR/gsd-pristine"
|
||||
```
|
||||
If it exists, the installer saved pristine copies at install time. Use these as the baseline.
|
||||
|
||||
### Option C: No baseline available (two-way fallback)
|
||||
If neither git history nor pristine snapshots are available, fall back to two-way comparison — but with **strengthened heuristics** (see Step 3).
|
||||
|
||||
## Step 3: Show patch summary
|
||||
|
||||
```
|
||||
## Local Patches to Reapply
|
||||
|
||||
**Backed up from:** v{from_version}
|
||||
**Current version:** {read VERSION file}
|
||||
**Files modified:** {count}
|
||||
**Merge strategy:** {three-way (git) | three-way (pristine) | two-way (enhanced)}
|
||||
|
||||
| # | File | Status |
|
||||
|---|------|--------|
|
||||
| 1 | {file_path} | Pending |
|
||||
| 2 | {file_path} | Pending |
|
||||
```
|
||||
|
||||
## Step 4: Merge each file
|
||||
|
||||
For each file in `backup-meta.json`:
|
||||
|
||||
1. **Read the backed-up version** (user's modified copy from `gsd-local-patches/`)
|
||||
2. **Read the newly installed version** (current file after update)
|
||||
3. **If available, read the pristine baseline** (from git history or `gsd-pristine/`)
|
||||
|
||||
### Three-way merge (when baseline is available)
|
||||
|
||||
Compare the three versions to isolate changes:
|
||||
- **User changes** = diff(pristine → user's version) — these are the customizations to preserve
|
||||
- **Upstream changes** = diff(pristine → new version) — these are version updates to accept
|
||||
|
||||
**Merge rules:**
|
||||
- Sections changed only by user → apply user's version
|
||||
- Sections changed only by upstream → accept upstream version
|
||||
- Sections changed by both → flag as CONFLICT, show both, ask user
|
||||
- Sections unchanged by either → use new version (identical to all three)
|
||||
|
||||
### Two-way merge (fallback when no baseline)
|
||||
|
||||
When no pristine baseline is available, use these **strengthened heuristics**:
|
||||
|
||||
**CRITICAL RULE: Every file in this backup directory was explicitly detected as modified by the installer's SHA-256 hash comparison. "No custom content" is never a valid conclusion.**
|
||||
|
||||
For each file:
|
||||
a. Read both versions completely
|
||||
b. Identify ALL differences, then classify each as:
|
||||
- **Mechanical drift** — path substitutions (e.g. `/Users/xxx/.claude/` → `$HOME/.claude/`), variable additions (`${GSD_WS}`, `${AGENT_SKILLS_*}`), error handling additions (`|| true`)
|
||||
- **User customization** — added steps/sections, removed sections, reordered content, changed behavior, added frontmatter fields, modified instructions
|
||||
|
||||
c. **If ANY differences remain after filtering out mechanical drift → those are user customizations. Merge them.**
|
||||
d. **If ALL differences appear to be mechanical drift → still flag as CONFLICT.** The installer's hash check already proved this file was modified. Ask the user: "This file appears to only have path/variable differences. Were there intentional customizations?" Do NOT silently skip.
|
||||
|
||||
### Git-enhanced two-way merge
|
||||
|
||||
When the config directory is a git repo but the pristine install commit can't be found, use commit history to identify user changes:
|
||||
```bash
|
||||
# Find non-update commits that touched this file
|
||||
git -C "$CONFIG_DIR" log --oneline --no-merges -- "{file_path}" | grep -v "gsd:update\|GSD update\|gsd-install"
|
||||
```
|
||||
Each matching commit represents an intentional user modification. Use the commit messages and diffs to understand what was changed and why.
|
||||
|
||||
4. **Write merged result** to the installed location
|
||||
|
||||
### Post-merge verification
|
||||
|
||||
After writing each merged file, verify that user modifications survived the merge:
|
||||
|
||||
1. **Line-count check:** Count lines in the backup and the merged result. If the merged result has fewer lines than the backup minus the expected upstream removals, flag for review.
|
||||
2. **Hunk presence check:** For each user-added section identified during diff analysis, search the merged output for at least the first significant line (non-blank, non-comment) of each addition. Missing signature lines indicate a dropped hunk.
|
||||
3. **Report warnings inline** (do not block):
|
||||
```
|
||||
⚠ Potential dropped content in {file_path}:
|
||||
- Missing hunk near line {N}: "{first_line_preview}..." ({line_count} lines)
|
||||
- Backup available: {patches_dir}/{file_path}
|
||||
```
|
||||
4. **Produce a Hunk Verification Table** — one row per hunk per file. This table is **mandatory output** and must be produced before Step 5 can proceed. Format:
|
||||
|
||||
| file | hunk_id | signature_line | line_count | verified |
|
||||
|------|---------|----------------|------------|----------|
|
||||
| {file_path} | {N} | {first_significant_line} | {count} | yes |
|
||||
| {file_path} | {N} | {first_significant_line} | {count} | no |
|
||||
|
||||
- `hunk_id` — sequential integer per file (1, 2, 3…)
|
||||
- `signature_line` — first non-blank, non-comment line of the user-added section
|
||||
- `line_count` — total lines in the hunk
|
||||
- `verified` — `yes` if the signature_line is present in the merged output, `no` otherwise
|
||||
|
||||
5. **Track verification status** — add to per-file report: `Merged (verified)` vs `Merged (⚠ {N} hunks may be missing)`
|
||||
|
||||
6. **Report status per file:**
|
||||
- `Merged` — user modifications applied cleanly (show summary of what was preserved)
|
||||
- `Conflict` — user reviewed and chose resolution
|
||||
- `Incorporated` — user's modification was already adopted upstream (only valid when pristine baseline confirms this)
|
||||
|
||||
**Never report `Skipped — no custom content`.** If a file is in the backup, it has custom content.
|
||||
|
||||
## Step 5: Hunk Verification Gate
|
||||
|
||||
Before proceeding to cleanup, evaluate the Hunk Verification Table produced in Step 4.
|
||||
|
||||
**If the Hunk Verification Table is absent** (Step 4 did not produce it), STOP immediately and report to the user:
|
||||
```
|
||||
ERROR: Hunk Verification Table is missing. Post-merge verification was not completed.
|
||||
Rerun /gsd-update --reapply to retry with full verification.
|
||||
```
|
||||
|
||||
**If any row in the Hunk Verification Table shows `verified: no`**, STOP and report to the user:
|
||||
```
|
||||
ERROR: {N} hunk(s) failed verification — content may have been dropped during merge.
|
||||
|
||||
Unverified hunks:
|
||||
{file} hunk {hunk_id}: signature line "{signature_line}" not found in merged output
|
||||
|
||||
The backup is preserved at: {patches_dir}/{file}
|
||||
Review the merged file manually, then either:
|
||||
(a) Re-merge the missing content by hand, or
|
||||
(b) Restore from backup: cp {patches_dir}/{file} {installed_path}
|
||||
```
|
||||
|
||||
Do not proceed to cleanup until the user confirms they have resolved all unverified hunks.
|
||||
|
||||
**Only when all rows show `verified: yes`** (or when all files had zero user-added hunks) may execution continue to Step 6.
|
||||
|
||||
## Step 6: Cleanup option
|
||||
|
||||
Ask user:
|
||||
- "Keep patch backups for reference?" → preserve `gsd-local-patches/`
|
||||
- "Clean up patch backups?" → remove `gsd-local-patches/` directory
|
||||
|
||||
## Step 7: Report
|
||||
|
||||
```
|
||||
## Patches Reapplied
|
||||
|
||||
| # | File | Result | User Changes Preserved |
|
||||
|---|------|--------|----------------------|
|
||||
| 1 | {file_path} | Merged | Added step X, modified section Y |
|
||||
| 2 | {file_path} | Incorporated | Already in upstream v{version} |
|
||||
| 3 | {file_path} | Conflict resolved | User chose: keep custom section |
|
||||
|
||||
{count} file(s) updated. Your local modifications are active again.
|
||||
```
|
||||
|
||||
</process>
|
||||
|
||||
<success_criteria>
|
||||
- [ ] All backed-up patches processed — zero files left unhandled
|
||||
- [ ] No file classified as "no custom content" or "SKIP" — every backed-up file is definitionally modified
|
||||
- [ ] Three-way merge used when pristine baseline available (git history or gsd-pristine/)
|
||||
- [ ] User modifications identified and merged into new version
|
||||
- [ ] Conflicts surfaced to user with both versions shown
|
||||
- [ ] Status reported for each file with summary of what was preserved
|
||||
- [ ] Post-merge verification checks each file for dropped hunks and warns if content appears missing
|
||||
</success_criteria>
|
||||
@@ -573,7 +573,7 @@ Check for gsd-local-patches/backup-meta.json in the config directory.
|
||||
|
||||
```
|
||||
Local patches were backed up before the update.
|
||||
Run /gsd-reapply-patches to merge your modifications into the new version.
|
||||
Run /gsd-update --reapply to merge your modifications into the new version.
|
||||
```
|
||||
|
||||
**If no patches:** Continue normally.
|
||||
|
||||
Reference in New Issue
Block a user