cc-safe-setup 29.2.0 → 29.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +4 -1
  2. package/index.mjs +13 -10
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -87,7 +87,7 @@ Each hook exists because a real incident happened without it.
87
87
  | `--scan [--apply]` | Tech stack detection |
88
88
  | `--export / --import` | Team config sharing |
89
89
  | `--verify` | Test each hook |
90
- | `--install-example <name>` | Install from 336 examples |
90
+ | `--install-example <name>` | Install from 338 examples |
91
91
  | `--examples [filter]` | Browse examples by keyword |
92
92
  | `--full` | All-in-one setup |
93
93
  | `--status` | Check installed hooks |
@@ -137,6 +137,9 @@ Each hook exists because a real incident happened without it.
137
137
  | Diagnose why hooks aren't working | `npx cc-safe-setup --doctor` |
138
138
  | Preview how hooks react to a command | `npx cc-safe-setup --simulate "git push origin main"` |
139
139
  | Protect a specific file from edits | `npx cc-safe-setup --protect .env` |
140
+ | Stop .git/ write prompts | `npx cc-safe-setup --install-example allow-git-hooks-dir` |
141
+ | Auto-approve compound git commands | `npx cc-safe-setup --install-example auto-approve-compound-git` |
142
+ | Detect prompt injection patterns | `npx cc-safe-setup --install-example prompt-injection-detector` |
140
143
  | Define rules in YAML, compile to hooks | `npx cc-safe-setup --rules rules.yaml` |
141
144
  | Validate all hook scripts are correct | `npx cc-safe-setup --validate` |
142
145
  | Maximum protection mode | `npx cc-safe-setup --safe-mode` |
package/index.mjs CHANGED
@@ -606,15 +606,18 @@ async function installExample(name) {
606
606
  let trigger = 'PreToolUse';
607
607
  let matcher = 'Bash';
608
608
 
609
- // Detect trigger from header comments
610
- if (content.includes('TRIGGER: PermissionRequest') || content.match(/^#.*PermissionRequest hook/m)) trigger = 'PermissionRequest';
611
- else if (content.includes('TRIGGER: PostToolUse') || content.includes('PostToolUse')) trigger = 'PostToolUse';
612
- else if (content.includes('TRIGGER: Notification') || content.includes('Notification')) trigger = 'Notification';
613
- else if (content.includes('TRIGGER: Stop') || content.includes('Stop')) trigger = 'Stop';
614
- else if (content.includes('TRIGGER: SessionStart') || content.includes('SessionStart')) trigger = 'SessionStart';
615
- else if (content.includes('TRIGGER: PreCompact') || content.includes('PreCompact')) trigger = 'PreCompact';
616
- else if (content.includes('TRIGGER: SessionEnd') || content.includes('SessionEnd')) trigger = 'SessionEnd';
617
- else if (content.includes('TRIGGER: UserPromptSubmit') || content.match(/^#.*UserPromptSubmit hook/m)) trigger = 'UserPromptSubmit';
609
+ // Detect trigger from header comments (case-insensitive for "Trigger:" prefix)
610
+ const triggerMatch = content.match(/^#\s*[Tt]rigger:\s*(\S+)/m);
611
+ if (triggerMatch) {
612
+ const t = triggerMatch[1];
613
+ if (['PermissionRequest','PostToolUse','Notification','Stop','SessionStart','PreCompact','SessionEnd','UserPromptSubmit'].includes(t)) {
614
+ trigger = t;
615
+ }
616
+ } else if (content.match(/^#.*PermissionRequest hook/m)) {
617
+ trigger = 'PermissionRequest';
618
+ } else if (content.match(/^#.*UserPromptSubmit hook/m)) {
619
+ trigger = 'UserPromptSubmit';
620
+ }
618
621
 
619
622
  // Detect matcher from header (JSON format or comment format)
620
623
  const matcherMatch = content.match(/"matcher":\s*"([^"]*)"/);
@@ -4949,7 +4952,7 @@ async function doctor() {
4949
4952
  pass('"hooks" section exists in settings.json');
4950
4953
 
4951
4954
  // 5. Check each hook trigger type
4952
- for (const trigger of ['PreToolUse', 'PostToolUse', 'Stop']) {
4955
+ for (const trigger of ['PreToolUse', 'PostToolUse', 'Stop', 'Notification', 'SessionStart', 'SessionEnd', 'PreCompact', 'PermissionRequest', 'UserPromptSubmit']) {
4953
4956
  const entries = hooks[trigger] || [];
4954
4957
  if (entries.length > 0) {
4955
4958
  pass(trigger + ': ' + entries.length + ' hook(s) registered');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-safe-setup",
3
- "version": "29.2.0",
3
+ "version": "29.3.1",
4
4
  "description": "One command to make Claude Code safe. 346 hooks (8 built-in + 338 examples). 49 CLI commands. 1030 tests. 5 languages.",
5
5
  "main": "index.mjs",
6
6
  "bin": {