Documentation
¶
Overview ¶
Package hookconfig owns the install/uninstall/check logic for Confab hooks in Claude Code's settings.json and Codex's config.toml. Provider methods delegate here so pkg/provider doesn't carry the configuration-file detail.
Index ¶
- func InstallCodexHooks(configPath string) (string, error)
- func InstallPostToolUseHooks() error
- func InstallPreToolUseHooks() error
- func InstallSyncHooks() error
- func InstallUserPromptSubmitHook() error
- func IsCodexHooksInstalled(configPath string) (bool, error)
- func IsPostToolUseHooksInstalled() (bool, error)
- func IsPreToolUseHooksInstalled() (bool, error)
- func IsSyncHooksInstalled() (bool, error)
- func IsUserPromptSubmitHookInstalled() (bool, error)
- func UninstallCodexHooks(configPath string) (string, error)
- func UninstallPostToolUseHooks() error
- func UninstallPreToolUseHooks() error
- func UninstallSyncHooks() error
- func UninstallUserPromptSubmitHook() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InstallCodexHooks ¶
InstallCodexHooks writes the managed Confab hook block into Codex's config.toml at configPath, preserving user content and creating a backup. Returns the configPath that was written.
func InstallPostToolUseHooks ¶
func InstallPostToolUseHooks() error
InstallPostToolUseHooks installs the PostToolUse hook for GitHub link tracking.
func InstallPreToolUseHooks ¶
func InstallPreToolUseHooks() error
InstallPreToolUseHooks installs the PreToolUse hook for git commit validation. Installs with a "Bash" matcher to intercept git commits.
func InstallSyncHooks ¶
func InstallSyncHooks() error
InstallSyncHooks installs SessionStart + SessionEnd hooks for the incremental sync daemon.
func InstallUserPromptSubmitHook ¶
func InstallUserPromptSubmitHook() error
InstallUserPromptSubmitHook installs the UserPromptSubmit hook. Unlike other hooks, UserPromptSubmit doesn't use matchers.
func IsCodexHooksInstalled ¶
IsCodexHooksInstalled parses configPath and returns true only when all three Confab hook events (SessionStart, PreToolUse, PostToolUse) carry a confab command. Existing SessionStart-only installs (pre-CF-492) read as "not installed" so `confab setup` re-emits the managed block and transparently upgrades them.
func IsPostToolUseHooksInstalled ¶
IsPostToolUseHooksInstalled checks if the PostToolUse hook is installed.
func IsPreToolUseHooksInstalled ¶
IsPreToolUseHooksInstalled checks if the PreToolUse hook is installed.
func IsSyncHooksInstalled ¶
IsSyncHooksInstalled checks whether sync daemon hooks are installed. Recognizes both old ("sync start/stop") and new ("hook session-start/end").
func IsUserPromptSubmitHookInstalled ¶
IsUserPromptSubmitHookInstalled checks if the UserPromptSubmit hook is installed.
func UninstallCodexHooks ¶
UninstallCodexHooks removes the managed Confab hook block from Codex's config.toml, preserving the rest of the file. Returns the configPath even if no block was present.
func UninstallPostToolUseHooks ¶
func UninstallPostToolUseHooks() error
UninstallPostToolUseHooks removes the PostToolUse hook.
func UninstallPreToolUseHooks ¶
func UninstallPreToolUseHooks() error
UninstallPreToolUseHooks removes the PreToolUse hook.
func UninstallSyncHooks ¶
func UninstallSyncHooks() error
UninstallSyncHooks removes the sync daemon hooks. Handles both old ("sync start/stop") and new ("hook session-start/end") patterns.
func UninstallUserPromptSubmitHook ¶
func UninstallUserPromptSubmitHook() error
UninstallUserPromptSubmitHook removes the UserPromptSubmit hook.
Types ¶
This section is empty.