worktree

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package worktree provides worktree lifecycle management and hooks.

Index

Constants

View Source
const DefaultHookTimeout = 30 * time.Second

DefaultHookTimeout is the default timeout for pre-hook execution.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckoutRequest

type CheckoutRequest struct {
	WorkspaceID   string
	WorkItemID    string
	Repository    string
	Branch        string
	WorkItemTitle string
}

CheckoutRequest describes a requested worktree checkout.

type HookConfig

type HookConfig struct {
	Name    string
	Timeout time.Duration // 0 means DefaultHookTimeout
}

HookConfig configures a hook's behavior.

type HookRegistry

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

HookRegistry manages pre-checkout hooks.

func NewHookRegistry

func NewHookRegistry() *HookRegistry

NewHookRegistry creates a new empty hook registry.

func (*HookRegistry) Register

func (r *HookRegistry) Register(cfg HookConfig, hook PreHook)

Register adds a pre-hook to the registry. Hooks are called in registration order.

func (*HookRegistry) Run

Run executes all registered pre-hooks against the given request. Returns the first non-nil error from a hook, or nil if all hooks pass.

type PreHook

type PreHook func(ctx context.Context, req CheckoutRequest) error

PreHook is a synchronous hook called before a worktree checkout. If any hook returns an error, the checkout is aborted.

Jump to

Keyboard shortcuts

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