hooks

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package hooks manages Claude Code hooks integration for cdev. It handles installing, uninstalling, and checking hook status to capture real-time events from Claude running in any terminal/IDE.

Index

Constants

View Source
const (
	// CdevHooksDir is the directory for cdev hook scripts
	CdevHooksDir = ".cdev/hooks"
	// CdevMarker is used to identify cdev-managed hooks in settings.json
	CdevMarker = "_cdev_managed"
	// InstalledMarkerFile indicates hooks have been installed
	InstalledMarkerFile = ".cdev/hooks/.installed"
	// DefaultPermissionTimeout is how long to wait for mobile response (seconds)
	DefaultPermissionTimeout = 60
)

Variables

This section is empty.

Functions

func ForwardScriptName

func ForwardScriptName() string

ForwardScriptName returns the platform-appropriate forward hook script name.

func PermissionScriptName

func PermissionScriptName() string

PermissionScriptName returns the platform-appropriate permission hook script name.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager handles Claude Code hooks installation and management.

func NewManager

func NewManager(port int) *Manager

NewManager creates a new hooks manager.

func (*Manager) Install

func (m *Manager) Install() error

Install installs cdev hooks for Claude Code. This creates the hook scripts and adds hooks to Claude's settings.json. - forward.sh: Fire-and-forget script for notifications (SessionStart, PostToolUse) - permission.sh: Blocking script for PreToolUse that enables mobile permission approval

func (*Manager) IsInstalled

func (m *Manager) IsInstalled() bool

IsInstalled checks if cdev hooks are already installed.

func (*Manager) RestoreBackup

func (m *Manager) RestoreBackup() error

RestoreBackup restores the backup settings file if it exists. Call this if something goes wrong after modification.

func (*Manager) Status

func (m *Manager) Status() string

Status returns the current hook installation status.

func (*Manager) Uninstall

func (m *Manager) Uninstall() error

Uninstall removes cdev hooks from Claude Code.

Jump to

Keyboard shortcuts

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