Agent skills - adjusted to install genkit...#10587
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds support for custom skill packages in installAgentSkills by introducing a skillPackage option, which is then utilized during the Firebase Studio migration process. The feedback identifies a violation of the repository's style guide in the unit tests, where as any is used as a type assertion. It is recommended to dynamically import child_process and provide a fully typed mock object instead.
| it("should use custom skill package if provided", async () => { | ||
| const spawnSyncStub = sandbox.stub(require("child_process"), "spawnSync").returns({ | ||
| status: 0, | ||
| } as any); |
There was a problem hiding this comment.
The use of as any as a type assertion violates the repository style guide rule: "Never use any or unknown as an escape hatch." (GEMINI.md, line 38).
Instead of using as any, we can dynamically import child_process to get full type safety and provide all the required properties of SpawnSyncReturns<Buffer> to avoid any type casting.
| it("should use custom skill package if provided", async () => { | |
| const spawnSyncStub = sandbox.stub(require("child_process"), "spawnSync").returns({ | |
| status: 0, | |
| } as any); | |
| it("should use custom skill package if provided", async () => { | |
| const cp = await import("child_process"); | |
| const spawnSyncStub = sandbox.stub(cp, "spawnSync").returns({ | |
| status: 0, | |
| pid: 0, | |
| output: [], | |
| stdout: Buffer.alloc(0), | |
| stderr: Buffer.alloc(0), | |
| signal: null, | |
| }); |
References
- Never use
anyorunknownas an escape hatch. Define proper interfaces/types or use type guards. (link)
joehan
left a comment
There was a problem hiding this comment.
LGTM after you fix the failing tests
Agent skills - adjusted to install genkit. Added genkit to FBS migrate.ts.