feat: add Gemini CLI support via rtk init --gemini#573
Open
ousamabenyounes wants to merge 1 commit intortk-ai:developfrom
Open
feat: add Gemini CLI support via rtk init --gemini#573ousamabenyounes wants to merge 1 commit intortk-ai:developfrom
ousamabenyounes wants to merge 1 commit intortk-ai:developfrom
Conversation
- Add `rtk hook gemini` command: native Rust hook processor for Gemini CLI BeforeTool hooks. Reads JSON from stdin, delegates to `rewrite_command()` (single source of truth), outputs Gemini-format JSON response. - Add `--gemini` flag to `rtk init`: installs hook wrapper script, GEMINI.md, and patches ~/.gemini/settings.json with BeforeTool hook entry. - Add `rtk init -g --gemini --uninstall`: clean removal of all Gemini artifacts. - 6 unit tests covering hook format, rewrite delegation, and exclusions. Replaces PR rtk-ai#174 which had too many conflicts after upstream restructuring. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Ousama Ben Younes <benyounes.ousama@gmail.com>
6 tasks
Contributor
Author
Live testing on Gemini CLI ✅Tested on Gemini CLI 0.32.1 (Linux) — hook works end-to-end: Setup: rtk init -g --gemini --auto-patch
# → Hook: ~/.gemini/hooks/rtk-hook-gemini.sh
# → GEMINI.md installed
# → settings.json patched with BeforeTool hookResult: Gemini types 3 lines instead of ~15 — standard RTK compression. Hook processor verified with all command families:
Install/uninstall cycle:
|
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
Replaces #174 (too many conflicts after upstream restructuring). Clean implementation on latest
develop.rtk hook gemini: Native Rust hook processor for Gemini CLIBeforeToolhooks. Reads JSON from stdin, delegates torewrite_command()(single source of truth — no duplicate rewrite logic), outputs Gemini-format JSON response.rtk init -g --gemini: Installs hook wrapper (~/.gemini/hooks/rtk-hook-gemini.sh), GEMINI.md, and patches~/.gemini/settings.json.rtk init -g --gemini --uninstall: Clean removal of all Gemini artifacts.Key design decisions
rewrite_command()fromdiscover/registry.rsinstead of duplicating rewrite rules (unlike the old PR). One source of truth for all hook engines.exec rtk hook gemini) keeps the hook script minimal and testable — all logic is in Rust.--geminiis a new opt-in flag.Files changed
src/hook_cmd.rssrc/main.rs--geminiflag,Hooksubcommand routingsrc/init.rsrun_gemini(),patch_gemini_settings(),uninstall_gemini()README.mdTest plan
cargo fmt --all --check— OKcargo clippy --all-targets— 0 new warningscargo test— 905 passed, 3 ignoredhook_cmd.rscovering hook format, rewrite delegation, env prefix, exclusionsrtk init -g --geminion a machine with Gemini CLI installedgit statusis rewritten in Gemini CLI sessionCloses #174
🤖 Generated with Claude Code