#!/bin/bash set -e FRAMEWORK_DIR="$HOME/.automaton" if [ ! -d "$FRAMEWORK_DIR" ]; then echo "ERROR: automaton not installed at $FRAMEWORK_DIR" echo "Run './install.sh' first." exit 1 fi echo "Updating automaton 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 and pull latest changes git pull origin main echo "" echo "Framework updated to $(git rev-parse --short HEAD)." # Check current project for stale files or deprecated task location if [ -d ".automaton" ] && [ "$PWD" != "$FRAMEWORK_DIR" ]; then NEEDS_MIGRATION=false # Check for stale prompt/contract/script copies for dir in prompts contracts scripts; do if [ -d ".automaton/$dir" ]; then NEEDS_MIGRATION=true break fi done # Check for tasks at project root (deprecated location) if [ -d "tasks" ] && [ -d ".automaton" ] && [ ! -e ".automaton/tasks" ]; then NEEDS_MIGRATION=true fi if $NEEDS_MIGRATION; then echo "" echo "⚠️ This project has deprecated file locations." echo " Run migration: bash $FRAMEWORK_DIR/scripts/migrate-project.sh \"$PWD\"" echo " Or tell the agent: 'Upgrade automaton for this project'" fi fi echo "" echo "Update complete."