mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-21 18:44:30 -07:00
refactor(skills): replace 'project' with 'workspace' scope (#16380)
This commit is contained in:
@@ -84,6 +84,34 @@ describe('skills disable command', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('should disable an enabled skill in workspace scope', async () => {
|
||||
const mockSettings = {
|
||||
forScope: vi.fn().mockReturnValue({
|
||||
settings: { skills: { disabled: [] } },
|
||||
path: '/workspace/.gemini/settings.json',
|
||||
}),
|
||||
setValue: vi.fn(),
|
||||
};
|
||||
mockLoadSettings.mockReturnValue(
|
||||
mockSettings as unknown as LoadedSettings,
|
||||
);
|
||||
|
||||
await handleDisable({
|
||||
name: 'skill1',
|
||||
scope: SettingScope.Workspace as LoadableSettingScope,
|
||||
});
|
||||
|
||||
expect(mockSettings.setValue).toHaveBeenCalledWith(
|
||||
SettingScope.Workspace,
|
||||
'skills.disabled',
|
||||
['skill1'],
|
||||
);
|
||||
expect(emitConsoleLog).toHaveBeenCalledWith(
|
||||
'log',
|
||||
'Skill "skill1" disabled by adding it to the disabled list in workspace (/workspace/.gemini/settings.json) settings.',
|
||||
);
|
||||
});
|
||||
|
||||
it('should log a message if the skill is already disabled', async () => {
|
||||
const mockSettings = {
|
||||
forScope: vi.fn().mockReturnValue({
|
||||
|
||||
@@ -42,14 +42,16 @@ export const disableCommand: CommandModule = {
|
||||
})
|
||||
.option('scope', {
|
||||
alias: 's',
|
||||
describe: 'The scope to disable the skill in (user or project).',
|
||||
describe: 'The scope to disable the skill in (user or workspace).',
|
||||
type: 'string',
|
||||
default: 'project',
|
||||
choices: ['user', 'project'],
|
||||
default: 'workspace',
|
||||
choices: ['user', 'workspace'],
|
||||
}),
|
||||
handler: async (argv) => {
|
||||
const scope =
|
||||
argv['scope'] === 'project' ? SettingScope.Workspace : SettingScope.User;
|
||||
argv['scope'] === 'workspace'
|
||||
? SettingScope.Workspace
|
||||
: SettingScope.User;
|
||||
await handleDisable({
|
||||
name: argv['name'] as string,
|
||||
scope,
|
||||
|
||||
@@ -64,7 +64,7 @@ describe('skills enable command', () => {
|
||||
path: '/user/settings.json',
|
||||
};
|
||||
}
|
||||
return { settings: {}, path: '/project/settings.json' };
|
||||
return { settings: {}, path: '/workspace/settings.json' };
|
||||
}),
|
||||
setValue: vi.fn(),
|
||||
};
|
||||
@@ -81,7 +81,7 @@ describe('skills enable command', () => {
|
||||
);
|
||||
expect(emitConsoleLog).toHaveBeenCalledWith(
|
||||
'log',
|
||||
'Skill "skill1" enabled by removing it from the disabled list in user (/user/settings.json) and project (/project/settings.json) settings.',
|
||||
'Skill "skill1" enabled by removing it from the disabled list in user (/user/settings.json) and workspace (/workspace/settings.json) settings.',
|
||||
);
|
||||
});
|
||||
|
||||
@@ -122,7 +122,7 @@ describe('skills enable command', () => {
|
||||
);
|
||||
expect(emitConsoleLog).toHaveBeenCalledWith(
|
||||
'log',
|
||||
'Skill "skill1" enabled by removing it from the disabled list in project (/workspace/settings.json) and user (/user/settings.json) settings.',
|
||||
'Skill "skill1" enabled by removing it from the disabled list in workspace (/workspace/settings.json) and user (/user/settings.json) settings.',
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user