#!/usr/bin/env bash set -e REPO="yunyingk/seal-home" INSTALL_DIR="/usr/local/bin" ALT_INSTALL_DIR="$HOME/.local/bin" echo "==> Detecting platform and architecture..." OS="$(uname -s | tr '[:upper:]' '[:lower:]')" ARCH="$(uname -m)" case "$OS" in darwin) PLATFORM="darwin" ;; linux) PLATFORM="linux" ;; *) echo "Unsupported operating system: $OS" >&2 exit 1 ;; esac case "$ARCH" in x86_64|amd64) ARCH_NAME="x64" ;; arm64|aarch64) ARCH_NAME="arm64" ;; *) echo "Unsupported architecture: $ARCH" >&2 exit 1 ;; esac ASSET_NAME="seal-home-${PLATFORM}-${ARCH_NAME}" DOWNLOAD_URL="https://github.com/${REPO}/releases/latest/download/${ASSET_NAME}" echo "==> Downloading latest seal-home for ${PLATFORM}-${ARCH_NAME}..." TMP_FILE="$(mktemp)" if ! curl -fsSL "$DOWNLOAD_URL" -o "$TMP_FILE"; then echo "Error: Failed to download $DOWNLOAD_URL" >&2 rm -f "$TMP_FILE" exit 1 fi chmod +x "$TMP_FILE" # Determine target directory TARGET_PATH="${INSTALL_DIR}/seal-home" if [ -w "$INSTALL_DIR" ]; then mv "$TMP_FILE" "$TARGET_PATH" elif command -v sudo >/dev/null 2>&1; then echo "==> Installing to ${TARGET_PATH} (requires sudo)..." sudo mv "$TMP_FILE" "$TARGET_PATH" sudo chmod 755 "$TARGET_PATH" else mkdir -p "$ALT_INSTALL_DIR" TARGET_PATH="${ALT_INSTALL_DIR}/seal-home" mv "$TMP_FILE" "$TARGET_PATH" echo "==> Installed to ${TARGET_PATH}" echo " Please ensure ${ALT_INSTALL_DIR} is in your PATH." fi # Ad-hoc sign on macOS if [ "$PLATFORM" = "darwin" ] && command -v codesign >/dev/null 2>&1; then codesign --force --sign - "$TARGET_PATH" 2>/dev/null || true fi echo "==> Initializing agent skill..." "$TARGET_PATH" skill install >/dev/null 2>&1 || true echo "" echo "✨ seal-home successfully installed!" "$TARGET_PATH" version echo "" echo "Quick start:" echo " 1. Add enterprise: seal-home corps add-hose --json '{...}'" echo " 2. View MCP config: seal-home mcp-config" echo " 3. Self-update: seal-home update" echo ""