Documentation
¶
Overview ¶
browser: the launcher for everything runnable in this repo. A directory-reader viewmodel data-binds to TWO roots through the fs.FS seam — cmd/ (the demos) and docs/learn/examples/ (the finished code for each Learn tutorial) — filtered by the same Go convention: directories exactly one level deep that contain a main.go. They are listed as two labeled groups. Picking one runs it via `go run` in a child process that takes over THIS terminal, which is one call to gooey.App.Suspend: the screen is restored, the input decoder is torn down so nothing of ours is still reading the tty, and everything is rebuilt when the child exits.
Recording uses the same handoff: `r` wraps the demo in asciinema, so the terminal the demo drives is the one being captured, and agg turns the cast into a GIF afterwards.
The preview pane shows what the directory itself says: a README.md when the demo has one, rendered as markdown (markdown.go), and the main.go doc comment otherwise. `p` plays the demo's recorded GIF in that same pane, decoded and coalesced into whole frames and animated by a clock the Composer owns (gifplay.go).
None of it needs a restart. A <Timer> in the page polls a fingerprint of every directory the UI reads from (watch.go), so a recording finished in another terminal, a new demo, an added .gooey file or an edited doc comment all reach the list and the visible preview on their own.
Two markup documents describe the screen. browser.gooey is the shell: the grid, the chrome, every key gesture, the poll, and the picker's place in z-order. infopane.gooey is the preview pane, a markup-only control instantiated with the handles it needs — the lines it shows, their order, and which of them collapse are all declared there. What is left in Go is data (the directory scan), algorithms (markdown, GIF coalescing, git), and the three leaves markup has no element for.
The tree being browsed does not have to be the tree the browser was launched from. `b` opens a source picker (picker.go) listing the repository's worktrees and local branches (source.go); picking one re-resolves the demo list, previews, watching, exec and recording against that checkout — a branch with no worktree gets a throwaway detached one under the system temp dir, removed on switch-away and on exit. Recordings are the one thing that stays anchored to the LAUNCH tree: they are artifacts the user keeps, and an artifact written into an ephemeral checkout would be deleted with it.
j/k ↑/↓ select enter run r record p play GIF b sources q/esc quit