cc-safe-setup 28.9.0 → 29.0.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.
- package/index.mjs +11 -8
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -605,16 +605,19 @@ async function installExample(name) {
|
|
|
605
605
|
let matcher = 'Bash';
|
|
606
606
|
|
|
607
607
|
// Detect trigger from header comments
|
|
608
|
-
if (content.includes('TRIGGER:
|
|
609
|
-
if (content.includes('TRIGGER:
|
|
610
|
-
if (content.includes('TRIGGER:
|
|
611
|
-
if (content.includes('TRIGGER:
|
|
612
|
-
if (content.includes('TRIGGER:
|
|
613
|
-
if (content.includes('TRIGGER:
|
|
614
|
-
|
|
615
|
-
|
|
608
|
+
if (content.includes('TRIGGER: PermissionRequest') || content.match(/^#.*PermissionRequest hook/m)) trigger = 'PermissionRequest';
|
|
609
|
+
else if (content.includes('TRIGGER: PostToolUse') || content.includes('PostToolUse')) trigger = 'PostToolUse';
|
|
610
|
+
else if (content.includes('TRIGGER: Notification') || content.includes('Notification')) trigger = 'Notification';
|
|
611
|
+
else if (content.includes('TRIGGER: Stop') || content.includes('Stop')) trigger = 'Stop';
|
|
612
|
+
else if (content.includes('TRIGGER: SessionStart') || content.includes('SessionStart')) trigger = 'SessionStart';
|
|
613
|
+
else if (content.includes('TRIGGER: PreCompact') || content.includes('PreCompact')) trigger = 'PreCompact';
|
|
614
|
+
else if (content.includes('TRIGGER: SessionEnd') || content.includes('SessionEnd')) trigger = 'SessionEnd';
|
|
615
|
+
|
|
616
|
+
// Detect matcher from header (JSON format or comment format)
|
|
616
617
|
const matcherMatch = content.match(/"matcher":\s*"([^"]*)"/);
|
|
617
618
|
if (matcherMatch) matcher = matcherMatch[1];
|
|
619
|
+
const commentMatcher = content.match(/^#\s*Matcher:\s*(.+)$/m);
|
|
620
|
+
if (commentMatcher) matcher = commentMatcher[1].trim();
|
|
618
621
|
|
|
619
622
|
// Update settings.json
|
|
620
623
|
let settings = {};
|
package/package.json
CHANGED