From 28709c5577c375cd85ade2199186162947f0d6d8 Mon Sep 17 00:00:00 2001 From: Jasper Chen Date: Tue, 5 May 2026 17:19:18 -0400 Subject: [PATCH] fix: add fail-fast probe for base branch in ship step 12 --- ship/SKILL.md | 5 +++++ ship/SKILL.md.tmpl | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/ship/SKILL.md b/ship/SKILL.md index c7a74dd739..b421950901 100644 --- a/ship/SKILL.md +++ b/ship/SKILL.md @@ -2371,6 +2371,11 @@ already knows. A good test: would this insight save time in a future session? If **Idempotency check:** Before bumping, classify the state by comparing `VERSION` against the base branch AND against `package.json`'s `version` field. Four states: FRESH (do bump), ALREADY_BUMPED (skip bump), DRIFT_STALE_PKG (sync pkg only, no re-bump), DRIFT_UNEXPECTED (stop and ask). ```bash +if ! git rev-parse --verify origin/ >/dev/null 2>&1; then + echo "ERROR: Unable to resolve origin/. Run 'git fetch origin' or verify the base branch exists." + exit 1 +fi + BASE_VERSION=$(git show origin/:VERSION 2>/dev/null | tr -d '\r\n[:space:]' || echo "0.0.0.0") CURRENT_VERSION=$(cat VERSION 2>/dev/null | tr -d '\r\n[:space:]' || echo "0.0.0.0") [ -z "$BASE_VERSION" ] && BASE_VERSION="0.0.0.0" diff --git a/ship/SKILL.md.tmpl b/ship/SKILL.md.tmpl index 470068fd89..da90dd2fe8 100644 --- a/ship/SKILL.md.tmpl +++ b/ship/SKILL.md.tmpl @@ -406,6 +406,11 @@ For each comment in `comments`: **Idempotency check:** Before bumping, classify the state by comparing `VERSION` against the base branch AND against `package.json`'s `version` field. Four states: FRESH (do bump), ALREADY_BUMPED (skip bump), DRIFT_STALE_PKG (sync pkg only, no re-bump), DRIFT_UNEXPECTED (stop and ask). ```bash +if ! git rev-parse --verify origin/ >/dev/null 2>&1; then + echo "ERROR: Unable to resolve origin/. Run 'git fetch origin' or verify the base branch exists." + exit 1 +fi + BASE_VERSION=$(git show origin/:VERSION 2>/dev/null | tr -d '\r\n[:space:]' || echo "0.0.0.0") CURRENT_VERSION=$(cat VERSION 2>/dev/null | tr -d '\r\n[:space:]' || echo "0.0.0.0") [ -z "$BASE_VERSION" ] && BASE_VERSION="0.0.0.0"