Storyline is a streaming, text-based protocol that combines append-only output with replaceable state, enabling rich terminal experiences that degrade cleanly to plain logs. A Storyline renderer can present live tables, trees, and progress views while preserving a sensible append-only log for non-interactive use.
This project is an experiment. The API and implementation are unstable and may change without notice.
The library exposes an Encoder, Decoder, and a TTY Renderer that all speak the Storyline protocol.
out := storyline.Out() defer out.Flush() _ = out.Append("app", 1, map[string]storyline.Value{"level": storyline.V("info")}, "hello")
To render a stream of Storyline events:
renderer := storyline.NewRenderer(os.Stdout) decoder := storyline.NewDecoder(os.Stdin) _ = decoder.DecodeTo(renderer) _ = renderer.Flush()
storyline renders a Storyline stream on a TTY and passes through output when
stdout is not a terminal.
storyline < stream.txt
storyline ./some-command --with-args
tail -F logfile | storyline
Each example is a standalone program that emits Storyline events.
go run ./examples/append | go run ./cmd/storyline
go run ./examples/live | go run ./cmd/storyline
go run ./examples/table | go run ./cmd/storyline
go run ./examples/tree | go run ./cmd/storyline
go run ./examples/mux | go run ./cmd/storyline
go run ./examples/combined | go run ./cmd/storyline