| 145 | * Build a unified timeline from commands and captures |
| 146 | */ |
| 147 | export function buildTimeline( |
| 148 | commands: Command[], |
| 149 | captures: Capture[] |
| 150 | ): TimelineEntry[] { |
| 151 | const entries: TimelineEntry[] = [] |
| 152 | |
| 153 | // Add commands to timeline |
| 154 | commands.forEach((cmd, idx) => { |
| 155 | entries.push({ |
| 156 | timestamp: cmd.timestamp, |
| 157 | type: 'command', |
| 158 | command: cmd, |
| 159 | index: idx, |
| 160 | }) |
| 161 | }) |
| 162 | |
| 163 | // Add captures to timeline |
| 164 | captures.forEach((cap, idx) => { |
| 165 | entries.push({ |
| 166 | timestamp: cap.frontMatter.timestamp, |
| 167 | type: 'capture', |
| 168 | capture: cap, |
| 169 | index: idx, |
| 170 | }) |
| 171 | }) |
| 172 | |
| 173 | // Sort by timestamp |
| 174 | entries.sort((a, b) => String(a.timestamp).localeCompare(String(b.timestamp))) |
| 175 | |
| 176 | return entries |
| 177 | } |
| 178 | |
| 179 | /** |
| 180 | * Load complete session data |