+
    4j@                         R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^RIHt ^RI	H
t
 ^RIHt ^RIHt RtRtRtRtR	 tR
 tR tR tR tR tR tR tR# )ut  sshj.doctor — `sshj doctor`: machine-readable self-diagnostics (atuin doctor pattern).

Leaf (stdlib only): the JSON output surface over the EXISTING probes —
reuses selftest's probe functions and relay lookup, adds no probe logic.
Tiers:
  sshj doctor           full: sshj identity + probes (tty/kernel/relay) +
                        env/config/state + warnings; a human header line
                        above the JSON ("include this output with any
                        bug report") unless --json.
  sshj doctor --info    tier 2: env/config/state only — no probes.
Exit codes: 0 OK (warnings allowed) · 1 a hard-unavailable: the relay
route is dead (TIOCSTI refused with no relay, or no /bin/bash on the
relay route) or python below the 3.8 floor. A no-tty run is a WARNING,
not a hard — doctor must stay runnable from a pipe (that's how a bug
report collects it).
N)selftest)config_files)	STATE_DIR)VERSSHJ_RELAY_GRID_ROWSSHJ_RELAY_PROMPT_WAITg      @c            	         \         P                  p R\        RRV P                  V P                  V P
                  3,          R\         P                  R\        P                  ! 4       /# )u?   The sshj identity block (version/python/os/arch) — no probes.versionpythonz%d.%d.%dosarch)sysversion_infor   majorminormicroplatformmachine)vs    src/sshj/doctor.py	_identityr   '   sO    AsjAGGQWWagg#>>#,,(8(8(:< <    c                j    \         P                  ! 4       w  rRTRV '       d   RMRRV '       d   R/# R/# )z@The kernel block: release + TIOCSTI state + the resulting route.releasetiocsti	availableunavailableroutedirectrelay)r   _kernel_version)ttiocsti_kverrels   &  r   _kernelr$   /   s>    ))+JEsh{MX8 8/68 8r   c            
     &   \         P                  ! 4       p \        P                  P	                  R4      ;'       g    RpV'       gr   \        P
                  P                  R4      p\        P
                  P                  V4      '       d.   \        P                  ! V\        P                  4      '       d   TpV'       g!   \        P                  ! R4      ;'       g    Rp \        \        P                  P	                  \        \        4      4      pRV RJRT R\        P
                  P                  R	4      '       d.   \        P                  ! R	\        P                  4      '       d   RMR
RT;'       g    RRV/#   \         d
    \        p L}i ; i)zFThe relay block: presence, the /bin/bash child, starship, prompt wait.SSHJ_STARSHIP z~/.local/bin/starshipstarshippresentNpathshellz	/bin/bashmissingnoneprompt_wait)r   _relay_pathr   environgetr*   
expanduserexistsaccessX_OKshutilwhichfloatPROMPT_WAIT_ENVPROMPT_WAIT_DEFAULT
ValueError)r*   starlocalwaits       r   _relayr?   7   s   !D ::>>/*00bD""#:;77>>%  RYYubgg%>%>D||J'--2#RZZ^^O5HIJ t4'D44))K99   %4! !  #"#s   !1E< <FFc                 T    \        \        R \        P                   4       4      4      # )zIEvery SSHJ_* var set (with its value), minus the per-launch grid-row var.c              3      "   T FD  pVP                  R 4      '       g   K  V\        8w  g   K)  V\        P                  V,          3x  KF  	  R# 5i)SSHJ_N)
startswithGRID_ROW_ENVr   r0   ).0ks   & r   	<genexpr>_env.<locals>.<genexpr>S   s>      G:a,,w/ *454E *2::a=):s   AA!A)dictsortedr   r0    r   r   _envrL   Q   s+     G2:: G G H Hr   c            	         R\        4       RR\        P                  P                  R4      R\        P                  P                  R4      //# )zGThe ssh config files actually read + the SSHJ_CONFIG/SSH_CONFIG extras.filesextraSSHJ_CONFIG
SSH_CONFIG)r   r   r0   r1   rK   r   r   _configrR   W   sA    \^mRZZ^^M%B"BJJNN<$@BC Cr   c                     R\         R\         U u. uFN  p \        P                  P	                  \        P                  P                  \         V 4      4      '       g   KL  V NKP  	  up /# u up i )z/The state dir + which of its files are present.dirrN   )r   STATE_FILESr   r*   r3   join)ns    r   _staterX   ^   sW    9 EAY(BC a EF FEs   A	A(
A(
c                   . . rV R8X  d   VP                  R4       V'       ga   VR,          '       g   VP                  R4       MVR,          R8X  d   VP                  R4       VR,          R	8X  d   VP                  R
4       MVR,          R8X  d   VP                  R4       VR8X  d   VP                  RV,           4       VR8X  d   VP                  RV,           4       Wx3# )z7Split findings into (soft warnings, hard unavailables).FAILuh   no tty (stdin not a terminal) — the grid can't open; use sshj <host> (direct mode) or ssh -T host sshjr)   uS   TIOCSTI unavailable and sshj-relay missing — two-stage Tab is dead (make install)r+   r,   uQ   relay route active but /bin/bash missing — the relay child shell is unavailabler(   r-   u<   starship not found — the relay prompt prefix will be blankuT   /bin/bash missing — the relay fallback won't work (TIOCSTI direct stuff covers it)WARNzterminal size: zshell: )append)	t_statuss_statuss_det	sh_statussh_detr!   r   softhards	   &&&&&&&  r   	_classifyrd   e   s     R$6 H 	IYKK ? @7^y(KK ; <&KK ( )	w9	$ 7 	86%-.FI&':r   c                >   RV 9   pRV 9   pR\        4       /p. pV'       d*   \        4       VR&   \        4       VR&   \        4       VR&   EM\        P
                  ! 4       p\        P                  ! 4       w  rgp\        P                  ! 4       w  rp\        P                  ! 4       w  rp\        P                  ! 4       w  ppp\        4       p\        P                  ! RV
4      pR\        P                  P                  4       R	\        P                   P                  4       R
V'       d5   \#        VP%                  ^4      4      \#        VP%                  ^4      4      .MR/VR&   \'        V4      VR&   VVR&   \)        WiWWV4      w  ppVR8X  d   VP+                  RV,           4       \        4       VR&   \        4       VR&   \        4       VR&   VVR&   WCR&   V'       g   \-        R\.        ,          4       \-        \0        P2                  ! V^RR7      4       V'       d   ^# ^ # )zTBuild the document, print header (unless --json) + JSON, return the exit code (0/1).z--infoz--jsonsshjenvconfigstatez(\d+) rows x (\d+) colsstdin_isattystdout_isattysizeNttykernelr   rZ   zpython warningsrc   u=   sshj doctor (v%s) — include this output with any bug reportT)indent	sort_keys)r   rL   rR   rX   r   _ttiocsti_works	probe_tty
probe_sizeprobe_shellprobe_pythonr?   researchr   stdinisattystdoutintgroupr$   rd   r\   printr   jsondumps)argsinfo	json_onlydocrc   r!   r]   _t_det_t_msgr^   r_   _s_msgr`   ra   _sh_msg	py_statuspy_det_py_msgr   mrb   s   &                    r   runr      s   tDD I9;
CDVE
	HxG++-#+#5#5#7 &"*"5"5"7%-%9%9%;"	7%-%:%:%<"	67 II0%8$cii&6&6&8%szz'8'8':As1771:AGGAJ@!E
  )HGx5%8
dKK	F*+VE
	HxGJFM 		$**Sd
341!r   )zlast_used.jsonzidentity.jsonzupdate.flag)__doc__r   r   r   rw   r6   r   r'   r   discoverr   jsonior   themer   rD   r9   r:   rU   r   r$   r?   rL   rR   rX   rd   r   rK   r   r   <module>r      sl      	  	  
  "   %* @<8!4HCF6(r   