Skip to content

refactor(prompts): streamline commit message generation logic #457

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

jcppkkk
Copy link
Contributor

@jcppkkk jcppkkk commented Apr 1, 2025

This update introduces a new structure for generating commit messages by defining a constant for commit types and consolidating the logic into a single function. The changes enhance readability and maintainability while ensuring consistent formatting based on the OCO_OMIT_SCOPE configuration.


This merge request is the first of five commits intended to archive feat(commitlint): Improve consistency handling and prompt structure. I have split the changes into five reviewable merge requests that will be submitted sequentially.


feat(commitlint): Improve consistency handling and prompt structure

Problem:
The current commitlint integration has limitations in generating commit messages that strictly follow commitlint rules. For example, when commitlint config has body-leading-blank: [2, 'always'], the default prompt cannot generate messages with proper blank line between header and body:

- feat(scope): add new feature
- This is the body text
+ feat(scope): add new feature
+ 
+ This is the body text

Solution:
We refactor the consistency handling to use the default commit message format as a reference style, while ensuring the generated messages strictly follow commitlint rules. This approach:

  1. Uses the default content as a reference for style and features
  2. Generates dynamic requirements based on config settings
  3. Ensures the message follows all commitlint rules
  4. Maintains backward compatibility

@jcppkkk jcppkkk force-pushed the feat/commitlint-improve-consistency-handling branch 2 times, most recently from 98a6484 to 8228b8e Compare April 1, 2025 10:59
This update introduces a new structure for generating commit messages by defining a constant for commit types and consolidating the logic into a single function. The changes enhance readability and maintainability while ensuring consistent formatting based on the OCO_OMIT_SCOPE configuration.
@jcppkkk jcppkkk force-pushed the feat/commitlint-improve-consistency-handling branch from 8228b8e to fb533f8 Compare April 10, 2025 08:41
@jcppkkk jcppkkk changed the title feat(commitlint): Improve consistency handling and prompt structure refactor(prompts): streamline commit message generation logic Apr 10, 2025
@di-sukharev di-sukharev merged commit 9418f67 into di-sukharev:master Apr 12, 2025
5 checks passed
@di-sukharev
Copy link
Owner

thank you, this is cleaner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants