config.go

 1package hooks
 2
 3// Config defines hook system configuration.
 4type Config struct {
 5	// Disabled controls whether hooks are executed.
 6	Disabled bool `json:"disabled,omitempty" jsonschema:"description=Disable hook execution,default=false"`
 7
 8	// TimeoutSeconds is the maximum time a hook can run.
 9	TimeoutSeconds int `json:"timeout_seconds,omitempty" jsonschema:"description=Maximum execution time for hooks in seconds,default=30,example=30"`
10
11	// Directories are additional directories to search for hooks.
12	// Defaults to [".crush/hooks"] if empty.
13	Directories []string `json:"directories,omitempty" jsonschema:"description=Directories to search for hook scripts,example=.crush/hooks"`
14
15	// Inline hooks defined directly in configuration.
16	// Map key is the hook type (e.g., "pre-tool-use").
17	Inline map[string][]InlineHook `json:"inline,omitempty" jsonschema:"description=Inline hook scripts defined in configuration"`
18
19	// DisableHooks is a list of hook paths to skip.
20	// Paths are relative to the hooks directory.
21	// Example: ["pre-tool-use/02-slow-check.sh"]
22	DisableHooks []string `json:"disable_hooks,omitempty" jsonschema:"description=List of hook paths to disable,example=pre-tool-use/02-slow-check.sh"`
23
24	// Environment variables to pass to hooks.
25	Environment map[string]string `json:"environment,omitempty" jsonschema:"description=Environment variables to pass to all hooks"`
26}
27
28// InlineHook is a hook defined inline in the config.
29type InlineHook struct {
30	// Name is the name of the hook (used as filename).
31	Name string `json:"name" jsonschema:"required,description=Name of the hook script,example=audit.sh"`
32
33	// Script is the bash script content.
34	Script string `json:"script" jsonschema:"required,description=Bash script content to execute"`
35}