mirror of
https://github.com/stablyai/orca.git
synced 2026-10-31 09:07:40 +00:00
* refactor(shell): one shell-argument-quoting module for the duplicated quote copies Each former copy now calls the canonical function with its exact spelling; a table test pins byte-identical output for every copy over hostile inputs. Distinct spellings stay distinct functions: '\'' vs '"'"', the two plain-word sets, and the cmd.exe doubled quote. Co-Authored-By: Claude <noreply@anthropic.com> * style: keep the quoting import at the top of two import-less files Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
12 lines
319 B
TypeScript
12 lines
319 B
TypeScript
import { quotePosixShell } from '../shared/shell-argument-quoting'
|
|
|
|
export function quoteCliCommandArgument(value: string): string {
|
|
if (/^[a-zA-Z0-9._:/@-]+$/.test(value)) {
|
|
return value
|
|
}
|
|
if (process.platform === 'win32') {
|
|
return `"${value.replace(/"/g, '\\"')}"`
|
|
}
|
|
return quotePosixShell(value)
|
|
}
|