Skip to main content

Module claude_settings

Module claude_settings 

Source
Expand description

Inline --settings JSON for gw-spawned Claude sessions, and the entry builders used by gw setup-claude to register .claude/settings.json hooks.

Hook commands use the bare name gw rather than an absolute path. Claude Code resolves the command through the user’s PATH, which is what makes .claude/settings.json portable across machines (Homebrew, cargo, manual installers, CI) and safe to commit to a repo.

Functions§

guard_settings_json
Build the --settings JSON payload that registers gw guard as a PreToolUse(Bash) hook.
pre_tool_use_bash_entry
One PreToolUse(Bash) hook entry — used by both --settings inline injection and setup-claude’s .claude/settings.json merge.
worktree_create_entry
One WorktreeCreate hook entry (no matcher — Claude Code does not support matchers for worktree lifecycle events).
worktree_remove_entry
One WorktreeRemove hook entry (no matcher — Claude Code does not support matchers for worktree lifecycle events).