Skip to content

Add version#19

Merged
kasumi-1 merged 6 commits intosemperai:masterfrom
kasumi-1:add-version
Aug 17, 2025
Merged

Add version#19
kasumi-1 merged 6 commits intosemperai:masterfrom
kasumi-1:add-version

Conversation

@kasumi-1
Copy link
Contributor

@kasumi-1 kasumi-1 commented Aug 17, 2025

Summary by CodeRabbit

  • New Features

    • Added a --version/-V command to display the tool’s version and exit.
  • Documentation

    • Revised help text and examples to show version usage.
    • Rewrote the manpage into a configuration- and template-focused guide: simplified option descriptions, renamed sections, added CONFIGURATION FILES guidance (including .gitcommitai/.gitmessage), updated examples with placeholders, and clarified configuration precedence.
  • Chores

    • Startup debug logs now include the current version when debug is enabled.

- Introduce --version/-V flag to show version information
- Add version display in debug mode startup message
- Update help text and examples to include version flag
- Early detection of version flag before argument parsing
@coderabbitai
Copy link

coderabbitai bot commented Aug 17, 2025

Warning

Rate limit exceeded

@kasumi-1 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 3 minutes and 28 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 6fd92c9 and 6777afa.

📒 Files selected for processing (1)
  • git-commitai.1 (7 hunks)

Walkthrough

Adds module versioning to git_commitai.py via a public __version__ = "0.1.0", exposes version output through argparse's built-in --version action, includes the version in debug startup logging, and rewrites the git-commitai.1 manpage to emphasize configuration, templates, and precedence while condensing option text.

Changes

Cohort / File(s) Summary
CLI versioning
git_commitai.py
Adds __version__ = "0.1.0"; replaces any custom version display with argparse's --version action that uses __version__; startup debug log now includes the version when --debug is set; updates CLI help/examples to include --version.
Manual page / documentation
git-commitai.1
Rewrites and reorganizes the manpage: condenses option descriptions (shorter --debug/-v notes), renames and restructures sections (adds CONFIGURATION FILES, removes TEMPLATE FILES), introduces .gitcommitai and .gitmessage examples and model spec placeholders, updates configuration precedence and examples, and removes provider-specific/long-form sections.

Sequence Diagram(s)

sequenceDiagram
  actor User
  participant CLI as git_commitai CLI
  participant Parser as ArgParser
  participant Main as main()

  User->>CLI: Invoke command (maybe --version)
  CLI->>Main: start
  Main->>Parser: parse_args() (argparse with version action)
  alt --version provided
    Parser-->>User: Print version (uses __version__) and exit
  else
    Parser-->>Main: return args
    Main-->>Main: normal startup (logs include version if --debug)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • Cleanup #10 — Modifies the same CLI version behavior: that PR removes the argparse --version argument and manpage entry, which conflicts with this PR’s addition of --version and related docs changes.

Poem

I twitch my nose at the version sign,
A tiny tag — now neat, defined.
With argparse I chirp, “Here's who I am!”
Debug logs wink as I scamper and scram.
A rabbit release hops off — 0.1.0! 🐇✨

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

- Document --dry-run flag usage with examples
- Show how to combine dry-run with other options
- Include sample output and debugging tips
- Explain that hooks are skipped during dry-run
Copy link

@coderabbitai coderabbitai bot left a 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 (5)
git_commitai.py (5)

103-107: Consider delegating --version handling to argparse

You can avoid manual printing/exiting by letting argparse handle version display. This also removes the need to call sys.exit() in a helper and reduces branching in main().


1416-1419: Remove pre-parse --version check (let argparse handle it)

This early check duplicates the argparse-based handling. Delegating to argparse simplifies control flow and avoids double maintenance.

Apply this diff to remove the redundant early check:

-    # Check for --version flag early
-    if "--version" in sys.argv or "-V" in sys.argv:
-        show_version()
-

1440-1441: Help example: surface the -V alias

Minor UX tweak: show the short alias in the examples to improve discoverability.

Apply this diff to the example line:

-  git-commitai --version          # Show version information
+  git-commitai --version or -V    # Show version information

1532-1537: Use argparse’s built-in version action

This avoids manual conditionals and exits; argparse will print the version and exit consistently, including in -h help output.

Apply this diff:

-    parser.add_argument(
-        "--version",
-        "-V",
-        action="store_true",
-        help="Show version information and exit",
-    )
+    parser.add_argument(
+        "--version",
+        "-V",
+        action="version",
+        version="%(prog)s " + __version__,
+        help="Show version information and exit",
+    )

1547-1550: Remove post-parse args.version check (redundant with argparse action="version")

If you adopt argparse’s version action, this block becomes dead code.

Apply this diff:

-    # Handle version flag (though this should have been caught earlier)
-    if args.version:
-        show_version()
-
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 3406c31 and 5bce50f.

📒 Files selected for processing (1)
  • git_commitai.py (6 hunks)
🔇 Additional comments (2)
git_commitai.py (2)

19-21: Version constant added — good baseline

Defining a module-level version is a solid start for CLI versioning and logging.


1555-1555: Nice touch: include version in startup debug logs

Including the version in debug logs improves traceability during support/debug sessions.

- Removed custom show_version() function
- Simplified --version flag processing by using argparse's native support
- Eliminated redundant version check in main() since argparse now handles it

This change reduces code duplication and leverages argparse's standard version functionality for better maintainability.
- Reorganized sections for better flow and clarity
- Removed redundant descriptions and simplified explanations
- Consolidated configuration and template sections
- Updated examples to focus on essential use cases
- Streamlined option documentation while maintaining completeness
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🔭 Outside diff range comments (3)
git-commitai.1 (3)

3-3: Align man page header with code version (0.1.0) and current year.

The .TH header shows 1.0.0 (and 2024), which conflicts with the PR’s introduced version = "0.1.0" and 2025 copyright. Update for consistency.

-.TH GIT-COMMITAI 1 "2024" "1.0.0" "Git Commit AI Manual"
+.TH GIT-COMMITAI 1 "2025" "0.1.0" "Git Commit AI Manual"

9-24: Expose --version in SYNOPSIS.

The CLI introduces --version but it’s missing here. Include it to reflect available flags.

 [\fB\-h\fR|\fB\-\-help\fR]
+[\fB\-\-version\fR]

33-58: Add --version to “Git Commit AI Specific Options.”

Document the new flag in OPTIONS to match argparse’s version action.

 .BR \-\-model " " \fIname\fR
 Override the AI model name for this commit.
 Overrides the \fBGIT_COMMIT_AI_MODEL\fR environment variable.
 
+.TP
+.BR \-\-version
+Display version information and exit.
🧹 Nitpick comments (4)
git-commitai.1 (4)

41-43: Note that --debug includes version in startup logs.

Minor clarity improvement to set expectations when troubleshooting.

 .BR \-\-debug
-Enable debug mode. Outputs detailed logging information to stderr for troubleshooting.
+Enable debug mode. Outputs detailed logging information to stderr for troubleshooting.
+When enabled, startup logs include the tool version.

99-104: API key isn’t always required (local providers).

Since the docs show a local LLM example, clarify that an API key is only required for providers that mandate it.

 .B GIT_COMMIT_AI_KEY
-Your API key for the AI service (required).
-Can be overridden with \fB--api-key\fR.
+Your API key for the AI service (if your provider requires one).
+Can be overridden with \fB--api-key\fR. Not needed for local providers that do not require authentication.

164-172: Optional: If using OpenRouter by default, consider provider-prefixed model alias.

OpenRouter typically expects provider-qualified model names (e.g., openai/gpt-4o). If that’s your default API URL, this example may be more accurate.

 # Use a different model for this commit
-$ git commitai --model "gpt-4o"
+$ git commitai --model "openai/gpt-4o"

If the tool normalizes model aliases internally, you can ignore this.


232-247: Avoid duplication between TEMPLATE FILES and FILES sections.

Template precedence appears in both TEMPLATE FILES and FILES, which can drift over time. Consider centralizing precedence details in one place and cross-referencing from the other section.

Also applies to: 268-277

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 5bce50f and 6fd92c9.

📒 Files selected for processing (2)
  • git-commitai.1 (4 hunks)
  • git_commitai.py (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • git_commitai.py
🔇 Additional comments (1)
git-commitai.1 (1)

207-217: LGTM: Clear configuration precedence.

The ordered precedence (CLI > env > .gitcommitai > default) is clearly documented and aligns with typical CLI expectations.

Comment on lines 61 to 64
.BR \-a ", " \-\-all
Automatically stage all tracked, modified files before committing.
Equivalent to running \fBgit add -u\fR before the commit.
Cannot be used with \fB--amend\fR.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Remove incorrect restriction: “-a cannot be used with --amend.”

In Git, combining -a with --amend is valid and commonly used. The current sentence is misleading.

 .BR \-a ", " \-\-all
 Automatically stage all tracked, modified files before committing.
-Cannot be used with \fB--amend\fR.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
.BR \-a ", " \-\-all
Automatically stage all tracked, modified files before committing.
Equivalent to running \fBgit add -u\fR before the commit.
Cannot be used with \fB--amend\fR.
.BR \-a ", " \-\-all
Automatically stage all tracked, modified files before committing.
🤖 Prompt for AI Agents
In git-commitai.1 around lines 61 to 64, remove the incorrect sentence stating
"-a cannot be used with --amend" and update the wording to correctly state that
-a automatically stages all tracked, modified files before committing and may be
combined with --amend; simply delete the prohibition and, if desired, add a
short clarifying phrase like "May be used with --amend" or leave the line out so
only the factual behavior remains.

- Update copyright year to 2025
- Add --version flag documentation
- Revise API key requirement wording
- Update example model usage to openai/gpt-4o
@kasumi-1 kasumi-1 merged commit d72b99a into semperai:master Aug 17, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant