agentleFS
MicrosoftKnown publishermicrosoft/tui-test/SKILL.md

tui-test

Skill325 starsChanged 5 days agoMITView on GitHub

Control, inspect, test, and record real terminal apps with the tui-test CLI or its Rust, Python, and JavaScript APIs. Use for shells, TUI apps, text and style locators, keyboard or mouse input, terminal state, clipboard waits, screenshots, recordings, snapshots, and live terminal sessions.

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. microsoft/inshellisense★ 11ksame name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

The file

Show its rules and text

We split this skill into the rules it gives an agent

14 rules. About 0 are common, 3 are distinctive, and 11 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 11

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use tui-test to control and test a real terminal.

    line 8
  2. Very specific:

    Use the library that matches the project.

    line 21
  3. Very specific:

    Run tui-test agent-context for exact command and option names.

    line 35
  4. Distinctive:

    Use text and style locators for visible terminal state.

    line 79
  5. Very specific:

    Use first(), last(), nth(), or unique() before an action when text repeats.

    line 92
  6. Very specific:

    Use get_by_style() or getByStyle() for colors and attributes.

    line 93
  7. Very specific:

    Use direction="within", "after", or "before" for relative matches.

    line 94
  8. Very specific:

    Use locations() or count() for immediate reads.

    line 95
  9. Very specific:

    Use wait(), expect(), or click() when the app may still be changing.

    line 96
  10. Distinctive:

    Do not use a fixed sleep when a wait can describe the state.

    line 110
  11. Very specific:

    Use open for shell commands and run for an app.

    line 115
  12. Distinctive:

    Keep the shell, terminal size, cwd, environment, and timeouts explicit when they affect output.

    line 117
  13. Very specific:

    Use semantic mouse buttons: left, middle, or right.

    line 118
  14. Very specific:

    Use screenshot for text, SVG, or PNG.

    line 123

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

tui-test

Use tui-test to control and test a real terminal.

Pick an API

ContextUseReference
Agent or shell workflowCLICLI
Trusted tape to GIFLocal CLI workflowTape
Python codetui_testPython
JavaScript or TypeScript@microsoft/tui-testJavaScript
Rust codetui-test-rsRust
Common tasksCurrent project languageRecipes

Use the library that matches the project. Use the CLI when the terminal must persist across separate commands or be watched with monitor.

CLI and library sessions do not share state.

CLI

tui-test run my-app
tui-test expect text "Ready"
tui-test click text "Continue"
tui-test expect text "Done"
tui-test close

Run tui-test agent-context for exact command and option names.

For a trusted tape, use the isolated local workflow:

tui-test tape check demo.tape --json
tui-test tape run demo.tape

Both commands report the effective grid, pixel dimensions, and source-located warnings. check does not start a child or write an output. Tape commands ignore TUI_TEST_SESSION and do not load project configuration. They reject explicit session and diagnostic flags; only the global --json flag applies. Warning: Run only trusted tapes. Tapes can execute shell commands; they are not sandboxed. See Tape for an example and the supported subset.

Python

from tui_test import TuiTest

async with TuiTest.ephemeral() as terminal:
    await terminal.run("my-app")
    await terminal.get_by_text("Ready").expect()
    await terminal.get_by_text("Continue").click()

JavaScript

import { TuiTest } from "@microsoft/tui-test";

const terminal = TuiTest.ephemeral();
try {
  await terminal.run("my-app");
  await terminal.getByText("Ready").expect();
  await terminal.getByText("Continue").click();
} finally {
  await terminal.closeQuiet();
}

Locators

Use text and style locators for visible terminal state.

save = (
    terminal
    .get_by_text("Settings")
    .get_by_text("Save", direction="after")
    .unique()
)

await save.click()
  • Use first(), last(), nth(), or unique() before an action when text repeats.
  • Use get_by_style() or getByStyle() for colors and attributes.
  • Use direction="within", "after", or "before" for relative matches.
  • Use locations() or count() for immediate reads.
  • Use wait(), expect(), or click() when the app may still be changing.

Wait for state

NeedUse
Visible or hidden textLocator wait() or expect()
Submitted command finishedwait command, wait_command(), waitCommand()
Program exitedwait exit, wait_exit(), waitExit()
Shell prompt readywait ready, wait_ready(), waitReady()
Screen stopped changingwait idle, wait_idle(), waitIdle()
Clipboard changed or matchedwait clipboard, wait_clipboard(), waitClipboard()
Bell firedwait bell, wait_bell(), waitBell()

Do not use a fixed sleep when a wait can describe the state.

Keep tests stable

  • Give parallel tests unique sessions.
  • Use open for shell commands and run for an app.
  • Assert the exit code separately from visible text.
  • Keep the shell, terminal size, cwd, environment, and timeouts explicit when they affect output.
  • Use semantic mouse buttons: left, middle, or right.
  • Close every session. Prefer the Python and JavaScript test helpers.

Capture output

Use screenshot for text, SVG, or PNG. SVG, PNG, APNG, and GIF support --background COLOR and --transparent. MP4 supports --background only. Use record for APNG, GIF, MP4, or asciinema. Select asciicast v2 with --format cast or v3 with --format cast3; .cast alone selects v2.

For an automatic cast without a trace, pass --recording-mode on-failure or --recording-mode always to open or run. Set [recording].directory to choose where casts go and [recording].format to choose cast (default) or cast3. Selecting a format does not enable recording; the mode is not a TOML key.

Configure [trace] with mode = "on-failure" and a directory for test artifacts, including agent-readable Markdown/JSON, an asciicast, and standalone HTML. Trace modes are off (default), on, and on-failure. Active tracing takes precedence over --recording-mode.

For a failed assertion that must be understood offline, add --failure-artifacts <dir>. Agents should read failure.md first, then failure.json for exact locator/process evidence and timeline.json for retained per-cell frame metadata. Users can open failure.html directly from disk to navigate assertion checkpoints, step frames, and inspect clicked cells. Missing history is explicit; sampled frames are not a complete recording. Add --failure-artifact-recording for a continuous cast only when terminal output is safe to retain; diagnostic bundles can contain sensitive terminal text, titles, and locator operands.

References

  • CLI
  • Tape
  • Python
  • JavaScript
  • Rust
  • Recipes

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.