worktreerun

package
v0.182.5 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package worktreerun implements reusable worktree inspection and lifecycle operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCollaborationService

func NewCollaborationService(projectsRoot string) (worktreecollab.Service, error)

NewCollaborationService binds collaboration authority to the registered sessions and checkout identity of the projects root supplied at execution time.

func NewEndEngine

func NewEndEngine(projectsRoot string, claimOut io.Writer, release func(string, string, io.Writer)) (*worktreeend.Engine, error)

func StartRelocationProgress

func StartRelocationProgress(out io.Writer, task string) func()

StartRelocationProgress emits the established delayed relocation pulse. Its stop function joins the reporter before returning.

Types

type ActiveDependencies

type ActiveDependencies struct {
	Claims   func(string, string) ([]worktrees.ActiveClaimSummary, error)
	Sessions func(string) ([]session.View, error)
	Remote   ActiveRemoteDependencies
}

ActiveDependencies supplies local claims/sessions and remote snapshots to preflight.

func DefaultActiveDependencies

func DefaultActiveDependencies(remote ActiveRemoteDependencies) ActiveDependencies

DefaultActiveDependencies uses the native local custody and session inventory.

type ActiveLocalStatus

type ActiveLocalStatus struct {
	Status                  string `json:"status"` // available | incomplete
	OmittedUnresolvedClaims int    `json:"omitted_unresolved_claims,omitempty"`
}

type ActiveMachineSnapshot

type ActiveMachineSnapshot struct {
	Machine            string `json:"machine"`
	WorktreesPublished string `json:"worktrees_published_at,omitempty"`
	MachineHeartbeat   string `json:"machine_heartbeat_at,omitempty"`
	Stale              bool   `json:"stale,omitempty"`
}

type ActiveRemoteDependencies

type ActiveRemoteDependencies struct {
	Load  func(string) (remotestate.Config, remotestate.Provider, error)
	Login func() (string, error)
	Now   func() time.Time
}

ActiveRemoteDependencies binds inventory to the authoritative configured provider and machine identity.

type ActiveRemoteStatus

type ActiveRemoteStatus struct {
	Status        string                  `json:"status"` // available | stale | unavailable | local_only
	Error         string                  `json:"error,omitempty"`
	StaleAfter    string                  `json:"stale_after,omitempty"`
	Machines      int                     `json:"machines,omitempty"`
	StaleMachines int                     `json:"stale_machines,omitempty"`
	Snapshots     []ActiveMachineSnapshot `json:"snapshots,omitempty"`
}

type ActiveReport

type ActiveReport struct {
	SchemaVersion int                `json:"schema_version"`
	Local         ActiveLocalStatus  `json:"local"`
	Remote        ActiveRemoteStatus `json:"remote"`
	Worktrees     []ActiveRow        `json:"worktrees"`
}

func CollectActive

func CollectActive(ctx context.Context, deps ActiveDependencies, projectsRoot, filter string, localOnly bool, stale time.Duration) (ActiveReport, error)

type ActiveRow

type ActiveRow struct {
	Locality          string                        `json:"locality"` // local | remote
	Machine           string                        `json:"machine,omitempty"`
	Task              string                        `json:"task"`
	Summary           string                        `json:"summary,omitempty"`
	Repository        string                        `json:"repository"`
	Branch            string                        `json:"branch"`
	Owner             string                        `json:"owner,omitempty"`
	OwnerState        string                        `json:"owner_state"`
	LastActivityAt    string                        `json:"last_activity_at,omitempty"`
	Lifecycle         string                        `json:"lifecycle"`
	PullRequest       *remotestate.PullRequestState `json:"pull_request,omitempty"`
	SnapshotPublished string                        `json:"snapshot_published_at,omitempty"`
	SnapshotHeartbeat string                        `json:"snapshot_heartbeat_at,omitempty"`
	SnapshotStale     bool                          `json:"snapshot_stale,omitempty"`
}

ActiveRow is deliberately smaller than ListResult and WorktreeState. It is a preflight aid, not an inspection dump: private prompt bodies, paths, commits, and source status do not help decide whether work overlaps.

type InfoDocument

type InfoDocument struct {
	worktrees.WorkLogView
	MergerLaneClaim *orchestrate.MergeLaneClaim `json:"merger_lane_claim,omitempty"`
	Collaboration   *worktreecollab.View        `json:"collaboration,omitempty"`
}

InfoDocument joins a redacted work log with merger and collaboration authority.

type InfoRequest

type InfoRequest struct{ ProjectsRoot, Worktree string }

InfoRequest identifies a checkout in one projects root.

type InfoService

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

InfoService inspects native checkout state without disclosing prompt bodies.

func DefaultInfoService

func DefaultInfoService() InfoService

DefaultInfoService composes the existing native work log and custody services.

func (InfoService) Inspect

func (service InfoService) Inspect(ctx context.Context, request InfoRequest) (InfoDocument, error)

Inspect preserves the load, merger-lane and collaboration failure order.

type RemoteClaimOutcome

type RemoteClaimOutcome struct {
	Outcome string `json:"outcome"`
	Detail  string `json:"detail,omitempty"`
}

RemoteClaimOutcome carries a best-effort creation claim receipt. Disabled preserves the plain worktree result array; other outcomes include the receipt without changing the claim authority or creation success.

Jump to

Keyboard shortcuts

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