OpenCommitのセットアップ

以下の資料を見ながらセットアップしていく.

di-sukharev/opencommit: GPT wrapper for git — generate commit messages with an LLM in 1 sec — works best with Claude 3.5 — supports local models too

インストール

brew install ollama

起動

nohup ollama start &

モデルmistralのダウンロード

ollama pull mistral

モデルmistralの起動

ollama run mistral

OpenCommitのインストール

npm install -g opencommit

OpenCommitをLocal LLM向けに設定

oco config set OCO_API_URL='http://127.0.0.1:11434/api/chat'
oco config set OCO_AI_PROVIDER='ollama' OCO_MODEL='mistral'

Gitリポジトリで以下のコマンドを実行

$ oco

(node:83962) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
  open-commit

  3 staged files:
  .vscode/settings.json
  main.tex
  out/main.pdf

  📝 Commit message generated

  Generated commit message:
——————————————————
 feat(vscode-settings): add eclog, inne, Millis, Zipf's to 'extensions.json'
   docs(main.tex): update trace span figure description for better readability
   chore(latex): regenerate main.pdf with updated changes
——————————————————

◇  Confirm the commit message?
│  Yes
◇  ✔ Successfully committed
└  [master 87b9b56]  feat(vscode-settings): add eclog, inne, Millis, Zipf's to 'extensions.json'    docs(main.tex): update trace span figure description for better readability    chore(latex): regenerate main.pdf with updated changes
 3 files changed, 6 insertions(+), 2 deletions(-)


  Do you want to run `git push`?
  Yes

   Successfully pushed all commits to origin