An open API service indexing awesome lists of open source software.

https://github.com/samunatsu/ai-commit

A Command Line Utility for AI Generating Git Commit Message
https://github.com/samunatsu/ai-commit

ai cli commit-message git rust

Last synced: 3 months ago
JSON representation

A Command Line Utility for AI Generating Git Commit Message

Awesome Lists containing this project

README

          

# AI Commit

A Command Line Utility for AI Generating Git Commit Message

## Install

### Use Cargo Install

```sh
cargo install --git https://github.com/SamuNatsu/ai-commit
```

### Use CLI (Linux/MacOS only)

```sh
curl -s https://installer.samunatsu.workers.dev/SamuNatsu/ai-commit | bash
```

## Environment Variables

Some environment variables must be provided, dotenv files also can be used to provide such variables.

| Name | Introduction | Required | Example | Default |
| :------------------: | :------------------------------------------------ | :------: | :-------------------------------: | :--------------------------------------------: |
| `AI_COMMIT_ENDPOINT` | OpenAI API style endpoint url | Yes | `https://api.deepseek.com/` | - |
| `AI_COMMIT_API_KEY` | OpenAI API style API key | Yes | `sk-xxxxxxxxxxxxxxx` | - |
| `AI_COMMIT_MODEL` | OpenAI API style model name | Yes | `deepseek-reasoner` | - |
| `AI_COMMIT_FILTER` | A RegExp file name filter for ignoring their diff | No | `package-lock\.json\| yarn\.lock` | See [here](./src/includes/default_filters.txt) |

## Usage

### TL; DR

```txt
A Command Line Utility for AI Generating Git Commit Message

Usage: ai-commit [OPTIONS]

Options:
-v, --verbose Show verbose message
-d, --dotenv Dotenv profile name
-t, --commit-type Force using the given commit type
-s, --commit-scope Force using the given commit scope
-p, --prompt Additional prompt message
-h, --help Print help
-V, --version Print version
```

## Dotenv profiles

You can use different dotenv file by passing the `-d|--dotenv` option.
Command below will use `.env.openai` as profile:

```sh
ai-commit -d openai
```

## Additional message

You can add a custom prompt message for AI model, makes it better understands your demands.

```sh
ai-commit -p "This commit is for optimization"
```

## Sponsor