From e1912c27c08165e996c3d3a595d169de929e24b7 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Wed, 6 May 2026 09:07:09 -0500 Subject: feat(hooks): make destructive-bash-confirm opt-in I added an OPTIN_HOOKS list in the Makefile and excluded those entries from the default install-hooks recipe. destructive-bash-confirm.py is the first opt-in. The recipe now prints the exact ln -s command for each opt-in so users can wire individual ones without consulting docs. uninstall-hooks and list still iterate the full HOOKS list so they keep handling opt-ins that someone has manually linked. --- Makefile | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index c368e2f..8fb9750 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,10 @@ CLAUDE_DIR := $(HOME)/.claude SKILLS := $(patsubst %/SKILL.md,%,$(wildcard */SKILL.md)) RULES := $(wildcard claude-rules/*.md) HOOKS := $(wildcard hooks/*.sh hooks/*.py) +# Opt-in hooks: present in the repo but not installed by default. Users link +# them manually if they want the behavior. Add new opt-ins to this list. +OPTIN_HOOKS := hooks/destructive-bash-confirm.py +DEFAULT_HOOKS := $(filter-out $(OPTIN_HOOKS),$(HOOKS)) CLAUDE_CONFIG := $(wildcard .claude/*.json) $(wildcard .claude/.*.json) LANGUAGES := $(notdir $(wildcard languages/*)) @@ -252,10 +256,10 @@ list: ## Show global install status echo " - commands"; \ fi -install-hooks: ## Symlink global hooks into ~/.claude/hooks/ + print settings.json snippet +install-hooks: ## Symlink default hooks into ~/.claude/hooks/ + print settings.json snippet (opt-in hooks excluded) @mkdir -p $(HOOKS_DIR) - @echo "Hooks:" - @for hook in $(HOOKS); do \ + @echo "Hooks (default):" + @for hook in $(DEFAULT_HOOKS); do \ name=$$(basename $$hook); \ if [ -L "$(HOOKS_DIR)/$$name" ]; then \ echo " skip $$name (already linked)"; \ @@ -266,6 +270,15 @@ install-hooks: ## Symlink global hooks into ~/.claude/hooks/ + print settings.js echo " link $$name → $(HOOKS_DIR)/$$name"; \ fi \ done + @if [ -n "$(strip $(OPTIN_HOOKS))" ]; then \ + echo ""; \ + echo "Opt-in hooks (not installed by default — link manually if you want them):"; \ + for hook in $(OPTIN_HOOKS); do \ + name=$$(basename $$hook); \ + echo " - $$name"; \ + echo " ln -s $(CURDIR)/$$hook $(HOOKS_DIR)/$$name"; \ + done; \ + fi @echo "" @echo "Merge this into ~/.claude/settings.json (preserve any existing hooks arrays):" @echo "" -- cgit v1.2.3