glyph

module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 22, 2026 License: MIT

README

glyph

Beautifully designed components for the terminal. Yours to copy, paste, own.

test Go Reference Version

glyph reel

A copy-paste component library for terminal UIs. Install the CLI, run glyph add chat-thread, and a chat surface drops into your repo as plain Go source you own. No glyph runtime dependency. No version pinning. No magic.

The model is shadcn/ui, ported to the terminal. The components are built for Bubble Tea in v0.1. Adapters for ratatui, Textual, and Ink follow.

Install

go install github.com/truffle-dev/glyph/cmd/glyph@latest
cd path/to/your/project
glyph init
glyph add chat-thread

That's the whole onboarding. The third command writes Go files into internal/ui/ (or wherever your glyph.json aliases say) and runs go get for the upstream libraries the component needs.

Components (v0.1)

Component Description
theme Token palette every component reads from. Edit one file to retheme an entire app.
chat-bubble Role-aware speech bubble with width-aware wrapping. user / assistant / system / tool.
chat-input Single-line chat prompt with placeholder, cursor, focus state, submit and cancel bindings.
chat-thread Vertically scrolling conversation surface. Composes chat-bubble. Arrow keys, PgUp/PgDn, Home/End.
command-palette Filterable modal command picker. Substring matcher by default; swap in your own.
markdown-viewer Scrollable terminal markdown. Headings, paragraphs, bullets, blockquotes, code, links.
log-stream Bounded color-coded log view that tails like tail -f. Level filter, capacity ring.
diff-view Unified-diff renderer with line numbers, color-coded additions and removals. Ships with a ParseUnified helper.
notification-toast Stacked dismissible notifications with level-aware coloring and per-toast TTLs.
status-bar Single-line three-segment status bar. Left fills from left, right anchors right, truncates left first under pressure.
spinner Animated single-glyph indicator with an optional label. Five styles: dots, line, arc, pulse, bounce.
tabs Horizontal labeled tab row primitive. Arrow keys or Tab cycle with wrap. Parent owns the panels below.
panel Bordered container with optional title and footer. The workhorse layout primitive: wrap any view in one.
list Vertical selectable list with cursor highlight, optional hints, disabled items, and internal scrolling.
progress-bar Determinate progress indicator with an optional label and percentage readout. Color- and glyph-tunable.
key-hints Compact footer of key-and-description pairs. The bottom-row cheatsheet every TUI grows into.

Every screenshot below is a recording of the component's own story/ binary running in a real terminal. No mockups, no Figma, no compositing — the same Bubble Tea output you get after glyph add <name>.

theme
theme — Token palette every component reads from.chat-bubble
chat-bubble — Role-aware speech bubble with width-aware wrapping.chat-input
chat-input — Single-line chat prompt with placeholder, cursor, focus.chat-thread
chat-thread — Vertically scrolling conversation surface.command-palette
command-palette — Filterable modal command picker.markdown-viewer
markdown-viewer — Scrollable terminal markdown.log-stream
log-stream — Bounded color-coded log view that tails like tail -f.diff-view
diff-view — Unified-diff renderer with line numbers.notification-toast
notification-toast — Stacked dismissible notifications.status-bar
status-bar — Single-line three-segment status bar.spinner
spinner — Animated single-glyph indicator. Five styles.tabs
tabs — Horizontal labeled tab row primitive.panel
panel — Bordered container with optional title and footer.list
list — Vertical selectable list with cursor highlight.progress-bar
progress-bar — Determinate progress indicator.key-hints
key-hints — Compact footer of key-and-description pairs.

Browse all sixteen with live demos at truffleagent.com/glyph.

How it works

Glyph is two things: a CLI and a static registry.

The CLI reads a local glyph.json in your repo and resolves paths via aliases:

{
  "$schema": "https://truffleagent.com/glyph/schema/glyph.json",
  "frame": "bubbletea",
  "module": "github.com/your-org/your-app",
  "aliases": {
    "components": "internal/ui",
    "lib": "internal/uilib",
    "hooks": "internal/uihooks"
  },
  "theme": "default",
  "registry": "https://truffleagent.com/glyph/r"
}

glyph add chat-thread fetches truffleagent.com/glyph/r/chat-thread.json, walks the dependency graph (chat-thread depends on chat-bubble which depends on theme), and writes each file into the alias-resolved path. Import paths are rewritten so the files reference your module, not glyph's.

After install, the files are yours. Edit them. Refactor them. Delete the prompt prefix in chat-input.go and replace it with your project's logo. The library has no opinion.

Philosophy

The terminal is having a renaissance. Bubble Tea, ratatui, Textual, gum, lazygit, atuin, claude code — the list of TUIs people use daily is longer than it has been in a decade.

What's missing is a shared component vocabulary. Every team rewrites the chat surface, the command palette, the diff view, the status bar. Each rewrite is a little different, a little worse, and the team owes one more library upgrade for each one they import.

shadcn/ui solved this on the web by inverting the model. You don't import a library; you copy the source into your repo and own it. Updates are deliberate. Customization is direct. The library has no upgrade path because there is no library, only your code.

glyph applies the same shape to the terminal. Components are source files you copy. They reference a small theme module you also own. They have no runtime dependency on glyph. If glyph disappears, your app still works.

The rules that fall out of that bet:

  1. Copy, don't depend. Every component is downloadable as source. No glyph runtime dependency. Delete glyph after install and your app still works.
  2. One framework at a time. v0.1 is Bubble Tea. Adapters for ratatui, Textual, and Ink follow. We won't dilute the launch.
  3. Tokens, not hardcoded colors. Every component references theme.Default. Theming a whole app is one file change.
  4. Stories are tests are screenshots. A component without a story file doesn't ship. Stories drive the screenshot pipeline and the demo site equally.
  5. Quiet, not loud. No emojis, no marketing phrases, no exclamation marks. Earn attention with the work.

What's next

v0.1 ships sixteen Bubble Tea components and the CLI. The shape that follows:

  • v0.2 — form and structure. Text input, select / dropdown, modal, confirmation dialog, code view with syntax highlighting (via chroma), table, file tree, breadcrumb, key-binding chord. The set rounds out the toolkit a config-heavy or browse-heavy TUI needs.
  • v0.3 — first non-Bubble-Tea adapter. Likely ratatui (Rust), based on demand. The registry shape already encodes frame, so each component re-ships as a sibling source file with the same manifest contract.
  • v0.4 and beyond. Textual (Python) and Ink (TypeScript). The catalog grows, the registry shape stays.

The registry contract is stable. What grows is the catalog.

Demo site

truffleagent.com/glyph browses every component with a live SVG preview, the install command, the full source, and the JSON manifest.

Run the showcase locally

examples/showcase/ is a single-binary TUI demo: five tabs (Chat, Commands, Markdown, Logs, Diff), a status bar, and a toast overlay. The tab primitive, spinner, and panel each ship with their own runnable story under components/<name>/story/.

go run ./examples/showcase

Tab cycles tabs forward, Shift-Tab cycles back. On any non-chat tab, t fires a toast and l appends a log entry. q or Ctrl-C quits.

Contributing

See CONTRIBUTING.md. The fastest first contribution is a new component: copy components/chat-bubble/ as a template, replace the body, add a story file, and open a PR.

Credits

The shape of glyph is borrowed from shadcn/ui, which solved this distribution problem for React. The terminal needed the same answer.

Built on Bubble Tea by Charm.

License

MIT

Directories

Path Synopsis
cmd
glyph command
Package main is the glyph CLI entry point.
Package main is the glyph CLI entry point.
components
chat-bubble
Package chatbubble renders a role-aware speech bubble with width-aware wrap.
Package chatbubble renders a role-aware speech bubble with width-aware wrap.
chat-input
Package chatinput renders a single-line chat prompt with a placeholder, cursor, and submit/escape key bindings.
Package chatinput renders a single-line chat prompt with a placeholder, cursor, and submit/escape key bindings.
chat-thread
Package chatthread renders a vertically-stacked conversation of role-aware chat bubbles with viewport-style scrolling.
Package chatthread renders a vertically-stacked conversation of role-aware chat bubbles with viewport-style scrolling.
command-palette
Package commandpalette renders a fuzzy-filtered command picker as a modal surface.
Package commandpalette renders a fuzzy-filtered command picker as a modal surface.
diff-view
Package diffview renders a unified diff as a color-coded, scrollable terminal block.
Package diffview renders a unified diff as a color-coded, scrollable terminal block.
key-hints
Package keyhints renders a compact footer of "<key> <description>" pairs separated by a thin divider.
Package keyhints renders a compact footer of "<key> <description>" pairs separated by a thin divider.
list
Package list renders a vertical list of items with a single selected cursor.
Package list renders a vertical list of items with a single selected cursor.
log-stream
Package logstream renders a bounded, scrollable log view.
Package logstream renders a bounded, scrollable log view.
markdown-viewer
Package markdownviewer renders a small markdown subset to a styled terminal block with theme tokens.
Package markdownviewer renders a small markdown subset to a styled terminal block with theme tokens.
notification-toast
Package notificationtoast renders a stack of dismissible, level-aware notifications.
Package notificationtoast renders a stack of dismissible, level-aware notifications.
panel
Package panel wraps arbitrary content in a bordered container with an optional title and footer.
Package panel wraps arbitrary content in a bordered container with an optional title and footer.
progress-bar
Package progressbar renders a determinate progress indicator with an optional label, percentage readout, and color-tunable fill.
Package progressbar renders a determinate progress indicator with an optional label, percentage readout, and color-tunable fill.
spinner
Package spinner renders a small animated glyph next to an optional label, the way an agent UI signals "working on it".
Package spinner renders a small animated glyph next to an optional label, the way an agent UI signals "working on it".
status-bar
Package statusbar renders a single-line, three-segment status bar.
Package statusbar renders a single-line, three-segment status bar.
tabs
Package tabs renders a horizontal row of labeled tabs with one active label.
Package tabs renders a horizontal row of labeled tabs with one active label.
theme
Package theme provides the token palette every glyph component reads from.
Package theme provides the token palette every glyph component reads from.
examples
reel command
Command reel is the glyph marketing demo: a self-playing TUI that walks through the library's headline components on a fixed timeline.
Command reel is the glyph marketing demo: a self-playing TUI that walks through the library's headline components on a fixed timeline.
showcase command
Command showcase is a single-binary demo: the chat, command-palette, markdown-viewer, log-stream, diff-view, notification-toast, and status-bar components composed into one navigable TUI.
Command showcase is a single-binary demo: the chat, command-palette, markdown-viewer, log-stream, diff-view, notification-toast, and status-bar components composed into one navigable TUI.
tools
build command
Build flattens components/*/*.json manifests into a registry tree under ./r.
Build flattens components/*/*.json manifests into a registry tree under ./r.

Jump to

Keyboard shortcuts

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