From 140a8573191220ec9a81069666dc1e395ad54103 Mon Sep 17 00:00:00 2001 From: openhands Date: Sun, 22 Mar 2026 19:23:22 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20address=20review=20=E2=80=94=20netrc=20c?= =?UTF-8?q?url=20flag=20and=20claude=20auth=20error=20handling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add --netrc flag to curl when CODEBERG_TOKEN is unset so ~/.netrc auth users don't get false-positive API failures - Check claude auth status exit code separately; only skip the check when the subcommand is unrecognized (old claude version), otherwise treat failures as auth errors Co-Authored-By: Claude Opus 4.6 (1M context) --- bin/disinto | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/bin/disinto b/bin/disinto index c13239f..a3be729 100755 --- a/bin/disinto +++ b/bin/disinto @@ -82,9 +82,17 @@ preflight_check() { # ── Claude Code authentication ── if command -v claude &>/dev/null && command -v jq &>/dev/null; then - local auth_json + local auth_json auth_stderr auth_rc=0 + auth_stderr=$(claude auth status 2>&1 >/dev/null) || auth_rc=$? auth_json=$(claude auth status 2>/dev/null) || auth_json="" - if [ -n "$auth_json" ]; then + # Only skip check if subcommand is unrecognized (old claude version) + if printf '%s' "$auth_stderr" | grep -qi "unknown command"; then + : # claude version doesn't support auth status — skip + elif [ -z "$auth_json" ] || [ "$auth_rc" -ne 0 ]; then + echo "Error: Claude Code is not authenticated (auth check failed)" >&2 + echo " Run: claude auth login" >&2 + errors=$((errors + 1)) + else local logged_in logged_in=$(printf '%s' "$auth_json" | jq -r '.loggedIn // false' 2>/dev/null) || logged_in="false" if [ "$logged_in" != "true" ]; then @@ -111,6 +119,8 @@ preflight_check() { local curl_args=(-sf --max-time 10) if [ -n "${CODEBERG_TOKEN:-}" ]; then curl_args+=(-H "Authorization: token ${CODEBERG_TOKEN}") + else + curl_args+=(--netrc) fi if ! curl "${curl_args[@]}" "https://codeberg.org/api/v1/user" >/dev/null 2>&1; then echo "Error: Codeberg API auth failed" >&2