Conversation
Summary of ChangesHello @tibisabau, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the command-line interface by adding a convenient way for users to query the application's version. This improves user experience and simplifies maintenance by dynamically retrieving version information, ensuring it's always up-to-date with the installed package. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a --version command to the CLI, which is a great addition for usability. The implementation is clean and follows best practices for Typer applications by using an eager callback that exits after printing the version. I appreciate the use of importlib.metadata.version to dynamically fetch the package version, which avoids hardcoding and ensures the version is always in sync with the package metadata. The changes are correct and well-executed. No issues found.
Greptile OverviewGreptile SummaryThis PR adds a global The change is localized to Main issue to address before merge: the Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant Typer as CLI (typer)
participant CLI as codebase_rag/cli.py
participant Meta as importlib.metadata
participant Console as app_context.console
User->>Typer: cgr --version / -v
Typer->>CLI: invoke eager option callback
CLI->>Meta: version('graph-code')
alt distribution metadata present
Meta-->>CLI: "X.Y.Z"
CLI->>Console: print "code-graph-rag version X.Y.Z"
CLI-->>Typer: raise typer.Exit()
else metadata missing
Meta-->>CLI: raise PackageNotFoundError
CLI-->>Typer: unhandled exception (crash)
end
|
Description
Implemented a
--versioncommand that displays the current package version. The version is dynamically read from package metadata usingimportlib.metadata.version('graph-code')to avoid hardcoding. Bothcgr --versionandcgr -vwork correctly, outputting the format:code-graph-rag version X.Y.Z.The implementation uses Typer's callback pattern with
is_eager=Trueto ensure the version check occurs before other option processing, and raisestyper.Exit()to cleanly terminate after displaying the version.Closes #239.
Checklist if Applicable
uv run cgr --versionanduv run cgr -vmake pre-commit(formatting, linting, type checking, security checks, unit tests)