Skip to main content

Module install

Module install 

Source
Expand description

Merging the steering hook into a Claude Code settings file. The merge runs through the comment- and layout-preserving ct-patch engine (crate::patch): the existing file is parsed only to decide which edits to make, and those edits are byte-range splices against the original text, so the user’s comments and formatting survive.

Enums§

Scope
Which settings file the hook is written to.

Functions§

hook_command
The hook command string written into settings for mode.
install
Install the steering hook into existing settings text (or create a fresh document). Returns the new text and whether it changed. Idempotent: re-installing the same command is a no-op; a --mode change rewrites the command in place. Comments and layout in existing are preserved.
uninstall
Remove every steering hook from existing settings text, pruning emptied matcher entries (and the PreToolUse/hooks containers when they end up empty). Comments and layout elsewhere are preserved.