workspace

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2025 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package workspace provides workspace management functionality for CM.

Package workspace provides workspace management functionality and error definitions.

Package workspace is a generated GoMock package.

Package workspace provides workspace management functionality for CM.

Package workspace provides workspace management functionality for CM.

Package workspace provides workspace management functionality for CM.

Package workspace provides workspace management functionality for CM.

Package workspace provides workspace management functionality for CM.

Package workspace provides workspace management functionality for CM.

Package workspace provides workspace management functionality for CM.

Package workspace provides workspace management functionality for CM.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Workspace file errors.
	ErrFailedToCheckWorkspaceFiles = errors.New("failed to check for workspace files")
	ErrWorkspaceFileNotFound       = errors.New("workspace file not found")
	ErrInvalidWorkspaceFile        = errors.New("invalid workspace file")
	ErrNoRepositoriesFound         = errors.New("no repositories found in workspace")

	// Repository errors.
	ErrRepositoryNotFound = errors.New("repository not found in workspace")
	ErrRepositoryNotClean = errors.New("repository is not clean")

	// Worktree errors.
	ErrWorktreeExists      = errors.New("worktree already exists")
	ErrWorktreeNotInStatus = errors.New("worktree not found in status file")

	// Directory and file system errors.
	ErrDirectoryExists = errors.New("directory already exists")

	// User interaction errors.
	ErrDeletionCancelled = errors.New("deletion cancelled by user")
)

Error definitions for workspace package.

Functions

This section is empty.

Types

type Config

type Config struct {
	Name    string   `json:"name,omitempty"`
	Folders []Folder `json:"folders"`
}

Config represents the configuration of a workspace.

type CreateWorktreeOpts

type CreateWorktreeOpts struct {
	IDEName string
}

CreateWorktreeOpts contains optional parameters for worktree creation.

type Folder

type Folder struct {
	Name string `json:"name"`
	Path string `json:"path"`
}

Folder represents a folder in a workspace.

type MockWorkspace

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

MockWorkspace is a mock of Workspace interface.

func NewMockWorkspace

func NewMockWorkspace(ctrl *gomock.Controller) *MockWorkspace

NewMockWorkspace creates a new mock instance.

func (*MockWorkspace) CreateWorktree

func (m *MockWorkspace) CreateWorktree(branch string, force bool, opts ...CreateWorktreeOpts) error

CreateWorktree mocks base method.

func (*MockWorkspace) DeleteWorktree

func (m *MockWorkspace) DeleteWorktree(branch string, force bool) error

DeleteWorktree mocks base method.

func (*MockWorkspace) DetectWorkspaceFiles

func (m *MockWorkspace) DetectWorkspaceFiles() ([]string, error)

DetectWorkspaceFiles mocks base method.

func (*MockWorkspace) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockWorkspace) GetName

func (m *MockWorkspace) GetName(config *Config, filename string) string

GetName mocks base method.

func (*MockWorkspace) HandleMultipleFiles

func (m *MockWorkspace) HandleMultipleFiles(workspaceFiles []string, force bool) (string, error)

HandleMultipleFiles mocks base method.

func (*MockWorkspace) ListWorktrees

func (m *MockWorkspace) ListWorktrees(force bool) ([]status.WorktreeInfo, error)

ListWorktrees mocks base method.

func (*MockWorkspace) Load

func (m *MockWorkspace) Load(force bool) error

Load mocks base method.

func (*MockWorkspace) ParseFile

func (m *MockWorkspace) ParseFile(filename string) (*Config, error)

ParseFile mocks base method.

func (*MockWorkspace) Validate

func (m *MockWorkspace) Validate() error

Validate mocks base method.

func (*MockWorkspace) ValidateWorkspaceReferences

func (m *MockWorkspace) ValidateWorkspaceReferences() error

ValidateWorkspaceReferences mocks base method.

type MockWorkspaceMockRecorder

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

MockWorkspaceMockRecorder is the mock recorder for MockWorkspace.

func (*MockWorkspaceMockRecorder) CreateWorktree

func (mr *MockWorkspaceMockRecorder) CreateWorktree(branch, force any, opts ...any) *gomock.Call

CreateWorktree indicates an expected call of CreateWorktree.

func (*MockWorkspaceMockRecorder) DeleteWorktree

func (mr *MockWorkspaceMockRecorder) DeleteWorktree(branch, force any) *gomock.Call

DeleteWorktree indicates an expected call of DeleteWorktree.

func (*MockWorkspaceMockRecorder) DetectWorkspaceFiles

func (mr *MockWorkspaceMockRecorder) DetectWorkspaceFiles() *gomock.Call

DetectWorkspaceFiles indicates an expected call of DetectWorkspaceFiles.

func (*MockWorkspaceMockRecorder) GetName

func (mr *MockWorkspaceMockRecorder) GetName(config, filename any) *gomock.Call

GetName indicates an expected call of GetName.

func (*MockWorkspaceMockRecorder) HandleMultipleFiles

func (mr *MockWorkspaceMockRecorder) HandleMultipleFiles(workspaceFiles, force any) *gomock.Call

HandleMultipleFiles indicates an expected call of HandleMultipleFiles.

func (*MockWorkspaceMockRecorder) ListWorktrees

func (mr *MockWorkspaceMockRecorder) ListWorktrees(force any) *gomock.Call

ListWorktrees indicates an expected call of ListWorktrees.

func (*MockWorkspaceMockRecorder) Load

func (mr *MockWorkspaceMockRecorder) Load(force any) *gomock.Call

Load indicates an expected call of Load.

func (*MockWorkspaceMockRecorder) ParseFile

func (mr *MockWorkspaceMockRecorder) ParseFile(filename any) *gomock.Call

ParseFile indicates an expected call of ParseFile.

func (*MockWorkspaceMockRecorder) Validate

func (mr *MockWorkspaceMockRecorder) Validate() *gomock.Call

Validate indicates an expected call of Validate.

func (*MockWorkspaceMockRecorder) ValidateWorkspaceReferences

func (mr *MockWorkspaceMockRecorder) ValidateWorkspaceReferences() *gomock.Call

ValidateWorkspaceReferences indicates an expected call of ValidateWorkspaceReferences.

type NewWorkspaceParams

type NewWorkspaceParams struct {
	FS            fs.FS
	Git           git.Git
	Config        *config.Config
	StatusManager status.Manager
	Logger        logger.Logger
	Prompt        prompt.Prompt
	Worktree      worktree.Worktree
	Verbose       bool
}

NewWorkspaceParams contains parameters for creating a new Workspace instance.

type Workspace

type Workspace interface {
	// Load handles the complete workspace loading workflow.
	// It detects workspace files, handles user selection if multiple files are found,
	// and loads the workspace configuration for display.
	Load(force bool) error

	// Validate validates all repositories in a workspace.
	Validate() error

	// ListWorktrees lists worktrees for workspace mode.
	ListWorktrees(force bool) ([]status.WorktreeInfo, error)

	// CreateWorktree creates worktrees for all repositories in the workspace.
	CreateWorktree(branch string, force bool, opts ...CreateWorktreeOpts) error

	// DeleteWorktree deletes worktrees for the workspace with the specified branch.
	DeleteWorktree(branch string, force bool) error

	// DetectWorkspaceFiles checks if the current directory contains workspace files.
	DetectWorkspaceFiles() ([]string, error)

	// ParseFile parses a workspace configuration file.
	ParseFile(filename string) (*Config, error)

	// GetName extracts the workspace name from configuration or filename.
	GetName(config *Config, filename string) string

	// HandleMultipleFiles handles the selection of workspace files when multiple are found.
	HandleMultipleFiles(workspaceFiles []string, force bool) (string, error)

	// ValidateWorkspaceReferences validates that workspace references point to existing worktrees and repositories.
	ValidateWorkspaceReferences() error
}

Workspace interface provides workspace management operations.

func NewWorkspace

func NewWorkspace(params NewWorkspaceParams) Workspace

NewWorkspace creates a new Workspace instance.

type WorktreeWithRepo

type WorktreeWithRepo struct {
	status.WorktreeInfo
	RepoURL  string
	RepoPath string
}

WorktreeWithRepo represents a worktree with its associated repository information.

Jump to

Keyboard shortcuts

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