diff --git a/plugins/hookify/core/rule_engine.py b/plugins/hookify/core/rule_engine.py index 51561c39..ee3eb5ad 100644 --- a/plugins/hookify/core/rule_engine.py +++ b/plugins/hookify/core/rule_engine.py @@ -73,7 +73,8 @@ def evaluate_rules(self, rules: List[Rule], input_data: Dict[str, Any]) -> Dict[ return { "hookSpecificOutput": { "hookEventName": hook_event, - "permissionDecision": "deny" + "permissionDecision": "deny", + "permissionDecisionReason": combined_message }, "systemMessage": combined_message } @@ -86,8 +87,19 @@ def evaluate_rules(self, rules: List[Rule], input_data: Dict[str, Any]) -> Dict[ # If only warnings, show them but allow operation if warning_rules: messages = [f"**[{r.name}]**\n{r.message}" for r in warning_rules] + combined_warn = "\n\n".join(messages) + + if hook_event in ['PreToolUse', 'PostToolUse']: + return { + "hookSpecificOutput": { + "hookEventName": hook_event, + "permissionDecision": "allow", + "additionalContext": combined_warn + }, + "systemMessage": combined_warn + } return { - "systemMessage": "\n\n".join(messages) + "systemMessage": combined_warn } # No matches - allow operation