worktree

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FailedWorkResultFromPreparation

func FailedWorkResultFromPreparation(
	dispatchID string,
	transitionID string,
	start time.Time,
	err error,
) interfaces.WorkResult

FailedWorkResultFromPreparation maps a preparation error to a failed workstation result.

func ResolveFactoryWorktreeCheckoutPath

func ResolveFactoryWorktreeCheckoutPath(factoryRoot, worktreeName string) (string, error)

ResolveFactoryWorktreeCheckoutPath returns the target checkout path for a resolved worktree name under the factory-local worktrees parent.

func ResolveFactoryWorktreeParent

func ResolveFactoryWorktreeParent(factoryRoot string) (string, error)

ResolveFactoryWorktreeParent returns the directory under factoryRoot where new git worktree checkouts should be created. When no existing worktrees parent is present, the default is <factoryRoot>/.worktrees.

func ShouldPrepareFactoryWorktreeForCodex

func ShouldPrepareFactoryWorktreeForCodex(
	executionModelProvider string,
	authoredWorkingDirectory string,
	resolvedWorktree string,
) bool

ShouldPrepareFactoryWorktreeForCodex reports whether a Codex model workstation dispatch should materialize a factory-local git worktree before execution. Preparation runs when execution will use the Codex provider, a worktree template resolved to a name, and the workstation did not also author a workingDirectory template. Callers must pass the resolved execution model provider (not runner ID alone) so legacy modelProvider: claude workstations with default runner selection keep CLI --worktree passthrough.

Types

type ExecGitCommander

type ExecGitCommander struct{}

ExecGitCommander implements GitCommander via the git binary on PATH.

func (ExecGitCommander) Run

func (ExecGitCommander) Run(ctx context.Context, dir string, args ...string) (string, string, int, error)

type GitCommander

type GitCommander interface {
	Run(ctx context.Context, dir string, args ...string) (stdout string, stderr string, exitCode int, err error)
}

GitCommander runs git CLI commands. Tests inject fakes; production uses ExecGitCommander.

type PrepareFactoryGitWorktreeResult

type PrepareFactoryGitWorktreeResult struct {
	CheckoutPath string
	Reused       bool
}

PrepareFactoryGitWorktreeResult describes a successful worktree preparation.

func PrepareFactoryGitWorktree

func PrepareFactoryGitWorktree(
	ctx context.Context,
	factoryRoot string,
	worktreeName string,
	git GitCommander,
) (PrepareFactoryGitWorktreeResult, error)

PrepareFactoryGitWorktree creates or reuses a git worktree checkout for the resolved worktree name under the factory root.

Jump to

Keyboard shortcuts

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