skip to content

// npm cli

cliprobe

Black-box tests for the terminal bugs that only show up in a pipe, on Ctrl-C or in front of an AI agent.

cliprobe runs any command-line program the way scripts, CI runners and AI agents run it, and reports what breaks. It closes stdout before the first write, leaves stdin open with nothing in it, sends Ctrl-C and SIGTERM, and feeds it file names that can clear a screen, then answers each check with a verdict and the line that proves it. Nine checks, four report formats for people, CI and agents, and zero runtime dependencies.

// probe11/22
year
2026
type
npm cli
group
developer tools
status
released on npm, maintained

//in plain words

Command-line programs are written to be used by a person at a keyboard, but more and more they are run by scripts, build servers and AI agents. Those readers cut output short, never type anything and stop programs by sending signals, and many programs crash, hang or leave junk behind when that happens. cliprobe tests a program under exactly those conditions and shows the proof for every problem it finds, so the author can fix it before users hit it.

for people who build command-line tools, and anyone who runs them from scripts, CI or an AI agent

the problem

//01the problem

When a program's output goes into a reader that stops early, like head, grep -q or an agent that has read enough, its next write fails. A well-behaved program exits quietly. Many Node.js CLIs crash with a stack trace and exit code 1 instead, which breaks scripts under set -o pipefail and confuses agents that read stderr. The same gap hides color codes in logs, prompts that wait forever on a stdin nobody writes to, servers that ignore Ctrl-C or leave children running after kill, and file names that can drive your terminal. These bugs never show up when you try the program yourself, and the best-known existing CLI auditor rated eight of the crashing commands as passing its SIGPIPE check.

how it works

//02how it works

  1. 01

    Conditions you rarely make by hand

    A closed pipe is a FIFO whose reader is gone before the program starts, so even a fast native binary fails its first write every time. Ctrl-C is SIGINT to the process group, SIGTERM goes to the program alone as kill and docker stop send it, stdin is an open pipe nobody writes to, and the terminal is a real pseudo-terminal at 80 by 24. Every run gets the same minimal environment and a temporary home.

  2. 02

    Nine checks, each with evidence

    closed-pipe, write-error, color, pipe-escapes, stdin, ctrl-c, sigterm, restore and control-chars. Each result is PASS, FAIL, WARN or SKIP with a sentence and the line that proves it: the EPIPE error and the first stack frame in the program's own code, the escape sequence that leaked, the process left running. A skip says which probe would have reached the check.

  3. 03

    Calibrated before it may fail

    A new check starts as warn-only and runs against real tools before it is allowed to fail: the top 100 npm commands, 78 commands doing real work and 38 watch modes and dev servers, all offline in a throwaway container. Every fail was reproduced by hand. sigterm and restore still only warn, because what they find is a nuisance rather than a broken job, and write-error only warns because it is new.

  4. 04

    Cleans up after what it tests

    Programs are run without a shell, with stdin closed unless a check needs it. On a timeout the whole process group is killed, and when a program exits, whatever it left running is listed and killed, including processes it detached into a session of their own. If cliprobe itself is interrupted, it stops the probe, removes its temporary folders and exits by the same signal.

  5. 05

    Made to sit in CI and agents

    Exit 0 when nothing failed, 1 when a check did, 2 when the command could not run or the report could not be written. Reports come as human text, JSON described by a schema that ships in the package, Markdown for a job summary and JUnit for CI test views, and text from the program is escaped so a report cannot drive a terminal. Within 1.x a minor release never turns a passing program red.

  6. 06

    An agent skill in the repository

    An official agent skill teaches coding agents such as Claude Code, Codex and Gemini CLI to run every check with the right probes, read the JSON report, propose the fix for each failure and add a CI step. It ships with evals, and its options and numbers are tested like code in CI, next to tests that read the README so the docs cannot drift from the tool.

screens

//03screens

  1. A default run: tsx 4.23.15 in an offline container: --version crashes once stdout is closed, --help prints color into a pipe, and each skip says which probe it needs.
    01A default runtsx 4.23.15 in an offline container: --version crashes once stdout is closed, --help prints color into a pipe, and each skip says which probe it needs.
  2. Ctrl-C and SIGTERM: Python's default KeyboardInterrupt traceback fails ctrl-c, and a shell wrapper that dies on SIGTERM leaves the server it started still running.
    02Ctrl-C and SIGTERMPython's default KeyboardInterrupt traceback fails ctrl-c, and a shell wrapper that dies on SIGTERM leaves the server it started still running.
  3. File names that drive a terminal: On macOS, ls escapes the hostile names in the fixture, while BSD find prints a window title and a screen clear straight to the terminal.
    03File names that drive a terminalOn macOS, ls escapes the hostile names in the fixture, while BSD find prints a window title and a screen clear straight to the terminal.
  4. The JSON report: The summary and every failure pulled out with jq: check, invocation and evidence, with escape codes from the program kept escaped.
    04The JSON reportThe summary and every failure pulled out with jq: check, invocation and evidence, with escape codes from the program kept escaped.
  5. The Markdown report: --format markdown, rendered: one table row per probe, written for a CI job summary or a pull request comment.
    05The Markdown report--format markdown, rendered: one table row per probe, written for a CI job summary or a pull request comment.
  6. A JUnit report for CI: A failed check exits 1 while the human report still prints, and the XML file gives CI one suite per check and one case per probe.
    06A JUnit report for CIA failed check exits 1 while the human report still prints, and the XML file gives CI one suite per check and one case per probe.

measured

//04measured

9 of 119
popular commands crashed on a closed pipe
the 100 most-downloaded npm packages that ship a command, offline in a container, november 2026
0
false failures in that census
every fail reproduced by hand before it was counted
546
tests, 96.8% statements
vitest, ci run of 2 dec 2026; ci covers linux on node 22, 24 and 26, macos and alpine
3,908
npm downloads in its first 11 days
api.npmjs.org, 11 to 21 nov 2026

decisions

//05decisions

  1. 01

    chose black-box testing from the outside

    over a library or lint rule per language

    It catches the bug whatever the program is written in, and it tests the shipped binary rather than the source. The cost is that cliprobe has to run the program, so it strips the environment, uses a temporary home and asks you to probe only programs you trust.

  2. 02

    chose a pipe closed before the program starts

    over piping into head

    Short output fits in the pipe buffer, so | head -1 often misses the crash entirely. A reader that is already gone makes the first write fail every time, which turns a flaky bug into a deterministic test, at the price of testing the worst case rather than the common one.

  3. 03

    chose warn first, fail only after calibration

    over letting every check fail from day one

    One false failure in CI is enough for people to remove a tool. Each check proved itself on real tools before it could fail, so new detections arrive slowly, and three checks still only warn.

  4. 04

    chose evidence, never a score

    over a conformance score out of 100

    A score cannot be fixed; a quoted stack frame or escape sequence can. It means there is no single number to put on a badge, and the reports are longer.

  5. 05

    chose the system's script command for pseudo-terminals

    over a native pseudo-terminal module

    It keeps the package at zero runtime dependencies with nothing to compile on install. The cost is handling two flavors of script, BSD on macOS and util-linux on Linux, and an extra package on Alpine.

try it

//06try it

  1. //test a command without installing

    npx cliprobe -- <command>

    node 22.12 or later, macos or linux

  2. //cover every check in one run

    npx cliprobe --probe "serve --port 0" --probe "scan {fixture}" -- my-cli

    a command that keeps running, and one that prints file names

  3. //write a job summary in github actions

    npx --yes cliprobe@1 --format markdown -o "$GITHUB_STEP_SUMMARY" -- node ./dist/cli.js

    exit code 1 when a check fails

  4. //give it to a coding agent

    npx skills add KhaledSaeed18/cliprobe --skill cliprobe

highlights

//07highlights

  • Nine checks: closed pipe, failed writes on a full disk, color, escape codes in a pipe, stdin hangs, Ctrl-C, SIGTERM, terminal restore and control characters in file names
  • Works on any program as a black box, whatever language it is written in
  • Every verdict quotes its evidence; never a score
  • Human, JSON, Markdown and JUnit reports, with exit codes for CI
  • Kills what the program leaves running and removes its own temporary files
  • Zero runtime dependencies, published with npm provenance
  • Official agent skill installed with npx skills add

built with

  • TypeScript
  • Node.js
  • Vitest
  • tsdown
  • oxlint
  • semantic-release
  • GitHub Actions
  • npm

on githubcliprobe

license
MIT
language
TypeScript
latest release
v1.7.0 dec 2, 2026
last push
dec 3, 2026

printings

//08printings

  1. census

    The 100 most-downloaded npm packages that ship a command, run offline with stdout closed: eight crashed every time. The first commit is the closed-pipe check alone.

  2. v0.2.0

    On npm, with --check, --output-file and Markdown and JUnit reports; the pipe-escapes and stdin checks followed the same day.

  3. v0.5.0

    The restore check: a program run under a real terminal, sent Ctrl-C as a keystroke and judged on the terminal modes it leaves on.

  4. v1.0.0

    Each check's measurements moved under details, a JSON schema shipped in the package, and the stability promises for 1.x written down. The sigterm check arrived the same day.

  5. v1.2.0

    --probe, so --version, --help, a watch command and a file-listing command are all tested in one run.

  6. v1.3.0

    The official agent skill, with evals and tests in CI.

  7. v1.4.0

    Each run judged on the program's own exit, whatever it leaves behind listed and killed, and a clean exit when cliprobe itself is interrupted.

  8. v1.4.2

    Stricter options: a --timeout that would overflow and an option given where a value belongs are rejected, and the report file is checked before any probe runs.

  9. v1.5.0

    pipe-escapes warns on the other escape sequences in a pipe. The 1.4.3 and 1.4.4 patches before it made reports clearer: a skipped probe that exited with a failure code says so, and evidence stays unambiguous in narrow rows.

  10. v1.6.0

    restore reads the terminal settings a program leaves behind and warns when it leaves the terminal in raw mode.

  11. v1.7.0

    The ninth check, write-error: it warns when a program exits 0 or crashes as writes to stdout fail, on Linux, where /dev/full exists. cliprobe itself now reports a failed write to stdout and exits 2.

questions

//09questions

Does it only work for Node.js programs?
No. It tests any command from the outside, so a Go, Rust, Python or shell CLI works as well. Only the fixes in the README are specific to Node.js.
Why were ctrl-c, sigterm and control-chars skipped?
They need probes that --version and --help do not give: a command that keeps running, such as a server or a watcher, and one that prints file names from {fixture}. Add them with --probe and one run covers every check.
Is it safe to probe any program?
It runs the program with your privileges, in a minimal environment with a temporary home and no tokens from your shell. Probe programs you trust, and anything else in a disposable container with networking off.
Will an update break my CI?
Not within 1.x unless you use --strict. A minor release never makes a passing or warning program fail; new detections only warn until the next major version. Match on check and verdict in the JSON, not on the wording.
Does a pass mean my CLI has no terminal bugs?
No. Each check tests one behaviour on the probes that ran, and a subcommand that was not probed was not checked. Add a --probe for each command your users pipe or interrupt.
Does it run on Windows?
Not yet. It runs on macOS and Linux, including Alpine, where the terminal checks need the script command from util-linux-misc.

related sheets

//10related sheets

//11contact

Say hello.I read everything.

Email is the fastest way to reach me. For anything that needs a conversation, book a call.

to

name
Khaled Saeed
country
Lebanon