upgrade

GitHub

用于升级 NotFair 插件至最新版本。通过更新市场仓库、安装新版本到缓存并修改 installed_plugins.json 记录,实现自动或手动升级流程。

notfair-upgrade-skill/SKILL.md nowork-studio/notfair-plugin

Trigger Scenarios

用户要求升级 NotFair 插件 技能检测到 UPGRADE_AVAILABLE 状态

Install

npx skills add nowork-studio/notfair-plugin --skill upgrade -g -y
More Options

Non-standard path

npx skills add https://github.com/nowork-studio/notfair-plugin/tree/main/notfair-upgrade-skill -g -y

Use without installing

npx skills use nowork-studio/notfair-plugin@upgrade

指定 Agent (Claude Code)

npx skills add nowork-studio/notfair-plugin --skill upgrade -a claude-code -g -y

安装 repo 全部 skill

npx skills add nowork-studio/notfair-plugin --all -g -y

预览 repo 内 skill

npx skills add nowork-studio/notfair-plugin --list

SKILL.md

Frontmatter
{
    "name": "upgrade",
    "description": "Upgrade the NotFair plugin to the latest version. Updates the marketplace repo, installs the new version to the plugin cache, and updates installed_plugins.json. Use when asked to \"upgrade notfair\", \"update notfair\", or \"get latest version\". Also handles inline upgrade prompts when a skill detects UPGRADE_AVAILABLE at startup.\n",
    "allowed-tools": [
        "Bash",
        "Read",
        "AskUserQuestion"
    ],
    "argument-hint": "<or just run '\/notfair:upgrade'>"
}

/notfair:upgrade

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

Key paths

What Path
Marketplace repo ~/.claude/plugins/marketplaces/nowork-studio/
Plugin cache ~/.claude/plugins/cache/nowork-studio/notfair/<version>/
Installed plugins ~/.claude/plugins/installed_plugins.json
Update state ~/.toprank/ (intentionally preserved — see CHANGELOG 0.24.0)

Inline upgrade flow

This section is used when a skill preamble outputs UPGRADE_AVAILABLE.

Step 1: Auto-upgrade

Log "Upgrading NotFair v{old} → v{new}..." and proceed to Step 2.


Step 2: Detect current install

First check for dev symlink (see "Dev symlink detection" section). If detected, stop — do not upgrade.

# Find the currently installed plugin path
INSTALLED_DIR=$(ls -d ~/.claude/plugins/cache/nowork-studio/notfair/*/ 2>/dev/null | grep -v '.bak' | head -1)
if [ -z "$INSTALLED_DIR" ]; then
  echo "ERROR: NotFair plugin not found in cache"; exit 1
fi
MARKETPLACE_DIR="$HOME/.claude/plugins/marketplaces/nowork-studio"
if [ ! -d "$MARKETPLACE_DIR/.git" ]; then
  echo "ERROR: marketplace repo not found at $MARKETPLACE_DIR"; exit 1
fi
echo "Current install: $INSTALLED_DIR"
echo "Marketplace repo: $MARKETPLACE_DIR"

Step 3: Save old version

OLD_VERSION=$(cat "$INSTALLED_DIR/VERSION" 2>/dev/null | tr -d '[:space:]' || echo "unknown")

Step 4: Update marketplace repo and install

cd "$MARKETPLACE_DIR"
git fetch origin
git reset --hard origin/main
NEW_VERSION=$(cat VERSION | tr -d '[:space:]')
GIT_SHA=$(git rev-parse HEAD)

# Create new versioned cache directory
NEW_CACHE_DIR="$HOME/.claude/plugins/cache/nowork-studio/notfair/$NEW_VERSION"
if [ -d "$NEW_CACHE_DIR" ]; then
  rm -rf "$NEW_CACHE_DIR"
fi
mkdir -p "$NEW_CACHE_DIR"

# Copy plugin files (exclude .git to save space)
rsync -a --exclude='.git' "$MARKETPLACE_DIR/" "$NEW_CACHE_DIR/"

If the copy fails, warn: "Upgrade failed — the old version is still active. Run /notfair:upgrade manually." and stop.

Step 5: Update installed_plugins.json

Read ~/.claude/plugins/installed_plugins.json, then update the notfair@nowork-studio entry:

python3 -c "
import json, os
from datetime import datetime, timezone

path = os.path.expanduser('~/.claude/plugins/installed_plugins.json')
with open(path) as f:
    data = json.load(f)

data['plugins']['notfair@nowork-studio'] = [{
    'scope': 'user',
    'installPath': os.path.expanduser('~/.claude/plugins/cache/nowork-studio/notfair/$NEW_VERSION'),
    'version': '$NEW_VERSION',
    'installedAt': data['plugins'].get('notfair@nowork-studio', [{}])[0].get('installedAt', datetime.now(timezone.utc).isoformat()),
    'lastUpdated': datetime.now(timezone.utc).isoformat(),
    'gitCommitSha': '$GIT_SHA'
}]

with open(path, 'w') as f:
    json.dump(data, f, indent=4)
print('Updated installed_plugins.json: notfair@nowork-studio -> v$NEW_VERSION')
"

Step 6: Clean up old cache versions

Remove old versioned cache directories (keep only the new one). Never remove a dev symlink:

for dir in ~/.claude/plugins/cache/nowork-studio/notfair/*/; do
  ver=$(basename "$dir")
  if [ "$ver" != "$NEW_VERSION" ] && [ "$ver" != "dev" ]; then
    rm -rf "$dir"
    echo "Removed old cache: $ver"
  fi
done

Step 7: Write marker + clear update state

mkdir -p ~/.toprank
echo "$OLD_VERSION" > ~/.toprank/just-upgraded-from
rm -f ~/.toprank/last-update-check
rm -f ~/.toprank/update-snoozed

Step 8: Show What's New

Read $NEW_CACHE_DIR/CHANGELOG.md. Find all version entries between the old version and the new version. Summarize as 3-7 bullets grouped by theme — focus on user-facing changes, skip internal refactors.

Format:

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

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

The new version will be fully active on your next Claude Code session.

Step 9: Continue

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


Dev symlink detection

Before upgrading, check if the installed cache directory is a symlink named dev:

CACHE_DIR=$(ls -d ~/.claude/plugins/cache/nowork-studio/notfair/*/ 2>/dev/null | head -1)
if [ -L "${CACHE_DIR%/}" ] && [ "$(basename "$CACHE_DIR")" = "dev" ]; then
  echo "DEV_SYMLINK"
fi

If DEV_SYMLINK: tell the user "NotFair is installed as a dev symlink — it always points to your local source (v$(cat "$CACHE_DIR/VERSION" 2>/dev/null | tr -d '[:space:]')). No upgrade needed." and stop. Do not proceed with Steps 2–8.


Standalone usage

When invoked directly as /notfair:upgrade:

  1. Check for dev symlink (see "Dev symlink detection" above). If detected, stop.

  2. Force a fresh update check (bypass cache and snooze):

_UPD_BIN=$(ls ~/.claude/plugins/cache/nowork-studio/notfair/*/bin/notfair-update-check 2>/dev/null | head -1)
[ -n "$_UPD_BIN" ] && _UPD=$("$_UPD_BIN" --force 2>/dev/null || true) || _UPD=""
echo "$_UPD"
  1. If UPGRADE_AVAILABLE <old> <new>: follow Steps 2–8 above.

  2. If no UPGRADE_AVAILABLE output: tell the user "You're already on the latest version (v{LOCAL})."

Version History

  • 82a79b7 Current 2026-07-25 05:07

Same Skill Collection

analytics/google-analytics/SKILL.md
analytics/search-console/SKILL.md
google-ads/assets/SKILL.md
google-ads/audit/SKILL.md
google-ads/copy/SKILL.md
google-ads/manage/SKILL.md
meta-ads/creative/SKILL.md
meta-ads/manage/SKILL.md
paid-ads/paid-ads-amazon/SKILL.md
paid-ads/paid-ads-chatgpt/SKILL.md
paid-ads/paid-ads-creative/SKILL.md
paid-ads/paid-ads-guide/SKILL.md
paid-ads/paid-ads-integrations/SKILL.md
paid-ads/paid-ads-launch/SKILL.md
paid-ads/paid-ads-linkedin/SKILL.md
paid-ads/paid-ads-optimize/SKILL.md
paid-ads/paid-ads-review/SKILL.md
paid-ads/paid-ads-setup/SKILL.md
paid-ads/paid-ads-tiktok/SKILL.md
paid-ads/paid-ads-x/SKILL.md
paid-ads/paid-ads/SKILL.md
seo/broken-link-checker/SKILL.md
seo/meta-tags-optimizer/SKILL.md
seo/schema-markup-generator/SKILL.md
seo/setup-cms/SKILL.md
skills/broken-link-checker/SKILL.md
skills/google-ads-assets/SKILL.md
skills/google-ads-audit/SKILL.md
skills/google-ads-copy/SKILL.md
skills/google-ads/SKILL.md
skills/google-analytics/SKILL.md
skills/meta-ads-creative/SKILL.md
skills/meta-ads/SKILL.md
skills/meta-tags-optimizer/SKILL.md
skills/paid-ads-amazon/SKILL.md
skills/paid-ads-chatgpt/SKILL.md
skills/paid-ads-creative/SKILL.md
skills/paid-ads-guide/SKILL.md
skills/paid-ads-integrations/SKILL.md
skills/paid-ads-launch/SKILL.md
skills/paid-ads-linkedin/SKILL.md
skills/paid-ads-optimize/SKILL.md
skills/paid-ads-review/SKILL.md
skills/paid-ads-setup/SKILL.md
skills/paid-ads-tiktok/SKILL.md
skills/paid-ads-x/SKILL.md
skills/paid-ads/SKILL.md
skills/schema-markup-generator/SKILL.md
skills/search-console/SKILL.md

Metadata

Files
0
Version
8d9d54b
Hash
263952ed
Indexed
2026-07-25 05:07

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-21 03:54
浙ICP备14020137号-1 $방문자$