CodexWrapper.Commands.Doctor (CodexWrapper v0.4.0)

Copy Markdown View Source

Doctor command -- diagnose the local Codex install, config, auth, and runtime health.

Wraps codex doctor [OPTIONS]. Useful as a preflight before a run: it reports whether the CLI is installed, whether auth is configured, and whether the configured provider endpoints are reachable.

Usage

config = CodexWrapper.Config.new()

{:ok, report} = CodexWrapper.Commands.Doctor.execute(Doctor.new(), config)

For a machine-readable report, use execute_json/2:

{:ok, report} = CodexWrapper.Commands.Doctor.execute_json(Doctor.new(), config)

report["overallStatus"]
#=> "ok"

Exit status

codex doctor exits 0 even when checks report warnings or failures, so a successful call is not by itself a clean bill of health. Read "overallStatus" from the JSON report ("ok", "warning", ...) rather than relying on the exit code.

Summary

Functions

Expand long lists in detailed human output (--all).

Use ASCII status labels and separators in human output (--ascii).

Build the argument list for this command.

Run the diagnostics synchronously, returning the report as a string.

Run the diagnostics with --json and return the decoded report.

Emit a redacted machine-readable report (--json).

Create a doctor command with every option unset.

Disable ANSI color in human output (--no-color).

Show only grouped check rows and the final count summary (--summary).

Types

t()

@type t() :: %CodexWrapper.Commands.Doctor{
  all: boolean(),
  ascii: boolean(),
  json: boolean(),
  no_color: boolean(),
  summary: boolean()
}

Functions

all(d)

@spec all(t()) :: t()

Expand long lists in detailed human output (--all).

ascii(d)

@spec ascii(t()) :: t()

Use ASCII status labels and separators in human output (--ascii).

build_args(d)

@spec build_args(t()) :: [String.t()]

Build the argument list for this command.

execute(doctor, config)

@spec execute(t(), CodexWrapper.Config.t()) :: {:ok, String.t()} | {:error, term()}

Run the diagnostics synchronously, returning the report as a string.

The human-readable report is a display format, not a stable contract. Use execute_json/2 when the caller needs to inspect the result.

execute_json(doctor, config)

@spec execute_json(t(), CodexWrapper.Config.t()) :: {:ok, map()} | {:error, term()}

Run the diagnostics with --json and return the decoded report.

Forces --json on the command. The report is a map keyed by "schemaVersion", "overallStatus", "codexVersion", and "checks".

json(d)

@spec json(t()) :: t()

Emit a redacted machine-readable report (--json).

new()

@spec new() :: t()

Create a doctor command with every option unset.

no_color(d)

@spec no_color(t()) :: t()

Disable ANSI color in human output (--no-color).

summary(d)

@spec summary(t()) :: t()

Show only grouped check rows and the final count summary (--summary).