θΏ™ζ˜―indexlocζδΎ›ηš„ζœεŠ‘οΌŒδΈθ¦θΎ“ε…₯任何密码
Skip to content

Conversation

@chrstnb
Copy link
Collaborator

@chrstnb chrstnb commented Oct 7, 2025

TLDR

  • Allow just passing a path (this will create an empty extension)
  • Remove redundant gemini context filepath

Dive Deeper

Reviewer Test Plan

Testing Matrix

🍏 πŸͺŸ 🐧
npm run ❓ ❓ ❓
npx ❓ ❓ ❓
Docker ❓ ❓ ❓
Podman ❓ - -
Seatbelt ❓ - -

Linked issues / bugs

@chrstnb chrstnb requested a review from a team as a code owner October 7, 2025 02:27
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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 gemini extensions new command by making the template argument optional, enabling the creation of empty extensions with just a path. It also streamlines an example extension manifest by removing a redundant contextFileName field.

Highlights

  • Intent: This pull request updates the gemini extensions new command to allow creating an empty extension by only providing a path, and removes a redundant contextFileName field from an example extension manifest.
  • Changes: The gemini extensions new command now supports an optional template argument, allowing users to create a new extension directory with a basic gemini-extension.json manifest if no template is specified. Previously, both a path and a template were mandatory. This involved modifying the command's argument parsing, introducing a new createDirectory helper function, and updating the handleNew logic to conditionally create an empty extension or copy from a template. Additionally, the contextFileName field was removed from the gemini-extension.json example, as it was deemed redundant. Corresponding test cases were updated to reflect these changes, including a new test for creating an empty directory.
  • Reviewer Activity: No specific reviewer activity was provided in the context.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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 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.

Comment on lines +37 to 49
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();
});
Copy link
Contributor

Choose a reason for hiding this comment

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

high

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();
  });

Comment on lines +60 to +64
const extensionName = basename(args.path);
const manifest = {
name: extensionName,
version: '1.0.0',
};
Copy link
Contributor

Choose a reason for hiding this comment

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

high

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.

Suggested change
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',
};

@github-actions
Copy link

github-actions bot commented Oct 7, 2025

Size Change: +555 B (0%)

Total Size: 17.6 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 17.6 MB +555 B (0%)
./bundle/sandbox-macos-permissive-closed.sb 1.03 kB 0 B
./bundle/sandbox-macos-permissive-open.sb 830 B 0 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB 0 B
./bundle/sandbox-macos-restrictive-closed.sb 3.29 kB 0 B
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB 0 B
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB 0 B

compressed-size-action

@chrstnb chrstnb added this pull request to the merge queue Oct 7, 2025
Merged via the queue into main with commit 69f93f8 Oct 7, 2025
20 checks passed
@chrstnb chrstnb deleted the cb/new2 branch October 7, 2025 13:20
@chrstnb
Copy link
Collaborator Author

chrstnb commented Oct 7, 2025

/patch preview

@github-actions
Copy link

github-actions bot commented Oct 7, 2025

βœ… Patch workflow(s) dispatched successfully!

πŸ“‹ Details:

  • Channels: preview
  • Commit: 69f93f852e70794ef0f5991579055b56f58d0489
  • Workflows Created: 1

πŸ”— Track Progress:

github-actions bot pushed a commit that referenced this pull request Oct 7, 2025
@github-actions
Copy link

github-actions bot commented Oct 7, 2025

πŸš€ Patch PR Created!

πŸ“‹ Patch Details:

πŸ“ Next Steps:

  1. Review and approve the hotfix PR: #10642
  2. Once merged, the patch release will automatically trigger
  3. You'll receive updates here when the release completes

πŸ”— Track Progress:

@github-actions
Copy link

github-actions bot commented Oct 7, 2025

πŸš€ Patch Release Started!

πŸ“‹ Release Details:

⏳ Status: The patch release is now running. You'll receive another update when it completes.

πŸ”— Track Progress:

thacio added a commit to thacio/auditaria that referenced this pull request Oct 7, 2025
giraffe-tree pushed a commit to giraffe-tree/gemini-cli that referenced this pull request Oct 10, 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.

4 participants