Documentation
¶
Index ¶
- Constants
- Variables
- func AddStatsPostRunToCommand(cmd *cobra.Command)
- func CaptureClusteringConfig()
- func CaptureClusteringConfigFromSettings(defaultMethod string, enabledMethods []string, ...)
- func CompleteOperation(name string)
- func ConfirmAction(message string, defaultYes bool) bool
- func ConfirmActionWithDetails(action string, details []string, defaultYes bool) bool
- func ContainsString(s, substr string) bool
- func Debug(message string)
- func EnableStats()
- func Error(message string, fileContext ...string)
- func FailOperation(name string, reason string)
- func GenerateBinaryCommitMessage(filePath string, gitStatus string) string
- func GetBinaryFileType(filePath string) string
- func GetLastSystemInstruction() string
- func GetMemoryUsage() string
- func Info(message string)
- func IsBinaryFile(filePath string) bool
- func IsCreativeLoaderActive() bool
- func IsNumeric(s string) bool
- func IsQuietMode() bool
- func IsStatsEnabled() bool
- func ListFiles(directory string) ([]string, error)
- func MarkOperationComplete(name string)
- func NewDefaultGeminiRunner() interfaces.GeminiRunner
- func ParseFloat(s string) (float64, error)
- func ParseInt(s string) (int, error)
- func Print(data string)
- func PrintStats()
- func PromptForInput(message string, defaultValue string) string
- func PromptForSelection(message string, options []string, defaultIndex int) (string, int)
- func SafeExecute(operation string, fn func() error) (err error)
- func SanitizeUserInstructions(instructions string) string
- func SendToGemini(contextData map[string]map[string]string, apiKey string, ...) (string, error)
- func SetClusteringInfo(method string, enabledMethods []string, ...)
- func SetLogLevel(level string)
- func SetQuietMode(quiet bool)
- func SetTimeoutVar(retries, delay int)
- func ShowCompletionMessage(message string, success bool)
- func ShowProgressiveConfirmation(steps []string, actions []func() error) error
- func StartCreativeLoader(message string, animationType AnimationType)
- func StartOperation(name string)
- func StartPromptCoordinator(promptChan <-chan PromptRequest)
- func StopCreativeLoader()
- func Success(message string)
- func ToJSON(data interface{}) string
- func ToUserFriendlyMessage(err error) string
- func UpdateCreativeLoaderMessage(message string)
- func UpdateCreativeLoaderPhase(phase string)
- func UpdateOperationProgress(name string, progress float64)
- func UpdateProgress(name string, progress float64, status string)
- func Warning(message string)
- func WithRetry(ctx context.Context, operation string, config RetryConfig, fn func() error) error
- type AnimationType
- type ClusteringMethodInfo
- type CommandStats
- type CreativeLoader
- func (cl *CreativeLoader) SetHideInQuiet(hide bool) *CreativeLoader
- func (cl *CreativeLoader) SetPhase(phase string)
- func (cl *CreativeLoader) SetWriter(writer io.Writer) *CreativeLoader
- func (cl *CreativeLoader) Start()
- func (cl *CreativeLoader) Stop()
- func (cl *CreativeLoader) UpdateMessage(message string)
- type DefaultGeminiRunner
- type ErrorType
- type ProgressInfo
- type ProgressReporter
- func (p *ProgressReporter) Done()
- func (p *ProgressReporter) Increment(amount int64)
- func (p *ProgressReporter) SetHideInQuiet(hide bool) *ProgressReporter
- func (p *ProgressReporter) SetWidth(width int) *ProgressReporter
- func (p *ProgressReporter) SetWriter(writer io.Writer) *ProgressReporter
- func (p *ProgressReporter) Start() *ProgressReporter
- func (p *ProgressReporter) Update(current int64)
- func (p *ProgressReporter) UpdateMessage(message string)
- type PromptRequest
- type ResourceManager
- func (rm *ResourceManager) GetRecommendedWorkerCount(defaultWorkers int) int
- func (rm *ResourceManager) GetResourceUsage() map[string]interface{}
- func (rm *ResourceManager) IsRunning() bool
- func (rm *ResourceManager) SetCheckInterval(interval time.Duration)
- func (rm *ResourceManager) SetMaxCPUPercent(percent float64)
- func (rm *ResourceManager) SetMaxMemoryPercent(percent float64)
- func (rm *ResourceManager) Start()
- func (rm *ResourceManager) Stop()
- type RetryConfig
- type StructuredError
- func NewAPIError(message string, cause error, context map[string]interface{}, ...) *StructuredError
- func NewConfigError(message string, cause error, context map[string]interface{}, ...) *StructuredError
- func NewGitError(message string, cause error, context map[string]interface{}, ...) *StructuredError
- func NewSystemError(message string, cause error, context map[string]interface{}, ...) *StructuredError
- func NewUserError(message string, cause error, context map[string]interface{}) *StructuredError
- func NewValidationError(message string, cause error, context map[string]interface{}, ...) *StructuredError
- type WorkerPool
Constants ¶
const ( Reset = "\033[0m" Red = "\033[38;5;196m" // Bright red Green = "\033[38;5;46m" // Neon green Yellow = "\033[38;5;226m" // Warning yellow Blue = "\033[38;5;33m" // Electric blue Magenta = "\033[38;5;201m" // Cyber pink Cyan = "\033[38;5;51m" // Holographic cyan Black = "\033[38;5;236m" // Dark background Bold = "\033[1m" Underline = "\033[4m" Blink = "\033[5m" // Use sparingly! Dim = "\033[2m" BlackBg = "\033[48;5;235m" // Dark background )
ANSI color codes - Dark Tech palette
Variables ¶
var BinaryFileExtensions = map[string]bool{ ".jpg": true, ".jpeg": true, ".png": true, ".gif": true, ".bmp": true, ".tiff": true, ".svg": true, ".webp": true, ".ico": true, ".mp4": true, ".avi": true, ".mov": true, ".wmv": true, ".flv": true, ".webm": true, ".mkv": true, ".m4v": true, ".mp3": true, ".wav": true, ".flac": true, ".aac": true, ".ogg": true, ".wma": true, ".m4a": true, ".zip": true, ".rar": true, ".7z": true, ".tar": true, ".gz": true, ".bz2": true, ".xz": true, ".exe": true, ".dll": true, ".so": true, ".dylib": true, ".app": true, ".deb": true, ".rpm": true, ".pdf": true, ".doc": true, ".docx": true, ".xls": true, ".xlsx": true, ".ppt": true, ".pptx": true, ".ttf": true, ".otf": true, ".woff": true, ".woff2": true, ".eot": true, ".db": true, ".sqlite": true, ".sqlite3": true, ".bin": true, ".dat": true, ".dump": true, ".img": true, ".iso": true, ".dmg": true, }
BinaryFileExtensions contains common binary file extensions
var LogLevel string = "info"
Functions ¶
func AddStatsPostRunToCommand ¶
AddStatsPostRunToCommand adds a PostRun function to display stats for a command
func CaptureClusteringConfig ¶
func CaptureClusteringConfig()
CaptureClusteringConfig captures clustering configuration from the config package This function should be called when clustering operations begin
func CaptureClusteringConfigFromSettings ¶
func CaptureClusteringConfigFromSettings( defaultMethod string, enabledMethods []string, confidenceThresholds map[string]float64, similarityThresholds map[string]float64, maxFilesForSemantic int, enableFallbackMethods bool, performanceMode string, maxProcessingTime int, enableBenchmarking bool, adaptiveOptimization bool, )
CaptureClusteringConfigFromSettings captures clustering configuration info from provided parameters
func CompleteOperation ¶
func CompleteOperation(name string)
CompleteOperation marks an operation as completed
func ConfirmAction ¶
ConfirmAction asks the user to confirm an action with yes/no prompt
func ConfirmActionWithDetails ¶
ConfirmActionWithDetails asks for confirmation and shows detailed information
func ContainsString ¶
ContainsString checks if a string contains a substring
func FailOperation ¶
FailOperation marks an operation as failed
func GenerateBinaryCommitMessage ¶
GenerateBinaryCommitMessage creates appropriate commit messages for binary files
func GetBinaryFileType ¶
GetBinaryFileType returns a descriptive type for binary files
func GetLastSystemInstruction ¶
func GetLastSystemInstruction() string
GetLastSystemInstruction returns the last system instruction used (for testing)
func GetMemoryUsage ¶
func GetMemoryUsage() string
GetMemoryUsage returns current memory usage as a formatted string
func IsBinaryFile ¶
IsBinaryFile checks if a file is likely binary based on its extension
func IsCreativeLoaderActive ¶
func IsCreativeLoaderActive() bool
IsCreativeLoaderActive returns whether the global loader is active
func IsStatsEnabled ¶
func IsStatsEnabled() bool
IsStatsEnabled returns whether stats tracking is currently enabled
func MarkOperationComplete ¶
func MarkOperationComplete(name string)
MarkOperationComplete is a helper function to mark an operation as complete with proper progress handling
func NewDefaultGeminiRunner ¶
func NewDefaultGeminiRunner() interfaces.GeminiRunner
NewDefaultGeminiRunner creates a new instance of DefaultGeminiRunner
func ParseFloat ¶
func PromptForInput ¶
PromptForInput asks the user for text input with an optional default value
func PromptForSelection ¶
PromptForSelection asks the user to select from a list of options
func SafeExecute ¶
SafeExecute runs a function with panic recovery
func SanitizeUserInstructions ¶
SanitizeUserInstructions cleans potentially harmful or manipulative instructions
func SendToGemini ¶
func SetClusteringInfo ¶
func SetClusteringInfo(method string, enabledMethods []string, confidenceThresholds, similarityThresholds map[string]float64, maxFilesForSemantic int, enableFallbackMethods bool, performanceMode string, maxProcessingTime int, enableBenchmarking, adaptiveOptimization bool)
SetClusteringInfo stores clustering configuration information for stats display
func SetLogLevel ¶
func SetLogLevel(level string)
func SetTimeoutVar ¶
func SetTimeoutVar(retries, delay int)
func ShowCompletionMessage ¶
ShowCompletionMessage displays a completion message with appropriate styling
func ShowProgressiveConfirmation ¶
ShowProgressiveConfirmation shows a multi-step confirmation dialog where each step depends on the previous one
func StartCreativeLoader ¶
func StartCreativeLoader(message string, animationType AnimationType)
StartCreativeLoader starts a global creative loader
func StartOperation ¶
func StartOperation(name string)
StartOperation tracks the start of an operation
func StartPromptCoordinator ¶ added in v1.5.0
func StartPromptCoordinator(promptChan <-chan PromptRequest)
func StopCreativeLoader ¶
func StopCreativeLoader()
StopCreativeLoader stops the global creative loader
func ToUserFriendlyMessage ¶
ToUserFriendlyMessage converts an error to a user-friendly message with possible solution
func UpdateCreativeLoaderMessage ¶
func UpdateCreativeLoaderMessage(message string)
UpdateCreativeLoaderMessage updates the global loader message
func UpdateCreativeLoaderPhase ¶
func UpdateCreativeLoaderPhase(phase string)
UpdateCreativeLoaderPhase updates the global loader phase
func UpdateOperationProgress ¶
UpdateOperationProgress is a helper function to update operation progress and ensure consistent progress tracking in the stats system
func UpdateProgress ¶
UpdateProgress updates the progress of an operation
Types ¶
type AnimationType ¶
type AnimationType int
AnimationType defines the type of animation to use
const ( SpinnerAnimation AnimationType = iota DotsAnimation BarAnimation BrailleAnimation GitAnimation ProcessingAnimation )
type ClusteringMethodInfo ¶
type ClusteringMethodInfo struct { Method string `json:"method"` EnabledMethods []string `json:"enabledMethods"` ConfidenceThresholds map[string]float64 `json:"confidenceThresholds"` SimilarityThresholds map[string]float64 `json:"similarityThresholds"` MaxFilesForSemantic int `json:"maxFilesForSemantic"` EnableFallbackMethods bool `json:"enableFallbackMethods"` PerformanceMode string `json:"performanceMode"` MaxProcessingTime int `json:"maxProcessingTime"` EnableBenchmarking bool `json:"enableBenchmarking"` AdaptiveOptimization bool `json:"adaptiveOptimization"` }
func GetClusteringInfo ¶
func GetClusteringInfo() *ClusteringMethodInfo
GetClusteringInfo returns the stored clustering configuration
type CommandStats ¶
type CreativeLoader ¶
type CreativeLoader struct {
// contains filtered or unexported fields
}
CreativeLoader provides a more engaging progress display with various animations
func NewCreativeLoader ¶
func NewCreativeLoader(message string, animationType AnimationType) *CreativeLoader
NewCreativeLoader creates a new creative loader
func (*CreativeLoader) SetHideInQuiet ¶
func (cl *CreativeLoader) SetHideInQuiet(hide bool) *CreativeLoader
SetHideInQuiet sets whether to hide in quiet mode
func (*CreativeLoader) SetPhase ¶
func (cl *CreativeLoader) SetPhase(phase string)
SetPhase updates the current phase for dynamic messages
func (*CreativeLoader) SetWriter ¶
func (cl *CreativeLoader) SetWriter(writer io.Writer) *CreativeLoader
SetWriter sets the output writer
func (*CreativeLoader) Start ¶
func (cl *CreativeLoader) Start()
Start begins the creative loader animation
func (*CreativeLoader) Stop ¶
func (cl *CreativeLoader) Stop()
Stop stops the creative loader animation
func (*CreativeLoader) UpdateMessage ¶
func (cl *CreativeLoader) UpdateMessage(message string)
UpdateMessage updates the loader message
type DefaultGeminiRunner ¶
type DefaultGeminiRunner struct{}
DefaultGeminiRunner implements the GeminiRunner interface using the real Gemini API
func (*DefaultGeminiRunner) SendToGemini ¶
func (r *DefaultGeminiRunner) SendToGemini(contextData map[string]map[string]string, apiKey string, customInstructions ...string) (string, error)
SendToGemini delegates to the real SendToGemini function
type ProgressInfo ¶
type ProgressReporter ¶
type ProgressReporter struct {
// contains filtered or unexported fields
}
ProgressReporter provides an interface for reporting progress of long-running operations
func NewIndeterminateProgressReporter ¶
func NewIndeterminateProgressReporter(message string) *ProgressReporter
NewIndeterminateProgressReporter creates a progress reporter for operations where the total amount of work is unknown
func NewProgressReporter ¶
func NewProgressReporter(total int64, message string) *ProgressReporter
NewProgressReporter creates a new progress reporter
func (*ProgressReporter) Done ¶
func (p *ProgressReporter) Done()
Done completes the progress reporting
func (*ProgressReporter) Increment ¶
func (p *ProgressReporter) Increment(amount int64)
Increment increases the current progress by the specified amount
func (*ProgressReporter) SetHideInQuiet ¶
func (p *ProgressReporter) SetHideInQuiet(hide bool) *ProgressReporter
SetHideInQuiet sets whether the progress bar should be hidden in quiet mode
func (*ProgressReporter) SetWidth ¶
func (p *ProgressReporter) SetWidth(width int) *ProgressReporter
SetWidth sets the width of the progress bar
func (*ProgressReporter) SetWriter ¶
func (p *ProgressReporter) SetWriter(writer io.Writer) *ProgressReporter
SetWriter sets the io.Writer where progress updates are written
func (*ProgressReporter) Start ¶
func (p *ProgressReporter) Start() *ProgressReporter
Start begins the progress reporting
func (*ProgressReporter) Update ¶
func (p *ProgressReporter) Update(current int64)
Update updates the current progress
func (*ProgressReporter) UpdateMessage ¶
func (p *ProgressReporter) UpdateMessage(message string)
UpdateMessage updates the message displayed with the progress bar
type PromptRequest ¶ added in v1.5.0
type ResourceManager ¶
type ResourceManager struct {
// contains filtered or unexported fields
}
ResourceManager monitors and manages system resources for the application
func GetResourceManager ¶
func GetResourceManager() *ResourceManager
GetResourceManager returns the default resource manager instance
func NewResourceManager ¶
func NewResourceManager() *ResourceManager
NewResourceManager creates a resource manager with default settings
func (*ResourceManager) GetRecommendedWorkerCount ¶
func (rm *ResourceManager) GetRecommendedWorkerCount(defaultWorkers int) int
GetRecommendedWorkerCount returns the recommended number of worker goroutines based on current system load and available CPU cores
func (*ResourceManager) GetResourceUsage ¶
func (rm *ResourceManager) GetResourceUsage() map[string]interface{}
GetResourceUsage returns the current resource usage metrics
func (*ResourceManager) IsRunning ¶
func (rm *ResourceManager) IsRunning() bool
IsRunning returns whether resource monitoring is active
func (*ResourceManager) SetCheckInterval ¶
func (rm *ResourceManager) SetCheckInterval(interval time.Duration)
SetCheckInterval sets how often resources are checked
func (*ResourceManager) SetMaxCPUPercent ¶
func (rm *ResourceManager) SetMaxCPUPercent(percent float64)
SetMaxCPUPercent sets the maximum allowed CPU usage as a percentage
func (*ResourceManager) SetMaxMemoryPercent ¶
func (rm *ResourceManager) SetMaxMemoryPercent(percent float64)
SetMaxMemoryPercent sets the maximum allowed memory usage as a percentage
func (*ResourceManager) Start ¶
func (rm *ResourceManager) Start()
Start begins monitoring system resources
type RetryConfig ¶
type RetryConfig struct { MaxRetries int InitialDelay time.Duration MaxDelay time.Duration Factor float64 // Exponential backoff factor }
RetryConfig holds the configuration for retry operations
func DefaultRetryConfig ¶
func DefaultRetryConfig() RetryConfig
DefaultRetryConfig returns the default retry configuration
type StructuredError ¶
type StructuredError struct { Type ErrorType Message string Cause error Context map[string]interface{} ProcessedFile string }
StructuredError represents an error with additional context
func NewAPIError ¶
func NewAPIError(message string, cause error, context map[string]interface{}, processedFile ...string) *StructuredError
NewAPIError creates a new API-related error
func NewConfigError ¶
func NewConfigError(message string, cause error, context map[string]interface{}, processedFile ...string) *StructuredError
NewConfigError creates a new configuration error
func NewGitError ¶
func NewGitError(message string, cause error, context map[string]interface{}, processedFile ...string) *StructuredError
NewGitError creates a new Git-related error
func NewSystemError ¶
func NewSystemError(message string, cause error, context map[string]interface{}, processedFile ...string) *StructuredError
NewSystemError creates a new system-related error
func NewUserError ¶
func NewUserError(message string, cause error, context map[string]interface{}) *StructuredError
NewUserError creates a new user-related error
func NewValidationError ¶
func NewValidationError(message string, cause error, context map[string]interface{}, processedFile ...string) *StructuredError
NewValidationError creates a new validation error
func (*StructuredError) Error ¶
func (e *StructuredError) Error() string
Error implements the error interface
func (*StructuredError) Unwrap ¶
func (e *StructuredError) Unwrap() error
Unwrap implements the errors.Unwrap interface
type WorkerPool ¶
type WorkerPool struct {
// contains filtered or unexported fields
}
WorkerPool implements a reusable worker pool with configurable concurrency limit
func NewWorkerPool ¶
func NewWorkerPool(maxWorkers int) *WorkerPool
NewWorkerPool creates a new worker pool with the specified maximum concurrent workers
func (*WorkerPool) Errors ¶
func (wp *WorkerPool) Errors() []error
Errors returns all errors collected from task execution
func (*WorkerPool) HasErrors ¶
func (wp *WorkerPool) HasErrors() bool
HasErrors returns true if any tasks have reported errors
func (*WorkerPool) Submit ¶
func (wp *WorkerPool) Submit(taskName string, timeout time.Duration, task func() error)
Submit adds a task to the worker pool with the specified timeout
func (*WorkerPool) Wait ¶
func (wp *WorkerPool) Wait() []error
Wait blocks until all tasks have completed