cli-test

A command that generates tests for Rust command-line programs, including tests that run the program, compare its printed output, and check many kinds of input.

In plain words
What is it for?
Use it to generate integration tests, snapshot tests for saved output comparisons, property-based tests for input validation, or all three for a selected command-line project.
Why use it?
It reduces the work of designing test cases and setting up the code needed to check a command-line program. This helps catch broken arguments, output, exit codes, and side effects.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/geoffjay/claude-plugins/cli-test
Clone the repo
git clone --depth 1 https://github.com/geoffjay/claude-plugins
Per session 19 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,261 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00019 $0.03261
Opus 5 $0.00010 $0.01631
Sonnet 5 $0.00004 $0.00652
Haiku 4.5 $0.00002 $0.00326

Measured yesterday against content hash a4f79cbbc628, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

cli-test scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/rust-cli-developer/commands/cli-test.md · 593 lines

How it starts

The opening of the file, as written. The whole thing — 593 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CLI Test Command

Generate comprehensive test suites for Rust CLI applications, including integration tests, snapshot tests for output, and property-based tests for input validation.

Arguments

  • $1 - Test type: "integration", "snapshot", "property", or "all" (required)
  • $2 - Path to project directory (optional, defaults to current directory)
  • --command <name> - Specific command to test (optional)

Usage

# Generate all test types
/cli-test all

# Generate integration tests only
/cli-test integration

# Generate snapshot tests for specific command
/cli-test snapshot --command build

# Generate property-based tests
/cli-test property

# Test specific project
/cli-test all /path/to/my-cli

Test Types

1. Integration Tests

Tests that run the actual CLI binary with different arguments and verify output, exit codes, and side effects.

Generated Tests:

// tests/integration_tests.rs
use assert_cmd::Command;
use assert_fs::prelude::*;
use predicates::prelude::*;

fn cmd() -> Command {
    Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap()
}

#[test]
fn test_help_flag() {
    cmd().arg("--help")
        .assert()
        .success()
        .stdout(predicate::str::contains("Usage:"));
}

#[test]
fn test_version_flag() {
    cmd().arg("--version")
        .assert()
        .success()
        .stdout(predicate::str::contains(env!("CARGO_PKG_VERSION")));
}

#[test]
fn test_invalid_argument() {
    cmd().arg("--invalid")
        .assert()
        .failure()
        .stderr(predicate::str::contains("unexpected argument"));
}

#[test]
fn test_missing_required_arg() {
    cmd().arg("build")
        .assert()
        .failure()
        .stderr(predicate::str::contains("required arguments"));
}

#[test]
fn test_command_with_file_io() -> Result<(), Box<dyn std::error::Error>> {
    let temp = assert_fs::TempDir::new()?;
    let input = temp.child("input.txt");
    input.write_str("test content")?;

    let output = temp.child("output.txt");

    cmd()
        .arg("process")
        .arg(input.path())
        .arg("--output")
        .arg(output.path())
        .assert()
        .success();

    output.assert(predicate::path::exists());
    output.assert(predicate::str::contains("TEST CONTENT"));

    temp.close()?;
    Ok(())
}

#[test]
fn test_exit_code_config_error() {
    cmd()
        .arg("--config")
        .arg("/nonexistent/config.toml")
        .assert()
        .code(2)
        .failure();
}

#[test]
fn test_env_var_override() -> Result<(), Box<dyn std::error::Error>> {
    cmd()
        .env("MYAPP_PORT", "9000")
        .arg("config")
        .arg("show")
        .assert()
        .success()
        .stdout(predicate::str::contains("9000"));

    Ok(())
}

Read the full file on GitHub · 593 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 593 lines · 19 tokens per session scan A a4f79cbbc628

Subscribe to this mod's changes

cli-test is a command published in the GitHub repository geoffjay/claude-plugins (8 stars, last pushed 10mo ago), licensed MIT. It adds 19 tokens to every session and 3,261 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.