Documentation
¶
Overview ¶
Package claudehooks installs and detects Stapler Squad's standalone Claude Code hooks in a global ~/.claude/settings.json file.
Two independent hooks are supported:
- Rules: a PreToolUse hook running "<ssq-hooks> check", which classifies each tool request against the local rules database (allow/deny).
- Notifications: Notification + Stop hooks running "<ssq-hook-handler> <event>", which produce audio chimes / attention alerts.
Unlike the per-session HTTP hooks in server/services/hook_injector.go (which are scoped to a stapler-squad-managed session via X-CS-Session-ID), these target the user's GLOBAL settings so they fire for any Claude Code session, including ones started from a plain terminal.
All mutations are idempotent and write atomically (temp file + rename).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultGlobalSettingsPath ¶
DefaultGlobalSettingsPath returns ~/.claude/settings.json.
func InstallNotifications ¶
InstallNotifications registers "<handlerPath> notification" and "<handlerPath> stop" as Notification and Stop hooks. Idempotent per event.
func InstallRules ¶
InstallRules registers "<binPath> check" as a PreToolUse hook. Idempotent: it is a no-op if a PreToolUse hook with the rules marker is already present.
func RulesHookCommand ¶
RulesHookCommand is the PreToolUse command for a given ssq-hooks binary path.
Types ¶
type Status ¶
type Status struct {
RulesInstalled bool `json:"rulesInstalled"`
NotificationsInstalled bool `json:"notificationsInstalled"`
}
Status reports which of our global hooks are currently installed.
func DetectStatus ¶
DetectStatus reads settingsPath and reports which hooks are present. A missing settings file is not an error — it reports both hooks as not installed.