-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Update gemini extensions new #10629
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
Update gemini extensions new #10629
Conversation
Summary of ChangesHello @chrstnb, 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 PR enhances the Highlights
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.
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 updates the extensions new command to allow creating an empty extension by just providing a path, without a template. The changes look good and align with the goal. I've added two high-severity comments: one to add validation for the generated extension name to prevent creating invalid manifest files, and another to improve test coverage for the new functionality to ensure the manifest file creation is properly tested.
| it('should create directory when no template is provided', async () => { | ||
| mockedFs.access.mockRejectedValue(new Error('ENOENT')); | ||
| mockedFs.mkdir.mockResolvedValue(undefined); | ||
|
|
||
| const parser = yargs([]).command(newCommand).fail(false); | ||
|
|
||
| await parser.parseAsync('new /some/path'); | ||
|
|
||
| expect(mockedFs.mkdir).toHaveBeenCalledWith('/some/path', { | ||
| recursive: true, | ||
| }); | ||
| expect(mockedFs.cp).not.toHaveBeenCalled(); | ||
| }); |
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.
This test case is incomplete. It verifies that the directory is created but misses a crucial part of the new functionality: the creation of the gemini-extension.json manifest file. The test should be updated to also assert that fs.writeFile is called with the correct content, and the test description should be updated to reflect this.
it('should create directory and manifest when no template is provided', async () => {
mockedFs.access.mockRejectedValue(new Error('ENOENT'));
mockedFs.mkdir.mockResolvedValue(undefined);
mockedFs.writeFile.mockResolvedValue(undefined);
const parser = yargs([]).command(newCommand).fail(false);
await parser.parseAsync('new /some/path');
expect(mockedFs.mkdir).toHaveBeenCalledWith('/some/path', {
recursive: true,
});
expect(mockedFs.writeFile).toHaveBeenCalledWith(
path.join('/some/path', 'gemini-extension.json'),
JSON.stringify({ name: 'path', version: '1.0.0' }, null, 2)
);
expect(mockedFs.cp).not.toHaveBeenCalled();
});| const extensionName = basename(args.path); | ||
| const manifest = { | ||
| name: extensionName, | ||
| version: '1.0.0', | ||
| }; |
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.
The extensionName derived from basename(args.path) is not validated. If a user provides a root path like / or an invalid path, basename could return an empty string or other undesirable values (e.g., . or ..), leading to an invalid gemini-extension.json file. This could cause issues later when the extension is used. Please add validation to ensure a valid extension name is generated.
| const extensionName = basename(args.path); | |
| const manifest = { | |
| name: extensionName, | |
| version: '1.0.0', | |
| }; | |
| const extensionName = basename(args.path); | |
| if (!extensionName || ['.', '..', '/', '\\'].includes(extensionName)) { | |
| throw new Error( | |
| `Could not determine a valid extension name from path "${args.path}".` | |
| ); | |
| } | |
| const manifest = { | |
| name: extensionName, | |
| version: '1.0.0', | |
| }; |
|
Size Change: +555 B (0%) Total Size: 17.6 MB βΉοΈ View Unchanged
|
|
/patch preview |
|
β Patch workflow(s) dispatched successfully! π Details:
π Track Progress: |
|
π Patch PR Created! π Patch Details:
π Next Steps:
π Track Progress: |
|
π Patch Release Started! π Release Details:
β³ Status: The patch release is now running. You'll receive another update when it completes. π Track Progress: |
TLDR
Dive Deeper
Reviewer Test Plan
Testing Matrix
Linked issues / bugs