rust-anything 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 the rust-anything authors
3
+ Copyright (c) 2026 Erkam Yaman (erkamyaman)
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,11 +1,30 @@
1
1
  <p align="center">
2
- <img src="docs/assets/hero.png" alt="rust-anything: Rewrite anything in Rust. Keep it working the whole way. Piece by piece, checked against the original at every step, until it is pure Rust." width="820">
2
+ <img src="docs/assets/logo.svg" width="160" height="160" alt="The rust-anything crab, its mouth a code tag">
3
3
  </p>
4
4
 
5
- **Rewrite your app in Rust, one piece at a time, proving nothing changed.** For TypeScript/JavaScript,
6
- Python, C, Go, Ruby and Java apps: rust-anything ports your app piece by piece, checks every step
7
- against the original's recorded behavior, and hands you a pure Rust app. Only need the slow part
8
- fast? Port just that, one hot path at a time:
5
+ <h1 align="center">rust-anything</h1>
6
+
7
+ <p align="center"><em>Rewrite your whole app in Rust. Keep it working the whole way.</em></p>
8
+
9
+ <p align="center"><em>CLIs, servers and libraries, piece by piece, checked against the original at every step.</em></p>
10
+
11
+ <p align="center">
12
+ <a href="https://crates.io/crates/rust-anything"><img src="https://img.shields.io/crates/v/rust-anything?color=E2862A&label=crates.io" alt="crates.io version"></a>
13
+ <img src="https://img.shields.io/badge/languages-6-E2862A" alt="6 languages">
14
+ <a href="#works-with"><img src="https://img.shields.io/badge/works%20with-4%20agents-E2862A" alt="Works with 4 agents"></a>
15
+ <a href="https://github.com/erkamyaman/rust-anything/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/erkamyaman/rust-anything/ci.yml?branch=main&label=tests" alt="Tests"></a>
16
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-E2862A" alt="MIT license"></a>
17
+ <a href="https://github.com/erkamyaman/rust-anything"><img src="https://img.shields.io/github/stars/erkamyaman/rust-anything?style=social" alt="GitHub stars"></a>
18
+ </p>
19
+
20
+ <p align="center">up to 20x faster · 38,251 recorded cases replayed · 0 mismatches · one command</p>
21
+
22
+ **Rewrite your whole app in Rust, one piece at a time.** rust-anything records what your
23
+ TypeScript/JavaScript, Python, C, Go, Ruby or Java app does today, then checks every piece of the
24
+ Rust rewrite against that recording before it moves on, until the app is pure Rust. CLIs, HTTP
25
+ servers and libraries; your coding agent (or you) writes the Rust. It can only catch what the
26
+ recording covers: see [What it can't catch](#what-it-cant-catch). Only need the slow part fast?
27
+ Port just that, one hot path at a time:
9
28
 
10
29
  | Real workload, same results as the original | Original | With rust-anything |
11
30
  | --- | ---: | ---: |
@@ -32,19 +51,20 @@ rust-anything finds the loop worth moving, and moves it.
32
51
  Paste this into Claude Code, Codex, Cursor or Gemini CLI and let your agent install it:
33
52
 
34
53
  ```text
35
- Install rust-anything: run `cargo install --git https://github.com/erkamyaman/rust-anything`,
36
- then `rust-anything setup`. Tell me when to restart you.
54
+ Install rust-anything: run `cargo install rust-anything`, then `rust-anything setup`.
55
+ Tell me when to restart you.
37
56
  ```
38
57
 
39
58
  Or yourself:
40
59
 
41
60
  ```sh
42
- npm install -g rust-anything # prebuilt binary for macOS, Linux and Windows
43
- # or: cargo install --git https://github.com/erkamyaman/rust-anything
61
+ cargo install rust-anything # from crates.io
44
62
  rust-anything setup # registers it with Claude Code, Codex, Cursor and Gemini CLI
45
63
  ```
46
64
 
47
- Prebuilt binaries are also attached to each [GitHub release](https://github.com/erkamyaman/rust-anything/releases).
65
+ No Rust toolchain yet? Prebuilt binaries for macOS, Linux and Windows are attached to each
66
+ [GitHub release](https://github.com/erkamyaman/rust-anything/releases), and for JavaScript
67
+ projects `npm install -g rust-anything` installs the same binary.
48
68
 
49
69
  In Claude Code you can also install it as a plugin (the MCP server and the skill; the CLI above
50
70
  must be on your `PATH`):
@@ -143,10 +163,10 @@ analyze --whole-app ──> app record ──> app front-door ──> per unit:
143
163
 
144
164
  | Step | Command | What it does |
145
165
  | --- | --- | --- |
146
- | 0. Profile | `rust-anything profile <repo> -- node bench.mjs` | Runs a real workload under the language's profiler (node, cProfile, `go test` pprof, JFR, a Ruby tracer): hot functions by inclusive time, their callers, and which loops to batch |
166
+ | 0. Profile | `rust-anything profile <repo> -- node bench.mjs` | Runs a real workload under the language's profiler (node, cProfile, `go test` pprof, JFR, a Ruby tracer): hot functions by inclusive time, their callers, and which loops to batch; flags code that is already compiled (numba, Cython, JAX), where Rust gains little |
147
167
  | 1. Plan | `rust-anything analyze <repo>` | Units, port order, risks with `file:line`, bridge per unit, dependency-to-crate fit, best first ports; `--whole-app` adds entry points and shape, every dependency (imported or declared) with its crate, pieces (units that import each other move together) and numbered decisions with a recommended answer |
148
168
  | 2. Bridge | `rust-anything bridge <repo> <unit>` | Crate with the bindings (`lib.rs`, plus the wrapper the source language loads) and stubs to port (`port.rs`); `--batch fn:param` adds a class that keeps many `param` values in Rust |
149
- | 3. Record | `rust-anything record <crate>` | Runs the original on generated edge cases (non-ASCII, emoji, `-0`, `NaN`, ints where floats are expected, ...) and on every semantic trap in every parameter (string length and case, signed division, overflow edges, float printing, map and sort order), and saves `cases.jsonl` |
169
+ | 3. Record | `rust-anything record <crate>` | Runs the original on generated edge cases (non-ASCII, emoji, `-0`, `NaN`, ints where floats are expected, ...) and on every semantic trap in every parameter (string length and case, signed division, overflow edges, float printing, map and sort order), and saves `cases.jsonl`; `--float-tolerance 1e-9` lets floats match within that share for numeric code |
150
170
  | 3. Build | `rust-anything build <crate>` | Builds the Rust side: `.node`, wasm package, Python extension or shared library |
151
171
  | 3. Diff | `rust-anything diff <crate>` | Replays the recorded cases against Rust, called the way the original's callers call it; lists mismatches |
152
172
  | 3. Bench | `rust-anything bench <crate>` | Times the recorded cases on the original and on Rust, bridge included |
@@ -159,7 +179,21 @@ analyze --whole-app ──> app record ──> app front-door ──> per unit:
159
179
  The goal is a pure Rust app that behaves like the original, with the original kept as reference.
160
180
  Your agent writes the Rust; rust-anything orders the work, scaffolds it, and proves every step.
161
181
  The [whole-app skill](./skills/rust-anything/whole-app.md) walks the agent through it, starting
162
- with the decisions only you can make.
182
+ with the decisions only you can make:
183
+
184
+ - **Grilling**: the agent asks in rounds, each question with its recommended answer, until every
185
+ decision the port depends on is settled, and writes each one as an ADR in `rust/DECISIONS.md`,
186
+ with `rust/GLOSSARY.md` mapping the original's terms to Rust names.
187
+ - **Research**: background agents read each dependency's primary sources and write
188
+ `rust/research/<topic>.md`, with every semantic trap they found.
189
+ - **Across sessions**: `rust/MAP.md` lists every unit with its state; a session claims one unit
190
+ before it starts, and each checkpoint leaves a `rust/HANDOFF.md` for the next session. Units in
191
+ one wave can be ported in parallel by subagents.
192
+ - **Cutover**: the agent does what it can and writes `rust/cutover.sh`, an interactive script for
193
+ the steps only you can do (deploys, DNS, secrets), with a way back at each step.
194
+
195
+ Grilling, research and these practices are adapted from
196
+ [Matt Pocock's skills](https://github.com/mattpocock/skills).
163
197
 
164
198
  Plan first: `rust-anything analyze . --whole-app` adds the app's shape (CLI, server or library)
165
199
  and entry points, every external dependency (imported or declared) with its Rust crate and fit,
@@ -190,6 +224,8 @@ rust-anything app replay . --build "target/release/mytool"
190
224
  `rust/app-cases/replay-report.md` with a diff per failing case, and exits non-zero on any
191
225
  mismatch. A build that appends to the file named by `RUST_ANYTHING_FALLBACK_LOG` (one line per
192
226
  fallback to the original), as the front door below does, also gets its fallback rate reported.
227
+ - `app replay --case <name>` reruns one case by the name the report gives it: the fast,
228
+ repeatable loop for fixing a mismatch before running everything again.
193
229
 
194
230
  Then move the entry point to Rust and hand it commands one unit at a time:
195
231
 
@@ -459,16 +495,43 @@ Design choices and their reasons: [DECISIONS.md](./DECISIONS.md).
459
495
  ## Update or remove
460
496
 
461
497
  ```sh
462
- npm install -g rust-anything@latest # update (npm)
463
- cargo install --git https://github.com/erkamyaman/rust-anything --force # update (Cargo)
464
- rust-anything setup # refresh agent settings
465
- rust-anything setup --remove && npm uninstall -g rust-anything # remove (npm)
466
- rust-anything setup --remove && cargo uninstall rust-anything # remove (Cargo)
498
+ cargo install rust-anything # update (Cargo)
499
+ npm install -g rust-anything@latest # update (npm)
500
+ rust-anything setup # refresh agent settings
501
+ rust-anything setup --remove && cargo uninstall rust-anything # remove (Cargo)
502
+ rust-anything setup --remove && npm uninstall -g rust-anything # remove (npm)
467
503
  ```
468
504
 
469
505
  `setup --remove` takes out only rust-anything's entries; the copies it saved
470
506
  (`<file>.rust-anything.bak`) stay until you delete them.
471
507
 
508
+ ## What it can't catch
509
+
510
+ Passing means the Rust matches every case that was recorded, nothing more. What bites rewrites
511
+ usually lives outside the recording, so know where the edges are:
512
+
513
+ - **Inputs nobody recorded.** The generated cases, the traps and your own `--inputs` are the
514
+ ceiling. Add real inputs (production samples, bug reports, the original's test fixtures); the
515
+ user input that breaks prod is rarely one a generator thinks of.
516
+ - **Regexes.** The `regex` crate has no lookaround or backreferences, and even a pattern that
517
+ compiles can treat `\w`, `\b`, `\d` and case-insensitive matching on non-ASCII text differently
518
+ from JS, Python or Java. Swapping in `fancy-regex` or rewriting the pattern can pass every
519
+ recorded case and still differ on a Turkish dotless `ı` or a zero-width joiner. `record` adds
520
+ regex traps (those, the Kelvin sign, long s, Arabic-Indic digits, line separators, final sigma)
521
+ to every function in a file that uses regexes, but fuzz your real patterns against real text too.
522
+ - **What changes between runs.** `record` runs the original twice and sorts out what differed:
523
+ changed values (times, ids) become wildcards; the same lines in another order (hash maps,
524
+ concurrency) are compared in any order, so a port still has to produce exactly those lines; a
525
+ different number of lines becomes `...`, which matches anything. `record` lists each kind:
526
+ look at every one, since a hash-order or concurrency difference is exactly what can change for
527
+ real in a port.
528
+ - **Floats.** Number-to-text formatting differs between languages (`1e21`, `-0`, digit counts).
529
+ The traps include those values, and they must match exactly; `--float-tolerance` forgives
530
+ rounding only, never formatting.
531
+ - **Anything not in the output.** Timing, memory, concurrency under load, and side effects other
532
+ than stdout, stderr, exit codes, written files and HTTP responses (network calls, databases,
533
+ signals) are not compared.
534
+
472
535
  ## FAQ
473
536
 
474
537
  **Does it rewrite my code automatically?** No. It finds what to move, generates the bridge,
@@ -481,7 +544,13 @@ runs both and returns the original's result while you build confidence).
481
544
  **Is Rust always faster?** No, and rust-anything says so. A small function called once per item
482
545
  is often slower in Rust, because each call crosses a bridge; V8, the JVM and Go run such functions
483
546
  in nanoseconds. `profile` finds the loop around it, `--batch` moves the whole loop, and `bench`
484
- gives a verdict before you ship.
547
+ gives a verdict before you ship. Code already compiled by numba, Cython or JAX runs as machine
548
+ code too: `profile` and `analyze` flag it, since porting it buys little speed.
549
+
550
+ **My code is numeric; will the floats match exactly?** Often not: operation order, fused
551
+ multiply-add and the math library differ between compilers. Record with `--float-tolerance 1e-9`
552
+ (`record` or `app record`), and floats match within that share of the larger value (absolute below
553
+ 1). Integers, text and structure still have to match exactly.
485
554
 
486
555
  **Does my code leave my machine?** No: rust-anything runs locally and sends none of your code
487
556
  anywhere. Cargo downloads crates as usual, and your agent's model provider sees what your agent
@@ -501,4 +570,4 @@ especially welcome.
501
570
 
502
571
  ## License
503
572
 
504
- [MIT](./LICENSE). Ports and generated code in your repository are yours.
573
+ [MIT](./LICENSE) © [Erkam Yaman](https://github.com/erkamyaman). Ports and generated code in your repository are yours.
@@ -10,7 +10,7 @@ const bin = path.join(__dirname, '..', 'binaries', key, exe)
10
10
  if (!fs.existsSync(bin)) {
11
11
  console.error(
12
12
  `rust-anything: no prebuilt binary for ${key}.\n` +
13
- 'Install it with Cargo instead: cargo install --git https://github.com/erkamyaman/rust-anything',
13
+ 'Install it with Cargo instead: cargo install rust-anything',
14
14
  )
15
15
  process.exit(1)
16
16
  }
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rust-anything",
3
- "version": "1.1.0",
4
- "description": "Rewrite your app in Rust, one piece at a time, proving nothing changed. TypeScript, Python, C, Go, Ruby, Java.",
3
+ "version": "1.2.0",
4
+ "description": "Rewrite your app in Rust, one piece at a time, checked against the original's recorded behavior at every step. TypeScript, Python, C, Go, Ruby, Java.",
5
5
  "keywords": [
6
6
  "rust",
7
7
  "performance",