-
Notifications
You must be signed in to change notification settings - Fork 4
Add GitBlame connection for GitHub repositories #19
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
base: aryana_github
Are you sure you want to change the base?
Conversation
…ovement UI improvements for the connection dialog widget
…n on upstream base
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.
Summary of Changes
Hello @ArjunSharma7864, 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 introduces a new GitBlame connection that allows the Mantis system to integrate directly with GitHub repositories. It enables automatic detection of GitHub file pages, extracts detailed Git blame information for each line of code, and incorporates repository metadata. The extracted data is then used to create comprehensive Mantis spaces, all presented through a seamlessly integrated, GitHub-style user interface with enhanced interactive elements.
Highlights
- New GitBlame Connection: A new connection,
GitBlameConnection, has been introduced, specifically designed to extract and process Git blame information from GitHub repositories. This enables Mantis to provide detailed historical context for code lines. - Seamless GitHub Integration: The system now automatically detects when a user is viewing a GitHub file page (URLs containing
/blob/) and can trigger the GitBlame connection. It leverages the@octokit/restlibrary to interact with the GitHub API, fetching blame data and repository metadata. - Detailed Data Extraction: The connection extracts comprehensive data for each line, including filename, line number, commit SHA, author, date, and line content. It also pulls in repository-level metadata such as full name, description, and primary language, enriching the context within Mantis spaces.
- Mantis Space Creation: The extracted Git blame and repository data are used to create structured Mantis spaces, allowing users to analyze file history and collaborate more effectively within the Mantis environment.
- Enhanced UI/UX with Framer Motion: Significant enhancements have been made to the user interface, particularly for the space creation dialog. It now features draggable and resizable panels, along with smooth animations powered by
framer-motion, providing a more interactive and polished user experience that blends well with GitHub's own UI. - Permissions Update: The
plasmo.config.tsfile has been updated to include necessaryhost_permissionsforapi.github.comandgithub.com, ensuring the extension has the required access to perform its operations.
Using Gemini Code Assist
The 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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.
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
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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.
Code Review
This pull request introduces a new GitBlame connection for GitHub, which is a great feature. The implementation of the connection has some critical issues related to security and correctness that need to be addressed. Specifically, a GitHub token is exposed on the client-side, and the core git blame logic is flawed, leading to incorrect results. There are also some high-severity issues with URL parsing and potential runtime errors. I've provided detailed comments and suggestions to fix these problems. The UI improvements in content.tsx are excellent, introducing a draggable and resizable dialog panel, which significantly enhances the user experience.
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.
Thanks for your contribution @ArjunSharma7864! I saw that this handles a GitHub token - can you make it so the user specifies their PAT and it is saved by the extension instead (so we don't hardcode our own)?
Once you're done with that, just resolve any Gemini comments and re-request my review - then I'll check to make sure this runs for me locally/suggest final changes!
…gement, use GraphQL API for accurate blame data, improve URL parsing robustness, add proper TypeScript types, and use Tailwind CSS classes
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.
Thanks for making changes @ArjunS7864! I'm getting a few errors on my end.
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.
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.
I see @gconsigli, I am currently working to fix this. Thank you for letting me know
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.
|
I'll run another Gemini review to see if it finds any other issues. |
|
/gemini review |
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.
Code Review
This pull request introduces a valuable new GitBlame connection for GitHub repositories and significantly enhances the user interface with a new draggable and resizable dialog. The implementation is well-structured, but there are a few critical areas in the new connection logic that need attention regarding correctness and performance. My review includes suggestions to fix an incorrect and inefficient data fetching strategy in the blame analysis, improve URL parsing for branches with slashes, and enhance code quality and organization in both the new connection and the updated UI components.
…icient blame implementation, better URL parsing, code organization, and type safety improvements
|
/gemini review |
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.
Code Review
This pull request introduces a significant new feature, the GitBlame connection for GitHub, and includes a major UI overhaul for the dialogs, making them draggable, resizable, and animated. The changes are well-structured and the new functionality is impressive. My review focuses on a potential bug in the new dialog component, some opportunities to improve maintainability and browser compatibility, and removal of dead code.
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.
…ponses and fallback authentication for GraphQL operations
|
I'm still getting the same error on my end. @ArjunS7864 - Can you try testing it on your end? |
- Updated trigger to work on both blob and pull request pages - Added PR detection and branch extraction logic - Enhanced URL parsing for PR file views - Added PR metadata to space creation (isPR, prNumber) - Updated UI injection to handle PR page layouts - Added PR indicator to button text - Improved error handling for all scenarios
|
Hi @gconsigli I made some changes, let me know if this works! |




What This PR Adds
This PR introduces a new GitBlame connection that integrates with GitHub repositories to provide Git blame information through the Mantis system.
Features
Technical Details
src/connections/gitblame/connection.tsx@octokit/restfor GitHub API integrationTesting
Usage
Users can now visit any GitHub file page and activate the GitBlame connection to analyze file history and create Mantis spaces with detailed blame data.