Files
msd-core/commands/gsd/update.md
Solvely-Colin 83845755b3 fix: update command respects local vs global install
Fixes #363

The update command was hardcoded to use --global flag, which would
convert a local installation to a global one during updates.

Changes:
- Detect install type by checking ./.claude/ first, then ~/.claude/
- Use --local flag when updating a local install
- Use --global flag when updating a global install
- Update cache cleanup path to match install location
- Clarify warning message paths to be relative to install location
2026-02-03 11:11:00 -06:00

4.9 KiB

name, description
name description
gsd:update Update GSD to latest version with changelog display
Check for GSD updates, install if available, and display what changed.

Provides a better update experience than raw npx get-shit-done-cc by showing version diff and changelog entries.

Detect whether GSD is installed locally or globally by checking both locations:
# Check local first (takes priority)
if [ -f "./.claude/get-shit-done/VERSION" ]; then
  cat "./.claude/get-shit-done/VERSION"
  echo "LOCAL"
elif [ -f ~/.claude/get-shit-done/VERSION ]; then
  cat ~/.claude/get-shit-done/VERSION
  echo "GLOBAL"
else
  echo "UNKNOWN"
fi

Parse output:

  • If last line is "LOCAL": installed version is first line, use --local flag for update
  • If last line is "GLOBAL": installed version is first line, use --global flag for update
  • If "UNKNOWN": proceed to install step (treat as version 0.0.0)

If VERSION file missing:

## GSD Update

**Installed version:** Unknown

Your installation doesn't include version tracking.

Running fresh install...

Proceed to install step (treat as version 0.0.0 for comparison).

Check npm for latest version:
npm view get-shit-done-cc version 2>/dev/null

If npm check fails:

Couldn't check for updates (offline or npm unavailable).

To update manually: `npx get-shit-done-cc --global`

STOP here if npm unavailable.

Compare installed vs latest:

If installed == latest:

## GSD Update

**Installed:** X.Y.Z
**Latest:** X.Y.Z

You're already on the latest version.

STOP here if already up to date.

If installed > latest:

## GSD Update

**Installed:** X.Y.Z
**Latest:** A.B.C

You're ahead of the latest release (development version?).

STOP here if ahead.

**If update available**, fetch and show what's new BEFORE updating:
  1. Fetch changelog (same as fetch_changelog step)
  2. Extract entries between installed and latest versions
  3. Display preview and ask for confirmation:
## GSD Update Available

**Installed:** 1.5.10
**Latest:** 1.5.15

### What's New
────────────────────────────────────────────────────────────

## [1.5.15] - 2026-01-20

### Added
- Feature X

## [1.5.14] - 2026-01-18

### Fixed
- Bug fix Y

────────────────────────────────────────────────────────────

⚠️  **Note:** The installer performs a clean install of GSD folders:
- `commands/gsd/` will be wiped and replaced
- `get-shit-done/` will be wiped and replaced
- `agents/gsd-*` files will be replaced

(Paths are relative to your install location: `~/.claude/` for global, `./.claude/` for local)

Your custom files in other locations are preserved:
- Custom commands not in `commands/gsd/` ✓
- Custom agents not prefixed with `gsd-` ✓
- Custom hooks ✓
- Your CLAUDE.md files ✓

If you've modified any GSD files directly, back them up first.

Use AskUserQuestion:

  • Question: "Proceed with update?"
  • Options:
    • "Yes, update now"
    • "No, cancel"

If user cancels: STOP here.

Run the update using the install type detected in step 1:

If LOCAL install:

npx get-shit-done-cc --local

If GLOBAL install (or unknown):

npx get-shit-done-cc --global

Capture output. If install fails, show error and STOP.

Clear the update cache so statusline indicator disappears:

If LOCAL install:

rm -f ./.claude/cache/gsd-update-check.json

If GLOBAL install:

rm -f ~/.claude/cache/gsd-update-check.json
Format completion message (changelog was already shown in confirmation step):
╔═══════════════════════════════════════════════════════════╗
║  GSD Updated: v1.5.10 → v1.5.15                           ║
╚═══════════════════════════════════════════════════════════╝

⚠️  Restart Claude Code to pick up the new commands.

[View full changelog](https://github.com/glittercowboy/get-shit-done/blob/main/CHANGELOG.md)

<success_criteria>

  • Installed version read correctly
  • Latest version checked via npm
  • Update skipped if already current
  • Changelog fetched and displayed BEFORE update
  • Clean install warning shown
  • User confirmation obtained
  • Update executed successfully
  • Restart reminder shown </success_criteria>