agentleFS
Upsolve-LabsUpsolve-Labs/upstack/skills/upgrade/SKILL.md

upgrade

Skill17 starsChanged 8 months agoMITView on GitHub

Upgrade upstack to the latest version. Detects global vs vendored install, runs the upgrade, and shows what's new.

  • Deletes or force-pushes

14 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use status, init and 2 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • AnthropicSkill

    status

    Case status summary by audience — client-facing (plain language), internal (for the professor), or court-ready (formal caption format per local rules). Same facts, different framing and depth. Use when a student needs to update the client, brief the professor, or prepare a court status report.

    Also in 3 projects that use this

  • MicrosoftSkill

    init

    Generate or update chat customization files for AI coding agents

    Also in 3 projects that use this

  • OpenAISkill

    audit

    Audit or critique a product flow, journey, workflow, funnel, onboarding path, checkout path, settings path, screen, or multi-step product experience by capturing screenshots first, then reporting UX, design, and accessibility findings inline from that evidence. Use Figma only when the user explicitly asks for a board. Use when the user asks to audit, review, critique, inspect, assess, analyze, evaluate, or give feedback on a product experience.

    Also in 3 projects that use this

  • MicrosoftSkill

    release

    Use ONLY when the user explicitly asks to cut/publish a Huabu desktop release or tag a version. Performs an outward action — bumps the version in apps/desktop/package.json, commits + annotated-tags vX.Y.Z, and pushes the branch + tag. That tag push auto-builds the macOS/Windows installers and publishes a GitHub Release. Provides `status`, `bump`, `tag-push`, and a one-command `run` (bump → tag-push).

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

7 rules. 0 are common, 3 are distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 9 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If "Not now": Write snooze state with escalating backoff (first snooze = 24h, second = 48h, third+ = 1 week), then continue with the …

    line 45
  2. Very specific:

    If $STASH_OUTPUT contains "Saved working directory", warn the user: "Note: local changes were stashed.

    line 116
  3. Distinctive:

    After upgrading the primary install, check if there's also a local copy in the current project that needs updating:

    line 132
  4. Very specific:

    If LOCAL_UPSTACK is non-empty, update it by copying from the freshly-upgraded primary install:

    line 147
  5. Very specific:

    Read $INSTALL_DIR/CHANGELOG.md.

    line 170
  6. Distinctive:

    After showing What's New, continue with whatever skill the user originally invoked.

    line 187
  7. Very specific:

    When invoked directly as /upgrade (not from a preamble), follow Steps 2-6 above.

    line 193

“Common” is measured: kept by at least 6 in 10 of the 9 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

/upgrade

Upgrade upstack to the latest version and show what's new.

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:

_AUTO=""
[ "${UPSTACK_AUTO_UPGRADE:-}" = "1" ] && _AUTO="true"
[ -z "$_AUTO" ] && _AUTO=$(~/.claude/skills/upstack/bin/upstack-config get auto_upgrade 2>/dev/null || .claude/skills/upstack/bin/upstack-config get auto_upgrade 2>/dev/null || true)
echo "AUTO_UPGRADE=$_AUTO"

If AUTO_UPGRADE=true or AUTO_UPGRADE=1: Skip AskUserQuestion. Log "Auto-upgrading upstack v{old} → v{new}..." and proceed directly to Step 2. If ./install.sh fails during auto-upgrade, restore from backup (.bak directory) and warn the user: "Auto-upgrade failed — restored previous version. Run /upgrade manually to retry."

Otherwise, use AskUserQuestion:

  • Question: "upstack v{new} is available (you're on v{old}). 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":

~/.claude/skills/upstack/bin/upstack-config set auto_upgrade true 2>/dev/null || .claude/skills/upstack/bin/upstack-config set auto_upgrade true 2>/dev/null

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.

_SNOOZE_FILE="${UPSTACK_STATE_DIR:-$HOME/.upstack}/update-snoozed"
_REMOTE_VER="{new}"
_CUR_LEVEL=0
if [ -f "$_SNOOZE_FILE" ]; then
  _SNOOZED_VER=$(awk '{print $1}' "$_SNOOZE_FILE")
  if [ "$_SNOOZED_VER" = "$_REMOTE_VER" ]; then
    _CUR_LEVEL=$(awk '{print $2}' "$_SNOOZE_FILE")
    case "$_CUR_LEVEL" in *[!0-9]*) _CUR_LEVEL=0 ;; esac
  fi
fi
_NEW_LEVEL=$((_CUR_LEVEL + 1))
[ "$_NEW_LEVEL" -gt 3 ] && _NEW_LEVEL=3
echo "$_REMOTE_VER $_NEW_LEVEL $(date +%s)" > "$_SNOOZE_FILE"

Note: {new} is the remote version from the UPGRADE_AVAILABLE output — substitute it from the update check result.

Tell user the snooze duration: "Next reminder in 24h" (or 48h or 1 week, depending on level). Tip: "Set auto_upgrade: true in ~/.upstack/config.yaml for automatic upgrades."

If "Never ask again":

~/.claude/skills/upstack/bin/upstack-config set update_check false 2>/dev/null || .claude/skills/upstack/bin/upstack-config set update_check false 2>/dev/null

Tell user: "Update checks disabled. Run ~/.claude/skills/upstack/bin/upstack-config set update_check true to re-enable." Continue with the current skill.

Step 2: Detect install type

if [ -d "$HOME/.claude/skills/upstack/.git" ]; then
  INSTALL_TYPE="global-git"
  INSTALL_DIR="$HOME/.claude/skills/upstack"
elif [ -d ".claude/skills/upstack/.git" ]; then
  INSTALL_TYPE="local-git"
  INSTALL_DIR=".claude/skills/upstack"
elif [ -d ".claude/skills/upstack" ]; then
  INSTALL_TYPE="vendored"
  INSTALL_DIR=".claude/skills/upstack"
elif [ -d "$HOME/.claude/skills/upstack" ]; then
  INSTALL_TYPE="vendored-global"
  INSTALL_DIR="$HOME/.claude/skills/upstack"
else
  echo "ERROR: upstack not found"
  exit 1
fi
echo "Install type: $INSTALL_TYPE at $INSTALL_DIR"

Step 3: Save old version

OLD_VERSION=$(cat "$INSTALL_DIR/VERSION" 2>/dev/null || echo "unknown")

Step 4: Upgrade

For git installs (global-git, local-git):

cd "$INSTALL_DIR"
STASH_OUTPUT=$(git stash 2>&1)
git fetch origin
git reset --hard origin/main
./install.sh

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."

For vendored installs (vendored, vendored-global):

PARENT=$(dirname "$INSTALL_DIR")
TMP_DIR=$(mktemp -d)
git clone --depth 1 https://github.com/Upsolve-Labs/upstack.git "$TMP_DIR/upstack"
mv "$INSTALL_DIR" "$INSTALL_DIR.bak"
mv "$TMP_DIR/upstack" "$INSTALL_DIR"
cd "$INSTALL_DIR" && ./install.sh
rm -rf "$INSTALL_DIR.bak" "$TMP_DIR"

Step 4.5: Sync local vendored copy

After upgrading the primary install, check if there's also a local copy in the current project that needs updating:

_ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
LOCAL_UPSTACK=""
if [ -n "$_ROOT" ] && [ -d "$_ROOT/.claude/skills/upstack" ]; then
  _RESOLVED_LOCAL=$(cd "$_ROOT/.claude/skills/upstack" && pwd -P)
  _RESOLVED_PRIMARY=$(cd "$INSTALL_DIR" && pwd -P)
  if [ "$_RESOLVED_LOCAL" != "$_RESOLVED_PRIMARY" ]; then
    LOCAL_UPSTACK="$_ROOT/.claude/skills/upstack"
  fi
fi
echo "LOCAL_UPSTACK=$LOCAL_UPSTACK"

If LOCAL_UPSTACK is non-empty, update it by copying from the freshly-upgraded primary install:

mv "$LOCAL_UPSTACK" "$LOCAL_UPSTACK.bak"
cp -Rf "$INSTALL_DIR" "$LOCAL_UPSTACK"
rm -rf "$LOCAL_UPSTACK/.git"
cd "$LOCAL_UPSTACK" && ./install.sh
rm -rf "$LOCAL_UPSTACK.bak"

Tell user: "Also updated vendored copy at $LOCAL_UPSTACK — commit .claude/skills/upstack/ when you're ready."

Step 5: Write marker + clear cache

mkdir -p "${UPSTACK_STATE_DIR:-$HOME/.upstack}"
echo "$OLD_VERSION" > "${UPSTACK_STATE_DIR:-$HOME/.upstack}/just-upgraded-from"
rm -f "${UPSTACK_STATE_DIR:-$HOME/.upstack}/last-update-check"
rm -f "${UPSTACK_STATE_DIR:-$HOME/.upstack}/update-snoozed"

Step 6: Show What's New

Read $INSTALL_DIR/CHANGELOG.md. Find all version entries between the old version and the new version. Summarize as 5-7 bullets grouped by theme. Focus on user-facing changes.

Format:

upstack v{new} — upgraded from v{old}!

What's new:
- [bullet 1]
- [bullet 2]
- ...

Happy shipping!

Step 7: Continue

After showing What's New, continue with whatever skill the user originally invoked. The upgrade is done — no further action needed.


Standalone usage

When invoked directly as /upgrade (not from a preamble), follow Steps 2-6 above. If already on the latest version, tell the user: "You're already on the latest version (v{version})."

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.