Commit Message Standardization Plugin
A VS Code plugin that generates Conventional Commit messages based on Git diff analysis, helping developers write consistent and meaningful commit messages.
Features
- Automated Commit Message Generation: Automatically generates a commit message following the Conventional Commit format based on the changes made in your code.
- Commit Message Suggestion: Suggests commit types like
feat , fix , docs , etc., based on the content of the changed files.
- Modifiable Commit Messages: Displays the generated commit message in an input field so that users can review, modify, and manually commit it.
- Supports Conventional Commit Guidelines: Ensures commit messages adhere to standardized guidelines, making it easier for teams to maintain a clean Git history and integrate with automated tools.
Installation
- Clone or download the repository.
- Open the folder in Visual Studio Code.
- Run
npm install to install the necessary dependencies.
- Press
F5 to start the extension in development mode.
To install the extension globally:
- Package the extension using
vsce package (make sure you have the vsce tool installed).
- Install the generated
.vsix file in your VS Code instance.
How It Works
- When a user stages changes or prepares to commit, the plugin automatically analyzes the Git diff.
- Based on the changes, the plugin generates a commit message following the Conventional Commit format.
- The commit message is displayed in an input box, allowing the user to modify the message before committing.
The generated commit message follows this structure:
<type>(<scope>): <subject>
[optional body]
[optional footer(s)]
- Type: The type of change (e.g.,
feat , fix , docs , test , chore ).
- Scope: (Optional) The area of the codebase affected (e.g.,
auth , api ).
- Subject: A brief description of the changes.
Usage
Generating Commit Message:
- Open the command palette (
Ctrl+Shift+P ) and type Generate Conventional Commit Message .
- The plugin analyzes the changes and generates a suggested commit message.
- The message is displayed in an input box where you can modify it.
- You can manually use this message to commit your changes.
Example Workflow:
Manual Commit:
- Once the commit message is generated, you can copy it and manually commit the changes using
git commit .
Configuration
- The plugin currently works with Conventional Commit types (
feat , fix , docs , chore , test ). You can extend or modify this list based on your project needs.
- Additional configuration options such as custom commit types or stricter message formatting can be added by modifying the code.
Example
Output Commit Message:
feat(app): updated app functionality, updated documentation
Future Improvements
- Support for more commit types such as
style , refactor , and perf .
- Deeper code analysis to generate more specific commit descriptions.
- Integration with Git hooks for auto-commit suggestions during the commit process.
Contributing
Contributions are welcome! Please fork this repository, make your changes, and submit a pull request.
License
This project is licensed under the MIT License.
Dependencies
- simple-git: Used to interact with the Git repository and retrieve diffs.
- TypeScript: The plugin is written in TypeScript for type safety and easier development.
| |