MCPcopy
hub / github.com/anthropics/claude-code / main

Function main

plugins/hookify/hooks/stop.py:30–55  ·  view source on GitHub ↗

Main entry point for Stop hook.

()

Source from the content-addressed store, hash-verified

28
29
30def main():
31 """Main entry point for Stop hook."""
32 try:
33 # Read input from stdin
34 input_data = json.load(sys.stdin)
35
36 # Load stop rules
37 rules = load_rules(event='stop')
38
39 # Evaluate rules
40 engine = RuleEngine()
41 result = engine.evaluate_rules(rules, input_data)
42
43 # Always output JSON (even if empty)
44 print(json.dumps(result), file=sys.stdout)
45
46 except Exception as e:
47 # On any error, allow the operation
48 error_output = {
49 "systemMessage": f"Hookify error: {str(e)}"
50 }
51 print(json.dumps(error_output), file=sys.stdout)
52
53 finally:
54 # ALWAYS exit 0
55 sys.exit(0)
56
57
58if __name__ == '__main__':

Callers 1

stop.pyFile · 0.70

Calls 3

evaluate_rulesMethod · 0.95
load_rulesFunction · 0.90
RuleEngineClass · 0.90

Tested by

no test coverage detected