Conversation
The Endpoint trait needed a concrete implementation to handle the Claude Code PreToolUse Hook stdin/stdout protocol, translating between hook JSON and the rule engine's Action types. Implement ClaudeCodeHookAdapter with: - extract_command: returns command only for tool_name == "Bash" - handle_action: converts Action to HookOutput JSON (allow/deny/ask) with sandbox-aware command rewriting via updatedInput - handle_no_match: applies defaults.action for Bash, outputs nothing for non-Bash tools - handle_error: writes to stderr, exits with code 2 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary of ChangesHello @fohte, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request integrates the Claude Code PreToolUse Hook with the existing rule engine by implementing a new adapter. This adapter translates the hook's JSON protocol into a format compatible with the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
…character bypass Compound commands like `safe-cmd && dangerous-cmd` were passed unquoted to `runok exec --sandbox`, causing the shell to interpret `&&` before runok could enforce the sandbox. This meant the second command would execute outside the sandbox. Shell-quote the command with `shlex::try_quote` so the entire compound command is passed as a single argument to `runok exec`. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…put parsing BashToolInput parsing via `serde_json::from_value(self.input.tool_input.clone())` was repeated in three places: `build_action_output`, `build_no_match_output`, and `extract_command`. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #54 +/- ##
==========================================
- Coverage 90.33% 90.27% -0.06%
==========================================
Files 20 21 +1
Lines 4315 4454 +139
==========================================
+ Hits 3898 4021 +123
- Misses 417 433 +16 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…d on quote failure `wrap_with_sandbox` silently fell back to the raw unquoted command when `shlex::try_quote` failed (on NUL bytes), which would bypass sandbox protection. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…-hook-adapter # Conflicts: # src/adapter/mod.rs
…th_sandbox Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Preset names come from user config files and could contain spaces or special characters, so they need shell quoting just like the command argument.
Why
EndpointtraitWhat
ClaudeCodeHookAdapterto translate between the Claude Code PreToolUse Hook JSON protocol and theEndpointtraittool_name == "Bash"; produce no output for other tools (outside runok's scope)updatedInputtorunok exec --sandbox <preset> -- <cmd>on sandbox-enabled allowdefaults.actionand output hook response when no rule matches