-
Notifications
You must be signed in to change notification settings - Fork 4
Github Extension #6
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: main
Are you sure you want to change the base?
Conversation
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.
Hello @thanosan23, 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!
Summary of Changes
This pull request adds a new connection to Mantis Extensions that allows for the creation of GitHub spaces. It introduces the octokit library to fetch commit data from GitHub repositories, including commit messages, authors, dates, links, and diffs. This data is then used to create a Mantis space, which is injected into the GitHub repository content area as an iframe. The PR also includes minor UI tweaks to improve the appearance of the connection dialog.
Highlights
- GitHub Connection: Adds a new connection to Mantis Extensions for creating spaces from GitHub repositories.
- Dependency: octokit: Introduces the
octokitlibrary to fetch commit data from GitHub. - Data Extraction: Extracts commit messages, authors, dates, links, and diffs from GitHub repositories.
- UI Injection: Injects the created Mantis space into the GitHub repository content area as an iframe.
- UI Tweaks: Includes minor UI tweaks to improve the appearance of the connection dialog.
Changelog
Click here to see the changelog
- .env
- Added
PLASMO_PUBLIC_GITHUB_REDIRECT_URIandPLASMO_PUBLIC_GITHUB_AUTHvariables for GitHub authentication. - Commented out
PLASMO_PUBLIC_GITHUB_CLIENT_IDandPLASMO_PUBLIC_GITHUB_CLIENT_SECRETas their usage is still being determined.
- Added
- package.json
- Added
octokitas a dependency.
- Added
- plasmo.config.ts
- No significant changes.
- src/connections/github/connection.tsx
- Implemented the
GitHubConnectioncomponent to fetch commit data and create Mantis spaces. - Uses
octokitto retrieve commit information, including messages, authors, dates, links, and diffs. - Injects the created Mantis space into the GitHub repository content area as an iframe.
- Includes functions to trigger the connection based on the URL and to create the space with extracted data.
- Implemented the
- src/content.tsx
- Updated the text color of the connection name, counter, and note text in the connection dialog to black.
- src/driver.tsx
- Added
GitHubConnectionto the list of available connections.
- Added
- yarn.lock
- Updated dependencies, including adding
octokitand its related dependencies.
- Updated dependencies, including adding
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 is currently in preview and 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 to provide feedback.
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.
Did you know?
The name 'Octokit' is a play on words, combining 'Octo' (referring to GitHub's Octocat mascot) and 'Kit' (referring to a set of tools or library).
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 connection to Mantis Extensions for GitHub space creation. The changes include adding necessary dependencies, configuring environment variables, and implementing the connection logic. Overall, the code seems well-structured, but there are a few areas that could be improved for clarity and security.
Summary of Findings
- Environment Variable Security: Storing the GitHub authentication token directly in the
.envfile is not secure, especially for a client-side application. This exposes the token to potential vulnerabilities. Consider using a more secure method for handling authentication, such as OAuth flow or storing the token securely on the server-side. - Error Handling: The error handling in the
createSpacefunction could be improved. Currently, it catches errors during the diff retrieval but simply assigns "Diff unavailable". Consider logging the error or providing more informative feedback to the user. - Magic Numbers: The scale variable in the
injectUIfunction is a magic number. It would be better to define it as a constant with a descriptive name.
Merge Readiness
The pull request introduces a significant new feature. However, due to the high severity security concern regarding the storage of the GitHub authentication token, I recommend addressing this issue before merging. Additionally, addressing the error handling and magic number issues would improve the overall quality of the code. I am unable to approve this pull request, and users should have others review and approve this code before merging.
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 GitHub connection to the Mantis extension, allowing users to create spaces based on GitHub repository commits. The changes include adding necessary dependencies, configuring environment variables, implementing the GitHub connection logic, and updating the UI to support the new connection. There are a few suggestions for code improvements, such as using import instead of require, adding descriptive comments, using object destructuring, and removing debugging statements.
|
|
||
| import githubIcon from "data-base64:../../../assets/github.png"; | ||
| import { getSpacePortal, registerAuthCookies, reqSpaceCreation } from "../../driver"; | ||
| const { Octokit } = require("@octokit/core"); |
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.
| </button> | ||
| <div className="flex-grow" /> | ||
| <span className="text-gray-600"> | ||
| <span className="text-black-600"> |
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 so much for this work @thanosan23 and @aryanahou! I'll be reviewing this PR over the next few days to make sure everything is working. |
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.
Just finished my review! I tested this integration on my end for errors and usability. I ran into a few issues on my end with running the integration - I'm not sure if that was because I was using the wrong scopes/GitHub PAT. We might just need to change the logic of the backend with recent changes to space creation.
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.
Since this extension will be published to the Chrome Web Store, can you make a settings page that lets users add their OpenAI API key and GitHub token to use the GitHub integration? Possibly settings that can be added to the GitHub space creation popup:
Make sure that this also includes details about the type of GitHub PAT needed and what scopes should be enabled (fine-grained or classic)
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.
When I try creating a space using this integration, I'm getting the following errors:
github.com/orgoruser/reponame pages:
Non github.com/orgoruser/reponame pages:
I'm not sure if this integration is meant to only be run on the main page of a repo, but if it is, can you make it so the button only shows up on valid repository URLs?

Added connection to Mantis Extensions to allow for GitHub space creation