#!/bin/sh # activity CLI — review this script before piping to a shell: # curl -fsSL http://activity.apprunner.win/install.sh set -eu BASE="http://activity.apprunner.win" SHA256="d222ffd66c82fc6e29e2332a43f994981ffedba65f92b00708dc3b61192e5247" PREFIX="${ACTIVITY_PREFIX:-$HOME/.local}" SHARE="$PREFIX/share/agent-activity" BIN="$PREFIX/bin" if [ "$(id -u)" -eq 0 ]; then echo "Don't install as root. The CLI lives in $PREFIX." >&2 exit 1 fi if ! command -v python3 >/dev/null 2>&1; then echo "python3 is required (3.12+)." >&2 exit 1 fi if ! python3 -c 'import sys; raise SystemExit(0 if sys.version_info >= (3, 12) else 1)'; then echo "Python 3.12+ is required. macOS: brew install python@3.12" >&2 exit 1 fi if command -v curl >/dev/null 2>&1; then fetch() { curl -fsSL "$1" -o "$2"; } elif command -v wget >/dev/null 2>&1; then fetch() { wget -qO "$2" "$1"; } else echo "curl or wget is required." >&2 exit 1 fi TMP=$(mktemp -d) trap 'rm -rf "$TMP"' EXIT echo "Downloading the activity CLI from $BASE …" fetch "$BASE/download/cli.tar.gz" "$TMP/cli.tar.gz" python3 - "$SHA256" "$TMP/cli.tar.gz" <<'PY' import hashlib import sys expected, path = sys.argv[1], sys.argv[2] digest = hashlib.sha256(open(path, "rb").read()).hexdigest() if digest != expected: sys.stderr.write("checksum mismatch (got %s)\n" % digest) sys.exit(1) PY mkdir -p "$TMP/unpack" tar -xzf "$TMP/cli.tar.gz" -C "$TMP/unpack" SRC="$TMP/unpack/agent-activity-cli" if [ ! -f "$SRC/agent_activity/cli.py" ] || [ ! -f "$SRC/skills/report-activity/SKILL.md" ]; then echo "The downloaded archive is missing the CLI or skills." >&2 exit 1 fi rm -rf "$SHARE" mkdir -p "$SHARE" "$BIN" cp -R "$SRC/agent_activity" "$SHARE/agent_activity" cp -R "$SRC/skills" "$SHARE/skills" # SHARE is expanded now; $@ stays for the wrapper's caller. cat > "$BIN/activity" </dev/null if command -v activity >/dev/null 2>&1; then echo "Next: activity setup --url $BASE" else echo "Add $BIN to PATH, then:" echo " export PATH=\"$BIN:\$PATH\"" echo " activity setup --url $BASE" fi