docs: final CST-agent → Hermit migration notice (0.10.1)
Point readers at WHC/Hermit as canonical; add MIGRATION.md and migrate_remote_to_hermit.sh so existing checkouts can retarget origin. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Executable
+52
@@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env bash
|
||||
# Retarget this checkout's origin to the Hermit repo (canonical name).
|
||||
# Safe to rerun. Does not rewrite history.
|
||||
#
|
||||
# ./scripts/migrate_remote_to_hermit.sh
|
||||
# HERMIT_REMOTE_URL=… ./scripts/migrate_remote_to_hermit.sh
|
||||
set -euo pipefail
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
cd "$ROOT"
|
||||
|
||||
NEW_URL="${HERMIT_REMOTE_URL:-https://git.whcself.xyz/WHC/Hermit.git}"
|
||||
OLD_HINT="CST-agent"
|
||||
|
||||
if [[ ! -d .git ]]; then
|
||||
echo "not a git checkout: $ROOT" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cur="$(git remote get-url origin 2>/dev/null || true)"
|
||||
echo "==> current origin: ${cur:-"(none)"}"
|
||||
echo "==> target origin: $NEW_URL"
|
||||
|
||||
if [[ -n "$cur" && "$cur" == "$NEW_URL" ]]; then
|
||||
echo "already on Hermit remote"
|
||||
else
|
||||
if git remote get-url origin >/dev/null 2>&1; then
|
||||
git remote set-url origin "$NEW_URL"
|
||||
else
|
||||
git remote add origin "$NEW_URL"
|
||||
fi
|
||||
# Keep a pointer at the old name for a while.
|
||||
if ! git remote get-url cst-agent >/dev/null 2>&1; then
|
||||
if [[ -n "$cur" && "$cur" == *"$OLD_HINT"* ]]; then
|
||||
git remote add cst-agent "$cur" || true
|
||||
echo "==> saved previous URL as remote 'cst-agent'"
|
||||
else
|
||||
git remote add cst-agent "https://git.whcself.xyz/WHC/CST-agent.git" || true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
git fetch origin
|
||||
branch="$(git rev-parse --abbrev-ref HEAD)"
|
||||
if git show-ref --verify --quiet "refs/remotes/origin/$branch"; then
|
||||
git branch --set-upstream-to="origin/$branch" "$branch" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "OK. Canonical repo: $NEW_URL"
|
||||
echo " git remote -v"
|
||||
echo " See MIGRATION.md for config / binary / env notes."
|
||||
git remote -v
|
||||
Reference in New Issue
Block a user