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.
- package/index.mjs +12 -9
- 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
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
else if (content.
|
|
617
|
-
|
|
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