#!/usr/bin/env bash # kickagents bootstrap: curl -fsSL https://kickagents.com/install | bash # # Downloads the latest release of the open source core into ~/kickagents (or # $KICKAGENTS_DIR) and runs its installer. Re-running updates the code and keeps your # settings (secrets.env, state, logs). Read the installer itself in the repo: install.sh. set -euo pipefail main() { local repo="kickagents/kickagents" local url="${KICKAGENTS_URL:-https://github.com/$repo/releases/latest/download/kickagents.tar.gz}" local dir="${KICKAGENTS_DIR:-$HOME/kickagents}" case "$(uname -s)" in Darwin|Linux) ;; *) echo "kickagents supports macOS and Linux (on Windows, use WSL)." >&2; exit 1 ;; esac for tool in curl tar python3; do if ! command -v "$tool" >/dev/null 2>&1; then echo "Missing: $tool. Install it and run this again." >&2 [[ "$tool" == python3 && "$(uname -s)" == Darwin ]] && echo " xcode-select --install" >&2 exit 1 fi done local tmp tmp="$(mktemp -d)" trap 'rm -rf "$tmp"' EXIT echo "Downloading kickagents..." curl -fsSL "$url" -o "$tmp/kickagents.tar.gz" mkdir -p "$tmp/src" tar -xzf "$tmp/kickagents.tar.gz" -C "$tmp/src" # the archive holds one top folder (kickagents-/) or the files directly local src="$tmp/src" if [[ ! -f "$src/install.sh" ]]; then src="$(find "$tmp/src" -mindepth 1 -maxdepth 1 -type d | head -n 1)" fi if [[ ! -f "$src/install.sh" ]]; then echo "The download does not look like a kickagents release." >&2 exit 1 fi if [[ -d "$dir" ]]; then echo "Updating $dir (your settings stay)..." else echo "Installing into $dir..." mkdir -p "$dir" fi # code files only: secrets.env, *.state.json and logs are not in the release cp -R "$src/." "$dir/" chmod +x "$dir/install.sh" "$dir/start.sh" 2>/dev/null || true cd "$dir" # stdin is this script when piped from curl; the installer needs the keyboard if { true < /dev/tty; } 2>/dev/null; then exec ./install.sh "$@" < /dev/tty fi exec ./install.sh "$@" } # the whole script is downloaded before anything runs main "$@"