Documentation
¶
Overview ¶
Package hooks defines jungi's first-party built-in hook catalog. Built-in hooks are disabled by default and must be opted into via [hooks.<name>] in settings.toml. This package mirrors internal/agents: All() returns the full catalog of Builtin descriptors and Enabled() filters it down to the hooks the user has activated, returning (event, Hook) pairs ready to be loaded into a hooksreg.Registry via Registry.Add.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builtin ¶
type Builtin struct {
// Name is the settings.toml key, e.g. "notify" or "github-pr".
Name string
// DefaultEvents lists every event this built-in can fire for. When the
// user does not restrict events via the events field, all DefaultEvents
// are active.
DefaultEvents []hooksreg.Event
// New builds the Hook instance configured with the user's HookEntry.
New func(entry settings.HookEntry) hooksreg.Hook
}
Builtin describes a code-defined built-in hook. Each built-in has a stable name that maps to a [hooks.<name>] key in settings.toml, a set of default lifecycle events it subscribes to, and a constructor that produces the hooksreg.Hook implementation.
type EnabledHook ¶
EnabledHook pairs a lifecycle event with the Hook that should be registered for it. Wire the result of Enabled into a registry via:
for _, eh := range hooks.Enabled(cfg, log) {
registry.Add(eh.Event, eh.Hook)
}
func Enabled ¶
func Enabled(cfg settings.HooksSettings, log *logger.Logger) []EnabledHook
Enabled filters All() to the hooks that are opted into via cfg, builds their Hook instances, and expands each to one EnabledHook per active event. Keys present in cfg that do not correspond to any known built-in are logged as warnings via log (nil-safe).
Source Files
¶
- hooks.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package githubpr implements the "github-pr" built-in hook.
|
Package githubpr implements the "github-pr" built-in hook. |
|
Package notify implements the "notify" built-in hook, which sends a desktop notification on each subscribed lifecycle event.
|
Package notify implements the "notify" built-in hook, which sends a desktop notification on each subscribed lifecycle event. |