Documentation
¶
Overview ¶
Package workspace provides workspace management functionality.
Index ¶
- Constants
- func CreateWorkspaceInfo(workspacePath, name, repoURL string, cloned, failed int) error
- func ReadWorkspaceInfo(workspacePath string) (time.Time, error)
- type BranchResult
- type CreateInput
- type CreateOutput
- type DeleteInput
- type DeleteOutput
- type Manager
- type RepoResult
- type RepositorySpec
- type Service
- func (s *Service) Create(input CreateInput) (*CreateOutput, error)
- func (s *Service) Delete(input DeleteInput) (*DeleteOutput, error)
- func (s *Service) DiscoverRepos() ([]RepositorySpec, error)
- func (s *Service) GetPath(name string) (string, error)
- func (s *Service) GetType(workspacePath string) (WorkspaceType, error)
- func (s *Service) List() ([]WorkspaceInfo, error)
- func (s *Service) SyncMainRepos(repos []RepositorySpec) []SyncResult
- type SyncResult
- type Workspace
- type WorkspaceInfo
- type WorkspaceType
Constants ¶
const (
// DefaultWorkspaceName is the name of the protected default workspace.
DefaultWorkspaceName = "workspace-default"
)
Variables ¶
This section is empty.
Functions ¶
func CreateWorkspaceInfo ¶
CreateWorkspaceInfo writes workspace metadata to a .workspace-info file.
Types ¶
type BranchResult ¶
BranchResult describes the outcome of a branch operation.
type CreateInput ¶
type CreateInput struct {
Name string
}
CreateInput contains all parameters for creating a workspace.
type CreateOutput ¶
type CreateOutput struct {
WorkspacePath string
CreatedRepos []RepoResult
FailedRepos []RepoResult
SyncResults []SyncResult
WorkspaceType WorkspaceType
AlreadyExists bool
}
CreateOutput contains the result of workspace creation.
type DeleteInput ¶
DeleteInput contains all parameters for deleting a workspace.
type DeleteOutput ¶
type DeleteOutput struct {
WorkspacePath string
WorkspaceType WorkspaceType
DeletedBranches []BranchResult
SkippedBranches []BranchResult
Deleted bool
}
DeleteOutput contains the result of workspace deletion.
type Manager ¶
Manager handles workspace operations including creation, deletion, and listing.
func NewManager ¶
NewManager creates a new workspace manager with the specified directories.
func (*Manager) GetWorkspacePath ¶
GetWorkspacePath returns the filesystem path for a workspace by name.
func (*Manager) GetWorkspaceType ¶
func (m *Manager) GetWorkspaceType(workspacePath string) (WorkspaceType, error)
GetWorkspaceType determines if a workspace uses clones or worktrees.
func (*Manager) GetWorkspaces ¶
GetWorkspaces returns a list of all workspaces sorted by creation time.
type RepoResult ¶
RepoResult describes the outcome of a single repository operation.
type RepositorySpec ¶
RepositorySpec describes a repository to be included in a workspace.
func DiscoverMainRepos ¶
func DiscoverMainRepos(reposDir string) ([]RepositorySpec, error)
DiscoverMainRepos finds all git repositories in the repos directory.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service provides workspace management operations.
func NewService ¶
NewService creates a new workspace service.
func (*Service) Create ¶
func (s *Service) Create(input CreateInput) (*CreateOutput, error)
Create creates a new workspace with repositories.
func (*Service) Delete ¶
func (s *Service) Delete(input DeleteInput) (*DeleteOutput, error)
Delete removes a workspace and optionally its associated branches.
func (*Service) DiscoverRepos ¶
func (s *Service) DiscoverRepos() ([]RepositorySpec, error)
DiscoverRepos finds all git repositories in the repos directory.
func (*Service) GetType ¶
func (s *Service) GetType(workspacePath string) (WorkspaceType, error)
GetType determines if a workspace uses clones or worktrees.
func (*Service) List ¶
func (s *Service) List() ([]WorkspaceInfo, error)
List returns all workspaces.
func (*Service) SyncMainRepos ¶
func (s *Service) SyncMainRepos(repos []RepositorySpec) []SyncResult
SyncMainRepos fetches and pulls all main repositories.
type SyncResult ¶
SyncResult describes the outcome of syncing a main repository.
type Workspace ¶
Workspace represents a development workspace containing multiple repositories. This is a shared type used across packages (shell, ui, cmd).
type WorkspaceInfo ¶
type WorkspaceInfo struct {
Name string
Path string
Projects []string
Created time.Time
Type WorkspaceType
IsDefault bool
}
WorkspaceInfo extends the basic Workspace with additional metadata.
func ToWorkspaceInfo ¶
func ToWorkspaceInfo(w Workspace) WorkspaceInfo
ToWorkspaceInfo converts a Workspace to WorkspaceInfo.
type WorkspaceType ¶
type WorkspaceType string
WorkspaceType indicates whether a workspace uses clones or worktrees.
const ( WorkspaceTypeClone WorkspaceType = "clone" WorkspaceTypeWorktree WorkspaceType = "worktree" )