ci(#1374): add gateway contract drift check (#1378)

This commit is contained in:
m57 authored and GitHub committed 2026-09-29 14:37:46 +03:00
1 parent 30afd845e8
commit d07325cd31
8 files changed
+40484

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
# Refresh the vendored gateway contract snapshot from hermes-agent (#1374).
# Usage: scripts/sync-gateway-contract.sh [ref] (default: main)
set -euo pipefail
REF="${1:-main}"
REPO="NousResearch/hermes-agent"
CONTRACT_PATH="apps/shared/src/gateway-contract.openrpc.json"
DEST="$(cd "$(dirname "$0")/.." && pwd)/app/src/test/resources/gateway-contract"
SHA="$(gh api "repos/$REPO/commits/$REF" --jq .sha)"
DATE="$(gh api "repos/$REPO/commits/$SHA" --jq .commit.committer.date)"
mkdir -p "$DEST"
gh api -H "Accept: application/vnd.github.raw" "repos/$REPO/contents/$CONTRACT_PATH?ref=$SHA" > "$DEST/openrpc.json"
jq -e '.methods | length > 0' "$DEST/openrpc.json" > /dev/null
printf 'repo: %s\nref: %s\nsha: %s\ndate: %s\npath: %s\n' "$REPO" "$REF" "$SHA" "${DATE%%T*}" "$CONTRACT_PATH" > "$DEST/SOURCE"
echo "Vendored $REPO@$SHA. Run ./gradlew testDebugUnitTest --tests '*GatewayContract*' and review the diff."