Skip to main content

latest

Conventional commit generator cli by AI

This package works with Deno
JSR Score
64%
Published
a month ago (0.0.8)

Commit

Requirements

This script requires Deno to run. If you don't have Deno installed, you can install it by following the instructions on the official Deno website.

You will also need an OpenAI API key to use this script. You can sign up for an account and get an API key on the OpenAI website.

Install

deno install -A -fn commit  jsr:@garn/commit

Usage

commit [OPTIONS]
  • --add: Runs git add . before creating the commit message.
  • --push: Runs git push after creating the commit.
  • --skipEdit: Skips the editing of the commit message before creating the commit.
  • --noCommit: Skips the creation of the commit. Just prints the commit message.
  • --model <model>: Specifies the model to use for generating the commit message. The default is gpt-4o.
  • --config: Ask for the OpenAI API key and save it.
  • --apiKey <apiKey>: Specifies the OpenAI API key to use. This will override the value set in the OPENAI_API_KEY environment variable.
  • --baseURL <baseURL>: Specifies the base URL to use for the OpenAI API. This will override the default base URL.
  • --debug: Enables debug mode, which will print additional information to the console.
  • --maxWords <maxWords>: Specifies the maximum number of words to call the api. The default is 6000. Is useful to no incur in extra charges.
  • --ollama: Uses the llama3 model and sets the base URL to 'http://localhost:11434/v1'.
  • --help: Prints the help message.

Environment Variables

  • OPENAI_API_KEY: Your OpenAI API key. This is required to interact with the OpenAI API.

Example

Here's an example of how you can use commit:

OPENAI_API_KEY=your_api_key_here commit --add --push

This will add all changes, create a commit with a message generated by the OpenAI API, and push the changes to the current branch.

Add Package

deno add @garn/commit

Import symbol

import * as mod from "@garn/commit";