#!/bin/sh # HGCode self-hosted Connect installer. # curl -fsSL https://install.hagihub.tech | sh # Installs the t3 CLI runtime, points it at relay.hagihub.tech, links this # machine (one device-code approval in the browser), and persists the service. set -eu bin_dir="${T3CODE_INSTALL_BIN_DIR:-$HOME/.local/bin}" step() { printf '\n %s\n' "$1" >&2; } step "Installing the CLI runtime..." curl -fsSL https://t3.codes/install.sh | sh T3="$bin_dir/t3" [ -x "$T3" ] || T3="$(command -v t3 || true)" [ -n "$T3" ] || { echo "install: t3 binary not found" >&2; exit 1; } export T3CODE_RELAY_URL="https://relay.hagihub.tech" export T3CODE_CLERK_PUBLISHABLE_KEY="pk_test_ZGlzY3JldGUtc3RhcmZpc2gtNjEzOC5jbGVyay5hY2NvdW50cy5kZXYk" export T3CODE_CLERK_JWT_TEMPLATE="t3-relay" export T3CODE_CLERK_CLI_OAUTH_CLIENT_ID="kCqq887nJgZDUDd3" step "Linking to https://relay.hagihub.tech ..." step "A device code will appear below — approve it in your browser." "$T3" up --connect --headless --yes || "$T3" up --connect --headless step "Persisting relay config for the background service..." svc_dir="$HOME/.config/systemd/user/t3code.service.d" mkdir -p "$svc_dir" cat > "$svc_dir/env.conf" </dev/null || true systemctl --user daemon-reload 2>/dev/null || true systemctl --user restart t3code 2>/dev/null || true "$T3" connect status || true step "Done."