287c08ebfc
Consolidate connect, graph, and search workflows with mobile endpoint defaults and shared installation docs. Co-authored-by: Cursor <cursoragent@cursor.com>
55 lines
1.3 KiB
Bash
Executable File
55 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# GitNexus health check — Cursor, Hermes, operator.
|
|
set -euo pipefail
|
|
|
|
BASE="${GITNEXUS_SERVER_URL:-https://gitnexus.mobile.agency-ai.dev}"
|
|
BASE="${BASE%/}"
|
|
REPO="${GITNEXUS_DEFAULT_REPO:-one-gateway}"
|
|
|
|
echo "=== GitNexus health ==="
|
|
echo "Server: $BASE"
|
|
echo
|
|
|
|
echo "--- GET /api/health ---"
|
|
HEALTH=$(curl -fsS "$BASE/api/health" 2>&1) || {
|
|
echo "FAIL: cannot reach $BASE/api/health"
|
|
echo "$HEALTH"
|
|
exit 1
|
|
}
|
|
echo "$HEALTH"
|
|
echo
|
|
|
|
echo "--- GET /api/repos ---"
|
|
REPOS=$(curl -fsS "$BASE/api/repos" 2>&1) || {
|
|
echo "FAIL: cannot reach $BASE/api/repos"
|
|
echo "$REPOS"
|
|
exit 1
|
|
}
|
|
echo "$REPOS"
|
|
echo
|
|
|
|
if command -v python3 >/dev/null 2>&1; then
|
|
if echo "$REPOS" | python3 -c "
|
|
import json, sys
|
|
repos = json.load(sys.stdin)
|
|
names = [r.get('name', '') for r in repos]
|
|
target = sys.argv[1]
|
|
sys.exit(0 if target in names else 1)
|
|
" "$REPO" 2>/dev/null; then
|
|
echo "OK: repo '$REPO' is indexed"
|
|
else
|
|
echo "WARN: repo '$REPO' not found in index (check analyze on server)"
|
|
exit 1
|
|
fi
|
|
else
|
|
if echo "$REPOS" | grep -q "\"name\":\"$REPO\"" || echo "$REPOS" | grep -q "\"name\": \"$REPO\""; then
|
|
echo "OK: repo '$REPO' appears in response"
|
|
else
|
|
echo "WARN: repo '$REPO' not found in response"
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
echo
|
|
echo "=== All checks passed ==="
|