Files
automaton/scripts/update.sh
T
gitea 99ddb98861
CI / build (push) Has been cancelled
Drive all 4 remaining tasks to completion through full lifecycle
- actionable-phase-guidance: lifecycle artifacts + .state->complete
- harden-enforcement-layers: pre-push hook, install-hooks.sh, register-guards.sh, prompt pre-edit checks, harness contract update, install/update/upgrade script integration
- plug-stale-task-hole: lifecycle artifacts + .state->complete
- port-pi-guard: pi dev guard plugin, package.json, register-guards integration

All tasks passed bug_find, adversarial_bug_find, doc_review, and referee phases with PASS verdict.
2026-06-16 07:28:45 -04:00

75 lines
2.1 KiB
Bash
Executable File

#!/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
# Check for uncommitted changes
if ! git diff --quiet HEAD || ! git diff --cached --quiet HEAD; then
echo "ERROR: $FRAMEWORK_DIR has uncommitted changes."
echo "Commit or stash them before updating to avoid losing work."
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."
# Register pre-edit guards for detected harnesses
bash "$FRAMEWORK_DIR/scripts/register-guards.sh"
# Ensure git hooks are installed in current project
if git rev-parse --git-dir &>/dev/null 2>&1; then
HOOK_DIR="$(git rev-parse --git-dir)/hooks"
for hook in pre-commit pre-push; do
HOOK_SRC="$HOME/.automaton/scripts/git-hooks/$hook"
HOOK_DST="$HOOK_DIR/$hook"
if [ -f "$HOOK_SRC" ] && [ ! -f "$HOOK_DST" ]; then
ln -sf "$HOOK_SRC" "$HOOK_DST"
echo "Installed $hook hook"
fi
done
fi