doctor

package
v0.77.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: AGPL-3.0 Imports: 16 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 answers "would lich start on this machine, and why not". It walks the same boot the app walks — config dir, log file, the pinned listener, the workspace database, the window, the providers — and reports each step with a verdict and how long it took.

It is a command line because the failure it diagnoses is a window that never opened: there is no Settings › Help behind a window that is not there. It needs no TTY and no running instance, and it exits non-zero when a check that would stop a launch fails, so it works as a smoke test in a script.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Failed

func Failed(checks []Check) bool

Failed reports whether any check would stop a launch, which is what the exit code carries to a script.

func Instance

func Instance(configDir string) (*singleton.Info, bool)

Instance returns the lich recorded in the runtime file and whether it still answers. A recorded instance that does not is itself a finding, so the caller gets both halves rather than a single boolean.

func OnPath

func OnPath(id string) []providers.Binary

OnPath lists every distinct binary of a provider on $PATH with its version. The id comes from Detect, so the one error OnPath has (an unknown id) cannot happen here.

func Providers

func Providers() []providers.Detected

Providers lists the harnesses on PATH. A detection that fails outright is reported as none found: both callers treat "no provider" as their finding, and neither has anywhere to put the error.

func Render

func Render(w io.Writer, version string, checks []Check)

Render writes the report: a header naming the build, one line per check in boot order, the total, and a verdict. The verdict is the whole point of reading it — a table of six lines that never says whether lich would start leaves the reader to add it up.

func Window added in v0.73.0

func Window() (string, error)

Window resolves the native window lich launches: the LICH_NATIVE pin, else lich-native beside the lich binary.

Types

type Check

type Check struct {
	Name   string
	Status Status
	Detail string
	Took   time.Duration
}

Check is one step of the boot, as the report prints it.

type Doctor

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

Doctor runs the checks. Every probe that reaches the machine is a field, so a test decides what this machine has without touching PATH, the port or the database.

func New

func New(configDir string, getenv func(string) string) *Doctor

New returns a Doctor for this machine. configDir is the OS config dir, and getenv resolves the listener port exactly as a launch would.

func (*Doctor) Run

func (d *Doctor) Run() []Check

Run walks the boot in order and returns one Check per step. The instance is probed once for the whole run: two checks need the answer, and a stale runtime file costs a timeout to find out.

type Status

type Status string

Status is one check's verdict.

const (
	// OK: this step of a launch would succeed.
	OK Status = "ok"
	// Warn: lich starts, but something it offers will not work.
	Warn Status = "warn"
	// Fail: a launch stops here. Any Fail exits non-zero.
	Fail Status = "fail"
	// Skip: the check could not run without disturbing the instance already
	// running — reported rather than guessed at.
	Skip Status = "skip"
)

Jump to

Keyboard shortcuts

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