Skip to content

fix(tool-routing): output JSON format for PreToolUse hook blocking#26

Merged
technicalpickles merged 3 commits intomainfrom
feat/tool-routing-test-harness
Feb 2, 2026
Merged

fix(tool-routing): output JSON format for PreToolUse hook blocking#26
technicalpickles merged 3 commits intomainfrom
feat/tool-routing-test-harness

Conversation

@technicalpickles
Copy link
Owner

Summary

  • Fixed hook output format from plain text stderr + exit 2 to structured JSON stdout + exit 0
  • This is the format Claude Code expects for PreToolUse hooks to control tool behavior
  • Fixed hooks.json command to use --quiet (suppress uv output) and --directory (correct flag)

Changes

cli.py: Output JSON with hookSpecificOutput.permissionDecision: deny instead of plain text to stderr

hooks.json: Use uv run --quiet --directory "${CLAUDE_PLUGIN_ROOT}" instead of --project

Test plan

  • Verified hook blocks WebFetch calls to GitHub PR URLs in isolated test environment
  • Debug logs show: Hook denied tool use for WebFetch and WebFetch tool permission denied

🤖 Generated with Claude Code

technicalpickles and others added 3 commits February 2, 2026 14:21
Changed hook output from plain text stderr + exit 2 to structured JSON
stdout + exit 0, which is the format Claude Code expects for PreToolUse
hooks to control tool behavior.

Also fixed hooks.json command:
- Use --quiet to suppress uv's venv creation messages
- Use --directory instead of --project for correct working directory

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds bin/test-claude wrapper that creates an isolated Claude config
for testing plugin hooks without affecting the user's real config.

Features:
- Sets up local-test marketplace pointing to repo
- Copies bedrock settings from global config
- Installs plugins to isolated cache
- Supports --setup, --install, --status, --clean, --reset

Generated test artifacts go in tmp/ (now gitignored).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@technicalpickles technicalpickles marked this pull request as ready for review February 2, 2026 19:35
@technicalpickles technicalpickles merged commit ebd12e6 into main Feb 2, 2026
0 of 2 checks passed
@technicalpickles technicalpickles deleted the feat/tool-routing-test-harness branch February 2, 2026 20:31
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.

1 participant