# Sample CLI Outputs

This directory contains captured real CLI outputs for use in parser unit tests.
These files allow testing stream parsers without incurring API costs.

## Files

### claude-stream-success.jsonl
A successful Claude CLI session (v2.1.33) that:
- Initializes with `system` event containing `session_id`
- Emits `assistant` message with content
- Completes with `result` event containing `done` status JSON

### claude-stream-questions.jsonl
A Claude CLI session that:
- Initializes with `system` event containing `session_id`
- Emits `assistant` message with content wrapped in markdown code block
- Completes with `result` event containing `questions` status JSON

### codex-stream-success.jsonl
A successful Codex CLI session (v0.98.0) that:
- Starts with `thread.started` event containing `thread_id`
- Emits `turn.started`, `item.completed` events
- Completes with `turn.completed` event containing usage stats

## Event Type Differences

### Claude CLI (`--output-format stream-json`)
- `system` (subtype: `init`) - Contains `session_id`, tools, model info
- `assistant` - Contains message content in `content[].text`
- `result` - Contains final `result` text and `total_cost_usd`

### Codex CLI (`--json`)
- `thread.started` - Contains `thread_id` (equivalent to session_id)
- `turn.started` - Marks beginning of turn
- `item.completed` - Contains reasoning or agent_message items
- `turn.completed` - Contains usage stats

## Usage

These files can be used to test stream parsers in isolation:

```typescript
import { readFileSync } from 'fs';
import { ClaudeStreamParser } from '../../../agent/providers/parsers/claude.js';

const output = readFileSync('sample-outputs/claude-stream-success.jsonl', 'utf-8');
const parser = new ClaudeStreamParser();

for (const line of output.split('\n')) {
  if (line.trim()) {
    const events = parser.parseLine(line);
    // Assert on events...
  }
}
```

## Capturing New Outputs

### Claude
```bash
claude -p "your prompt" --output-format stream-json --verbose > output.jsonl
```

### Codex
```bash
codex exec --full-auto --json "your prompt" > output.jsonl
```
