workspace

package
v0.2.3 Latest Latest
Warning

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

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

Documentation

Overview

Package workspace provides the core domain logic for worktree management. It follows the Repository pattern - one Workspace represents one git repository.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddResult added in v0.2.2

type AddResult struct {
	Branch        string   // Branch name
	Path          string   // Worktree path
	CreatedBranch bool     // Whether a new branch was created
	SyncedFiles   []string // Files that were synced
	PostInstall   []string // Post-install commands that were run
	IsBackground  bool     // Whether post-install ran in background
}

AddResult contains the result of adding a worktree

type RemoveResult added in v0.2.2

type RemoveResult struct {
	Path          string // Worktree path that was removed
	Branch        string // Associated branch name
	BranchDeleted bool   // Whether the branch was also deleted
}

RemoveResult contains the result of removing a worktree

type Workspace

type Workspace struct {
	Root   string         // Repository root path
	Name   string         // Repository name (basename of root)
	Config *config.Config // WM configuration
	UI     ui.Prompter    // User interaction handler
}

Workspace represents a git repository with WM configuration

func Open

func Open(ui ui.Prompter) (*Workspace, error)

Open creates a Workspace from the current directory

func OpenAt

func OpenAt(dir string, prompter ui.Prompter) (*Workspace, error)

OpenAt creates a Workspace from a specific directory

func (*Workspace) AddWorktree

func (w *Workspace) AddWorktree(branch string, customPath string) (*AddResult, error)

AddWorktree creates a new worktree with optional sync and post-install

func (*Workspace) ListWorktrees

func (w *Workspace) ListWorktrees() ([]git.Worktree, error)

ListWorktrees returns all worktrees in this workspace

func (*Workspace) RemoveWorktree

func (w *Workspace) RemoveWorktree(path string, deleteBranch, force bool) (*RemoveResult, error)

RemoveWorktree removes a worktree and optionally its branch

Jump to

Keyboard shortcuts

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