Skip to content

fix: hookify plugin imports broken by versioned cache path#27796

Open
hmesfin wants to merge 1 commit intoanthropics:mainfrom
hmesfin:fix/hookify-import-paths
Open

fix: hookify plugin imports broken by versioned cache path#27796
hmesfin wants to merge 1 commit intoanthropics:mainfrom
hmesfin:fix/hookify-import-paths

Conversation

@hmesfin
Copy link
Copy Markdown

@hmesfin hmesfin commented Feb 23, 2026

Summary

The hookify plugin's Python hook scripts all fail with No module named 'hookify' because the import paths don't account for the versioned plugin cache directory structure.

Root cause: All hook scripts and core/rule_engine.py use from hookify.core.config_loader import ..., expecting a hookify Python package on sys.path. However, when installed via the plugin cache, the directory structure is:

~/.claude/plugins/cache/claude-code-plugins/hookify/0.1.0/
  core/
    config_loader.py
    rule_engine.py
  hooks/
    pretooluse.py
    ...

The scripts add PLUGIN_ROOT (.../hookify/0.1.0/) and its parent (.../hookify/) to sys.path. But from hookify.core.config_loader requires a directory named hookify containing core/ somewhere on the path — the parent directory .../hookify/ only contains 0.1.0/, not core/.

Fix: Changed all from hookify.core. imports to from core. since PLUGIN_ROOT (which directly contains core/) is already on sys.path.

Files changed

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

Test plan

  • Install the hookify plugin and verify no Hookify import error: No module named 'hookify' messages appear on tool use
  • Verify hookify rules still load and evaluate correctly

The hook scripts use `from hookify.core.config_loader import ...` but
when installed via the plugin cache, the directory structure is:

  .../hookify/0.1.0/core/config_loader.py

The version subdirectory (0.1.0) breaks the `hookify` package path.
Since PLUGIN_ROOT (which contains `core/`) is already on sys.path,
changing imports to `from core.config_loader import ...` works correctly.
Copilot AI review requested due to automatic review settings February 23, 2026 03:57
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a critical import error in the hookify plugin that prevented all hook scripts from functioning. The issue occurred because the plugin's import paths used from hookify.core.* which assumed a package structure that doesn't exist when the plugin is installed via the versioned cache directory (.../hookify/0.1.0/). The fix changes all imports to use relative imports (from core.*) since PLUGIN_ROOT (containing the core/ directory) is already added to sys.path.

Changes:

  • Updated import statements from from hookify.core.* to from core.* across all hook scripts and the rule engine module
  • Ensures compatibility with the versioned plugin cache directory structure

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
plugins/hookify/hooks/userpromptsubmit.py Changed imports from hookify.core to core for config_loader and rule_engine
plugins/hookify/hooks/stop.py Changed imports from hookify.core to core for config_loader and rule_engine
plugins/hookify/hooks/pretooluse.py Changed imports from hookify.core to core for config_loader and rule_engine
plugins/hookify/hooks/posttooluse.py Changed imports from hookify.core to core for config_loader and rule_engine
plugins/hookify/core/rule_engine.py Changed imports from hookify.core to core for config_loader imports (both main and test sections)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants