Add update mechanism: update.sh script, project upgrade option in onboarding, update instructions in README, Bug 12
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
FRAMEWORK_DIR="$HOME/.agent-framework"
|
||||
|
||||
if [ ! -d "$FRAMEWORK_DIR" ]; then
|
||||
echo "ERROR: agent-framework not installed at $FRAMEWORK_DIR"
|
||||
echo "Run './install.sh' first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Updating agent-framework at $FRAMEWORK_DIR..."
|
||||
cd "$FRAMEWORK_DIR"
|
||||
|
||||
# Check if it's a git repo
|
||||
if [ ! -d ".git" ]; then
|
||||
echo "ERROR: $FRAMEWORK_DIR is not a git repository."
|
||||
echo "Cannot update. Please reinstall from git."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Fetch latest changes
|
||||
git fetch origin
|
||||
echo ""
|
||||
|
||||
# Check for local changes
|
||||
if ! git diff --quiet HEAD; then
|
||||
echo "WARNING: You have uncommitted changes in $FRAMEWORK_DIR."
|
||||
echo "These will be lost when pulling updates."
|
||||
read -p "Do you want to discard your local changes and update? (y/N) " -n 1 -r
|
||||
echo
|
||||
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
||||
echo "Update cancelled."
|
||||
exit 1
|
||||
fi
|
||||
git reset --hard HEAD
|
||||
fi
|
||||
|
||||
# Pull latest changes
|
||||
git pull origin main
|
||||
echo ""
|
||||
|
||||
echo "Update complete."
|
||||
echo "You can check for breaking changes at: https://gitea.yourdomain.com/hermes/agent-framework"
|
||||
Reference in New Issue
Block a user