aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-06 09:07:09 -0500
committerCraig Jennings <c@cjennings.net>2026-05-06 09:07:09 -0500
commite1912c27c08165e996c3d3a595d169de929e24b7 (patch)
tree4250b20eeb2844cd950b4066797a18a3332b213f
parenta2466a4c7df9732ee46f9c37686e96c224193456 (diff)
downloadrulesets-e1912c27c08165e996c3d3a595d169de929e24b7.tar.gz
rulesets-e1912c27c08165e996c3d3a595d169de929e24b7.zip
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.
-rw-r--r--Makefile19
1 files 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 ""