-
Notifications
You must be signed in to change notification settings - Fork 2.3k
feat: add Gemini CLI support via rtk init --gemini #174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
ousamabenyounes
wants to merge
9
commits into
rtk-ai:develop
from
ousamabenyounes:feat/gemini-support
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
3d723d7
feat: add Gemini CLI support via rtk init --gemini
ousamabenyounes 6da6b8b
feat: add Gemini CLI support via rtk init --gemini
ousamabenyounes d964813
Translate French comments to English in REWRITE_GEMINI_HOOK and relat…
ousamabenyounes 7b59557
docs: update version in README from 0.18.1 to 0.20.1
ousamabenyounes 138e9bb
Fix test-all.sh failures
ousamabenyounes c6dd162
feat: auto-detect CLIs with rtk init --global, add --claude flag
ousamabenyounes 56b98c1
feat: implement Rust-native Gemini CLI hook (rtk hook gemini)
ousamabenyounes 2ada408
docs: update version to 0.27.2 and module count to 59
ousamabenyounes e5c0f09
test: add rtk hook gemini smoke tests
ousamabenyounes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| #!/bin/bash | ||
| set -e | ||
|
|
||
| RTK_BIN="./target/debug/rtk" | ||
| GREEN='\033[0;32m' | ||
| RED='\033[0;31m' | ||
| NC='\033[0m' | ||
| PASS=0 | ||
| FAIL=0 | ||
|
|
||
| HOME_SAV=$HOME | ||
| TEST_HOME=$(mktemp -d) | ||
| export HOME=$TEST_HOME | ||
| trap 'export HOME=$HOME_SAV; rm -rf "$TEST_HOME"' EXIT | ||
|
|
||
| check() { | ||
| local label=$1 | ||
| local file=$2 | ||
| if [ -f "$file" ] || [ -d "$file" ]; then | ||
| echo -e "${GREEN}✅ $label${NC}" | ||
| PASS=$((PASS + 1)) | ||
| else | ||
| echo -e "${RED}❌ $label — not found: $file${NC}" | ||
| FAIL=$((FAIL + 1)) | ||
| fi | ||
| } | ||
|
|
||
| # Ensure binary exists | ||
| if [ ! -f "$RTK_BIN" ]; then | ||
| echo "Building rtk..." | ||
| cargo build | ||
| fi | ||
|
|
||
| echo "--- Cas 1: Claude only ---" | ||
| mkdir -p "$HOME/.claude" | ||
| $RTK_BIN init -g --auto-patch > /dev/null | ||
| check "Claude: settings.json" "$HOME/.claude/settings.json" | ||
| check "Claude: hook" "$HOME/.claude/hooks/rtk-rewrite.sh" | ||
| rm -rf "$HOME/.claude" "$HOME/.gemini" | ||
|
|
||
| echo "--- Cas 2: Gemini only ---" | ||
| mkdir -p "$HOME/.gemini" | ||
| $RTK_BIN init -g --auto-patch > /dev/null | ||
| check "Gemini: settings.json" "$HOME/.gemini/settings.json" | ||
| check "Gemini: hook" "$HOME/.gemini/hooks/rtk-rewrite.sh" | ||
| check "Gemini: GEMINI.md" "$HOME/.gemini/GEMINI.md" | ||
| rm -rf "$HOME/.claude" "$HOME/.gemini" | ||
|
|
||
| echo "--- Cas 3: Both ---" | ||
| mkdir -p "$HOME/.claude" "$HOME/.gemini" | ||
| $RTK_BIN init -g --auto-patch > /dev/null | ||
| check "Both: Claude settings.json" "$HOME/.claude/settings.json" | ||
| check "Both: Gemini settings.json" "$HOME/.gemini/settings.json" | ||
| rm -rf "$HOME/.claude" "$HOME/.gemini" | ||
|
|
||
| echo "--- Cas 4: No CLI ---" | ||
| output=$($RTK_BIN init -g 2>&1 || true) | ||
| if echo "$output" | grep -q "No CLI detected"; then | ||
| echo -e "${GREEN}✅ No CLI: message correct${NC}" | ||
| PASS=$((PASS + 1)) | ||
| else | ||
| echo -e "${RED}❌ No CLI: message manquant${NC}" | ||
| FAIL=$((FAIL + 1)) | ||
| fi | ||
|
|
||
| echo "" | ||
| echo "Results: $PASS passed, $FAIL failed" | ||
| [ $FAIL -eq 0 ] && echo -e "${GREEN}✨ ALL PASSED ✨${NC}" || exit 1 |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To keep it understandable/simple in six months, I will have taken this approach:
rtk init --claudertk init --geminirtk init --global-> auto CLIs detection (search for ~/.gemini and ~/.claude)(By the way, Hey Ousama, I hope you are doing well 😄)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a PR in progress similar to this one.
#158
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey! I’m doing great, hope you are too 🙂
I’m aligned with your approach and implementing it in a lightweight way.
There was #131, but it was considered too large and needed splitting.
So I decided to move forward with a lighter, more focused version instead.
I’ve also applied the requested fixes:
feat: auto-detect CLIs with rtk init --global, add --claude flag
I’m against duplicate work… just like I’m against copy-paste code 😄
Happy to align if #158 already covers it.