MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / buildTimeline

Function buildTimeline

scripts/tmux/tmux-viewer/session-loader.ts:147–177  ·  view source on GitHub ↗
(
  commands: Command[],
  captures: Capture[]
)

Source from the content-addressed store, hash-verified

145 * Build a unified timeline from commands and captures
146 */
147export 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

Callers 1

sessionToJSONFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected