Repository navigation
feat(cli): support custom extension hooks and skills directories - #25008
skainguyen1412 wants to merge 4 commits into
Conversation
Summary of ChangesHello, 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 significantly enhances the flexibility of the Gemini CLI by allowing extension authors to define custom directory paths for their hooks and skills. This change enables better integration with diverse repository structures, moving away from a rigid default directory layout. It ensures that extensions can be organized more intuitively while maintaining robust security through path validation and preserving full backward compatibility for existing extensions. 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. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces support for custom directories for extension hooks and skills by adding hooksDir and skillsDir configuration options to the extension manifest. It updates the extension manager and discovery service to resolve these paths safely within the extension directory and includes comprehensive tests for these new capabilities. I have provided a security-focused suggestion to sanitize hook identifiers to prevent potential prompt injection vulnerabilities.
|
Can you take a look, @cocosheng-g? Feel free to suggest any changes, and let me know if you need me to handle anything. |
Summary
Add support for custom extension hooks and skills directories via optional
hooksDirandskillsDirfields ingemini-extension.json.This lets extension authors reuse existing repository layouts without being forced to place content under
hooks/andskills/, while preserving the current default behavior for existing extensions.Details
hooksDirandskillsDirmanifest fields.hooks/andskills/when the new fields are not provided.hooks and skills directories are included in safety prompts.
gemini-hooksandgemini-skills.Related Issues
Closes #19969
How to Validate
Run the CLI-focused tests:
npm run test --workspace @google/gemini-cli -- \ src/config/extension.test.ts \ src/config/extension-manager-hydration.test.ts \ src/config/extension-manager-skills.test.ts \ src/commands/extensions/install.test.tsExpected result: all targeted CLI tests pass.
Run the core trust-discovery tests:
npm run test --workspace @google/gemini-cli-core -- \ src/services/FolderTrustDiscoveryService.test.tsExpected result: all targeted core tests pass.
Verify backward compatibility:
hooksDirorskillsDir.hooks/hooks.jsonandskills/exactly as before.
Verify custom directory support:
{ "hooksDir": "gemini-hooks", "skillsDir": "gemini-skills" }gemini-hooks/hooks.json.gemini-skills/<skill-name>/SKILL.md.Verify path safety:
hooksDirorskillsDirto a path outside the extension root, suchas
../shared-hooks.extension directory are loaded.
Pre-Merge Checklist