"""nova auth status — print active credential + mode (REQ-344).""" from __future__ import annotations import json import os import sys from core.auth_store import active_credential, emit_status_audit from core.mode_resolver import resolve_mode_from_env def add_parser(subparsers): p = subparsers.add_parser("status", help="show active credential + client mode") p.set_defaults(_run=run) def run(args) -> int: cred = active_credential() emit_status_audit() mode, reason = resolve_mode_from_env( credential_type=cred.get("type") if cred else None, ) if cred is None: print(f"no active credential (mode={mode}, reason={reason})") return 0 print(json.dumps({ "active_credential_jti": cred.get("jti"), "type": cred.get("type"), "exp": cred.get("exp"), "mode": mode, "selection_reason": reason, }, indent=2)) return 0