Documentation
¶
Overview ¶
Package doctor reports why baum can or cannot find its tools, backend and GitHub token, with a fix for each problem.
It runs "<tool> --version" for git, the same checks as the desktop engine runs for claude, codex (including codex's read-only sandbox preflight) and cursor-agent (its --help and --version), and for anthropic (that ANTHROPIC_API_KEY is set; the key is not tried against the API), and reads baum's credential store when no explicit GitHub token is configured, and at most one network request, for the signed price list. The tools run with the environment their backends give them, never the whole of ours. It never prints a token or an API key, only where one was found.
Index ¶
Constants ¶
const (
IssuesNewURL = "https://github.com/baum-ai/baum/issues/new"
)
IssuesNewURL opens a new issue in the public repository. The bug report form reads its fields from the query (the ids in .github/ISSUE_TEMPLATE/bug_report.yml); the user sees every value in the browser and sends nothing until they submit the form.
Variables ¶
This section is empty.
Functions ¶
func IssueURL ¶
IssueURL is a link that opens the public repository's new bug report with the version, OS and the report's PublicSummary filled in. The summary loses whole lines from its end, with a note, until the link fits maxIssueURL. The tray and the window menu open it; the app's dialog builds its own from PublicIssueParts.
Types ¶
type Check ¶
type Check struct {
ID string `json:"id"`
Label string `json:"label"`
Status Status `json:"status"`
Detail string `json:"detail"`
Path string `json:"path,omitempty"`
Version string `json:"version,omitempty"`
Source string `json:"source,omitempty"`
Fix string `json:"fix,omitempty"`
}
Check is one finding. Fix is set on every warning and problem.
type Daemon ¶
type Daemon struct {
Running bool
Version string
Protocol int
PID int
Uptime time.Duration
// State is the daemon's state directory (logs, credential) and Socket its
// control socket.
State, Socket string
// Older is set when this baum would replace the daemon; Incompatible when
// it speaks a newer protocol than this baum.
Older, Incompatible bool
// Err is why the daemon could not be asked, when it holds its lock but
// does not answer.
Err error
}
Daemon is what the report says about the per-user daemon. It never holds the daemon's credential.
type IssueInfo ¶
type IssueInfo struct {
Version string
// OS is for example "linux/amd64".
OS string
// Home is the user's home directory, which the summary writes as "~".
Home string
}
IssueInfo is what an issue link states besides the report.
type IssueParts ¶
type IssueParts struct {
Version string `json:"version"`
OS string `json:"os"`
Versions string `json:"versions"`
Diagnostics string `json:"diagnostics"`
// MaxURL is the longest link GitHub is sure to answer with the form.
MaxURL int `json:"max_url"`
// TruncationNote ends a diagnostics field that lost lines to fit MaxURL.
TruncationNote string `json:"truncation_note"`
}
IssueParts is what the app's "Report a problem" dialog may attach to a new issue, each part already scrubbed: the version and OS fields, and the diagnostics field at either level the person can choose. The dialog builds the link itself, so its preview is exactly what the link carries.
type Options ¶
type Options struct {
// FetchPrices fetches the signed price list first. It is the report's one
// network request.
FetchPrices bool
// Desktop reports for the desktop app and its daemon, which run jobs with
// Claude Code and Codex only: the cursor-agent and anthropic backends are
// neither checked nor offered, and a configured backend other than auto,
// claude or codex is a problem.
Desktop bool
Getenv func(string) string
LookPath func(string) (string, error)
// Run runs path with args in exactly env and returns its combined output,
// under ctx. The report decides env per tool and never passes our own.
Run func(ctx context.Context, env []string, path string, args ...string) (string, error)
// Backends builds the backends to check; nil builds the real ones from
// the configuration, as the desktop engine does.
Backends func(config.Config) generate.Backends
// GitHubToken resolves the token for host; nil uses the configuration's
// own resolver.
GitHubToken func(ctx context.Context, cfg config.Config, host string) (token, source string, err error)
// RefreshPrices fetches the signed list; nil uses pricing.Refresh without
// storing it, since a diagnostic run must not change the daemon's state.
RefreshPrices func(ctx context.Context) error
// PriceSource describes the active list; nil uses pricing.CurrentSource.
PriceSource func() pricing.Source
// Registry lists the registered clones of the registry file at path,
// which exists. The default opens it read-only.
Registry func(ctx context.Context, path string) ([]repos.Clone, error)
// Repositories lists the picked repositories of the registry file, so the
// report can count those without a clone. The default opens it read-only
// and only applies with the default Registry; nil omits the count.
Repositories func(ctx context.Context, path string) ([]repos.Repository, error)
// Daemon describes the per-user baum daemon; nil omits that check. The
// caller supplies it because the daemon itself serves this report.
Daemon func(ctx context.Context) Daemon
// Executable is this baum's executable, compared with the baum on PATH;
// nil is os.Executable.
Executable func() (string, error)
}
Options configure Run. The zero value inspects the real environment; tests replace the pieces that touch it.
type Report ¶
Report is the ordered checks and the worst status among them: problem, else warning, else ok. Info checks do not change it.
func (Report) PublicIssueParts ¶
func (r Report) PublicIssueParts(info IssueInfo) IssueParts
PublicIssueParts is the report's IssueParts.
func (Report) PublicSummary ¶
PublicSummary is the report as markdown lines that are safe to paste into a public issue: per check its label, status, version, path and detail, each scrubbed (see Scrub). It leaves out the per-clone store checks, which name the user's repositories and where they are cloned, and replaces the configuration's load error, whose text can quote the file. Fix lines are left out: they repeat the detail with paths of this machine, and the maintainers know them.
func (Report) PublicVersions ¶
PublicVersions is the versions-only summary: per check that found a version, its label and that version, scrubbed (see Scrub). It names no paths and no details. The per-clone store checks are left out, as in PublicSummary.