fix(hookify): Fix Python import errors in plugin hooks #13868
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.
Summary
Fixes Python import errors (
No module named 'hookify') in the hookify plugin when running in Claude Code's versioned plugin cache.Problem
The hookify plugin's Python hooks fail to import core modules because:
parent_dir/hookify/core/...exists.../cache/{marketplace}/{plugin}/{version}/core/...CLAUDE_PLUGIN_ROOTpoints to the versioned directory (e.g.,.../hookify/0.1.0/)hookify/package inside - the code lives directly under the version directorySolution
hooks/common.py- Centralizes import logic with correctsys.pathhandlingcommonmodule (DRY principle)core/rule_engine.py- Use relative imports (.config_loader)Changes
hooks/common.pyhooks/*.pycore/rule_engine.pyTesting
Verified imports work correctly:
Test plan