garrytan/gstack/gstack-upgrade
Claude Code and agent skill by garrytan/gstack
- community
Checking that the SKILL.md file is still in the repository.
Upgrade gstack to the latest version. Use for: upgrade gstack, update gstack version.
Install
npx vskill@latest install garrytan/gstack/gstack-upgradeSKILL.md
The same SKILL.md was published earlier as garrytan/gstack/gstack-upgrade.
/gstack-upgrade
Inline upgrade flow
This section is referenced by all skill preambles when they detect UPGRADE_AVAILABLE.
Step 1: Ask the user (or auto-upgrade)
First, check if auto-upgrade is enabled:
If `AUTO_UPGRADE=true` or `AUTO_UPGRADE=1`: Skip AskUserQuestion. Log "Auto-upgrading gstack v{old} → v{new}..." and proceed directly to Step 2. On setup failure, follow Step 4's install-specific recovery: vendored installs restore their backup; git installs stop with the pre-upgrade commit recorded, without a destructive reset. Never claim restoration unless it actually succeeded.
Otherwise, use AskUserQuestion:
- Question: "gstack v{new} is available (you're on v{old}). Upgrade now?"
Four fields (UPGRADE_AVAILABLE <old> <old>+<n> <sha>, main moved): ask "gstack main is {n} commit(s) past v{old} (at {sha}). Upgrade now?"
- Options: ["Yes, upgrade now", "Always keep me up to date", "Not now", "Never ask again"]
If "Yes, upgrade now": Proceed to Step 2.
If "Always keep me up to date":
Tell user: "Auto-upgrade enabled. Future updates will install automatically." Then proceed to Step 2.
If "Not now": Write snooze state with escalating backoff (first snooze = 24h, second = 48h, third+ = 1 week), then continue with the current skill. Do not mention the upgrade again.
Note: {line} is the whole UPGRADE_AVAILABLE line, exactly as printed; the snippet picks the field gstack-update-check reads.
Tell user the snooze duration: "Next reminder in 24h" (or 48h or 1 week, depending on level). Tip: "Set auto_upgrade: true in ~/.gstack/config.yaml for automatic upgrades."
If "Never ask again":
Tell user: "Update checks disabled. Run ~/.claude/skills/gstack/bin/gstack-config set update_check true to re-enable." Continue with the current skill.
Step 2: Detect install type
The install type and the absolute directory printed above are used in all subsequent steps. Carry INSTALL_TYPE, INSTALL_DIR, OLD_VERSION, and later UPSTREAM_REF and NEW_VERSION forward explicitly: tool calls may run in fresh shells, so start each later block by assigning them from the captured output (for example INSTALL_DIR=/abs/path/printed/above). Do not rely on a prior call's working directory or shell variables. Every block that changes files first checks INSTALL_DIR and stops before any git command when it is unset, empty, missing, unreadable, or not gstack's own checkout.
Step 3: Save old version
Use the install directory from Step 2's output below:
Step 4: Upgrade
Use the install type and directory detected in Step 2:
For git installs (global-git, local-git):
Fast-forward first, through bin/gstack-ff-update, the same code the session-update auto-upgrade uses: local edits that merge cleanly ride over the update, and an edit that conflicts (or a staged change, or an unmerged file) is saved in a rescue ref instead of being left as conflict markers:
Setup's --refresh-registered refreshes every install this checkout registered (each host, global and this project's), prints the source first, and ends with an Upgrade summary of one row per install. Relay those rows as printed. A failed row means that host kept its previous install; give its retry command and never say every host was refreshed. A skipped row belongs to another checkout or project; pass on its command, do not run it.
If the output ends with FF_OK, the upgrade is done — skip the fallback below entirely. When the line before it reads rescued <old> <new> refs/gstack/rescue/<oid> unmerged=<0|1>, tell the user their conflicting local edits were saved there and relay the Inspect, Export and Delete commands the script printed (export into a scratch checkout with git apply -3, never stash apply in the install; unmerged=1 means the rescue needs manual resolution). On FF_STOPPED, STOP and relay the reason: nothing was changed. On AHEAD_OF_STABLE, STOP: the checkout is already past the latest stable release, so nothing changes until the next cut (gstack-config set update_channel main follows every merge). On a fetching origin/stable failed line above, STOP and relay it; nothing was changed. ff-busy means another gstack update is running (retry in a minute); autostash-unrecoverable names what is in the way (an untracked file the release adds, or another git command); index-unreadable means the checkout's index is damaged. On BUN_TOO_OLD, STOP: tell the user to run bun upgrade, then /gstack-upgrade again. On BUN_VERSION_UNREADABLE, STOP: bun --version did not print a version gstack can read, so bun upgrade may not run either; tell the user to reinstall Bun from https://bun.sh (curl -fsSL https://bun.sh/install | bash in Git Bash or a macOS/Linux terminal), check that bun --version prints a version such as 1.4.2, then run /gstack-upgrade again (docs/troubleshooting.md#bun-version-unreadable). On SETUP_FAILED, STOP; keep user changes and report the recovery commit. There is no .bak on the git path. Do not enter the divergence fallback merely because setup failed. Enter it only on FF_REFUSED (local commits or a diverged history); network/auth failures stop for repair, not reset.
Fallback (ff-only refused — local commits or divergence). git reset --hard DESTROYS things: a clean tree with unpushed local commits still loses those commits. Gate it:
- Run
git status --porcelainandgit rev-list "${UPSTREAM_REF:?}"..HEAD --oneline
in $INSTALL_DIR.
- If BOTH are empty, the reset is provably safe — run the fallback block
below without asking.
- Otherwise ask via AskUserQuestion (one-way door — destructive), listing
exactly what will be discarded: each dirty file and each unpushed commit by hash + subject. Options: A) Discard them and upgrade (reset) — requires the explicit letter; B) Abort the upgrade so the user can rescue their work first (recommended when local commits exist). Never proceed on a vague reply.
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."
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckinggstack-upgrade/SKILL.md
Popularity
- Repository stars
- 130,235
- Repository forks
- 19,586
- 7-day trend score
- 59
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/garrytan/gstack/gstack-upgrade)