From 7f6bdd93b5e991568fb2846d043b11c964aa2d9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sam=20B=C3=BCth?= Date: Sun, 26 Mar 2023 17:39:55 +0200 Subject: [PATCH] docs: document configuration options (#155) Co-authored-by: Hiroki Osame --- README.md | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/README.md b/README.md index 6ce7f11..6591805 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,15 @@ aicommits --dry-run > 👉 **Tip:** Use the `aic` alias if `aicommits` is too long for you. +#### Generate multiple recommendations + +Sometimes the recommended commit message isn't the best so you want it to generate a few to pick from. You can generate multiple commit messages at once by passing in the `--generate` flag: +```sh +aicommits --generate # or -g +``` + +> Warning: this uses more tokens, meaning it costs more. + ### Git hook You can also integrate _aicommits_ with Git via the [`prepare-commit-msg`](https://git-scm.com/docs/githooks#_prepare_commit_msg) hook. This lets you use Git like you normally would, and edit the commit message before committing. @@ -96,6 +105,67 @@ aicommits hook uninstall 3. Save and close the editor to commit! +## Configuration + +### Reading a configuration value +To retrieve a configuration option, use the command: + +```sh +aicommits config get +``` + +For example, to retrieve the API key, you can use: +```sh +aicommits config get OPENAI_KEY +``` + +You can also retrieve multiple configuration options at once by separating them with spaces: + +```sh +aicommits config get OPENAI_KEY generate +``` + +### Setting a configuration value + +To set a configuration option, use the command: + +```sh +aicommits config set = +``` + +For example, to set the API key, you can use: + +```sh +aicommits config set OPENAI_KEY= +``` + +You can also set multiple configuration options at once by separating them with spaces, like + +```sh +aicommits config set OPENAI_KEY= generate=3 locale=en +``` + +### Options +#### OPENAI_KEY + +Required + +The OpenAI API key. You can retrieve it from [OpenAI API Keys page](https://platform.openai.com/account/api-keys). + +#### locale +Default: `en` + +The locale to use for the generated commit messages. Consult the list of codes in: https://wikipedia.org/wiki/List_of_ISO_639-1_codes. + +#### generate + +Default: `1` + +The number of commit messages to generate to pick from. + +Note, this will use more tokens as it generates more results. + +This can also be configured with the CLI flag `--generate`. ## How it works