Files
loop-loop/install.sh
Sheldon Finlay b3d263258a fix: critical bugs, stale refs, README rewrite, security fixes
- Fix evaluator bypass on last story (moved completion check)
- Fix all stale command name references across README, loop.sh, skills, plugin.json
- Fix explore evaluator false rejects (.loop/ files are expected)
- Fix stderr capture order in headless mode
- Fix shell injection risk in hooks.sh python fallback
- Remove .DS_Store from tracking
- Rewrite README to match current architecture (single entry point, tmux, optional tools)
- Add XcodeBuildMCP and iOS simulator MCP to optional tools docs
2026-03-27 14:58:01 -04:00

107 lines
2.7 KiB
Bash
Executable File

#!/bin/bash
# Install Agent Loop globally for Claude Code.
#
# What this does:
# 1. Copies the harness to ~/.claude/loop/ (prompts, templates, lib, loop.sh)
# 2. Installs skills as Claude Code commands at ~/.claude/commands/
#
# After install, use /agent-loop:run in any project to get started.
#
# Usage:
# ./install.sh # Install
# ./install.sh --uninstall # Remove
set -euo pipefail
CLAUDE_DIR="$HOME/.claude"
HARNESS_DIR="$CLAUDE_DIR/loop"
COMMANDS_DIR="$CLAUDE_DIR/commands"
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
SKILLS=(setup stories run triage)
# --- Colors (if terminal supports them) ---
if [ -t 1 ]; then
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
RED='\033[0;31m'
BOLD='\033[1m'
RESET='\033[0m'
else
GREEN='' YELLOW='' RED='' BOLD='' RESET=''
fi
info() { echo -e "${GREEN}[loop]${RESET} $*"; }
warn() { echo -e "${YELLOW}[loop]${RESET} $*"; }
error() { echo -e "${RED}[loop]${RESET} $*"; }
# --- Uninstall ---
if [[ "${1:-}" == "--uninstall" ]]; then
info "Uninstalling Agent Loop..."
if [ -d "$HARNESS_DIR" ]; then
rm -rf "$HARNESS_DIR"
info "Removed $HARNESS_DIR"
fi
for skill in "${SKILLS[@]}"; do
cmd="$COMMANDS_DIR/$skill.md"
if [ -f "$cmd" ]; then
rm -f "$cmd"
info "Removed $cmd"
fi
done
info "Done. Per-project .loop/ directories are untouched."
exit 0
fi
# --- Install ---
info "Installing Agent Loop..."
# Ensure ~/.claude/ exists
mkdir -p "$CLAUDE_DIR"
# Copy harness (prompts, templates, lib, loop.sh, config example)
if [ -d "$HARNESS_DIR" ]; then
warn "Updating existing install at $HARNESS_DIR"
rm -rf "$HARNESS_DIR"
fi
mkdir -p "$HARNESS_DIR"
cp -r "$SCRIPT_DIR/prompts" "$HARNESS_DIR/"
cp -r "$SCRIPT_DIR/templates" "$HARNESS_DIR/"
cp -r "$SCRIPT_DIR/lib" "$HARNESS_DIR/"
cp -r "$SCRIPT_DIR/skills" "$HARNESS_DIR/"
cp "$SCRIPT_DIR/loop.sh" "$HARNESS_DIR/"
cp "$SCRIPT_DIR/config.json.example" "$HARNESS_DIR/"
cp "$SCRIPT_DIR/init.sh.example" "$HARNESS_DIR/"
chmod +x "$HARNESS_DIR/loop.sh"
info "Harness installed to $HARNESS_DIR"
# Install Claude Code commands
mkdir -p "$COMMANDS_DIR"
for skill in "${SKILLS[@]}"; do
src="$HARNESS_DIR/skills/$skill/SKILL.md"
dest="$COMMANDS_DIR/$skill.md"
if [ -f "$src" ]; then
cp "$src" "$dest"
info "Installed /$skill command"
else
warn "Skill not found: $src (skipping)"
fi
done
echo ""
info "${BOLD}Installation complete.${RESET}"
echo ""
echo " Next steps (inside Claude Code, in any project):"
echo ""
echo " /agent-loop:run # Single command — setup, plan, and run"
echo ""
echo " Or run headless: .loop/loop.sh"
echo ""