fix(omp): preserve unmodelled shell launch commands

This commit is contained in:
Neil
2026-09-19 01:37:24 -07:00
parent fd2481a32e
commit e6d4797e6a
2 changed files with 10 additions and 3 deletions
+9 -2
View File
@@ -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(
+1 -1
View File
@@ -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()