hookruntime

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, adapter Adapter, processor Processor, mode Mode, stdin io.Reader, stdout, stderr io.Writer) error

Types

type Adapter

type Adapter interface {
	Decode(io.Reader) (Event, error)
	Encode(io.Writer, Result) error
	MalformedHookName() string
}

type AgentAdapter

type AgentAdapter struct {
	Agent     agent.Agent
	AgentName string
}

func (AgentAdapter) Decode

func (a AgentAdapter) Decode(r io.Reader) (Event, error)

func (AgentAdapter) Encode

func (a AgentAdapter) Encode(out io.Writer, result Result) error

func (AgentAdapter) MalformedHookName

func (a AgentAdapter) MalformedHookName() string

type Event

type Event struct {
	HookName  string
	CanBlock  bool
	RiskEvent risk.HookEvent
}

type Mode

type Mode string
const (
	ModeObserve Mode = "observe"
	ModeEnforce Mode = "enforce"
)

func ParseMode

func ParseMode(value string) (Mode, error)

type Processor

type Processor interface {
	Process(ctx context.Context, event risk.HookEvent) (server.ProcessResponse, error)
}

type Result

type Result struct {
	HookName string
	CanBlock bool
	Decision risk.Decision
	Reason   string
	Mode     Mode
}

Jump to

Keyboard shortcuts

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