From 05245a8bba53f1541a41b62a65fba24136129a99 Mon Sep 17 00:00:00 2001 From: "juvenal.diaz" Date: Thu, 22 Oct 2026 20:25:27 -0600 Subject: [PATCH] feat: add remote API help listing --- scripts/jeannie-remote | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/scripts/jeannie-remote b/scripts/jeannie-remote index eb98914..1adeb81 100755 --- a/scripts/jeannie-remote +++ b/scripts/jeannie-remote @@ -2,6 +2,30 @@ set -euo pipefail REMOTE_URL="${JEANNIE_REMOTE_URL:-http://127.0.0.1:8787}" REMOTE_TOKEN="${JEANNIE_REMOTE_TOKEN:-${JEANNIE_SERVER_TOKEN:-}}" +if [[ "${1:-}" == "--help" || "${1:-}" == "-h" ]]; then + export JEANNIE_REMOTE_URL="${REMOTE_URL}" REMOTE_TOKEN + python3 - <<'PY' +import json, os, sys, urllib.error, urllib.request +url = os.environ["JEANNIE_REMOTE_URL"].rstrip("/") +headers = {} +if os.environ.get("REMOTE_TOKEN"): + headers["Authorization"] = "Bearer " + os.environ["REMOTE_TOKEN"] +request = urllib.request.Request(url + "/v1/commands", headers=headers, method="GET") +try: + with urllib.request.build_opener(urllib.request.ProxyHandler({})).open(request, timeout=15) as response: + payload = json.loads(response.read()) +except urllib.error.HTTPError as exc: + print(exc.read().decode(errors="replace"), file=sys.stderr) + raise SystemExit(1) +except urllib.error.URLError as exc: + print(f"jeannie remote: cannot reach {url}: {exc.reason}", file=sys.stderr) + raise SystemExit(1) +print(f"Jeannie remote API commands ({url}):") +for command in payload.get("commands", []): + print(f" {command}") +PY + exit 0 +fi if [[ $# -lt 1 ]]; then echo "Usage: ./jeannie remote [args...]" >&2 exit 2