status

package
v0.27.1 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2025 License: GPL-3.0 Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package status provides status management functionality and error definitions.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Worktree management errors.
	ErrWorktreeAlreadyExists       = errors.New("worktree already exists")
	ErrWorktreeNotFound            = errors.New("worktree not found")
	ErrConfigurationNotInitialized = errors.New("configuration is not initialized")
	ErrNotInitialized              = errors.New("CM is not initialized. Run 'cm init' to initialize")

	// Repository management errors.
	ErrRepositoryNotFound      = errors.New("repository not found in status")
	ErrRepositoryAlreadyExists = errors.New("repository already exists")

	// Workspace management errors.
	ErrWorkspaceNotFound      = errors.New("workspace not found in status")
	ErrWorkspaceAlreadyExists = errors.New("workspace already exists")

	// Status file errors.
	ErrStatusFileParse = errors.New("failed to parse status file")
)

Error definitions for status package.

Functions

This section is empty.

Types

type AddRepositoryParams

type AddRepositoryParams struct {
	Path    string
	Remotes map[string]Remote
}

AddRepositoryParams contains parameters for AddRepository.

type AddWorkspaceParams

type AddWorkspaceParams struct {
	Repositories []string // List of repository URLs/names
}

AddWorkspaceParams contains parameters for AddWorkspace.

type AddWorktreeParams

type AddWorktreeParams struct {
	RepoURL       string
	Branch        string
	WorktreePath  string
	WorkspacePath string
	IssueInfo     *issue.Info
	Remote        string
}

AddWorktreeParams contains parameters for AddWorktree.

type Manager

type Manager interface {
	// AddWorktree adds a worktree entry to the status file.
	AddWorktree(params AddWorktreeParams) error
	// RemoveWorktree removes a worktree entry from the status file.
	RemoveWorktree(repoURL, branch string) error
	// GetWorktree retrieves the status of a specific worktree.
	GetWorktree(repoURL, branch string) (*WorktreeInfo, error)
	// CreateInitialStatus creates the initial status file structure.
	CreateInitialStatus() error
	// AddRepository adds a repository entry to the status file.
	AddRepository(repoURL string, params AddRepositoryParams) error
	// RemoveRepository removes a repository entry from the status file.
	RemoveRepository(repoURL string) error
	// GetRepository retrieves a repository entry from the status file.
	GetRepository(repoURL string) (*Repository, error)
	// ListRepositories lists all repositories in the status file.
	ListRepositories() (map[string]Repository, error)
	// AddWorkspace adds a workspace entry to the status file.
	AddWorkspace(workspacePath string, params AddWorkspaceParams) error
	// GetWorkspace retrieves a workspace entry from the status file.
	GetWorkspace(workspacePath string) (*Workspace, error)
	// RemoveWorkspace removes a workspace entry from the status file.
	RemoveWorkspace(workspaceName string) error
	// UpdateWorkspace updates an existing workspace entry in the status file.
	UpdateWorkspace(workspaceName string, workspace Workspace) error
	// ListWorkspaces lists all workspaces in the status file.
	ListWorkspaces() (map[string]Workspace, error)
}

Manager interface provides status file management functionality.

func NewManager

func NewManager(fs fs.FS, config config.Config) Manager

NewManager creates a new Status Manager instance.

type Remote

type Remote struct {
	DefaultBranch string `yaml:"default_branch"`
}

Remote represents a remote configuration for a repository.

type Repository

type Repository struct {
	Path      string                  `yaml:"path"`
	Remotes   map[string]Remote       `yaml:"remotes"`
	Worktrees map[string]WorktreeInfo `yaml:"worktrees"`
}

Repository represents a repository entry in the status file.

type Status

type Status struct {
	Repositories map[string]Repository `yaml:"repositories"`
	Workspaces   map[string]Workspace  `yaml:"workspaces"`
}

Status represents the status.yaml file structure.

type Workspace

type Workspace struct {
	Worktrees    []string `yaml:"worktrees"`    // List of worktrees references
	Repositories []string `yaml:"repositories"` // List of repository URLs/names
}

Workspace represents a workspace entry in the status file.

func (*Workspace) HasRepository added in v0.26.0

func (w *Workspace) HasRepository(repositoryName string) bool

HasRepository checks if the workspace contains the specified repository.

type WorktreeInfo

type WorktreeInfo struct {
	Remote string      `yaml:"remote"`
	Branch string      `yaml:"branch"`
	Issue  *issue.Info `yaml:"issue,omitempty"`
}

WorktreeInfo represents worktree information.

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