Switch to using npx skills to install skills#10097
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 refactors the Antigravity skill installation process within the Firebase Studio migration logic. By transitioning from manual GitHub API interactions to leveraging the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
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.
Code Review
This pull request refactors the skill installation process in the Firebase Studio migration to use npx skills add instead of directly downloading files from GitHub. The changes are logical and simplify the implementation. I've added a few suggestions to improve error handling, test coverage for failure cases, and code structure in the tests, in line with the repository's best practices.
|
|
||
| beforeEach(() => { | ||
| sandbox.stub(fs, "stat").resolves({ isDirectory: () => true } as any); | ||
| const cp = require("child_process"); |
There was a problem hiding this comment.
The child_process module is required multiple times within this test file. To improve code clarity and avoid redundancy, consider declaring a variable for the module at the top of the describe block and initializing it once in the beforeEach function. This would make it accessible to all tests within this suite.
For example:
describe("migrate", () => {
let cp: typeof import("child_process");
// ...
beforeEach(() => {
cp = require("child_process");
// ...
});
// ...
});| beforeEach(() => { | ||
| sandbox.stub(fs, "stat").resolves({ isDirectory: () => true } as any); | ||
| const cp = require("child_process"); | ||
| sandbox.stub(cp, "spawnSync").returns({ status: 0 }); |
There was a problem hiding this comment.
This stub only covers the success case for spawnSync. The implementation in migrate.ts handles failures where spawnSync returns a non-zero status or an error object. To comply with the repository's style guide (line 46), which requires testing error cases, please add tests for these failure scenarios. For instance, you could test that a warning is logged when spawnSync is stubbed to return { status: 1 }.
References
- Test error cases and edge conditions, not just the "happy path." (link)
| if (result.status !== 0) { | ||
| throw new Error(`npx skills add exited with code ${result.status}`); | ||
| } |
There was a problem hiding this comment.
To align with the error handling strategy in this repository and the style guide (line 30), please throw a FirebaseError instead of a generic Error. This ensures consistent error reporting.
| if (result.status !== 0) { | |
| throw new Error(`npx skills add exited with code ${result.status}`); | |
| } | |
| if (result.status !== 0) { | |
| throw new FirebaseError(`npx skills add exited with code ${result.status}`); | |
| } |
References
- Throw
FirebaseError(src/error.ts) for expected, user-facing errors. If the error is due to a violation of a precondition (e.g. something that is null but should never be), specify a non-zero exit code. (link)
* Switch to using npx skills to install skills * format + cleanup
Description
Like it says on the tin - this pushes the work of staying up to date with AGYs changes off of our plate, and gets these installs counted on skills.sh