Documentation
¶
Index ¶
- Constants
- func Debug(message string, args ...interface{})
- func Error(message string, args ...interface{})
- func Fatal(message string, args ...interface{})
- func FormatError(err error) string
- func GetCallerInfo(skip int) (string, string, int)
- func GetContext(err error) map[string]string
- func GetErrorCode(err error) string
- func GetSuggestions(err error) []string
- func Info(message string, args ...interface{})
- func InitializeLogging(logLevel LogLevel, logFile string) error
- func IsQuiet() bool
- func IsRetryable(err error) bool
- func IsVerbose() bool
- func Quiet(message string, args ...interface{})
- func SetLoggingConfig(config LoggingConfig) error
- func Success(message string, args ...interface{})
- func Trace(message string, args ...interface{})
- func Verbose(message string, args ...interface{})
- func Warn(message string, args ...interface{})
- type AutoRebaseDecision
- type AutoRebaseEngine
- type AutoRebaseLogger
- type AutoRebaseOptions
- type AutoRebaseRecoveryState
- type AutoRebaseResult
- type AutoRebaseSummary
- type BranchDependency
- type BranchInfo
- type BranchProcessor
- type BranchRecoveryState
- type BranchResult
- type BranchValidator
- type ConflictResolutionDecision
- type DefaultBranchProcessor
- func (p *DefaultBranchProcessor) CleanupTempBranch(name string, opts ProcessOptions) error
- func (p *DefaultBranchProcessor) CreateTempBranch(name, base string, opts ProcessOptions) (string, error)
- func (p *DefaultBranchProcessor) EnableRecoveryTracking()
- func (p *DefaultBranchProcessor) GetFeaturesInEnvironment(env string) []string
- func (p *DefaultBranchProcessor) HandleBranchFailure(branch string, err error, opts ProcessOptions) error
- func (p *DefaultBranchProcessor) LockTarget(target string, opts ProcessOptions) error
- func (p *DefaultBranchProcessor) ProcessBranch(branch, tempBranch string, opts ProcessOptions) error
- func (p *DefaultBranchProcessor) ProcessBranches(source string, target string, branches []string, opts ProcessOptions) error
- func (p *DefaultBranchProcessor) SwapToTarget(tempBranch, target string, opts ProcessOptions) error
- func (p *DefaultBranchProcessor) UnlockTarget(target string, opts ProcessOptions) error
- func (p *DefaultBranchProcessor) UpdateMetadata(source, target string, branches []string, opts ProcessOptions) error
- func (p *DefaultBranchProcessor) ValidatePreconditions(source string, target string, branches []string, opts ProcessOptions) error
- type DefaultOperationLogger
- func (o *DefaultOperationLogger) LogOperationFailure(operation, target string, err error, duration time.Duration, ...)
- func (o *DefaultOperationLogger) LogOperationProgress(operation, target string, progress int, message string)
- func (o *DefaultOperationLogger) LogOperationStart(operation, target string, fields map[string]interface{})
- func (o *DefaultOperationLogger) LogOperationSuccess(operation, target string, duration time.Duration, ...)
- type DefaultPerformanceLogger
- func (p *DefaultPerformanceLogger) LogMemoryUsage(operation string, allocated, total uint64)
- func (p *DefaultPerformanceLogger) LogPerformanceMetric(operation string, metric string, value interface{}, unit string)
- func (p *DefaultPerformanceLogger) LogSlowOperation(operation string, duration time.Duration, threshold time.Duration)
- type DependencyAnalysis
- type DependencyAnalyzer
- type DependencySummary
- type DryRunImpact
- type DryRunSafetyCheck
- type DryRunValidation
- type ErrorAnalysis
- type ErrorRecoveryManager
- func (erm *ErrorRecoveryManager) AnalyzeError(err error) ErrorAnalysis
- func (erm *ErrorRecoveryManager) GetDefaultRecoveryStrategies() map[errors.ErrorCategory]RecoveryStrategy
- func (erm *ErrorRecoveryManager) RecoverFromError(err error, attempt int) error
- func (erm *ErrorRecoveryManager) RegisterRecoveryStrategy(strategy RecoveryStrategy)
- type ErrorType
- type GlobalRepositoryLock
- type HitchError
- func NewBranchNotFoundError(branchName string) *HitchError
- func NewConfigurationError(parameter string, value string) *HitchError
- func NewDependencyConflictError(dependencies []string) *HitchError
- func NewGitOperationFailedError(operation string, cause error) *HitchError
- func NewHitchError(code, message string, errorType ErrorType) *HitchError
- func NewInvalidSourceError(source string) *HitchError
- func NewInvalidTargetError(target string) *HitchError
- func NewLockAcquisitionFailedError(target string, cause error) *HitchError
- func NewLockConflictError(target, lockedBy, lockedAt string) *HitchError
- func NewMetadataNotLoadedError() *HitchError
- func NewNetworkError(operation string, cause error) *HitchError
- func NewOperationTimeoutError(operation string, timeout time.Duration) *HitchError
- func NewPermissionDeniedError(operation string) *HitchError
- func NewRebaseConflictError(branch string, conflicts []string) *HitchError
- func NewRebuildFailedError(environment string, cause error) *HitchError
- func NewReleaseFailedError(source, target string, cause error) *HitchError
- func NewRepoNotInitializedError() *HitchError
- func NewTempBranchFailedError(operation, branchName string, cause error) *HitchError
- func NewUncommittedChangesError(branch string) *HitchError
- func NewUserRequiredError() *HitchError
- func NewValidationFailedError(validation string, details string) *HitchError
- func WrapError(err error, code, message string, errorType ErrorType) *HitchError
- func (e *HitchError) Error() string
- func (e *HitchError) Is(target error) bool
- func (e *HitchError) Unwrap() error
- func (e *HitchError) WithCause(cause error) *HitchError
- func (e *HitchError) WithContext(key, value string) *HitchError
- func (e *HitchError) WithContextMap(context map[string]string) *HitchError
- func (e *HitchError) WithRetryable(retryable bool) *HitchError
- func (e *HitchError) WithSuggestion(suggestion string) *HitchError
- func (e *HitchError) WithSuggestions(suggestions []string) *HitchError
- type InteractivePromptSystem
- type LockInfo
- type LockLogger
- type LockManager
- func (lm *LockManager) AcquireLock(req LockRequest) (*LockResult, error)
- func (lm *LockManager) CleanupStaleLocks() (int, error)
- func (lm *LockManager) GetAllLocks() map[string]*LockInfo
- func (lm *LockManager) GetLockInfo(target LockTarget) (*LockInfo, error)
- func (lm *LockManager) GetStatus() *LockManagerStatus
- func (lm *LockManager) IsLocked(target LockTarget) bool
- func (lm *LockManager) ReleaseLock(target LockTarget, userEmail string) error
- func (lm *LockManager) SetDefaultTimeout(timeout time.Duration)
- func (lm *LockManager) SetEnabled(enabled bool)
- func (lm *LockManager) SetStaleLockTimeout(timeout time.Duration)
- type LockManagerStatus
- type LockOperationResult
- type LockRequest
- type LockResult
- type LockTarget
- type LogLevel
- type Logger
- type LoggingConfig
- type MergeConflict
- type OperationLogger
- type PerformanceLogger
- type PostReleaseValidator
- type PreReleaseValidator
- type ProcessOptions
- type ProcessingResult
- type ProcessingState
- type PromptFormatter
- type PromptLogger
- type RebasePlan
- type RebaseStep
- type RebaseStepResult
- type RecoveryOptions
- type RecoveryPersistence
- func (rp *RecoveryPersistence) ArchiveRecoveryState(releaseID string) error
- func (rp *RecoveryPersistence) CleanupOldRecoveryStates(olderThan time.Duration) (int, error)
- func (rp *RecoveryPersistence) DeleteRecoveryState(releaseID string) error
- func (rp *RecoveryPersistence) EnsureRecoveryDirectory() error
- func (rp *RecoveryPersistence) GetRecoveryDirectory() string
- func (rp *RecoveryPersistence) ListRecoveryStates() ([]*ReleaseRecoveryState, error)
- func (rp *RecoveryPersistence) LoadRecoveryState(releaseID string) (*ReleaseRecoveryState, error)
- func (rp *RecoveryPersistence) SaveRecoveryState(state *ReleaseRecoveryState) error
- type RecoveryResult
- type RecoveryStrategy
- type RecoverySummary
- type ReleaseBranchInfo
- type ReleaseConfiguration
- type ReleaseHistory
- type ReleaseIssue
- type ReleaseMetadataLogger
- type ReleaseMetadataManager
- func (rmm *ReleaseMetadataManager) AddIssue(record *ReleaseRecord, issueType, severity, message, branch, file string)
- func (rmm *ReleaseMetadataManager) CompleteReleaseRecord(record *ReleaseRecord, status string) error
- func (rmm *ReleaseMetadataManager) CreateReleaseRecord(operationType, source, target string, config ReleaseConfiguration) (*ReleaseRecord, error)
- func (rmm *ReleaseMetadataManager) GetReleaseHistory(limit int) (*ReleaseHistory, error)
- func (rmm *ReleaseMetadataManager) GetReleaseRecord(id string) (*ReleaseRecord, error)
- func (rmm *ReleaseMetadataManager) RollbackRelease(record *ReleaseRecord, reason string) (*RollbackInfo, error)
- func (rmm *ReleaseMetadataManager) SearchReleaseRecords(criteria ReleaseSearchCriteria) ([]ReleaseRecord, error)
- func (rmm *ReleaseMetadataManager) UpdateReleaseRecord(record *ReleaseRecord) error
- type ReleaseRecord
- type ReleaseRecoveryLogger
- type ReleaseRecoveryManager
- func (rrm *ReleaseRecoveryManager) CanRecover(releaseID string) (*ReleaseRecoveryState, error)
- func (rrm *ReleaseRecoveryManager) CleanupFailedRelease(releaseID string, opts RecoveryOptions) error
- func (rrm *ReleaseRecoveryManager) DetectRecoveryStates() ([]*ReleaseRecoveryState, error)
- func (rrm *ReleaseRecoveryManager) GenerateRecoveryReport(releaseID string) (string, error)
- func (rrm *ReleaseRecoveryManager) GetRecoveryStatus() (map[string]*ReleaseRecoveryState, error)
- func (rrm *ReleaseRecoveryManager) ResumeRelease(releaseID string, opts RecoveryOptions) (*RecoveryResult, error)
- func (rrm *ReleaseRecoveryManager) RollbackRelease(releaseID string, opts RecoveryOptions) error
- func (rrm *ReleaseRecoveryManager) ValidateRecoveryState(state *ReleaseRecoveryState) error
- type ReleaseRecoveryState
- type ReleaseResults
- type ReleaseSearchCriteria
- type ReleaseStatistics
- type ReleaseSummary
- type ReleaseValidationLogger
- type ReleaseValidationManager
- func (rvm *ReleaseValidationManager) CheckReleaseReadiness(source, target string) (bool, []string, error)
- func (rvm *ReleaseValidationManager) GetValidationReport(result *ValidationResult) string
- func (rvm *ReleaseValidationManager) RollbackRelease(releaseID string, opts RollbackOptions) (*RollbackResult, error)
- func (rvm *ReleaseValidationManager) ValidateRelease(source, target string, opts ValidationOptions) (*ValidationResult, error)
- func (rvm *ReleaseValidationManager) ValidateReleaseCandidate(branch string, opts ValidationOptions) (*ValidationResult, error)
- type ReleaseValidator
- type RepositoryLock
- func (rl *RepositoryLock) IsLocked() bool
- func (rl *RepositoryLock) Lock() error
- func (rl *RepositoryLock) SetLogger(logger RepositoryLockLogger)
- func (rl *RepositoryLock) SetMaxWaitTime(duration time.Duration)
- func (rl *RepositoryLock) Unlock() error
- func (rl *RepositoryLock) WithLock(fn func() error) error
- type RepositoryLockLogger
- type RollbackInfo
- type RollbackItem
- type RollbackOptions
- type RollbackResult
- type RollbackSummary
- type TempBranchConfig
- type TempBranchInfo
- type TempBranchLogger
- type TempBranchManager
- func (m *TempBranchManager) CleanupAllTempBranches(config TempBranchConfig) (int, error)
- func (m *TempBranchManager) CleanupTempBranch(info *TempBranchInfo, config TempBranchConfig) error
- func (m *TempBranchManager) CreateTempBranch(config TempBranchConfig) (*TempBranchInfo, error)
- func (m *TempBranchManager) FindTempBranches(config TempBranchConfig) ([]*TempBranchInfo, error)
- func (m *TempBranchManager) GenerateBranchName(config TempBranchConfig) string
- func (m *TempBranchManager) GenerateSearchPattern(config TempBranchConfig) string
- func (m *TempBranchManager) ParseBranchInfo(branchName, currentBranch string) *TempBranchInfo
- func (m *TempBranchManager) ValidateTempBranch(info *TempBranchInfo) error
- type UserInfo
- type ValidationIssue
- type ValidationOptions
- type ValidationResult
- type ValidationSummary
Constants ¶
const ( ErrCodeRepoNotInitialized = "REPO_NOT_INITIALIZED" ErrCodeMetadataNotLoaded = "METADATA_NOT_LOADED" ErrCodeBranchNotFound = "BRANCH_NOT_FOUND" ErrCodeLockAcquisitionFailed = "LOCK_ACQUISITION_FAILED" ErrCodeLockConflict = "LOCK_CONFLICT" ErrCodeGitOperationFailed = "GIT_OPERATION_FAILED" ErrCodeTempBranchFailed = "TEMP_BRANCH_FAILED" ErrCodeValidationFailed = "VALIDATION_FAILED" ErrCodeDependencyConflict = "DEPENDENCY_CONFLICT" ErrCodeRebaseConflict = "REBASE_CONFLICT" ErrCodePermissionDenied = "PERMISSION_DENIED" ErrCodeUncommittedChanges = "UNCOMMITTED_CHANGES" ErrCodeReleaseFailed = "RELEASE_FAILED" ErrCodeRebuildFailed = "REBUILD_FAILED" ErrCodeUserRequired = "USER_REQUIRED" ErrCodeInvalidTarget = "INVALID_TARGET" ErrCodeInvalidSource = "INVALID_SOURCE" ErrCodeOperationTimeout = "OPERATION_TIMEOUT" ErrCodeNetworkError = "NETWORK_ERROR" ErrCodeConfigurationError = "CONFIGURATION_ERROR" )
Error codes for consistent error handling
const ( ColorReset = "\033[0m" ColorRed = "\033[31m" ColorGreen = "\033[32m" ColorYellow = "\033[33m" ColorBlue = "\033[34m" ColorPurple = "\033[35m" ColorCyan = "\033[36m" ColorWhite = "\033[37m" ColorGray = "\033[90m" ColorOrange = "\033[38;5;208m" // Bright orange for warnings )
ANSI color codes for console output
Variables ¶
This section is empty.
Functions ¶
func FormatError ¶
FormatError formats an error for display with context and suggestions
func GetCallerInfo ¶
GetCallerInfo returns information about the calling function
func GetContext ¶
GetContext extracts context information from an error
func GetErrorCode ¶
GetErrorCode extracts the error code from an error
func GetSuggestions ¶
GetSuggestions extracts recovery suggestions from an error
func InitializeLogging ¶
InitializeLogging sets up global logging configuration (legacy compatibility)
func Quiet ¶
func Quiet(message string, args ...interface{})
Quiet logs a message only in quiet mode (for critical quiet-only messages)
func SetLoggingConfig ¶
func SetLoggingConfig(config LoggingConfig) error
SetLoggingConfig updates the global logging configuration
func Trace ¶
func Trace(message string, args ...interface{})
Convenience functions for global logging with verbosity awareness
Types ¶
type AutoRebaseDecision ¶
type AutoRebaseDecision struct {
Decision string `json:"decision"` // "auto-rebase", "manual", "skip", "abort"
Details string `json:"details"` // Additional details about the decision
ExcludedBranches []string `json:"excluded_branches"` // Branches to exclude from auto-rebase
BackupStrategy string `json:"backup_strategy"` // "always", "on-conflict", "never"
}
AutoRebaseDecision represents the user's decision about auto-rebase
type AutoRebaseEngine ¶
type AutoRebaseEngine struct {
// contains filtered or unexported fields
}
AutoRebaseEngine handles automatic rebasing of dependent branches
func NewAutoRebaseEngine ¶
func NewAutoRebaseEngine(repo *hitchgit.Repo, dependencyAnalyzer *DependencyAnalyzer) *AutoRebaseEngine
NewAutoRebaseEngine creates a new auto-rebase engine
func (*AutoRebaseEngine) ExecuteAutoRebase ¶
func (are *AutoRebaseEngine) ExecuteAutoRebase(plan *RebasePlan, opts AutoRebaseOptions) (*AutoRebaseResult, error)
ExecuteAutoRebase executes an auto-rebase operation based on a rebase plan
type AutoRebaseLogger ¶
type AutoRebaseLogger interface {
LogStart(plan *RebasePlan, opts AutoRebaseOptions)
LogStep(step *RebaseStep, stepNumber int, totalSteps int)
LogStepResult(result *RebaseStepResult, stepNumber int, totalSteps int)
LogConflict(branch string, conflicts []string)
LogResolution(branch string, resolution string)
LogCompletion(result *AutoRebaseResult)
LogError(operation string, branch string, err error)
}
AutoRebaseLogger handles logging for auto-rebase operations
type AutoRebaseOptions ¶
type AutoRebaseOptions struct {
DryRun bool `json:"dry_run"`
Interactive bool `json:"interactive"`
ForceRebase bool `json:"force_rebase"`
BackupBeforeRebase bool `json:"backup_before_rebase"`
ContinueOnError bool `json:"continue_on_error"`
MaxRetries int `json:"max_retries"`
ExcludedBranches []string `json:"excluded_branches"`
Verbose bool `json:"verbose"`
Quiet bool `json:"quiet"`
}
AutoRebaseOptions configures the auto-rebase operation
type AutoRebaseRecoveryState ¶
type AutoRebaseRecoveryState struct {
TotalBranches int `json:"total_branches"`
CompletedBranches int `json:"completed_branches"`
FailedBranches int `json:"failed_branches"`
SkippedBranches int `json:"skipped_branches"`
CurrentBranch string `json:"current_branch,omitempty"`
BranchStates map[string]*BranchRecoveryState `json:"branch_states"`
BackupBranches []string `json:"backup_branches"`
}
AutoRebaseRecoveryState tracks the state of auto-rebase operations
type AutoRebaseResult ¶
type AutoRebaseResult struct {
Success bool `json:"success"`
TotalSteps int `json:"total_steps"`
CompletedSteps int `json:"completed_steps"`
FailedSteps int `json:"failed_steps"`
SkippedSteps int `json:"skipped_steps"`
StartTime string `json:"start_time"`
EndTime string `json:"end_time"`
Duration string `json:"duration"`
StepResults []RebaseStepResult `json:"step_results"`
Summary AutoRebaseSummary `json:"summary"`
BackupsCreated []string `json:"backups_created"`
Recommendations []string `json:"recommendations"`
}
AutoRebaseResult represents the result of an auto-rebase operation
type AutoRebaseSummary ¶
type AutoRebaseSummary struct {
BranchesProcessed int `json:"branches_processed"`
BranchesRebased int `json:"branches_rebased"`
BranchesFailed int `json:"branches_failed"`
BranchesSkipped int `json:"branches_skipped"`
ConflictsResolved int `json:"conflicts_resolved"`
ConflictsRemaining int `json:"conflicts_remaining"`
TotalCommits int `json:"total_commits"`
SuccessRate float64 `json:"success_rate"`
OverallStatus string `json:"overall_status"` // "success", "partial_success", "failed"
}
AutoRebaseSummary provides a high-level summary of the auto-rebase operation
type BranchDependency ¶
type BranchDependency struct {
Source string `json:"source"` // The branch being depended on
Dependent string `json:"dependent"` // The branch that depends on source
Relationship string `json:"relationship"` // Type of relationship: "direct", "indirect", "environment"
Distance int `json:"distance"` // Number of hops in dependency graph
Conflicts []MergeConflict `json:"conflicts"` // Potential merge conflicts
Metadata map[string]string `json:"metadata"` // Additional dependency metadata
}
BranchDependency represents a dependency relationship between branches
type BranchInfo ¶
type BranchInfo struct {
Name string `json:"name"`
CommitHash string `json:"commit_hash"`
CommitDate string `json:"commit_date"`
Author string `json:"author"`
Message string `json:"message"`
FileCount int `json:"file_count"`
Additions int `json:"additions"`
Deletions int `json:"deletions"`
IsEnvironment bool `json:"is_environment"`
}
BranchInfo contains detailed information about a branch
type BranchProcessor ¶
type BranchProcessor interface {
// ProcessBranches executes the core branch processing algorithm
// This is the main method that both rebuild and release will use
ProcessBranches(source string, target string, branches []string, opts ProcessOptions) error
// GetFeaturesInEnvironment returns the list of features in an environment
GetFeaturesInEnvironment(env string) []string
// LockTarget acquires a lock on the target branch/environment
LockTarget(target string, opts ProcessOptions) error
// UnlockTarget releases a lock on the target branch/environment
UnlockTarget(target string, opts ProcessOptions) error
// CreateTempBranch creates a temporary branch for safe operations
CreateTempBranch(name, base string, opts ProcessOptions) (string, error)
// CleanupTempBranch removes a temporary branch
CleanupTempBranch(name string, opts ProcessOptions) error
// SwapToTarget atomically swaps temp branch to become the target
SwapToTarget(tempBranch, target string, opts ProcessOptions) error
// ProcessBranch handles processing of a single branch
ProcessBranch(branch, tempBranch string, opts ProcessOptions) error
// HandleBranchFailure handles failures during branch processing
HandleBranchFailure(branch string, err error, opts ProcessOptions) error
// UpdateMetadata updates metadata after processing
UpdateMetadata(source, target string, branches []string, opts ProcessOptions) error
// ValidatePreconditions validates that processing can proceed
ValidatePreconditions(source, target string, branches []string, opts ProcessOptions) error
}
BranchProcessor defines the interface for processing branches This interface is shared between rebuild and release commands to ensure consistent behavior and maximum code reuse.
type BranchRecoveryState ¶
type BranchRecoveryState struct {
BranchName string `json:"branch_name"`
OriginalCommit string `json:"original_commit"`
CurrentCommit string `json:"current_commit"`
Status string `json:"status"` // "pending", "in_progress", "completed", "failed", "rolled_back"
BackupBranch string `json:"backup_branch,omitempty"`
FailedStep string `json:"failed_step,omitempty"`
FailureReason string `json:"failure_reason,omitempty"`
LastError string `json:"last_error,omitempty"`
LastUpdate string `json:"last_update"`
}
BranchRecoveryState tracks the recovery state of individual branches
type BranchResult ¶
type BranchResult struct {
Branch string // Branch name
Success bool // Whether processing succeeded
StartedAt time.Time // When processing started
CompletedAt time.Time // When processing completed
Duration time.Time // How long processing took
Error error // Error if processing failed
Conflicts []string // Conflicts that were encountered and resolved
Commits int // Number of commits made
Messages []string // Informational messages
}
BranchResult represents the result of processing a single branch
type BranchValidator ¶
type BranchValidator interface {
ValidatePreconditions(repo *hitchgit.Repo, meta *metadata.Metadata, source, target string, branches []string) error
}
Placeholder interfaces that will be implemented in subsequent priorities
type ConflictResolutionDecision ¶
type ConflictResolutionDecision struct {
Strategy string `json:"strategy"` // "abort", "skip", "manual", "force"
Details string `json:"details"`
Actions []string `json:"actions"`
}
ConflictResolutionDecision represents a decision about conflict resolution
type DefaultBranchProcessor ¶
type DefaultBranchProcessor struct {
// contains filtered or unexported fields
}
DefaultBranchProcessor provides a concrete implementation of BranchProcessor This implementation contains all the shared logic used by rebuild and release commands
func NewDefaultBranchProcessor ¶
func NewDefaultBranchProcessor(repo *hitchgit.Repo, meta *metadata.Metadata) *DefaultBranchProcessor
NewDefaultBranchProcessor creates a new DefaultBranchProcessor
func (*DefaultBranchProcessor) CleanupTempBranch ¶
func (p *DefaultBranchProcessor) CleanupTempBranch(name string, opts ProcessOptions) error
CleanupTempBranch removes a temporary branch
func (*DefaultBranchProcessor) CreateTempBranch ¶
func (p *DefaultBranchProcessor) CreateTempBranch(name, base string, opts ProcessOptions) (string, error)
CreateTempBranch creates a temporary branch for safe operations
func (*DefaultBranchProcessor) EnableRecoveryTracking ¶
func (p *DefaultBranchProcessor) EnableRecoveryTracking()
EnableRecoveryTracking enables recovery state tracking for release operations
func (*DefaultBranchProcessor) GetFeaturesInEnvironment ¶
func (p *DefaultBranchProcessor) GetFeaturesInEnvironment(env string) []string
GetFeaturesInEnvironment returns the list of features in an environment
func (*DefaultBranchProcessor) HandleBranchFailure ¶
func (p *DefaultBranchProcessor) HandleBranchFailure(branch string, err error, opts ProcessOptions) error
HandleBranchFailure handles failures during branch processing
func (*DefaultBranchProcessor) LockTarget ¶
func (p *DefaultBranchProcessor) LockTarget(target string, opts ProcessOptions) error
LockTarget acquires a lock on the target branch/environment
func (*DefaultBranchProcessor) ProcessBranch ¶
func (p *DefaultBranchProcessor) ProcessBranch(branch, tempBranch string, opts ProcessOptions) error
ProcessBranch handles processing of a single branch
func (*DefaultBranchProcessor) ProcessBranches ¶
func (p *DefaultBranchProcessor) ProcessBranches(source string, target string, branches []string, opts ProcessOptions) error
ProcessBranches executes the core branch processing algorithm This is the main method that implements the shared logic between rebuild and release
func (*DefaultBranchProcessor) SwapToTarget ¶
func (p *DefaultBranchProcessor) SwapToTarget(tempBranch, target string, opts ProcessOptions) error
SwapToTarget atomically swaps temp branch to become the target
func (*DefaultBranchProcessor) UnlockTarget ¶
func (p *DefaultBranchProcessor) UnlockTarget(target string, opts ProcessOptions) error
UnlockTarget releases a lock on the target branch/environment
func (*DefaultBranchProcessor) UpdateMetadata ¶
func (p *DefaultBranchProcessor) UpdateMetadata(source, target string, branches []string, opts ProcessOptions) error
UpdateMetadata updates metadata after processing
func (*DefaultBranchProcessor) ValidatePreconditions ¶
func (p *DefaultBranchProcessor) ValidatePreconditions(source string, target string, branches []string, opts ProcessOptions) error
ValidatePreconditions validates that processing can proceed
type DefaultOperationLogger ¶
type DefaultOperationLogger struct {
// contains filtered or unexported fields
}
DefaultOperationLogger implements OperationLogger
func (*DefaultOperationLogger) LogOperationFailure ¶
func (o *DefaultOperationLogger) LogOperationFailure(operation, target string, err error, duration time.Duration, fields map[string]interface{})
LogOperationFailure logs operation failure
func (*DefaultOperationLogger) LogOperationProgress ¶
func (o *DefaultOperationLogger) LogOperationProgress(operation, target string, progress int, message string)
LogOperationProgress logs operation progress
func (*DefaultOperationLogger) LogOperationStart ¶
func (o *DefaultOperationLogger) LogOperationStart(operation, target string, fields map[string]interface{})
LogOperationStart logs the start of an operation
func (*DefaultOperationLogger) LogOperationSuccess ¶
func (o *DefaultOperationLogger) LogOperationSuccess(operation, target string, duration time.Duration, fields map[string]interface{})
LogOperationSuccess logs successful completion of an operation
type DefaultPerformanceLogger ¶
type DefaultPerformanceLogger struct {
// contains filtered or unexported fields
}
DefaultPerformanceLogger implements PerformanceLogger
func (*DefaultPerformanceLogger) LogMemoryUsage ¶
func (p *DefaultPerformanceLogger) LogMemoryUsage(operation string, allocated, total uint64)
LogMemoryUsage logs memory usage
func (*DefaultPerformanceLogger) LogPerformanceMetric ¶
func (p *DefaultPerformanceLogger) LogPerformanceMetric(operation string, metric string, value interface{}, unit string)
LogPerformanceMetric logs a performance metric
func (*DefaultPerformanceLogger) LogSlowOperation ¶
func (p *DefaultPerformanceLogger) LogSlowOperation(operation string, duration time.Duration, threshold time.Duration)
LogSlowOperation logs a slow operation
type DependencyAnalysis ¶
type DependencyAnalysis struct {
SourceBranch string `json:"source_branch"`
TargetBranch string `json:"target_branch"`
AnalyzedAt string `json:"analyzed_at"`
DirectDependents []BranchDependency `json:"direct_dependents"`
IndirectDependents []BranchDependency `json:"indirect_dependents"`
EnvironmentDependents []BranchDependency `json:"environment_dependents"`
TotalDependents int `json:"total_dependents"`
Conflicts []MergeConflict `json:"conflicts"`
Summary DependencySummary `json:"summary"`
}
DependencyAnalysis represents the complete analysis of branch dependencies
type DependencyAnalyzer ¶
type DependencyAnalyzer struct {
// contains filtered or unexported fields
}
DependencyAnalyzer detects and analyzes dependencies between branches
func NewDependencyAnalyzer ¶
func NewDependencyAnalyzer(repo *hitchgit.Repo, meta *metadata.Metadata) *DependencyAnalyzer
NewDependencyAnalyzer creates a new dependency analyzer
func (*DependencyAnalyzer) AnalyzeReleaseDependencies ¶
func (da *DependencyAnalyzer) AnalyzeReleaseDependencies(source, target string) (*DependencyAnalysis, error)
AnalyzeReleaseDependencies analyzes dependencies for a release operation
func (*DependencyAnalyzer) GetRebasePlan ¶
func (da *DependencyAnalyzer) GetRebasePlan(analysis *DependencyAnalysis) (*RebasePlan, error)
GetRebasePlan creates a rebase plan for the detected dependencies
type DependencySummary ¶
type DependencySummary struct {
TotalBranches int `json:"total_branches"`
DirectBranches int `json:"direct_branches"`
IndirectBranches int `json:"indirect_branches"`
EnvironmentBranches int `json:"environment_branches"`
HasConflicts bool `json:"has_conflicts"`
ConflictCount int `json:"conflict_count"`
CriticalConflicts int `json:"critical_conflicts"`
RebaseRequired bool `json:"rebase_required"`
RiskLevel string `json:"risk_level"` // "low", "medium", "high", "critical"
Recommendations []string `json:"recommendations"`
}
DependencySummary provides a high-level overview of dependencies
type DryRunImpact ¶
type DryRunImpact struct {
EstimatedDuration string
AffectedBranches int
RiskLevel string // "low", "medium", "high", "critical"
}
DryRunImpact represents the impact analysis result
type DryRunSafetyCheck ¶
DryRunSafetyCheck represents a safety check result
type DryRunValidation ¶
DryRunValidation represents validation results
type ErrorAnalysis ¶
type ErrorAnalysis struct {
CanRecover bool
CanRetry bool
MaxRetries int
RetryDelay time.Duration
Severity string
Category errors.ErrorCategory
Message string
UserAction string
Recommendations []string
}
ErrorAnalysis provides detailed analysis of an error
type ErrorRecoveryManager ¶
type ErrorRecoveryManager struct {
// contains filtered or unexported fields
}
ErrorRecoveryManager provides enhanced error recovery capabilities
func InitializeDefaultErrorRecovery ¶
func InitializeDefaultErrorRecovery() *ErrorRecoveryManager
InitializeDefaultErrorRecovery sets up default error recovery for Hitch
func NewErrorRecoveryManager ¶
func NewErrorRecoveryManager() *ErrorRecoveryManager
NewErrorRecoveryManager creates a new error recovery manager
func (*ErrorRecoveryManager) AnalyzeError ¶
func (erm *ErrorRecoveryManager) AnalyzeError(err error) ErrorAnalysis
AnalyzeError analyzes an error and provides recovery recommendations
func (*ErrorRecoveryManager) GetDefaultRecoveryStrategies ¶
func (erm *ErrorRecoveryManager) GetDefaultRecoveryStrategies() map[errors.ErrorCategory]RecoveryStrategy
GetDefaultRecoveryStrategies returns the default set of recovery strategies
func (*ErrorRecoveryManager) RecoverFromError ¶
func (erm *ErrorRecoveryManager) RecoverFromError(err error, attempt int) error
RecoverFromError attempts to recover from an error automatically
func (*ErrorRecoveryManager) RegisterRecoveryStrategy ¶
func (erm *ErrorRecoveryManager) RegisterRecoveryStrategy(strategy RecoveryStrategy)
RegisterRecoveryStrategy registers a recovery strategy for an error category
type ErrorType ¶
type ErrorType string
ErrorType represents categories of errors
const ( ErrorTypeValidation ErrorType = "validation" ErrorTypeLocking ErrorType = "locking" ErrorTypeGit ErrorType = "git" ErrorTypeMetadata ErrorType = "metadata" ErrorTypeDependency ErrorType = "dependency" ErrorTypeRebase ErrorType = "rebase" ErrorTypeRelease ErrorType = "release" ErrorTypePermission ErrorType = "permission" ErrorTypeNetwork ErrorType = "network" ErrorTypeConfiguration ErrorType = "configuration" ErrorTypeSystem ErrorType = "system" )
func GetErrorType ¶
GetErrorType extracts the error type from an error
type GlobalRepositoryLock ¶
type GlobalRepositoryLock struct {
// contains filtered or unexported fields
}
GlobalRepositoryLock provides simple cross-process repository locking This prevents Git index lock contention between multiple Hitch processes
func GetGlobalRepositoryLock ¶
func GetGlobalRepositoryLock(repoPath string) *GlobalRepositoryLock
GetGlobalRepositoryLock returns a global repository lock for the given path
func NewGlobalRepositoryLock ¶
func NewGlobalRepositoryLock(repoPath string) *GlobalRepositoryLock
NewGlobalRepositoryLock creates a new global repository lock
func (*GlobalRepositoryLock) IsLocked ¶
func (grl *GlobalRepositoryLock) IsLocked() bool
IsLocked checks if the repository is currently locked
func (*GlobalRepositoryLock) Lock ¶
func (grl *GlobalRepositoryLock) Lock() error
Lock acquires the global repository lock with simple PID-based checking
func (*GlobalRepositoryLock) Unlock ¶
func (grl *GlobalRepositoryLock) Unlock() error
Unlock releases the global repository lock
type HitchError ¶
type HitchError struct {
Code string `json:"code"` // Error code for programmatic handling
Type ErrorType `json:"type"` // Error category
Message string `json:"message"` // Human-readable message
Context map[string]string `json:"context"` // Additional context
Suggestions []string `json:"suggestions"` // Recovery suggestions
Timestamp time.Time `json:"timestamp"` // When error occurred
Retryable bool `json:"retryable"` // Whether operation can be retried
Cause error `json:"-"` // Underlying error (not serialized)
}
HitchError represents a structured error with context and recovery suggestions
func NewBranchNotFoundError ¶
func NewBranchNotFoundError(branchName string) *HitchError
NewBranchNotFoundError creates a branch not found error
func NewConfigurationError ¶
func NewConfigurationError(parameter string, value string) *HitchError
NewConfigurationError creates a configuration error
func NewDependencyConflictError ¶
func NewDependencyConflictError(dependencies []string) *HitchError
NewDependencyConflictError creates a dependency conflict error
func NewGitOperationFailedError ¶
func NewGitOperationFailedError(operation string, cause error) *HitchError
NewGitOperationFailedError creates a git operation failed error
func NewHitchError ¶
func NewHitchError(code, message string, errorType ErrorType) *HitchError
NewHitchError creates a new structured error
func NewInvalidSourceError ¶
func NewInvalidSourceError(source string) *HitchError
NewInvalidSourceError creates an invalid source error
func NewInvalidTargetError ¶
func NewInvalidTargetError(target string) *HitchError
NewInvalidTargetError creates an invalid target error
func NewLockAcquisitionFailedError ¶
func NewLockAcquisitionFailedError(target string, cause error) *HitchError
NewLockAcquisitionFailedError creates a lock acquisition failed error
func NewLockConflictError ¶
func NewLockConflictError(target, lockedBy, lockedAt string) *HitchError
NewLockConflictError creates a lock conflict error
func NewMetadataNotLoadedError ¶
func NewMetadataNotLoadedError() *HitchError
NewMetadataNotLoadedError creates a metadata not loaded error
func NewNetworkError ¶
func NewNetworkError(operation string, cause error) *HitchError
NewNetworkError creates a network error
func NewOperationTimeoutError ¶
func NewOperationTimeoutError(operation string, timeout time.Duration) *HitchError
NewOperationTimeoutError creates an operation timeout error
func NewPermissionDeniedError ¶
func NewPermissionDeniedError(operation string) *HitchError
NewPermissionDeniedError creates a permission denied error
func NewRebaseConflictError ¶
func NewRebaseConflictError(branch string, conflicts []string) *HitchError
NewRebaseConflictError creates a rebase conflict error
func NewRebuildFailedError ¶
func NewRebuildFailedError(environment string, cause error) *HitchError
NewRebuildFailedError creates a rebuild failed error
func NewReleaseFailedError ¶
func NewReleaseFailedError(source, target string, cause error) *HitchError
NewReleaseFailedError creates a release failed error
func NewRepoNotInitializedError ¶
func NewRepoNotInitializedError() *HitchError
NewRepoNotInitializedError creates a repository not initialized error
func NewTempBranchFailedError ¶
func NewTempBranchFailedError(operation, branchName string, cause error) *HitchError
NewTempBranchFailedError creates a temporary branch operation failed error
func NewUncommittedChangesError ¶
func NewUncommittedChangesError(branch string) *HitchError
NewUncommittedChangesError creates an uncommitted changes error
func NewUserRequiredError ¶
func NewUserRequiredError() *HitchError
NewUserRequiredError creates a user required error
func NewValidationFailedError ¶
func NewValidationFailedError(validation string, details string) *HitchError
NewValidationFailedError creates a validation failed error
func WrapError ¶
func WrapError(err error, code, message string, errorType ErrorType) *HitchError
WrapError wraps a standard error with Hitch context
func (*HitchError) Is ¶
func (e *HitchError) Is(target error) bool
Is checks if the error matches the target error
func (*HitchError) WithCause ¶
func (e *HitchError) WithCause(cause error) *HitchError
WithCause adds an underlying cause
func (*HitchError) WithContext ¶
func (e *HitchError) WithContext(key, value string) *HitchError
WithContext adds context information
func (*HitchError) WithContextMap ¶
func (e *HitchError) WithContextMap(context map[string]string) *HitchError
WithContextMap adds multiple context values
func (*HitchError) WithRetryable ¶
func (e *HitchError) WithRetryable(retryable bool) *HitchError
WithRetryable marks the error as retryable
func (*HitchError) WithSuggestion ¶
func (e *HitchError) WithSuggestion(suggestion string) *HitchError
WithSuggestion adds a recovery suggestion
func (*HitchError) WithSuggestions ¶
func (e *HitchError) WithSuggestions(suggestions []string) *HitchError
WithSuggestions adds multiple recovery suggestions
type InteractivePromptSystem ¶
type InteractivePromptSystem struct {
// contains filtered or unexported fields
}
InteractivePromptSystem handles user interaction for auto-rebase decisions
func NewInteractivePromptSystem ¶
func NewInteractivePromptSystem() *InteractivePromptSystem
NewInteractivePromptSystem creates a new interactive prompt system
func (*InteractivePromptSystem) PromptForAutoRebase ¶
func (ips *InteractivePromptSystem) PromptForAutoRebase(analysis *DependencyAnalysis) (*AutoRebaseDecision, error)
PromptForAutoRebase prompts the user for auto-rebase decision when dependents are detected
func (*InteractivePromptSystem) PromptForConflictResolution ¶
func (ips *InteractivePromptSystem) PromptForConflictResolution(branch string, conflicts []string) (*ConflictResolutionDecision, error)
PromptForConflictResolution prompts the user for conflict resolution strategy
type LockInfo ¶
type LockInfo struct {
ID string `json:"id"`
Target LockTarget `json:"target"`
LockedBy string `json:"locked_by"`
LockedAt time.Time `json:"locked_at"`
Reason string `json:"reason,omitempty"`
ExpiresAt time.Time `json:"expires_at,omitempty"`
IsStale bool `json:"is_stale"`
}
LockInfo contains information about a lock
type LockLogger ¶
type LockLogger interface {
LogAcquisition(req LockRequest, result *LockResult)
LogRelease(target LockTarget, user string, err error)
LogStaleDetected(target LockTarget, lockInfo *LockInfo)
LogRecovery(target LockTarget, recovered bool)
}
LockLogger handles logging for lock operations
type LockManager ¶
type LockManager struct {
// contains filtered or unexported fields
}
LockManager provides unified lock management for both environments and branches
func NewLockManager ¶
func NewLockManager(meta *metadata.Metadata) *LockManager
NewLockManager creates a new unified lock manager
func (*LockManager) AcquireLock ¶
func (lm *LockManager) AcquireLock(req LockRequest) (*LockResult, error)
AcquireLock acquires a lock for any target (environment or branch)
func (*LockManager) CleanupStaleLocks ¶
func (lm *LockManager) CleanupStaleLocks() (int, error)
CleanupStaleLocks removes all stale locks
func (*LockManager) GetAllLocks ¶
func (lm *LockManager) GetAllLocks() map[string]*LockInfo
GetAllLocks returns all current locks
func (*LockManager) GetLockInfo ¶
func (lm *LockManager) GetLockInfo(target LockTarget) (*LockInfo, error)
GetLockInfo returns information about a lock
func (*LockManager) GetStatus ¶
func (lm *LockManager) GetStatus() *LockManagerStatus
GetStatus returns the current status of the lock manager
func (*LockManager) IsLocked ¶
func (lm *LockManager) IsLocked(target LockTarget) bool
IsLocked checks if a target is currently locked
func (*LockManager) ReleaseLock ¶
func (lm *LockManager) ReleaseLock(target LockTarget, userEmail string) error
ReleaseLock releases a lock for any target (environment or branch)
func (*LockManager) SetDefaultTimeout ¶
func (lm *LockManager) SetDefaultTimeout(timeout time.Duration)
SetDefaultTimeout sets the default lock timeout
func (*LockManager) SetEnabled ¶
func (lm *LockManager) SetEnabled(enabled bool)
SetEnabled enables or disables the lock manager
func (*LockManager) SetStaleLockTimeout ¶
func (lm *LockManager) SetStaleLockTimeout(timeout time.Duration)
SetStaleLockTimeout sets the timeout for considering locks as stale
type LockManagerStatus ¶
type LockManagerStatus struct {
Enabled bool `json:"enabled"`
TotalLocks int `json:"total_locks"`
EnvironmentLocks map[string]LockInfo `json:"environment_locks"`
BranchLocks map[string]LockInfo `json:"branch_locks"`
}
LockManagerStatus contains the status of the lock manager
type LockOperationResult ¶
type LockOperationResult struct {
Operation string `json:"operation"` // "acquire", "release"
Target string `json:"target"`
TargetType string `json:"target_type"` // "branch", "environment"
Success bool `json:"success"`
Error string `json:"error,omitempty"`
Timestamp string `json:"timestamp"`
Duration string `json:"duration"`
}
LockOperationResult represents the result of a lock operation
type LockRequest ¶
type LockRequest struct {
Target LockTarget
User string
Reason string
Timeout time.Duration
Force bool
LockType string // "exclusive" | "shared" (future extension)
}
LockRequest represents a unified lock acquisition request
type LockResult ¶
type LockResult struct {
Success bool
Message string
LockAcquired bool
WasStale bool
RecoveredFrom []string
LockInfo *LockInfo
}
LockResult represents the result of a lock operation
type LockTarget ¶
type LockTarget struct {
Type string // "environment" | "branch"
Name string // "qa", "dev", "main", etc.
FullName string // Full name for logging (e.g., "environment qa", "branch main")
}
LockTarget defines the type of resource being locked
type LogLevel ¶
type LogLevel int
LogLevel represents different logging levels
func GetEffectiveLogLevel ¶
func GetEffectiveLogLevel() LogLevel
GetEffectiveLogLevel returns the current effective log level considering all flags
func ParseLogLevel ¶
ParseLogLevel parses a string into a LogLevel
type Logger ¶
type Logger interface {
Trace(message string, args ...interface{})
Debug(message string, args ...interface{})
Info(message string, args ...interface{})
Warn(message string, args ...interface{})
Error(message string, args ...interface{})
Fatal(message string, args ...interface{})
WithError(err error) Logger
WithContext(key, value string) Logger
WithFields(fields map[string]interface{}) Logger
SetOutput(w io.Writer) Logger
SetLevel(level LogLevel) Logger
}
Logger interface for structured logging
func NewFileLogger ¶
NewFileLogger creates a logger that writes to a file
type LoggingConfig ¶
type LoggingConfig struct {
Level LogLevel
Quiet bool
Verbose bool
NoColor bool
LogFile string
EnableCaller bool
EnableTimestamp bool
EnableSystemLog bool
}
LoggingConfig holds configuration for the global logging system
func GetLoggingConfig ¶
func GetLoggingConfig() LoggingConfig
GetLoggingConfig returns the current global logging configuration
type MergeConflict ¶
type MergeConflict struct {
Type string `json:"type"` // "file", "directory", "content"
Path string `json:"path"` // File/directory path
Description string `json:"description"` // Human-readable description
Severity string `json:"severity"` // "low", "medium", "high", "critical"
Solutions []string `json:"solutions"` // Suggested resolutions
}
MergeConflict represents a potential merge conflict
type OperationLogger ¶
type OperationLogger interface {
LogOperationStart(operation, target string, fields map[string]interface{})
LogOperationSuccess(operation, target string, duration time.Duration, fields map[string]interface{})
LogOperationFailure(operation, target string, err error, duration time.Duration, fields map[string]interface{})
LogOperationProgress(operation, target string, progress int, message string)
}
OperationLogger provides specialized logging for Hitch operations
func NewOperationLogger ¶
func NewOperationLogger(logger Logger) OperationLogger
NewOperationLogger creates a new operation logger
type PerformanceLogger ¶
type PerformanceLogger interface {
LogPerformanceMetric(operation string, metric string, value interface{}, unit string)
LogSlowOperation(operation string, duration time.Duration, threshold time.Duration)
LogMemoryUsage(operation string, allocated, total uint64)
}
PerformanceLogger provides specialized logging for performance metrics
func NewPerformanceLogger ¶
func NewPerformanceLogger(logger Logger) PerformanceLogger
NewPerformanceLogger creates a new performance logger
type PostReleaseValidator ¶
type PostReleaseValidator struct {
// contains filtered or unexported fields
}
PostReleaseValidator handles post-release validation
func (*PostReleaseValidator) GetDescription ¶
func (pv *PostReleaseValidator) GetDescription() string
func (*PostReleaseValidator) GetName ¶
func (pv *PostReleaseValidator) GetName() string
func (*PostReleaseValidator) Validate ¶
func (pv *PostReleaseValidator) Validate(source, target string, opts ValidationOptions) (*ValidationResult, error)
Post-release validation implementation
type PreReleaseValidator ¶
type PreReleaseValidator struct {
// contains filtered or unexported fields
}
PreReleaseValidator handles pre-release validation
func (*PreReleaseValidator) GetDescription ¶
func (pv *PreReleaseValidator) GetDescription() string
func (*PreReleaseValidator) GetName ¶
func (pv *PreReleaseValidator) GetName() string
func (*PreReleaseValidator) Validate ¶
func (pv *PreReleaseValidator) Validate(source, target string, opts ValidationOptions) (*ValidationResult, error)
Pre-release validation implementation
type ProcessOptions ¶
type ProcessOptions struct {
// Core operation identification
OperationType string // "rebuild" | "release" | future operations
Source string // Source branch/environment name
Target string // Target branch/environment name
SourceType string // "hitched_branch" | "feature_branch" | "base_branch"
// Operation configuration
DryRun bool // Simulate without making changes
Force bool // Force operation even if locked/in use
Interactive bool // Prompt for user decisions during conflicts
Resume bool // Resume a previously failed operation
UpdateDependents bool // Update dependent branches after operation
// Locking configuration
LockTimeout time.Duration // How long to wait for locks
LockReason string // Reason for locking
UserEmail string // User email for lock attribution
UserName string // User name for lock attribution
// Branch processing options
AutoRebase bool // Automatically rebase dependent branches
BackupBranches bool // Create backups before modifying branches
ContinueOnFail bool // Continue processing other branches if one fails
// Output and logging
Verbose bool // Show detailed processing information
Quiet bool // Suppress non-error output
ColorOutput bool // Use colored output
// Metadata options
UpdateMetadata bool // Update metadata after processing
CommitMessage string // Custom commit message for metadata updates
// Validation options
SkipValidation bool // Skip pre-flight validation
StrictMode bool // Fail on any warnings
}
ProcessOptions captures the differences between different operations This allows the same core algorithm to be used for rebuild, release, and future operations
type ProcessingResult ¶
type ProcessingResult struct {
// Success information
Success bool // Whether operation succeeded
CompletedAt time.Time // When operation completed
Duration time.Time // Total duration taken
// Branch processing results
ProcessedBranches []string // Successfully processed
FailedBranches []string // Failed to process
ConflictedBranches []string // Had conflicts
BranchResults map[string]BranchResult // Detailed results per branch
// Changes made
TempBranchCreated string // Temporary branch that was created
ChangesCommitted int // Number of commits made
ConflictsResolved int // Number of conflicts resolved
BranchesRebased []string // Branches that were rebased
// Metadata updates
MetadataUpdated bool // Whether metadata was updated
MetadataCommitSHA string // SHA of metadata commit
ReleaseID string // ID of release (for release operations)
// Lock information
LockAcquired bool // Whether a lock was acquired
LockReleased bool // Whether lock was properly released
LockDuration time.Time // How long lock was held
// Error information
Errors []error // All errors encountered
LastError error // Last error
RecoveryAvailable bool // Whether recovery is possible
RecoveryActions []string // Recovery actions available
// Additional information
Messages []string // Informational messages
Warnings []string // Warning messages
DryRun bool // Whether this was a dry run
ResumeAvailable bool // Whether operation can be resumed
}
ProcessingResult represents the result of a processing operation
type ProcessingState ¶
type ProcessingState struct {
// Identification
OperationID string // Unique identifier for this operation
OperationType string // Type of operation (rebuild, release, etc.)
Source string // Source branch/environment
Target string // Target branch/environment
StartTime time.Time // When the operation started
// Branch information
Branches []string // Branches being processed
ProcessedBranches []string // Successfully processed branches
FailedBranches []string // Failed to process
ConflictedBranches []string // Had conflicts during processing
// Temporary branch management
TempBranch string // Current temporary branch name
OriginalBranch string // Branch we started on
BaseBranch string // Base branch for operations
// Locking state
TargetLocked bool // Whether target is currently locked
LockAcquiredAt time.Time // When lock was acquired
LockExpiresAt time.Time // When lock expires
// User information
UserEmail string // User email
UserName string // User name
// Progress tracking
CurrentStep string // Current step description
ProgressPercent int // Progress percentage (0-100)
EstimatedRemaining time.Time // Estimated time remaining
// Error handling
LastError error // Last error encountered
RetryCount int // Number of retries attempted
MaxRetries int // Maximum allowed retries
// Results
Success bool // Whether operation succeeded
CompletionTime time.Time // When operation completed
Duration time.Time // Total duration
ChangesCommitted int // Number of changes committed
ConflictsResolved int // Number of conflicts resolved
}
ProcessingState represents the current state of a processing operation
type PromptFormatter ¶
type PromptFormatter interface {
FormatDependencySummary(analysis *DependencyAnalysis) string
FormatRebasePrompt(options []string) string
FormatConflictPrompt(conflicts []string) string
FormatDecision(decision string, details string) string
}
PromptFormatter handles formatting of prompts and responses
type PromptLogger ¶
type PromptLogger interface {
LogPrompt(question string)
LogResponse(response string)
LogDecision(decision string, details string)
}
PromptLogger handles logging for prompt operations
type RebasePlan ¶
type RebasePlan struct {
SourceBranch string `json:"source_branch"`
TargetBranch string `json:"target_branch"`
CreatedAt string `json:"created_at"`
Steps []RebaseStep `json:"steps"`
Summary string `json:"summary"`
}
RebasePlan represents a plan for rebasing dependent branches
type RebaseStep ¶
type RebaseStep struct {
Branch string `json:"branch"`
Order int `json:"order"`
Priority string `json:"priority"` // "high", "medium", "low"
Dependencies []string `json:"dependencies"` // Branches this depends on
Conflicts []MergeConflict `json:"conflicts"`
Description string `json:"description"`
}
RebaseStep represents a single step in the rebase plan
type RebaseStepResult ¶
type RebaseStepResult struct {
Step RebaseStep `json:"step"`
Success bool `json:"success"`
StartTime string `json:"start_time"`
EndTime string `json:"end_time"`
Duration string `json:"duration"`
Error string `json:"error,omitempty"`
Conflicts []string `json:"conflicts,omitempty"`
BackupCreated string `json:"backup_created,omitempty"`
Actions []string `json:"actions"`
Status string `json:"status"` // "pending", "in_progress", "completed", "failed", "skipped"
}
RebaseStepResult represents the result of a single rebase step
type RecoveryOptions ¶
type RecoveryOptions struct {
ForceResume bool `json:"force_resume"`
ForceRollback bool `json:"force_rollback"`
SkipFailedSteps bool `json:"skip_failed_steps"`
CleanupOnFailure bool `json:"cleanup_on_failure"`
CleanupArtifacts bool `json:"cleanup_artifacts"`
CreateBackup bool `json:"create_backup"`
CreateBackups bool `json:"create_backups"`
RollbackDependents bool `json:"rollback_dependents"`
Verbose bool `json:"verbose"`
Quiet bool `json:"quiet"`
DryRun bool `json:"dry_run"`
}
RecoveryOptions contains options for recovery operations
type RecoveryPersistence ¶
type RecoveryPersistence struct {
// contains filtered or unexported fields
}
RecoveryPersistence handles saving and loading recovery state from disk
func NewRecoveryPersistence ¶
func NewRecoveryPersistence(repo *hitchgit.Repo) *RecoveryPersistence
NewRecoveryPersistence creates a new recovery persistence handler
func (*RecoveryPersistence) ArchiveRecoveryState ¶
func (rp *RecoveryPersistence) ArchiveRecoveryState(releaseID string) error
ArchiveRecoveryState moves a recovery state to archive directory
func (*RecoveryPersistence) CleanupOldRecoveryStates ¶
func (rp *RecoveryPersistence) CleanupOldRecoveryStates(olderThan time.Duration) (int, error)
CleanupOldRecoveryStates removes recovery states older than the specified duration
func (*RecoveryPersistence) DeleteRecoveryState ¶
func (rp *RecoveryPersistence) DeleteRecoveryState(releaseID string) error
DeleteRecoveryState removes a recovery state file
func (*RecoveryPersistence) EnsureRecoveryDirectory ¶
func (rp *RecoveryPersistence) EnsureRecoveryDirectory() error
EnsureRecoveryDirectory creates the recovery directory if it doesn't exist
func (*RecoveryPersistence) GetRecoveryDirectory ¶
func (rp *RecoveryPersistence) GetRecoveryDirectory() string
GetRecoveryDirectory returns the recovery directory path
func (*RecoveryPersistence) ListRecoveryStates ¶
func (rp *RecoveryPersistence) ListRecoveryStates() ([]*ReleaseRecoveryState, error)
ListRecoveryStates lists all available recovery states
func (*RecoveryPersistence) LoadRecoveryState ¶
func (rp *RecoveryPersistence) LoadRecoveryState(releaseID string) (*ReleaseRecoveryState, error)
LoadRecoveryState loads a recovery state from disk
func (*RecoveryPersistence) SaveRecoveryState ¶
func (rp *RecoveryPersistence) SaveRecoveryState(state *ReleaseRecoveryState) error
SaveRecoveryState saves the current recovery state to disk
type RecoveryResult ¶
type RecoveryResult struct {
Success bool `json:"success"`
ResumedFrom string `json:"resumed_from"`
CompletedSteps []string `json:"completed_steps"`
FailedSteps []string `json:"failed_steps"`
RolledBackBranches []string `json:"rolled_back_branches"`
CleanedUpBranches []string `json:"cleaned_up_branches"`
Duration string `json:"duration"`
Issues []ReleaseIssue `json:"issues"`
Recommendations []string `json:"recommendations"`
Summary RecoverySummary `json:"summary"`
}
RecoveryResult contains the result of a recovery operation
type RecoveryStrategy ¶
type RecoveryStrategy struct {
Category errors.ErrorCategory
CanRetry bool
MaxRetries int
RetryDelay time.Duration
UserAction string
AutoRecovery bool
RecoveryAction func(error) error
}
RecoveryStrategy defines how to recover from different types of errors
type RecoverySummary ¶
type RecoverySummary struct {
TotalSteps int `json:"total_steps"`
CompletedSteps int `json:"completed_steps"`
FailedSteps int `json:"failed_steps"`
SkippedSteps int `json:"skipped_steps"`
RolledBackBranches int `json:"rolled_back_branches"`
CleanedUpBranches int `json:"cleaned_up_branches"`
SuccessRate float64 `json:"success_rate"`
OverallStatus string `json:"overall_status"`
}
RecoverySummary provides a summary of the recovery operation
type ReleaseBranchInfo ¶
type ReleaseBranchInfo struct {
Source BranchInfo `json:"source"`
Target BranchInfo `json:"target"`
Dependents []BranchInfo `json:"dependents"`
TempBranch BranchInfo `json:"temp_branch,omitempty"`
}
ReleaseBranchInfo contains information about branches involved in the release
type ReleaseConfiguration ¶
type ReleaseConfiguration struct {
AutoRebase bool `json:"auto_rebase"`
Interactive bool `json:"interactive"`
DryRun bool `json:"dry_run"`
Force bool `json:"force"`
BackupEnabled bool `json:"backup_enabled"`
BackupStrategy string `json:"backup_strategy"` // "always", "on-conflict", "never"
ExcludedBranches []string `json:"excluded_branches"`
LockTimeout int `json:"lock_timeout_minutes"`
MaxRetries int `json:"max_retries"`
}
ReleaseConfiguration contains all configuration for a release operation
type ReleaseHistory ¶
type ReleaseHistory struct {
TotalReleases int `json:"total_releases"`
RecentReleases []ReleaseRecord `json:"recent_releases"`
Statistics ReleaseStatistics `json:"statistics"`
LastUpdated string `json:"last_updated"`
}
ReleaseHistory contains the history of all release operations
type ReleaseIssue ¶
type ReleaseIssue struct {
ID string `json:"id"`
Type string `json:"type"` // "error", "warning", "conflict", "validation"
Severity string `json:"severity"` // "critical", "high", "medium", "low"
Message string `json:"message"`
Branch string `json:"branch"`
File string `json:"file,omitempty"`
LineNumber int `json:"line_number,omitempty"`
Timestamp string `json:"timestamp"`
Resolved bool `json:"resolved"`
Resolution string `json:"resolution,omitempty"`
}
ReleaseIssue represents an issue that occurred during the release
type ReleaseMetadataLogger ¶
type ReleaseMetadataLogger interface {
LogRecordCreated(record *ReleaseRecord)
LogRecordUpdated(record *ReleaseRecord)
LogRecordQueried(query string, results int)
LogBackupCreated(branch string, backup string)
LogRollbackExecuted(rollbackID string, success bool)
}
ReleaseMetadataLogger handles logging for release metadata operations
type ReleaseMetadataManager ¶
type ReleaseMetadataManager struct {
// contains filtered or unexported fields
}
ReleaseMetadataManager manages release metadata and history
func NewReleaseMetadataManager ¶
func NewReleaseMetadataManager(repo *hitchgit.Repo, meta *metadata.Metadata) *ReleaseMetadataManager
NewReleaseMetadataManager creates a new release metadata manager
func (*ReleaseMetadataManager) AddIssue ¶
func (rmm *ReleaseMetadataManager) AddIssue(record *ReleaseRecord, issueType, severity, message, branch, file string)
AddIssue adds an issue to the release record
func (*ReleaseMetadataManager) CompleteReleaseRecord ¶
func (rmm *ReleaseMetadataManager) CompleteReleaseRecord(record *ReleaseRecord, status string) error
CompleteReleaseRecord marks a release record as completed
func (*ReleaseMetadataManager) CreateReleaseRecord ¶
func (rmm *ReleaseMetadataManager) CreateReleaseRecord(operationType, source, target string, config ReleaseConfiguration) (*ReleaseRecord, error)
CreateReleaseRecord creates a new release record
func (*ReleaseMetadataManager) GetReleaseHistory ¶
func (rmm *ReleaseMetadataManager) GetReleaseHistory(limit int) (*ReleaseHistory, error)
GetReleaseHistory retrieves the history of release operations
func (*ReleaseMetadataManager) GetReleaseRecord ¶
func (rmm *ReleaseMetadataManager) GetReleaseRecord(id string) (*ReleaseRecord, error)
GetReleaseRecord retrieves a specific release record by ID
func (*ReleaseMetadataManager) RollbackRelease ¶
func (rmm *ReleaseMetadataManager) RollbackRelease(record *ReleaseRecord, reason string) (*RollbackInfo, error)
RollbackRelease performs a rollback of a release operation
func (*ReleaseMetadataManager) SearchReleaseRecords ¶
func (rmm *ReleaseMetadataManager) SearchReleaseRecords(criteria ReleaseSearchCriteria) ([]ReleaseRecord, error)
SearchReleaseRecords searches for release records matching criteria
func (*ReleaseMetadataManager) UpdateReleaseRecord ¶
func (rmm *ReleaseMetadataManager) UpdateReleaseRecord(record *ReleaseRecord) error
UpdateReleaseRecord updates an existing release record
type ReleaseRecord ¶
type ReleaseRecord struct {
ID string `json:"id"`
OperationType string `json:"operation_type"`
SourceBranch string `json:"source_branch"`
TargetBranch string `json:"target_branch"`
StartTime string `json:"start_time"`
EndTime string `json:"end_time"`
Duration string `json:"duration"`
Status string `json:"status"` // "in_progress", "completed", "failed", "aborted", "rolled_back"
User UserInfo `json:"user"`
Configuration ReleaseConfiguration `json:"configuration"`
Branches ReleaseBranchInfo `json:"branches"`
Metadata map[string]string `json:"metadata"`
Results ReleaseResults `json:"results"`
Issues []ReleaseIssue `json:"issues"`
RollbackInfo *RollbackInfo `json:"rollback_info,omitempty"`
}
ReleaseRecord represents a complete release operation record
type ReleaseRecoveryLogger ¶
type ReleaseRecoveryLogger interface {
LogRecoveryAttempt(releaseID string)
LogRecoverySuccess(releaseID string)
LogRecoveryFailure(releaseID string, err error)
LogCleanupAttempt(releaseID string)
LogCleanupSuccess(releaseID string)
LogRollbackAttempt(releaseID string)
LogRollbackSuccess(releaseID string)
LogRollbackFailure(releaseID string, err error)
}
ReleaseRecoveryLogger handles logging for recovery operations
type ReleaseRecoveryManager ¶
type ReleaseRecoveryManager struct {
// contains filtered or unexported fields
}
ReleaseRecoveryManager handles recovery operations for failed or interrupted releases
func NewReleaseRecoveryManager ¶
func NewReleaseRecoveryManager(repo *hitchgit.Repo, meta *metadata.Metadata) *ReleaseRecoveryManager
NewReleaseRecoveryManager creates a new release recovery manager
func (*ReleaseRecoveryManager) CanRecover ¶
func (rrm *ReleaseRecoveryManager) CanRecover(releaseID string) (*ReleaseRecoveryState, error)
CanRecover checks if a specific release can be recovered
func (*ReleaseRecoveryManager) CleanupFailedRelease ¶
func (rrm *ReleaseRecoveryManager) CleanupFailedRelease(releaseID string, opts RecoveryOptions) error
CleanupFailedRelease cleans up artifacts from a failed release
func (*ReleaseRecoveryManager) DetectRecoveryStates ¶
func (rrm *ReleaseRecoveryManager) DetectRecoveryStates() ([]*ReleaseRecoveryState, error)
DetectRecoveryStates scans for interrupted releases that can be recovered
func (*ReleaseRecoveryManager) GenerateRecoveryReport ¶
func (rrm *ReleaseRecoveryManager) GenerateRecoveryReport(releaseID string) (string, error)
GenerateRecoveryReport generates a detailed report of recovery options
func (*ReleaseRecoveryManager) GetRecoveryStatus ¶
func (rrm *ReleaseRecoveryManager) GetRecoveryStatus() (map[string]*ReleaseRecoveryState, error)
GetRecoveryStatus returns the current recovery status of all releases
func (*ReleaseRecoveryManager) ResumeRelease ¶
func (rrm *ReleaseRecoveryManager) ResumeRelease(releaseID string, opts RecoveryOptions) (*RecoveryResult, error)
ResumeRelease attempts to resume a failed or interrupted release
func (*ReleaseRecoveryManager) RollbackRelease ¶
func (rrm *ReleaseRecoveryManager) RollbackRelease(releaseID string, opts RecoveryOptions) error
RollbackRelease rolls back a release operation
func (*ReleaseRecoveryManager) ValidateRecoveryState ¶
func (rrm *ReleaseRecoveryManager) ValidateRecoveryState(state *ReleaseRecoveryState) error
ValidateRecoveryState checks if a recovery state is still valid
type ReleaseRecoveryState ¶
type ReleaseRecoveryState struct {
ReleaseID string `json:"release_id"`
OriginalBranch string `json:"original_branch"`
SourceBranch string `json:"source_branch"`
TargetBranch string `json:"target_branch"`
TempBranch string `json:"temp_branch"`
BackupBranches []string `json:"backup_branches"`
CurrentStep string `json:"current_step"`
CompletedSteps []string `json:"completed_steps"`
FailedStep string `json:"failed_step,omitempty"`
FailureReason string `json:"failure_reason,omitempty"`
Configuration ReleaseConfiguration `json:"configuration"`
StartTime string `json:"start_time"`
LastUpdateTime string `json:"last_update_time"`
AutoRebaseState *AutoRebaseRecoveryState `json:"auto_rebase_state,omitempty"`
Metadata map[string]string `json:"metadata"`
IsResumable bool `json:"is_resumable"`
RequiresCleanup bool `json:"requires_cleanup"`
CanRollback bool `json:"can_rollback"`
}
ReleaseRecoveryState represents the current state of a release operation
type ReleaseResults ¶
type ReleaseResults struct {
BranchesProcessed int `json:"branches_processed"`
BranchesSucceeded int `json:"branches_succeeded"`
BranchesFailed int `json:"branches_failed"`
AutoRebaseResult *AutoRebaseResult `json:"auto_rebase_result,omitempty"`
LockOperations []LockOperationResult `json:"lock_operations"`
BackupBranches []string `json:"backup_branches"`
CreatedTags []string `json:"created_tags"`
UpdatedMetadata map[string]string `json:"updated_metadata"`
Summary ReleaseSummary `json:"summary"`
}
ReleaseResults contains the results of a release operation
type ReleaseSearchCriteria ¶
type ReleaseSearchCriteria struct {
OperationType string `json:"operation_type"`
SourceBranch string `json:"source_branch"`
TargetBranch string `json:"target_branch"`
Status string `json:"status"`
User string `json:"user"`
StartTime string `json:"start_time"`
EndTime string `json:"end_time"`
MinDuration string `json:"min_duration"`
MaxDuration string `json:"max_duration"`
HasIssues bool `json:"has_issues"`
HasRollback bool `json:"has_rollback"`
IncludeMetadata []string `json:"include_metadata"`
ExcludeMetadata []string `json:"exclude_metadata"`
Limit int `json:"limit"`
Offset int `json:"offset"`
SortBy string `json:"sort_by"`
SortOrder string `json:"sort_order"`
}
ReleaseSearchCriteria contains criteria for searching release records
type ReleaseStatistics ¶
type ReleaseStatistics struct {
TotalReleases int `json:"total_releases"`
SuccessfulReleases int `json:"successful_releases"`
FailedReleases int `json:"failed_releases"`
AverageDuration string `json:"average_duration"`
MostCommonTarget string `json:"most_common_target"`
MostCommonSource string `json:"most_common_source"`
ReleasesByUser map[string]int `json:"releases_by_user"`
ReleasesByTarget map[string]int `json:"releases_by_target"`
ReleasesByMonth map[string]int `json:"releases_by_month"`
SuccessRate float64 `json:"success_rate"`
}
ReleaseStatistics provides statistics about release operations
type ReleaseSummary ¶
type ReleaseSummary struct {
TotalBranches int `json:"total_branches"`
SuccessfulBranches int `json:"successful_branches"`
FailedBranches int `json:"failed_branches"`
SkippedBranches int `json:"skipped_branches"`
HasRollback bool `json:"has_rollback"`
TotalCommits int `json:"total_commits"`
FilesChanged int `json:"files_changed"`
Additions int `json:"additions"`
Deletions int `json:"deletions"`
SuccessRate float64 `json:"success_rate"`
OverallStatus string `json:"overall_status"`
}
ReleaseSummary provides a high-level summary of the release operation
type ReleaseValidationLogger ¶
type ReleaseValidationLogger interface {
LogValidationStart(releaseID string)
LogValidationResult(releaseID string, result *ValidationResult)
LogRollbackStart(releaseID string)
LogRollbackResult(releaseID string, result *RollbackResult)
}
ReleaseValidationLogger handles logging for validation operations
type ReleaseValidationManager ¶
type ReleaseValidationManager struct {
// contains filtered or unexported fields
}
ReleaseValidationManager handles validation and rollback operations for releases
func NewReleaseValidationManager ¶
func NewReleaseValidationManager(repo *hitchgit.Repo, meta *metadata.Metadata) *ReleaseValidationManager
NewReleaseValidationManager creates a new release validation manager
func (*ReleaseValidationManager) CheckReleaseReadiness ¶
func (rvm *ReleaseValidationManager) CheckReleaseReadiness(source, target string) (bool, []string, error)
CheckReleaseReadiness performs a quick readiness check
func (*ReleaseValidationManager) GetValidationReport ¶
func (rvm *ReleaseValidationManager) GetValidationReport(result *ValidationResult) string
GetValidationReport generates a detailed validation report
func (*ReleaseValidationManager) RollbackRelease ¶
func (rvm *ReleaseValidationManager) RollbackRelease(releaseID string, opts RollbackOptions) (*RollbackResult, error)
RollbackRelease performs rollback of a release
func (*ReleaseValidationManager) ValidateRelease ¶
func (rvm *ReleaseValidationManager) ValidateRelease(source, target string, opts ValidationOptions) (*ValidationResult, error)
ValidateRelease performs comprehensive release validation
func (*ReleaseValidationManager) ValidateReleaseCandidate ¶
func (rvm *ReleaseValidationManager) ValidateReleaseCandidate(branch string, opts ValidationOptions) (*ValidationResult, error)
ValidateReleaseCandidate checks if a branch is ready for release
type ReleaseValidator ¶
type ReleaseValidator interface {
Validate(source, target string, opts ValidationOptions) (*ValidationResult, error)
GetName() string
GetDescription() string
}
ReleaseValidator interface for different validation strategies
type RepositoryLock ¶
type RepositoryLock struct {
// contains filtered or unexported fields
}
RepositoryLock provides cross-process synchronization for Git operations This prevents multiple Hitch processes from executing Git commands simultaneously
func GetRepositoryLock ¶
func GetRepositoryLock(repoPath string) *RepositoryLock
GetRepositoryLock returns a repository lock for the given path Reuses existing locks within the same process
func NewRepositoryLock ¶
func NewRepositoryLock(repoPath string) *RepositoryLock
NewRepositoryLock creates a new repository lock for the given path
func (*RepositoryLock) IsLocked ¶
func (rl *RepositoryLock) IsLocked() bool
IsLocked returns true if the repository is currently locked
func (*RepositoryLock) Lock ¶
func (rl *RepositoryLock) Lock() error
Lock acquires exclusive access to the repository for Git operations This blocks until the lock is acquired or maxWaitTime is exceeded
func (*RepositoryLock) SetLogger ¶
func (rl *RepositoryLock) SetLogger(logger RepositoryLockLogger)
SetLogger sets the logger for repository lock operations
func (*RepositoryLock) SetMaxWaitTime ¶
func (rl *RepositoryLock) SetMaxWaitTime(duration time.Duration)
SetMaxWaitTime sets the maximum time to wait for a lock
func (*RepositoryLock) Unlock ¶
func (rl *RepositoryLock) Unlock() error
Unlock releases the repository lock
func (*RepositoryLock) WithLock ¶
func (rl *RepositoryLock) WithLock(fn func() error) error
WithLock executes a function while holding the repository lock This ensures that Git operations are serialized across all Hitch processes
type RepositoryLockLogger ¶
type RepositoryLockLogger interface {
LogLockAcquired(repoPath string, waitTime time.Duration)
LogLockReleased(repoPath string, holdTime time.Duration)
LogLockFailed(repoPath string, err error)
LogLockStale(repoPath string, lockAge time.Duration)
}
RepositoryLockLogger handles logging for repository lock operations
type RollbackInfo ¶
type RollbackInfo struct {
RollbackID string `json:"rollback_id"`
Reason string `json:"reason"`
ExecutedAt string `json:"executed_at"`
ExecutedBy string `json:"executed_by"`
BranchesRestored []string `json:"branches_restored"`
TagsDeleted []string `json:"tags_deleted"`
MetadataRestored map[string]string `json:"metadata_restored"`
Success bool `json:"success"`
Issues []ReleaseIssue `json:"issues"`
}
RollbackInfo contains information about a rollback operation
type RollbackItem ¶
type RollbackItem struct {
Type string `json:"type"` // "branch", "tag", "metadata", "file"
Name string `json:"name"`
PreviousState string `json:"previous_state"`
NewState string `json:"new_state"`
Success bool `json:"success"`
Error string `json:"error,omitempty"`
}
RollbackItem represents an item that was rolled back
type RollbackOptions ¶
type RollbackOptions struct {
ForceRollback bool `json:"force_rollback"`
CreateBackup bool `json:"create_backup"`
RollbackDependents bool `json:"rollback_dependents"`
CleanupArtifacts bool `json:"cleanup_artifacts"`
Reason string `json:"reason"`
ConfirmBeforeRollback bool `json:"confirm_before_rollback"`
Verbose bool `json:"verbose"`
DryRun bool `json:"dry_run"`
}
RollbackOptions contains options for release rollback
type RollbackResult ¶
type RollbackResult struct {
Success bool `json:"success"`
RolledBackItems []RollbackItem `json:"rolled_back_items"`
FailedItems []RollbackItem `json:"failed_items"`
Warnings []ValidationIssue `json:"warnings"`
Summary RollbackSummary `json:"summary"`
Duration string `json:"duration"`
Recommendations []string `json:"recommendations"`
}
RollbackResult contains the result of a rollback operation
type RollbackSummary ¶
type RollbackSummary struct {
TotalItems int `json:"total_items"`
SuccessItems int `json:"success_items"`
FailedItems int `json:"failed_items"`
SuccessRate float64 `json:"success_rate"`
OverallStatus string `json:"overall_status"`
}
RollbackSummary provides a summary of rollback operations
type TempBranchConfig ¶
type TempBranchConfig struct {
// Naming configuration
Prefix string // Default: "hitch"
OperationType string // e.g., "rebuild", "release"
TargetBranch string // e.g., "qa", "main"
UniqueSuffix string // Optional unique suffix
// Safety configuration
BackupBeforeDelete bool // Create backup before deleting temp branches
SafetyChecks bool // Enable comprehensive safety checks
ImportantBranches []string // Branches that should never be auto-deleted
// Cleanup configuration
AutoCleanup bool // Automatically cleanup after operation
CleanupDelay time.Duration // Delay before cleanup (for debugging)
RetainOnFailure bool // Keep temp branches if operation fails
// Logging configuration
Verbose bool // Show detailed temp branch operations
SilentMode bool // Suppress all temp branch output
}
TempBranchConfig holds configuration for temp branch operations
type TempBranchInfo ¶
type TempBranchInfo struct {
Name string // Full branch name
Prefix string // e.g., "hitch-rebuild"
OperationType string // e.g., "rebuild"
TargetBranch string // e.g., "qa", "main"
CreatedAt time.Time // When the branch was created
CreatedBy string // User who created it
BaseBranch string // Branch it was created from
IsActive bool // Whether this is the currently active temp branch
HasChanges bool // Whether the branch has uncommitted changes
}
TempBranchInfo holds information about a temporary branch
type TempBranchLogger ¶
type TempBranchLogger interface {
LogCreate(info *TempBranchInfo)
LogCleanup(branchName string)
LogError(operation string, branchName string, err error)
LogWarning(message string)
}
TempBranchLogger handles logging for temp branch operations
type TempBranchManager ¶
type TempBranchManager struct {
// contains filtered or unexported fields
}
TempBranchManager handles temporary branch operations for Hitch commands This provides a unified, safe way to manage temporary branches across all operations
func NewTempBranchManager ¶
func NewTempBranchManager(repo *hitchgit.Repo) *TempBranchManager
NewTempBranchManager creates a new temporary branch manager
func (*TempBranchManager) CleanupAllTempBranches ¶
func (m *TempBranchManager) CleanupAllTempBranches(config TempBranchConfig) (int, error)
CleanupAllTempBranches cleans up all temporary branches matching criteria
func (*TempBranchManager) CleanupTempBranch ¶
func (m *TempBranchManager) CleanupTempBranch(info *TempBranchInfo, config TempBranchConfig) error
CleanupTempBranch safely removes a temporary branch
func (*TempBranchManager) CreateTempBranch ¶
func (m *TempBranchManager) CreateTempBranch(config TempBranchConfig) (*TempBranchInfo, error)
CreateTempBranch creates a temporary branch with safety checks
func (*TempBranchManager) FindTempBranches ¶
func (m *TempBranchManager) FindTempBranches(config TempBranchConfig) ([]*TempBranchInfo, error)
FindTempBranches finds all temporary branches matching a pattern
func (*TempBranchManager) GenerateBranchName ¶
func (m *TempBranchManager) GenerateBranchName(config TempBranchConfig) string
func (*TempBranchManager) GenerateSearchPattern ¶
func (m *TempBranchManager) GenerateSearchPattern(config TempBranchConfig) string
func (*TempBranchManager) ParseBranchInfo ¶
func (m *TempBranchManager) ParseBranchInfo(branchName, currentBranch string) *TempBranchInfo
func (*TempBranchManager) ValidateTempBranch ¶
func (m *TempBranchManager) ValidateTempBranch(info *TempBranchInfo) error
ValidateTempBranch validates that a temporary branch is in a good state
type UserInfo ¶
type UserInfo struct {
Name string `json:"name"`
Email string `json:"email"`
IPAddress string `json:"ip_address,omitempty"`
}
UserInfo contains information about the user performing the operation
type ValidationIssue ¶
type ValidationIssue struct {
Type string `json:"type"` // "error", "warning", "info"
Severity string `json:"severity"` // "low", "medium", "high", "critical"
Category string `json:"category"` // "dependency", "conflict", "permission", "quality", "security"
Title string `json:"title"`
Description string `json:"description"`
File string `json:"file,omitempty"`
LineNumber int `json:"line_number,omitempty"`
Suggestion string `json:"suggestion,omitempty"`
CheckName string `json:"check_name"`
}
ValidationIssue represents a single validation issue
type ValidationOptions ¶
type ValidationOptions struct {
PreReleaseOnly bool `json:"pre_release_only"`
PostReleaseOnly bool `json:"post_release_only"`
SkipDependencyCheck bool `json:"skip_dependency_check"`
SkipConflictCheck bool `json:"skip_conflict_check"`
SkipPermissionCheck bool `json:"skip_permission_check"`
RequiredChecks []string `json:"required_checks"`
ForbiddenPatterns []string `json:"forbidden_patterns"`
MaxCommitCount int `json:"max_commit_count"`
MaxFileChanges int `json:"max_file_changes"`
RequireTestCoverage bool `json:"require_test_coverage"`
Verbose bool `json:"verbose"`
}
ValidationOptions contains options for release validation
type ValidationResult ¶
type ValidationResult struct {
IsValid bool `json:"is_valid"`
CanProceed bool `json:"can_proceed"`
Warnings []ValidationIssue `json:"warnings"`
Errors []ValidationIssue `json:"errors"`
CriticalIssues []ValidationIssue `json:"critical_issues"`
Summary ValidationSummary `json:"summary"`
Recommendations []string `json:"recommendations"`
EstimatedRisk string `json:"estimated_risk"` // "low", "medium", "high", "critical"
ValidationTime string `json:"validation_time"`
Duration string `json:"duration"`
}
ValidationResult contains the result of release validation
type ValidationSummary ¶
type ValidationSummary struct {
TotalChecks int `json:"total_checks"`
PassedChecks int `json:"passed_checks"`
FailedChecks int `json:"failed_checks"`
WarningChecks int `json:"warning_checks"`
SkippedChecks int `json:"skipped_checks"`
SuccessRate float64 `json:"success_rate"`
RiskScore float64 `json:"risk_score"`
OverallStatus string `json:"overall_status"` // "pass", "warning", "fail", "critical"
}
ValidationSummary provides a summary of validation results
Source Files
¶
- auto_rebase_engine.go
- branch_processor.go
- default_branch_processor.go
- dependency_analyzer.go
- error_recovery.go
- errors.go
- global_repository_lock.go
- interactive_prompts.go
- lock_manager.go
- logging.go
- recovery_persistence.go
- release_metadata_manager.go
- release_recovery_manager.go
- release_validation_manager.go
- repository_lock.go
- temp_branch_manager.go