Documentation
¶
Overview ¶
Package doctor provides a pipeline health check surface for the `commitbrief doctor` subcommand. Each "check" inspects one concern (git binary on PATH, config validity, provider reachability, cache writability, …) and returns a Result the CLI formats into a single status table. The aim is to reduce support burden — when something goes wrong, a user can self-diagnose before opening an issue.
Checks live as methods on Runner rather than discrete types so the CLI command can compose them without a registration dance. Per-check dependencies (config snapshot, repo root, user home) come from the Runner's fields; nothing in this package mutates global state.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Result ¶
Result is the output of a single check. Name is a short user-facing label (left column in the doctor table); Detail is the free-form right-hand explanation (a resolved path, an error message, etc.).
type Runner ¶
type Runner struct {
// RepoRoot is the resolved git repository root, or "" when running
// outside a repo. Checks that depend on a repo (cache writability,
// .gitignore content) short-circuit on empty.
RepoRoot string
// Home is the resolved user home directory, used by OUTPUT.md
// fallback lookup. Empty home skips the user-level layer.
Home string
// Config is the merged effective configuration. Never nil at the
// CLI layer; tests can pass an explicit [config.Default()] minimum.
Config *config.Config
// Catalog provides i18n translations for check names. Nil falls
// back to a no-op catalog (returns the key verbatim).
Catalog *i18n.Catalog
}
Runner holds the dependencies shared across all checks. Tests build minimal Runners directly; the CLI builds one from the resolved app context. Catalog may be nil — in that case check names fall back to their English defaults.
type Status ¶
type Status int
Status is a coarse health label for a single check. Three levels keep the table readable: green for OK, yellow for advisory issues that don't block use, red for actual failures.
const ( // StatusOK — the checked condition holds. Detail is informational // (e.g. the resolved path of a found binary). StatusOK Status = iota // StatusWarn — the condition isn't ideal but the CLI can still // operate (e.g. one of several configured providers fails its ping). StatusWarn // StatusFail — the condition blocks normal operation (e.g. git // binary missing, no provider configured at all). Exit code 1. StatusFail )