From 153a45b79d1d00ff9e76a2b3e64cff235ef210df Mon Sep 17 00:00:00 2001 From: Rizel Scarlett Date: Sat, 5 Jul 2025 23:28:44 -0400 Subject: [PATCH] feat: add support for 'cu' command in extension installation - Add 'cu' to allowedCommands list in deeplink validation - Include 'cu' in shimPatterns for path resolution - Add 'cu' to binaryPathMap in both utils.ts and extensions.tsx - Fixes error: 'Invalid command: cu. Only docker, jbang, npx, uvx, goosed are allowed' This enables extensions using the 'cu' command to be installed via deeplinks in the Desktop application. --- 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 0436cc932bbd..5c43ca59e81d 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 5c7f6f173655..53cf14206fd9 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 fbe5515a474a..598fee62b0d3 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'),