Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions plugins/hookify/core/rule_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
Expand Down