import { describe, expect, it, vi } from 'vitest' import { buildCcArgv } from '../../src/cc/ccCommand' vi.mock('../../src/cc/claudeBin', () => ({ resolveClaudeBin: () => '/Users/me/My Apps/claude', })) const BASE = ['/Users/me/My Apps/claude', '--dangerously-skip-permissions', '--settings', '/p.json'] describe('buildCcArgv', () => { it('appends the prompt as a positional arg for a fresh session', () => { expect(buildCcArgv({ profilePath: '/p.json', prompt: 'hello' })) .toEqual([...BASE, 'hello']) }) it('resumes without a prompt when only a session id is given', () => { expect(buildCcArgv({ profilePath: '/p.json', resumeSessionId: 'abc' })) .toEqual([...BASE, '--resume', 'abc']) }) it('resumes and hands the prompt to the restored session', () => { expect(buildCcArgv({ profilePath: '/p.json', resumeSessionId: 'abc', prompt: 'go on' })) .toEqual([...BASE, '--resume', 'abc', 'go on']) }) it('puts effort first and keeps quotes / $ / newlines in paths and prompt as-is', () => { const prompt = 'don\'t $touch\n"this"' expect(buildCcArgv({ profilePath: '/it\'s/p.json', effort: 'high', prompt })).toEqual([ '/Users/me/My Apps/claude', '--effort', 'high', '--dangerously-skip-permissions', '--settings', '/it\'s/p.json', prompt, ]) }) })