Documentation
¶
Overview ¶
Package classify applies an ordered list of rules to a parsed stack and returns the set of matching categories. It is pure: it does not know whether a rule originated from a preset or a custom config block.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Category ¶ added in v0.5.0
Category is one matched rule's outcome: its name, icon, and — for the rule's EmitAttributes — the sorted-unique non-null values across the changes it matched. Attributes is nil when nothing was emitted.
func Classify ¶
Classify returns a Category for every rule that matches enough changes, in rule order. The slice is empty when no rule fires — the caller supplies the display fallback. Rules are independent; there is no first-match-wins.
type Rule ¶
type Rule struct {
Name string
Icon string
TypePattern *regexp.Regexp // nil → match any resource type
Actions []string // nil/empty → match any action; else all listed must be present
MinCount int // minimum matching changes for the rule to fire (treated as 1 if <1)
EmitAttributes []string // attribute names to extract from matched changes
}
Rule is a single classification rule with a deliberately small matcher.