Skip to content

Conversation

@FabienBounoir
Copy link

💡 Motivation Behind This PR: Supporting Custom Commit Scopes

Currently, the scope selection is limited to a predefined list, which works well for highly structured projects. However, it can be restrictive in more flexible or open source environments, where contributors might need to define context-specific scopes.

This pull request introduces a new customScopeInput configuration option that allows:

  • Keeping the current behavior with an autocomplete prompt based on predefined scopes.
  • Or enabling a free-text input to let users specify custom scopes when customScopeInput: true.

🎯 Why this is valuable:

  • Adds flexibility for teams and contributors who don’t have a fixed list of scopes.
  • More welcoming for open-source contributors who may need custom scope definitions.
  • Backward-compatible: default behavior remains unchanged.

✅ Summary of Changes

🛠 Feature Implementation

  • [README.md]: Updated to document the new customScopeInput option.

  • [lib/defaults.js]: Introduced the customScopeInput flag (default is false).

  • [lib/questions/scope.js]: Updated createQuestion to:

    • Use predefined scopes + autocomplete if customScopeInput is false (default).
    • Prompt for custom input using limitedInput if customScopeInput is true.

🧪 Tests

  • [test/formatCommitMessage.test.js]: Added tests with customScopeInput: false to validate current behavior and ensure proper coverage.

📌 Proposal

This enhancement introduces no breaking changes and brings more flexibility for users with varied workflows. It’s especially useful for open-source projects and collaborative environments.

The feature is:

  • Optional and non-intrusive
  • Tested
  • Fully documented

I'd love to hear your feedback and am happy to make any adjustments necessary to meet your standards. Thank you for your time and consideration!

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.

1 participant