doctor

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package doctor runs automated diagnostics on the development stack.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintFindings

func PrintFindings(w io.Writer, findings []Finding)

PrintFindings formats findings for terminal output with color support.

Types

type CheckFunc

type CheckFunc func(ctx context.Context, opts *Options) []Finding

CheckFunc is the signature for individual diagnostic checks.

type Doctor

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

Doctor orchestrates diagnostic checks.

func New

func New() *Doctor

New creates a Doctor with all built-in checks registered.

func (*Doctor) Register

func (d *Doctor) Register(name string, fn CheckFunc)

Register adds a named check to the doctor.

func (*Doctor) Run

func (d *Doctor) Run(ctx context.Context, opts *Options) []Finding

Run executes all registered checks and collects findings.

type Finding

type Finding struct {
	Severity Severity
	Title    string
	Detail   string
	Fix      string
	Service  string
}

Finding represents a single diagnostic result.

func CheckContainerStatus

func CheckContainerStatus(ctx context.Context, opts *Options) []Finding

CheckContainerStatus reports running containers as OK findings.

func CheckCrashLoops

func CheckCrashLoops(ctx context.Context, opts *Options) []Finding

CheckCrashLoops detects services stuck in restarting or exited state.

func CheckEnvDrift

func CheckEnvDrift(ctx context.Context, opts *Options) []Finding

CheckEnvDrift detects keys present in .env.example but missing from .env.

func CheckLocalhostMisuse

func CheckLocalhostMisuse(ctx context.Context, opts *Options) []Finding

CheckLocalhostMisuse warns when .env contains localhost references that should use Docker service names inside containers.

func CheckPortConflicts

func CheckPortConflicts(ctx context.Context, opts *Options) []Finding

CheckPortConflicts verifies that ports configured in stackup.yml health checks are available.

type Options

type Options struct {
	ComposeFile string
	EnvFile     string
	ExampleFile string
	ConfigFile  string
}

Options holds file paths and configuration for diagnostic checks.

type Severity

type Severity int

Severity represents the importance level of a diagnostic finding.

const (
	SeverityError Severity = iota
	SeverityWarning
	SeverityOK
)

Jump to

Keyboard shortcuts

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