fix(hookify): use relative imports so plugin works when installed via plugin cache#42162
Open
lcaiger wants to merge 1 commit intoanthropics:mainfrom
Open
fix(hookify): use relative imports so plugin works when installed via plugin cache#42162lcaiger wants to merge 1 commit intoanthropics:mainfrom
lcaiger wants to merge 1 commit intoanthropics:mainfrom
Conversation
…lugin cache When the hookify plugin is installed via Claude Code's plugin system, files are placed at a path like ~/.claude/plugins/cache/.../hookify/0.1.0/ where core/ is a direct child of the plugin root, not under a hookify/ subdirectory. The previous `from hookify.core.` imports therefore fail with ImportError. Change all `from hookify.core.` imports to `from core.` in rule_engine.py and all four hook scripts so the plugin resolves modules correctly at runtime. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When the hookify plugin is installed via Claude Code's plugin system, files are placed at a path like:
In this layout,
core/is a direct child of the plugin root directory — there is nohookify/package subdirectory wrapping it. Python therefore cannot resolvefrom hookify.core.imports, and every hook script fails immediately with anImportError.The hook scripts do add
PLUGIN_ROOTand its parent tosys.path, but since there is nohookify/directory at either of those locations, thehookify.corepackage simply does not exist at runtime.Fix
Change all
from hookify.core.<module> import ...statements tofrom core.<module> import ...across the five affected files:plugins/hookify/core/rule_engine.py(2 occurrences)plugins/hookify/hooks/stop.pyplugins/hookify/hooks/posttooluse.pyplugins/hookify/hooks/pretooluse.pyplugins/hookify/hooks/userpromptsubmit.pyWith
PLUGIN_ROOTalready onsys.path,from core.resolves correctly to thecore/directory sitting directly inside the plugin installation.Test plan
ImportErrorin the output