mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-10 22:21:22 -07:00
Agent Skills: Add skill directory to WorkspaceContext upon activation (#15870)
This commit is contained in:
@@ -29,6 +29,9 @@ describe('ActivateSkillTool', () => {
|
||||
},
|
||||
];
|
||||
mockConfig = {
|
||||
getWorkspaceContext: vi.fn().mockReturnValue({
|
||||
addDirectory: vi.fn(),
|
||||
}),
|
||||
getSkillManager: vi.fn().mockReturnValue({
|
||||
getSkills: vi.fn().mockReturnValue(skills),
|
||||
getAllSkills: vi.fn().mockReturnValue(skills),
|
||||
@@ -81,6 +84,9 @@ describe('ActivateSkillTool', () => {
|
||||
expect(mockConfig.getSkillManager().activateSkill).toHaveBeenCalledWith(
|
||||
'test-skill',
|
||||
);
|
||||
expect(mockConfig.getWorkspaceContext().addDirectory).toHaveBeenCalledWith(
|
||||
'/path/to/test-skill',
|
||||
);
|
||||
expect(result.llmContent).toContain('<ACTIVATED_SKILL name="test-skill">');
|
||||
expect(result.llmContent).toContain('<INSTRUCTIONS>');
|
||||
expect(result.llmContent).toContain('Skill instructions content.');
|
||||
|
||||
@@ -115,6 +115,12 @@ ${folderStructure}`,
|
||||
|
||||
skillManager.activateSkill(skillName);
|
||||
|
||||
// Add the skill's directory to the workspace context so the agent has permission
|
||||
// to read its bundled resources.
|
||||
this.config
|
||||
.getWorkspaceContext()
|
||||
.addDirectory(path.dirname(skill.location));
|
||||
|
||||
const folderStructure = await this.getOrFetchFolderStructure(
|
||||
skill.location,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user