Files
sproutclaw/scripts/sync-upstream.sh
root 0a91cc99d0
Some checks failed
CI / build-check-test (push) Has been cancelled
chore: add sproutclaw git workflow and track local extensions
Document main/upstream-sync/feature branch strategy, add sync/push
scripts, track .pi/agent extensions and webui in git, and disable
startup changelog via showChangelogOnStartup.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-22 20:38:20 +08:00

47 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# Merge upstream pi-mono into upstream-sync, then into main.
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT"
export GIT_HTTP_VERSION="${GIT_HTTP_VERSION:-1.1}"
echo "==> Fetch upstream (badlogic/pi-mono)"
git fetch upstream
CURRENT="$(git branch --show-current)"
if [[ "$CURRENT" != "main" && "$CURRENT" != "upstream-sync" ]]; then
echo "Switch to main or upstream-sync first (current: $CURRENT)" >&2
exit 1
fi
echo "==> Update upstream-sync from main"
git checkout upstream-sync 2>/dev/null || git checkout -b upstream-sync main
git merge main --ff-only
echo "==> Merge upstream/main into upstream-sync"
if ! git merge upstream/main -m "merge: sync upstream pi-mono main"; then
echo
echo "Conflicts detected. Resolve them, then:"
echo " git add <resolved-files>"
echo " git commit"
echo " git checkout main && git merge upstream-sync"
echo " ./scripts/push-sproutclaw.sh"
exit 1
fi
echo "==> Merge upstream-sync into main"
git checkout main
git merge upstream-sync --ff-only
echo "==> Install deps and build"
npm install --ignore-scripts
npm run build
echo
echo "Done. Push with: ./scripts/push-sproutclaw.sh"
echo "Conflict hints:"
echo " README.md, sproutclaw patches -> keep ours"
echo " package-lock.json, *.generated.ts -> take upstream, then npm install"