Nutlope / aicommits

A CLI that writes your git commit messages for you with AI

Home Page:https://www.npmjs.com/package/aicommits

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

1Password OPEN AI integration with aicommits

joqim opened this issue · comments

commented

Feature request

I'm in development of a feature where

Instead of aicommits config set OPENAI_KEY=<your token>,

I want to implement a 1Password integration where OPENAI_KEY is loaded into aicommits from the Private vault if already exists. Preferably aicommits config command would prompt to see if OPENAI_KEY exists in my connected 1Password account.

Thus technically making aicommits as a part of 1Password's shell plugin.
See attached

Why?

Ease of access and so that I don't have to "copy&paste" my OpenAI API credentials.

Alternatives

No response

Additional context

I'm not very familiar with CLI development, I'm trying to implement this feature.

See below code for proof of concept.

Formatted version

I have trouble building this project and testing it out locally to check if this works.

Would appreciate any guidance.

Thanks for the request. PR welcome!

I'm also open to encrypting the token on disk so at least its not in plain text.

I think the ideal is to be able to use any password manager, not only 1Password. However, I took a quick look at the code in the repository and realized that you can do an export of OPENAI_KEY. This is how I configure it using pass as manager:

export OPENAI_KEY=$(pass show openai/api-key)

I think it's worth to mention it on the readme instead of storing the key as plain text into the .aicommits file

commented

Hello developer, is there any difference between this function and this one? https://github.com/uk0/aicommit-shell

I think the ideal is to be able to use any password manager, not only 1Password. However, I took a quick look at the code in the repository and realized that you can do an export of OPENAI_KEY. This is how I configure it using pass as manager:

export OPENAI_KEY=$(pass show openai/api-key)

I think it's worth to mention it on the readme instead of storing the key as plain text into the .aicommits file

True, and it can already be done for 1password in the same way with:
for example with Windows Powershell:

$env:OPENAI_KEY=(op read <reference>) aicommits @args

the line above can be saved to an example.ps1 to be run instead of "aicommits" command