Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BuildOptions ¶ added in v0.12.9
BuildOptions supplies source-specific trust and environment settings.
type Config ¶
type Config struct {
Description string `json:"description,omitempty"`
Hooks Events `json:"hooks"`
}
Config is the Codex hooks.json shape. HTTP is a Wingman extension whose request and successful response bodies use the same wire schema as command hooks.
func Parse ¶ added in v0.12.9
Parse reads one named hooks.json document. The name is used only in errors, which also makes this suitable for inline plugin hook declarations.
func (*Config) Build ¶ added in v0.12.9
Build compiles all matching handlers for each event into one native hook so handlers within a Codex event can execute concurrently and aggregate their decisions before the agent continues.
func (*Config) BuildWithOptions ¶ added in v0.12.9
func (c *Config) BuildWithOptions(workDir string, options BuildOptions) hook.Hooks
BuildWithOptions compiles hooks and injects source-specific environment variables into command handlers. HTTP handlers intentionally do not inherit these values into headers unless the process environment explicitly exposes them through allowedEnvVars.
type Events ¶ added in v0.12.9
type Events struct {
PreToolUse []MatcherGroup `json:"PreToolUse,omitempty"`
PermissionRequest []MatcherGroup `json:"PermissionRequest,omitempty"`
PostToolUse []MatcherGroup `json:"PostToolUse,omitempty"`
PreCompact []MatcherGroup `json:"PreCompact,omitempty"`
PostCompact []MatcherGroup `json:"PostCompact,omitempty"`
SessionStart []MatcherGroup `json:"SessionStart,omitempty"`
SessionEnd []MatcherGroup `json:"SessionEnd,omitempty"`
UserPromptSubmit []MatcherGroup `json:"UserPromptSubmit,omitempty"`
SubagentStart []MatcherGroup `json:"SubagentStart,omitempty"`
SubagentStop []MatcherGroup `json:"SubagentStop,omitempty"`
Stop []MatcherGroup `json:"Stop,omitempty"`
}
type Gate ¶
type Gate struct {
Confirm func(ctx context.Context, message string) (bool, error)
Message string
// contains filtered or unexported fields
}
Gate defers a workspace trust decision until the first matching hook fires.
type Handler ¶ added in v0.12.9
type Handler struct {
Type string `json:"type"`
Command string `json:"command,omitempty"`
CommandWindows string `json:"commandWindows,omitempty"`
CommandWindowsSnake string `json:"command_windows,omitempty"`
Server string `json:"server,omitempty"`
Tool string `json:"tool,omitempty"`
Input map[string]any `json:"input,omitempty"`
Prompt string `json:"prompt,omitempty"`
Model string `json:"model,omitempty"`
URL string `json:"url,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
AllowedEnvVars []string `json:"allowedEnvVars,omitempty"`
Timeout *int `json:"timeout,omitempty"`
Async bool `json:"async,omitempty"`
StatusMessage string `json:"statusMessage,omitempty"`
AdditionalContextLimit *int `json:"additionalContextLimit,omitempty"`
}