#!/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 env cat /tmp/prev-ia-commit-message _ask return $status else if [ $response = r ] ia-commit else if [ $response = n ] return 1 end return 0 end function ia-commit echo -e "Write a professional git commit message based on the diff below. DO NOT CODE. You goal is only to propose a **professionnal git commit message** corresponding to the git diff below. Here are the rulses\n\n1. Do not preface the commit message with greeting. \n2. Use the present tense. \n3. The first line MUST be a sentence that describe the following diff. \n4. The first line MUST follow the conventional commits specification (: ).\n\n\nHere is the git diff:\n\n\n----------\n\n\n$(git diff --staged)" | hailper -p commit-message | tee /tmp/prev-ia-commit-message _ask set -l ret $status rm /tmp/prev-ia-commit-message 2>/dev/null return $ret end