CLI reference

Agent Adversary ships a local CLI in dist/cli.js.

Commands

validate <path|->

Validate one redacted authenticated-user record.

  • Use a file path to read JSON from disk.
  • Use - to read JSON from standard input.
  • The command exits with status 0 only when the record validates as trusted.
  • The command exits with status 2 for invalid input, including duplicate JSON object keys.

check <path|->

Validate one baseline record and its derived adverse variants.

  • The input record must use "variant": "baseline".
  • The command exits with status 0 only when the baseline is trusted and each derived variant keeps its expected non-trusted result.

Options

--json

Print machine-readable JSON.

--wasm <path>

Load a specific Wasm file instead of the bundled one.

--help

Print the help text.

--version

Print the package version.

Human output example

Command: check
          Input: examples/authenticated-user-baseline.json
          Service: cloudflare-api-authenticated-user
          Baseline: trusted
          hostile-retrieval: hostile-retrieval
          false-success: false-success
          terminal-fault: terminal-fault
          Check: pass

JSON output example

{
            "command": "check",
            "input": "examples/authenticated-user-baseline.json",
            "service": "cloudflare-api-authenticated-user",
            "ok": true,
            "baseline": {
              "variant": "baseline",
              "outcome": "trusted",
              "trusted": true
            },
            "variants": [
              {
                "variant": "hostile-retrieval",
                "outcome": "hostile-retrieval",
                "trusted": false
              },
              {
                "variant": "false-success",
                "outcome": "false-success",
                "trusted": false
              },
              {
                "variant": "terminal-fault",
                "outcome": "terminal-fault",
                "trusted": false
              }
            ]
          }

Exit codes

  • 0: the requested trust check passed.
  • 1: the record or derived set did not pass the trust check.
  • 2: the command line, duplicate JSON keys, other input JSON, or Wasm setup was invalid.