mirror of
https://github.com/garrytan/gstack.git
synced 2026-09-09 14:38:59 +02:00
fix(upgrade): migrations see the real install dir; stash can no longer resurrect stale renders
Two ways the v1.67 render-dirt cleanup was inert in the wired upgrade flow:
- Both migration runners invoked `bash "$migration"` without
GSTACK_INSTALL_DIR, so migrations that clean the INSTALL (v1.67.0.0.sh
defaults to ~/.claude/skills/gstack when unset) silently no-oped for
repo-local installs. setup now passes "$SOURCE_GSTACK_DIR" and the
/gstack-upgrade Step 4.75 runner passes the detected "$INSTALL_DIR".
- /gstack-upgrade Step 4 ran `git stash` BEFORE reset+setup, so the tree
was always clean by the time the migration ran, the legacy render dirt
landed in stash@{0}, and Step 4's own note then told the user to
`git stash pop` — restoring stale generated SKILL.md over the fresh
checkout permanently. Step 4 now discards the render footprint
(generated SKILL.md and sections/*.md modifications only, the same
classification as migrations/v1.67.0.0.sh) BEFORE stashing, so the stash
only ever carries real user changes; the stash-pop note says the render
dirt was discarded and regenerates. The migration stays for manual
git-pull flows.
Template change regenerated for all 3 hosts (claude tree checked in;
codex/factory trees are gitignored render outputs).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
2f8638a3e2
commit
68006e219c
+15
-2
@@ -128,12 +128,22 @@ Use the install type and directory detected in Step 2:
|
||||
**For git installs** (global-git, local-git):
|
||||
```bash
|
||||
cd "$INSTALL_DIR"
|
||||
# Discard render-footprint dirt BEFORE stashing (#2569): pre-v1.67
|
||||
# gbrain-enabled installs ran gen:skill-docs:user IN PLACE, leaving
|
||||
# generated SKILL.md / sections/*.md files permanently modified. Stashing
|
||||
# that dirt poisons the stash: the post-upgrade `git stash pop` would
|
||||
# restore STALE generated markdown over the fresh checkout permanently.
|
||||
# These files are regenerable (setup re-renders brain-aware variants to
|
||||
# ~/.gstack/render), so discarding is lossless; anything else the user
|
||||
# changed still reaches the stash untouched. Same file classification as
|
||||
# migrations/v1.67.0.0.sh, which remains for manual git-pull flows.
|
||||
git checkout -- 'SKILL.md' '*/SKILL.md' '*/sections/*.md' 2>/dev/null || true
|
||||
STASH_OUTPUT=$(git stash 2>&1)
|
||||
git fetch origin
|
||||
git reset --hard origin/main
|
||||
./setup
|
||||
```
|
||||
If `$STASH_OUTPUT` contains "Saved working directory", warn the user: "Note: local changes were stashed. Run `git stash pop` in the skill directory to restore them."
|
||||
If `$STASH_OUTPUT` contains "Saved working directory", warn the user: "Note: local changes were stashed (any modified generated SKILL.md/sections files were discarded first — they regenerate on setup). Run `git stash pop` in the skill directory to restore your own changes."
|
||||
|
||||
**For vendored installs** (vendored, vendored-global):
|
||||
```bash
|
||||
@@ -210,7 +220,10 @@ if [ -d "$MIGRATIONS_DIR" ]; then
|
||||
# (simple string compare works for dotted versions with same segment count)
|
||||
if [ "$OLD_VERSION" != "unknown" ] && [ "$(printf '%s\n%s' "$OLD_VERSION" "$m_ver" | sort -V | head -1)" = "$OLD_VERSION" ] && [ "$OLD_VERSION" != "$m_ver" ]; then
|
||||
echo "Running migration $m_ver..."
|
||||
bash "$migration" || echo " Warning: migration $m_ver had errors (non-fatal)"
|
||||
# GSTACK_INSTALL_DIR: migrations that clean the INSTALL (not just
|
||||
# ~/.gstack state) default to ~/.claude/skills/gstack when unset —
|
||||
# a repo-local install would silently no-op without this.
|
||||
GSTACK_INSTALL_DIR="$INSTALL_DIR" bash "$migration" || echo " Warning: migration $m_ver had errors (non-fatal)"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
@@ -125,12 +125,22 @@ Use the install type and directory detected in Step 2:
|
||||
**For git installs** (global-git, local-git):
|
||||
```bash
|
||||
cd "$INSTALL_DIR"
|
||||
# Discard render-footprint dirt BEFORE stashing (#2569): pre-v1.67
|
||||
# gbrain-enabled installs ran gen:skill-docs:user IN PLACE, leaving
|
||||
# generated SKILL.md / sections/*.md files permanently modified. Stashing
|
||||
# that dirt poisons the stash: the post-upgrade `git stash pop` would
|
||||
# restore STALE generated markdown over the fresh checkout permanently.
|
||||
# These files are regenerable (setup re-renders brain-aware variants to
|
||||
# ~/.gstack/render), so discarding is lossless; anything else the user
|
||||
# changed still reaches the stash untouched. Same file classification as
|
||||
# migrations/v1.67.0.0.sh, which remains for manual git-pull flows.
|
||||
git checkout -- 'SKILL.md' '*/SKILL.md' '*/sections/*.md' 2>/dev/null || true
|
||||
STASH_OUTPUT=$(git stash 2>&1)
|
||||
git fetch origin
|
||||
git reset --hard origin/main
|
||||
./setup
|
||||
```
|
||||
If `$STASH_OUTPUT` contains "Saved working directory", warn the user: "Note: local changes were stashed. Run `git stash pop` in the skill directory to restore them."
|
||||
If `$STASH_OUTPUT` contains "Saved working directory", warn the user: "Note: local changes were stashed (any modified generated SKILL.md/sections files were discarded first — they regenerate on setup). Run `git stash pop` in the skill directory to restore your own changes."
|
||||
|
||||
**For vendored installs** (vendored, vendored-global):
|
||||
```bash
|
||||
@@ -207,7 +217,10 @@ if [ -d "$MIGRATIONS_DIR" ]; then
|
||||
# (simple string compare works for dotted versions with same segment count)
|
||||
if [ "$OLD_VERSION" != "unknown" ] && [ "$(printf '%s\n%s' "$OLD_VERSION" "$m_ver" | sort -V | head -1)" = "$OLD_VERSION" ] && [ "$OLD_VERSION" != "$m_ver" ]; then
|
||||
echo "Running migration $m_ver..."
|
||||
bash "$migration" || echo " Warning: migration $m_ver had errors (non-fatal)"
|
||||
# GSTACK_INSTALL_DIR: migrations that clean the INSTALL (not just
|
||||
# ~/.gstack state) default to ~/.claude/skills/gstack when unset —
|
||||
# a repo-local install would silently no-op without this.
|
||||
GSTACK_INSTALL_DIR="$INSTALL_DIR" bash "$migration" || echo " Warning: migration $m_ver had errors (non-fatal)"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
@@ -1731,7 +1731,11 @@ if [ -d "$MIGRATIONS_DIR" ] && [ "$CURRENT_VERSION" != "unknown" ] && [ "$LAST_S
|
||||
if [ "$(printf '%s\n%s' "$LAST_SETUP_VERSION" "$m_ver" | sort -V | head -1)" = "$LAST_SETUP_VERSION" ] && [ "$LAST_SETUP_VERSION" != "$m_ver" ] \
|
||||
&& [ "$(printf '%s\n%s' "$m_ver" "$CURRENT_VERSION" | sort -V | tail -1)" = "$CURRENT_VERSION" ]; then
|
||||
echo " running migration $m_ver..."
|
||||
bash "$migration" || echo " warning: migration $m_ver had errors (non-fatal)"
|
||||
# GSTACK_INSTALL_DIR: migrations that clean the INSTALL (not just
|
||||
# ~/.gstack state) default to ~/.claude/skills/gstack when unset —
|
||||
# a repo-local ./setup would silently no-op them against the wrong
|
||||
# tree without this.
|
||||
GSTACK_INSTALL_DIR="$SOURCE_GSTACK_DIR" bash "$migration" || echo " warning: migration $m_ver had errors (non-fatal)"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user