From 624861e32034f785995c0facd6677aaf5308a18e Mon Sep 17 00:00:00 2001 From: anaxios Date: Wed, 7 Aug 2024 04:12:18 -0700 Subject: [PATCH] Refactor aicommit_groq script: extract system message to a heredoc, remove redundant variable assignment, and improve code organization --- aicommit_groq | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/aicommit_groq b/aicommit_groq index 4db5ff1..27074e1 100755 --- a/aicommit_groq +++ b/aicommit_groq @@ -5,6 +5,17 @@ set -e ARGS=("${@-}") TMP_FILE="/tmp/aicommit" + +system=$( +cat - </dev/null || exit 1 spin() { @@ -24,7 +35,6 @@ if [[ -z ${GROQ_API_KEY} ]]; then exit 1 fi -system="You are an expert programmer that values clear, unambiguous communication and are specialized in generating concise and informative git commit messages. Only reply with the commit message and nothing else." if ! diff=$(git diff --cached); then echo "Failed to get diff."