Harden computer use runtime and CLI (#4705)

Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
Jinwoo Hong
2026-06-07 17:49:01 -07:00
committed by GitHub
co-authored by Orca
parent 401fc1e43e
commit 76cb846d68
96 changed files with 10408 additions and 3410 deletions
+20
View File
@@ -0,0 +1,20 @@
import { afterEach, describe, expect, it, vi } from 'vitest'
import { quoteCliCommandArgument } from './shell-command-quote'
describe('quoteCliCommandArgument', () => {
afterEach(() => {
vi.restoreAllMocks()
})
it('leaves simple selectors unquoted', () => {
expect(quoteCliCommandArgument('com.apple.finder')).toBe('com.apple.finder')
})
it('quotes values with spaces for the current platform shell', () => {
vi.spyOn(process, 'platform', 'get').mockReturnValue('darwin')
expect(quoteCliCommandArgument('Text Editor')).toBe("'Text Editor'")
vi.spyOn(process, 'platform', 'get').mockReturnValue('win32')
expect(quoteCliCommandArgument('Text Editor')).toBe('"Text Editor"')
})
})