Kaynağa Gözat

feat(skills): fleetflow version-skew guard (install-sync)

ff-doctor --offline now compares the running scripts against any installed copy at $HOME/.claude/skills/fleetflow/scripts (sha256 per script) and emits an install-sync check: ok when they match / running from the install, advisory when they differ (re-run install). FF_VERSION=1.1.0 constant added to ff-doctor. Drift stays advisory so honest PRs stay green.

Co-Authored-By: Claude <noreply@anthropic.com>
0xDarkMatter 2 hafta önce
ebeveyn
işleme
340e56f572
1 değiştirilmiş dosya ile 27 ekleme ve 0 silme
  1. 27 0
      skills/fleetflow/scripts/ff-doctor.sh

+ 27 - 0
skills/fleetflow/scripts/ff-doctor.sh

@@ -12,6 +12,8 @@
 #             10 structural failure
 set -u
 
+FF_VERSION="1.1.0"
+
 usage() {
   cat <<'EOF'
 Usage: ff-doctor.sh [--offline | --live]
@@ -54,6 +56,31 @@ for s in ff-spawn.sh ff-collect.sh ff-status.sh; do
 done
 [ -f "$HERE/../assets/guard-preamble.txt" ] && say "guard-preamble" ok "present" || { say "guard-preamble" fail "missing"; FAIL=1; }
 
+# --- install-sync: repo copy vs the installed copy at $HOME/.claude/skills ---
+# version-skew guard. Only compares when an installed copy exists AND is a
+# different directory from the one being run (running from the install itself
+# trivially matches). Drift is advisory, never a hard fail.
+INST="$HOME/.claude/skills/fleetflow/scripts"
+if [ -d "$INST" ]; then
+  INST_ABS="$(cd "$INST" 2>/dev/null && pwd)"
+  if [ -n "$INST_ABS" ] && [ "$INST_ABS" != "$HERE" ]; then
+    DIFF=0
+    for s in ff-spawn.sh ff-collect.sh ff-status.sh ff-doctor.sh ff-run.sh ff-clean.sh; do
+      [ -f "$HERE/$s" ] || continue            # not shipped here; skip
+      if [ ! -f "$INST/$s" ]; then DIFF=1; break; fi
+      h1="$(sha256sum "$HERE/$s" | cut -d' ' -f1)"
+      h2="$(sha256sum "$INST/$s" | cut -d' ' -f1)"
+      [ "$h1" = "$h2" ] || { DIFF=1; break; }
+    done
+    if [ "$DIFF" = 0 ]; then say "install-sync" ok "repo and installed copies match"
+    else say "install-sync" advisory "repo and installed copies differ - re-run install"; fi
+  else
+    say "install-sync" ok "running from the installed copy"
+  fi
+else
+  say "install-sync" advisory "no installed copy at $INST"
+fi
+
 [ "$MODE" = "live" ] || { [ "$FAIL" = 0 ] && exit 0 || exit 10; }
 
 # --- live probes ----------------------------------------------------------------