Documentation
¶
Overview ¶
Package interfaces defines the worktree interface for dependency injection. This package is separate to avoid circular imports.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddToStatusParams ¶
type AddToStatusParams struct {
RepoURL string
Branch string
WorktreePath string
WorkspacePath string
Remote string
IssueInfo *issue.Info
Detached bool
}
AddToStatusParams contains parameters for adding worktree to status.
type CreateParams ¶
type CreateParams struct {
RepoURL string
Branch string
WorktreePath string
RepoPath string
Remote string
IssueInfo *issue.Info
Force bool
Detached bool // When true, creates standalone clone instead of worktree
}
CreateParams contains parameters for worktree creation.
type DeleteParams ¶
type DeleteParams struct {
RepoURL string
Branch string
WorktreePath string
RepoPath string
Force bool
}
DeleteParams contains parameters for worktree deletion.
type NewWorktreeParams ¶
type NewWorktreeParams struct {
FS interface{} // fs.FS
Git interface{} // git.Git
StatusManager interface{} // status.Manager
Logger interface{} // logger.Logger
Prompt interface{} // prompt.Prompter
RepositoriesDir string
}
NewWorktreeParams contains parameters for creating a new Worktree instance.
type ValidateCreationParams ¶
type ValidateCreationParams struct {
RepoURL string
Branch string
WorktreePath string
RepoPath string
}
ValidateCreationParams contains parameters for worktree creation validation.
type ValidateDeletionParams ¶
ValidateDeletionParams contains parameters for worktree deletion validation.
type Worktree ¶
type Worktree interface {
// BuildPath constructs a worktree path from repository URL, remote name, and branch.
BuildPath(repoURL, remoteName, branch string) string
// Create creates a new worktree with proper validation and cleanup.
Create(params CreateParams) error
// CheckoutBranch checks out the branch in the worktree after hooks have been executed.
CheckoutBranch(worktreePath, branch string) error
// Delete deletes a worktree with proper cleanup and confirmation.
Delete(params DeleteParams) error
// ValidateCreation validates that worktree creation is possible.
ValidateCreation(params ValidateCreationParams) error
// ValidateDeletion validates that worktree deletion is possible.
ValidateDeletion(params ValidateDeletionParams) error
// EnsureBranchExists ensures the specified branch exists, creating it if necessary.
EnsureBranchExists(repoPath, branch string) error
// AddToStatus adds the worktree to the status file.
AddToStatus(params AddToStatusParams) error
// RemoveFromStatus removes the worktree from the status file.
RemoveFromStatus(repoURL, branch string) error
// CleanupDirectory removes the worktree directory.
CleanupDirectory(worktreePath string) error
// Exists checks if a worktree exists for the specified branch.
Exists(repoPath, branch string) (bool, error)
// SetLogger sets the logger for this worktree instance.
SetLogger(logger logger.Logger)
}
Worktree defines the interface for worktree operations. This interface is implemented by the concrete worktree types.
type WorktreeProvider ¶
type WorktreeProvider func(params NewWorktreeParams) Worktree
WorktreeProvider defines the function signature for creating worktree instances.