rust-anything 5.0.1

Rewrite your app in Rust, one piece at a time, checked against the original's recorded behavior at every step. TypeScript/JavaScript, Python, C, Go, Ruby, Java, Kotlin, PHP, C# and PowerShell
Documentation
{
  "version": "5.0.1",
  "commands": [
    {
      "command": "",
      "help": "Rewrite TypeScript/JavaScript, Python, C, Go, Ruby, Java, Kotlin, PHP, C# or PowerShell apps in Rust, one verified piece at a time\n\nUsage: rust-anything <COMMAND>\n\nCommands:\n  analyze  1. Map a repository and write a ranked, ordered migration plan\n  bridge   2. Scaffold a Rust crate with bindings for one unit\n  refresh  2b. Regenerate the bindings and the language wrapper from the signatures in `port.rs`\n  record   3a. Record what the original's functions return on generated and given inputs\n  build    3b. Build the crate's native module for its language (napi-rs `.node` or wasm-bindgen output for TS/JS, a PyO3 extension for Python, a shared library for the others) or, with `--profile android`, the JNI library for Android ABIs into `jniLibs/`\n  diff     3c. Replay recorded cases against the Rust module\n  bench    3d. Time the recorded cases on the original and on Rust, bridge included\n  fuzz     3e. Run fresh inputs from a new seed through the original and the port and report where they differ: what the recorded cases did not cover\n  profile  Run a real workload under the language's profiler and say what to port: hot functions, their callers, and loops to batch. `rust-anything profile <repo> -- node bench.mjs` (also `python3 x.py`, `go test -bench . ./pkg`, `java ...`, `ruby x.rb`)\n  go       The hot-path loop in one command: profile the workload, bridge the top portable function, record it, hand the port to an agent, then build, diff and gate it, and switch it on only when everything matches. `rust-anything go --agent claude -- python3 app.py`\n  enable   Switch a ported unit on: one marked block in the original source files rebinds its functions to the Rust module, for every caller (TS/JS, Python and PowerShell). `disable` removes it\n  disable  Switch a unit off: removes exactly the lines `enable` added\n  report   Write a unit's result for a pull request or README: REPORT.md and card.svg with the recorded cases matched, the speedup from bench, the fallback rate and the machine\n  clean    Remove the build cache every port and bridge shares (CARGO_TARGET_DIR when set, else rust-anything/target in your cache folder). Ports rebuild on their next build\n  shadow   4. Generate a drop-in module that runs the original and Rust side by side\n  gate     5. Check the definition of done for a port\n  package  6. Lay out installable packages and a CI workflow for every platform; never publishes\n  app      Record the whole app's behavior and replay any build against it (CLIs and servers)\n  mcp      Serve every step as MCP tools over stdio\n  setup    Register rust-anything with your coding agents (Claude Code, Codex, Cursor, Gemini CLI, OpenCode): the MCP server and, where the agent reads skills, the workflow skill. Keeps your other settings; run it again any time\n  map      Map the port: every unit of the original, the crate that ports it, its cases and last diff, the whole app's glue, and which recordings the original changed past since they were made. Commit the map (`--write`) to see upstream changes in it\n  doctor   Check the language runtimes, the agent setup and the MCP server, with the command that fixes each problem. Exits 1 when something required is missing\n  rules    Show the port rules every agent prompt includes (rust/RULES.md), or add one: behavior the port must keep exactly, learned from a correction\n  help     Print this message or the help of the given subcommand(s)\n\nOptions:\n  -h, --help     Print help\n  -V, --version  Print version\n\nLoop per unit: analyze -> bridge -> record -> port src/port.rs -> build -> diff -> shadow -> gate\nOnly the slow part: go --agent claude -- <workload>, then enable/disable and report\n"
    },
    {
      "command": "analyze",
      "help": "1. Map a repository and write a ranked, ordered migration plan\n\nUsage: rust-anything analyze [OPTIONS] [ROOT]\n\nArguments:\n  [ROOT]  Repository root [default: .]\n\nOptions:\n      --json         Print the machine-readable report (schema `rust-anything/analyze@1`) instead of Markdown\n  -o, --out <OUT>    Write to this file instead of stdout\n      --lang <LANG>  Source language; detected from the repository when omitted [possible values: ts, python, c, go, ruby, java, kotlin, php, csharp, powershell]\n      --whole-app    Plan a whole-app port: entry points and shape, every dependency (imported or declared) with its crate, pieces in port order, and decisions for the user\n  -h, --help         Print help\n"
    },
    {
      "command": "bridge",
      "help": "2. Scaffold a Rust crate with bindings for one unit\n\nUsage: rust-anything bridge [OPTIONS] <ROOT> <UNIT>\n\nArguments:\n  <ROOT>\n          Repository root\n\n  <UNIT>\n          Unit id, as `analyze` lists it\n\nOptions:\n      --kind <KIND>\n          TS/JS units: napi or wasm; defaults to the plan's choice. Other languages have their own bridge\n          \n          [possible values: napi, wasm]\n\n  -o, --out <OUT>\n          Crate folder; defaults to `<root>/rust/<name>`\n\n      --name <NAME>\n          Crate name; defaults to `<unit>-rs`\n\n      --force\n          Bridge a unit the plan marks blocked or keep\n\n      --keep <KEEP>\n          Keep an export in the original language: `name` or `\"name: reason\"`. Repeatable\n\n      --batch <BATCH>\n          Add a batch class: `function:param` runs `function` over many `param` values kept in Rust, on all cores (what `profile` recommends for leaves called in loops)\n\n      --as-json <TYPE_PARAM>\n          Bridge a type parameter as JSON values (`--as-json T`) when the app only fills it with data, instead of keeping the generic export in TS. Repeatable\n\n      --allocator <ALLOCATOR>\n          Global allocator for crates with batches: `mimalloc` (C; wasm keeps Rust's default) or `rusty_alloc` (pure Rust, no C compiler; wasm too). Kept in `rust-anything.json`\n\n          Possible values:\n          - mimalloc:    mimalloc, built from C with `cc`. Wasm crates keep Rust's default allocator\n          - rusty_alloc: rusty_alloc, a pure-Rust remake of mimalloc: no C compiler, and wasm crates get it too\n          \n          [default: mimalloc]\n\n  -h, --help\n          Print help (see a summary with '-h')\n"
    },
    {
      "command": "refresh",
      "help": "2b. Regenerate the bindings and the language wrapper from the signatures in `port.rs`\n\nUsage: rust-anything refresh [OPTIONS] [CRATE_DIR]\n\nArguments:\n  [CRATE_DIR]  Crate folder made by `bridge` [default: .]\n\nOptions:\n      --batch <BATCH>  Add a batch class: `function:param` runs `function` over many `param` values kept in Rust, on all cores. Repeat for more\n  -h, --help           Print help\n"
    },
    {
      "command": "record",
      "help": "3a. Record what the original's functions return on generated and given inputs\n\nUsage: rust-anything record [OPTIONS] [CRATE_DIR] [-- <TEST_COMMAND>...]\n\nArguments:\n  [CRATE_DIR]\n          Crate folder made by `bridge`\n          \n          [default: .]\n\n  [TEST_COMMAND]...\n          The test command for `--from-tests`, after `--`; it runs in the original's folder\n\nOptions:\n      --count <COUNT>\n          Generated cases per function\n          \n          [default: 200]\n\n      --inputs <INPUTS>\n          Extra cases: JSONL of `{\"fn\": name, \"args\": [...]}`, plus `\"kwargs\": {...}` for Python and Ruby arguments passed by keyword\n\n      --module <MODULE>\n          Import the original from this JS module (e.g. built output) instead of the TS source\n\n      --resolve-from <RESOLVE_FROM>\n          Resolve npm packages from this folder's `node_modules` (when the repo has none installed)\n\n      --node-arg <NODE_ARGS>\n          Extra arguments for node, e.g. `--node-arg=--import=tsx`\n\n      --float-tolerance <FLOAT_TOLERANCE>\n          Floats match when they differ by at most this times the larger magnitude (absolute below 1), e.g. 1e-9 for numeric code. Saved with the crate for diff and gate; 0 removes it\n\n      --ignore-key-order\n          Compare objects regardless of key order, now and in every later `diff`, `gate`, `enable` and `report`. `--no-ignore-key-order` saves the opposite\n\n      --no-ignore-key-order\n          Save \"keep the original's key order\", undoing an earlier `--ignore-key-order`\n\n      --from-tests\n          Also record every call the original's own test suite makes to the unit's functions: `--from-tests -- npx jest` (TS/JS, any runner) or `-- pytest` (Python)\n\n      --profile <PROFILE>\n          Target: this machine, or a connected Android device (for JVM crates)\n\n          Possible values:\n          - host:    Run on this machine\n          - android: Run on Android: the JNI library for the ABIs in `jniLibs/`, and on a connected device when replaying\n          \n          [default: host]\n\n      --device <DEVICE>\n          Android device serial; picked automatically when only one is connected\n\n      --pin-clock\n          Pin the clock and random numbers while recording and diffing (TS/JS with napi, Python): `Date.now()`, `new Date()` and `Math.random` (`time.time`, `datetime.now` and `random`) get fixed values, saved in `pinned.json`, and the port reads them from `src/port/pinned.rs`. Kept for later runs until `--no-pin-clock`\n\n      --no-pin-clock\n          Stop pinning the clock and random numbers\n\n  -h, --help\n          Print help (see a summary with '-h')\n"
    },
    {
      "command": "build",
      "help": "3b. Build the crate's native module for its language (napi-rs `.node` or wasm-bindgen output for TS/JS, a PyO3 extension for Python, a shared library for the others) or, with `--profile android`, the JNI library for Android ABIs into `jniLibs/`\n\nUsage: rust-anything build [OPTIONS] [CRATE_DIR]\n\nArguments:\n  [CRATE_DIR]\n          Crate folder made by `bridge`\n          \n          [default: .]\n\nOptions:\n      --profile <PROFILE>\n          Target: this machine, or Android (needs the NDK and the Rust Android targets)\n\n          Possible values:\n          - host:    Run on this machine\n          - android: Run on Android: the JNI library for the ABIs in `jniLibs/`, and on a connected device when replaying\n          \n          [default: host]\n\n      --abi <ABI>\n          Android ABI to build; repeatable. Defaults to arm64-v8a, armeabi-v7a and x86_64\n\n      --api <API>\n          Android API level the libraries target (at least 26; defaults to 26)\n\n      --ndk <NDK>\n          Android NDK root; found from ANDROID_NDK_HOME or the SDK when omitted\n\n      --jni-libs <JNI_LIBS>\n          Where to install the Android libraries; defaults to `<crate>/jniLibs`\n\n  -h, --help\n          Print help (see a summary with '-h')\n"
    },
    {
      "command": "diff",
      "help": "3c. Replay recorded cases against the Rust module\n\nUsage: rust-anything diff [OPTIONS] [CRATE_DIR]\n\nArguments:\n  [CRATE_DIR]\n          Crate folder made by `bridge`\n          \n          [default: .]\n\nOptions:\n      --profile <PROFILE>\n          Target: this machine, or a connected Android device (for JVM crates)\n\n          Possible values:\n          - host:    Run on this machine\n          - android: Run on Android: the JNI library for the ABIs in `jniLibs/`, and on a connected device when replaying\n          \n          [default: host]\n\n      --device <DEVICE>\n          Android device serial; picked automatically when only one is connected\n\n      --jni-libs <JNI_LIBS>\n          Android libraries folder to diff; defaults to `<crate>/jniLibs`\n\n      --module <MODULE>\n          Test this JS module instead of the crate's `index.cjs`\n\n      --ignore-key-order\n          Compare objects regardless of key order\n\n      --float-tolerance <FLOAT_TOLERANCE>\n          Floats match within this tolerance for this run (the one saved by `record` otherwise)\n\n      --redact\n          Print mismatches as shapes only: where they differ, types, lengths and hashes, never values or arguments; safe to paste into an issue or hand to another agent\n\n      --json\n          Print the machine-readable report as JSON\n\n      --node-arg <NODE_ARGS>\n          Extra arguments for node, e.g. `--node-arg=--import=tsx`\n\n  -h, --help\n          Print help (see a summary with '-h')\n"
    },
    {
      "command": "bench",
      "help": "3d. Time the recorded cases on the original and on Rust, bridge included\n\nUsage: rust-anything bench [OPTIONS] [CRATE_DIR]\n\nArguments:\n  [CRATE_DIR]  Crate folder made by `bridge` [default: .]\n\nOptions:\n      --min-ms <MIN_MS>              Minimum measured time per function and side, in milliseconds [default: 200]\n      --resolve-from <RESOLVE_FROM>  Resolve npm packages the original imports from this folder's `node_modules`\n      --json                         Print the machine-readable report as JSON\n      --node-arg <NODE_ARGS>         Extra arguments for node, e.g. `--node-arg=--import=tsx`\n  -h, --help                         Print help\n"
    },
    {
      "command": "fuzz",
      "help": "3e. Run fresh inputs from a new seed through the original and the port and report where they differ: what the recorded cases did not cover\n\nUsage: rust-anything fuzz [OPTIONS] [CRATE_DIR]\n\nArguments:\n  [CRATE_DIR]\n          Crate folder made by `bridge`\n          \n          [default: .]\n\nOptions:\n      --cases <CASES>\n          Fresh cases per function (and scenarios per class) in each round\n          \n          [default: 200]\n\n      --seed <SEED>\n          Seed of the first round; random (and printed) when omitted. Later rounds count up\n\n      --time <SECS>\n          Keep running new rounds until this many seconds have passed (one round otherwise)\n\n      --keep[=<KEEP>]\n          Append the mismatching cases (`--keep`) or every fresh case (`--keep=all`) to `cases.jsonl`, so the next diff and gate check them\n\n          Possible values:\n          - mismatches: Only the cases where the port differs from the original\n          - all:        Every fresh case\n\n      --resolve-from <RESOLVE_FROM>\n          Resolve npm packages the original imports from this folder's `node_modules`\n\n      --json\n          Print the machine-readable report as JSON\n\n      --node-arg <NODE_ARGS>\n          Extra arguments for node, e.g. `--node-arg=--import=tsx`\n\n  -h, --help\n          Print help (see a summary with '-h')\n"
    },
    {
      "command": "profile",
      "help": "Run a real workload under the language's profiler and say what to port: hot functions, their callers, and loops to batch. `rust-anything profile <repo> -- node bench.mjs` (also `python3 x.py`, `go test -bench . ./pkg`, `java ...`, `ruby x.rb`)\n\nUsage: rust-anything profile [OPTIONS] <ROOT> -- <COMMAND>...\n\nArguments:\n  <ROOT>        Repository root\n  <COMMAND>...  The workload, after `--`\n\nOptions:\n      --json         Print the machine-readable report as JSON\n      --lang <LANG>  Source language; detected from the repository when omitted [possible values: ts, python, c, go, ruby, java, kotlin, php, csharp, powershell]\n  -h, --help         Print help\n"
    },
    {
      "command": "go",
      "help": "The hot-path loop in one command: profile the workload, bridge the top portable function, record it, hand the port to an agent, then build, diff and gate it, and switch it on only when everything matches. `rust-anything go --agent claude -- python3 app.py`\n\nUsage: rust-anything go [OPTIONS] [ROOT] -- <COMMAND>...\n\nArguments:\n  [ROOT]        Repository root, as `profile` takes it\n  <COMMAND>...  The workload, after `--`\n\nOptions:\n      --root <ROOT>          Repository root\n      --agent <AGENT>        `claude`, `codex`, or any command that reads a prompt on stdin. Without it, `go` writes the crate's TASK.md and stops; run it again once `src/port.rs` is ported\n      --function <FUNCTION>  Port this function instead of the profile's pick\n      --lang <LANG>          Source language; detected from the repository when omitted [possible values: ts, python, c, go, ruby, java, kotlin, php, csharp, powershell]\n      --count <COUNT>        Generated cases per function, on top of the calls the workload makes [default: 200]\n      --rounds <ROUNDS>      Agent turns: the port, then one more per failing diff or gate (default: 3)\n      --json                 Print the machine-readable report as JSON\n  -h, --help                 Print help\n"
    },
    {
      "command": "enable",
      "help": "Switch a ported unit on: one marked block in the original source files rebinds its functions to the Rust module, for every caller (TS/JS, Python and PowerShell). `disable` removes it\n\nUsage: rust-anything enable [OPTIONS] [CRATE_DIR]\n\nArguments:\n  [CRATE_DIR]  Crate folder made by `bridge` [default: .]\n\nOptions:\n      --only <ONLY>  Switch on only these exported functions (repeatable)\n      --partial      Switch on only the functions whose recorded cases all match; leave the rest in the original\n      --force        Switch it on even when recorded cases differ\n      --json         Print the machine-readable report as JSON\n  -h, --help         Print help\n"
    },
    {
      "command": "disable",
      "help": "Switch a unit off: removes exactly the lines `enable` added\n\nUsage: rust-anything disable [OPTIONS] [CRATE_DIR]\n\nArguments:\n  [CRATE_DIR]  Crate folder made by `bridge` [default: .]\n\nOptions:\n      --json  Print the machine-readable report as JSON\n  -h, --help  Print help\n"
    },
    {
      "command": "report",
      "help": "Write a unit's result for a pull request or README: REPORT.md and card.svg with the recorded cases matched, the speedup from bench, the fallback rate and the machine\n\nUsage: rust-anything report [OPTIONS] [CRATE_DIR]\n\nArguments:\n  [CRATE_DIR]  Crate folder made by `bridge` [default: .]\n\nOptions:\n  -o, --out <OUT>                    Output folder; defaults to `<crate>/report`\n      --min-ms <MIN_MS>              Minimum measured time per function and side, in milliseconds [default: 200]\n      --json                         Print the machine-readable report as JSON\n      --node-arg <NODE_ARGS>         Extra arguments for node, e.g. `--node-arg=--import=tsx`\n      --resolve-from <RESOLVE_FROM>  Resolve npm packages the original imports from this folder's `node_modules`\n  -h, --help                         Print help\n"
    },
    {
      "command": "clean",
      "help": "Remove the build cache every port and bridge shares (CARGO_TARGET_DIR when set, else rust-anything/target in your cache folder). Ports rebuild on their next build\n\nUsage: rust-anything clean [OPTIONS]\n\nOptions:\n      --dry-run  Only print the folder and its size\n      --force    Remove it even when CARGO_TARGET_DIR names it (other cargo projects may build there)\n      --json     Print the machine-readable report as JSON\n  -h, --help     Print help\n"
    },
    {
      "command": "shadow",
      "help": "4. Generate a drop-in module that runs the original and Rust side by side\n\nUsage: rust-anything shadow [OPTIONS] [CRATE_DIR]\n\nArguments:\n  [CRATE_DIR]  Crate folder made by `bridge` [default: .]\n\nOptions:\n  -o, --out <OUT>  Where to write the module. The default depends on the language: `<crate>/shadow/<name>.shadow.ts` (TypeScript), `<crate>/shadow/<name>_shadow.py` (Python), `<crate>/shadow/<name>_shadow.c` (C), `<crate>/go/shadow/<pkg>.go` (Go), `<crate>/ruby/<lib>_shadow.rb` (Ruby), and a folder, `<crate>/java/`, for Java and Kotlin. PHP, C# and PowerShell have no shadow module yet and stop with an error\n  -h, --help       Print help\n"
    },
    {
      "command": "gate",
      "help": "5. Check the definition of done for a port\n\nUsage: rust-anything gate [OPTIONS] [CRATE_DIR]\n\nArguments:\n  [CRATE_DIR]  Crate folder made by `bridge` [default: .]\n\nOptions:\n      --json                  Print the machine-readable report as JSON\n      --node-arg <NODE_ARGS>  Extra arguments for node, e.g. `--node-arg=--import=tsx`\n  -h, --help                  Print help\n"
    },
    {
      "command": "package",
      "help": "6. Lay out installable packages and a CI workflow for every platform; never publishes\n\nUsage: rust-anything package [OPTIONS] [CRATE_DIR]\n\nArguments:\n  [CRATE_DIR]  Crate folder made by `bridge` [default: .]\n\nOptions:\n      --name <NAME>          Package name on npm or PyPI; defaults to the crate name\n      --version <VERSION>    Package version; defaults to the original package's\n      --out <OUT>            Output folder; defaults to `<crate>/package`\n      --fallback <FALLBACK>  napi: the module to load where no binary fits (defaults to the original file when it imports nothing)\n      --bin <BIN>            CLI front door: a command the package installs (repeat for more); defaults to the package name without its scope\n      --original <ORIGINAL>  CLI front door: the original npm package it falls back to, as <name>@<version>; defaults to the one in the repository's node_modules\n      --dry-run              List the files, write nothing\n      --json                 Print the machine-readable report as JSON\n  -h, --help                 Print help\n"
    },
    {
      "command": "app",
      "help": "Record the whole app's behavior and replay any build against it (CLIs and servers)\n\nUsage: rust-anything app <COMMAND>\n\nCommands:\n  record      Run the original CLI on cases (its own examples, `--inputs`, semantic traps), twice each, and store them as trycmd files in `<repo>/rust/app-cases/`. `rust-anything app record . -- python3 cli.py`\n  replay      Run a build against `<repo>/rust/app-cases/`, print passed/total, write a report with a diff per failing case; exits non-zero on any mismatch\n  shadow      Servers: put a proxy in front of the original and a build. Each request is answered by the original; the build gets the same request and its answer is compared. The build's outbound HTTP and mail go to local sinks and its files to a fresh copy, so no side effect happens twice. Mismatches are logged to rust/app-cases/shadow/mismatches.jsonl as shapes only (no values)\n  front-door  Scaffold `<repo>/rust/app`, the Rust binary that owns the CLI's entry point: a clap parser for the recorded commands and flags, every command running the original until a unit is wired. Builds it and replays the cases (100% passed, 100% fallback)\n  wire        Hand commands to a unit's `port.rs` (after it passes gate): adds the crate to `rust/app`, a glue file to write once, the routing and a kill switch (`RUST_ANYTHING_UNIT_<NAME>=original`), then builds and replays\n  lift        Make `rust/app` a pure Rust app, once replay passes with fallback rate 0 and every unit passes gate: removes the fallback and the kill switches, turns the units into plain libraries, runs the lift checklist and replays the pure binary. Checked on a copy first; the original stays in place\n  drift       Check that the recording still describes the original and the port still matches: replays the original against rust/app-cases (cases it no longer matches changed upstream), lists examples in its docs that no case records, and replays the build. Writes rust/app-cases/drift-report.md; exits 1 on any change. For CI after a lift\n  help        Print this message or the help of the given subcommand(s)\n\nOptions:\n  -h, --help  Print help\n"
    },
    {
      "command": "app record",
      "help": "Run the original CLI on cases (its own examples, `--inputs`, semantic traps), twice each, and store them as trycmd files in `<repo>/rust/app-cases/`. `rust-anything app record . -- python3 cli.py`\n\nUsage: rust-anything app record [OPTIONS] [REPO] [-- <RUN>...]\n\nArguments:\n  [REPO]    Repository root [default: .]\n  [RUN]...  The command that runs the original, after `--`; paths are relative to the repository. Taken from the saved cases when omitted\n\nOptions:\n      --inputs <INPUTS>\n          Extra cases: JSONL of `{\"name\", \"args\": [...], \"stdin\", \"env\": {...}, \"files\": {path: text}}`\n      --normalize <NORMALIZE>\n          Normalizer: `timestamps`, `uuids`, `key-order`, or `name=regex` for your own. Repeatable; saved with the cases\n      --name <NAME>\n          The name the app is invoked by in its docs (found from the command and manifests when omitted)\n      --no-traps\n          Leave out the semantic-trap inputs\n      --timeout <TIMEOUT>\n          Seconds before a run is killed (default 30)\n      --http\n          The app is a server: the command starts it, taking its port from PORT or `{port}`; cases are requests (curl lines in its docs, `--inputs`, traps), kept in `http/`\n      --no-http\n          Drop a saved server recording and record as a CLI again\n      --port <PORT>\n          A port the server always listens on (implies --http); 0 removes a saved port\n      --arg <ARG>\n          An argument every server start gets after its command, the original's and every build's, so the Rust binary is started as the original is (`--arg db.json`). Repeatable; implies --http; saved with the cases\n      --no-args\n          Clear the saved `--arg` server arguments\n      --fresh <FRESH>\n          A file or folder of the repository the app reads or writes (a project tree, a database file, a public folder): snapshotted into `files/` (`http/files/` for a server) and copied into a fresh working directory before every case (CLIs) or start (servers). A CLI's written files are what differs from it afterwards, and the files it removed are compared too. Repeatable; saved with the cases\n      --no-fresh\n          Clear the saved `--fresh` paths and remove the saved snapshot\n      --pace <MS>\n          Milliseconds to wait after each response before the next request, for work a server does after answering (a file watcher reloading what it just wrote). Implies --http; saved with the cases and used by replay; 0 removes it\n      --ready-timeout <SECS>\n          Seconds to wait for the server to accept connections before giving up (default 60). Implies --http; saved with the cases and used by replay and the front door; 0 restores the default\n      --float-tolerance <FLOAT_TOLERANCE>\n          Numbers in the output match when they differ by at most this times the larger magnitude (absolute below 1), e.g. 1e-9 for numeric code. Saved with the cases; 0 removes it\n      --float-file <PATH=FORMAT>\n          A written file of raw floats, compared value by value within --float-tolerance instead of byte for byte: `PATH=f32le` or `PATH=f64le`. Repeatable; saved with the cases\n      --effects <KINDS>\n          Record what leaves the process too: `http` runs a local sink that answers every request (set as HTTP_PROXY, http_proxy and RUST_ANYTHING_HTTP_SINK), `smtp` a local mail server (SMTP_HOST, SMTP_PORT) recording decoded headers and MIME parts, and `smtp-raw` the same server recording the raw MIME DATA. Each case stores what reached them, in order, and replay compares it. Comma-separated or repeated. Saved with the cases\n      --effect-env <VAR=KIND>\n          Point one of the app's own settings at a sink: VAR=http-url, VAR=smtp-host, VAR=smtp-port or VAR=smtp-url (e.g. WEBHOOK_URL=http-url). Implies that effect\n      --effect-response <SPEC>\n          Canned response for the HTTP effect sink: `METHOD /path=STATUS [BODY|@FILE]` (e.g. `POST /v1/charges=201 @fixtures/charge.json` or `POST /hooks/*=500`). Matched in order with `*` wildcards; unmatched requests get `200 {}`. Enables the outbound HTTP effect (`--effects http`, not `--http` server mode); saved with the cases so replay sees identical replies. Repeatable\n      --db-reset <COMMAND>\n          A shell command run before each case (CLIs) or each start (servers) that resets the database to a known state. Cases then run one at a time. It runs in the folder the case runs in; a script it names by a relative path with a script extension (`reset.py`, `seed.sh`, `schema.sql`) is the repository's, other relative paths the case folder's\n      --db-dump <COMMAND>\n          A shell command that prints the database's state (e.g. `sqlite3 app.db .dump`), run after each case or request in the folder the case runs in; its output is recorded with the effects\n      --json\n          Print the machine-readable report as JSON\n  -h, --help\n          Print help\n"
    },
    {
      "command": "app replay",
      "help": "Run a build against `<repo>/rust/app-cases/`, print passed/total, write a report with a diff per failing case; exits non-zero on any mismatch\n\nUsage: rust-anything app replay [OPTIONS] [REPO]\n\nArguments:\n  [REPO]  Repository root [default: .]\n\nOptions:\n      --build <BUILD>      Command line of the build to test (the original, the front door, the final binary); the original when omitted\n      --timeout <TIMEOUT>  Seconds before a run is killed (default: the one saved by `app record`, 30 seconds unless it was changed)\n      --port <PORT>        Servers: the port the build always listens on; otherwise it gets a free one through PORT and `{port}`\n      --case <CASE>        Replay only this case, by the name the report gives it (a library: only this unit). The fast, repeatable loop for fixing one mismatch\n      --redact             Write the report and print mismatches as shapes only (no outputs, arguments or request paths)\n      --json               Print the machine-readable report as JSON\n  -h, --help               Print help\n"
    },
    {
      "command": "app shadow",
      "help": "Servers: put a proxy in front of the original and a build. Each request is answered by the original; the build gets the same request and its answer is compared. The build's outbound HTTP and mail go to local sinks and its files to a fresh copy, so no side effect happens twice. Mismatches are logged to rust/app-cases/shadow/mismatches.jsonl as shapes only (no values)\n\nUsage: rust-anything app shadow [OPTIONS] --build <BUILD> [REPO]\n\nArguments:\n  [REPO]  Repository root [default: .]\n\nOptions:\n      --build <BUILD>         Command line of the build to compare (the front door, the final binary)\n      --listen <PORT>         Port the proxy listens on (a free one, printed, when omitted)\n      --upstream <HOST:PORT>  An original that is already running; otherwise the saved command starts it\n      --requests <N>          Stop after this many requests (for tests and CI); runs until Ctrl-C otherwise\n      --timeout <TIMEOUT>     Seconds to wait for each answer (default: the one saved by `app record`, 30 seconds unless it was changed)\n      --keep                  Append each mismatching request to rust/app-cases/shadow/inputs.jsonl in `app record --inputs` format, so `app record --inputs` turns it into a case\n      --json                  Print the machine-readable report as JSON\n  -h, --help                  Print help\n"
    },
    {
      "command": "app front-door",
      "help": "Scaffold `<repo>/rust/app`, the Rust binary that owns the CLI's entry point: a clap parser for the recorded commands and flags, every command running the original until a unit is wired. Builds it and replays the cases (100% passed, 100% fallback)\n\nUsage: rust-anything app front-door [OPTIONS] [REPO]\n\nArguments:\n  [REPO]  Repository root [default: .]\n\nOptions:\n      --no-check  Only write the files; skip the build and replay\n      --library   Treat the repository as a library even if it has a `main`: the front door is a Rust crate with the public API (found by default when there is no main and no server)\n      --json      Print the machine-readable report as JSON\n  -h, --help      Print help\n"
    },
    {
      "command": "app wire",
      "help": "Hand commands to a unit's `port.rs` (after it passes gate): adds the crate to `rust/app`, a glue file to write once, the routing and a kill switch (`RUST_ANYTHING_UNIT_<NAME>=original`), then builds and replays\n\nUsage: rust-anything app wire [OPTIONS] <REPO> <UNIT>\n\nArguments:\n  <REPO>  Repository root\n  <UNIT>  Unit crate: its folder, its name under `rust/`, or the unit id it was bridged from\n\nOptions:\n      --command <COMMANDS>  A command the unit answers. Repeatable; kept from the last wire when omitted\n      --route <ROUTES>      Servers: a route the unit answers, axum syntax (`GET /users/{id}`, `/path` for any method, `*` for everything else). Repeatable; kept from the last wire when omitted\n      --skip-gate           Do not run gate on the unit first (it just passed)\n      --no-check            Only write the files; skip the build and replay\n      --json                Print the machine-readable report as JSON\n  -h, --help                Print help\n"
    },
    {
      "command": "app lift",
      "help": "Make `rust/app` a pure Rust app, once replay passes with fallback rate 0 and every unit passes gate: removes the fallback and the kill switches, turns the units into plain libraries, runs the lift checklist and replays the pure binary. Checked on a copy first; the original stays in place\n\nUsage: rust-anything app lift [OPTIONS] [REPO]\n\nArguments:\n  [REPO]  Repository root [default: .]\n\nOptions:\n      --json  Print the machine-readable report as JSON\n  -h, --help  Print help\n"
    },
    {
      "command": "app drift",
      "help": "Check that the recording still describes the original and the port still matches: replays the original against rust/app-cases (cases it no longer matches changed upstream), lists examples in its docs that no case records, and replays the build. Writes rust/app-cases/drift-report.md; exits 1 on any change. For CI after a lift\n\nUsage: rust-anything app drift [OPTIONS] [REPO]\n\nArguments:\n  [REPO]  Repository root [default: .]\n\nOptions:\n      --build <BUILD>      Build to check; defaults to rust/app, built with cargo, when it exists\n      --timeout <TIMEOUT>  Seconds before a run is killed (default: the one saved by `app record`, 30 seconds unless it was changed)\n      --json               Print the machine-readable report as JSON\n  -h, --help               Print help\n"
    },
    {
      "command": "mcp",
      "help": "Serve every step as MCP tools over stdio\n\nUsage: rust-anything mcp\n\nOptions:\n  -h, --help  Print help\n"
    },
    {
      "command": "setup",
      "help": "Register rust-anything with your coding agents (Claude Code, Codex, Cursor, Gemini CLI, OpenCode): the MCP server and, where the agent reads skills, the workflow skill. Keeps your other settings; run it again any time\n\nUsage: rust-anything setup [OPTIONS]\n\nOptions:\n      --agent <AGENTS>\n          Agents to set up (repeatable); every agent found by default\n\n          Possible values:\n          - claude:   Claude Code: `~/.claude.json`, skill in `~/.claude/skills`\n          - codex:    OpenAI Codex CLI: `~/.codex/config.toml`, skill in `~/.codex/skills`\n          - cursor:   Cursor: `~/.cursor/mcp.json`\n          - gemini:   Gemini CLI: `~/.gemini/settings.json`\n          - opencode: OpenCode: `~/.config/opencode/opencode.json`, skill in `~/.config/opencode/skills`\n\n      --remove\n          Take the rust-anything entries out again\n\n      --dry-run\n          Show what would change, write nothing\n\n      --no-backup\n          Change settings files in place without saving a `.rust-anything.bak` copy first\n\n      --json\n          Print the machine-readable report as JSON\n\n  -h, --help\n          Print help (see a summary with '-h')\n"
    },
    {
      "command": "map",
      "help": "Map the port: every unit of the original, the crate that ports it, its cases and last diff, the whole app's glue, and which recordings the original changed past since they were made. Commit the map (`--write`) to see upstream changes in it\n\nUsage: rust-anything map [OPTIONS] [REPO]\n\nArguments:\n  [REPO]  Repository root [default: .]\n\nOptions:\n      --crates <CRATES>  Also look for crates in this folder (crates kept outside the repository)\n      --write            Write the map to rust/PORT_MAP.md in the repository instead of printing it\n      --check            Exit 1 when the original changed since any port was recorded\n      --json             Print the machine-readable report as JSON\n  -h, --help             Print help\n"
    },
    {
      "command": "doctor",
      "help": "Check the language runtimes, the agent setup and the MCP server, with the command that fixes each problem. Exits 1 when something required is missing\n\nUsage: rust-anything doctor [OPTIONS]\n\nOptions:\n      --json  Print the machine-readable report as JSON\n  -h, --help  Print help\n"
    },
    {
      "command": "rules",
      "help": "Show the port rules every agent prompt includes (rust/RULES.md), or add one: behavior the port must keep exactly, learned from a correction\n\nUsage: rust-anything rules [OPTIONS] [ROOT]\n\nArguments:\n  [ROOT]  Repository root, or a crate folder made by `bridge` [default: .]\n\nOptions:\n      --add <TEXT>  Append a rule (repeatable); an exact duplicate is skipped\n      --json        Print the machine-readable report as JSON\n  -h, --help        Print help\n"
    }
  ]
}