Documentation
¶
Overview ¶
Package repository provides Git repository management functionality for CM.
Package repository provides repository management functionality and error definitions.
Package repository provides Git repository management functionality for CM.
Index ¶
Constants ¶
const DefaultRemote = "origin"
DefaultRemote is the default remote name used for Git operations.
Variables ¶
var ( // Git repository errors. ErrGitRepositoryNotFound = errors.New("not a valid Git repository: .git directory not found") ErrGitRepositoryInvalid = errors.New("git repository is in an invalid state") ErrNotAGitRepository = errors.New("not a Git repository: .git directory not found") // Worktree errors. ErrWorktreeExists = errors.New("worktree already exists") ErrWorktreeNotInStatus = errors.New("worktree not found in status file") // Repository state errors. ErrRepositoryNotClean = errors.New("repository is not clean") ErrDirectoryExists = errors.New("directory already exists") // User interaction errors. ErrDeletionCancelled = errors.New("deletion cancelled by user") // Remote errors. ErrOriginRemoteNotFound = errors.New("origin remote not found or invalid") ErrOriginRemoteInvalidURL = errors.New("origin remote URL is not a valid Git hosting service URL") )
Error definitions for repository package.
Functions ¶
This section is empty.
Types ¶
type CreateWorktreeOpts ¶ added in v0.21.0
type CreateWorktreeOpts struct {
IDEName string
IssueInfo *issue.Info
WorkspaceName string
Remote string // Remote name to use (defaults to DefaultRemote if empty)
}
CreateWorktreeOpts contains optional parameters for worktree creation in repository mode.
type LoadWorktreeOpts ¶
LoadWorktreeOpts contains optional parameters for LoadWorktree.
type NewRepositoryParams ¶
type NewRepositoryParams struct {
FS fs.FS
Git git.Git
Config config.Config
StatusManager status.Manager
Logger logger.Logger
Prompt prompt.Prompter
WorktreeProvider WorktreeProvider
HookManager hooks.HookManagerInterface
RepositoryName string // Name/Path of the repository (optional, defaults to current directory)
}
NewRepositoryParams contains parameters for creating a new Repository instance.
type Repository ¶
type Repository interface {
Validate() error
CreateWorktree(branch string, opts ...CreateWorktreeOpts) (string, error)
DeleteWorktree(branch string, force bool) error
DeleteAllWorktrees(force bool) error
ListWorktrees() ([]status.WorktreeInfo, error)
LoadWorktree(remoteSource, branchName string) (string, error)
IsGitRepository() (bool, error)
ValidateGitConfiguration(workDir string) error
ValidateGitStatus() error
ValidateRepository(params ValidationParams) (*ValidationResult, error)
ValidateWorktreeExists(repoURL, branch string) error
ValidateOriginRemote() error
HandleRemoteManagement(repoURL string) error
ExtractHostFromURL(url string) string
DetermineProtocol(url string) string
ExtractRepoNameFromFullPath(fullPath string) string
ConstructRemoteURL(originURL, remoteSource, repoName string) (string, error)
AddWorktreeToStatus(params StatusParams) error
AutoAddRepositoryToStatus(repoURL, repoPath string) error
}
Repository interface provides repository management capabilities.
func NewRepository ¶
func NewRepository(params NewRepositoryParams) Repository
NewRepository creates a new Repository instance.
type StatusParams ¶
type StatusParams struct {
RepoURL string
Branch string
WorktreePath string
WorkspacePath string
Remote string
IssueInfo *issue.Info
}
StatusParams contains parameters for status operations.
type ValidationParams ¶
ValidationParams contains parameters for repository validation.
type ValidationResult ¶
ValidationResult contains the result of repository validation.
type WorktreeProvider ¶
type WorktreeProvider func(params worktree.NewWorktreeParams) worktree.Worktree
WorktreeProvider is a function type that creates worktree instances.
Source Files
¶
- add_worktree_to_status.go
- create_worktree.go
- delete_all_worktrees.go
- delete_worktree.go
- errors.go
- handle_remote_management.go
- is_git_repository.go
- list_worktrees.go
- load_worktree.go
- repository.go
- validate.go
- validate_git_configuration.go
- validate_git_status.go
- validate_origin_remote.go
- validate_repository.go
- validate_worktree_exists.go