From e042fd5e0e35cfbdb86ff4adbda1f2c8dfb8ec5a Mon Sep 17 00:00:00 2001 From: Ariane Emory Date: Mon, 9 Mar 2026 17:27:24 -0400 Subject: [PATCH] fix: preserve quotes in slash command arguments Remove quoteTrimRegex that was stripping single and double quotes from all arguments. This allows users to intentionally include quotes in argument values, which is necessary for commands that need to preserve quote characters. --- packages/opencode/src/session/prompt.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/opencode/src/session/prompt.ts b/packages/opencode/src/session/prompt.ts index 4f77920cc98..3c351aaaaf4 100644 --- a/packages/opencode/src/session/prompt.ts +++ b/packages/opencode/src/session/prompt.ts @@ -1736,7 +1736,6 @@ NOTE: At any point in time through this workflow you should feel free to ask the // Match [Image N] as single token, quoted strings, or non-space sequences const argsRegex = /(?:\[Image\s+\d+\]|"[^"]*"|'[^']*'|[^\s"']+)/gi const placeholderRegex = /\$(\d+)/g - const quoteTrimRegex = /^["']|["']$/g /** * Regular expression to match @ file references in text * Matches @ followed by file paths, excluding commas, periods at end of sentences, and backticks @@ -1748,8 +1747,7 @@ NOTE: At any point in time through this workflow you should feel free to ask the const command = await Command.get(input.command) const agentName = command.agent ?? input.agent ?? (await Agent.defaultAgent()) - const raw = input.arguments.match(argsRegex) ?? [] - const args = raw.map((arg) => arg.replace(quoteTrimRegex, "")) + const args = input.arguments.match(argsRegex) ?? [] const templateCommand = await command.template