Coverage for src/moai_adk/templates/.claude/hooks/moai/lib/__init__.py: 83.33%

12 statements  

« prev     ^ index     » next       coverage.py v7.11.3, created at 2025-11-20 09:47 +0900

1""" 

2Hook utilities library - Consolidated from shared/, utils/, and handlers/ 

3 

4This module provides centralized access to all hook-related utilities: 

5- Configuration management (ConfigManager) 

6- Core utilities (timeout, error handling, JSON utilities) 

7- Event handlers (session, tool) 

8- Project and state tracking 

9""" 

10 

11try: 

12 # Import model classes 

13 # Import utilities 

14 from lib.common import format_duration 

15 

16 # Import core components 

17 from lib.config_manager import ( 

18 ConfigManager, 

19 get_config, 

20 get_config_manager, 

21 get_exit_code, 

22 get_graceful_degradation, 

23 get_timeout_seconds, 

24 ) 

25 from lib.models import HookPayload, HookResult 

26 

27 # Import handlers 

28 from lib.session import handle_session_start 

29 from lib.timeout import CrossPlatformTimeout 

30 from lib.tool import handle_post_tool_use, handle_pre_tool_use 

31 

32 __all__ = [ 

33 # Hook payload/result classes 

34 "HookPayload", 

35 "HookResult", 

36 

37 # Configuration 

38 "ConfigManager", 

39 "get_config_manager", 

40 "get_config", 

41 "get_timeout_seconds", 

42 "get_graceful_degradation", 

43 "get_exit_code", 

44 

45 # Core 

46 "CrossPlatformTimeout", 

47 

48 # Handlers 

49 "handle_session_start", 

50 "handle_pre_tool_use", 

51 "handle_post_tool_use", 

52 

53 # Utilities 

54 "format_duration", 

55 ] 

56 

57except ImportError: 

58 # Fallback if not all imports are available 

59 __all__ = [] 

60 

61__version__ = "1.0.0" 

62__author__ = "MoAI-ADK Team"