Skip to content

Desktop: Extension command parser doesn't respect quotes in paths with spaces #6417

@dianed-square

Description

@dianed-square

Describe the bug

The Desktop app's extension command parser doesn't respect quotes when parsing commands with spaces. The splitCmdAndArgs() function uses .split(/\s+/) which splits on all whitespace, breaking paths like /Applications/IntelliJ IDEA.app/... even when quoted.


To Reproduce

  1. Go to Settings → Extensions
  2. Click "Add Extension"
  3. Enter command: "/Applications/IntelliJ IDEA.app/Contents/jbr/Contents/Home/bin/java" -classpath "/path/with spaces/lib.jar" com.example.Main
  4. Save the extension
  5. Check ~/.config/goose/config.yaml - the command is incorrectly split with quotes appearing in wrong places

Expected behavior

Quoted strings should be preserved as single arguments, similar to shell behavior. The CLI already uses shlex::split for this - the Desktop UI should use equivalent parsing (e.g., shell-quote npm package).


Screenshots

N/A


Please provide the following information

  • OS & Arch: macOS
  • Interface: UI
  • Version: v1.18.0-block
  • Extensions enabled: N/A (occurs during extension setup)
  • Provider & Model: N/A (configuration issue)

Additional context

Current code (ui/desktop/src/components/settings/extensions/utils.ts):

export function splitCmdAndArgs(str: string): { cmd: string; args: string[] } {
  const words = str.trim().split(/\s+/);  // ← breaks on all whitespace
  const cmd = words[0] || '';
  const args = words.slice(1);
  return { cmd, args };
}

Workarounds:

  • Create symlinks without spaces
  • Use wrapper scripts
  • Manually edit config.yaml

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions