Last active
July 11, 2025 14:15
-
-
Save sputnikus/fc5fbd6bcee9a77963e968465e0e436f to your computer and use it in GitHub Desktop.
Revisions
-
sputnikus revised this gist
Jul 11, 2025 . 1 changed file with 38 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,18 +9,51 @@ if [ -z "$DIFF" ] return 1 end # Use existing revset description to provide CC description set -l DESC_DETAIL $(jj log --no-graph -T description -r @) if [ -z "$DESC_DETAIL" ] set -l DESC_DETAIL "" end # Generate commit message using LLM if [ -n "$DESC_DETAIL" ] # Use handwritten description set -f DESC_MSG $(printf '\ Generate a conventional commit message following this exact format: - First line: type(scope): brief description (50 chars max) - Blank line - This detailed explanation: %s Use conventional commit types: feat, fix, docs, style, refactor, test, chore, build, ci, perf. Only output the commit message - no code blocks, explanations, or extra formatting. Code changes: %s' $DESC_DETAIL $(echo "$DIFF") | llm --log) else # Generate simple conventional commit message set -f DESC_MSG $(printf '\ Generate a conventional commit message from this diff: - First line only: type(scope): brief description (50 chars max) - Use conventional commit types: feat, fix, docs, style, refactor, test, chore, build, ci, perf - Only output the commit message - no code blocks, explanations, or extra formatting Code changes: %s' $(echo "$DIFF") | llm --log) end if [ -z "$DESC_MSG" ] echo "Failed to generate change description." return 1 end set -l FIRST_LINE $(echo "$DESC_MSG" | head -1) if ! echo "$FIRST_LINE" | grep -q "^[a-z][a-z]*\(.*\)*:" echo "Warning: Generated message may not follow conventional commits format:" echo " First line: $FIRST_LINE" echo " Expected: type(scope): description" echo "" end # Describe changes printf %s\n $DESC_MSG | jj desc --stdin -
sputnikus revised this gist
Jun 19, 2025 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,7 @@ #!/usr/bin/env fish # Shebang for testing, Jujutsu config at the end of this file # LLMs are useful for generating the first line of the CC (the What), but you # should always review generated description to include the Why and the How. set -l DIFF $(jj diff --git -r @) if [ -z "$DIFF" ] -
sputnikus revised this gist
Jun 19, 2025 . No changes.There are no files selected for viewing
-
sputnikus created this gist
Jun 19, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ #!/usr/bin/env fish # Shebang for testing, Jujutsu config at the end of this file set -l DIFF $(jj diff --git -r @) if [ -z "$DIFF" ] echo "No changes found." return 1 end # Generate commit message using LLM set -l DESC_MSG $(echo "$DIFF" | llm -m claude-3.5-sonnet "\ Generate a concise commit message (first line), blank line and detailed description based on these changes. Follow conventional commits format. Your response will be passed directly into version control command. Diff:\ ") if [ -z "$DESC_MSG" ] echo "Failed to generate change description." return 1 end # Describe changes printf %s\n $DESC_MSG | jj desc --stdin # Jujutsu config # [aliases] # cdesc = ["util", "exec", "--", "llm_conventional_desc.fish"]