Documentation
¶
Overview ¶
Package doctor provides workspace health checks and diagnostics for bc.
Run a full health check:
report := doctor.RunAll(ctx, ws)
for _, cat := range report.Categories {
fmt.Println(cat.Name)
for _, item := range cat.Items {
fmt.Printf(" %s %s\n", item.Status, item.Message)
}
}
Run a single category:
cat := doctor.CheckWorkspace(ws) cat := doctor.CheckDatabase(ws) cat := doctor.CheckAgents(ctx, ws) cat := doctor.CheckTools(ctx) cat := doctor.CheckGit(ctx, ws)
Index ¶
- func ValidCategories() []string
- type CategoryReport
- func CategoryByName(ctx context.Context, ws *workspace.Workspace, name string) *CategoryReport
- func CheckAgents(ctx context.Context, ws *workspace.Workspace) CategoryReport
- func CheckDatabase(ws *workspace.Workspace) CategoryReport
- func CheckGit(ctx context.Context, ws *workspace.Workspace) CategoryReport
- func CheckTools(ctx context.Context) CategoryReport
- func CheckWorkspace(ws *workspace.Workspace) CategoryReport
- type FixResult
- type Item
- type Report
- type Severity
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidCategories ¶
func ValidCategories() []string
ValidCategories returns the list of valid category names.
Types ¶
type CategoryReport ¶
CategoryReport is the result of checking one category.
func CategoryByName ¶
CategoryByName runs a single named category check. Returns nil if the category name is unknown.
func CheckAgents ¶
func CheckAgents(ctx context.Context, ws *workspace.Workspace) CategoryReport
CheckAgents checks for orphaned sessions and stale agents.
func CheckDatabase ¶
func CheckDatabase(ws *workspace.Workspace) CategoryReport
CheckDatabase checks SQLite integrity and table existence.
func CheckGit ¶
func CheckGit(ctx context.Context, ws *workspace.Workspace) CategoryReport
CheckGit checks git worktree health for the workspace.
func CheckTools ¶
func CheckTools(ctx context.Context) CategoryReport
CheckTools checks binary installations: tmux, git, registered providers, and env vars.
func CheckWorkspace ¶
func CheckWorkspace(ws *workspace.Workspace) CategoryReport
CheckWorkspace checks the .bc/ directory structure, config validity, and roles.
func (*CategoryReport) Counts ¶
func (c *CategoryReport) Counts() (ok, warn, fail int)
Counts tallies ok/warn/fail across Items.
type FixResult ¶
FixResult describes one auto-fix action taken (or that would be taken).
func Fix ¶
Fix runs auto-fix actions for all fixable issues found in report. If dryRun is true no changes are made; actions are described instead.
func FixCategory ¶
func FixCategory(ctx context.Context, ws *workspace.Workspace, cat *CategoryReport, dryRun bool) []FixResult
FixCategory runs auto-fix actions for issues in a single category.
type Item ¶
type Item struct {
Name string `json:"name"`
Message string `json:"message"`
Fix string `json:"fix,omitempty"`
Severity Severity `json:"severity"`
}
Item is the result of a single health check. Field order optimized by fieldalignment.
type Report ¶
type Report struct {
Categories []CategoryReport `json:"categories"`
}
Report contains all category results from a full health check.
type Severity ¶
type Severity int
Severity indicates the outcome of a single health check item.
func (Severity) MarshalJSON ¶
MarshalJSON encodes a Severity as its string representation.
func (*Severity) UnmarshalJSON ¶
UnmarshalJSON decodes a Severity from its string representation.