doctor

package
v0.37.2 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountFixable

func CountFixable(results []Result) int

CountFixable returns the number of fixable issues across all results.

func Summary

func Summary(results []Result) (passed, warned, failed int)

Summary returns counts of passed, warned, and failed items across all results.

Types

type Check

type Check interface {
	Name() string
	Run(ctx context.Context) Result
}

Check defines the interface for a doctor check.

type CheckItem

type CheckItem struct {
	Label   string `json:"label"`
	Status  Status `json:"-"`
	Detail  string `json:"detail,omitempty"`
	Fixable bool   `json:"fixable,omitempty"`

	// For JSON output
	StatusStr string `json:"status"`
}

CheckItem represents a single line item within a check result.

type ConfigCheck

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

ConfigCheck validates the configuration file.

func NewConfigCheck

func NewConfigCheck(cfg *config.Config, configPath string) *ConfigCheck

NewConfigCheck creates a new configuration check.

func (*ConfigCheck) Name

func (c *ConfigCheck) Name() string

func (*ConfigCheck) Run

func (c *ConfigCheck) Run(ctx context.Context) Result

type OrphanCheck

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

OrphanCheck detects directories in the repos folder without session records.

func NewOrphanCheck

func NewOrphanCheck(sessions session.Store, reposDir string, fix bool) *OrphanCheck

NewOrphanCheck creates a new orphan worktree check. If fix is true, orphaned directories will be deleted.

func (*OrphanCheck) Name

func (c *OrphanCheck) Name() string

func (*OrphanCheck) Run

func (c *OrphanCheck) Run(ctx context.Context) Result

type PluginCheck

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

PluginCheck reports each plugin's availability.

func NewPluginCheck

func NewPluginCheck(plugins []PluginInfo) *PluginCheck

NewPluginCheck creates a new plugin availability check.

func (*PluginCheck) Name

func (c *PluginCheck) Name() string

func (*PluginCheck) Run

func (c *PluginCheck) Run(_ context.Context) Result

type PluginInfo

type PluginInfo struct {
	Name      string
	Available bool
	Disabled  bool // explicitly disabled via config (enabled: false)
}

PluginInfo describes a plugin's availability for doctor checks. Decoupled from the plugin interface to avoid import cycles.

type RepoDirsCheck

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

RepoDirsCheck verifies that configured workspaces entries exist and are accessible.

func NewRepoDirsCheck

func NewRepoDirsCheck(dirs []string) *RepoDirsCheck

NewRepoDirsCheck creates a new repo directories check.

func (*RepoDirsCheck) Name

func (c *RepoDirsCheck) Name() string

func (*RepoDirsCheck) Run

func (c *RepoDirsCheck) Run(_ context.Context) Result

type Result

type Result struct {
	Name  string      `json:"name"`
	Items []CheckItem `json:"items"`
}

Result represents the outcome of a check containing multiple items.

func RunAll

func RunAll(ctx context.Context, checks []Check) []Result

RunAll executes all checks and returns their results.

type Status

type Status int

Status represents the result status of a check item.

const (
	StatusPass Status = iota
	StatusWarn
	StatusFail
)

func (Status) String

func (s Status) String() string

type ToolsCheck

type ToolsCheck struct{}

ToolsCheck verifies that required external tools are available on $PATH.

func NewToolsCheck

func NewToolsCheck() *ToolsCheck

NewToolsCheck creates a new tools check.

func (*ToolsCheck) Name

func (c *ToolsCheck) Name() string

func (*ToolsCheck) Run

func (c *ToolsCheck) Run(_ context.Context) Result

Jump to

Keyboard shortcuts

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