diff --git a/install.sh b/install.sh index f22087b..0e2e8d8 100755 --- a/install.sh +++ b/install.sh @@ -443,26 +443,29 @@ run_doctor() { fi if command -v jq >/dev/null 2>&1 && printf '%s' "${out}" | jq -e . >/dev/null 2>&1; then - local ready - ready="$(printf '%s' "${out}" | jq -r '.readiness.ready // false')" + local blockers + blockers="$(printf '%s' "${out}" | jq -r '.readiness.blockers | if type == "array" then length else -1 end')" printf '%s\n' "${out}" | jq -r ' .readiness as $r | - "ready: \($r.ready)\n" + - ((($r.checks // []) | map(" - \(.name): \(.status)\(if .detail then " (\(.detail))" else "" end)") | join("\n"))) + "ready: \($r.blockers | type == "array" and length == 0)\n" + + ((($r.blockers // []) | map(" - \(.)") | join("\n"))) ' - if [[ "${ready}" == "true" ]]; then + if [[ "${blockers}" -eq 0 ]]; then log_ok "doctor reports ready" + elif [[ "${blockers}" -eq -1 ]]; then + log_fail "doctor output missing blockers field — unexpected JSON structure" + return 1 else log_fail "doctor reports NOT ready" while IFS= read -r line; do FAILED_CHECKS+=("${line}") - done < <(printf '%s' "${out}" | jq -r '.readiness.checks[]? | select(.status != "ok") | "\(.name): \(.detail // .status)"') + done < <(printf '%s' "${out}" | jq -r '.readiness.blockers[]?') return 1 fi else # Raw fallback. printf '%s\n' "${out}" - if printf '%s' "${out}" | grep -qiE '"ready"[[:space:]]*:[[:space:]]*true|ready: true'; then + if printf '%s' "${out}" | grep -qiE '"blockers"[[:space:]]*:[[:space:]]*\[\]'; then log_ok "doctor reports ready (raw)" else log_fail "doctor did not report ready (install jq for a structured summary)"