viewkit

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2026 License: MIT

README

viewkit

GitHub release CI

A small toolkit for building terminal UIs with Lip Gloss. Core packages stay Bubble Tea-free; interactive hosts live in the nested deck/ module (Bubble Tea allowed there only — see deck/INTERFACE.md).

Packages

Package Role
layout Frame, panels/sections, sticky footer, scroll, focus Ring
panels Charts/widgets from neutral structs (Bar, Line, Meter, …)
theme Theme + Use / Cur palettes and status helpers
glyph Nerd/Uni/ASCII variants, status strip, severity vocabulary
keys Keybinding tables
forms Field builders
list / browser List/browser helpers
notify Notification tone helpers
timefmt Time formatting
term Terminal launcher helpers
deck/ (module) Tea host / screens (Menu, Scroll, ItemList, HomeShell, flight) — only place tea is a dependency

Longer API notes: skills/viewkit/references/api.md.

Core depends on charmbracelet/lipgloss, charmbracelet/x/ansi, and the standard library. Typical flow: panels → layout → theme.

Install

go get github.com/codyconfer/viewkit@latest
# interactive host (separate module):
go get github.com/codyconfer/viewkit/deck@latest
import (
    "github.com/codyconfer/viewkit/layout"
    "github.com/codyconfer/viewkit/panels"
    "github.com/codyconfer/viewkit/theme"
)

Design contract

viewkit is domain-agnostic: data crosses the boundary as neutral structs (panels.Datum, panels.OHLC, panels.LedgerRow) and formatter callbacks — never application domain types. A layout.Frame carries render width and focus; construct with layout.NewFrame(width).

frame := layout.NewFrame(80)

body := frame.Panel("STATUS", frame.Row("tokens", "1.2M"))

chart := panels.Bar(frame, "GPUs", []panels.Datum{
    {Label: "gpu", Value: 12},
    {Label: "cloud", Value: 30},
}, 40, fmtNum, "no data")
Theming
th := theme.Default()
th.Accent = lipgloss.NewStyle().Foreground(lipgloss.Color("212"))
theme.Use(th)

Structural dimensions (theme.BodyWidth, …) are exported constants — set per-view width via layout.NewFrame(width).

Status

Extracted from goose / used by munin. API may still shift before a published v1; local coherence work tracks munin m7-coherence.

Development

make build          # go build ./...
make check          # build + fmt-check + lint + govulncheck + test (CI gate is `make ci`)
make test           # go test ./...

Linters live in the nested tools/ module (go tool -modfile=tools/go.mod).

Local multi-repo development (go.work)

When editing viewkit alongside munin/sisyphus, use an uncommitted go.work in the consumer that uses sibling checkouts (including ../viewkit/deck). Do not commit go.work / go.work.sum and do not add committed replace directives — CI builds against tagged pins.

License

MIT © Cody Confer

Directories

Path Synopsis
deck module
Package forms provides keys.Action-driven forms and confirm dialogs for viewkit terminal UIs.
Package forms provides keys.Action-driven forms and confirm dialogs for viewkit terminal UIs.
Package keys maps raw input onto semantic actions and footer hint legends for viewkit applications.
Package keys maps raw input onto semantic actions and footer hint legends for viewkit applications.
Package layout provides frame-based structural layout primitives for terminal UIs built with viewkit.
Package layout provides frame-based structural layout primitives for terminal UIs built with viewkit.
Package notify models transient notifications and TTL queues for viewkit applications.
Package notify models transient notifications and TTL queues for viewkit applications.
Package panels renders charts, tables, and small status widgets against a viewkit layout frame.
Package panels renders charts, tables, and small status widgets against a viewkit layout frame.
Package theme manages viewkit's process-global palette, styles, and screen background rendering.
Package theme manages viewkit's process-global palette, styles, and screen background rendering.
Package timefmt formats relative timestamps for TUI chrome.
Package timefmt formats relative timestamps for TUI chrome.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL