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
4 changes: 0 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
APP_PORT=80
APP_IPS="420.69.247.365"
APP_ENV="development"

OPENAI_API_KEY="DEEZ"
GEMINI_API_KEY="NUTZ"
10 changes: 2 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,15 @@ commit:
@./assets/sh/commit.sh

generate:
@git add -A && git --no-pager diff --cached | jq -Rs '{"diff": .}' | curl -s -X POST "http://localhost" -H "Content-Type: application/json" -d @- | jq -r '.message' && git reset -q

generate-openai:
@git add -A && git --no-pager diff --cached | jq -Rs '{"diff": ., "provider": "openai"}' | curl -s -X POST "http://localhost" -H "Content-Type: application/json" -d @- | jq -r '.message' && git reset -q

generate-gemini:
@git add -A && git --no-pager diff --cached | jq -Rs '{"diff": ., "provider": "gemini"}' | curl -s -X POST "http://localhost" -H "Content-Type: application/json" -d @- | jq -r '.message' && git reset -q
@git add -A && ./assets/sh/commit.sh --dry-run && git reset -q

push:
@make format
@make lint
@make test
@git add -A
@make commit
# @curl -s https://commit.jaw.dev/ | bash
# @curl -fsSL https://commit.jaw.dev/ | bash
@git push --no-verify

dev:
Expand Down
73 changes: 54 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ https://github.com/user-attachments/assets/9b584dec-057c-4533-ad1b-c5835bf1cb52

[![CI](https://github.com/wajeht/commit/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/wajeht/commit/actions/workflows/ci.yml) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/wajeht/commit/blob/main/LICENSE) [![Open Source Love svg1](https://badges.frapsoft.com/os/v1/open-source.svg?v=103)](https://github.com/wajeht/commit)

Generate conventional commits with AI
Generate Conventional Commit messages with AI. The downloaded script sends your
Git diff directly to OpenRouter; API keys and diffs do not pass through
`commit.jaw.dev`.

Open [commit.jaw.dev](https://commit.jaw.dev) in a browser to view the usage guide. Requests made with `curl` continue to return the commit script.

Expand All @@ -29,45 +31,78 @@ $ sudo pacman -S jq git curl coreutils sed
Or if you already have `curl` you can run the following script to detect OS and install it automatically.

```bash
$ curl -s https://commit.jaw.dev/install.sh | bash
$ curl -fsSL https://commit.jaw.dev/install.sh | bash
```

After confirming the installation of these tools, navigate to any project directory that uses `git`. Within this directory, execute the commit script with the following command:
On the first run, Commit asks only for your OpenRouter API key. It then
creates `~/.config/commit/config.json` with private permissions automatically:

```bash
$ curl -s https://commit.jaw.dev/ | bash
$ git add .
$ curl -fsSL https://commit.jaw.dev/ | bash
```

The generated configuration looks like this:

```json
{
"api_key": "YOUR_OPENROUTER_API_KEY"
}
```

Create an API key at [openrouter.ai/keys](https://openrouter.ai/keys). Run setup
again at any time:

```bash
$ curl -fsSL https://commit.jaw.dev/ | bash -s -- --setup
```

Set `OPENROUTER_API_KEY` to avoid saving a key locally. Advanced users can set
`COMMIT_MODEL` to override the default model. Browse valid model IDs at
[openrouter.ai/models](https://openrouter.ai/models), or list them from the API:

```bash
$ curl -fsSL https://openrouter.ai/api/v1/models | jq -r '.data[].id'
```

After setup, stage changes and run the normal command:

```bash
$ curl -fsSL https://commit.jaw.dev/ | bash
```

### Options

- `-ai`, `--ai-provider` Specify AI provider (openai or gemini, default: gemini)
- `-k`, `--api-key` Specify the API key for the AI provider
- `-dr`, `--dry-run` Run the script without making any changes
- `-nv`, `--no-verify` Skip message selection
- `-m`, `--model` Override the configured OpenRouter model for one run
- `--dry-run` Run the script without making any changes
- `-y`, `--yes` Accept the generated message without confirmation
- `-v`, `--verbose` Enable verbose logging
- `--setup` Create or update the saved configuration
- `-h`, `--help` Display this help message

### Example Commands

```bash
$ curl -s https://commit.jaw.dev/ | bash -s -- --no-verify
$ curl -s https://commit.jaw.dev/ | bash -s -- --dry-run
$ curl -s https://commit.jaw.dev/ | bash -s -- -ai openai
$ curl -s https://commit.jaw.dev/ | bash -s -- -ai gemini
$ curl -s https://commit.jaw.dev/ | bash -s -- -ai openai --api-key YOUR_API_KEY
$ curl -s https://commit.jaw.dev/ | bash -s -- -ai gemini --api-key YOUR_API_KEY
$ curl -s https://commit.jaw.dev/ | bash -s -- -nv
$ curl -s https://commit.jaw.dev/ | bash -s -- -dr
$ curl -s https://commit.jaw.dev/ | bash -s -- -v
$ curl -s https://commit.jaw.dev/ | bash -s -- -h
$ curl -s https://commit.jaw.dev/ | bash
$ curl -fsSL https://commit.jaw.dev/ | bash -s -- --yes
$ curl -fsSL https://commit.jaw.dev/ | bash -s -- --dry-run
$ curl -fsSL https://commit.jaw.dev/ | bash -s -- --model openrouter/auto
$ curl -fsSL https://commit.jaw.dev/ | bash -s -- -v
$ curl -fsSL https://commit.jaw.dev/ | bash -s -- -h
$ curl -fsSL https://commit.jaw.dev/ | bash
```

The configuration path follows `$XDG_CONFIG_HOME` when set and defaults to
`~/.config/commit/config.json`. Set `COMMIT_CONFIG` to use another path. The
default model is `google/gemini-2.5-flash-lite`. Pass a model ID exactly as
OpenRouter displays it, for example `openrouter/auto`. Diffs larger than 1 MiB
are rejected before an API request is made.

# Docs

- See [RECIPE](./docs/recipe.md) for `recipe` guide.
- See [DEVELOPMENT](./docs/development.md) for `development` guide.
- See [CONTRIBUTION](./docs/contribution.md) for `contribution` guide.
- See [MANUAL QA](./docs/manual-qa.md) for the security and release checklist.

# License

Expand Down
Loading