mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
[extensions] Add extensions uninstall command (#6877)
This commit is contained in:
@@ -338,3 +338,19 @@ export async function installExtension(
|
||||
|
||||
return newExtensionName;
|
||||
}
|
||||
|
||||
export async function uninstallExtension(extensionName: string): Promise<void> {
|
||||
const installedExtensions = loadUserExtensions();
|
||||
if (
|
||||
!installedExtensions.some(
|
||||
(installed) => installed.config.name === extensionName,
|
||||
)
|
||||
) {
|
||||
throw new Error(`Error: Extension "${extensionName}" not found.`);
|
||||
}
|
||||
const storage = new ExtensionStorage(extensionName);
|
||||
return await fs.promises.rm(storage.getExtensionDir(), {
|
||||
recursive: true,
|
||||
force: true,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user