Development
Skill
/terminal-emulator
Test interactive CLI/TUI applications using @microsoft/tui-test. Use when you need to test CLI tools with interactive prompts, TUI rendering, arrow key navigation, or any command that requires a TTY. Triggers include "test CLI", "test TUI", "run interactively", "automate
Install
$ npx -y skills add slopus/happy --skill terminal-emulator --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/terminal-emulator
Context preview
The summary Claude sees to decide when to auto-load this skill.
Test interactive CLI/TUI applications using @microsoft/tui-test. Use when you need to test CLI tools with interactive prompts, TUI rendering, arrow key navigation, or any command that requires a TTY. Triggers include "test CLI", "test TUI", "run interactively", "automate
SKILL.md
terminal-emulator.SKILL.mdname: terminal-emulator
description: Test interactive CLI/TUI applications using @microsoft/tui-test. Use when you need to test CLI tools with interactive prompts, TUI rendering, arrow key navigation, or any command that requires a TTY. Triggers include "test CLI", "test TUI", "run interactively", "automate terminal input", "simulate user input in terminal".
allowed-tools: Bash(npx tui-test:*), Bash(node:*)
Testing Interactive CLI / TUI with @microsoft/tui-test
Playwright-like API for terminals. Real PTY per test. Made by Microsoft.
- **GitHub**: https://github.com/microsoft/tui-test
- **npm**: `@microsoft/tui-test`
Install
yarn add -D @microsoft/tui-test
Usage
import { test, expect } from '@microsoft/tui-test';
test.use({ program: { file: 'node', args: ['./my-cli.js'] } });
test('selects option and proceeds', async ({ terminal }) => {
await expect(terminal.getByText('Select an option')).toBeVisible();
await terminal.write('\x1B[B'); // Arrow Down
await terminal.submit(); // Enter
await expect(terminal.getByText('Option 2 selected')).toBeVisible();
});
test('matches snapshot', async ({ terminal }) => {
await expect(terminal).toMatchSnapshot();
});API
// Navigation
await terminal.write('\x1B[A'); // Arrow Up
await terminal.write('\x1B[B'); // Arrow Down
await terminal.write('\x1B[C'); // Arrow Right
await terminal.write('\x1B[D'); // Arrow Left
await terminal.submit(); // Enter
await terminal.write('\t'); // Tab
await terminal.write('\x03'); // Ctrl+C
await terminal.write('\x1B'); // Escape
await terminal.write('\x7F'); // Backspace
await terminal.write('hello'); // Type text
// Assertions
await expect(terminal.getByText('pattern')).toBeVisible();
await expect(terminal.getByText('pattern', { full: true })).toBeVisible();
await expect(terminal).toMatchSnapshot();
// Reading
const content = terminal.content; // Full terminal content as stringRunning
npx tui-test # Run all tests
npx tui-test --update-snapshots # Update snapshots
npx tui-test my-test.ts # Run specific test
Reference
- Used by VS Code terminal team
- Real PTY isolation per test (no mocking)
- Auto-waits for terminal renders
- Cross-platform (macOS, Linux, Windows)
- Snapshot testing built-in
Read more
name: terminal-emulator description: Test interactive CLI/TUI applications using @microsoft/tui-test. Use when you need to test CLI tools with interactive prompts, TUI rendering, arrow key navigation, or any command that requires a TTY. Triggers include "test CLI", "test TUI", "run interactively", "automate terminal input", "simulate user input in terminal". allowed-tools: Bash(npx tui-test:*), Bash(node:*)
Testing Interactive CLI / TUI with @microsoft/tui-test
Playwright-like API for terminals. Real PTY per test. Made by Microsoft.
- **GitHub**: https://github.com/microsoft/tui-test
- **npm**: `@microsoft/tui-test`
Install
yarn add -D @microsoft/tui-test
Usage
import { test, expect } from '@microsoft/tui-test';
test.use({ program: { file: 'node', args: ['./my-cli.js'] } });
test('selects option and proceeds', async ({ terminal }) => {
await expect(terminal.getByText('Select an option')).toBeVisible();
await terminal.write('\x1B[B'); // Arrow Down
await terminal.submit(); // Enter
await expect(terminal.getByText('Option 2 selected')).toBeVisible();
});
test('matches snapshot', async ({ terminal }) => {
await expect(terminal).toMatchSnapshot();
});API
// Navigation
await terminal.write('\x1B[A'); // Arrow Up
await terminal.write('\x1B[B'); // Arrow Down
await terminal.write('\x1B[C'); // Arrow Right
await terminal.write('\x1B[D'); // Arrow Left
await terminal.submit(); // Enter
await terminal.write('\t'); // Tab
await terminal.write('\x03'); // Ctrl+C
await terminal.write('\x1B'); // Escape
await terminal.write('\x7F'); // Backspace
await terminal.write('hello'); // Type text
// Assertions
await expect(terminal.getByText('pattern')).toBeVisible();
await expect(terminal.getByText('pattern', { full: true })).toBeVisible();
await expect(terminal).toMatchSnapshot();
// Reading
const content = terminal.content; // Full terminal content as stringRunning
npx tui-test # Run all tests npx tui-test --update-snapshots # Update snapshots npx tui-test my-test.ts # Run specific test
Reference
- Used by VS Code terminal team
- Real PTY isolation per test (no mocking)
- Auto-waits for terminal renders
- Cross-platform (macOS, Linux, Windows)
- Snapshot testing built-in
Ships withhappy
Mobile and Web client for Codex and Claude Code, with realtime voice, encryption and fully featured
Get the whole plugin
Stats
23,259
Stars
1,967
Forks
Active
Maintenance
TypeScript
Language
MIT
License
2d ago
Last commit
1y ago
Created
Repo: slopus/happy

