Help us shape the future of Go! Take the 2026 Go Developer Survey

debug

package
v0.30.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package debug implements the debug command, which dumps stack, snapshot, continuation, and remote metadata state as JSON for troubleshooting.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Action

func Action(ctx context.Context, deps Deps, opts Options) error

Action collects and outputs debugging information

Types

type BranchInfo

type BranchInfo struct {
	Name           string         `json:"name"`
	SHA            string         `json:"sha,omitempty"`
	Parent         string         `json:"parent,omitempty"`
	ParentRevision string         `json:"parent_revision,omitempty"`
	Children       []string       `json:"children,omitempty"`
	IsTracked      bool           `json:"is_tracked"`
	IsFixed        bool           `json:"is_fixed"`
	IsTrunk        bool           `json:"is_trunk"`
	PRInfo         *engine.PrInfo `json:"pr_info,omitempty"`
	MetadataRefSHA string         `json:"metadata_ref_sha,omitempty"`
}

BranchInfo represents detailed information about a branch

type CommandSnapshot

type CommandSnapshot struct {
	Timestamp     time.Time `json:"timestamp"`
	Command       string    `json:"command"`
	Args          []string  `json:"args"`
	CurrentBranch string    `json:"current_branch"`
}

CommandSnapshot represents a single command from the undo history

type ContinuationStateInfo

type ContinuationStateInfo struct {
	BranchesToRestack      []string `json:"branches_to_restack,omitempty"`
	BranchesToSync         []string `json:"branches_to_sync,omitempty"`
	CurrentBranchOverride  string   `json:"current_branch_override,omitempty"`
	RebasedBranchBase      string   `json:"rebased_branch_base,omitempty"`
	ExpectedBranchRevision string   `json:"expected_branch_revision,omitempty"`
}

ContinuationStateInfo represents continuation state

type Deps

type Deps struct {
	Engine   Engine
	Out      output.Output
	RepoRoot string
}

Deps are the collaborators debug needs.

type Engine

type Engine interface {
	Snapshots() ([]engine.SnapshotInfo, error)
	LoadSnapshot(snapshotID string) (*engine.Snapshot, error)
	Trunk() engine.Branch
	CurrentBranch(ctx context.Context) *engine.Branch
	AllBranches() engine.Branches
	GetBranch(branchName string) engine.Branch
	Graph(ctx context.Context, strategy engine.SortStrategy) *engine.StackGraph
	ListMetadataRefs(ctx context.Context) (map[string]string, error)
	BatchReadMetadataRaw(ctx context.Context, branchNames []string) (engine.MetaMap, map[string]error)
	BatchRevisions(ctx context.Context, branches engine.Branches) engine.RevisionMap
	ReadBranchStatuses(ctx context.Context, branches engine.Branches) engine.BranchStatuses
	GetRemoteURL(ctx context.Context) (string, error)
	EnsureRemoteMetadata(ctx context.Context) error
	LoadRemoteMetadataCache(ctx context.Context) error
	RemoteMetadataCache() engine.RemoteMetadataView
	IsRemoteSyncEnabled(ctx context.Context) bool
}

Engine lists exactly the engine methods debug calls.

type Info

type Info struct {
	Timestamp           time.Time                `json:"timestamp"`
	RecentCommands      []CommandSnapshot        `json:"recent_commands"`
	StackState          StackStateInfo           `json:"stack_state"`
	ContinuationState   *ContinuationStateInfo   `json:"continuation_state,omitempty"`
	RepositoryInfo      RepositoryInfo           `json:"repository_info"`
	RemoteMetadataState *RemoteMetadataStateInfo `json:"remote_metadata_state,omitempty"`
}

Info represents the complete debugging information

type MetadataDiffInfo

type MetadataDiffInfo struct {
	Branch      string   `json:"branch"`
	DiffFields  []string `json:"diff_fields"`
	LocalValue  string   `json:"local_value,omitempty"`
	RemoteValue string   `json:"remote_value,omitempty"`
}

MetadataDiffInfo represents a difference between local and remote metadata

type Options

type Options struct {
	Limit      int  // Limit number of recent commands to show (0 = all)
	ShowRemote bool // Fetch and show remote metadata state
}

Options contains options for the debug command

type RemoteMetadataStateInfo

type RemoteMetadataStateInfo struct {
	RemoteStateAvailable bool                     `json:"remote_state_available"`
	RemoteRefs           map[string]RemoteRefInfo `json:"remote_refs,omitempty"`
	LocalVsRemoteDiffs   []MetadataDiffInfo       `json:"local_vs_remote_diffs,omitempty"`
}

RemoteMetadataStateInfo represents the state of metadata on the remote

type RemoteRefInfo

type RemoteRefInfo struct {
	SHA          string `json:"sha"`
	LastModified string `json:"last_modified,omitempty"`
	ModifiedBy   string `json:"modified_by,omitempty"`
	Scope        string `json:"scope,omitempty"`
}

RemoteRefInfo represents information about a single remote ref

type RepositoryInfo

type RepositoryInfo struct {
	RemoteURL string `json:"remote_url,omitempty"`
	RepoRoot  string `json:"repo_root,omitempty"`
}

RepositoryInfo represents basic repository information

type StackStateInfo

type StackStateInfo struct {
	Trunk         string       `json:"trunk"`
	CurrentBranch string       `json:"current_branch"`
	Branches      []BranchInfo `json:"branches"`
}

StackStateInfo represents the complete stack state

Jump to

Keyboard shortcuts

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