worktree

package
v0.13.2 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LifecycleManager added in v0.13.0

type LifecycleManager struct {
	BaseRepo      string
	WorktreesBase string
	ExecutorType  string
	Config        rules.WorktreeConfig
	// contains filtered or unexported fields
}

LifecycleManager implements the opt-in lifecycle contract. The older Manager remains intentionally untouched for configurations without worktree.

func NewLifecycleManager added in v0.13.0

func NewLifecycleManager(baseRepo, worktreesDir, executorType string, config rules.WorktreeConfig) (*LifecycleManager, error)

func (*LifecycleManager) Adopt added in v0.13.0

func (m *LifecycleManager) Adopt(ctx context.Context, cardID string) error

Adopt is an explicit administrator preflight. It only writes a verified ownership record and never renames, resets, cleans, or prepares source.

func (*LifecycleManager) BranchContext added in v0.13.2

func (m *LifecycleManager) BranchContext(ctx context.Context, cardID, path string) string

BranchContext reports checkout drift to the executor without changing source, rewriting the expected branch, or turning branch inspection into a run gate. The caller has already selected and verified this worktree's ownership.

func (*LifecycleManager) BranchName added in v0.13.0

func (m *LifecycleManager) BranchName(cardID string) string

func (*LifecycleManager) ExistingOrBase added in v0.13.0

func (m *LifecycleManager) ExistingOrBase(ctx context.Context, request LifecycleRequest) (string, error)

ExistingOrBase deliberately performs no create, hook, link, setup, prune, repair, or record mutation. It is used by safe stop actions.

func (*LifecycleManager) Prepare added in v0.13.0

func (m *LifecycleManager) Prepare(ctx context.Context, request LifecycleRequest) (string, error)

Prepare creates or verifies a worktree, then runs only the configured materialization, sharing, and preparation phases within the caller deadline.

func (*LifecycleManager) Remove added in v0.13.0

func (m *LifecycleManager) Remove(_ string, _ bool) error

Remove intentionally does not implement a second Done-retirement path. The validated direct cleanup rule introduced by #67 remains responsible for retirement when lifecycle configuration is enabled.

func (*LifecycleManager) WorktreePath added in v0.13.0

func (m *LifecycleManager) WorktreePath(cardID string) string

type LifecycleReason added in v0.13.0

type LifecycleReason string
const (
	LifecycleCreate LifecycleReason = "create"
	LifecycleReuse  LifecycleReason = "reuse"
)

type LifecycleRequest added in v0.13.0

type LifecycleRequest struct {
	CardID  string
	BoardID string
	Reason  LifecycleReason
}

type Manager

type Manager struct {
	BaseRepo      string
	WorktreesBase string
	SetupCommand  string
	ExecutorType  string
	Runner        Runner
	// contains filtered or unexported fields
}

func NewManager

func NewManager(baseRepo string, worktreesDir string, setupCommand string, executorType string) *Manager

func (*Manager) BranchName

func (m *Manager) BranchName(cardID string) string

func (*Manager) Create

func (m *Manager) Create(cardID string, branchName string) (string, error)

func (*Manager) Get

func (m *Manager) Get(cardID string) (string, bool)

func (*Manager) ListActive

func (m *Manager) ListActive() []string

func (*Manager) Remove

func (m *Manager) Remove(cardID string, force bool) error
func (m *Manager) SetupSymlinks(worktreePath string) error

func (*Manager) WorktreePath

func (m *Manager) WorktreePath(cardID string) string

type RunResult

type RunResult struct {
	Stdout string
	Stderr string
}

type Runner

type Runner interface {
	Run(dir string, args []string) (RunResult, error)
}

Jump to

Keyboard shortcuts

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