glyphrunStop eyeballing your terminal app.
Specs for CLIs and TUIs. Real PTY, deterministic screen, artifacts an agent can read.
Specs for CLIs and TUIs. Real PTY, deterministic screen, artifacts an agent can read.
Testing a TUI usually means expect scripts, a framework harness, or a human at the keyboard. A Glyphrun spec replaces all three: intent and outcomes are the contract, steps are repairable hints.
name: hello_quits
intent: a user can open the app and quit with q.
target: { cmd: ["./bin/app"] }
steps:
- wait: { screen: { contains: "hello" } }
- press: "q"
outcomes:
- id: clean_exit
description: q exits the application cleanly
verify: { process: { exitCode: 0 } }glyph run specs/hello.yml --format mdOne command launches the app in a real PTY, checks every outcome against the emulated screen, and writes a run directory: JSON/YAML/Markdown reports, the final screen as text and SVG, per-outcome evidence, and agent_context.md. Exit 0 means every outcome passed. Exit codes 1-7 each mean one distinct kind of failure.
Stamp the contract. Write intent and outcomes. glyph spec verify --stamp seals them with a contract hash. Silent edits abort the run.
Read the evidence. Pass or fail, you get a self-contained artifact pack. On failure, glyph context latest shows what happened, and glyph repair proposes step fixes without touching what pass means.
Agents cannot see a TUI. Glyphrun can, on the same CLI humans use. No per-agent code paths: glyph mcp starts a stdio MCP server that mirrors the commands. After a failure, agent_context.md hands the agent recent events and inspection commands.
The contract hash refuses silent edits to intent or outcomes, so an agent can repair drifted steps without redefining success:
glyph run specs/app.yml --format json # banner changed
glyph context latest --format md
glyph repair specs/app.yml --write # steps only
glyph run specs/app.yml --format json # greenThe full loop is in the agent guide.
glyph stories catalogs specs that mount one TUI state at a time. --html inspects cells (grid, rulers, hover). --tui is the feel catalog in the host terminal. Same black-box runner, no framework bindings.
The Stories guide covers glyph stories init, the inspect overlays, and the example harness.
glyph import bats converts an existing BATS file; glyph export bats goes the other way.brew install abdul-hamid-achik/tap/glyph
# or
go install github.com/abdul-hamid-achik/glyphrun/cmd/glyph@latestMIT licensed. glyph init writes a passing smoke spec. The Quickstart walks through it.