cc-safe-setup 29.2.0 → 29.3.0

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 (2) hide show
  1. package/index.mjs +12 -9
  2. package/package.json +1 -1
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*"([^"]*)"/);
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.0",
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": {