Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .goji.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
"aichoices": {
"phind": {
"model": "Phind-70B"
},
"openai": {
"model": ""
},
Expand All @@ -20,9 +17,12 @@
},
"deepseek": {
"model": ""
},
"gemini": {
"model": "gemini-2.5-flash-lite"
}
},
"aiprovider": "phind",
"aiprovider": "gemini",
"noemoji": false,
"scopes": [
"home",
Expand Down
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"sarif-viewer.connectToGithubCodeScanning": "off"
}
146 changes: 106 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ for selecting the type of change, scope, and description of your commit message.
- Customizable commit types and scopes through a JSON configuration file.
- Supports Git out of the box
- AI generated commit messages using multiple providers:
- **Phind** (default, no API key required)
- **Gemini** (OAuth login with Google account or API key, uses Gemini Flash)
- **OpenRouter** (default, access to multiple models, requires API key)
- **Groq** (fast inference, requires API key)
- **OpenRouter** (access to multiple models, requires API key)
- Intelligent large diff handling with automatic summarization
- No rate limiting issues with smart diff compression

Expand Down Expand Up @@ -134,16 +134,20 @@ This command connects to an AI provider to generate a commit message based on yo

### Quick Start

**1. Set up environment variables (if using Groq or OpenRouter):**
**1. Set up authentication:**

```sh
# For Groq
export GROQ_API_KEY="your-groq-api-key"
# For Gemini (OAuth - recommended, like Gemini CLI)
export GOOGLE_CLIENT_ID="your-client-id.apps.googleusercontent.com"

# OR for Gemini (API key)
export GEMINI_API_KEY="your-gemini-api-key"

# For OpenRouter
# For OpenRouter (default)
export OPENROUTER_API_KEY="your-openrouter-api-key"

# For Phind (no setup needed)
# For Groq
export GROQ_API_KEY="your-groq-api-key"
```

**2. Generate and commit:**
Expand Down Expand Up @@ -180,52 +184,76 @@ goji draft --body --commit

Goji supports multiple AI providers for generating commit messages. Configure your preferred provider in the `.goji.json` file:

#### 1. Phind (Default - No API Key Required)
#### 1. Gemini (OAuth Login - Like Gemini CLI)

Phind is the default provider and doesn't require any API keys.
Use your Google account to authenticate with Gemini, or use an API key. Uses Gemini Flash by default.

```json
{
"aiprovider": "phind",
"aichoices": {
"phind": {
"model": "Phind-70B"
}
}
}
```
**Setup with OAuth (Recommended - Browser Login):**

#### 2. Groq
Similar to Gemini CLI's "Login with Google" feature - just open browser and sign in!

Fast inference with various models. Requires a Groq API key.
1. **One-time setup:** Get an OAuth client ID:
- Visit: <https://console.cloud.google.com/apis/credentials>
- Click "Create Credentials" → "OAuth client ID"
- Application type: **Desktop app**
- Name it (e.g., "Goji CLI")
- Copy the **Client ID** (you don't need the secret with PKCE)

**Setup:**
2. **Set the client ID:**

```sh
export GOOGLE_CLIENT_ID="your-client-id.apps.googleusercontent.com"
```

3. **Run goji:**

```sh
goji draft
```

- Browser will open automatically
- Sign in with your Google account
- Token is saved for future use

**Setup with API Key (Simpler):**

```sh
export GROQ_API_KEY="your-groq-api-key"
export GEMINI_API_KEY="your-gemini-api-key"
```

**Configuration:**

```json
{
"aiprovider": "groq",
"aiprovider": "gemini",
"aichoices": {
"groq": {
"model": "mixtral-8x7b-32768"
"gemini": {
"model": "gemini-3-flash-preview"
}
}
}
```

**Available Models:**

- `mixtral-8x7b-32768` (default)
- `llama2-70b-4096`
- `llama2-13b-chat`
- `gemma-7b-it`
- `gemini-3-flash-preview` (default, recommended)
- `gemini-1.5-pro`
- `gemini-1.5-flash`

#### 3. OpenRouter
**Authentication Methods:**

1. **Login with Google (OAuth - Recommended)** - Like Gemini CLI
- One-time setup: Create OAuth client ID in Google Cloud Console
- Set `GOOGLE_CLIENT_ID` environment variable
- Browser opens automatically for login
- No API key needed
- Uses PKCE flow (secure, no client secret required)

2. **API Key** - Simpler alternative
- Get from [Google AI Studio](https://makersuite.google.com/app/apikey)
- Set `GEMINI_API_KEY` environment variable

#### 2. OpenRouter (Default)

Access to multiple AI models through a single API. Requires an OpenRouter API key.

Expand Down Expand Up @@ -256,6 +284,36 @@ export OPENROUTER_API_KEY="your-openrouter-api-key"
- `meta-llama/llama-3.1-405b-instruct`
- `google/gemini-pro-1.5`

#### 3. Groq

Fast inference with various models. Requires a Groq API key.

**Setup:**

```sh
export GROQ_API_KEY="your-groq-api-key"
```

**Configuration:**

```json
{
"aiprovider": "groq",
"aichoices": {
"groq": {
"model": "mixtral-8x7b-32768"
}
}
}
```

**Available Models:**

- `mixtral-8x7b-32768` (default)
- `llama2-70b-4096`
- `llama2-13b-chat`
- `gemma-7b-it`

### Large Diff Handling

Goji automatically handles large diffs using intelligent summarization:
Expand Down Expand Up @@ -310,10 +368,10 @@ Update your `.goji.json` to configure AI providers:

```json
{
"aiprovider": "groq",
"aiprovider": "gemini",
"aichoices": {
"phind": {
"model": "Phind-70B"
"gemini": {
"model": "gemini-3-flash-preview"
},
"groq": {
"model": "mixtral-8x7b-32768"
Expand All @@ -333,26 +391,34 @@ Goji uses environment variables to authenticate with AI providers. Set these in

| Provider | Environment Variable | Required | Description |
|----------|---------------------|----------|-------------|
| **Phind** | None | ❌ | Works out of the box |
| **Groq** | `GROQ_API_KEY` | ✅ | Get from [Groq Console](https://console.groq.com) |
| **Gemini** | `GOOGLE_CLIENT_ID` (for OAuth) or `GEMINI_API_KEY` (for API key) | ❌ | OAuth via browser login (like Gemini CLI) - set `GOOGLE_CLIENT_ID` once, then browser opens automatically. Or use API key from [Google AI Studio](https://makersuite.google.com/app/apikey) |
| **OpenRouter** | `OPENROUTER_API_KEY` | ✅ | Get from [OpenRouter](https://openrouter.ai) |
| **Groq** | `GROQ_API_KEY` | ✅ | Get from [Groq Console](https://console.groq.com) |

**For Groq:**

```sh
export GROQ_API_KEY="your-groq-api-key"
```

**For OpenRouter:**
**For Gemini (OAuth - recommended, like Gemini CLI):**

```sh
export OPENROUTER_API_KEY="your-openrouter-api-key"
# One-time: Get client ID from Google Cloud Console
export GOOGLE_CLIENT_ID="your-client-id.apps.googleusercontent.com"
# Then run goji draft - browser will open for login
```

**For Gemini (API key):**

```sh
export GEMINI_API_KEY="your-gemini-api-key"
```

**For Phind:**
**For OpenRouter:**

```sh
# No environment variables required - works out of the box
export OPENROUTER_API_KEY="your-openrouter-api-key"
```

#### Setting Environment Variables
Expand Down
6 changes: 3 additions & 3 deletions cmd/completion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ func TestCompletionCmd_Run(t *testing.T) {
os.Stdout = w

testCmd := &cobra.Command{Use: "testcmd"}
testCmd.GenZshCompletion(os.Stdout)
_ = testCmd.GenZshCompletion(os.Stdout)

_ = w.Close()
os.Stdout = originalStdout
Expand All @@ -257,7 +257,7 @@ func TestCompletionCmd_Run(t *testing.T) {
os.Stdout = w

testCmd := &cobra.Command{Use: "testcmd"}
testCmd.GenFishCompletion(os.Stdout, true)
_ = testCmd.GenFishCompletion(os.Stdout, true)

_ = w.Close()
os.Stdout = originalStdout
Expand All @@ -273,7 +273,7 @@ func TestCompletionCmd_Run(t *testing.T) {
os.Stdout = w

testCmd := &cobra.Command{Use: "testcmd"}
testCmd.GenPowerShellCompletionWithDesc(os.Stdout)
_ = testCmd.GenPowerShellCompletionWithDesc(os.Stdout)

_ = w.Close()
os.Stdout = originalStdout
Expand Down
Loading
Loading