From 78b921bc5ba363bbc225be4381f06494726df50a Mon Sep 17 00:00:00 2001 From: Nicklas af Ekenstam Date: Wed, 15 Apr 2026 11:42:24 +0200 Subject: [PATCH] Fix update skills to handle local git clone installs When shipkit is installed from a local git clone, `pip install --upgrade` does nothing because pip sees the same version. The update skills now detect git clone installs and use `pip install --force-reinstall .` after pulling, which correctly reinstalls the updated code. --- shipkit/core/skills/update-shipkit/SKILL.md | 55 +++++++++++---------- shipkit/core/skills/update/SKILL.md | 4 +- 2 files changed, 32 insertions(+), 27 deletions(-) diff --git a/shipkit/core/skills/update-shipkit/SKILL.md b/shipkit/core/skills/update-shipkit/SKILL.md index 696cd9b..87d68f6 100644 --- a/shipkit/core/skills/update-shipkit/SKILL.md +++ b/shipkit/core/skills/update-shipkit/SKILL.md @@ -26,54 +26,57 @@ shipkit --version Determine how shipkit was installed so we use the right upgrade command: ```bash -# Check if installed via uv tool -uv tool list 2>/dev/null | grep shipkit +# Find the package location +python3 -c "import shipkit; from pathlib import Path; p = Path(shipkit.__file__).parent.parent; print(p); print('git' if (p / '.git').exists() else 'pip')" +``` -# Check if installed in a uv-managed environment -pip show shipkit 2>/dev/null | grep Location +```bash +# Also check if installed via uv tool +uv tool list 2>/dev/null | grep shipkit ``` +- If the package root has `.git/`: it's a **local git clone** (most common for development) - If `uv tool list` shows shipkit: it's a **uv tool install** -- If location is inside a `.venv`: it's a **uv/pip project install** -- Otherwise: it's a **regular pip install** +- Otherwise: it's a **pip install** (from PyPI or local) -### Step 3: Check Available Version on PyPI +### Step 3: Check for Updates +**Git clone install:** ```bash -# Prefer uv if available -uv pip index versions shipkit 2>/dev/null || pip index versions shipkit +cd +git fetch origin +git log HEAD..origin/main --oneline ``` +If no new commits, tell user and stop. +Show what changed (new commits, CHANGELOG entries). +**PyPI install:** +```bash +uv pip index versions shipkit 2>/dev/null || pip index versions shipkit +``` Compare current vs available. If already on latest, tell user and stop. ### Step 4: Confirm Upgrade -Show user: -``` -Current: shipkit 0.1.2 -Available: shipkit 0.1.5 - -New in 0.1.5: -- [Fetch from CHANGELOG if possible, or just show version bump] - -Would you like to upgrade? -``` +Show user what's new and ask to proceed. ### Step 5: Upgrade -Use the method matching the installation: - -**uv tool install (recommended):** +**Git clone install:** ```bash -uv tool upgrade shipkit +cd +git pull --rebase origin main +pip install --force-reinstall . ``` +`--force-reinstall` is required because pip doesn't detect changes in a local clone +unless the version number bumped. Without it, pip sees "same version" and skips. -**uv pip (project venv):** +**uv tool install:** ```bash -uv pip install --upgrade shipkit +uv tool upgrade shipkit ``` -**pip fallback:** +**pip from PyPI:** ```bash pip install --upgrade shipkit ``` diff --git a/shipkit/core/skills/update/SKILL.md b/shipkit/core/skills/update/SKILL.md index e6f5b0e..2b27bf6 100644 --- a/shipkit/core/skills/update/SKILL.md +++ b/shipkit/core/skills/update/SKILL.md @@ -46,7 +46,9 @@ Pull the latest code. - Ask user how to resolve each - Recommend taking upstream for package code - Offer `git rebase --abort` as escape hatch -- After successful pull, run `uv sync` to update dependencies +- After successful pull, run `pip install --force-reinstall .` to install the updated code + (`--force-reinstall` is required because pip doesn't detect changes in a local clone unless the version bumped) +- Then run `uv sync` if the project uses uv to update dependencies ### 4. Verify