claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

fix(hookify): use relative imports for core module

Open filter-tiago opened this issue 1 month ago • 1 comments

Summary

Fixes the hookify plugin's broken Python imports that cause all hooks to fail with No module named 'hookify'.

Problem

The hook scripts use absolute imports like:

from hookify.core.config_loader import load_rules

But the package structure has core/ directly in the plugin root:

plugins/hookify/
├── core/           # ← here, not in hookify/core/
├── hooks/
└── ...

Solution

Changed all imports from from hookify.core... to from core... since CLAUDE_PLUGIN_ROOT is already added to sys.path by each hook script.

Files Changed

  • hooks/stop.py
  • hooks/pretooluse.py
  • hooks/posttooluse.py
  • hooks/userpromptsubmit.py
  • core/rule_engine.py

Testing

Verified imports work correctly:

cd plugins/hookify
CLAUDE_PLUGIN_ROOT="$PWD" python3 -c "
import os, sys
sys.path.insert(0, os.environ['CLAUDE_PLUGIN_ROOT'])
from core.config_loader import load_rules
from core.rule_engine import RuleEngine
print('All imports successful!')
"

Fixes #15674

filter-tiago avatar Dec 29 '25 10:12 filter-tiago