Coverage for .claude/hooks/moai/lib/__init__.py: 0.00%

17 statements  

« prev     ^ index     » next       coverage.py v7.11.3, created at 2025-11-19 08:00 +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, user, notification) 

8- Project and state tracking 

9""" 

10 

11try: 

12 # Import core components 

13 from lib.config_manager import ( 

14 ConfigManager, 

15 get_config_manager, 

16 get_config, 

17 get_timeout_seconds, 

18 get_graceful_degradation, 

19 get_exit_code, 

20 ) 

21 from lib.timeout import CrossPlatformTimeout 

22 from lib.error_handler import HookError, ToolError, handle_hook_error 

23 from lib.json_utils import safe_json_loads, safe_json_dumps 

24 from lib.agent_context import AgentContext, get_agent_context 

25 

26 # Import handlers 

27 from lib.session import handle_session_start 

28 from lib.tool import handle_pre_tool_use, handle_post_tool_use 

29 from lib.user import handle_user_prompt_submit 

30 from lib.notification import handle_subagent_start, handle_subagent_stop 

31 

32 # Import utilities 

33 from lib.common import format_duration, get_module_version 

34 from lib.hook_config import ( 

35 load_hook_timeout, 

36 get_hook_execution_config, 

37 ) 

38 

39 __all__ = [ 

40 # Configuration 

41 "ConfigManager", 

42 "get_config_manager", 

43 "get_config", 

44 "get_timeout_seconds", 

45 "get_graceful_degradation", 

46 "get_exit_code", 

47 

48 # Core 

49 "CrossPlatformTimeout", 

50 "HookError", 

51 "ToolError", 

52 "handle_hook_error", 

53 "safe_json_loads", 

54 "safe_json_dumps", 

55 "AgentContext", 

56 "get_agent_context", 

57 

58 # Handlers 

59 "handle_session_start", 

60 "handle_pre_tool_use", 

61 "handle_post_tool_use", 

62 "handle_user_prompt_submit", 

63 "handle_subagent_start", 

64 "handle_subagent_stop", 

65 

66 # Utilities 

67 "format_duration", 

68 "get_module_version", 

69 "load_hook_timeout", 

70 "get_hook_execution_config", 

71 ] 

72 

73except ImportError: 

74 # Fallback if not all imports are available 

75 __all__ = [] 

76 

77__version__ = "1.0.0" 

78__author__ = "MoAI-ADK Team"