Agent Skills: Add skill directory to WorkspaceContext upon activation (#15870)

This commit is contained in:
N. Taylor Mullen
2026-01-06 11:24:37 -08:00
committed by GitHub
parent cce4574143
commit 0c54136244
2 changed files with 12 additions and 0 deletions

View File

@@ -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.');

View File

@@ -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,
);