#!/bin/fish # Utility that will Prompt a LLM to make a commit message from a git diff. function _ask echo "Is it correct ?! (y/n/e/1/r/)" read response if [ $response = y ] git commit -F /tmp/prev-ia-commit-message else if [ $response = 1 ] git commit -m (cat /tmp/prev-ia-commit-message | head -n 1) else if [ $response = e ] $EDITOR /tmp/prev-ia-commit-message cat /tmp/prev-ia-commit-message | head -n 1 _ask else if [ $response = r ] ia-commit else if [ $response = n ] exit 1 end end function ia-commit echo -e "Write a professional git commit message based on the a diff below. \nDo not preface the commit with anything, use the present tense, return the full sentence, and use the conventional commits specification (: )\n\n-----\n\n$(git diff --staged)" | hailper -p b-code | tee /tmp/prev-ia-commit-message _ask rm /tmp/prev-ia-commit-message 2>/dev/null end