-
Notifications
You must be signed in to change notification settings - Fork 1
Develop #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- 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 <[email protected]>
- 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 <[email protected]>
- Add `AIGITCOMMIT_SIGNOFF` environment variable to README - Mention auto sign-off feature when variable is set to true Signed-off-by: mingcheng <[email protected]>
- 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 <[email protected]> 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 <[email protected]>
- 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 <[email protected]> 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 <[email protected]>
- 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 <[email protected]>
- 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 <[email protected]>
- 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 <[email protected]>
WalkthroughThis update introduces a new Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CLI
participant Main
participant OpenAI
participant Git
User->>CLI: Run command with --check
CLI->>Main: Parse CLI args
Main->>OpenAI: check_model(model_name)
OpenAI->>OpenAI: Fetch available models
OpenAI-->>Main: Return success/failure
Main-->>User: Output check result
User->>CLI: Run commit command
CLI->>Main: Parse CLI args (with/without signoff)
Main->>Git: commit(message, need_signoff)
Git->>Git: Append signoff if needed
Git-->>Main: Return commit result
Main-->>User: Output commit message
Possibly related PRs
Suggested labels
Poem
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
Cargo.toml (1)
30-34
: Remove unused dependencies from Cargo.tomlSearches for
serde
,serde_json
,strum
, andstrum_macros
in code (including derive macros and fully qualified references) yielded no matches. You can safely delete these commented‐out entries to clean up the manifest. Before merging, please double-check that no tests, examples, or documentation snippets still rely on them.• Cargo.toml (lines 30–34): remove
#serde = { version = "1.0", features = ["derive"] } #serde_json = "1.0" #strum = "0.27.1" #strum_macros = "0.27.1"src/openai.rs (1)
91-108
: LGTM: Enhanced model validation with improved specificity.The refactored method now properly validates both API connectivity and model availability, which is much more useful than the previous simple connectivity check. The debug logging of available models is helpful for troubleshooting.
Consider optimizing the model check if the API supports querying a specific model directly instead of fetching the entire list, especially for APIs with many models.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
Cargo.lock
is excluded by!**/*.lock
📒 Files selected for processing (6)
Cargo.toml
(2 hunks)README.md
(4 hunks)src/cli.rs
(1 hunks)src/git.rs
(6 hunks)src/main.rs
(5 hunks)src/openai.rs
(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Rust project - latest (nightly)
- GitHub Check: Rust project - latest (stable)
- GitHub Check: Rust project - latest (beta)
🔇 Additional comments (12)
README.md (1)
22-22
: LGTM: Clean formatting improvements.The whitespace and formatting corrections improve document readability without affecting content.
Also applies to: 52-52, 67-67, 99-99
src/cli.rs (1)
42-48
: LGTM: Well-implemented CLI flag.The new
--check
flag follows the existing pattern and provides clear functionality for validating OpenAI API configuration.src/main.rs (2)
88-99
: LGTM: Well-implemented model validation check.The conditional model checking logic is properly implemented with good error handling and logging. The check only runs when the
--check
flag is enabled, which is appropriate.
166-166
: Commit method signature confirmed
TheGit::commit
method in src/git.rs (line 40) is defined as:pub fn commit(&self, message: &str, need_signoff: bool) -> Result<(), Box<dyn Error>>which matches the call in src/main.rs (
repository.commit(&result, need_signoff)
). No further changes required.src/git.rs (8)
15-15
: LGTM: Import addition is correct.The addition of
Signature
to the imports is appropriate for the new signature creation functionality.
43-67
: LGTM: Signoff logic implementation is correct.The signoff logic is well-implemented with proper formatting and conditional application. The signoff format follows the conventional "Signed-off-by" standard, and the logic correctly appends it only when needed.
54-58
: Verify the impact of changing signature source.The change from using HEAD commit's author/committer signatures to using repository configuration values is a significant behavioral change. This ensures commits use the current user's configured identity rather than inheriting from the previous commit.
This change improves consistency by using the repository's configured user identity, but verify that this aligns with the expected behavior for your use case.
69-76
: LGTM: Commit creation logic is correct.The commit creation now properly uses the new signature for both author and committer, which is the standard practice for most Git operations.
88-105
: LGTM: Author email retrieval is well-implemented.The method includes proper error handling, logging, and follows the same pattern as other methods in the struct. The configuration access is correct.
107-123
: LGTM: Author name retrieval is well-implemented.The method mirrors the email retrieval implementation with consistent error handling and logging patterns.
125-125
: LGTM: Documentation comments improve code clarity.The addition of documentation comments for the
get_diff
andget_logs
methods enhances code readability and maintainability.Also applies to: 173-173
40-40
: Allcommit
calls include the newneed_signoff
parameterVerified that every usage of your
commit(&str, bool)
wrapper has been updated:
- src/main.rs:
repository.commit(&result, need_signoff)
No further updates are needed.
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Chores