Documentation
¶
Overview ¶
Package handlers provides execution of handlers on a single pack. It encapsulates the flow: match files → filter handlers → create operations → execute.
Index ¶
- func CreateHandler(name string, options map[string]interface{}) (interface{}, error)
- func ExecuteMatches(matches []rules.RuleMatch, dataStore datastore.DataStore, ...) (*context.ExecutionContext, error)
- func FilterMatchesByHandlerCategory(matches []rules.RuleMatch, allowConfiguration, allowCodeExecution bool) []rules.RuleMatch
- func GetAllHandlerPatterns(pack types.Pack) (map[string][]string, error)
- func GetHandlerExecutionOrder(handlerNames []string) []string
- func GetHandlersNeedingFiles(pack types.Pack, optionalFS ...types.FS) ([]string, error)
- func GetMatches(packs []types.Pack) ([]rules.RuleMatch, error)
- func GetMatchesFS(packs []types.Pack, fs types.FS) ([]rules.RuleMatch, error)
- func GetPatternsForHandler(handlerName string, pack types.Pack) ([]string, error)
- func GroupMatchesByHandler(matches []rules.RuleMatch) map[string][]rules.RuleMatch
- func SuggestFilenameForHandler(handlerName string, patterns []string) string
- type ExecutionOptions
- type FilterType
- type HandlerExecution
- type Options
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateHandler ¶
CreateHandler creates a handler instance by name This replaces the registry-based handler creation
func ExecuteMatches ¶
func ExecuteMatches(matches []rules.RuleMatch, dataStore datastore.DataStore, opts ExecutionOptions) (*context.ExecutionContext, error)
ExecuteMatches executes rule matches using handlers and the DataStore abstraction. This is the core execution function that replaces the internal pipeline approach.
func FilterMatchesByHandlerCategory ¶
func FilterMatchesByHandlerCategory(matches []rules.RuleMatch, allowConfiguration, allowCodeExecution bool) []rules.RuleMatch
FilterMatchesByHandlerCategory filters rule matches based on handler category
func GetAllHandlerPatterns ¶
GetAllHandlerPatterns returns patterns for all available handlers in a pack Returns a map of handler name to list of patterns
func GetHandlerExecutionOrder ¶
GetHandlerExecutionOrder returns handlers in the order they should be executed Code execution handlers run before configuration handlers
func GetHandlersNeedingFiles ¶
GetHandlersNeedingFiles returns handlers that have no matching files in the pack It uses the existing matching system to determine which handlers are already active Optionally accepts a filesystem parameter for testing
func GetMatches ¶
GetMatches scans packs and returns all rule matches using the rule system
func GetMatchesFS ¶
GetMatchesFS scans packs and returns all rule matches using the rule system with a custom filesystem This function is used for testing and commands that need to use a different filesystem
func GetPatternsForHandler ¶
GetPatternsForHandler returns all patterns that would activate a specific handler This includes patterns from both global and pack-specific rules
func GroupMatchesByHandler ¶
GroupMatchesByHandler groups rule matches by their handler name
func SuggestFilenameForHandler ¶
SuggestFilenameForHandler suggests a filename that would match the handler's patterns For glob patterns, it returns a reasonable example filename
Types ¶
type ExecutionOptions ¶
ExecutionOptions contains options for executing rule matches
type FilterType ¶
type FilterType int
FilterType determines which handlers to execute
const ( // ConfigOnly executes only configuration handlers (symlink, shell, path) ConfigOnly FilterType = iota // ProvisionOnly executes only code execution handlers (homebrew, install) ProvisionOnly // All executes all handlers All )
type HandlerExecution ¶
HandlerExecution represents the result of executing a single handler
type Result ¶
type Result struct {
Pack types.Pack
TotalHandlers int
SuccessCount int
FailureCount int
SkippedCount int
ExecutedHandlers []HandlerExecution
}
Result contains the execution results for a single pack
func ExecuteHandlersForPack ¶
ExecuteHandlersForPack executes the handler pipeline for a single pack. This is the minimal starting point that orchestrates existing code.