(data: SessionData)
| 210 | * Convert session data to JSON format for AI consumption |
| 211 | */ |
| 212 | export function sessionToJSON(data: SessionData): SessionJSON { |
| 213 | const timeline = buildTimeline(data.commands, data.captures) |
| 214 | |
| 215 | return { |
| 216 | session: data.sessionInfo, |
| 217 | commands: data.commands, |
| 218 | captures: data.captures.map((cap) => ({ |
| 219 | sequence: cap.frontMatter.sequence, |
| 220 | label: cap.frontMatter.label, |
| 221 | timestamp: cap.frontMatter.timestamp, |
| 222 | after_command: cap.frontMatter.after_command, |
| 223 | dimensions: cap.frontMatter.dimensions, |
| 224 | path: cap.path, |
| 225 | content: cap.content, |
| 226 | })), |
| 227 | timeline: timeline.map((entry) => ({ |
| 228 | timestamp: entry.timestamp, |
| 229 | type: entry.type, |
| 230 | data: entry.type === 'command' ? entry.command! : entry.capture!, |
| 231 | })), |
| 232 | } |
| 233 | } |
no test coverage detected