hookinstall

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package hookinstall provides the core logic for `openclaw-cortex hook install`. It is a separate package so the cmd layer can delegate to it and the tests/ package can exercise the logic without importing package main.

Index

Constants

View Source
const (
	// EventUserPromptSubmit is the Claude Code hook event fired when the user submits a prompt.
	EventUserPromptSubmit = "UserPromptSubmit"
	// EventStop is the Claude Code hook event fired when the assistant stops generating.
	EventStop = "Stop"
	// BinaryName is the name of the openclaw-cortex binary.
	BinaryName = "openclaw-cortex"
)

Variables

This section is empty.

Functions

func DefaultHookConfig

func DefaultHookConfig() map[string][]HookMatcher

DefaultHookConfig returns the hook matchers to inject for each event.

func Install

func Install(path string) (bool, error)

Install reads the settings file at path (creating it if absent), merges the openclaw-cortex hook configuration, and writes the result back. It returns true when the file was modified and false when it was already up to date.

func ResolveSettingsPath

func ResolveSettingsPath(global bool) (string, error)

ResolveSettingsPath returns the absolute path to the Claude Code settings.json given whether the global flag was set.

Types

type HookEntry

type HookEntry struct {
	Type    string `json:"type"`
	Command string `json:"command"`
}

HookEntry represents a single Claude Code hook command entry.

type HookMatcher

type HookMatcher struct {
	Matcher string      `json:"matcher"`
	Hooks   []HookEntry `json:"hooks"`
}

HookMatcher represents a matcher+hooks pair in the Claude Code settings.

Jump to

Keyboard shortcuts

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