Skip to content

Commit 4320b1f

Browse files
committed
Add AI-Powered Git Commits blog post and Gist shortcode
- Created a new blog post titled "AI-Powered Git Commits: Alternative for GitHub Copilot with Mistral codestral" detailing the use of Mistral's Codestral API for generating commit messages. - Included a drop-in shell script for users to automate commit message generation. - Added a new shortcode for rendering Gist content in markdown format.
1 parent 0d652d4 commit 4320b1f

9 files changed

Lines changed: 308 additions & 182 deletions

adminEditor/data/categories.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
},
77
{
88
"name": "Software Development",
9-
"count": 6
9+
"count": 7
1010
}
1111
]
1212
}

adminEditor/data/tags.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
},
3131
{
3232
"name": "Mistral",
33-
"count": 1
33+
"count": 2
3434
},
3535
{
3636
"name": "streamlit",
@@ -46,11 +46,15 @@
4646
},
4747
{
4848
"name": "AI",
49-
"count": 1
49+
"count": 2
5050
},
5151
{
5252
"name": "Roo Code",
5353
"count": 1
54+
},
55+
{
56+
"name": "Git",
57+
"count": 1
5458
}
5559
]
5660
}
78.2 KB
Loading
229 KB
Loading
Lines changed: 67 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,67 @@
1-
---
2-
title: Use mistral or codestral API with cline
3-
description: Learn to integrate Mistral or Codestral API with Cline and other OpenAI-compatible APIs for seamless AI functionality - completely free.
4-
date: 2025-01-15T16:12:04.290Z
5-
tags:
6-
- Cline
7-
- Codestral
8-
- Mistral
9-
- Roo Cline
10-
- braintrust
11-
categories:
12-
- AI Tool
13-
thumbnail:
14-
url: /img/blog/cline_codestral.png
15-
lang: en
16-
slug: mistral-codestral-api-cline
17-
---
18-
19-
## Explanation: What is Cline and Roo Cline for Visual Studio Code?
20-
21-
**Cline** is a versatile tool designed to facilitate seamless integration with various AI models and APIs, enabling users to leverage advanced AI capabilities in their workflows. It provides a user-friendly interface for configuring and managing API keys, selecting models, and testing integrations.
22-
23-
**Roo Cline** is an extended or specialized version of Cline, often tailored for specific use cases or enhanced functionalities. It may include additional features, optimizations, or integrations that cater to more advanced or niche requirements.
24-
25-
## How to Use Mistral API with Cline or Cline fork
26-
27-
If you want to try out Cline for free, it is a good starting point to use the free Mistral API with **mistral-large-latest** or **codestral-latest**. Unfortunately, there is no direct way to use the Mistral API in Cline. However, by following these clear, step-by-step instructions, you can ensure a seamless integration.
28-
29-
## Step 1: Obtain a Free Mistral API Key
30-
31-
- **Source**: Acquire your free Mistral API key from the [Mistral AI console](https://console.mistral.ai/).
32-
33-
## Step 2: Access Cline Settings
34-
35-
- Navigate to the **Provider Settings** section in Cline, as shown in the configuration image.
36-
- Select **API Provider** - **OpenAI Compatible**
37-
- Use the image as a guide to locate the settings panel.
38-
39-
### Cline Version > v3.1.11
40-
41-
- API Provider: **Mistral**
42-
43-
The [Provider configuration](https://github.com/cline/cline/blob/main/src/api/providers/mistral.ts) could now directly used with the Mistral Typescript Client and serverURL: "https://codestral.mistral.ai".
44-
45-
## Step 3: Enter the API Key
46-
47-
- **Field**: Locate the **"API Key"** field within the Provider Settings.
48-
- **Input**: Paste your Mistral API key into this field. **Important**: Always use the Mistral API key, not the Codestral API key.
49-
- **Additional Settings**: Ensure any required fields, such as the API endpoint, are correctly set to **https://api.braintrust.dev/v1/proxy**.
50-
51-
## Step 4: Select the Correct Model
52-
53-
- **Model Selection**:
54-
- For Codestral: Enter **codestral-latest**.
55-
- For Mistral: Enter **mistral-large-latest**.
56-
57-
## Step 5: Test the Integration
58-
59-
- **Testing**: Enter a simple prompt to verify that the AI responds correctly. For example, create a `test.md` file with the current date.
60-
61-
## Step 6: Troubleshooting Common Issues
62-
63-
- **Common Errors**:
64-
- **Invalid API Key**: Verify the key's correctness and check for any typos.
65-
- **Model Not Found**: Ensure the model name is accurately entered.
66-
- **Security**: Keep your API keys secure and avoid sharing them publicly.
1+
---
2+
title: Use mistral or codestral API with cline
3+
description: Learn to integrate Mistral or Codestral API with Cline and other OpenAI-compatible APIs for seamless AI functionality - completely free.
4+
date: 2025-01-15T16:12:04.290Z
5+
tags:
6+
- Cline
7+
- Codestral
8+
- Mistral
9+
- Roo Cline
10+
- braintrust
11+
categories:
12+
- AI Tool
13+
thumbnail:
14+
url: /img/blog/cline_codestral.png
15+
author: d.o.
16+
lang: en
17+
slug: mistral-codestral-api-cline
18+
---
19+
20+
## Explanation: What is Cline and Roo Cline for Visual Studio Code?
21+
22+
**Cline** is a versatile tool designed to facilitate seamless integration with various AI models and APIs, enabling users to leverage advanced AI capabilities in their workflows. It provides a user-friendly interface for configuring and managing API keys, selecting models, and testing integrations.
23+
24+
**Roo Cline** is an extended or specialized version of Cline, often tailored for specific use cases or enhanced functionalities. It may include additional features, optimizations, or integrations that cater to more advanced or niche requirements.
25+
26+
## How to Use Mistral API with Cline or Cline fork
27+
28+
If you want to try out Cline for free, it is a good starting point to use the free Mistral API with **mistral-large-latest** or **codestral-latest**. Unfortunately, there is no direct way to use the Mistral API in Cline. However, by following these clear, step-by-step instructions, you can ensure a seamless integration.
29+
30+
## Step 1: Obtain a Free Mistral API Key
31+
32+
- **Source**: Acquire your free Mistral API key from the [Mistral AI console](https://console.mistral.ai/).
33+
34+
## Step 2: Access Cline Settings
35+
36+
- Navigate to the **Provider Settings** section in Cline, as shown in the configuration image.
37+
- Select **API Provider** - **OpenAI Compatible**
38+
- Use the image as a guide to locate the settings panel.
39+
40+
### Cline Version > v3.1.11
41+
42+
- API Provider: **Mistral**
43+
44+
The [Provider configuration](https://github.com/cline/cline/blob/main/src/api/providers/mistral.ts) could now directly used with the Mistral Typescript Client and serverURL: "https://codestral.mistral.ai".
45+
46+
## Step 3: Enter the API Key
47+
48+
- **Field**: Locate the **"API Key"** field within the Provider Settings.
49+
- **Input**: Paste your Mistral API key into this field. **Important**: Always use the Mistral API key, not the Codestral API key.
50+
- **Additional Settings**: Ensure any required fields, such as the API endpoint, are correctly set to **https://api.braintrust.dev/v1/proxy**.
51+
52+
## Step 4: Select the Correct Model
53+
54+
- **Model Selection**:
55+
- For Codestral: Enter **codestral-latest**.
56+
- For Mistral: Enter **mistral-large-latest**.
57+
58+
## Step 5: Test the Integration
59+
60+
- **Testing**: Enter a simple prompt to verify that the AI responds correctly. For example, create a `test.md` file with the current date.
61+
62+
## Step 6: Troubleshooting Common Issues
63+
64+
- **Common Errors**:
65+
- **Invalid API Key**: Verify the key's correctness and check for any typos.
66+
- **Model Not Found**: Ensure the model name is accurately entered.
67+
- **Security**: Keep your API keys secure and avoid sharing them publicly.
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
---
2+
title: "AI-Powered Git Commits: Alternative for GitHub Copilot with Mistral codestral"
3+
slug: ai-powered-git-commits-alternative-github-copilot-mistral-codestral
4+
description: Alternative for VSCode / Windsurf IDE git commit with GitHub Copilot with a lightweight shell script that calls Mistral’s free Codestral API.
5+
date: 2025-05-21T19:17:00Z
6+
tags:
7+
- Mistral
8+
- AI
9+
- Git
10+
categories:
11+
- Software Development
12+
thumbnail:
13+
url: /img/blog/ai-powered-git-commits-alternative-for-github-copilot-mistral-codestral.jpg
14+
author: d.o. (flux)
15+
---
16+
Building clear, concise commit messages can feel like a chore—especially when you’ve got context switching, PR reviews, and deadlines breathing down your neck. GitHub Copilot’s “generate commit” feature is handy, but you may hit retry limits or find that it simply won’t fire off a good message.
17+
18+
Enter **Codestral**, an AI‑powered chat API from Mistral that you can hook into your local workflow with a single shell script. Below, we’ll walk through:
19+
20+
1. Why you might look beyond Copilot for commit messages
21+
2. How to grab your free Codestral API key
22+
3. A drop‑in `.sh` script you can drop into your repo to generate and confirm AI‑crafted commit messages
23+
24+
---
25+
26+
## 1. When Copilot’s “Generate Commit” Hits Its Limit or Windsurf "is only available for users on a paid plan"
27+
28+
Copilot is great—and for many small changes, it nails the message on the first try. But if you:
29+
30+
* Push the “retry” button too many times
31+
* Get rate‑limited mid‑flow
32+
* Find its output too verbose or vague
33+
* Source: Windsurf
34+
35+
> AI commit message generation is only available for users on a paid plan.
36+
37+
By using an external AI backend via a simple `curl` call, you sidestep GitHub’s limits and get ultra‑low‑latency responses fine‑tuned for commit messages.
38+
39+
**Hint**: You could replace the codestral api with any other OpenAI-compatible API and model. Only replace:
40+
41+
* CODESTRAL_API_KEY -> FOO_API_KEY
42+
* DEFAULT_MODEL="foo-latest"
43+
* API_URL="https://my.foo.ai/v1/chat/completions"
44+
45+
## 2. Grab Your Free Codestral Key
46+
47+
Sign up for a free API key at Mistral’s console:
48+
49+
[La Plateforme - codestral](https://console.mistral.ai/codestral)
50+
51+
You’ll be prompted to log in or create an account, then copy your **Codestral API key**—a long alphanumeric token that you’ll stash in an environment variable or `.env` file.
52+
53+
## 3. Drop‑in Shell Script: `ai-git-commit.sh`
54+
55+
Below is an alternative to GitHub Copilot AI commit message generator. Save this as `scripts/ai-git-commit.sh` (or wherever you keep your helper scripts), make it executable, and watch it auto‑stage, summarize diffs, call Codestral, and prompt you for confirmation.
56+
57+
{{< gistmarkdown url="https://gist-githubusercontent-com.sihan.fun/d-oit/c184cc30804f1d79474782a991a47f4e/raw/94b202f3587e76aee604f134da79d8fc42b44859/ai-git-commit.sh" >}}
58+
59+
**How it works**:
60+
61+
* **Staging**: Automatically stages tracked changes, with an optional prompt for untracked files.
62+
* **Diffing**: Pulls in your staged diff (up to \~6,000 characters).
63+
* **Payload**: Wraps the diff in a JSON payload for the Codestral chat endpoint.
64+
* **API call**: Sends `model: codestral-latest` with low temperature to get a focused message.
65+
* **Cleanup**: Strips Markdown fences and polish quotes.
66+
* **Confirmation**: Shows you the AI’s message before committing.
67+
68+
{{< image class="rounded lightbox" src="./img/blog/ai-git-commit-windsurf.png" caption="Windsurf: AI commit" >}}
69+
70+
## Putting It All Together
71+
72+
1. **Install prerequisites**:
73+
74+
```bash
75+
brew install jq
76+
# or your distro’s package manager
77+
```
78+
79+
2. **Create a `.env`** at your project root:
80+
81+
```bash
82+
CODESTRAL_API_KEY=sk-<your-free-key>
83+
```
84+
85+
3. **Make the script executable**:
86+
87+
```bash
88+
chmod +x scripts/ai-git-commit.sh
89+
```
90+
91+
4. **Use it instead of `git commit`**:
92+
93+
```bash
94+
./scripts/ai-git-commit.sh
95+
```
96+
97+
Voilà—every commit message now backed by a world‑class open‑source AI model, with none of Copilot’s rate limits or UI hurdles.

hugo_stats.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"figure",
1414
"footer",
1515
"form",
16+
"h1",
1617
"h2",
1718
"h3",
1819
"h4",
@@ -128,6 +129,7 @@
128129
"carousel-inner",
129130
"carousel-item",
130131
"chroma",
132+
"code-block",
131133
"col",
132134
"col-10",
133135
"col-12",
@@ -482,10 +484,15 @@
482484
"/img/about_collage/SDC10933.JPG",
483485
"/img/about_collage/SDC11187.JPG",
484486
"1-capturing-with-postmans-built-in-proxy",
487+
"1-when-copilots-generate-commit-hits-its-limit-or-windsurf",
488+
"1-when-copilots-generate-commit-hits-its-limit-or-windsurf-in-is-only-available-for-users-on-a-paid-plan",
489+
"1-when-copilots-generate-commit-hits-its-limit-or-windsurf-is-only-available-for-users-on-a-paid-plan",
490+
"2-grab-your-free-codestral-key",
485491
"2-pointing-postman-at-an-external-proxy",
486492
"2024-11-20-add-zoom-in-and-out-buttons-to-the-lightboxjs--themescss",
487493
"2024-11-22-add-previous-next-button",
488494
"3-capturing-with-mitmproxy",
495+
"3-dropin-shell-script-ai-git-commitsh",
489496
"4-feeding-vs-code-through-your-proxy",
490497
"5-digging-into-your-logs",
491498
"Copyright",
@@ -647,6 +654,7 @@
647654
"listView",
648655
"liveToastSaveThemMode",
649656
"lokale-installation",
657+
"main-script-execution",
650658
"my-text-image-generation-for-different-models",
651659
"navbar-0-collapse",
652660
"net-create-excel-or-text-license-file-for-used-nuget-packages",
@@ -661,6 +669,7 @@
661669
"privacy-policy",
662670
"projects",
663671
"prompt-2-google-calendar",
672+
"putting-it-all-together",
664673
"py-file",
665674
"python-github-action",
666675
"react-webapp-basketball-live-streams-prompt-google-calendar-events-creator-with-google-api",
@@ -672,6 +681,7 @@
672681
"removedefaultlanguagehtml",
673682
"result-content-page",
674683
"roo-code",
684+
"run-the-main-function",
675685
"running-the-tests",
676686
"schritt-1-kostenlosen-mistral-api-schlüssel-erstellen",
677687
"schritt-2-zugriff-auf-die-cline-provider-einstellungen",
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{{- $url := .Get "url" -}}
2+
{{- $type := .Get "type" | default "bash" -}}
3+
{{- if not $url -}}
4+
{{- errorf "The gist_markdown shortcode requires a 'url' parameter" -}}
5+
{{- else -}}
6+
{{- $resource := resources.GetRemote $url -}}
7+
{{- if not $resource -}}
8+
{{- errorf "Failed to fetch remote resource from %s" $url -}}
9+
{{- else -}}
10+
{{- $content := $resource.Content -}}
11+
{{- /* Use specified type in markdown code block */ -}}
12+
{{ (printf "```%s\n%s\n```" $type $content) | markdownify }}
13+
{{- end -}}
14+
{{- end -}}

0 commit comments

Comments
 (0)