Documentation
¶
Overview ¶
Package doctor implements `vegaload doctor`: a set of small, independent checks that answer "will VegaLoad work from here?" for the CLI, for each agent host (Cursor, Claude Code, Claude Desktop), and for a target.
Every check returns pass, warn, fail, or skip with a one-line message and, for problems, a fix. Checks that can be repaired safely carry a fix function that `--fix` runs. Nothing changes on disk unless the caller asks for fixes, and nothing is sent to Harness unless it asks for the harness checks (NFR-05).
The package knows nothing about the engine, protocols, or reporting. Host-specific file locations come from internal/hosts, the same source `vegaload init` writes from.
Index ¶
- func ProtocolForScheme(scheme string) string
- func SchemesFor(protocol string) []string
- func WriteJSON(w io.Writer, rep Report, home string) error
- func WriteJSONL(w io.Writer, rep Report, home string) error
- func WriteText(w io.Writer, rep Report, home string, verbose bool)
- type Check
- type Env
- type FixFunc
- type Options
- type Report
- type Result
- type Status
- type Summary
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProtocolForScheme ¶ added in v0.9.0
ProtocolForScheme is the -protocol name for a URL scheme, or "" when the scheme is not one this binary speaks.
func SchemesFor ¶ added in v0.9.0
SchemesFor lists the URL schemes that use a -protocol name, in order. https is also listed for http2: the map names one protocol per scheme, and an https target is probed as http1.
func WriteJSONL ¶
WriteJSONL prints one JSON object per line: a "check" line per result, then one "summary" line (FR-CLI-05's streaming mode).
Types ¶
type Env ¶
type Env struct {
Version string
Exe string // the running vegaload binary
OS string
Arch string
Home string
Dir string
Getenv func(string) string
LookPath func(string) (string, error)
DirExists func(string) bool // nil means the real file system
LookupHost func(ctx context.Context, host string) ([]string, error)
DialContext func(ctx context.Context, network, addr string) (net.Conn, error)
HTTPClient *http.Client
// RunCmd runs a command and returns its combined output, trimmed.
RunCmd func(ctx context.Context, name string, args ...string) (string, error)
// Probe starts an MCP server command and lists its tools.
Probe func(ctx context.Context, c mcpprobe.Command) (mcpprobe.Info, error)
}
Env is everything the checks read from the machine. Tests replace the pieces they care about; DefaultEnv fills in the real ones.
func DefaultEnv ¶
DefaultEnv returns an Env wired to the real machine.
type FixFunc ¶
FixFunc repairs one problem. With dryRun set it changes nothing and returns what it would do. Otherwise it returns what it did.
type Options ¶
type Options struct {
Dir string // project directory; empty means Env.Dir
Hosts []string // "auto" (default), "all", "none", or host IDs
MCPConfig string // an extra MCP config file to check (host "custom")
Target string // target URL or host:port to check
AllowTargets []string // extra allowlisted hosts, as for `run -allow-target`
Smoke bool // run a one-user, one-second test against Target
Harness bool // verify Harness RT access (the only network call to Harness)
Fix bool // repair what can be repaired safely
DryRun bool // with Fix: report planned repairs, change nothing
Only []string // run only these check IDs or prefixes
Skip []string // skip these check IDs or prefixes
Timeout time.Duration
}
Options selects and tunes the checks.
type Report ¶
type Report struct {
Version string `json:"version"`
OS string `json:"os"`
Arch string `json:"arch"`
Dir string `json:"dir"`
Summary Summary `json:"summary"`
Results []Result `json:"results"`
Started time.Time `json:"-"`
}
Report is a complete doctor run.
type Result ¶
type Result struct {
ID string `json:"id"`
Category string `json:"category"`
Name string `json:"name"`
Status Status `json:"status"`
Message string `json:"message"`
Detail []string `json:"detail,omitempty"`
Fix string `json:"fix,omitempty"`
Fixable bool `json:"fixable,omitempty"`
FixPlan string `json:"fix_plan,omitempty"` // set by --fix -dry-run
Fixed bool `json:"fixed,omitempty"` // set when --fix repaired it
FixError string `json:"fix_error,omitempty"` // set when --fix failed
DurationMS int64 `json:"duration_ms"`
// contains filtered or unexported fields
}
Result is one check's outcome. The JSON form is the stable output contract of `vegaload doctor -output json` (FR-CLI-05).