doctor

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package doctor provides health check diagnostics for gz-git. It verifies system dependencies, configuration integrity, authentication, and repository state to help users diagnose issues.

Index

Constants

View Source
const (
	// DivergeBehindWarn: warn when local branch is this many commits behind upstream.
	DivergeBehindWarn = 10

	// DivergeAheadWarn: warn when local branch is this many commits ahead of upstream.
	DivergeAheadWarn = 20

	// BranchDistanceWarn: warn when develop is this many commits away from main/master.
	BranchDistanceWarn = 50

	// BranchDistanceError: error when develop is this many commits away from main/master.
	BranchDistanceError = 150

	// FeatureBranchDistanceWarn: warn when a feature branch is this far from its base.
	FeatureBranchDistanceWarn = 30

	// FeatureBranchDistanceError: error when a feature branch exceeds this distance.
	FeatureBranchDistanceError = 100

	// StaleFeatureBranchDays: feature branches older than this are stale.
	StaleFeatureBranchDays = 30
)

Thresholds for repository health checks.

Variables

This section is empty.

Functions

This section is empty.

Types

type Category

type Category string

Category groups related checks together.

const (
	// CategorySystem groups system dependency checks.
	CategorySystem Category = "system"
	// CategoryConfig groups configuration file checks.
	CategoryConfig Category = "config"
	// CategoryAuth groups authentication checks.
	CategoryAuth Category = "auth"
	// CategoryForge groups forge API connectivity checks.
	CategoryForge Category = "forge"
	// CategoryRepo groups repository state checks.
	CategoryRepo Category = "repo"
)

type CheckResult

type CheckResult struct {
	Name     string   `json:"name"`
	Category Category `json:"category"`
	Status   Status   `json:"status"`
	Message  string   `json:"message"`
	Detail   string   `json:"detail,omitempty"`
}

CheckResult represents the outcome of a single diagnostic check.

type Options

type Options struct {
	SkipForge bool
	SkipRepo  bool
	Verbose   bool
	Directory string // working directory for repo checks
	ScanDepth int    // max directory depth for repo scanning (default 1)
}

Options configures which checks to run.

type Report

type Report struct {
	Checks   []CheckResult `json:"checks"`
	Summary  Summary       `json:"summary"`
	Duration time.Duration `json:"duration"`
}

Report holds the complete doctor diagnostic report.

func Run

func Run(ctx context.Context, opts Options) *Report

Run executes all diagnostic checks and returns a report.

type Status

type Status string

Status represents the result status of a single check.

const (
	// StatusOK indicates the check passed.
	StatusOK Status = "ok"
	// StatusWarning indicates a non-critical issue.
	StatusWarning Status = "warning"
	// StatusError indicates a critical issue.
	StatusError Status = "error"
	// StatusUnreachable indicates the target cannot be reached.
	StatusUnreachable Status = "unreachable"
	// StatusSkipped indicates the check was skipped.
	StatusSkipped Status = "skipped"
)

type Summary

type Summary struct {
	OK          int `json:"ok"`
	Warning     int `json:"warning"`
	Error       int `json:"error"`
	Unreachable int `json:"unreachable"`
	Skipped     int `json:"skipped"`
	Total       int `json:"total"`
}

Summary counts results by status.

Jump to

Keyboard shortcuts

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