mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-16 09:01:17 -07:00
[Skills] Multi-scope skill enablement and shadowing fix (#15953)
This commit is contained in:
@@ -193,7 +193,6 @@ describe('skillsCommand', () => {
|
||||
(s) => s.name === 'enable',
|
||||
)!;
|
||||
context.services.settings.merged.skills = { disabled: ['skill1'] };
|
||||
// Also need to mock the scope-specific disabled list
|
||||
(
|
||||
context.services.settings as unknown as {
|
||||
workspace: { settings: { skills: { disabled: string[] } } };
|
||||
@@ -212,7 +211,47 @@ describe('skillsCommand', () => {
|
||||
expect(context.ui.addItem).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
type: MessageType.INFO,
|
||||
text: 'Skill "skill1" enabled by removing it from the disabled list in project settings. Use "/skills reload" for it to take effect.',
|
||||
text: 'Skill "skill1" enabled by removing it from the disabled list in project and user settings. Use "/skills reload" for it to take effect.',
|
||||
}),
|
||||
expect.any(Number),
|
||||
);
|
||||
});
|
||||
|
||||
it('should enable a skill across multiple scopes', async () => {
|
||||
const enableCmd = skillsCommand.subCommands!.find(
|
||||
(s) => s.name === 'enable',
|
||||
)!;
|
||||
(
|
||||
context.services.settings as unknown as {
|
||||
user: { settings: { skills: { disabled: string[] } } };
|
||||
}
|
||||
).user.settings = {
|
||||
skills: { disabled: ['skill1'] },
|
||||
};
|
||||
(
|
||||
context.services.settings as unknown as {
|
||||
workspace: { settings: { skills: { disabled: string[] } } };
|
||||
}
|
||||
).workspace.settings = {
|
||||
skills: { disabled: ['skill1'] },
|
||||
};
|
||||
|
||||
await enableCmd.action!(context, 'skill1');
|
||||
|
||||
expect(context.services.settings.setValue).toHaveBeenCalledWith(
|
||||
SettingScope.User,
|
||||
'skills.disabled',
|
||||
[],
|
||||
);
|
||||
expect(context.services.settings.setValue).toHaveBeenCalledWith(
|
||||
SettingScope.Workspace,
|
||||
'skills.disabled',
|
||||
[],
|
||||
);
|
||||
expect(context.ui.addItem).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
type: MessageType.INFO,
|
||||
text: 'Skill "skill1" enabled by removing it from the disabled list in project and user settings. Use "/skills reload" for it to take effect.',
|
||||
}),
|
||||
expect.any(Number),
|
||||
);
|
||||
|
||||
@@ -127,11 +127,7 @@ async function enableAction(
|
||||
return;
|
||||
}
|
||||
|
||||
const scope = context.services.settings.workspace.path
|
||||
? SettingScope.Workspace
|
||||
: SettingScope.User;
|
||||
|
||||
const result = enableSkill(context.services.settings, skillName, scope);
|
||||
const result = enableSkill(context.services.settings, skillName);
|
||||
|
||||
let feedback = renderSkillActionFeedback(
|
||||
result,
|
||||
|
||||
Reference in New Issue
Block a user