#!/usr/bin/env bash set -e TERMPERKS_SERVER="https://www.term.works" TERMPERKS_DIR="$HOME/.termworks" echo "Installing TermWorks..." echo "" # Detect OS and architecture OS="$(uname -s | tr '[:upper:]' '[:lower:]')" ARCH="$(uname -m)" case "$ARCH" in x86_64) ARCH="amd64" ;; arm64|aarch64) ARCH="arm64" ;; *) echo "Unsupported architecture: $ARCH" exit 1 ;; esac case "$OS" in darwin|linux) ;; *) echo "Unsupported OS: $OS" exit 1 ;; esac # Create install dir mkdir -p "$TERMPERKS_DIR" # Download binary BINARY_URL="$TERMPERKS_SERVER/bin/termworks-${OS}-${ARCH}" echo "Downloading termworks (${OS}/${ARCH})..." if ! curl -fsSL "$BINARY_URL" -o "$TERMPERKS_DIR/termworks"; then echo "Download failed. Please try again or report the issue." exit 1 fi chmod +x "$TERMPERKS_DIR/termworks" # Add ~/.termworks to PATH for this session so we can run termworks export PATH="$TERMPERKS_DIR:$PATH" # Install shell hook and register with server REF_FLAG="" "$TERMPERKS_DIR/termworks" install --server-url "$TERMPERKS_SERVER" $REF_FLAG echo "" echo "Add termworks to your PATH permanently by adding this to your shell config:" echo ' export PATH="$HOME/.termworks:$PATH"'