Commit for me (cfme) automates the generation of conventional commit messages using AI, enhancing your git workflow. By analyzing staged changes, it offers meaningful suggestions that can be reviewed and customized before committing. Embrace consistency and accuracy in your commit history while adapting to team standards effortlessly.
Commit for Me (cfme)
cfme is an innovative tool designed to streamline the commit message generation process by utilizing artificial intelligence. By running cfme after staging changes in your Git repository, it automatically generates meaningful commit messages based on the conventional commits standard, while offering customization options to suit your specific needs.
Key Features
- AI-Powered Commit Messages: Leverages advanced AI models, including OpenAI GPT and GitHub Copilot, to analyze staged changes and produce coherent commit messages.
- Interactive Review & Selection: Offers an interactive selection process with multiple AI-generated candidates via
fzf, allowing for easy review and editing before finalizing the commit. - Default to Conventional Commits: Adopts the conventional commits standard by default for a consistent and organized commit history.
- Full Customization: Easily customize prompts, variables, and commit message standards to align with team workflows.
- Template-Based Prompts: Utilize a straightforward
<__MY_VARIABLE__>syntax for injecting git diffs, specific instructions, or command outputs into your prompts. - Diverse Prompt Types: Effortlessly switch between different commit message standards by modifying a single environment variable.
- Runtime Instructions: Directly guide AI responses using the
-i "Your Instruction Here"option without needing to edit prompt files. - Pipe-Friendly Output: Employ flags like
-ror-mto output messages for integration with a variety of tools and workflows. - Free Tier Available: Compatibility with GitHub Copilot's free tier, making it accessible for all GitHub account holders.
- Cross-Platform Support: Compatible with macOS, Linux, and Windows through environments such as WSL, Git Bash, and Cygwin.
- Reliability Checks: Utilizes Shellspec unit tests to ensure consistent performance and reliability.
Usage Examples
Generate and manage commit messages seamlessly using the following command examples:
cfme # Generate, review, and commit using default settings.
cfme -i "Address user login issue" # Provide additional instructions for better AI context.
cfme -p "path/to/custom-prompt.md" # Use a custom prompt file for specific message styles.
cfme -v "path/to/custom-variables.yaml" # Load custom variables for the prompt.
cfme -m # Output the reviewed commit message instead of committing.
cfme -rs # Suppress output while generating a commit message.
Customization
If the default prompts and variables do not meet requirements, cfme allows for custom prompt creation and variable definitions. Simply define your prompt in markdown format and your variables in YAML, ensuring compatibility with cfme’s syntax. This flexibility enables tailored commit message formatting to fit a variety of development and organizational standards.
Integration
cfme can be integrated into various tools, such as Lazygit, providing a user-friendly experience when generating commit messages within a TUI. Configuration steps and examples are available for embedding cfme into existing workflows, enhancing productivity beyond simple commit message generation.
For developers and teams looking to reduce the cognitive load of writing commit messages while maintaining a high level of consistency and clarity, cfme presents a robust solution.
No comments yet.
Sign in to be the first to comment.