Tcut Terminal Video
Create a concise terminal story that runs reliably, proves the important output, and produces the requested media without hiding failures.
Core contract
- Treat every command in a tcut script as a real shell command with the caller's permissions.
t.hide() removes footage; it does not sandbox, redact logs, or make a command safe.
- Prefer a scripted
.video.ts file for agent work. Use tcut rec only when live, human-driven interaction is part of the request or when converting an exploratory session into an editable script.
- Wait for observable terminal state before acting. Use
t.run(), t.wait(), and t.expect(); use t.sleep() for deliberate pacing, not synchronization.
- Assert the key result on the rendered terminal screen. A video that looks plausible but shows the wrong state is a failed demo.
- Keep the story short. Show only the commands and outputs needed to explain one workflow, and use
t.title() or t.print() only when a caption materially improves comprehension.
- Preserve the target repository and its instructions. Do not install packages, start external services, modify product files, upload media, or force a re-record unless the user has authorized that action.
- Never place tokens, credentials, private paths, or sensitive output in the script, cast, rendered media, shell history, captions, or publishing configuration.
- Do not claim cross-platform or visual success without checking the produced artifact. tcut's Linux and Windows binaries may behave differently from its verified macOS path.
Choose the path
| Need |
Path |
| A clean demo from known commands |
Use the easy scripted workflow below |
| Explore manually, then refine |
Record with tcut rec, edit the generated .video.ts, then test and render |
| Drive a TUI, Codex, Claude Code, or another agent |
Read advanced-workflows.md |
| Show a browser beside or over the terminal |
Read advanced-workflows.md |
| Tune the complete config or use less common key methods |
Read script-api.md |
| Re-theme an existing cast without re-running commands |
Use tcut render and read advanced-workflows.md |
| Upload to R2, S3, MinIO, or another compatible bucket |
Read the publishing guardrails in advanced-workflows.md |
Easy scripted workflow
1. Define the demo before writing it
Establish:
- the audience and the one outcome they should understand;
- the exact commands that are safe to run in the target checkout;
- the terminal state or output that proves success;
- the requested format, dimensions, theme, pacing, and destination;
- whether the commands mutate files, start services, access the network, or expose private data.
If the user did not specify a format, prefer .svg or .html for a dependency-light terminal artifact. Use .mp4, .webm, .gif, or .webp when motion playback is required and ffmpeg is available.
2. Check only the prerequisites the chosen path needs
tcut --version
bun --version
command -v ffmpeg
tcut requires Bun 1.4 or newer unless a standalone binary is already installed. SVG and HTML do not require ffmpeg. MP4, WebM, and GIF do; WebP needs an ffmpeg build with libwebp.
If tcut is absent and installation is authorized, the official package command is:
bun add -g termcut
The package is named termcut; the executable and TypeScript import are both tcut.
3. Write a deterministic script
Start with a small .video.ts file in the project where the commands should run:
import { defineVideo } from "tcut";
export default defineVideo(
{
output: ["demo.svg", "demo.gif"],
cols: 88,
rows: 26,
theme: "catppuccin-mocha",
typingSpeed: "40ms",
waitTimeout: "20s",
endPause: "1.5s",
},
async (t) => {
await t.title("Verify the project");
await t.run("bun test");
await t.expect(/pass|passed|tests?\s+passed/i);
await t.sleep("1s");
},
);
Replace the example command and assertion with output verified in the actual project. Do not invent a success expression broad enough to match unrelated screen text.
For ordinary commands, prefer t.run(command): it types, presses Enter, and waits for the prompt to return. Use t.type() plus key methods only when the interaction is genuinely incremental or full-screen.
4. Test behavior before spending time rendering
tcut test demo.video.ts --json
tcut test removes sleeps and typing delays, and exits non-zero when an expectation fails. With --json, stdout is exactly one JSON document and progress lines are suppressed. Read structured failures, especially the screen dump, before adjusting a wait or key sequence.
5. Record and render
tcut demo.video.ts --json
Recording is cached. Re-running an unchanged script can reuse its .cast; use --force only when a new recording is actually required. To change presentation without executing the shell again:
tcut render demo.cast --theme "Gruvbox Dark" -o demo.svg --json
6. Validate the artifact
Check that:
- the command and asserted result are visible and correct;
- no secret, private path, noisy setup, broken prompt, or stale full-screen content appears;
- text is readable at the target display size;
- captions do not collide with a TUI and the final state has enough pause;
- every requested output exists and plays or opens successfully;
- the working tree contains only intended script and artifact changes.
When the environment can inspect media, review at least the opening, transition, proof state, and ending rather than trusting the renderer's exit code alone.
Failure handling
- Exit code
0 means success; 1 means failure.
- Under
--json, parse the single JSON value instead of scraping status text. Errors include a type such as WaitTimeoutError or ExpectationError.
- A timeout usually means the script waited for the wrong visible state, used the wrong
scope, or encountered a different prompt. Inspect the screen dump first.
- If a TUI item moved, select by reading
t.screen() instead of replaying a fixed number of arrow keys.
- If background server logs repaint the terminal, detach stdin and redirect output as described in advanced-workflows.md.
- If only styling or format failed, re-render the existing cast rather than re-running commands.
Handoff
Report:
- the script and output paths;
- which commands the recording executed and whether they mutate state;
tcut test and render results;
- which artifact moments were visually inspected;
- any dependency, platform, browser, codec, publishing, or visual path not verified.
Current sources
Use the agent-focused llms.txt, official README, and CLI/API reference as the authority when flags or APIs may have changed. This skill was grounded in those sources on 2026-08-21.
1---2name: tcut-terminal-video3description: Create, edit, test, render, and publish repeatable terminal demos with tcut (the termcut package). Use when Codex needs to turn CLI commands, interactive terminal programs, coding agents, or a terminal-plus-browser workflow into scripted or live MP4, WebM, GIF, WebP, SVG, HTML, screenshots, or frame sequences. Covers easy recordings, deterministic TypeScript video scripts, TUI automation, visual styling, re-rendering casts, and S3-compatible publishing; do not use for general screen recording that does not involve tcut.4---56# Tcut Terminal Video78Create a concise terminal story that runs reliably, proves the important output, and produces the requested media without hiding failures.910## Core contract11121. Treat every command in a tcut script as a real shell command with the caller's permissions. `t.hide()` removes footage; it does not sandbox, redact logs, or make a command safe.132. Prefer a scripted `.video.ts` file for agent work. Use `tcut rec` only when live, human-driven interaction is part of the request or when converting an exploratory session into an editable script.143. Wait for observable terminal state before acting. Use `t.run()`, `t.wait()`, and `t.expect()`; use `t.sleep()` for deliberate pacing, not synchronization.154. Assert the key result on the rendered terminal screen. A video that looks plausible but shows the wrong state is a failed demo.165. Keep the story short. Show only the commands and outputs needed to explain one workflow, and use `t.title()` or `t.print()` only when a caption materially improves comprehension.176. Preserve the target repository and its instructions. Do not install packages, start external services, modify product files, upload media, or force a re-record unless the user has authorized that action.187. Never place tokens, credentials, private paths, or sensitive output in the script, cast, rendered media, shell history, captions, or publishing configuration.198. Do not claim cross-platform or visual success without checking the produced artifact. tcut's Linux and Windows binaries may behave differently from its verified macOS path.2021## Choose the path2223| Need | Path |24| --- | --- |25| A clean demo from known commands | Use the easy scripted workflow below |26| Explore manually, then refine | Record with `tcut rec`, edit the generated `.video.ts`, then test and render |27| Drive a TUI, Codex, Claude Code, or another agent | Read [advanced-workflows.md](references/advanced-workflows.md) |28| Show a browser beside or over the terminal | Read [advanced-workflows.md](references/advanced-workflows.md) |29| Tune the complete config or use less common key methods | Read [script-api.md](references/script-api.md) |30| Re-theme an existing cast without re-running commands | Use `tcut render` and read [advanced-workflows.md](references/advanced-workflows.md) |31| Upload to R2, S3, MinIO, or another compatible bucket | Read the publishing guardrails in [advanced-workflows.md](references/advanced-workflows.md) |3233## Easy scripted workflow3435### 1. Define the demo before writing it3637Establish:3839- the audience and the one outcome they should understand;40- the exact commands that are safe to run in the target checkout;41- the terminal state or output that proves success;42- the requested format, dimensions, theme, pacing, and destination;43- whether the commands mutate files, start services, access the network, or expose private data.4445If the user did not specify a format, prefer `.svg` or `.html` for a dependency-light terminal artifact. Use `.mp4`, `.webm`, `.gif`, or `.webp` when motion playback is required and ffmpeg is available.4647### 2. Check only the prerequisites the chosen path needs4849```sh50tcut --version51bun --version52command -v ffmpeg53```5455tcut requires Bun 1.4 or newer unless a standalone binary is already installed. SVG and HTML do not require ffmpeg. MP4, WebM, and GIF do; WebP needs an ffmpeg build with libwebp.5657If tcut is absent and installation is authorized, the official package command is:5859```sh60bun add -g termcut61```6263The package is named `termcut`; the executable and TypeScript import are both `tcut`.6465### 3. Write a deterministic script6667Start with a small `.video.ts` file in the project where the commands should run:6869```ts70import { defineVideo } from "tcut";7172export default defineVideo(73 {74 output: ["demo.svg", "demo.gif"],75 cols: 88,76 rows: 26,77 theme: "catppuccin-mocha",78 typingSpeed: "40ms",79 waitTimeout: "20s",80 endPause: "1.5s",81 },82 async (t) => {83 await t.title("Verify the project");84 await t.run("bun test");85 await t.expect(/pass|passed|tests?\s+passed/i);86 await t.sleep("1s");87 },88);89```9091Replace the example command and assertion with output verified in the actual project. Do not invent a success expression broad enough to match unrelated screen text.9293For ordinary commands, prefer `t.run(command)`: it types, presses Enter, and waits for the prompt to return. Use `t.type()` plus key methods only when the interaction is genuinely incremental or full-screen.9495### 4. Test behavior before spending time rendering9697```sh98tcut test demo.video.ts --json99```100101`tcut test` removes sleeps and typing delays, and exits non-zero when an expectation fails. With `--json`, stdout is exactly one JSON document and progress lines are suppressed. Read structured failures, especially the screen dump, before adjusting a wait or key sequence.102103### 5. Record and render104105```sh106tcut demo.video.ts --json107```108109Recording is cached. Re-running an unchanged script can reuse its `.cast`; use `--force` only when a new recording is actually required. To change presentation without executing the shell again:110111```sh112tcut render demo.cast --theme "Gruvbox Dark" -o demo.svg --json113```114115### 6. Validate the artifact116117Check that:118119- the command and asserted result are visible and correct;120- no secret, private path, noisy setup, broken prompt, or stale full-screen content appears;121- text is readable at the target display size;122- captions do not collide with a TUI and the final state has enough pause;123- every requested output exists and plays or opens successfully;124- the working tree contains only intended script and artifact changes.125126When the environment can inspect media, review at least the opening, transition, proof state, and ending rather than trusting the renderer's exit code alone.127128## Failure handling129130- Exit code `0` means success; `1` means failure.131- Under `--json`, parse the single JSON value instead of scraping status text. Errors include a `type` such as `WaitTimeoutError` or `ExpectationError`.132- A timeout usually means the script waited for the wrong visible state, used the wrong `scope`, or encountered a different prompt. Inspect the screen dump first.133- If a TUI item moved, select by reading `t.screen()` instead of replaying a fixed number of arrow keys.134- If background server logs repaint the terminal, detach stdin and redirect output as described in [advanced-workflows.md](references/advanced-workflows.md).135- If only styling or format failed, re-render the existing cast rather than re-running commands.136137## Handoff138139Report:140141- the script and output paths;142- which commands the recording executed and whether they mutate state;143- `tcut test` and render results;144- which artifact moments were visually inspected;145- any dependency, platform, browser, codec, publishing, or visual path not verified.146147## Current sources148149Use the [agent-focused llms.txt](https://tcut.amanv.dev/llms.txt), [official README](https://github.com/AmanVarshney01/tcut/tree/main/packages/tcut), and [CLI/API reference](https://github.com/AmanVarshney01/tcut/blob/main/packages/tcut/docs/REFERENCE.md) as the authority when flags or APIs may have changed. This skill was grounded in those sources on 2026-08-21.