Introduce an automatic formatting step in llm-commit to ensure that generated commit messages adhere to common best practices regarding line lengths, particularly:
- Subject line ≤ 50 characters
- Body lines wrapped at 72 characters
This behavior should be enabled by default.
Problem
Currently, llm-commit may generate well-structured commit messages, but it doesn't guarantee adherence to formatting conventions regarding line lengths. For instance:
Current output example:
chore(makefile): enhance CSS build output readability
Improved the readability of the generated CSS files by expanding their style format. This change aids in debugging and maintenance by providing a clearer view of the CSS structure.
* Added `--style=expanded` option to the `npx sass` command in the Makefile
* Ensures that the generated CSS is more human-readable, facilitating easier troubleshooting and updates
This leads to long, hard-to-read lines, especially in terminal-based workflows.
A correct formatting should give :
chore(makefile): enhance CSS build output readability
Improved the readability of the generated CSS files by expanding their
style format. This change aids in debugging and maintenance by providing
a clearer view of the CSS structure.
* Added `--style=expanded` option to the `npx sass` command in the
Makefile
* Ensures that the generated CSS is more human-readable, facilitating
easier troubleshooting and updates
Proposed solution
- Add a default post-processing step to format the commit message body:
- Wrap body lines at 72 characters.
- Optionally warn if the subject line exceeds 50 characters.
- Use the mdformat library to perform Markdown-aware formatting, preserving lists and code blocks.
References
Introduce an automatic formatting step in
llm-committo ensure that generated commit messages adhere to common best practices regarding line lengths, particularly:This behavior should be enabled by default.
Problem
Currently,
llm-commitmay generate well-structured commit messages, but it doesn't guarantee adherence to formatting conventions regarding line lengths. For instance:Current output example:
This leads to long, hard-to-read lines, especially in terminal-based workflows.
A correct formatting should give :
Proposed solution
References
mdformatdocumentation