doctor

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, provider CLIs) down to “nice-to-have” (service-mode ergonomics). Hard prerequisites stay hard failures; optional providers and auth gaps surface as warnings so the operator can still use the providers that are installed and logged in.

Index

type Check

Check is one diagnostic step’s output.

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.

type Option func(*RunOptions)

func WithMinClaudeVersion

func WithMinClaudeVersion(v string) Option

WithMinClaudeVersion pins the minimum claude CLI version expected.

func WithMinGitVersion

func WithMinGitVersion(v string) Option

WithMinGitVersion pins the minimum git version expected.

func WithRunner

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.

type Report struct {
    Checks    []Check
    OKCount   int
    WarnCount int
    FailCount int
}

func Run

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

func (r Report) Passed() bool

Passed reports whether the overall doctor run succeeded (zero FAILs).

func (Report) WriteText

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.

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.

type Severity int

const (
    // OK means the check passed.
    OK  Severity = iota
    // WARN means an issue was detected but is non-fatal.
    WARN
    // FAIL means a hard prerequisite failed and the runtime cannot run.
    FAIL
)

func (Severity) String

func (s Severity) String() string

String returns a human-friendly severity label.

Generated by gomarkdoc