docs: document configuration options (#155)
Co-authored-by: Hiroki Osame <hiroki.osame@gmail.com>
This commit is contained in:
70
README.md
70
README.md
@@ -64,6 +64,15 @@ aicommits --dry-run
|
|||||||
|
|
||||||
> 👉 **Tip:** Use the `aic` alias if `aicommits` is too long for you.
|
> 👉 **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
|
### 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.
|
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!
|
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 <key>
|
||||||
|
```
|
||||||
|
|
||||||
|
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 <key>=<value>
|
||||||
|
```
|
||||||
|
|
||||||
|
For example, to set the API key, you can use:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
aicommits config set OPENAI_KEY=<your-api-key>
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also set multiple configuration options at once by separating them with spaces, like
|
||||||
|
|
||||||
|
```sh
|
||||||
|
aicommits config set OPENAI_KEY=<your-api-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
|
## How it works
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user