Documentation
¶
Overview ¶
Package hooks installs Claude Code hooks and records hook telemetry.
Index ¶
- type InstallOptions
- type ProfileSource
- type RecordOptions
- type RecordResult
- type Result
- type Service
- func (s *Service) Install(ctx context.Context, opts InstallOptions) ([]Result, error)
- func (s *Service) Record(ctx context.Context, opts RecordOptions) (RecordResult, error)
- func (s *Service) Status(ctx context.Context, opts StatusOptions) ([]Result, error)
- func (s *Service) Uninstall(ctx context.Context, opts UninstallOptions) ([]Result, error)
- type Status
- type StatusOptions
- type Store
- type UninstallOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InstallOptions ¶
InstallOptions controls hook installation.
type ProfileSource ¶
type ProfileSource interface {
List(ctx context.Context) ([]contracts.Profile, error)
Get(ctx context.Context, name string) (contracts.Profile, error)
}
ProfileSource resolves registered profiles.
type RecordOptions ¶
RecordOptions controls hook payload recording.
type RecordResult ¶
type RecordResult struct {
Profile string `json:"profile"`
Session string `json:"session,omitempty"`
Event string `json:"event,omitempty"`
Recorded bool `json:"recorded"`
Message string `json:"message,omitempty"`
Error string `json:"error,omitempty"`
}
RecordResult is emitted after a hook payload is recorded.
type Result ¶
type Result struct {
Profile string `json:"profile"`
Installed bool `json:"installed"`
Status Status `json:"status"`
Disabled bool `json:"disabled"`
SettingsPath string `json:"settings_path"`
BackupPath string `json:"backup_path,omitempty"`
Message string `json:"message,omitempty"`
Error string `json:"error,omitempty"`
}
Result is emitted by install, uninstall, and status operations.
type Service ¶
type Service struct {
Profiles ProfileSource
Store Store
BinaryPath func() (string, error)
Now func() time.Time
}
Service owns hooks operations for the CLI.
func (*Service) Install ¶
Install adds ccx-managed Claude Code hook handlers to registered profiles.
func (*Service) Record ¶
func (s *Service) Record(ctx context.Context, opts RecordOptions) (RecordResult, error)
Record reads one Claude Code hook payload and stores normalized telemetry.
type Status ¶
type Status string
Status describes the ccx-managed hook installation state for one profile.
const ( // StatusMissing means settings.json does not exist for the profile. StatusMissing Status = "missing" // StatusInvalid means settings.json could not be parsed safely. StatusInvalid Status = "invalid" // StatusPartial means some or all required ccx hooks are absent. StatusPartial Status = "partial" // StatusDisabled means Claude Code has disableAllHooks enabled. StatusDisabled Status = "disabled" // StatusInstalled means all required ccx hooks are present. StatusInstalled Status = "installed" )
type StatusOptions ¶
type StatusOptions struct {
Profile string
}
StatusOptions controls status checks.
type Store ¶
type Store interface {
InsertHookEvent(ctx context.Context, profileName string, event contracts.HookEvent) error
UpsertSessionTelemetry(ctx context.Context, profileName string, event contracts.HookEvent) error
}
Store persists hook events and their session aggregate.
type UninstallOptions ¶
type UninstallOptions struct {
Profile string
}
UninstallOptions controls hook removal.