hookinstall

package
v0.72.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AgentBoth   = "both"
	AgentClaude = "claude"
	AgentCodex  = "codex"

	DefaultTimeout = 10 * time.Second
)
View Source
const SessionStartScript = `` /* 6086-byte string literal not displayed */

Variables

This section is empty.

Functions

func DefaultClaudeConfig

func DefaultClaudeConfig() (string, error)

func DefaultCodexConfig

func DefaultCodexConfig() (string, error)

func DefaultScriptPath

func DefaultScriptPath() (string, error)

Types

type FileResult

type FileResult struct {
	Path    string `json:"path"`
	Changed bool   `json:"changed"`
	Backup  string `json:"backup,omitempty"`
}

type Options

type Options struct {
	Agent        string
	ScriptPath   string
	BinaryPath   string
	ClaudeConfig string
	CodexConfig  string
	Timeout      time.Duration
	DryRun       bool
}

func NormalizeOptions

func NormalizeOptions(opts Options) (Options, error)

type Result

type Result struct {
	Agent              string                 `json:"agent"`
	Script             FileResult             `json:"script"`
	Configs            map[string]FileResult  `json:"configs"`
	Commands           map[string]string      `json:"commands"`
	Snippets           map[string]interface{} `json:"snippets"`
	TimeoutSeconds     int                    `json:"timeout_seconds"`
	HookTimeoutSeconds int                    `json:"hook_timeout_seconds"`
	DryRun             bool                   `json:"dry_run"`
}

func Install

func Install(opts Options) (Result, error)

type StaleSessionStartHook added in v0.71.0

type StaleSessionStartHook struct {
	ConfigPath string `json:"config_path"`
	Agent      string `json:"agent"`
	ScriptPath string `json:"script_path"`
}

StaleSessionStartHook describes an AMQ-owned SessionStart hook command whose script path does not exist. It is used by amq doctor to flag dead hooks.

func StaleSessionStartHooks added in v0.71.0

func StaleSessionStartHooks(configPath, agent string) ([]StaleSessionStartHook, error)

StaleSessionStartHooks scans a Claude or Codex hook config file for AMQ-owned SessionStart hook commands whose script path does not exist. It does not modify the file. Returns one entry per stale hook. Uses classifyHook so it agrees with the install-time self-heal. Owned hooks that cannot be parsed are not reported (they are preserved, not stale).

Jump to

Keyboard shortcuts

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