
Tuistory
FreeDrive and test terminal apps headlessly with ease.
Free · Opens the source repo
What Tuistory does
Tuistory is a powerful tool designed for developers and testers who need to interact with terminal applications in a headless environment. By wrapping terminal commands in named background PTY sessions, Tuistory allows agents to read, wait on, and interact with terminal user interfaces (TUIs) without requiring a display. This makes it particularly useful for testing applications like Cline's TUI, where manual testing or bug reproduction is necessary without direct user interaction.
With Tuistory, you can launch terminal applications in isolated environments, ensuring that your testing does not interfere with real user configurations. It supports reactive waiting, meaning you can wait for specific text or conditions to be met before proceeding with further actions, eliminating the need for arbitrary sleep commands. This is particularly beneficial for long-lived processes or when running development servers in the background, allowing for efficient resource management and testing workflows.
The skill also facilitates the capturing of text snapshots and styled screenshots of the TUI screens, providing valuable evidence for debugging and documentation purposes. For those writing end-to-end tests, Tuistory offers a programmatic API that integrates seamlessly with existing testing frameworks, allowing for detailed assertions based on the actual screen state rather than raw output streams. This enhances the reliability of tests and ensures that UI changes are accurately reflected in your test results.
Overall, Tuistory is an essential tool for developers and QA engineers working with terminal applications who require a robust solution for headless testing and automation. Its capabilities streamline the testing process, making it easier to manage and interact with TUIs in a controlled and efficient manner.
When to use it
Use Tuistory when you need to test or automate terminal applications, especially in CI/CD pipelines or cloud environments.
When not to use it
Tuistory is not suitable for applications that require direct user interaction or graphical interfaces outside of terminal emulation.
What you can build with it
Automating TUI Testing
Use Tuistory to automate the testing of the Cline TUI in a CI/CD pipeline, allowing for consistent and repeatable tests.
Debugging Interactive Applications
Leverage Tuistory to reproduce and debug issues in terminal applications without affecting real user configurations.
Capturing Evidence for Testing
Utilize Tuistory to take snapshots and screenshots of terminal applications, providing clear evidence for testing and documentation.
How to install Tuistory
View source1. Install with the skills CLI
npx skills add cline/cline/tuistory --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by clinetuistory
tuistory wraps any terminal command in a named background PTY session backed by a Ghostty terminal emulator. Agents interact with the session via short CLI calls that return instantly; humans can tuistory attach to the same session to watch or intervene. No real terminal or display (DISPLAY) is needed — it works fully headless, which makes it the preferred way for cloud agents to exercise the Cline TUI.
It is installed as a devDependency of @cline/cli, so the pinned binary resolves when you run from apps/cli:
cd apps/cli
bunx tuistory --help # source of truth for commands, options, and syntax
For full upstream docs: curl -s https://raw.githubusercontent.com/remorses/tuistory/refs/heads/main/README.md
Driving the Cline TUI headlessly
Launch the TUI in an isolated environment so you don't touch real user config (~/.cline):
cd apps/cli
DATA_DIR=$(mktemp -d) && HOME_DIR=$(mktemp -d)
bunx tuistory -s cline --cols 120 --rows 36 \
--env HOME=$HOME_DIR --env CLINE_DATA_DIR=$DATA_DIR \
--env CLINE_DISABLE_CLINE_PASS_NOTICE=1 --env CLINE_TELEMETRY_DISABLED=1 \
-- bun src/index.ts --provider anthropic -m claude-sonnet-4-6 -k test-key
The dummy -k test-key renders the full chat UI; only an actual agent turn would fail. For recorded LLM turns, use the VCR cassettes described in apps/cli/src/tests/helpers/env.ts (CLINE_VCR=playback + CLINE_VCR_CASSETTE). Real turns need a provider credential (e.g. ANTHROPIC_API_KEY, CLINE_API_KEY).
Then use an observe → act → observe loop:
# Wait reactively for the chat view — never use sleep
bunx tuistory -s cline wait "What can I do for you?" --timeout 30000
# Act, then always observe the resulting screen state
bunx tuistory -s cline type "/settings"
bunx tuistory -s cline snapshot --trim
bunx tuistory -s cline press enter
bunx tuistory -s cline snapshot --trim
# Styled PNG of the current screen (prints the file path) — good for artifacts
bunx tuistory -s cline screenshot
# Full raw output stream (snapshot shows only the visible screen)
bunx tuistory read -s cline --all
# Tear down a session YOU started (double Ctrl+C exits the TUI cleanly)
bunx tuistory -s cline press ctrl c
bunx tuistory -s cline press ctrl c
bunx tuistory -s cline close
Background processes (instead of tmux)
bunx tuistory -s my-server -- bun run dev:sidecar # returns immediately
bunx tuistory -s my-server wait "/listening|ready/i" --timeout 30000
bunx tuistory read -s my-server # new output since last read
bunx tuistory -s my-server restart # after code changes
Key rules
- Options before
--, command after. Everything after the first--is passed verbatim to the child:tuistory -s name --cols 150 -- bun src/index.tsis correct. - Snapshot after every action. TUIs are stateful; dialogs and errors can render over the view you expect.
snapshotreflects what the user actually sees (occluded text does not count), unlike grepping the raw stream. - Wait, never sleep.
wait "text"/wait "/regex/i"(case-sensitive by default) reacts as fast as the terminal updates;wait-idlewhen you don't know what to expect. Always pass--timeout. - Keys land instantly. Unlike sleep-based scripts, a queued second keypress can leak into the next view (e.g. one Enter both accepts a slash completion and submits it).
- Never close a session you didn't start. Sessions are shared with humans (
tuistory attach -s name) and other agents. Default to leaving sessions running; useread/wait/snapshotto inspect without disrupting. --cols/--rowsaffect TUI layout (assertions are width-sensitive);--pixel-ratio 2gives sharper screenshots.
Writing e2e tests with the library API
apps/cli/src/cli.tuistory.e2e.test.ts (run: bun run test:e2e:tuistory) is the reference. The programmatic API runs in-process — no daemon:
import { launchTerminal } from "tuistory";
const session = await launchTerminal({
command: "bun",
args: ["src/index.ts", "--provider", "anthropic", "-k", "test-key"],
cwd: cliRoot,
env: isolatedEnv, // see createCliEnv() in the reference test
cols: 120,
rows: 36,
waitForDataTimeout: 30_000, // CLI cold start compiles a large TS graph
});
await session.waitForText("What can I do for you?", { timeout: 30_000 });
const screen = await session.text({ trimEnd: true }); // emulated screen state
await session.type("/settings");
await session.press("enter");
session.close(); // always close in test teardown
Screen-state assertions can check that stale UI is gone (expect(screen).not.toContain(...)), which stream-grepping harnesses cannot. session.text({ only: { bold: true } }) filters by style; session.read() returns the raw stream since the last read.
Frequently asked questions about Tuistory
Similar skills
Spring Boot Testing
Master testing techniques for Spring Boot 4 applications.
GitHub Issues
Manage GitHub issues efficiently with MCP tools.
Geofeed Tuner
Optimize your IP geolocation feeds in CSV format.
Batch Files
Master Windows batch scripting for automation and task management.
Adobe Illustrator Scripting
Automate your Illustrator workflows with ExtendScript.
Plugin Structure
Create and organize Claude Code plugins effectively.
