2025-11-07 10:10:29 -05:00
|
|
|
/**
|
|
|
|
|
* @license
|
|
|
|
|
* Copyright 2025 Google LLC
|
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
*/
|
|
|
|
|
|
2025-12-09 10:08:23 -05:00
|
|
|
import { listExtensions } from '@google/gemini-cli-core';
|
|
|
|
|
import type {
|
|
|
|
|
Command,
|
|
|
|
|
CommandContext,
|
|
|
|
|
CommandExecutionResponse,
|
|
|
|
|
} from './types.js';
|
2025-11-07 10:10:29 -05:00
|
|
|
|
|
|
|
|
export class ExtensionsCommand implements Command {
|
|
|
|
|
readonly name = 'extensions';
|
|
|
|
|
readonly description = 'Manage extensions.';
|
|
|
|
|
readonly subCommands = [new ListExtensionsCommand()];
|
|
|
|
|
readonly topLevel = true;
|
|
|
|
|
|
|
|
|
|
async execute(
|
2025-12-09 10:08:23 -05:00
|
|
|
context: CommandContext,
|
2025-11-07 10:10:29 -05:00
|
|
|
_: string[],
|
|
|
|
|
): Promise<CommandExecutionResponse> {
|
2025-12-09 10:08:23 -05:00
|
|
|
return new ListExtensionsCommand().execute(context, _);
|
2025-11-07 10:10:29 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export class ListExtensionsCommand implements Command {
|
|
|
|
|
readonly name = 'extensions list';
|
|
|
|
|
readonly description = 'Lists all installed extensions.';
|
|
|
|
|
|
|
|
|
|
async execute(
|
2025-12-09 10:08:23 -05:00
|
|
|
context: CommandContext,
|
2025-11-07 10:10:29 -05:00
|
|
|
_: string[],
|
|
|
|
|
): Promise<CommandExecutionResponse> {
|
2025-12-09 10:08:23 -05:00
|
|
|
const extensions = listExtensions(context.config);
|
2025-11-07 10:10:29 -05:00
|
|
|
const data = extensions.length ? extensions : 'No extensions installed.';
|
|
|
|
|
|
|
|
|
|
return { name: this.name, data };
|
|
|
|
|
}
|
|
|
|
|
}
|