Expand description
Turn raw ssh stderr into an actionable diagnosis.
Diagnosis is pure and always-on: hostcmd::host_add’s probe-failure path
classifies the underlying ssh error and, when it recognizes the shape,
prints a hint alongside it — never in place of it. The doing (host setup-key, Task 2) is a separate, explicit command; this module only
looks and tells.
Enums§
- SshDiagnosis
- What went wrong establishing an SSH connection, as inferred from stderr.
Functions§
- classify_
ssh_ error - Classify
stderrfrom a failedsshinvocation. Substring match, most specific first:HostKeyChangedandConnectionRefusedare checked before the more genericUnreachable/PermissionDenied, andPermissionDenied’s “Permission denied”/“publickey” are checked before falling back toOther. - diagnosis_
message - An actionable, multi-line hint for
d— empty forOther, so the caller falls back to the raw ssh error rather than showing a blank line.