(input: BuildExportMarkdownInput)
| 220 | } |
| 221 | |
| 222 | export function buildExportMarkdown(input: BuildExportMarkdownInput): string { |
| 223 | const { sessionId, workDir, history, tokenCount, now } = input; |
| 224 | |
| 225 | const lines: string[] = [ |
| 226 | '---', |
| 227 | `session_id: ${sessionId}`, |
| 228 | `exported_at: ${now.toISOString()}`, |
| 229 | `work_dir: ${workDir}`, |
| 230 | `message_count: ${String(history.length)}`, |
| 231 | `token_count: ${String(tokenCount)}`, |
| 232 | '---', |
| 233 | '', |
| 234 | '# Kimi Session Export', |
| 235 | '', |
| 236 | ]; |
| 237 | |
| 238 | const turns = groupIntoTurns(history); |
| 239 | lines.push(buildOverview(history, turns)); |
| 240 | lines.push(''); |
| 241 | |
| 242 | for (let i = 0; i < turns.length; i++) { |
| 243 | lines.push(formatTurnMd(turns[i]!, i + 1)); |
| 244 | } |
| 245 | |
| 246 | return lines.join('\n'); |
| 247 | } |
no test coverage detected