Repository navigation
Conversation
* feat: implement signoff feature for commit messages ✍️ - Add signoff option to CLI arguments in `cli.rs` - Implement author name and email retrieval in `git.rs` - Append signoff to commit message in `main.rs` if enabled - Add tests for author name and email functions in `git.rs` Signed-off-by: mingcheng <mingcheng@apache.org> * feat: add auto signoff detection from environment variable ✍️ - Implement detection of GIT_AUTO_SIGNOFF environment variable - Enable signoff if environment variable is set to true or 1 - Update logic to combine CLI signoff option with environment variable check Signed-off-by: mingcheng <mingcheng@apache.org> * docs: update README with new environment variable for signoff 📚 - Add `AIGITCOMMIT_SIGNOFF` environment variable to README - Mention auto sign-off feature when variable is set to true Signed-off-by: mingcheng <mingcheng@apache.org> * style: update log message formatting in git and openai modules 🖌️ (#13) - Replace static string formatting with variable interpolation in log messages - Apply consistent formatting for trace logs across `git.rs` and `openai.rs` Signed-off-by: mingcheng <mingcheng@apache.org> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * docs: correct environment variable name in README 📚 - Update `AIGITCOMMIT_SIGNOFF` to `GIT_AUTO_SIGNOFF` in README for consistency - Reflect the correct variable used in the code for auto signoff feature Signed-off-by: mingcheng <mingcheng@apache.org> * style: update log message formatting in git and openai modules 🖌️ (#13) - Replace static string formatting with variable interpolation in log messages - Apply consistent formatting for trace logs across `git.rs` and `openai.rs` Signed-off-by: mingcheng <mingcheng@apache.org> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * docs: correct environment variable name in README 📚 - Update `AIGITCOMMIT_SIGNOFF` to `GIT_AUTO_SIGNOFF` in README for consistency - Reflect the correct variable used in the code for auto signoff feature Signed-off-by: mingcheng <mingcheng@apache.org> * docs: update file modification timestamps 📅 - Adjust last modified timestamps in `main.rs` and `openai.rs` for accuracy - Resolve merge conflict timestamp in `main.rs` to reflect latest update Signed-off-by: mingcheng <mingcheng@apache.org> * feat: update version to 1.3.3 and add grok keyword 🚀 - Bump version from 1.3.2 to 1.3.3 in Cargo.toml - Add "grok" to keywords list in package metadata * feat: add CLI check for OpenAI API and model availability 🔍 - Introduce --check flag in CLI to verify API key and model - Implement check_model function to list and validate available models - Integrate check logic in main.rs with error handling - Comment out unused dependencies in Cargo.toml - Update package categories in Cargo.toml * refactor: simplify string formatting in model validation 🛠️ - Update error message formatting in main.rs to use direct variable interpolation - Simplify debug and error messages in openai.rs with consistent string formatting - Remove redundant string concatenation for cleaner code readability Signed-off-by: mingcheng <mingcheng@apache.org> * feat: implement signoff feature for git commits ✍️ - Add support for signed-off-by line in commit messages with configurable option - Refactor commit function to accept signoff parameter in git.rs - Retrieve author name and email from repository config for signoff - Remove redundant signoff logic from main.rs and centralize in git.rs - Update commit call in main.rs to pass signoff requirement Signed-off-by: mingcheng <mingcheng@apache.org> --------- Signed-off-by: mingcheng <mingcheng@apache.org> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* feat: implement signoff feature for commit messages ✍️ - Add signoff option to CLI arguments in `cli.rs` - Implement author name and email retrieval in `git.rs` - Append signoff to commit message in `main.rs` if enabled - Add tests for author name and email functions in `git.rs` Signed-off-by: mingcheng <mingcheng@apache.org> * feat: add auto signoff detection from environment variable ✍️ - Implement detection of GIT_AUTO_SIGNOFF environment variable - Enable signoff if environment variable is set to true or 1 - Update logic to combine CLI signoff option with environment variable check Signed-off-by: mingcheng <mingcheng@apache.org> * docs: update README with new environment variable for signoff 📚 - Add `AIGITCOMMIT_SIGNOFF` environment variable to README - Mention auto sign-off feature when variable is set to true Signed-off-by: mingcheng <mingcheng@apache.org> * style: update log message formatting in git and openai modules 🖌️ (#13) - Replace static string formatting with variable interpolation in log messages - Apply consistent formatting for trace logs across `git.rs` and `openai.rs` Signed-off-by: mingcheng <mingcheng@apache.org> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * docs: correct environment variable name in README 📚 - Update `AIGITCOMMIT_SIGNOFF` to `GIT_AUTO_SIGNOFF` in README for consistency - Reflect the correct variable used in the code for auto signoff feature Signed-off-by: mingcheng <mingcheng@apache.org> * style: update log message formatting in git and openai modules 🖌️ (#13) - Replace static string formatting with variable interpolation in log messages - Apply consistent formatting for trace logs across `git.rs` and `openai.rs` Signed-off-by: mingcheng <mingcheng@apache.org> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * docs: correct environment variable name in README 📚 - Update `AIGITCOMMIT_SIGNOFF` to `GIT_AUTO_SIGNOFF` in README for consistency - Reflect the correct variable used in the code for auto signoff feature Signed-off-by: mingcheng <mingcheng@apache.org> * docs: update file modification timestamps 📅 - Adjust last modified timestamps in `main.rs` and `openai.rs` for accuracy - Resolve merge conflict timestamp in `main.rs` to reflect latest update Signed-off-by: mingcheng <mingcheng@apache.org> * feat: update version to 1.3.3 and add grok keyword 🚀 - Bump version from 1.3.2 to 1.3.3 in Cargo.toml - Add "grok" to keywords list in package metadata * feat: add CLI check for OpenAI API and model availability 🔍 - Introduce --check flag in CLI to verify API key and model - Implement check_model function to list and validate available models - Integrate check logic in main.rs with error handling - Comment out unused dependencies in Cargo.toml - Update package categories in Cargo.toml * refactor: simplify string formatting in model validation 🛠️ - Update error message formatting in main.rs to use direct variable interpolation - Simplify debug and error messages in openai.rs with consistent string formatting - Remove redundant string concatenation for cleaner code readability Signed-off-by: mingcheng <mingcheng@apache.org> * feat: implement signoff feature for git commits ✍️ - Add support for signed-off-by line in commit messages with configurable option - Refactor commit function to accept signoff parameter in git.rs - Retrieve author name and email from repository config for signoff - Remove redundant signoff logic from main.rs and centralize in git.rs - Update commit call in main.rs to pass signoff requirement Signed-off-by: mingcheng <mingcheng@apache.org> --------- Signed-off-by: mingcheng <mingcheng@apache.org> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [tracing-subscriber](https://github.com/tokio-rs/tracing) from 0.3.19 to 0.3.20. - [Release notes](https://github.com/tokio-rs/tracing/releases) - [Commits](tokio-rs/tracing@tracing-subscriber-0.3.19...tracing-subscriber-0.3.20) --- updated-dependencies: - dependency-name: tracing-subscriber dependency-version: 0.3.20 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [slab](https://github.com/tokio-rs/slab) from 0.4.10 to 0.4.11. - [Release notes](https://github.com/tokio-rs/slab/releases) - [Changelog](https://github.com/tokio-rs/slab/blob/master/CHANGELOG.md) - [Commits](tokio-rs/slab@v0.4.10...v0.4.11) --- updated-dependencies: - dependency-name: slab dependency-version: 0.4.11 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
- Introduce `.coderabbit.yaml` for automated code reviews - Configure language to en-US and define path filters - Enable high-level summaries and auto-review with clippy Signed-off-by: mingcheng <mingcheng@apache.org> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Add signoff option to CLI arguments in `cli.rs` - Implement author name and email retrieval in `git.rs` - Append signoff to commit message in `main.rs` if enabled - Add tests for author name and email functions in `git.rs` Signed-off-by: mingcheng <mingcheng@apache.org>
- Implement detection of GIT_AUTO_SIGNOFF environment variable - Enable signoff if environment variable is set to true or 1 - Update logic to combine CLI signoff option with environment variable check Signed-off-by: mingcheng <mingcheng@apache.org>
- Add `AIGITCOMMIT_SIGNOFF` environment variable to README - Mention auto sign-off feature when variable is set to true Signed-off-by: mingcheng <mingcheng@apache.org>
- Replace static string formatting with variable interpolation in log messages - Apply consistent formatting for trace logs across `git.rs` and `openai.rs` Signed-off-by: mingcheng <mingcheng@apache.org> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
- Update `AIGITCOMMIT_SIGNOFF` to `GIT_AUTO_SIGNOFF` in README for consistency - Reflect the correct variable used in the code for auto signoff feature Signed-off-by: mingcheng <mingcheng@apache.org>
- Replace static string formatting with variable interpolation in log messages - Apply consistent formatting for trace logs across `git.rs` and `openai.rs` Signed-off-by: mingcheng <mingcheng@apache.org> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
- Update `AIGITCOMMIT_SIGNOFF` to `GIT_AUTO_SIGNOFF` in README for consistency - Reflect the correct variable used in the code for auto signoff feature Signed-off-by: mingcheng <mingcheng@apache.org>
- Adjust last modified timestamps in `main.rs` and `openai.rs` for accuracy - Resolve merge conflict timestamp in `main.rs` to reflect latest update Signed-off-by: mingcheng <mingcheng@apache.org>
- Bump version from 1.3.2 to 1.3.3 in Cargo.toml - Add "grok" to keywords list in package metadata
- Introduce --check flag in CLI to verify API key and model - Implement check_model function to list and validate available models - Integrate check logic in main.rs with error handling - Comment out unused dependencies in Cargo.toml - Update package categories in Cargo.toml
- Update error message formatting in main.rs to use direct variable interpolation - Simplify debug and error messages in openai.rs with consistent string formatting - Remove redundant string concatenation for cleaner code readability Signed-off-by: mingcheng <mingcheng@apache.org>
- Add support for signed-off-by line in commit messages with configurable option - Refactor commit function to accept signoff parameter in git.rs - Retrieve author name and email from repository config for signoff - Remove redundant signoff logic from main.rs and centralize in git.rs - Update commit call in main.rs to pass signoff requirement Signed-off-by: mingcheng <mingcheng@apache.org>
- Add instructions for generating git commit messages - Include details on diff-based message creation - Remove signed-off-by message from commit instructions - Update examples to reflect recent commit styles Signed-off-by: mingcheng <mingcheng@apache.org>
- Update version from 1.3.3 to 1.4.0 in Cargo.toml - Enhance system template with additional instructions - Simplify and clarify template content for better usability - Remove redundant information to streamline template - Ensure template aligns with latest commit message standards Signed-off-by: mingcheng <mingcheng@apache.org>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Reviewer's GuideThis PR optimizes prompt handling by introducing a model availability check via a new CLI flag, refactors signoff logic into the Git layer, updates project metadata and dependencies, refines documentation, and adds a coderabbit configuration file. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the commit message generation workflow by implementing on-demand OpenAI model validation, centralizing Git commit operations, and updating the system prompt to enforce Conventional Commits standards.
- Adds a
--checkCLI option to validate OpenAI API key and model availability before processing - Refactors commit signing logic from main into the Git layer using proper Git signature API
- Updates system prompt template with comprehensive Conventional Commits specification and formatting rules
Reviewed Changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| templates/system.txt | Complete rewrite to enforce Conventional Commits specification with detailed formatting rules |
| src/openai.rs | Replaces deprecated API check with model-specific validation method |
| src/main.rs | Removes commit sign-off logic and integrates new check option workflow |
| src/git.rs | Centralizes commit operations with proper signature handling and sign-off support |
| src/cli.rs | Adds new --check CLI option for API validation |
| README.md | Updates description and adds semantic commit message references |
| Cargo.toml | Version bump and dependency cleanup |
| .coderabbit.yaml | Adds code review automation configuration |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| @@ -1,31 +1,62 @@ | |||
| You are an experienced senior in software development with years of experience contributing to the open-source community. | |||
| You are an expert in generating Git commit messages following the Conventional Commits specification, focusing on creating precise, meaningful, and standardized commit documentation. English must be your primary language. | |||
There was a problem hiding this comment.
There's a typo in the PR title 'chroe/prompt optimize' - it should be 'chore/prompt optimize'.
| pub fn commit(&self, message: &str, need_signoff: bool) -> Result<(), Box<dyn Error>> { | ||
| // Get the current index (staged changes) | ||
|
|
||
| let mut message = message.to_string(); |
There was a problem hiding this comment.
The message parameter is converted to a mutable String but the original parameter could be changed to mut message: String to avoid the clone operation and make the intent clearer.
| pub fn commit(&self, message: &str, need_signoff: bool) -> Result<(), Box<dyn Error>> { | |
| // Get the current index (staged changes) | |
| let mut message = message.to_string(); | |
| pub fn commit(&self, mut message: String, need_signoff: bool) -> Result<(), Box<dyn Error>> { | |
| // Get the current index (staged changes) |
|
|
||
| #[arg( | ||
| long, | ||
| help = "Check the openai api key and model name whether is available", |
There was a problem hiding this comment.
The help text has grammatical issues. It should be 'Check whether the OpenAI API key and model name are available' or 'Check if the OpenAI API key and model name are available'.
| help = "Check the openai api key and model name whether is available", | |
| help = "Check whether the OpenAI API key and model name are available", |
Summary by Sourcery
Validate OpenAI model names on demand and centralize commit sign-off handling by refactoring the Git commit implementation and OpenAI client, bump version, update metadata and README with semantic commit guidelines
New Features:
Enhancements:
Documentation:
Chores: