external

package
v0.11.7 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	PreToolUse       []Rule `json:"preToolUse,omitempty"`
	PostToolUse      []Rule `json:"postToolUse,omitempty"`
	UserPromptSubmit []Rule `json:"userPromptSubmit,omitempty"`
	SessionStart     []Rule `json:"sessionStart,omitempty"`
	SessionEnd       []Rule `json:"sessionEnd,omitempty"`
	SubagentStop     []Rule `json:"subagentStop,omitempty"`
	PreCompact       []Rule `json:"preCompact,omitempty"`
}

func Load

func Load(paths ...string) (*Config, error)

func (*Config) CompactHooks added in v0.11.2

func (c *Config) CompactHooks(workDir string, gate *Gate) []hook.PreCompact

func (*Config) EndHooks added in v0.11.2

func (c *Config) EndHooks(workDir string, gate *Gate) []hook.SessionEnd

func (*Config) PostHooks

func (c *Config) PostHooks(workDir string, gate *Gate) []hook.PostToolUse

func (*Config) PreHooks

func (c *Config) PreHooks(workDir string, gate *Gate) []hook.PreToolUse

func (*Config) PromptHooks added in v0.11.2

func (c *Config) PromptHooks(workDir string, gate *Gate) []hook.UserPromptSubmit

func (*Config) RuleCount added in v0.11.2

func (c *Config) RuleCount() int

RuleCount reports how many hook rules the config carries, used for the workspace trust prompt.

func (*Config) StartHooks added in v0.11.2

func (c *Config) StartHooks(workDir string, gate *Gate) []hook.SessionStart

func (*Config) SubagentHooks added in v0.11.2

func (c *Config) SubagentHooks(workDir string, gate *Gate) []hook.SubagentStop

type Gate

type Gate struct {
	Confirm func(ctx context.Context, message string) (bool, error)
	Message string
	// contains filtered or unexported fields
}

Gate defers a yes/no decision (e.g. "trust this workspace's hooks?") until the first hook actually fires, then remembers it for the session.

func (*Gate) Allowed

func (g *Gate) Allowed(ctx context.Context) bool

type Rule

type Rule struct {
	Matcher string `json:"matcher,omitempty"`
	Command string `json:"command,omitempty"`
	URL     string `json:"url,omitempty"`
	Timeout int    `json:"timeout,omitempty"`
	Once    bool   `json:"once,omitempty"`
}

Jump to

Keyboard shortcuts

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