npx cliprobe -- tsx
cliprobe 1.4.3: closed-pipe, color, pipe-escapes, stdin, ctrl-c, sigterm, restore, control-chars checks for tsx
closed-pipe
FAIL tsx --version crashed when stdout was closed (exit 0 -> 1)
Error: write EPIPE (at node_modules/tsx/dist/cli.mjs:53:36962)
PASS tsx --help exited quietly
color
PASS tsx --version no color in a pipe or in a terminal
FAIL tsx --help printed color codes into a pipe
stdout line 5: \x1b[1mUsage:\x1b[22m
pipe-escapes
PASS tsx --version no cursor, erase, hyperlink, title or redraw codes in a pipe
PASS tsx --help no cursor, erase, hyperlink, title or redraw codes in a pipe
stdin
PASS tsx --version finished without waiting for stdin
PASS tsx --help finished without waiting for stdin
ctrl-c
SKIP tsx needs a probe that keeps running, such as a watch or serve command (--probe), or --bare
sigterm
SKIP tsx needs a probe that keeps running, such as a watch or serve command (--probe), or --bare
restore
PASS tsx --version left no terminal mode switched on and the terminal's settings as it found them when it exited
PASS tsx --help left no terminal mode switched on and the terminal's settings as it found them when it exited
control-chars
SKIP tsx no {fixture} in the arguments; add a probe that takes a path, e.g. --probe "ls {fixture}"
2 failed, 0 warned, 8 passed, 3 skipped
tsx 4.23.15, run offline in a container in November 2026.
Why cliprobe?
When a program's output goes into a reader that stops early (| head, grep -q, a closed agent pipe), its next write to stdout fails. A well-behaved program exits quietly. Many Node.js CLIs instead crash with Error: write EPIPE, a stack trace, and exit code 1. That breaks scripts running under set -o pipefail and confuses agents that read stderr.
In a census of the 100 most-downloaded npm packages that ship a command (119 commands, run offline in a throwaway container), 9 crashed this way every time: esbuild, browserslist, update-browserslist-db, autoprefixer, husky, tsconfck, ts-jest, rolldown, and tsx on --version. Since then esbuild and browserslist have fixed it; the other seven still crashed when re-checked at their November 2026 versions. The best-known existing CLI auditor rated the first 8 as passing its SIGPIPE check. The same census found two commands that print color codes into a pipe (giget --help, tsx --help), five whose --help or --version waits for stdin (he, cssesc, ansi-html, webpack and webpack-dev-server), and no false failures: every FAIL reproduced by hand. (A census of --help and --version can't exercise ctrl-c, sigterm or control-chars, which need a command that keeps running or takes a path; their fixtures and real-tool tests are in test/.)
The other checks cover the rest of what goes wrong between a program and the thing reading it: color codes leaking into logs and agent transcripts, Ctrl-C that is ignored or ends in a stack trace, child processes left running after kill or docker stop, a terminal left with a hidden cursor or no line wrapping after Ctrl-C, and file names that can send escape sequences to your terminal.
- Evidence, never a score. Every result is a verdict with the error line, the first stack frame in the target's own code, or the escape sequence that leaked.
- No false fails. A new check starts as warn-only and is calibrated against real tools before it may fail.
- Deterministic. A closed pipe is a FIFO closed before the program starts, Ctrl-C is a signal to its process group, and the terminal is always 80×24.
- Any language. It tests the program from the outside, so a Go, Rust, Python or shell CLI works as well as a Node.js one.
- Zero dependencies. Nothing but Node.js and, for the terminal checks, the system's
script command.
Contents
- Installation
- Usage
- Exit codes
- In CI
- JSON output
- Stability
- Checks: closed-pipe, color, pipe-escapes, stdin, ctrl-c, sigterm, restore, control-chars, info checks
- Fixing a failure in a Node.js CLI
- Agent skill
- Safety
- FAQ
- Contributing
- License
Installation
Requires Node.js 22.12 or later, on macOS or Linux (including Alpine). Windows isn't supported yet. The terminal checks (color, restore and control-chars) also need the system's script command, which macOS has and most Linux distributions install by default. Without it they're skipped, and each skip says so. If it's missing, install the package that has it: bsdutils on Debian and Ubuntu, util-linux-script on Fedora, util-linux-misc on Alpine.
Run it without installing:
npx cliprobe -- <command>
Or add it to a project, to run in CI against your own CLI:
npm install --save-dev cliprobe # or: pnpm add -D cliprobe
Usage
npx cliprobe -- <command> # probes "<command> --version" and "<command> --help"
npx cliprobe -- <command> [args...] # probes exactly this invocation
npx cliprobe --probe "watch app.ts" -- tsx # adds a probe: --version, --help and "watch app.ts"
npx cliprobe -- node ./dist/cli.js list # test your own CLI before publishing
npx cliprobe --json -- <command> # machine-readable results
npx cliprobe --format junit -o report.xml -- <command> # JUnit file for CI; human report on stdout
npx cliprobe -- ls {fixture} # {fixture}: a directory of hostile file names
npx cliprobe --bare -- htop # the command alone: a REPL, a full-screen program, a server
npx cliprobe --check startup,baseline -- node ./dist/cli.js # info checks, only when named
npx cliprobe --strict --skip restore -- node ./dist/cli.js server # warnings fail too, except restore's
| Option |
Meaning |
--bare |
Probe the command with no arguments instead of --version and --help, as a probe you wrote |
--probe <args> |
Also probe <command> <args>; repeat it for several. Split like a shell command line (quotes and backslashes, no variables or wildcards). The args after <command> aren't kept: with -- node ./cli.js, write --probe "./cli.js watch" |
--check <name> |
Run only this check; repeat it or use commas for several |
--skip <name> |
Leave this check out; repeat it or use commas for several |
--strict |
Exit 1 on a warning too, not only on a failure |
--format <name> |
Output format: human (default), json, markdown (a GitHub job summary or PR comment) or junit (XML for CI test reports) |
--json |
Same as --format json |
-o, --output-file <path> |
Write the --format report to a file (replaced atomically, keeping its mode and following symlinks, with parent folders created; a FIFO, /dev/stdout or /dev/fd/N is written in place); the human report still prints. For a path that starts with -, write -o=<path> or ./<path> |
--timeout <ms> |
Kill a probe after this long (default 15000, at most 2147483647, about 24 days); a command still running then is judged on what it did so far |
-h, --help |
Show help |
-v, --version |
Show the version |
An option's value follows it or comes after = (--format=json). A value that is another option, as in -o --strict, is a usage error rather than a file named --strict. --probe is the exception: its value may start with -, to probe a flag (--probe --json).
A probe runs <command> with its own args, in place of the args after the command, not after them. So when the command is an interpreter, name the script in every probe: npx cliprobe --probe "./dist/cli.js watch" -- node ./dist/cli.js probes node ./dist/cli.js and node ./dist/cli.js watch, while --probe watch would run node watch. A probe that exits with a failure code and is skipped says so in its reason, with the error line from stderr as evidence, so a probe that never ran as intended doesn't pass for a quiet skip.
Exit codes
| Code |
Meaning |
0 |
No check failed |
1 |
A check failed, or warned with --strict |
2 |
Usage error, the command could not run, or the --output-file report could not be written |
A command that can't run is reported once, before any check runs, with exit 2 and no report: one that isn't on PATH, a directory, a file without the execute bit (chmod +x), or a script whose #! interpreter is missing. A file this system can't execute at all, such as a binary built for another platform, makes every check say could-not-run (ERROR), so cliprobe exits 2 there too; on Linux, where /bin/sh tries such a file as a script, cliprobe recognizes the shell's complaint. An --output-file path that can't be written, such as a directory or a folder without write permission, is also reported before any check runs, with exit 2. If the file still can't be written at the end, cliprobe prints the human report first, so no result is lost, then the error, and exits 2 even when a check failed: CI fails the step either way. That makes cliprobe usable as a CI gate.
In CI
A failed check exits 1, so the step fails. Warnings don't fail it unless you add --strict; with --strict, --skip leaves out a check whose warning you accept. Add --probe for a command that keeps running and one with {fixture}, so a single step covers every check. In GitHub Actions, write a Markdown report to the job summary while the log keeps the human report:
- name: Check the CLI for terminal-edge bugs
run: npx --yes cliprobe@1 --format markdown --output-file "$GITHUB_STEP_SUMMARY" -- node ./dist/cli.js
For CI systems that read test results, write JUnit XML instead and keep it even when the step fails:
- run: npx --yes cliprobe@1 --format junit --output-file reports/cliprobe.xml -- node ./dist/cli.js
- uses: actions/upload-artifact@v7
if: always()
with:
name: cliprobe-report
path: reports/cliprobe.xml
In JUnit, each check is a test suite and each probe a test case: FAIL is a failure, could-not-run an error, SKIP skipped; WARN, INFO and PASS pass, with the verdict and reason in the case's output.
JSON output
--format json (or --json) writes one report, described by a JSON Schema that ships in the package as cliprobe/schema.json:
{
"tool": "cliprobe",
"schemaVersion": 1,
"version": "1.0.0",
"command": "node",
"checks": ["ctrl-c"],
"strict": false,
"summary": { "pass": 0, "fail": 1, "warn": 0, "skip": 0, "error": 0, "info": 0 },
"results": [
{
"check": "ctrl-c",
"invocation": ["node", "server.js"],
"verdict": "fail",
"reason": "ignored Ctrl-C: still running 3 s later",
"details": {
"sentAfterMs": 1003,
"exitedAfterMs": null,
"exitCode": null,
"signal": "SIGKILL",
"stderrAfter": ""
}
}
]
}
strict says whether --strict was given (added in 1.1). Every result has the same five fields: check, invocation (the command and arguments that ran), verdict (pass, fail, warn, skip, error for could-not-run, or info), reason (a sentence for a person) and details, plus evidence when there is a line to quote. details holds the check's own measurements, such as exit codes, timings, the terminal modes left on or the processes left running; the schema describes each check's. Text from the program under test is escaped: control characters, line separators and bidi overrides appear as \u escapes, so the report can't drive a terminal when printed. The human report shows them as \x1b-style escapes and doubles a backslash the program printed, so \\x1b is text and \x1b a real escape character; it cuts evidence longer than 200 characters, which the JSON has in full.
Stability
From 1.0, cliprobe follows semantic versioning, and these hold for every 1.x release:
- No new failures. A minor release never makes a passing or warning program fail. New checks, and new things an existing check notices, only warn until the next major release. So
cliprobe@1 in CI turns red only when your program changes.
- Names and exit codes. Check names, verdicts, options and exit codes stay as they are.
--strict opts out of the first promise. It fails on warnings, so a new warning in a minor release can fail your build. Pin an exact version (cliprobe@1.1.0) if that matters, or --skip the check.
- JSON.
schemaVersion stays 1. Fields are only added, never removed, renamed or given a new type.
- Not covered. The wording of
reason and evidence, and the human and Markdown output, are for people and may change. Match on check and verdict, not on text.
Checks
A default run does the eight checks below: closed-pipe, color, pipe-escapes, stdin, ctrl-c, sigterm, restore and control-chars. Each one reports evidence, never a score. Two info checks, startup and baseline, run only when you name them with --check.