doctor

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 25 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package doctor diagnoses the install: deps, perms, agent, known_hosts, manifest-vs-disk drift, and dangling keys.

It no longer mirrors v1 check for check. The dangling-key section comes from the keyaudit service and, unlike the orphan list it replaced, decides the verdict; --strict escalates every state for CI.

Index

Constants

View Source
const DefaultOldKeyMaxAge = 90 * 24 * time.Hour

DefaultOldKeyMaxAge is how long an archived predecessor is considered useful. Past that, the rotation it belongs to has long since been verified in practice and the file is just an unencrypted private key nobody is watching.

Variables

This section is empty.

Functions

func OldKeyMaxAge

func OldKeyMaxAge(get func(string) string) time.Duration

OldKeyMaxAge is the staleness threshold, overridable with $AUTHAMA_OLD_KEY_MAX_AGE_DAYS. A value of 0 or less disables the check rather than marking everything stale, so the escape hatch is not a footgun.

Types

type Report

type Report struct {
	Preflight          preflight.Report
	Home               string
	State              string // the state home, when it is not Home
	SSHDir             string
	PermIssues         []string
	AgentStatus        string
	KnownHosts         bool
	OldKeys            map[string]int // key_name -> archived count
	StaleOldKeys       []string       // archived predecessors past the retention window
	ConfigInSync       bool
	OrphanKeys         []string
	Dangling           keyaudit.Report
	DuplicateKeys      []string
	UnpinnedHosts      []string
	AliasCollisions    []string
	ProvidersSource    string // "user file" | "shipped default"
	StrandedLegacyHome string
	// OnePassword lists what stops a 1Password profile from working: no op
	// CLI, or no agent socket. Empty when no profile uses 1Password.
	OnePassword []string
	// StaleProxy lists rendered VM ProxyCommands whose authama binary no longer exists (an upgrade
	// moved it); `sshmgr config render` rewrites them.
	StaleProxy []string
	// ShadowedHosts lists managed aliases a foreign block above the managed
	// block overrides: ssh reads it first, so the manifest's values never
	// apply. sshmgr does not edit that content, so the user has to.
	ShadowedHosts []string
	// RawOptionOverlaps lists raw_options keys that duplicate a managed line.
	// The rendered config already resolves the managed value; this is advice.
	RawOptionOverlaps []string
	// NeededTools lists commands the manifest relies on that are not on PATH: a
	// VM host's hypervisor CLI (its address comes from it at connect time), and
	// git once defaults.git configures `sshmgr git`.
	NeededTools []string
	// Clipboard is set when no clipboard tool is found. Advice only: `termius
	// keys` then needs --print.
	Clipboard string
	// Strict is set by Run(strict=true), the CI mode: every warning then counts
	// against the verdict, so `doctor --strict` never says clean over one.
	Strict bool
}

Report is the full doctor diagnosis.

func (Report) Format

func (r Report) Format() string

Format renders the human-readable report (mirrors DoctorReport.format; the preflight block carries the Go runtime line in place of an interpreter version).

func (Report) JSON

func (r Report) JSON() ([]byte, error)

JSON returns the machine-readable view (mirrors DoctorReport.as_dict key order), with empty lists/maps as []/{} and unset paths as null.

func (Report) OK

func (r Report) OK() bool

OK is the overall verdict.

Dangling keys count. They used to be printed and then ignored by the verdict, so doctor could list an orphaned key and still say "clean" - a check whose result nothing acts on is not a check. Which states are fatal is keyaudit's call, not this one's (--strict makes all of them fatal).

func (Report) Warnings added in v0.1.1

func (r Report) Warnings() []string

Warnings lists the problems that are reported but, outside --strict, do not fail the verdict: they need the user (a VPN, a rename, a cleanup), not a broken setup. Advice (raw_options overlaps, a missing clipboard tool) is not a warning.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service runs doctor over a resolved home + (optional) manifest.

func New

func New(p paths.Paths, m *manifest.Manifest, emitUseKeychain bool) *Service

New builds a doctor service. m may be nil (no manifest yet).

func (*Service) FixPerms

func (s *Service) FixPerms() []string

FixPerms re-asserts canonical perms on the tool-managed ~/.ssh paths and the config-home secrets, returning the paths it changed. Mirrors facade.fix_perms (the advisory lock is the CLI's mutation guard, upstream of this).

func (*Service) Run

func (s *Service) Run(strict bool) Report

Run gathers the full report. strict escalates every dangling-key state to fatal, for CI.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL