doctor

package
v0.0.0-...-f9a56e6 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: MPL-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package doctor provides health check diagnostics for start configuration.

Index

Constants

View Source
const IssuesURL = "https://github.com/start-cli/start/issues"

IssuesURL is the issues URL for the project.

View Source
const RepoURL = "https://github.com/start-cli/start"

RepoURL is the repository URL for the project.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildInfo

type BuildInfo struct {
	Version      string
	Commit       string
	BuildDate    string
	GoVersion    string
	Platform     string
	IndexVersion string // Registry index version (empty if unavailable)
	IndexPath    string // Configured library_index path (empty if using built-in default)
}

BuildInfo holds version and build information.

func DefaultBuildInfo

func DefaultBuildInfo() BuildInfo

DefaultBuildInfo returns build info with runtime defaults.

type CheckResult

type CheckResult struct {
	Status  Status   `json:"status"`
	Label   string   `json:"label"`             // Short label (e.g., "claude", "agents.cue")
	Message string   `json:"message"`           // Detail message (e.g., "/usr/local/bin/claude", "NOT FOUND")
	Fix     string   `json:"fix,omitempty"`     // Suggested fix action
	Details []string `json:"details,omitempty"` // Additional details for verbose mode
	Indent  int      `json:"-"`                 // Additional indentation level (0 = normal, 1+ = nested)
	NoIcon  bool     `json:"-"`                 // Suppress status icon for this result
}

CheckResult holds the result of a single check item.

type Options

type Options struct {
	Verbose bool
	Quiet   bool
	Stdout  io.Writer
	Stderr  io.Writer
}

Options configures the doctor run.

type Report

type Report struct {
	Sections []SectionResult `json:"sections"`
}

Report holds the complete diagnostic report.

func (Report) ErrorCount

func (r Report) ErrorCount() int

ErrorCount returns the number of failures in the report.

func (Report) HasIssues

func (r Report) HasIssues() bool

HasIssues returns true if the report contains any failures or warnings.

func (Report) Issues

func (r Report) Issues() []CheckResult

Issues returns all check results that are failures or warnings.

func (Report) WarnCount

func (r Report) WarnCount() int

WarnCount returns the number of warnings in the report.

type Reporter

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

Reporter handles output formatting for doctor results.

func NewReporter

func NewReporter(w io.Writer, verbose, quiet bool) *Reporter

NewReporter creates a new reporter.

func (*Reporter) Print

func (r *Reporter) Print(report Report)

Print outputs the complete report.

type SchemaSet

type SchemaSet struct {
	Agent    cue.Value // #Agent definition
	Role     cue.Value // #Role definition
	Context  cue.Value // #Context definition
	Task     cue.Value // #Task definition
	Settings cue.Value // #Settings definition
}

SchemaSet holds parsed CUE schema definitions for validation.

func LoadSchemas

func LoadSchemas(dir string, reg modconfig.Registry) (SchemaSet, error)

LoadSchemas loads CUE schema definitions from a fetched module directory.

type SectionResult

type SectionResult struct {
	Name    string        `json:"name"`
	Results []CheckResult `json:"results"`
	Summary string        `json:"summary,omitempty"` // Optional summary (e.g., "2 configured")
	NoIcons bool          `json:"-"`                 // If true, don't show status icons (for info-only sections)
}

SectionResult holds the results for a check section.

func CheckAgents

func CheckAgents(cfgValue cue.Value) SectionResult

CheckAgents validates configured agent binaries are available.

func CheckCache

func CheckCache() SectionResult

CheckCache checks the registry index cache status.

func CheckConfiguration

func CheckConfiguration(paths config.Paths) SectionResult

CheckConfiguration validates CUE configuration files.

func CheckContexts

func CheckContexts(cfgValue cue.Value) SectionResult

CheckContexts validates configured context files exist.

func CheckEnvironment

func CheckEnvironment(paths config.Paths) SectionResult

CheckEnvironment validates runtime environment.

func CheckIntro

func CheckIntro() SectionResult

CheckIntro returns the intro section with repository info.

func CheckRoles

func CheckRoles(cfgValue cue.Value) SectionResult

CheckRoles validates configured role files exist.

func CheckSchemaValidation

func CheckSchemaValidation(paths config.Paths, schemas SchemaSet) SectionResult

CheckSchemaValidation validates config files against CUE schemas.

func CheckSettings

func CheckSettings(paths config.Paths, cfgValue cue.Value) SectionResult

CheckSettings resolves and displays all settings with their sources, and validates specific settings (default_agent, shell).

func CheckTasks

func CheckTasks(cfgValue cue.Value) SectionResult

CheckTasks validates configured task files exist.

func CheckVersion

func CheckVersion(info BuildInfo) SectionResult

CheckVersion returns the version section with build info.

type Status

type Status int

Status represents the result status of a check.

const (
	StatusPass Status = iota
	StatusWarn
	StatusFail
	StatusInfo
	StatusNotFound
)

func (Status) MarshalJSON

func (s Status) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler for Status, emitting the string representation.

func (Status) String

func (s Status) String() string

String returns the string representation of a Status.

func (Status) Symbol

func (s Status) Symbol() string

Symbol returns the display symbol for a Status.

Jump to

Keyboard shortcuts

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