workspace

package
v0.26.1 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2025 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Package workspace provides workspace management functionality for CM.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Worktree errors.
	ErrWorktreeExists      = errors.New("worktree already exists")
	ErrWorktreeNotInStatus = errors.New("worktree not found in status")
	ErrRepositoryNotClean  = errors.New("repository is not clean")
	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 added in v0.21.0

type CreateWorktreeOpts struct {
	IDEName       string
	IssueInfo     *issue.Info
	WorkspaceName string
}

CreateWorktreeOpts contains optional parameters for worktree creation in workspace mode.

type Folder

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

Folder represents a folder in a workspace.

type NewWorkspaceParams

type NewWorkspaceParams struct {
	FS                 fs.FS
	Git                git.Git
	Config             config.Config
	StatusManager      status.Manager
	Logger             logger.Logger
	Prompt             prompt.Prompter
	WorktreeProvider   WorktreeProvider
	RepositoryProvider RepositoryProvider
	HookManager        hooks.HookManagerInterface
}

NewWorkspaceParams contains parameters for creating a new Workspace instance.

type RepositoryProvider added in v0.26.1

type RepositoryProvider func(params repository.NewRepositoryParams) repository.Repository

RepositoryProvider is a function type that creates repository instances.

type Workspace

type Workspace interface {
	Validate() error
	CreateWorktree(branch string, opts ...CreateWorktreeOpts) (string, error)
	DeleteWorktree(workspaceName, branch string, force bool) error
	DeleteAllWorktrees(workspaceName string, force bool) error
	OpenWorktree(workspaceName, branch string) (string, error)
	SetLogger(logger logger.Logger)
	Load() error
	ParseFile(filename string) (Config, error)
	GetName(config Config, filename string) string
	ValidateWorkspaceReferences() error
}

Workspace interface provides workspace management capabilities.

func NewWorkspace

func NewWorkspace(params NewWorkspaceParams) Workspace

NewWorkspace creates a new Workspace instance.

type WorktreeProvider

type WorktreeProvider func(params worktree.NewWorktreeParams) worktree.Worktree

WorktreeProvider is a function type that creates worktree instances.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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