# Version output is not plain

> ax-check rule: --version did not print a version number on its own first line, so a script cannot read it reliably.

Section: ax-check rule · CLI behaviour  
Canonical: https://agentexperience.tech/checks/axc-c012/

\--version did not print a version number on its own first line, so a script cannot read it reliably.

- **How serious**: **info** Worth knowing, but may be fine for your product.
- **Kind of check**: **[Observed](https://agentexperience.tech/checks/#kinds)** Depends on the program and environment at run time.
- **ax-check command**: `ax-check probe-cli`
- **Where it applies**: Command-line programs, run as a subprocess
- **Topics**: [non-interactive](https://agentexperience.tech/evidence/#pattern-non-interactive), [drift](https://agentexperience.tech/evidence/#pattern-drift)
- **Rule text from**: ax-check 0.2.0Documented ahead of release

**Fix in one line** Make --version print just the version, for example "1.4.2", and exit 0.

`--version` either failed, printed no version number on its first line, or printed more than three lines. A script that wants to know which version it is talking to cannot read it reliably.

## What it checks

The version probe runs `<cmd> --version`. The rule fires when any one of these is true: the exit status is not 0, the first line has no version number of the form digits.digits (for example `1.4`), or the output is longer than three non-blank lines. A probe that timed out is skipped, because [Command hangs without a terminal](https://agentexperience.tech/checks/axc-c001/) reports it. Output on stderr is used when stdout is empty.

## Why it matters

Versions are how instructions and tools stay in step. An agent reads a skill or an AGENTS.md file that says “use `--status` with `invoicer` 1.4 or later”, then needs to check what is installed. The GNU Coding Standards say every program should support `--version` and `--help`. When the output is a banner, a changelog, or a prompt to update, the agent has to guess which line holds the number. This is related to drift: the `ax-check drift` command compares claims in documents against what the program really reports.

Public issues show this is not only a theoretical concern. cloudflare/cf issue #105 listed `--version` not being machine-readable among its complaints, and the `--version` part was later fixed. This is context, not a measure of how common the problem is.

## How to fix

Make `--version` print one short line with the program name and number, or just the number, and exit 0. Put the long banner, licence text and update notices elsewhere.

## Example

### Before

```console
$ invoicer --version </dev/null; echo $?
  ___ _ ___  ___ ___ ___ ___
 |_ _| | _ \/ _ \_ _/ __| __|
  | || |   / (_) | | (__| _|
 |___|_|_|_\\___/___\___|___|
Build: stable
A new release is available!
Run "invoicer upgrade" to update.
0
```

### After

```console
$ invoicer --version </dev/null; echo $?
invoicer 1.4.2
0
```

A Node fix:

```js
if (process.argv.includes('--version')) {
  process.stdout.write(`invoicer ${pkg.version}\n`);
  process.exit(0);
}
```

## How ax-check detects it

ax-check looks for the pattern digits, a dot, digits in the first line, so `1.4.2`, `invoicer 1.4.2` and `v2.0` all pass. It counts the non-blank lines and allows up to three, so a short licence line is fine. It does not check that the number is correct. It also does not check pre-release suffixes.

Known false positives: a program that identifies itself by a date or a single integer, for example `build 20260901`. Silence the rule with `--disable <rule-id>` if you use such a scheme on purpose.

To reproduce by hand: `invoicer --version </dev/null; echo $?`, then count lines with `invoicer --version </dev/null | grep -c .`.

Safety note: This rule uses the default `--version` probe. probe-cli executes your program under your own OS account. The temporary working directory and HOME it uses are not a sandbox: the program can still read and write anything your account can, and use the network. Probe a CLI you have not reviewed only inside a container or a throwaway virtual machine. Run `ax-check probe-cli --dry-run -- invoicer` first to see the probes that would run, and see the “Probe safety” section of the ax-check README for what is and is not isolated.

## Sources

- Guideline: GNU Coding Standards, Command-Line Interfaces. [https://www.gnu.org/prep/standards/html\_node/Command\_002dLine-Interfaces.html](https://www.gnu.org/prep/standards/html_node/Command_002dLine-Interfaces.html) . Says every program should support `--version` and `--help`.
- Vendor issue: cloudflare/cf issue #105, “Output for scripts and agents: empty stdout with exit 0, –version not machine-readable, agent detection changes nothing”. [https://github.com/cloudflare/cf/issues/105](https://github.com/cloudflare/cf/issues/105) . Context only; the `--version` part was later fixed.

## Related evidence

Records in the [AX evidence register](https://agentexperience.tech/evidence/) about the same pattern as this rule. They don’t test the rule itself.

- [A CLI exits 0 when a destructive command is refused](https://agentexperience.tech/evidence/ev-0036/): Cloudflare's cf CLI documents that in a non-interactive session a destructive command without --force prints 'Aborted.' and exits with status 0, and a public issue reproduces this for workflows delete. Independent measurement: no stake in the product
- [Launch post and documentation disagree on agent output format](https://agentexperience.tech/evidence/ev-0039/): Cloudflare's cf launch post says JSON output is 'condensed for agents', but the cf documentation says JSON output is indented whether or not output is a terminal, and a public issue reports byte-identical output with an agent detected. Independent measurement: no stake in the product
- [Agent skills recommended a package that does not exist](https://agentexperience.tech/evidence/ev-0040/): Merged pull requests in Vercel's agent plugin repository corrected skill instructions that recommended an npm package that is not published, and plugin guidance that advertised deployment cards the production MCP server does not expose. Vendor measurement: the vendor’s own, with its method

## Related guides

- [Agent error recovery: design the path back](https://agentexperience.tech/insights/design-for-recovery/): Agent error recovery in practice: what a failure response must say, when a retry is safe, how to handle partial completion, and when to escalate. Guide
- [Keep agent instructions true](https://agentexperience.tech/insights/keep-agent-instructions-true/): Agent instructions in AGENTS.md, llms.txt, skills and MCP servers drift from production. How to check every package, tool, flag and URL they name in CI. Guide
- [Write agent-readable documentation](https://agentexperience.tech/insights/make-documentation-legible/): Agent-readable documentation in practice: what documentation for AI agents must answer, how to shape a page around one decision, and how to keep it true. Guide

## Go here next

- [Agent error recovery: design the path back](https://agentexperience.tech/insights/design-for-recovery/): Four fields turn an error into a decision: what failed, whether state changed, whether a retry is safe, and what input would fix it. Guide
- [A CLI exits 0 when a destructive command is refused](https://agentexperience.tech/evidence/ev-0036/): Cloudflare's cf CLI documents that in a non-interactive session a destructive command without --force prints 'Aborted.' and exits with status 0, and a public issue reproduces this for workflows delete. Evidence
- [Advertised JSON output not verified](https://agentexperience.tech/checks/axc-c013/): Help advertises machine-readable output, but this run did not validate it: the json probe was not enabled, could not be built, or produced no output. Rule

## About this rule text

[NO\_COLOR not honoured](https://agentexperience.tech/checks/axc-c011/)

[Advertised JSON output not verified](https://agentexperience.tech/checks/axc-c013/)

[All ax-check rules](https://agentexperience.tech/checks/)

Rule text from ax-check 0.2.0, by Himadri Mishra. The licence will be confirmed before the source repository is published.
