--- title: internal/doctor description: Go API reference for the doctor package. --- # doctor ```go import "github.com/jbcom/radioactive-ralph/internal/doctor" ``` Package doctor runs radioactive\-ralph's environment health checks. \`radioactive\_ralph doctor\` iterates every check, prints the outcome, and exits 0 if every hard\-required check passed \(soft warnings don't fail\). This is the first thing operators run when something's off; output is optimised for remediation \(each failure carries a one\-line suggested fix\) rather than diagnosis depth. Checks are ordered from "fundamental prerequisites" \(git, claude\) down to "nice\-to\-have" \(specific multiplexer available\). Any hard failure short\-circuits subsequent dependent checks — no point probing the claude version if \`claude\` isn't on PATH. ## Index - [type Check](<#Check>) - [type Option](<#Option>) - [func WithMinClaudeVersion\(v string\) Option](<#WithMinClaudeVersion>) - [func WithMinGitVersion\(v string\) Option](<#WithMinGitVersion>) - [func WithRunner\(fn func\(ctx context.Context, name string, args ...string\) \(string, error\)\) Option](<#WithRunner>) - [type Report](<#Report>) - [func Run\(ctx context.Context, opts ...Option\) Report](<#Run>) - [func \(r Report\) Passed\(\) bool](<#Report.Passed>) - [func \(r Report\) WriteText\(w io.Writer\)](<#Report.WriteText>) - [type RunOptions](<#RunOptions>) - [type Severity](<#Severity>) - [func \(s Severity\) String\(\) string](<#Severity.String>) ## type [Check]() Check is one diagnostic step's output. ```go type Check struct { Name string // short label shown in the report ("git version") Severity Severity // OK | WARN | FAIL Detail string // one-line status (e.g. "git 2.42.0 detected") Remediate string // one-line suggested fix if not OK } ``` ## type [Option]() Option configures Run. ```go type Option func(*RunOptions) ``` ### func [WithMinClaudeVersion]() ```go func WithMinClaudeVersion(v string) Option ``` WithMinClaudeVersion pins the minimum claude CLI version expected. ### func [WithMinGitVersion]() ```go func WithMinGitVersion(v string) Option ``` WithMinGitVersion pins the minimum git version expected. ### func [WithRunner]() ```go func WithRunner(fn func(ctx context.Context, name string, args ...string) (string, error)) Option ``` WithRunner lets tests override exec.CommandContext behaviour. The runner receives the command name \+ args, returns stdout or error. ## type [Report]() Report aggregates check outcomes plus a summary. ```go type Report struct { Checks []Check OKCount int WarnCount int FailCount int } ``` ### func [Run]() ```go func Run(ctx context.Context, opts ...Option) Report ``` Run executes every check and returns a consolidated report. ctx is used to bound each subprocess invocation \(default 5s each\). ### func \(Report\) [Passed]() ```go func (r Report) Passed() bool ``` Passed reports whether the overall doctor run succeeded \(zero FAILs\). ### func \(Report\) [WriteText]() ```go func (r Report) WriteText(w io.Writer) ``` WriteText writes a human\-friendly report to w. Intended for the CLI \`radioactive\_ralph doctor\` subcommand. ## type [RunOptions]() RunOptions controls the checks. Zero value runs all checks. ```go type RunOptions struct { // MinClaudeVersion is the pinned minimum Claude Code version in // semver (e.g. "2.1.89"). Empty means "don't pin." MinClaudeVersion string // MinGitVersion is the pinned minimum git version (e.g. "2.5.0"). // Empty means "don't pin." MinGitVersion string // contains filtered or unexported fields } ``` ## type [Severity]() Severity classifies a check outcome. Hard failures \(FAIL\) cause \`radioactive\_ralph doctor\` to exit non\-zero. Soft failures \(WARN\) are printed but don't gate execution. ```go type Severity int ``` ```go const ( // OK means the check passed. OK Severity = iota // WARN means an issue was detected but is non-fatal (e.g. tmux // missing, we'll fall through to screen or setsid). WARN // FAIL means a hard prerequisite failed and the supervisor cannot run. FAIL ) ``` ### func \(Severity\) [String]() ```go func (s Severity) String() string ``` String returns a human\-friendly severity label. Generated by [gomarkdoc]()