Create ExtensionManager class which manages all high level extension tasks (#11667)

This commit is contained in:
Jacob MacDonald
2025-10-23 11:39:36 -07:00
committed by GitHub
parent 3a501196f0
commit c4c0c0d182
31 changed files with 1450 additions and 1568 deletions
+15 -11
View File
@@ -5,17 +5,18 @@
*/
import type { CommandModule } from 'yargs';
import {
INSTALL_WARNING_MESSAGE,
installOrUpdateExtension,
requestConsentNonInteractive,
} from '../../config/extension.js';
import {
debugLogger,
type ExtensionInstallMetadata,
} from '@google/gemini-cli-core';
import { getErrorMessage } from '../../utils/errors.js';
import { stat } from 'node:fs/promises';
import {
INSTALL_WARNING_MESSAGE,
requestConsentNonInteractive,
} from '../../config/extensions/consent.js';
import { ExtensionManager } from '../../config/extension-manager.js';
import { loadSettings } from '../../config/settings.js';
import { promptForSetting } from '../../config/extensions/extensionSettings.js';
interface InstallArgs {
@@ -67,13 +68,16 @@ export async function handleInstall(args: InstallArgs) {
debugLogger.log('You have consented to the following:');
debugLogger.log(INSTALL_WARNING_MESSAGE);
}
const name = await installOrUpdateExtension(
installMetadata,
const workspaceDir = process.cwd();
const extensionManager = new ExtensionManager({
workspaceDir,
requestConsent,
process.cwd(),
undefined,
promptForSetting,
);
requestSetting: promptForSetting,
loadedSettings: loadSettings(workspaceDir),
});
const name =
await extensionManager.installOrUpdateExtension(installMetadata);
debugLogger.log(`Extension "${name}" installed successfully and enabled.`);
} catch (error) {
debugLogger.error(getErrorMessage(error));