From 26be7b3ac79d7d16f8cb8fb4ac05e5469e6f6a0c Mon Sep 17 00:00:00 2001 From: NamesMT Date: Mon, 28 Apr 2025 07:54:10 +0000 Subject: [PATCH] fix: should not require workspace folder for `global` install (+ formatting) --- src/services/marketplace/MarketplaceManager.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/services/marketplace/MarketplaceManager.ts b/src/services/marketplace/MarketplaceManager.ts index bdbcaff6a9..09356db713 100644 --- a/src/services/marketplace/MarketplaceManager.ts +++ b/src/services/marketplace/MarketplaceManager.ts @@ -572,24 +572,24 @@ export class MarketplaceManager { target = 'project' } = options || {} - if (!vscode.workspace.workspaceFolders?.length) + if (target === 'project' && !vscode.workspace.workspaceFolders?.length) return vscode.window.showErrorMessage("Cannot load current workspace folder") + const cwd = target === 'project' + ? vscode.workspace.workspaceFolders![0].uri.fsPath + : await this.ensureSettingsDirectoryExists() + const { createHookable } = await import("roo-rocket") + const { unpackFromUrl } = await import("config-rocket/cli") + if (!item.binaryUrl || !item.binaryHash) return vscode.window.showErrorMessage("Item does not have a binary URL or hash") - const cwd = target === 'global' - ? await this.ensureSettingsDirectoryExists() - : vscode.workspace.workspaceFolders[0].uri.fsPath - const { createHookable } = await import("roo-rocket") - const { unpackFromUrl } = await import("config-rocket/cli") - // Create a custom hookable instance to support global installations // Currently, we only supports `.roomodes` and `.roo/mcp.json` files for global installation. const customHookable = createHookable() customHookable.hook('onExtract', ({ unzipped }) => { const allowedFiles = new Set(['.roo/mcp.json', '.roomodes']) - console.log({unzipped}) + console.log({ unzipped }) for (const key in unzipped) { if (!allowedFiles.has(key)) throw new Error('Unsupported file for global installation: ' + key)