Files
gemini-cli/packages/cli/src/commands/profiles/uninstall.ts
Rahul Kamat 0ec0c6ec08 feat(profiles): refactor profiles to centralize logic in core
Centralized profile loading and management in packages/core.
Updated CLI commands to use core ProfileManager.
Implemented persistent profile selection in loadCliConfig.
Standardized profile format as Markdown with YAML frontmatter.
Verified multi-extension loading with 'coder' profile.
2026-03-11 17:45:26 -07:00

42 lines
1.2 KiB
TypeScript

/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { type CommandModule } from 'yargs';
import { Storage, ProfileManager, debugLogger } from '@google/gemini-cli-core';
import { exitCli } from '../utils.js';
/**
* Command module for `gemini profiles uninstall <name>`.
*/
export const uninstallCommand: CommandModule = {
command: 'uninstall <name>',
describe: 'Uninstalls a profile.',
builder: (yargs) =>
yargs.positional('name', {
describe: 'The name of the profile to uninstall.',
type: 'string',
}),
handler: async (argv) => {
const name = String(argv['name']);
try {
const manager = new ProfileManager(Storage.getProfilesDir());
await manager.load();
await manager.uninstallProfile(name);
debugLogger.log(`Profile "${name}" successfully uninstalled.`);
// eslint-disable-next-line no-console
console.log(`Profile "${name}" successfully uninstalled.`);
} catch (error) {
// eslint-disable-next-line no-console
console.error(
`Error uninstalling profile: ${error instanceof Error ? error.message : String(error)}`,
);
await exitCli(1);
}
await exitCli();
},
};