-
Notifications
You must be signed in to change notification settings - Fork 1
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
octokit
library 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_URI
andPLASMO_PUBLIC_GITHUB_AUTH
variables for GitHub authentication. - Commented out
PLASMO_PUBLIC_GITHUB_CLIENT_ID
andPLASMO_PUBLIC_GITHUB_CLIENT_SECRET
as their usage is still being determined.
- Added
- package.json
- Added
octokit
as a dependency.
- Added
- plasmo.config.ts
- No significant changes.
- src/connections/github/connection.tsx
- Implemented the
GitHubConnection
component to fetch commit data and create Mantis spaces. - Uses
octokit
to 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
GitHubConnection
to the list of available connections.
- Added
- yarn.lock
- Updated dependencies, including adding
octokit
and 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
.env
file 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
createSpace
function 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
injectUI
function 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.
#PLASMO_PUBLIC_GITHUB_CLIENT_SECRET = | ||
PLASMO_PUBLIC_GITHUB_REDIRECT_URI = http://localhost:3000/oauth/callback | ||
PLASMO_PUBLIC_GITHUB_AUTH= |
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.
Storing the GitHub authentication token directly in the .env
file 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.
#PLASMO_PUBLIC_GITHUB_AUTH= # Consider using a more secure method for handling authentication, such as OAuth flow
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.
}); | ||
diff = diffResponse.data as string; |
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.
@@ -413,7 +413,7 @@ const ConnectionDialog = ({ activeConnections, close }: { activeConnections: Man | |||
<ArrowHead disabled={connectionIdx === 0} left /> | |||
</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.
Added connection to Mantis Extensions to allow for GitHub space creation