Documentation
¶
Overview ¶
Package selectors provides selector parsing and matching for rule/skill frontmatter.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidSelectorFormat = errors.New("invalid selector format")
ErrInvalidSelectorFormat is returned when a selector string is not in key=value format.
Functions ¶
This section is empty.
Types ¶
type Selectors ¶
Selectors stores selector key-value pairs where values are stored in inner maps Multiple values for the same key use OR logic (match any value in the inner map) Each value can be represented exactly once per key.
func (*Selectors) GetValue ¶
GetValue returns true if the given value exists in the inner map for the given key. Returns false if the key doesn't exist or the value is not present.
func (*Selectors) MatchesIncludes ¶
func (s *Selectors) MatchesIncludes(frontmatter markdown.BaseFrontMatter, includeByDefault bool) (bool, string)
MatchesIncludes returns whether the frontmatter matches all include selectors, along with a human-readable reason explaining the result. If a key doesn't exist in frontmatter, it's allowed when includeByDefault is true (the default). When includeByDefault is false, rules/skills that produce no explicit selector match are excluded. Multiple values for the same key use OR logic (matches if frontmatter value is in the inner map). This enables combining CLI selectors (-s flag) with task frontmatter selectors: both are added to the same Selectors map, creating an OR condition for rules to match.
Returns:
- bool: true if all selectors match, false otherwise
- string: reason explaining why (matched selectors or mismatch details)