mirror of
https://github.com/anthropics/claude-plugins-official.git
synced 2026-02-03 08:53:37 +00:00
Merge pull request #39 from anthropics/daisy/plugins/fix-hookify-imports
Fix hookify plugin import error: No module named 'hookify'
This commit is contained in:
@@ -7,7 +7,7 @@ from functools import lru_cache
|
|||||||
from typing import List, Dict, Any, Optional
|
from typing import List, Dict, Any, Optional
|
||||||
|
|
||||||
# Import from local module
|
# Import from local module
|
||||||
from hookify.core.config_loader import Rule, Condition
|
from core.config_loader import Rule, Condition
|
||||||
|
|
||||||
|
|
||||||
# Cache compiled regexes (max 128 patterns)
|
# Cache compiled regexes (max 128 patterns)
|
||||||
@@ -275,7 +275,7 @@ class RuleEngine:
|
|||||||
|
|
||||||
# For testing
|
# For testing
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
from hookify.core.config_loader import Condition, Rule
|
from core.config_loader import Condition, Rule
|
||||||
|
|
||||||
# Test rule evaluation
|
# Test rule evaluation
|
||||||
rule = Rule(
|
rule = Rule(
|
||||||
|
|||||||
@@ -9,18 +9,14 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
|
|
||||||
# CRITICAL: Add plugin root to Python path for imports
|
# Add plugin root to Python path for imports
|
||||||
PLUGIN_ROOT = os.environ.get('CLAUDE_PLUGIN_ROOT')
|
PLUGIN_ROOT = os.environ.get('CLAUDE_PLUGIN_ROOT')
|
||||||
if PLUGIN_ROOT:
|
if PLUGIN_ROOT and PLUGIN_ROOT not in sys.path:
|
||||||
parent_dir = os.path.dirname(PLUGIN_ROOT)
|
sys.path.insert(0, PLUGIN_ROOT)
|
||||||
if parent_dir not in sys.path:
|
|
||||||
sys.path.insert(0, parent_dir)
|
|
||||||
if PLUGIN_ROOT not in sys.path:
|
|
||||||
sys.path.insert(0, PLUGIN_ROOT)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from hookify.core.config_loader import load_rules
|
from core.config_loader import load_rules
|
||||||
from hookify.core.rule_engine import RuleEngine
|
from core.rule_engine import RuleEngine
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
error_msg = {"systemMessage": f"Hookify import error: {e}"}
|
error_msg = {"systemMessage": f"Hookify import error: {e}"}
|
||||||
print(json.dumps(error_msg), file=sys.stdout)
|
print(json.dumps(error_msg), file=sys.stdout)
|
||||||
|
|||||||
@@ -9,22 +9,14 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
|
|
||||||
# CRITICAL: Add plugin root to Python path for imports
|
# Add plugin root to Python path for imports
|
||||||
# We need to add the parent of the plugin directory so Python can find "hookify" package
|
|
||||||
PLUGIN_ROOT = os.environ.get('CLAUDE_PLUGIN_ROOT')
|
PLUGIN_ROOT = os.environ.get('CLAUDE_PLUGIN_ROOT')
|
||||||
if PLUGIN_ROOT:
|
if PLUGIN_ROOT and PLUGIN_ROOT not in sys.path:
|
||||||
# Add the parent directory of the plugin
|
sys.path.insert(0, PLUGIN_ROOT)
|
||||||
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)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from hookify.core.config_loader import load_rules
|
from core.config_loader import load_rules
|
||||||
from hookify.core.rule_engine import RuleEngine
|
from core.rule_engine import RuleEngine
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
# If imports fail, allow operation and log error
|
# If imports fail, allow operation and log error
|
||||||
error_msg = {"systemMessage": f"Hookify import error: {e}"}
|
error_msg = {"systemMessage": f"Hookify import error: {e}"}
|
||||||
|
|||||||
@@ -9,18 +9,14 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
|
|
||||||
# CRITICAL: Add plugin root to Python path for imports
|
# Add plugin root to Python path for imports
|
||||||
PLUGIN_ROOT = os.environ.get('CLAUDE_PLUGIN_ROOT')
|
PLUGIN_ROOT = os.environ.get('CLAUDE_PLUGIN_ROOT')
|
||||||
if PLUGIN_ROOT:
|
if PLUGIN_ROOT and PLUGIN_ROOT not in sys.path:
|
||||||
parent_dir = os.path.dirname(PLUGIN_ROOT)
|
sys.path.insert(0, PLUGIN_ROOT)
|
||||||
if parent_dir not in sys.path:
|
|
||||||
sys.path.insert(0, parent_dir)
|
|
||||||
if PLUGIN_ROOT not in sys.path:
|
|
||||||
sys.path.insert(0, PLUGIN_ROOT)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from hookify.core.config_loader import load_rules
|
from core.config_loader import load_rules
|
||||||
from hookify.core.rule_engine import RuleEngine
|
from core.rule_engine import RuleEngine
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
error_msg = {"systemMessage": f"Hookify import error: {e}"}
|
error_msg = {"systemMessage": f"Hookify import error: {e}"}
|
||||||
print(json.dumps(error_msg), file=sys.stdout)
|
print(json.dumps(error_msg), file=sys.stdout)
|
||||||
|
|||||||
@@ -9,18 +9,14 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
|
|
||||||
# CRITICAL: Add plugin root to Python path for imports
|
# Add plugin root to Python path for imports
|
||||||
PLUGIN_ROOT = os.environ.get('CLAUDE_PLUGIN_ROOT')
|
PLUGIN_ROOT = os.environ.get('CLAUDE_PLUGIN_ROOT')
|
||||||
if PLUGIN_ROOT:
|
if PLUGIN_ROOT and PLUGIN_ROOT not in sys.path:
|
||||||
parent_dir = os.path.dirname(PLUGIN_ROOT)
|
sys.path.insert(0, PLUGIN_ROOT)
|
||||||
if parent_dir not in sys.path:
|
|
||||||
sys.path.insert(0, parent_dir)
|
|
||||||
if PLUGIN_ROOT not in sys.path:
|
|
||||||
sys.path.insert(0, PLUGIN_ROOT)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from hookify.core.config_loader import load_rules
|
from core.config_loader import load_rules
|
||||||
from hookify.core.rule_engine import RuleEngine
|
from core.rule_engine import RuleEngine
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
error_msg = {"systemMessage": f"Hookify import error: {e}"}
|
error_msg = {"systemMessage": f"Hookify import error: {e}"}
|
||||||
print(json.dumps(error_msg), file=sys.stdout)
|
print(json.dumps(error_msg), file=sys.stdout)
|
||||||
|
|||||||
Reference in New Issue
Block a user