Skip to content

Commit c252ddd

Browse files
authored
feat: add gemini adapter (#26)
1 parent 758a684 commit c252ddd

File tree

4 files changed

+36
-6
lines changed

4 files changed

+36
-6
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ gtr.editor.default = cursor
322322
### AI Tool Settings
323323

324324
```bash
325-
# Default AI tool: none (or aider, claude, codex, cursor, continue, opencode)
325+
# Default AI tool: none (or aider, claude, codex, continue, cursor, gemini, opencode)
326326
gtr.ai.default = none
327327
```
328328

@@ -333,8 +333,9 @@ gtr.ai.default = none
333333
| **[Aider](https://aider.chat)** | `pip install aider-chat` | Pair programming, edit files with AI | `git gtr config set gtr.ai.default aider` |
334334
| **[Claude Code](https://claude.com/claude-code)** | Install from claude.com | Terminal-native coding agent | `git gtr config set gtr.ai.default claude` |
335335
| **[Codex CLI](https://github.com/openai/codex)** | `npm install -g @openai/codex` | OpenAI coding assistant | `git gtr config set gtr.ai.default codex` |
336-
| **[Cursor](https://cursor.com)** | Install from cursor.com | AI-powered editor with CLI agent | `git gtr config set gtr.ai.default cursor` |
337336
| **[Continue](https://continue.dev)** | See [docs](https://docs.continue.dev/cli/install) | Open-source coding agent | `git gtr config set gtr.ai.default continue` |
337+
| **[Cursor](https://cursor.com)** | Install from cursor.com | AI-powered editor with CLI agent | `git gtr config set gtr.ai.default cursor` |
338+
| **[Gemini](https://github.com/google-gemini/gemini-cli)** | `npm install -g @google/gemini-cli` | Open-source AI coding assistant powered by Google Gemini | `git gtr config set gtr.ai.default gemini` |
338339
| **[OpenCode](https://opencode.ai)** | Install from opencode.ai | AI coding assistant | `git gtr config set gtr.ai.default opencode` |
339340

340341
**Examples:**

adapters/ai/gemini.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
# Gemini CLI adapter
3+
4+
# Check if Gemini is available
5+
ai_can_start() {
6+
command -v gemini >/dev/null 2>&1
7+
}
8+
9+
# Start Gemini in a directory
10+
# Usage: ai_start path [args...]
11+
ai_start() {
12+
local path="$1"
13+
shift
14+
15+
if ! ai_can_start; then
16+
log_error "Gemini CLI not found. Install with: npm install -g @google/gemini-cli"
17+
log_info "Or: brew install gemini-cli"
18+
log_info "See https://github.com/google-gemini/gemini-cli for more info"
19+
return 1
20+
fi
21+
22+
if [ ! -d "$path" ]; then
23+
log_error "Directory not found: $path"
24+
return 1
25+
fi
26+
27+
# Change to the directory and run gemini with any additional arguments
28+
(cd "$path" && gemini "$@")
29+
}

bin/gtr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,7 @@ load_ai_adapter() {
965965

966966
if ! command -v "$cmd_name" >/dev/null 2>&1; then
967967
log_error "AI tool '$ai_tool' not found"
968-
log_info "Built-in adapters: aider, claude, codex, cursor, continue, opencode"
968+
log_info "Built-in adapters: aider, claude, codex, continue, cursor, gemini, opencode"
969969
log_info "Or use any AI tool command available in your PATH (e.g., bunx, gpt)"
970970
exit 1
971971
fi
@@ -1124,8 +1124,8 @@ CONFIGURATION OPTIONS:
11241124
webstorm, vim, nvim, emacs, sublime, nano,
11251125
atom, none
11261126
gtr.ai.default Default AI tool
1127-
Options: aider, claude, codex, cursor,
1128-
continue, opencode, none
1127+
Options: aider, claude, codex, continue,
1128+
cursor, gemini, opencode, none
11291129
gtr.copy.include Files to copy (multi-valued)
11301130
gtr.copy.exclude Files to exclude (multi-valued)
11311131
gtr.copy.includeDirs Directories to copy (multi-valued)

completions/_git-gtr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ _git-gtr() {
8585
_arguments '--editor[Editor to use]:editor:(cursor vscode zed idea pycharm webstorm vim nvim emacs sublime nano atom none)'
8686
;;
8787
ai)
88-
_arguments '--ai[AI tool to use]:tool:(aider claude codex cursor continue opencode none)'
88+
_arguments '--ai[AI tool to use]:tool:(aider claude codex continue cursor gemini opencode none)'
8989
;;
9090
rm)
9191
_arguments \

0 commit comments

Comments
 (0)