[Skills] Foundation: Centralize management logic and feedback rendering (#15952)

This commit is contained in:
N. Taylor Mullen
2026-01-06 20:11:19 -08:00
committed by GitHub
parent 537d73d0fa
commit bbfa69c9c4
8 changed files with 275 additions and 70 deletions
@@ -36,6 +36,7 @@ vi.mock('../../config/settings.js', async (importOriginal) => {
return {
...actual,
loadSettings: vi.fn(),
isLoadableSettingScope: vi.fn((s) => s === 'User' || s === 'Workspace'),
};
});
@@ -78,7 +79,7 @@ describe('skills enable command', () => {
);
expect(emitConsoleLog).toHaveBeenCalledWith(
'log',
'Skill "skill1" successfully enabled in scope "User".',
'Skill "skill1" enabled by removing it from the disabled list in user settings.',
);
});
@@ -86,22 +87,20 @@ describe('skills enable command', () => {
const mockSettings = {
forScope: vi.fn().mockReturnValue({
settings: { skills: { disabled: [] } },
path: '/user/settings.json',
}),
setValue: vi.fn(),
};
mockLoadSettings.mockReturnValue(
vi.mocked(loadSettings).mockReturnValue(
mockSettings as unknown as LoadedSettings,
);
await handleEnable({
name: 'skill1',
scope: SettingScope.User as LoadableSettingScope,
});
await handleEnable({ name: 'skill1', scope: SettingScope.User });
expect(mockSettings.setValue).not.toHaveBeenCalled();
expect(emitConsoleLog).toHaveBeenCalledWith(
'log',
'Skill "skill1" is already enabled in scope "User".',
'Skill "skill1" is already enabled.',
);
});
});