diff options
| author | Daisy S. Hollman <thewholedaisy@gmail.com> | 2025-12-18 20:29:39 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-18 20:29:39 -0800 |
| commit | 6d3752c000e2b3d0e6137bd7adb04895d6f40f14 (patch) | |
| tree | d41700479cec04d18700e2cda5d7a5185b870257 /plugins/hookify/hooks/pretooluse.py | |
| parent | 4bab8d0f501eb674a5661128ee5007624f4b9786 (diff) | |
| parent | 5f2db35c65ac214bc0efcf97d7f2c93964c1e740 (diff) | |
Merge pull request #39 from anthropics/daisy/plugins/fix-hookify-imports
Fix hookify plugin import error: No module named 'hookify'
Diffstat (limited to 'plugins/hookify/hooks/pretooluse.py')
| -rwxr-xr-x | plugins/hookify/hooks/pretooluse.py | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/plugins/hookify/hooks/pretooluse.py b/plugins/hookify/hooks/pretooluse.py index f265c277..9aff5197 100755 --- a/plugins/hookify/hooks/pretooluse.py +++ b/plugins/hookify/hooks/pretooluse.py @@ -9,22 +9,14 @@ import os import sys import json -# CRITICAL: Add plugin root to Python path for imports -# We need to add the parent of the plugin directory so Python can find "hookify" package +# Add plugin root to Python path for imports PLUGIN_ROOT = os.environ.get('CLAUDE_PLUGIN_ROOT') -if PLUGIN_ROOT: - # Add the parent directory of the plugin - parent_dir = os.path.dirname(PLUGIN_ROOT) - if parent_dir not in sys.path: - sys.path.insert(0, parent_dir) - - # Also add PLUGIN_ROOT itself in case we have other scripts - if PLUGIN_ROOT not in sys.path: - sys.path.insert(0, PLUGIN_ROOT) +if PLUGIN_ROOT and PLUGIN_ROOT not in sys.path: + sys.path.insert(0, PLUGIN_ROOT) try: - from hookify.core.config_loader import load_rules - from hookify.core.rule_engine import RuleEngine + from core.config_loader import load_rules + from core.rule_engine import RuleEngine except ImportError as e: # If imports fail, allow operation and log error error_msg = {"systemMessage": f"Hookify import error: {e}"} |
