doctor

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConsistencyReport

type ConsistencyReport struct {
	OrphanedRegistryEntries []string // In registry but no directory
	OrphanedDirectories     []string // Directory exists but not in registry
	OrphanedContainers      []string // Containers running but not in registry
	InvalidWorktrees        []string // Directory exists but not valid git worktree
}

ConsistencyReport contains registry/directory/container consistency issues

func CheckConsistency

func CheckConsistency(cfg *config.Config, reg *registry.Registry, projectName string) ConsistencyReport

CheckConsistency checks for mismatches between registry, directories, and containers

type DockerHealth

type DockerHealth struct {
	Installed        bool
	Running          bool
	ComposeAvailable bool
	Version          string
	Error            string
}

DockerHealth contains Docker availability status

func CheckDocker

func CheckDocker() DockerHealth

CheckDocker checks Docker installation and availability

type GitStatusReport

type GitStatusReport struct {
	Feature          string
	Branch           string
	UncommittedCount int
	BehindMain       int
	AheadOrigin      int
	BranchExists     bool
	YoloMode         bool
	Error            string
}

GitStatusReport contains git status for a single worktree

func CheckGitStatus

func CheckGitStatus(cfg *config.Config, wt *registry.Worktree, projectPath string, fetch bool) GitStatusReport

CheckGitStatus checks git status for a worktree using the given project path as the git directory.

type Options

type Options struct {
	FeatureFilter string
	NoFetch       bool
	AutoFix       bool
}

Options for running health checks

type PortAllocation

type PortAllocation struct {
	Feature string
	Service string
	Port    int
}

PortAllocation tracks which feature/service uses a port

type PortConflict

type PortConflict struct {
	Service string
	Port    int
	Feature string
}

PortConflict represents a port that's allocated but in use

type PortOutOfRange

type PortOutOfRange struct {
	Service string
	Port    int
	Feature string
	Range   [2]int
}

PortOutOfRange represents a port allocation outside configured ranges

type PortRangeInfo

type PortRangeInfo struct {
	Min       int
	Max       int
	Allocated int
	Available int
}

PortRangeInfo contains information about a port range

type PortReport

type PortReport struct {
	Conflicts      []PortConflict
	OutOfRange     []PortOutOfRange
	TotalAllocated int
	TotalAvailable int
	PortRanges     map[string]PortRangeInfo
}

PortReport contains port allocation status

func CheckPorts

func CheckPorts(reg *registry.Registry, workCfg *config.WorktreeConfig) PortReport

CheckPorts checks port allocations for conflicts and range violations

type Report

type Report struct {
	Docker      DockerHealth
	Consistency ConsistencyReport
	GitStatus   []GitStatusReport
	Staleness   []StalenessReport
	Ports       PortReport
	Summary     Summary
}

Report contains all diagnostic results

func RunHealthCheck

func RunHealthCheck(cfg *config.Config, workCfg *config.WorktreeConfig, reg *registry.Registry, opts Options) *Report

RunHealthCheck runs all diagnostic checks and returns a comprehensive report

func (*Report) ExitCode

func (r *Report) ExitCode() int

ExitCode returns the appropriate exit code based on report status

func (*Report) Print

func (r *Report) Print()

Print outputs the report in human-readable format

func (*Report) ToJSON

func (r *Report) ToJSON() string

ToJSON outputs the report in JSON format

type StalenessReport

type StalenessReport struct {
	Feature           string
	Branch            string
	LastModified      time.Time
	DaysSinceModified int
	BranchMerged      bool
	MergedDate        string
	NoContainers      bool
	Score             int // 0-3 based on criteria met
}

StalenessReport contains staleness metrics for a worktree

func CheckStaleness

func CheckStaleness(cfg *config.Config, wt *registry.Worktree, projectName string, projectPath string) StalenessReport

CheckStaleness checks if a worktree is stale based on multiple criteria. projectPath is the path to the first project directory within the worktree (used for git operations).

type Summary

type Summary struct {
	TotalWorktrees   int
	RunningWorktrees int
	WarningsCount    int
	ErrorsCount      int
	StaleWorktrees   int
	HealthStatus     string // GOOD, FAIR, POOR
}

Summary contains overall health metrics

Jump to

Keyboard shortcuts

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