From 97d96e69d49123f664c2e7e50ebf796f5b39565c Mon Sep 17 00:00:00 2001 From: Rizel Scarlett Date: Mon, 7 Jul 2025 00:31:31 -0400 Subject: [PATCH] feat: add support for 'cu' command in extension installation (#3261) --- ui/desktop/src/components/settings/extensions/deeplink.ts | 2 +- ui/desktop/src/components/settings/extensions/utils.ts | 3 ++- ui/desktop/src/extensions.tsx | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ui/desktop/src/components/settings/extensions/deeplink.ts b/ui/desktop/src/components/settings/extensions/deeplink.ts index 0436cc93..5c43ca59 100644 --- a/ui/desktop/src/components/settings/extensions/deeplink.ts +++ b/ui/desktop/src/components/settings/extensions/deeplink.ts @@ -14,7 +14,7 @@ function getStdioConfig( timeout: number ) { // Validate that the command is one of the allowed commands - const allowedCommands = ['docker', 'jbang', 'npx', 'uvx', 'goosed']; + const allowedCommands = ['cu', 'docker', 'jbang', 'npx', 'uvx', 'goosed']; if (!allowedCommands.includes(cmd)) { toastService.handleError( 'Invalid Command', diff --git a/ui/desktop/src/components/settings/extensions/utils.ts b/ui/desktop/src/components/settings/extensions/utils.ts index 5c7f6f17..53cf1420 100644 --- a/ui/desktop/src/components/settings/extensions/utils.ts +++ b/ui/desktop/src/components/settings/extensions/utils.ts @@ -196,6 +196,7 @@ export function extractExtensionConfig(fixedEntry: FixedExtensionEntry): Extensi export async function replaceWithShims(cmd: string) { const binaryPathMap: Record = { + cu: await window.electron.getBinaryPath('cu'), goosed: await window.electron.getBinaryPath('goosed'), jbang: await window.electron.getBinaryPath('jbang'), npx: await window.electron.getBinaryPath('npx'), @@ -212,7 +213,7 @@ export async function replaceWithShims(cmd: string) { export function removeShims(cmd: string) { // Only remove shims if the path matches our known shim patterns - const shimPatterns = [/goosed$/, /docker$/, /jbang$/, /npx$/, /uvx$/]; + const shimPatterns = [/cu$/, /goosed$/, /docker$/, /jbang$/, /npx$/, /uvx$/]; // Check if the command matches any shim pattern const isShim = shimPatterns.some((pattern) => pattern.test(cmd)); diff --git a/ui/desktop/src/extensions.tsx b/ui/desktop/src/extensions.tsx index fbe5515a..598fee62 100644 --- a/ui/desktop/src/extensions.tsx +++ b/ui/desktop/src/extensions.tsx @@ -270,6 +270,7 @@ export async function loadAndAddStoredExtensions() { // Update the path to the binary based on the command export async function replaceWithShims(cmd: string) { const binaryPathMap: Record = { + cu: await window.electron.getBinaryPath('cu'), goosed: await window.electron.getBinaryPath('goosed'), jbang: await window.electron.getBinaryPath('jbang'), npx: await window.electron.getBinaryPath('npx'),