hook

package
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package hook provides hook system for hawk-eco. Hooks allow custom commands to run at specific lifecycle points.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dispatcher

type Dispatcher struct {
	// contains filtered or unexported fields
}

Dispatcher manages hooks and dispatches them.

func NewDispatcher

func NewDispatcher() *Dispatcher

NewDispatcher creates a new hook dispatcher.

func (*Dispatcher) DispatchAfterReview

func (d *Dispatcher) DispatchAfterReview(result string) error

DispatchAfterReview runs hooks after a review.

func (*Dispatcher) DispatchBeforeReview

func (d *Dispatcher) DispatchBeforeReview(context string) error

DispatchBeforeReview runs hooks before a review.

func (*Dispatcher) List

func (d *Dispatcher) List() map[HookType][]*Hook

List returns all registered hooks.

func (*Dispatcher) LoadHooksFromDir

func (d *Dispatcher) LoadHooksFromDir(dir string) error

LoadHooksFromDir loads hooks from a directory.

func (*Dispatcher) Register

func (d *Dispatcher) Register(hookType HookType, hook *Hook)

Register adds a hook for a specific type.

func (*Dispatcher) RegisterBuiltin

func (d *Dispatcher) RegisterBuiltin()

RegisterBuiltin registers default hooks.

type Hook

type Hook struct {
	Name    string
	Command string
	Args    []string
}

Hook represents a lifecycle hook.

type HookType

type HookType string

HookType represents the type of hook.

const (
	HookBeforeReview HookType = "beforeReview"
	HookAfterReview  HookType = "afterReview"
	HookSessionStart HookType = "sessionStart"
	HookSessionEnd   HookType = "sessionEnd"
)

func HookTypeFromString

func HookTypeFromString(s string) HookType

HookTypeFromString converts a string to HookType.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL