Delete page "Home"
parent
ad131ad8e8
commit
a385cabe2b
1 changed files with 0 additions and 94 deletions
94
Home.md
94
Home.md
|
|
@ -1,94 +0,0 @@
|
|||
# go-session
|
||||
|
||||
A Go package for parsing, searching, and rendering Claude Code session transcripts. Reads the JSONL files that Claude Code writes during each conversation and transforms them into structured timelines, self-contained HTML reports, and MP4 videos.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
go get forge.lthn.ai/core/go-session
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
- **Parse** Claude Code JSONL transcripts into structured `Event` slices
|
||||
- **List** all sessions in a project directory, sorted by most recent
|
||||
- **Search** across sessions by keyword (commands, file paths, output)
|
||||
- **Render HTML** — self-contained dark-themed timeline with search and filtering
|
||||
- **Render MP4** — terminal recordings via [VHS](https://github.com/charmbracelet/vhs)
|
||||
|
||||
## Quick Example
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"forge.lthn.ai/core/go-session"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Parse a single session
|
||||
sess, err := session.ParseTranscript("/path/to/session.jsonl")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
fmt.Printf("Session %s: %d events
|
||||
", sess.ID, len(sess.Events))
|
||||
fmt.Printf("Duration: %s
|
||||
", sess.EndTime.Sub(sess.StartTime))
|
||||
|
||||
for _, evt := range sess.Events {
|
||||
if evt.Type == "tool_use" {
|
||||
fmt.Printf(" [%s] %s — %s
|
||||
", evt.Tool, evt.Input, evt.Duration)
|
||||
}
|
||||
}
|
||||
|
||||
// Render to HTML
|
||||
if err := session.RenderHTML(sess, "timeline.html"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Core Types
|
||||
|
||||
```go
|
||||
type Event struct {
|
||||
Timestamp time.Time
|
||||
Type string // "tool_use", "user", "assistant", "error"
|
||||
Tool string // "Bash", "Read", "Edit", "Write", "Grep", "Glob", etc.
|
||||
ToolID string
|
||||
Input string // Command, file path, or message text
|
||||
Output string // Result text
|
||||
Duration time.Duration
|
||||
Success bool
|
||||
ErrorMsg string
|
||||
}
|
||||
|
||||
type Session struct {
|
||||
ID string
|
||||
Path string
|
||||
StartTime time.Time
|
||||
EndTime time.Time
|
||||
Events []Event
|
||||
}
|
||||
```
|
||||
|
||||
## API Overview
|
||||
|
||||
| Function | Description |
|
||||
|----------|-------------|
|
||||
| `ListSessions(dir)` | List all `.jsonl` sessions in a directory, sorted newest first |
|
||||
| `ParseTranscript(path)` | Parse a JSONL file into a `*Session` with structured events |
|
||||
| `Search(dir, query)` | Search tool_use events across all sessions by keyword |
|
||||
| `RenderHTML(sess, path)` | Generate a self-contained HTML timeline report |
|
||||
| `RenderMP4(sess, path)` | Generate an MP4 video via VHS (charmbracelet) |
|
||||
|
||||
## Pages
|
||||
|
||||
- [[Session-Format]] — JSONL structure, Event types, tool-specific input extraction
|
||||
- [[Rendering]] — HTML timeline and MP4 video generation
|
||||
Loading…
Add table
Reference in a new issue