gemini-executor 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +274 -0
- package/agents/gemini-executor/README.md +315 -0
- package/agents/gemini-executor/__tests__/command.test.ts +362 -0
- package/agents/gemini-executor/__tests__/integration.test.ts +486 -0
- package/agents/gemini-executor/__tests__/security.test.ts +257 -0
- package/agents/gemini-executor/__tests__/validation.test.ts +373 -0
- package/agents/gemini-executor/index.ts +309 -0
- package/dist/agents/gemini-executor/index.d.ts +77 -0
- package/dist/agents/gemini-executor/index.d.ts.map +1 -0
- package/dist/agents/gemini-executor/index.js +249 -0
- package/dist/agents/gemini-executor/index.js.map +1 -0
- package/docs/architecture.md +261 -0
- package/package.json +58 -0
- package/skills/gemini/skill.md +362 -0
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
# Gemini CLI Integration Architecture
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
This project integrates Google's Gemini CLI into Claude Code, enabling Claude to leverage Gemini's capabilities for specific tasks while maintaining Claude's strengths in code manipulation and project understanding.
|
|
6
|
+
|
|
7
|
+
## Architecture Diagram
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
┌─────────────────────────────────────────────────────┐
|
|
11
|
+
│ Claude Code │
|
|
12
|
+
│ │
|
|
13
|
+
│ ┌────────────────┐ ┌──────────────────┐ │
|
|
14
|
+
│ │ User Request │────────▶│ Task Router │ │
|
|
15
|
+
│ └────────────────┘ └──────────────────┘ │
|
|
16
|
+
│ │ │
|
|
17
|
+
│ ┌────────────────┴───────────┐ │
|
|
18
|
+
│ │ │ │
|
|
19
|
+
│ ┌───────▼────────┐ ┌────────▼──────────┐
|
|
20
|
+
│ │ Claude Agent │ │ Gemini SubAgent │
|
|
21
|
+
│ │ │ │ │
|
|
22
|
+
│ │ • Code Editing │ │ • Complex Logic │
|
|
23
|
+
│ │ • File Ops │ │ • Data Analysis │
|
|
24
|
+
│ │ • Git Ops │ │ • Creative Tasks │
|
|
25
|
+
│ └────────────────┘ └─────────┬─────────┘
|
|
26
|
+
│ │
|
|
27
|
+
│ ┌──────────▼─────────┐
|
|
28
|
+
│ │ Gemini CLI │
|
|
29
|
+
│ │ │
|
|
30
|
+
│ │ gemini [options] │
|
|
31
|
+
│ └────────────────────┘
|
|
32
|
+
└─────────────────────────────────────────────────────────────┘
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Components
|
|
36
|
+
|
|
37
|
+
### 1. Gemini SubAgent (`agents/gemini-agent.md`)
|
|
38
|
+
|
|
39
|
+
A specialized agent that can be invoked via the Task tool with `subagent_type='gemini'`.
|
|
40
|
+
|
|
41
|
+
**Purpose:**
|
|
42
|
+
- Delegate complex reasoning tasks to Gemini
|
|
43
|
+
- Leverage Gemini's strengths in creative problem-solving
|
|
44
|
+
- Handle tasks requiring different reasoning approaches
|
|
45
|
+
|
|
46
|
+
**Key Features:**
|
|
47
|
+
- Automatic prompt construction
|
|
48
|
+
- Output format handling (text/json)
|
|
49
|
+
- Error handling and retry logic
|
|
50
|
+
- Session management support
|
|
51
|
+
|
|
52
|
+
**When to Use:**
|
|
53
|
+
- Complex algorithm design
|
|
54
|
+
- Data analysis and interpretation
|
|
55
|
+
- Creative content generation
|
|
56
|
+
- Alternative perspectives on problems
|
|
57
|
+
- Tasks benefiting from Gemini's specific capabilities
|
|
58
|
+
|
|
59
|
+
### 2. Gemini Skill (`skills/gemini/skill.md`)
|
|
60
|
+
|
|
61
|
+
A user-invocable skill accessible via `/gemini` command.
|
|
62
|
+
|
|
63
|
+
**Purpose:**
|
|
64
|
+
- Quick access to Gemini from the command line
|
|
65
|
+
- Interactive mode for iterative problem-solving
|
|
66
|
+
- Direct user control over Gemini interactions
|
|
67
|
+
|
|
68
|
+
**Key Features:**
|
|
69
|
+
- Simple syntax: `/gemini <query>`
|
|
70
|
+
- Support for interactive mode
|
|
71
|
+
- Model selection
|
|
72
|
+
- YOLO mode for automation
|
|
73
|
+
|
|
74
|
+
**When to Use:**
|
|
75
|
+
- User wants direct Gemini interaction
|
|
76
|
+
- Quick queries and clarifications
|
|
77
|
+
- Experimenting with different models
|
|
78
|
+
- When Claude suggests consulting Gemini
|
|
79
|
+
|
|
80
|
+
## Design Principles
|
|
81
|
+
|
|
82
|
+
### 1. Complementary Strengths
|
|
83
|
+
|
|
84
|
+
**Claude excels at:**
|
|
85
|
+
- Code editing and refactoring
|
|
86
|
+
- File system operations
|
|
87
|
+
- Git operations
|
|
88
|
+
- Understanding existing codebases
|
|
89
|
+
- Following strict patterns and conventions
|
|
90
|
+
|
|
91
|
+
**Gemini excels at:**
|
|
92
|
+
- Creative problem-solving
|
|
93
|
+
- Complex logical reasoning
|
|
94
|
+
- Data analysis and interpretation
|
|
95
|
+
- Explaining concepts in different ways
|
|
96
|
+
- Exploring alternative approaches
|
|
97
|
+
|
|
98
|
+
### 2. Seamless Integration
|
|
99
|
+
|
|
100
|
+
The integration should feel natural:
|
|
101
|
+
- Claude decides when to delegate to Gemini
|
|
102
|
+
- Results are automatically integrated into Claude's workflow
|
|
103
|
+
- Users can explicitly request Gemini via `/gemini`
|
|
104
|
+
- Clear attribution of which AI generated what
|
|
105
|
+
|
|
106
|
+
### 3. Flexible Invocation
|
|
107
|
+
|
|
108
|
+
**Programmatic (SubAgent):**
|
|
109
|
+
```typescript
|
|
110
|
+
// Claude internally decides to use Gemini
|
|
111
|
+
Task({
|
|
112
|
+
subagent_type: 'gemini',
|
|
113
|
+
prompt: 'Design an efficient algorithm for...',
|
|
114
|
+
description: 'Algorithm design with Gemini'
|
|
115
|
+
})
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**User-Driven (Skill):**
|
|
119
|
+
```bash
|
|
120
|
+
/gemini How should I structure my database schema for...
|
|
121
|
+
/gemini -m gemini-2.0-flash-thinking-exp Explain the trade-offs...
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Integration Patterns
|
|
125
|
+
|
|
126
|
+
### Pattern 1: Claude Plans, Gemini Designs
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
User: "Build a recommendation engine"
|
|
130
|
+
↓
|
|
131
|
+
Claude: Analyzes codebase, identifies requirements
|
|
132
|
+
↓
|
|
133
|
+
Claude → Gemini: "Design recommendation algorithm considering..."
|
|
134
|
+
↓
|
|
135
|
+
Gemini: Returns algorithm design
|
|
136
|
+
↓
|
|
137
|
+
Claude: Implements design in code
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Pattern 2: Iterative Refinement
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
User: "Optimize this SQL query"
|
|
144
|
+
↓
|
|
145
|
+
Claude: Analyzes current query
|
|
146
|
+
↓
|
|
147
|
+
Claude → Gemini: "Suggest optimizations for this query..."
|
|
148
|
+
↓
|
|
149
|
+
Gemini: Returns optimization suggestions
|
|
150
|
+
↓
|
|
151
|
+
Claude: Applies optimizations
|
|
152
|
+
↓
|
|
153
|
+
Claude: Runs tests and validates
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Pattern 3: Direct User Consultation
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
User: "/gemini What's the best approach for caching in microservices?"
|
|
160
|
+
↓
|
|
161
|
+
Gemini: Explains various caching strategies
|
|
162
|
+
↓
|
|
163
|
+
User: Discusses with Claude which to implement
|
|
164
|
+
↓
|
|
165
|
+
Claude: Implements chosen strategy
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Technical Implementation
|
|
169
|
+
|
|
170
|
+
### Gemini CLI Invocation
|
|
171
|
+
|
|
172
|
+
The system uses the installed Gemini CLI (`/opt/homebrew/bin/gemini`) with various modes:
|
|
173
|
+
|
|
174
|
+
**One-shot mode:**
|
|
175
|
+
```bash
|
|
176
|
+
gemini "Design a caching strategy for..."
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
**Interactive mode:**
|
|
180
|
+
```bash
|
|
181
|
+
gemini -i "Let's design an API structure..."
|
|
182
|
+
# Continues interactively
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
**JSON output:**
|
|
186
|
+
```bash
|
|
187
|
+
gemini -o json "Analyze this data structure..."
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
**Specific model:**
|
|
191
|
+
```bash
|
|
192
|
+
gemini -m gemini-2.0-flash-thinking-exp "Complex reasoning task..."
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### Output Processing
|
|
196
|
+
|
|
197
|
+
1. **Text output:** Direct integration into conversation
|
|
198
|
+
2. **JSON output:** Structured data for programmatic processing
|
|
199
|
+
3. **Stream JSON:** Real-time updates for long-running tasks
|
|
200
|
+
|
|
201
|
+
### Error Handling
|
|
202
|
+
|
|
203
|
+
- Graceful fallback if Gemini CLI unavailable
|
|
204
|
+
- Timeout handling for long-running requests
|
|
205
|
+
- Clear error messages to user
|
|
206
|
+
- Retry logic for transient failures
|
|
207
|
+
|
|
208
|
+
## Security Considerations
|
|
209
|
+
|
|
210
|
+
1. **Input Sanitization:**
|
|
211
|
+
- Validate all inputs before passing to Gemini CLI
|
|
212
|
+
- Escape shell special characters
|
|
213
|
+
- Prevent command injection
|
|
214
|
+
|
|
215
|
+
2. **Output Validation:**
|
|
216
|
+
- Parse and validate Gemini responses
|
|
217
|
+
- Sanitize before code generation
|
|
218
|
+
- Review before executing suggested commands
|
|
219
|
+
|
|
220
|
+
3. **API Key Management:**
|
|
221
|
+
- Gemini CLI handles authentication
|
|
222
|
+
- No API keys stored in code
|
|
223
|
+
- Uses user's configured credentials
|
|
224
|
+
|
|
225
|
+
## Performance Considerations
|
|
226
|
+
|
|
227
|
+
1. **Caching:**
|
|
228
|
+
- Cache frequent queries
|
|
229
|
+
- Store session results
|
|
230
|
+
- Reuse previous Gemini insights
|
|
231
|
+
|
|
232
|
+
2. **Parallel Execution:**
|
|
233
|
+
- Run Gemini tasks in background when possible
|
|
234
|
+
- Don't block Claude's other operations
|
|
235
|
+
- Use appropriate timeouts
|
|
236
|
+
|
|
237
|
+
3. **Resource Management:**
|
|
238
|
+
- Monitor Gemini CLI process
|
|
239
|
+
- Clean up stale sessions
|
|
240
|
+
- Limit concurrent Gemini calls
|
|
241
|
+
|
|
242
|
+
## Future Enhancements
|
|
243
|
+
|
|
244
|
+
1. **Advanced Features:**
|
|
245
|
+
- Multi-turn Gemini conversations
|
|
246
|
+
- Vision capabilities for screenshots
|
|
247
|
+
- Code review collaboration (Claude + Gemini)
|
|
248
|
+
|
|
249
|
+
2. **Configuration:**
|
|
250
|
+
- Per-project Gemini settings
|
|
251
|
+
- Custom prompts and templates
|
|
252
|
+
- Model selection preferences
|
|
253
|
+
|
|
254
|
+
3. **Analytics:**
|
|
255
|
+
- Track Gemini usage
|
|
256
|
+
- Measure effectiveness
|
|
257
|
+
- Optimize delegation patterns
|
|
258
|
+
|
|
259
|
+
## Examples
|
|
260
|
+
|
|
261
|
+
See `skills/gemini/examples.md` for detailed usage examples.
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "gemini-executor",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Integration layer combining Google's Gemini CLI with Claude Code for complementary AI collaboration",
|
|
5
|
+
"main": "dist/agents/gemini-executor/index.js",
|
|
6
|
+
"types": "dist/agents/gemini-executor/index.d.ts",
|
|
7
|
+
"author": "mokasz",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/mokasz/gemini-executor.git"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"gemini",
|
|
15
|
+
"claude",
|
|
16
|
+
"ai",
|
|
17
|
+
"cli",
|
|
18
|
+
"integration",
|
|
19
|
+
"multimodal",
|
|
20
|
+
"agent",
|
|
21
|
+
"claude-code",
|
|
22
|
+
"gemini-cli"
|
|
23
|
+
],
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=18.0.0"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "tsc",
|
|
29
|
+
"dev": "tsc --watch",
|
|
30
|
+
"test": "jest",
|
|
31
|
+
"test:watch": "jest --watch",
|
|
32
|
+
"test:coverage": "jest --coverage",
|
|
33
|
+
"lint": "eslint . --ext .ts,.js",
|
|
34
|
+
"format": "prettier --write \"**/*.{ts,js,json,md}\"",
|
|
35
|
+
"clean": "rm -rf dist"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@types/node": "^20.0.0"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@types/jest": "^29.0.0",
|
|
42
|
+
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
43
|
+
"@typescript-eslint/parser": "^6.0.0",
|
|
44
|
+
"eslint": "^8.0.0",
|
|
45
|
+
"jest": "^29.0.0",
|
|
46
|
+
"prettier": "^3.0.0",
|
|
47
|
+
"ts-jest": "^29.0.0",
|
|
48
|
+
"typescript": "^5.0.0"
|
|
49
|
+
},
|
|
50
|
+
"files": [
|
|
51
|
+
"dist",
|
|
52
|
+
"agents",
|
|
53
|
+
"skills",
|
|
54
|
+
"docs",
|
|
55
|
+
"README.md",
|
|
56
|
+
"LICENSE"
|
|
57
|
+
]
|
|
58
|
+
}
|
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
# Gemini Skill
|
|
2
|
+
|
|
3
|
+
User-invocable skill for direct interaction with Google's Gemini CLI from Claude Code.
|
|
4
|
+
|
|
5
|
+
## Command Syntax
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
/gemini [options] <query>
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Basic Usage
|
|
12
|
+
|
|
13
|
+
### Simple Query
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
/gemini Explain how async/await works in JavaScript
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### With Specific Model
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
/gemini -m gemini-2.0-flash-thinking-exp Design a caching strategy for high-traffic API
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### JSON Output
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
/gemini -o json Extract UI components from this design image
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Interactive Mode
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
/gemini -i Let's brainstorm ideas for improving code architecture
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Options
|
|
38
|
+
|
|
39
|
+
| Option | Alias | Description | Example |
|
|
40
|
+
|--------|-------|-------------|---------|
|
|
41
|
+
| `--model <name>` | `-m` | Specify model to use | `-m gemini-2.0-flash` |
|
|
42
|
+
| `--output <format>` | `-o` | Output format (text, json, stream-json) | `-o json` |
|
|
43
|
+
| `--interactive` | `-i` | Enable interactive mode | `-i` |
|
|
44
|
+
| `--files <paths>` | `-f` | Include file references | `-f ./src/index.ts` |
|
|
45
|
+
| `--help` | `-h` | Show help message | `-h` |
|
|
46
|
+
|
|
47
|
+
## Available Models
|
|
48
|
+
|
|
49
|
+
- `gemini-2.0-flash` (default) - Fast, balanced performance
|
|
50
|
+
- `gemini-2.0-flash-thinking-exp` - Advanced reasoning capabilities
|
|
51
|
+
- `gemini-pro` - Enhanced capabilities for complex tasks
|
|
52
|
+
|
|
53
|
+
## When to Use This Skill
|
|
54
|
+
|
|
55
|
+
### Automatic Triggers
|
|
56
|
+
|
|
57
|
+
This skill is automatically suggested when:
|
|
58
|
+
|
|
59
|
+
1. **Multimodal Files**: User mentions image, PDF, audio, or video files
|
|
60
|
+
2. **Large Context**: User requests analysis of entire project or large codebase
|
|
61
|
+
3. **Explicit Request**: User says "use Gemini", "ask Gemini", or "/gemini"
|
|
62
|
+
|
|
63
|
+
### Manual Invocation
|
|
64
|
+
|
|
65
|
+
Invoke manually for:
|
|
66
|
+
|
|
67
|
+
- Quick questions and clarifications
|
|
68
|
+
- Alternative perspectives on problems
|
|
69
|
+
- Creative brainstorming
|
|
70
|
+
- Data analysis and interpretation
|
|
71
|
+
- Experimenting with different models
|
|
72
|
+
|
|
73
|
+
## Examples
|
|
74
|
+
|
|
75
|
+
### Example 1: Code Review
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
/gemini Review this code for security vulnerabilities and suggest improvements
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Example 2: Architecture Analysis
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
/gemini -m gemini-2.0-flash-thinking-exp Analyze this project structure and suggest architectural improvements
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Example 3: UI Design Analysis
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
/gemini -f ./designs/mockup.png Extract all UI components and their specifications from this design
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Example 4: Data Analysis
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
/gemini -o json Analyze this dataset and identify trends ./data/metrics.csv
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Example 5: Interactive Problem Solving
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
/gemini -i I need help designing a scalable authentication system
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Workflow
|
|
106
|
+
|
|
107
|
+
### 1. Intent Recognition
|
|
108
|
+
|
|
109
|
+
When you invoke `/gemini`, Claude:
|
|
110
|
+
- Parses your command and options
|
|
111
|
+
- Validates file paths and inputs
|
|
112
|
+
- Detects multimodal content
|
|
113
|
+
|
|
114
|
+
### 2. Task Delegation
|
|
115
|
+
|
|
116
|
+
Claude delegates to the gemini-executor SubAgent:
|
|
117
|
+
```
|
|
118
|
+
User → /gemini command
|
|
119
|
+
→ Claude parses and validates
|
|
120
|
+
→ Task tool with subagent_type='gemini-executor'
|
|
121
|
+
→ Gemini CLI execution
|
|
122
|
+
→ Result returned to Claude
|
|
123
|
+
→ Claude formats and presents to user
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### 3. Result Presentation
|
|
127
|
+
|
|
128
|
+
Claude presents results in a user-friendly format:
|
|
129
|
+
- Summary of key points
|
|
130
|
+
- Full Gemini output (expandable)
|
|
131
|
+
- Suggested next actions
|
|
132
|
+
- Related code snippets (if applicable)
|
|
133
|
+
|
|
134
|
+
## Integration with Claude
|
|
135
|
+
|
|
136
|
+
### Complementary Workflow
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
1. User: "Analyze this UI design mockup.png"
|
|
140
|
+
2. Claude: [Detects image file, suggests /gemini skill]
|
|
141
|
+
3. Gemini: [Analyzes image, extracts components]
|
|
142
|
+
4. Claude: [Receives analysis, implements React components]
|
|
143
|
+
5. Result: Working UI implementation based on design
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Context Isolation
|
|
147
|
+
|
|
148
|
+
Gemini's lengthy outputs are processed separately:
|
|
149
|
+
|
|
150
|
+
**Without isolation:**
|
|
151
|
+
```
|
|
152
|
+
Gemini output (5000 lines) → Main conversation
|
|
153
|
+
→ Context overflow
|
|
154
|
+
→ Subsequent responses affected
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**With isolation:**
|
|
158
|
+
```
|
|
159
|
+
Gemini output (5000 lines) → SubAgent processing
|
|
160
|
+
→ Summary (50 lines) → Main conversation
|
|
161
|
+
→ Context preserved
|
|
162
|
+
→ Details available on demand
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Output Formats
|
|
166
|
+
|
|
167
|
+
### Text (Default)
|
|
168
|
+
|
|
169
|
+
Plain text response from Gemini:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
/gemini Explain dependency injection
|
|
173
|
+
|
|
174
|
+
# Returns formatted text explanation
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### JSON
|
|
178
|
+
|
|
179
|
+
Structured data output:
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
/gemini -o json List the main components in this architecture
|
|
183
|
+
|
|
184
|
+
# Returns parsed JSON:
|
|
185
|
+
{
|
|
186
|
+
"components": [
|
|
187
|
+
{"name": "API Gateway", "type": "service"},
|
|
188
|
+
{"name": "Auth Service", "type": "microservice"}
|
|
189
|
+
]
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Stream JSON
|
|
194
|
+
|
|
195
|
+
Real-time updates for long-running tasks:
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
/gemini -o stream-json Analyze entire codebase for patterns
|
|
199
|
+
|
|
200
|
+
# Returns streaming JSON with progress updates
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## Security Considerations
|
|
204
|
+
|
|
205
|
+
### Automatic Checks
|
|
206
|
+
|
|
207
|
+
The skill automatically:
|
|
208
|
+
- ✅ Validates file paths
|
|
209
|
+
- ✅ Detects sensitive files (.env, credentials, etc.)
|
|
210
|
+
- ✅ Sanitizes user inputs
|
|
211
|
+
- ✅ Prevents command injection
|
|
212
|
+
- ✅ Warns about potential security issues
|
|
213
|
+
|
|
214
|
+
### User Confirmations
|
|
215
|
+
|
|
216
|
+
You'll be asked to confirm when:
|
|
217
|
+
- Processing sensitive files
|
|
218
|
+
- Accessing large numbers of files
|
|
219
|
+
- Using experimental features
|
|
220
|
+
|
|
221
|
+
## Limitations
|
|
222
|
+
|
|
223
|
+
### File Size Limits
|
|
224
|
+
|
|
225
|
+
- **Images**: max 20MB
|
|
226
|
+
- **PDFs/Audio/Video**: max 100MB
|
|
227
|
+
- **Text files**: no hard limit (subject to context window)
|
|
228
|
+
|
|
229
|
+
### Rate Limits
|
|
230
|
+
|
|
231
|
+
- Subject to Gemini API free tier limits
|
|
232
|
+
- Daily usage quotas apply
|
|
233
|
+
- Automatic retry on temporary failures
|
|
234
|
+
|
|
235
|
+
### Context Window
|
|
236
|
+
|
|
237
|
+
- Maximum 1M tokens
|
|
238
|
+
- Approximately 750k words
|
|
239
|
+
- Or ~3000 pages of text
|
|
240
|
+
|
|
241
|
+
## Troubleshooting
|
|
242
|
+
|
|
243
|
+
### Gemini CLI Not Found
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
Error: Gemini CLI not found at /opt/homebrew/bin/gemini
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
**Solution:**
|
|
250
|
+
```bash
|
|
251
|
+
# Install via Homebrew
|
|
252
|
+
brew install gemini-cli
|
|
253
|
+
|
|
254
|
+
# Or verify installation path
|
|
255
|
+
which gemini
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### Timeout Errors
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
Error: Command timeout after 120000ms
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
**Solution:**
|
|
265
|
+
```bash
|
|
266
|
+
# Use thinking model for complex queries
|
|
267
|
+
/gemini -m gemini-2.0-flash-thinking-exp <your query>
|
|
268
|
+
|
|
269
|
+
# Or increase timeout (requires config change)
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### File Not Found
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
Error: File not found: ./nonexistent.txt
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
**Solution:**
|
|
279
|
+
- Verify file path is correct
|
|
280
|
+
- Use absolute paths for clarity
|
|
281
|
+
- Check file permissions
|
|
282
|
+
|
|
283
|
+
### JSON Parsing Errors
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
Error: Failed to parse JSON output
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
**Solution:**
|
|
290
|
+
```bash
|
|
291
|
+
# Request explicit JSON format
|
|
292
|
+
/gemini -o json <your query>
|
|
293
|
+
|
|
294
|
+
# Or use text format
|
|
295
|
+
/gemini -o text <your query>
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
## Best Practices
|
|
299
|
+
|
|
300
|
+
### DO ✅
|
|
301
|
+
|
|
302
|
+
- Use specific, clear queries
|
|
303
|
+
- Specify model for complex tasks
|
|
304
|
+
- Include relevant file references
|
|
305
|
+
- Use JSON output for structured data
|
|
306
|
+
- Break large tasks into smaller queries
|
|
307
|
+
|
|
308
|
+
### DON'T ❌
|
|
309
|
+
|
|
310
|
+
- Include sensitive data in queries
|
|
311
|
+
- Process untrusted files without review
|
|
312
|
+
- Exceed rate limits with rapid requests
|
|
313
|
+
- Rely solely on Gemini for code implementation
|
|
314
|
+
- Ignore security warnings
|
|
315
|
+
|
|
316
|
+
## Advanced Usage
|
|
317
|
+
|
|
318
|
+
### Chaining Commands
|
|
319
|
+
|
|
320
|
+
```bash
|
|
321
|
+
# Step 1: Analyze
|
|
322
|
+
/gemini -o json Analyze this codebase architecture ./src
|
|
323
|
+
|
|
324
|
+
# Step 2: Use results
|
|
325
|
+
Based on the analysis, implement the suggested improvements
|
|
326
|
+
|
|
327
|
+
# Step 3: Verify
|
|
328
|
+
/gemini Review the implemented changes
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### Custom Models
|
|
332
|
+
|
|
333
|
+
```bash
|
|
334
|
+
# Use experimental thinking model
|
|
335
|
+
/gemini -m gemini-2.0-flash-thinking-exp Solve this complex algorithm problem
|
|
336
|
+
|
|
337
|
+
# Use standard model for simple tasks
|
|
338
|
+
/gemini -m gemini-2.0-flash Quick question about syntax
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
### Batch Processing
|
|
342
|
+
|
|
343
|
+
```bash
|
|
344
|
+
# Process multiple files
|
|
345
|
+
/gemini -f ./docs/spec.md,./src/index.ts,./tests/unit.test.ts Analyze consistency across these files
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
## Related Documentation
|
|
349
|
+
|
|
350
|
+
- [SubAgent Documentation](../../agents/gemini-executor/README.md) - Technical implementation details
|
|
351
|
+
- [Architecture Guide](../../docs/architecture.md) - System design and patterns
|
|
352
|
+
- [Contributing Guide](../../CONTRIBUTING.md) - How to contribute
|
|
353
|
+
|
|
354
|
+
## Support
|
|
355
|
+
|
|
356
|
+
- **Issues**: [GitHub Issues](https://github.com/mokasz/gemini-executor/issues)
|
|
357
|
+
- **Discussions**: [GitHub Discussions](https://github.com/mokasz/gemini-executor/discussions)
|
|
358
|
+
- **Documentation**: [Full Documentation](../../README.md)
|
|
359
|
+
|
|
360
|
+
---
|
|
361
|
+
|
|
362
|
+
**Tip**: Start with simple queries to get familiar with the skill, then explore advanced features like interactive mode and custom models.
|