feat(adapter): add CheckAdapter for generic check interface#53
Conversation
…ck interface CheckAdapter provides a protocol-agnostic check interface that any LLM agent can use to query command permissions. It accepts commands via `from_command()` (for --command CLI arg) or `from_stdin()` (for JSON input), evaluates them through the common Endpoint flow, and outputs CheckOutput JSON to stdout with decision/reason/fix_suggestion/sandbox. - extract_command: returns the stored command string - handle_action: converts Action to CheckOutput JSON, exit 0 - handle_no_match: maps defaults.action to decision string, exit 0 - handle_error: writes to stderr, exit 2 - Sandbox info is included as informational data (preset name or merged policy details) Co-Authored-By: Claude Opus 4.6 <[email protected]>
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 introduces a new Highlights
Changelog
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
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #53 +/- ##
==========================================
+ Coverage 90.17% 90.38% +0.20%
==========================================
Files 19 20 +1
Lines 4234 4315 +81
==========================================
+ Hits 3818 3900 +82
+ Misses 416 415 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…l tests Tests for handle_action and handle_no_match were duplicating the production logic in test bodies, making assertions tautological (comparing a value against itself). Also, the for-loop test pattern and misleading case names needed cleanup per review feedback. Extract build_check_output() and build_no_match_output() from the Endpoint methods so tests can verify the mapping logic directly. Refactor handle_action_always_returns_exit_0 to use rstest parameterization, and fix constructor test naming. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Why
runok check --command "..."EndpointtraitWhat
CheckAdapteras anEndpointtrait implementation that returns permission decisions as JSONfrom_command()(CLI argument) andfrom_stdin()(stdin JSON)handle_actionconvertsActiontoCheckOutputJSON (decision,reason,fix_suggestion,sandbox) on stdout (exit 0)handle_no_matchreturns a decision based ondefaults.action(exit 0)handle_errorwrites to stderr (exit 2)