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
10 changes: 6 additions & 4 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache: 'pnpm'
- name: Install dependencies
run: npm ci
run: pnpm install --frozen-lockfile
- name: Build
run: npm run build
run: pnpm run build
- name: Run tests
run: xvfb-run -a npm test
run: xvfb-run -a pnpm test
20 changes: 10 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,26 @@ jobs:
fetch-depth: 0 # Fetch full history for version tagging
token: ${{ secrets.GITHUB_TOKEN }}

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache: 'pnpm'

- name: Install dependencies
run: npm ci
run: pnpm install --frozen-lockfile

- name: Run linting
run: npm run lint
run: pnpm run lint

- name: Build extension
run: npm run build
run: pnpm run build

- name: Run tests
run: xvfb-run -a npm test

- name: Install vsce
run: npm install -g @vscode/vsce
run: xvfb-run -a pnpm test

- name: Get version from package.json
id: get-version
Expand All @@ -48,7 +48,7 @@ jobs:
echo "Extension version: $VERSION"

- name: Package extension
run: vsce package
run: pnpm run package

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
Expand All @@ -71,4 +71,4 @@ jobs:
- name: Publish to VS Code Marketplace
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
run: vsce publish --pat $VSCE_PAT
run: pnpm exec vsce publish --pat $VSCE_PAT
9 changes: 6 additions & 3 deletions .github/workflows/version-bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,18 @@ jobs:
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache: 'pnpm'

- name: Install dependencies
run: npm ci
run: pnpm install --frozen-lockfile

- name: Configure Git
run: |
Expand All @@ -39,7 +42,7 @@ jobs:

- name: Bump version
run: |
npm version ${{ github.event.inputs.version_type }} --no-git-tag-version
pnpm version ${{ github.event.inputs.version_type }} --no-git-tag-version
NEW_VERSION=$(node -p "require('./package.json').version")
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
out
dist
node_modules
.pnpm-store
temp
.vscode-test/
*.vsix
Expand Down
6 changes: 5 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
enable-pre-post-scripts = true
enable-pre-post-scripts=true
save-exact=true
minimum-release-age=1440
minimum-release-age-exclude[]=serialize-javascript@7.0.5
minimum-release-age-exclude[]=diff@8.0.3
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
"typescript.tsc.autoDetect": "off",
"cSpell.words": ["commitollama", "ollama"],
"editor.defaultFormatter": "biomejs.biome",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.biome": "explicit"
},
"[json]": {
"editor.defaultFormatter": "biomejs.biome"
},
Expand Down
152 changes: 76 additions & 76 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# Commitollama 🦙

A free alternative to Github Copilot's commit generator that runs on your device using [ollama][1].
A free alternative to Github Copilot's commit generator that runs on your device using [Ollama][1].

## Features

- No telemetry or tracking.
- No API key needed.
- Different models available.
- Use any model you have already pulled in Ollama.
- No Internet connection needed.
- Quick model switching from the Source Control toolbar or Command Palette.
- Background pre-generation of change summaries for faster commits.

## Demo

Expand All @@ -16,98 +18,96 @@ A free alternative to Github Copilot's commit generator that runs on your device
## Requirements

- Install [Ollama][1] on your local machine.
- Install the model to use: `ollama pull [model_name]`, recommended to use `llama3.2` or `gemma3`.
- Make sure ollama is running, you can do it by visiting http://127.0.0.1:11434/ in your web browser (The port number might be different for you). If not, only opening the app should be enough, or run in your terminal: `ollama serve`.
- Pull at least one model, for example: `ollama pull llama3.2`
- Make sure Ollama is running. Open http://127.0.0.1:11434/ in your browser (your port may differ), open the Ollama app, or run `ollama serve`.

## Configuration

- Model: You can select the model from the plugin configuration.

`Llama` - default (Uses llama3.2:latest) (slow)

`Codegemma` (Uses codegemma:latest)

`Codellama` (Uses codellama. Worst result obtained)

`Mistral` (Uses mistral:latest)

`Gemma` (Uses gemma3:latest) (fast)

`Qwen` (Uses qwen3:latest)

`Custom` - It allows you to write down any other model name from ollama.

- Use Emojis: It allows you to enable or disable the use of emojis in commit messages.

- Use Description: It allows you to enable or disable the use of commit descriptions.
### Recommended models

- Use Lowercase: Enables or disables the use of lowercase at the beginning of commit messages.
These models work well for commit messages and are highlighted in the model picker:

- Language: Language for commit messages.
`llama3.2`, `codellama`, `qwen3`, `qwen2.5-coder:7b`, `mistral`, `gemma3`, `codegemma`

- Prompt Temperature: Custom temperature for generating the commit message. (Higher number = more creative)
See the [Ollama library][1] for more models.

- Commit Template: It allows you to write down the commit template you want to use. You should use the following placeholders:
- `{{type}}`: It will be replaced by the type of the commit.
- `{{emoji}}`: It will be replaced by the emoji selected in the configuration.
- `{{message}}`: It will be replaced by the commit message.
## Usage

Default value: `{{type}} {{emoji}}: {{message}}`
1. Stage your changes in Git.
2. Run **Commitollama** from the Source Control title bar (sparkle icon).
3. On first use, pick a model, then choose whether to save it in **project settings** (`.vscode/settings.json`) or **user settings** (all projects). The picker is skipped if `commitollama.model` is already set in either scope.
4. The generated commit message is written to the commit input box.

- Custom Model: Allows you to specify any model. The model has to be downloaded and available on your Ollama instance. **Note:** Ignored if `commitollama.model` is not set to "Custom".
### Switching models

- Custom Language: Allows you to specify any language for the commit messages. **Note:** Ignored if `commitollama.language` is not set to "Custom".
Use the swap icon next to the sparkle button in Source Control, or run **Commitollama: Switch Model** from the Command Palette. You can change the model and where it is saved at any time.

- Custom Emojis: Allows you to specify the emojis you want to use in the next template object within the VSCode config.json.
You can also set `commitollama.model` manually in VS Code settings.

```json
"commitollama.commitEmojis": {
"feat": "✨",
"fix": "🐛",
"docs": "📝",
"style": "💎",
"refactor": "♻️",
"test": "🧪",
"chore": "📦",
"revert": "⏪"
}
```

- Custom Endpoint: Ollama usually uses port 11434. It is the value that will be used if empty.

- Custom Prompt: The prompt that will be used to generate the commit message instead of the default one. If this field is populated, it will override all the extension prompts and rules.

- Custom Type Rules: Custom rules for commit message types.

- Custom Commit Message Rules: Custom rules for commit messages.

- Custom Description Prompt: A custom prompt to generate the commit description.

- Custom Request Headers: custom request headers that will be sent with each request to Ollama or a custom endpoint. This is useful for authentication and other purposes.

## Background Generation

This feature allows the extension to summarize file changes in the background as you work. When you're ready to commit, the message generation will be much faster because it aggregates these pre-computed summaries.

- **Enabled**: Enable or disable background generation. (Default: `true`)
- **Interval**: Time in seconds to scan for changes if `On Save` misses something or for periodic checks. (Default: `60`)
- **On Save**: Trigger background generation immediately when a file is saved. (Default: `true`)
## Configuration

> **Note**: This feature creates a smoother experience by moving the heavy lifting of LLM generation to the background while you code.
### General

| Setting | Description | Default |
| --- | --- | --- |
| `commitollama.model` | Ollama model tag (e.g. `llama3.2:latest`). Set via the model picker or manually. | `llama3.2:latest` |
| `commitollama.useEmojis` | Add emojis to commit messages. | `false` |
| `commitollama.useDescription` | Add a longer description below the subject line. | `false` |
| `commitollama.useLowerCase` | Lowercase the first letter of the commit message. | `false` |
| `commitollama.language` | Language preset (`English`, `Spanish`, `Custom`, …). | `English` |
| `commitollama.promptTemperature` | Model temperature (`0`–`1`). Higher = more creative. | `0.2` |
| `commitollama.commitTemplate` | Final commit format. Placeholders: `{{type}}`, `{{emoji}}`, `{{message}}`. | `{{type}} {{emoji}}: {{message}}` |

### Custom overrides

| Setting | Description |
| --- | --- |
| `commitollama.custom.language` | Custom language. Used when `commitollama.language` is `Custom`. |
| `commitollama.custom.emojis` | Map commit types to emojis. Only used when emojis are enabled. |
| `commitollama.custom.endpoint` | Ollama server URL. Empty uses `http://127.0.0.1:11434`. |
| `commitollama.custom.prompt` | Replace the default commit prompt entirely. |
| `commitollama.custom.typeRules` | Custom rules for commit types. |
| `commitollama.custom.commitMessageRules` | Custom rules for the commit subject. |
| `commitollama.custom.descriptionPrompt` | Custom prompt for the commit description. |
| `commitollama.custom.requestHeaders` | Extra HTTP headers for Ollama requests (e.g. auth). |

Example emoji map:

```json
"commitollama.custom.emojis": {
"feat": "✨",
"fix": "🐛",
"docs": "📝",
"style": "💎",
"refactor": "♻️",
"test": "🧪",
"chore": "📦",
"revert": "⏪"
}
```

### Background generation

Summarizes file changes in the background while you work. When you commit, cached summaries are reused when possible, so generation is faster.

| Setting | Description | Default |
| --- | --- | --- |
| `commitollama.background.enabled` | Enable background generation. | `true` |
| `commitollama.background.interval` | Seconds between periodic scans. | `60` |
| `commitollama.background.onSave` | Summarize when a file is saved. | `true` |

## Known Issues

Sometimes, depending on the model used, it can generate quite long commit messages. However, it provides a good starting point for what the commit should be and can be manually edited to achieve the desired length.
- Depending on the model, commit messages can be longer than ideal. They are meant as a starting point and can be edited before committing.
- Some models do not support the structured JSON output Commitollama uses (for example certain reasoning or harmony-format models). If generation fails, switch to a recommended model via **Commitollama: Switch Model**. Error messages include the underlying Ollama response when available.

## Contributing

- Fork the repository and create a feature branch.
- Install dependencies: `npm install`.
- Lint and format: `npm run lint` and `npm run format-fix`.
- Run tests: `npm run test`.
- Build the extension: `npm run build` (or `npm run watch`).
- Install dependencies: `pnpm install`
- Lint and format: `pnpm run lint` and `pnpm run format-fix`
- Run tests: `pnpm test`
- Build: `pnpm run build` (or `pnpm run watch`)
- Follow the existing style and configuration (`biome.json`).
- Open a PR against `main` with a clear description and meaningful commits (e.g., `type(scope): message`).
- Open a PR against `main` with a clear description and meaningful commits (e.g. `type(scope): message`).

[1]: https://ollama.ai/
[1]: https://ollama.com/library
[2]: https://raw.githubusercontent.com/jepricreations/commitollama/main/commitollama-demo.gif
8 changes: 3 additions & 5 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
{
"$schema": "https://biomejs.dev/schemas/1.5.0/schema.json",
"organizeImports": {
"enabled": true
},
"$schema": "https://biomejs.dev/schemas/2.5.0/schema.json",
"assist": { "actions": { "source": { "organizeImports": "on" } } },
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"preset": "recommended",
"suspicious": {
"noExplicitAny": "off"
},
Expand Down
Loading
Loading