doctor

package
v0.4.8 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package doctor provides repository health checking and repair operations.

Index

Constants

View Source
const (
	RepairCleanLocks               = "clean_locks"
	RepairRebindWorkspacePaths     = "rebind_workspace_paths"
	RepairCleanRuntimeTmp          = "clean_runtime_tmp"
	RepairCleanRuntimeOperations   = "clean_runtime_operations"
	RepairCleanRuntimeCleanupPlans = "clean_runtime_cleanup_plans"
)
View Source
const (
	ErrorCodeFormatVersionMissing        = "E_FORMAT_VERSION_MISSING"
	ErrorCodeFormatVersionInvalid        = "E_FORMAT_VERSION_INVALID"
	ErrorCodeFormatVersionUnsupported    = "E_FORMAT_VERSION_UNSUPPORTED"
	ErrorCodeWorktreeListFailed          = "E_WORKTREE_LIST_FAILED"
	ErrorCodeWorktreePayloadInvalid      = "E_WORKTREE_PAYLOAD_INVALID"
	ErrorCodeWorktreePathBindingInvalid  = "E_WORKTREE_PATH_BINDING_INVALID"
	ErrorCodeWorktreePayloadMissing      = "E_WORKTREE_PAYLOAD_MISSING"
	ErrorCodeWorktreeHeadMissing         = "E_WORKTREE_HEAD_MISSING"
	ErrorCodeWorktreeHeadInvalid         = "E_WORKTREE_HEAD_INVALID"
	ErrorCodeWorktreeInvalidSnapshotID   = "E_WORKTREE_INVALID_SNAPSHOT_ID"
	ErrorCodeWorktreeHeadLatestMismatch  = "E_WORKTREE_HEAD_LATEST_MISMATCH"
	ErrorCodeDescriptorControlInvalid    = "E_DESCRIPTOR_CONTROL_INVALID"
	ErrorCodeDescriptorFilenameInvalid   = "E_DESCRIPTOR_FILENAME_INVALID"
	ErrorCodeLineageDescriptorListFailed = "E_LINEAGE_DESCRIPTOR_LIST_FAILED"
	ErrorCodeIntentControlInvalid        = "E_INTENT_CONTROL_INVALID"
	ErrorCodeIntentOrphan                = "E_INTENT_ORPHAN"
	ErrorCodeReadyControlInvalid         = "E_READY_CONTROL_INVALID"
	ErrorCodeReadyInvalid                = snapshot.PublishStateCodeReadyInvalid
	ErrorCodeReadyInvalidSnapshotID      = "E_READY_INVALID_SNAPSHOT_ID"
	ErrorCodeReadyDescriptorInvalid      = "E_READY_DESCRIPTOR_INVALID"
	ErrorCodeReadyDescriptorMissing      = snapshot.PublishStateCodeReadyDescriptorMissing
	ErrorCodeReadyMissing                = snapshot.PublishStateCodeReadyMissing
	ErrorCodeStrictVerifyFailed          = "E_STRICT_VERIFY_FAILED"
	ErrorCodeTmpControlInvalid           = "E_TMP_CONTROL_INVALID"
	ErrorCodeTmpOrphan                   = "E_TMP_ORPHAN"
	ErrorCodeAuditScanFailed             = "E_AUDIT_SCAN_FAILED"
	ErrorCodeCloneHistoryInvalid         = "E_CLONE_HISTORY_INVALID"
	ErrorCodeLifecyclePending            = "E_LIFECYCLE_PENDING"
)

Variables

This section is empty.

Functions

func RuntimeRepairActionIDs

func RuntimeRepairActionIDs() []string

RuntimeRepairActionIDs returns executable public runtime-safe repair IDs.

func SetSeparatedStrictPermissionCheckerForTest added in v0.4.7

func SetSeparatedStrictPermissionCheckerForTest(checker func(string) error) func()

Types

type Doctor

type Doctor struct {
	// contains filtered or unexported fields
}

Doctor performs repository health checks.

func NewDoctor

func NewDoctor(repoRoot string) *Doctor

NewDoctor creates a new doctor.

func (*Doctor) Check

func (d *Doctor) Check(strict bool) (*Result, error)

Check runs all diagnostic checks.

func (*Doctor) ListRepairActions

func (d *Doctor) ListRepairActions() []RepairAction

ListRepairActions returns executable public runtime-safe repair actions.

func (*Doctor) Repair

func (d *Doctor) Repair(actions []string) ([]RepairResult, error)

Repair executes the specified repair actions.

type Finding

type Finding struct {
	Category               string `json:"category"`
	Description            string `json:"description"`
	Severity               string `json:"severity"`
	ErrorCode              string `json:"error_code,omitempty"`
	Path                   string `json:"path,omitempty"`
	RecommendedNextCommand string `json:"recommended_next_command,omitempty"`
}

Finding represents a detected issue.

type RepairAction

type RepairAction struct {
	ID          string `json:"id"`
	Description string `json:"description"`
	AutoSafe    bool   `json:"auto_safe"`
}

RepairAction describes a repair operation.

type RepairResult

type RepairResult struct {
	Action  string `json:"action"`
	Success bool   `json:"success"`
	Message string `json:"message"`
	Cleaned int    `json:"cleaned,omitempty"`
}

RepairResult contains the result of a repair operation.

type Result

type Result struct {
	Healthy  bool      `json:"healthy"`
	Findings []Finding `json:"findings"`
}

Result contains doctor check results.

type SeparatedStrictResult added in v0.4.7

type SeparatedStrictResult struct {
	RepoID            string        `json:"repo_id,omitempty"`
	Workspace         string        `json:"workspace"`
	ControlRoot       string        `json:"control_root"`
	Folder            string        `json:"folder"`
	BoundaryValidated bool          `json:"-"`
	DoctorStrict      string        `json:"-"`
	Healthy           bool          `json:"healthy"`
	Findings          []Finding     `json:"findings"`
	Checks            []StrictCheck `json:"checks"`
}

func CheckSeparatedStrict added in v0.4.7

func CheckSeparatedStrict(req repo.SeparatedContextRequest) (*SeparatedStrictResult, error)

type StrictCheck added in v0.4.7

type StrictCheck struct {
	Name                   string  `json:"name"`
	Status                 string  `json:"status"`
	ErrorCode              *string `json:"error_code"`
	Message                string  `json:"message"`
	RecommendedNextCommand string  `json:"recommended_next_command,omitempty"`
}

Jump to

Keyboard shortcuts

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