#!/bin/sh # AgentPreso CLI installer # Usage: curl -fsSL https://agentpreso.com/install.sh | sh set -e BOLD="\033[1m" GREEN="\033[32m" YELLOW="\033[33m" RED="\033[31m" RESET="\033[0m" info() { printf "${BOLD}%s${RESET}\n" "$1"; } success() { printf "${GREEN}%s${RESET}\n" "$1"; } warn() { printf "${YELLOW}%s${RESET}\n" "$1"; } error() { printf "${RED}%s${RESET}\n" "$1" >&2; exit 1; } # Detect OS and architecture detect_platform() { OS="$(uname -s)" ARCH="$(uname -m)" case "$OS" in Linux*) OS="linux" ;; Darwin*) OS="macos" ;; MINGW*|MSYS*|CYGWIN*) OS="windows" ;; *) error "Unsupported OS: $OS" ;; esac case "$ARCH" in x86_64|amd64) ARCH="x64" ;; arm64|aarch64) ARCH="arm64" ;; *) error "Unsupported architecture: $ARCH" ;; esac # Windows only supports x64 for now if [ "$OS" = "windows" ]; then ARCH="x64" fi PLATFORM="${OS}-${ARCH}" } # Download binary download() { URL="https://api.agentpreso.com/cli/download/${PLATFORM}" info "Downloading AgentPreso CLI for ${PLATFORM}..." if command -v curl >/dev/null 2>&1; then curl -fsSL "$URL" -o agentpreso elif command -v wget >/dev/null 2>&1; then wget -q "$URL" -O agentpreso else error "Neither curl nor wget found. Please install one of them." fi } # Install binary install() { INSTALL_DIR="${INSTALL_DIR:-/usr/local/bin}" chmod +x agentpreso if [ -w "$INSTALL_DIR" ]; then mv agentpreso "$INSTALL_DIR/agentpreso" else info "Installing to $INSTALL_DIR (requires sudo)..." sudo mv agentpreso "$INSTALL_DIR/agentpreso" fi success "AgentPreso CLI installed to $INSTALL_DIR/agentpreso" } # Verify installation verify() { if command -v agentpreso >/dev/null 2>&1; then VERSION="$(agentpreso --version 2>/dev/null || echo 'unknown')" success "Installation complete! Version: $VERSION" echo "" info "Get started:" echo " agentpreso login # Authenticate with your account" echo " agentpreso init # Create a new presentation" echo " agentpreso --help # Show all commands" else warn "Binary installed but not in PATH. Add $INSTALL_DIR to your PATH." fi } main() { info "AgentPreso CLI Installer" echo "" detect_platform download install verify } main