Skip to content

Commit 6ea4b1c

Browse files
author
Hieu Hoang
committed
Revert "Remove Gemini CLI provider (RooCodeInc#5223)"
This reverts commit d64e677.
1 parent 18c4d1a commit 6ea4b1c

File tree

16 files changed

+1295
-4
lines changed

16 files changed

+1295
-4
lines changed

CLAUDE.md

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
Roo Code is an AI-powered VS Code extension that acts as a development assistant. It's built as a monorepo using pnpm workspaces and TypeScript with Turbo for build orchestration.
8+
9+
## Architecture
10+
11+
### Monorepo Structure
12+
- **Root**: Main extension code in `src/`
13+
- **Packages/**: Shared workspace packages:
14+
- `@roo-code/types`: Shared TypeScript types and interfaces
15+
- `@roo-code/config-eslint`: ESLint configuration
16+
- `@roo-code/config-typescript`: TypeScript configuration
17+
- `@roo-code/build`: Build utilities
18+
- `@roo-code/ipc`: Inter-process communication
19+
- `@roo-code/cloud`: Cloud services integration
20+
- `@roo-code/telemetry`: Telemetry and analytics
21+
- `@roo-code/evals`: Evaluation framework
22+
23+
### Core Extension Architecture
24+
- **Entry Point**: `src/extension.ts` - Main extension activation
25+
- **Core**: `src/core/` - Core functionality including prompts, tools, and webview management
26+
- **API**: `src/api/` - Provider integrations for various AI models (40+ providers including OpenAI, Claude, Gemini, local models, etc.)
27+
- **Services**: `src/services/` - Core services (MCP server management, code indexing, checkpoints)
28+
- **Integrations**: `src/integrations/` - VS Code editor integrations, terminal handling, theme support
29+
- **Webview**: `webview-ui/` - React-based UI for the extension's chat interface
30+
31+
### Key Components
32+
- **Provider System**: Modular AI provider architecture in `src/api/providers/` with base classes and OpenAI-compatible implementations
33+
- **Tool System**: Extensible tool framework in `src/core/prompts/tools/` for file operations, browser automation, MCP integration
34+
- **MCP Integration**: Model Context Protocol server management for external tool integration
35+
- **Code Indexing**: Tree-sitter based code analysis and indexing system
36+
- **Terminal Integration**: Advanced terminal process management with shell integration
37+
- **I18n Support**: Full internationalization with 20+ language locales
38+
39+
## Development Commands
40+
41+
### Package Management
42+
```bash
43+
# Install all dependencies and bootstrap workspace
44+
pnpm install
45+
46+
# Clean all build artifacts
47+
pnpm clean
48+
```
49+
50+
### Development & Testing
51+
```bash
52+
# Run extension in development mode (F5 in VSCode)
53+
# Builds and opens new VSCode instance with extension loaded
54+
55+
# Lint all code
56+
pnpm lint
57+
58+
# Type checking
59+
pnpm check-types
60+
61+
# Run tests
62+
pnpm test
63+
64+
# Format code
65+
pnpm format
66+
```
67+
68+
### Building & Distribution
69+
```bash
70+
# Build extension
71+
pnpm build
72+
73+
# Create VSIX package for manual installation
74+
pnpm vsix
75+
76+
# Build and install VSIX directly to VSCode
77+
pnpm install:vsix [options]
78+
# Options: -y (skip confirmations), --editor=<command> (code/cursor/code-insiders)
79+
80+
# Nightly builds
81+
pnpm bundle:nightly
82+
pnpm vsix:nightly
83+
```
84+
85+
### Package-Specific Operations
86+
```bash
87+
# Build types package
88+
pnpm --filter @roo-code/types build
89+
90+
# Watch types package during development
91+
pnpm --filter @roo-code/types build:watch
92+
93+
# Publish types to npm
94+
pnpm npm:publish:types
95+
```
96+
97+
## Development Workflow
98+
99+
### Testing Individual Components
100+
- Use VSCode's built-in debugging (F5) for extension development
101+
- Extension hot-reloads automatically for most changes
102+
- Webview changes appear immediately in debug instance
103+
- Use `pnpm test` for unit tests, `pnpm lint` for code quality
104+
105+
### Adding New AI Providers
106+
1. Create provider in `src/api/providers/` extending `BaseProvider` or `BaseOpenAICompatibleProvider`
107+
2. Add provider to `src/api/providers/index.ts`
108+
3. Add types to `packages/types/src/providers/`
109+
4. Create React component in `webview-ui/src/components/settings/providers/`
110+
5. Add to webview provider index and constants
111+
112+
### Adding New Tools
113+
1. Define tool in `src/core/prompts/tools/` following existing patterns
114+
2. Implement tool execution logic
115+
3. Add to tools registry in prompt sections
116+
4. Test tool functionality through extension
117+
118+
### MCP Server Integration
119+
- MCP servers managed through `McpServerManager` in `src/services/mcp/`
120+
- Configuration through extension settings
121+
- Tools auto-discovered and made available to AI models
122+
123+
## Important Notes
124+
125+
- **Node Version**: Requires Node.js 20.19.2
126+
- **Package Manager**: Uses pnpm 10.8.1 (enforced by only-allow)
127+
- **Build System**: Turbo for workspace orchestration
128+
- **Testing**: Vitest for unit tests, extension testing through VSCode debugger
129+
- **Code Quality**: ESLint + Prettier, pre-commit hooks via Husky
130+
- **Type Safety**: Strict TypeScript with shared types package
131+
132+
### Git Workflow
133+
- Main development branch: `1696`
134+
- Uses changesets for version management
135+
- Pre-commit hooks run lint-staged for code formatting
136+
137+
### Environment Configuration
138+
- Environment variables loaded from `.env` in project root
139+
- Handles environment loading gracefully for development
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
import type { ModelInfo } from "../model.js"
2+
3+
// Gemini CLI models with free tier pricing (all $0)
4+
export type GeminiCliModelId = keyof typeof geminiCliModels
5+
6+
export const geminiCliDefaultModelId: GeminiCliModelId = "gemini-2.0-flash-001"
7+
8+
export const geminiCliModels = {
9+
"gemini-2.0-flash-001": {
10+
maxTokens: 8192,
11+
contextWindow: 1_048_576,
12+
supportsImages: true,
13+
supportsPromptCache: false,
14+
inputPrice: 0,
15+
outputPrice: 0,
16+
},
17+
"gemini-2.0-flash-thinking-exp-01-21": {
18+
maxTokens: 65_536,
19+
contextWindow: 1_048_576,
20+
supportsImages: true,
21+
supportsPromptCache: false,
22+
inputPrice: 0,
23+
outputPrice: 0,
24+
},
25+
"gemini-2.0-flash-thinking-exp-1219": {
26+
maxTokens: 8192,
27+
contextWindow: 32_767,
28+
supportsImages: true,
29+
supportsPromptCache: false,
30+
inputPrice: 0,
31+
outputPrice: 0,
32+
},
33+
"gemini-2.0-flash-exp": {
34+
maxTokens: 8192,
35+
contextWindow: 1_048_576,
36+
supportsImages: true,
37+
supportsPromptCache: false,
38+
inputPrice: 0,
39+
outputPrice: 0,
40+
},
41+
"gemini-1.5-flash-002": {
42+
maxTokens: 8192,
43+
contextWindow: 1_048_576,
44+
supportsImages: true,
45+
supportsPromptCache: false,
46+
inputPrice: 0,
47+
outputPrice: 0,
48+
},
49+
"gemini-1.5-flash-exp-0827": {
50+
maxTokens: 8192,
51+
contextWindow: 1_048_576,
52+
supportsImages: true,
53+
supportsPromptCache: false,
54+
inputPrice: 0,
55+
outputPrice: 0,
56+
},
57+
"gemini-1.5-flash-8b-exp-0827": {
58+
maxTokens: 8192,
59+
contextWindow: 1_048_576,
60+
supportsImages: true,
61+
supportsPromptCache: false,
62+
inputPrice: 0,
63+
outputPrice: 0,
64+
},
65+
"gemini-1.5-pro-002": {
66+
maxTokens: 8192,
67+
contextWindow: 2_097_152,
68+
supportsImages: true,
69+
supportsPromptCache: false,
70+
inputPrice: 0,
71+
outputPrice: 0,
72+
},
73+
"gemini-1.5-pro-exp-0827": {
74+
maxTokens: 8192,
75+
contextWindow: 2_097_152,
76+
supportsImages: true,
77+
supportsPromptCache: false,
78+
inputPrice: 0,
79+
outputPrice: 0,
80+
},
81+
"gemini-exp-1206": {
82+
maxTokens: 8192,
83+
contextWindow: 2_097_152,
84+
supportsImages: true,
85+
supportsPromptCache: false,
86+
inputPrice: 0,
87+
outputPrice: 0,
88+
},
89+
"gemini-2.5-flash": {
90+
maxTokens: 64_000,
91+
contextWindow: 1_048_576,
92+
supportsImages: true,
93+
supportsPromptCache: false,
94+
inputPrice: 0,
95+
outputPrice: 0,
96+
maxThinkingTokens: 24_576,
97+
supportsReasoningBudget: true,
98+
},
99+
"gemini-2.5-pro": {
100+
maxTokens: 64_000,
101+
contextWindow: 1_048_576,
102+
supportsImages: true,
103+
supportsPromptCache: false,
104+
inputPrice: 0,
105+
outputPrice: 0,
106+
maxThinkingTokens: 32_768,
107+
supportsReasoningBudget: true,
108+
requiredReasoningBudget: true,
109+
},
110+
} as const satisfies Record<string, ModelInfo>

packages/types/src/providers/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export * from "./doubao.js"
88
export * from "./featherless.js"
99
export * from "./fireworks.js"
1010
export * from "./gemini.js"
11+
export * from "./gemini-cli.js"
1112
export * from "./glama.js"
1213
export * from "./groq.js"
1314
export * from "./huggingface.js"

src/api/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
OpenAiHandler,
1717
LmStudioHandler,
1818
GeminiHandler,
19+
GeminiCliHandler,
1920
OpenAiNativeHandler,
2021
DeepSeekHandler,
2122
MoonshotHandler,
@@ -136,6 +137,8 @@ export function buildApiHandler(configuration: ProviderSettings): ApiHandler {
136137
return new LmStudioHandler(options)
137138
case "gemini":
138139
return new GeminiHandler(options)
140+
case "gemini-cli":
141+
return new GeminiCliHandler(options)
139142
case "openai-native":
140143
return new OpenAiNativeHandler(options)
141144
case "deepseek":

0 commit comments

Comments
 (0)