File size: 1,776 Bytes
84aa3bf | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | /**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type { CommandModule } from 'yargs';
import { loadSettings, SettingScope } from '../../config/settings.js';
import { debugLogger } from '@google/gemini-cli-core';
import { exitCli } from '../utils.js';
import { disableSkill } from '../../utils/skillSettings.js';
import { renderSkillActionFeedback } from '../../utils/skillUtils.js';
import chalk from 'chalk';
interface DisableArgs {
name: string;
scope: SettingScope;
}
export async function handleDisable(args: DisableArgs) {
const { name, scope } = args;
const workspaceDir = process.cwd();
const settings = loadSettings(workspaceDir);
const result = disableSkill(settings, name, scope);
const feedback = renderSkillActionFeedback(
result,
(label, path) => `${chalk.bold(label)} (${chalk.dim(path)})`,
);
debugLogger.log(feedback);
}
export const disableCommand: CommandModule = {
command: 'disable <name> [--scope]',
describe: 'Disables an agent skill.',
builder: (yargs) =>
yargs
.positional('name', {
describe: 'The name of the skill to disable.',
type: 'string',
demandOption: true,
})
.option('scope', {
alias: 's',
describe: 'The scope to disable the skill in (user or workspace).',
type: 'string',
default: 'workspace',
choices: ['user', 'workspace'],
}),
handler: async (argv) => {
const scope =
argv['scope'] === 'workspace'
? SettingScope.Workspace
: SettingScope.User;
await handleDisable({
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
name: argv['name'] as string,
scope,
});
await exitCli();
},
};
|