testjsonl

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package testjsonl provides shared JSONL fixture builders for Claude and Codex session test data. Used by both parser and sync test packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClaudeAssistantJSON

func ClaudeAssistantJSON(content any, timestamp string) string

ClaudeAssistantJSON returns a Claude assistant message as a JSON string.

func ClaudeMetaUserJSON

func ClaudeMetaUserJSON(
	content, timestamp string, meta, compact bool,
) string

ClaudeMetaUserJSON returns a Claude user message with optional isMeta and isCompactSummary flags as a JSON string.

func ClaudeSnapshotJSON

func ClaudeSnapshotJSON(timestamp string) string

ClaudeSnapshotJSON returns a Claude snapshot message as a JSON string.

func ClaudeUserJSON

func ClaudeUserJSON(
	content, timestamp string, cwd ...string,
) string

ClaudeUserJSON returns a Claude user message as a JSON string.

func CodexFunctionCallArgsJSON added in v0.2.0

func CodexFunctionCallArgsJSON(
	name string, arguments any, timestamp string,
) string

CodexFunctionCallArgsJSON returns a Codex function_call response_item with arguments payload.

func CodexFunctionCallFieldsJSON added in v0.2.1

func CodexFunctionCallFieldsJSON(
	name string, arguments, input any, timestamp string,
) string

CodexFunctionCallFieldsJSON returns a Codex function_call response_item with explicit arguments and input fields.

func CodexFunctionCallJSON

func CodexFunctionCallJSON(
	name, summary, timestamp string,
) string

CodexFunctionCallJSON returns a Codex function_call response_item as a JSON string.

func CodexMsgJSON

func CodexMsgJSON(role, text, timestamp string) string

CodexMsgJSON returns a Codex response_item message as a JSON string.

func CodexSessionMetaJSON

func CodexSessionMetaJSON(
	id, cwd, originator, timestamp string,
) string

CodexSessionMetaJSON returns a Codex session_meta message as a JSON string.

func GeminiAssistantMsg

func GeminiAssistantMsg(
	id, timestamp, content string, opts *GeminiMsgOpts,
) map[string]any

GeminiAssistantMsg builds a Gemini assistant message object.

func GeminiInfoMsg

func GeminiInfoMsg(
	id, timestamp, content, msgType string,
) map[string]any

GeminiInfoMsg builds a Gemini info/system message object.

func GeminiSessionJSON

func GeminiSessionJSON(
	sessionID, projectHash string,
	startTime, lastUpdated string,
	messages []map[string]any,
) string

GeminiSessionJSON builds a complete Gemini session JSON string from the given parameters.

func GeminiUserMsg

func GeminiUserMsg(
	id, timestamp, content string,
) map[string]any

GeminiUserMsg builds a Gemini user message object.

func JoinJSONL

func JoinJSONL(lines ...string) string

JoinJSONL joins JSON lines with newlines and appends a trailing newline.

Types

type GeminiMsgOpts

type GeminiMsgOpts struct {
	Thoughts  []GeminiThought
	ToolCalls []GeminiToolCall
	Model     string
}

GeminiMsgOpts holds optional fields for a Gemini assistant message.

type GeminiThought

type GeminiThought struct {
	Subject     string
	Description string
	Timestamp   string
}

GeminiThought defines a thought for Gemini test fixtures.

type GeminiToolCall

type GeminiToolCall struct {
	Name        string
	DisplayName string
	Args        map[string]string
}

GeminiToolCall defines a tool call for Gemini test fixtures.

type SessionBuilder

type SessionBuilder struct {
	// contains filtered or unexported fields
}

SessionBuilder constructs JSONL session content using a fluent API.

func NewSessionBuilder

func NewSessionBuilder() *SessionBuilder

NewSessionBuilder returns a new empty SessionBuilder.

func (*SessionBuilder) AddClaudeAssistant

func (b *SessionBuilder) AddClaudeAssistant(
	timestamp, text string,
) *SessionBuilder

AddClaudeAssistant appends a Claude assistant message line.

func (*SessionBuilder) AddClaudeMetaUser

func (b *SessionBuilder) AddClaudeMetaUser(
	timestamp, content string, meta, compact bool,
) *SessionBuilder

AddClaudeMetaUser appends a Claude user message line with isMeta and/or isCompactSummary flags.

func (*SessionBuilder) AddClaudeUser

func (b *SessionBuilder) AddClaudeUser(
	timestamp, content string, cwd ...string,
) *SessionBuilder

AddClaudeUser appends a Claude user message line.

func (*SessionBuilder) AddCodexFunctionCall

func (b *SessionBuilder) AddCodexFunctionCall(
	timestamp, name, summary string,
) *SessionBuilder

AddCodexFunctionCall appends a Codex function_call line.

func (*SessionBuilder) AddCodexMessage

func (b *SessionBuilder) AddCodexMessage(
	timestamp, role, text string,
) *SessionBuilder

AddCodexMessage appends a Codex response_item line.

func (*SessionBuilder) AddCodexMeta

func (b *SessionBuilder) AddCodexMeta(
	timestamp, id, cwd, originator string,
) *SessionBuilder

AddCodexMeta appends a Codex session_meta line.

func (*SessionBuilder) AddRaw

func (b *SessionBuilder) AddRaw(line string) *SessionBuilder

AddRaw appends an arbitrary raw line.

func (*SessionBuilder) String

func (b *SessionBuilder) String() string

String returns the JSONL content with a trailing newline.

func (*SessionBuilder) StringNoTrailingNewline

func (b *SessionBuilder) StringNoTrailingNewline() string

StringNoTrailingNewline returns the JSONL content without a trailing newline.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL