conventional commits generator (ccgen)
ccgen is a command-line tool that helps you create commit messages that adhere to the Conventional Commits specification. The tool allows you to interactively build commit messages, ensuring consistency and clarity in your version control history.
networking = Changes to backend logicfeatures
- Supports the mandatory commit types:
feat
andfix
. - Allows you to define custom commit types and scopes through a configuration file (
ccgen.ini
). - Interactive prompts to guide you through creating a commit message.
- Ability to generate a default configuration file with common commit types.
installation
To use the Conventional Commits Generator, simply download the ccgen.py
script and place it in your project directory.
configuration
The tool uses a configuration file ccgen.ini
to define custom commit types and scopes. You can generate a default configuration file by running the following command:
python ccgen.py generate-config
This will create a ccgen.ini
file with the following default commit types:
[types]
docs = Documentation only changes
style = Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc.)
refactor = A code change that neither fixes a bug nor adds a feature
perf = A code change that improves performance
test = Adding missing tests or correcting existing tests
build = Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
ci = Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
chore = Other changes that don’t modify src or test files
revert = Reverts a previous commit
[scopes]
ui = Changes to the user interface
backend = Changes to backend logic
api = Changes to the API
cli = Changes to the CLI
docs = Changes to documentation
feat
and fix
are always available by default and do not need to be included in the configuration file.
usage
To generate a commit message interactively, use the following command:
python ccgen.py commit
This command will prompt you to enter the following information:
- Commit Type: The type of change (e.g.,
feat
,fix
, or a custom type from the configuration file). - Scope: (Optional) The scope of the change (e.g.,
ui
,backend
). - Description: A short description of the change.
- Detailed Message: (Optional) A longer description of the change.
- Breaking Change: (Optional) Indicate if this commit introduces breaking changes.
- Issue Reference: (Optional) Reference any issues this commit closes.
example
Here's an example of how the tool might be used:
python ccgen.py commit # Prompts and Responses: Select the type of change you are committing (type 'help' for more info): feat Enter the scope of the change (optional, leave empty to skip): ui Enter a short description of the change: Add new color theme to the UI Enter a longer description of the change (optional, leave empty to skip): Does this commit introduce breaking changes? (y/n): n Reference any issues this commit closes (optional, leave empty to skip): #42 # Generated Commit Message: feat(ui): Add new color theme to the UI Closes: #42
command-line options
The script supports the following commands:
generate-config
: Generates a defaultccgen.ini
configuration file.commit
: Starts the interactive commit message generation process.
configuration file format
The configuration file (ccgen.ini
) is divided into sections:
- [types]: Defines custom commit types. Each type is associated with a description.
- [scopes]: Defines scopes that can be associated with commits. Each scope is associated with a description.
Example:
[types]
docs = Documentation only changes
style = Changes that do not affect the meaning of the code
[scopes]
backend = Changes to backend logic
api = Changes to the API