#!/bin/bash set -euo pipefail readonly BASEDIR="/opt/bytelyst/learning_ai_common_plat" readonly TOKEN_FILE="${GITEA_NPM_TOKEN_FILE:-$HOME/.gitea_npm_token}" if [[ -z "${GITEA_NPM_TOKEN:-}" ]]; then if [[ -f "$TOKEN_FILE" ]]; then export GITEA_NPM_TOKEN GITEA_NPM_TOKEN="$(<"$TOKEN_FILE")" else echo "Need GITEA_NPM_TOKEN (file $TOKEN_FILE or env)." exit 1 fi fi source "$BASEDIR/scripts/switch-network.sh" >/dev/null export NETWORK="${NETWORK:-home}" cd "$BASEDIR" corepack pnpm install corepack pnpm test echo "Verifying HTTP responses..." declare -A extra_headers=( [https://gitea.bytelyst.com/api/packages/ByteLyst/npm/]="-H Authorization: token ${GITEA_NPM_TOKEN}" ) for url in \ https://api.bytelyst.com/platform/health \ https://gitea.bytelyst.com/api/packages/ByteLyst/npm/ \ https://ollama.bytelyst.com/api/version \ ; do headers=${extra_headers[$url]:-} if curl -sSfI $headers "$url" >/tmp/last-curl.out; then status=$(head -n1 /tmp/last-curl.out) echo "$url -> $status" else echo "$url -> failed, see /tmp/last-curl.out" fi done echo "Done. pnpm install/test + endpoint verification complete."