doctor

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 2 Imported by: ? 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 holds the shape of git-stack's health checks: what a check looks at, what it found and how it can put it right. The checks themselves live with whatever they check (the backend checks gh and gh-stack, the use cases check the stacks) and pkg/app runs them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Check

type Check struct {
	// ID is stable and machine readable ("gh-stack.version").
	ID string
	// Title names what is checked ("gh-stack is up to date").
	Title string
	// Run looks and reports; it must not change anything.
	Run func(ctx context.Context) Finding
	// Fix tries to put right what Run found wrong; nil when that has to be
	// done by hand. FixLabel says what it will do ("gh extension upgrade
	// stack").
	Fix      func(ctx context.Context) error
	FixLabel string
	// Sub run after this check unless it failed.
	Sub []Check
}

Check is one thing to look at, with the checks that only make sense once it passes.

type Finding

type Finding struct {
	Status Status
	// Summary is one line: "gh-stack v0.3.0", "2 branches have no commits".
	Summary string
	// Details are extra lines, one idea each (a branch, a file).
	Details []string
	// Steps are things the user can run to deal with it by hand.
	Steps []string
}

Finding is what a check saw.

type Provider

type Provider interface {
	Checks(repo *git.Repo) []Check
}

Provider contributes checks. repo is nil outside a repository; checks that need one are left out then.

type Result

type Result struct {
	ID      string   `json:"id"`
	Title   string   `json:"title"`
	Status  Status   `json:"status"`
	Summary string   `json:"summary,omitempty"`
	Details []string `json:"details,omitempty"`
	Steps   []string `json:"next_steps,omitempty"`
	// Fix is what --fix does (or did) about it, when it can do anything.
	Fix string `json:"fix,omitempty"`
	// FixError is why the fix didn't work, when one was tried and failed.
	FixError string `json:"fix_error,omitempty"`
	// Parent is the ID of the check this one hangs off, in a Flatten list.
	Parent string `json:"parent,omitempty"`
	// Checks are the checks that hang off this one. They are left out of
	// JSON (a schema can't describe the recursion); Flatten lists them
	// with Parent set instead.
	Checks []Result `json:"-"`
}

Result is a check that has run.

func Flatten

func Flatten(results []Result) []Result

Flatten lists every result depth first, each with Parent set and its Checks left out.

type Status

type Status string

Status is the outcome of one check.

const (
	// OK: nothing wrong.
	OK Status = "ok"
	// Warn: it works, but something is worth knowing or tidying.
	Warn Status = "warn"
	// Fail: something git-stack needs is missing or broken.
	Fail Status = "fail"
	// Skipped: not run, because the check it hangs off failed or doesn't
	// apply here (outside a repository, say).
	Skipped Status = "skipped"
	// Fixed: it failed or warned, and --fix put it right.
	Fixed Status = "fixed"
)

Jump to

Keyboard shortcuts

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