guibranco / dotnet-aicommitmessage

🧠 🤖 This tool generates AI-powered commit messages via Git hooks, automating meaningful message suggestions from OpenAI and others to improve commit quality and efficiency.
https://guibranco.github.io/dotnet-aicommitmessage/
MIT License
1 stars 3 forks source link

[BUG] Error generating commit message with JIRA Ticket in branch name #89

Closed guibranco closed 1 month ago

guibranco commented 1 month ago

Description: There is an error when generating a commit message in a branch that contains a JIRA ticket number in its name. The issue appears to be related to the brackets in the message prefix, which are mistakenly interpreted as a color/style by the logging library.

Stack Trace:

Unhandled exception. System.InvalidOperationException: Could not find color or style 'CODE-12345'.
   at Spectre.Console.StyleParser.Parse(String text) in /_/src/Spectre.Console/StyleParser.cs:line 10
   at Spectre.Console.MarkupParser.Parse(String text, Style style) in /_/src/Spectre.Console/Internal/Text/Markup/MarkupParser.cs:line 29
   at Spectre.Console.AnsiConsoleExtensions.Markup(IAnsiConsole console, String value) in /_/src/Spectre.Console/Extensions/AnsiConsoleExtensions.Markup.cs:line 77
   at Spectre.Console.AnsiConsoleExtensions.Markup(IAnsiConsole console, IFormatProvider provider, String format, Object[] args) in /_/src/Spectre.Console/Extensions/AnsiConsoleExtensions.Markup.cs:line 47
   at Spectre.Console.AnsiConsoleExtensions.MarkupLine(IAnsiConsole console, IFormatProvider provider, String format, Object[] args) in /_/src/Spectre.Console/Extensions/AnsiConsoleExtensions.Markup.cs:line 129
   at Spectre.Console.AnsiConsoleExtensions.MarkupLine(IAnsiConsole console, String format, Object[] args) in /_/src/Spectre.Console/Extensions/AnsiConsoleExtensions.Markup.cs:line 88
   at Spectre.Console.AnsiConsole.MarkupLine(String format, Object[] args) in /_/src/Spectre.Console/AnsiConsole.Markup.cs:line 91
   at AiCommitMessage.Utility.Output.InfoLine(String message, Object[] args) in /home/runner/work/dotnet-aicommitmessage/dotnet-aicommitmessage/Src/AiCommitMessage/Utility/Output.cs:line 22
   at AiCommitMessage.Utility.Output.InfoLine(String message) in /home/runner/work/dotnet-aicommitmessage/dotnet-aicommitmessage/Src/AiCommitMessage/Utility/Output.cs:line 7
   at AiCommitMessage.Program.Run(Object options) in /home/runner/work/dotnet-aicommitmessage/dotnet-aicommitmessage/Src/AiCommitMessage/Program.cs:line 66
   at CommandLine.ParserResultExtensions.WithParsed[T](ParserResult`1 result, Action`1 action)
   at AiCommitMessage.Program.Main(String[] args) in /home/runner/work/dotnet-aicommitmessage/dotnet-aicommitmessage/Src/AiCommitMessage/Program.cs:line 27
Error: Failed to generate AI commit message. Using original message.
Aborting commit due to empty commit message.

Steps to Reproduce:

  1. Create a branch with the following pattern: feature/CODE-12345-something.
  2. Attempt to generate a commit message.

Expected Behavior: The expected output should be: [CODE-12345] Brief description of changes

Current Behavior: The application throws the exception above, failing to generate the commit message, and ultimately aborts the commit.

gitauto-ai[bot] commented 1 month ago

Click the checkbox below to generate a PR!

@guibranco, You have 5 requests left in this cycle which refreshes on 2024-11-21 10:07:38+00:00. If you have any questions or concerns, please contact us at info@gitauto.ai.