#!/usr/bin/env bash # vagents one-line installer. # # Designed to be invoked as: # # curl -fsSL https:///install | sh # # Steps it performs: # 1. Pre-flight: macOS or Linux, python3, git on PATH. # 2. Clone (or fast-forward) the BuddyTV/SITREP repo into ~/.vagents/src. # Pin to the configured ref (default 'main' -- the semantic-release # tagged stable branch) unless SITREP_INSTALL_REF overrides. # 3. Hand off to sitrep/install.sh inside the checkout, which # uses uv tool install to put the `sitrep` binary on PATH. # 4. Print the next step (`sitrep auth login`). # # Re-running this script upgrades an existing install in place: the # checkout is fast-forwarded to the configured ref and sitrep/ # install.sh is re-run (idempotent). # # Override knobs (env vars): # SITREP_INSTALL_DIR Default ~/.vagents/src. Where the source # checkout lives. Set to a writable path you # control if you want it elsewhere. # SITREP_INSTALL_REF Default 'main'. Branch / tag / commit-sha # to check out. Use 'feat/platform-v1' (or # a specific tag like 'v1.2.3') to install # a non-main version. # SITREP_REPO_URL Default https://github.com/BuddyTV/SITREP.git. # Override only for forks / mirrors. set -euo pipefail REPO_URL="${SITREP_REPO_URL:-https://github.com/BuddyTV/SITREP.git}" INSTALL_DIR="${SITREP_INSTALL_DIR:-$HOME/.vagents/src}" INSTALL_REF="${SITREP_INSTALL_REF:-main}" if [[ -t 1 ]]; then BOLD=$'\033[1m'; DIM=$'\033[2m'; RED=$'\033[31m' GREEN=$'\033[32m'; YELLOW=$'\033[33m'; CYAN=$'\033[36m'; RESET=$'\033[0m' else BOLD=""; DIM=""; RED=""; GREEN=""; YELLOW=""; CYAN=""; RESET="" fi step() { printf "\n${BOLD}${CYAN}==>${RESET} ${BOLD}%s${RESET}\n" "$*"; } info() { printf " %s\n" "$*"; } ok() { printf " ${GREEN}\xe2\x9c\x93${RESET} %s\n" "$*"; } warn() { printf " ${YELLOW}!${RESET} %s\n" "$*"; } die() { printf "\n${RED}error:${RESET} %s\n" "$*" >&2; exit 1; } # --------------------------------------------------------------------------- # Pre-flight # --------------------------------------------------------------------------- step "Checking environment" case "$(uname -s)" in Darwin) ok "macOS detected" ;; Linux) warn "Linux detected — should work but only Mac is officially tested" ;; *) die "Unsupported OS: $(uname -s)." ;; esac if ! command -v git >/dev/null 2>&1; then die "git is required but not on PATH. Install it (e.g. \`xcode-select --install\` on macOS) and retry." fi ok "git = $(git --version | awk '{print $3}')" if command -v python3 >/dev/null 2>&1; then py_ver="$(python3 -c 'import sys; print("%d.%d" % sys.version_info[:2])')" ok "python3 = $py_ver" else warn "python3 not found — uv will install its own Python during install" fi # --------------------------------------------------------------------------- # Checkout / update # --------------------------------------------------------------------------- step "Fetching vagents source" info "repo: $REPO_URL" info "ref: $INSTALL_REF" info "target: $INSTALL_DIR" # Make sure the parent dir exists (defensive: someone could set # SITREP_INSTALL_DIR to a deeply-nested path). mkdir -p "$(dirname "$INSTALL_DIR")" if [[ -d "$INSTALL_DIR/.git" ]]; then # Existing checkout -- fast-forward / reset to the requested ref. info "found existing checkout, updating..." git -C "$INSTALL_DIR" fetch --depth=1 origin "$INSTALL_REF" \ || die "git fetch failed (network? bad SITREP_INSTALL_REF=$INSTALL_REF?)" git -C "$INSTALL_DIR" checkout --force FETCH_HEAD \ || die "git checkout FETCH_HEAD failed inside $INSTALL_DIR" ok "updated to $INSTALL_REF" elif [[ -e "$INSTALL_DIR" ]]; then die "$INSTALL_DIR exists but is not a git checkout. Move it aside and retry, or set SITREP_INSTALL_DIR to a different path." else info "fresh clone..." # Shallow clone keeps install fast; the install.sh inside doesn't need # full history. git clone --depth=1 --branch "$INSTALL_REF" "$REPO_URL" "$INSTALL_DIR" \ || die "git clone failed (network? bad SITREP_INSTALL_REF=$INSTALL_REF?)" ok "cloned to $INSTALL_DIR" fi # --------------------------------------------------------------------------- # Hand off to the host installer # --------------------------------------------------------------------------- HOST_INSTALLER="$INSTALL_DIR/sitrep/install.sh" [[ -x "$HOST_INSTALLER" ]] || die "expected $HOST_INSTALLER to exist and be executable -- repo layout changed?" step "Running the host installer" "$HOST_INSTALLER" # --------------------------------------------------------------------------- # Done # --------------------------------------------------------------------------- cat <