mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 00:02:31 +00:00
fix(omp): preserve unmodelled shell launch commands
This commit is contained in:
@@ -27,9 +27,16 @@ describe('OMP fresh launch intent', () => {
|
||||
'omp --model',
|
||||
'omp -- hello',
|
||||
'echo omp',
|
||||
'omp && echo hi'
|
||||
'omp && echo hi',
|
||||
'omp --model foo;',
|
||||
'omp --model $(preferred-model)',
|
||||
'omp --model `preferred-model`'
|
||||
])('preserves %s', (command) => {
|
||||
expect(withFreshOmpLaunch(command, 'posix')).toContain(command)
|
||||
expect(withFreshOmpLaunch(command, 'posix')).toBe(command)
|
||||
})
|
||||
it.each(['cmd', 'powershell'] as const)('preserves compound values in %s', (shell) => {
|
||||
const command = 'omp --model foo&'
|
||||
expect(withFreshOmpLaunch(command, shell)).toBe(command)
|
||||
})
|
||||
it('quotes the host config path for each Windows shell', () => {
|
||||
expect(withFreshOmpLaunch('omp', 'powershell')).toContain(
|
||||
|
||||
@@ -25,7 +25,7 @@ const SWITCH_FLAGS = new Set(['--no-extensions', '--no-skills', '--no-prompt-tem
|
||||
/** Apply fresh intent to one launch command, never the saved resume configuration. */
|
||||
export function withFreshOmpLaunch(command: string, shell: AgentStartupShell, suffix = ''): string {
|
||||
const parsed = tokenizeStartupCommand(command, shell)
|
||||
if (!parsed.ok) {
|
||||
if (!parsed.ok || parsed.spans.some((span) => span.divergesFromShell)) {
|
||||
return command + suffix
|
||||
}
|
||||
const executable = parsed.tokens[0]?.split(/[\\/]/).at(-1)?.toLowerCase()
|
||||
|
||||
Reference in New Issue
Block a user