fix: plugin hooks must fall back to uvx when deepwork not on PATH#386
Merged
fix: plugin hooks must fall back to uvx when deepwork not on PATH#386
Conversation
End-user installs launch the MCP server via `uvx deepwork serve`, so the bare `deepwork` binary is not on PATH when hooks fire. Three plugin hooks (`post_commit_reminder.sh`, `deepschema_write.sh`, `post_compact.sh`) were calling `deepwork ...` directly and failing with exit 127 on every Bash tool use — Claude Code reports them as failed PostToolUse hooks. This regression was introduced in PR #361 when the bash-only commit reminder was rewritten to delegate to a Python hook via the deepwork CLI. The dev workflow masked the bug because direnv/Nix puts `.venv/bin` on PATH. Fix: each hook now probes `command -v deepwork` and falls back to `uvx deepwork ...` when missing. Adds a `.deepreview` rule (`claude_plugin_hook_deepwork_invocation` in plugins/claude/.deepreview) that flags any plugin hook script with an unguarded `deepwork` invocation, to prevent future regressions. Co-Authored-By: Claude Opus 4.7 (1M context) <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.
Summary
post_commit_reminder.sh,deepschema_write.sh,post_compact.sh) called baredeepwork .... End-user installs launch the MCP server viauvx deepwork serve, sodeepworkis not on PATH — the hooks failed with exit 127 on every Bash tool use, surfacing as failed PostToolUse hooks in Claude Code. Each hook now probescommand -v deepworkand falls back touvx deepwork .....deepreviewrule (claude_plugin_hook_deepwork_invocationinplugins/claude/.deepreview) that flags any plugin hook script with an unguardeddeepworkinvocation, to prevent the same regression from recurring.CHANGELOG.mdunder[Unreleased].The regression was introduced in #361, which moved the post-commit reminder from a self-contained jq script to a Python hook delegated via
deepwork hook .... The dev workflow masked the bug because direnv/Nix puts.venv/binon PATH.Test plan
uv run pytest tests/unit/test_post_commit_reminder_hook.py tests/unit/test_hook_cli.py tests/unit/plugins/test_claude_plugin.py— 68 passeddeepworkon PATH) returns{}for non-commit Bash callsPATHminimized so onlyuvxis reachable) successfully invokesuvx deepwork hook post_commit_reminder.deepreviewfiles againstdeepreview_schema.json🤖 Generated with Claude Code