Skip to content

Conversation

@ArjunS7864
Copy link

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

  • Automatic Detection: Triggers when visiting GitHub file pages
  • Git Blame Analysis: Extracts detailed blame information for each line
  • Repository Metadata: Includes repo info, description, and language
  • Mantis Integration: Creates comprehensive spaces with structured data
  • GitHub-Style UI: Seamlessly integrates with GitHub's interface

Technical Details

  • New connection: src/connections/gitblame/connection.tsx
  • Uses @octokit/rest for GitHub API integration
  • Updated connection manager to include GitBlame
  • Added necessary permissions and configuration
  • Comprehensive documentation included

Testing

  • All existing tests pass
  • Extension builds successfully
  • Ready for testing on GitHub file pages

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.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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/rest library 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.ts file has been updated to include necessary host_permissions for api.github.com and github.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

  1. 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.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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.

@gconsigli gconsigli self-requested a review August 28, 2025 23:04
Copy link
Contributor

@gconsigli gconsigli left a 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
@ArjunS7864 ArjunS7864 self-assigned this Aug 28, 2025
@ArjunS7864 ArjunS7864 requested a review from gconsigli August 28, 2025 23:36
@ArjunS7864 ArjunS7864 removed their assignment Aug 28, 2025
Copy link
Contributor

@gconsigli gconsigli left a 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.

Copy link
Contributor

@gconsigli gconsigli Aug 28, 2025

Choose a reason for hiding this comment

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

When running this on my end, this extension requires me to give a GitHub PAT even for public repos. If I enter a blank input, I see:

image

Copy link
Author

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

Copy link
Contributor

@gconsigli gconsigli Aug 28, 2025

Choose a reason for hiding this comment

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

When creating a space with a PAT, I'm getting:

image

@gconsigli
Copy link
Contributor

gconsigli commented Aug 28, 2025

I'll run another Gemini review to see if it finds any other issues.

@gconsigli
Copy link
Contributor

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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
@ArjunS7864
Copy link
Author

/gemini review

@ArjunS7864 ArjunS7864 requested a review from gconsigli August 29, 2025 00:07
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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.

Copy link
Contributor

@gconsigli gconsigli left a comment

Choose a reason for hiding this comment

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

Just having one more issue:

image

…ponses and fallback authentication for GraphQL operations
@ArjunS7864 ArjunS7864 requested a review from gconsigli August 29, 2025 01:18
@gconsigli
Copy link
Contributor

I'm still getting the same error on my end. @ArjunS7864 - Can you try testing it on your end?

@gconsigli
Copy link
Contributor

Also got this:
image

- 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
@ArjunS7864
Copy link
Author

Hi @gconsigli I made some changes, let me know if this works!

@ArjunS7864 ArjunS7864 self-assigned this Sep 6, 2025
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.

3 participants