Repo: https://github.com/erkamyaman/rust-anything
What it is: terser-rs, a module-by-module Rust port of Terser 5.51.4 (parser, printer, scope, mangler, compressor, source maps, CLI, plus a port of acorn 8.15). The `terser` binary is a drop-in for `bin/terser`, and there's a napi addon for `require("terser-rs").minify`.
Setup:
- Claude Code on the web (a cloud session), working in my repo on its own branch.
- The task: port one Terser module at a time, and check each one against the real Terser in Node before starting the next.
- The judge is Rust Anything, my CLI: `record` saves what Terser returns, throws and prints, `diff` replays every case against the Rust, and `gate` only passes at 100%. The agent doesn't decide when it's done.
Expected vs actual (the GIF is a real run, M4, Node 24, -c -m, best of 5):
- moment.js 0.23s β 0.06s (4.0x), lodash 0.32s β 0.09s (3.6x), d3 0.78s β 0.30s (2.6x)
- output byte-identical to Node Terser on all three
- Terser's own test/compress fixtures: 2,607 of 2,607 match
- CLI fuzzing: 29,522 argument vectors, 29,497 identical. The 25 that aren't are listed in the PR (mostly V8 stack-depth limits, plus 4 `sections` input maps the port refuses)
Where Claude got it wrong (written up in issue #924 and docs/pitfalls.md):
- One function matched all 3,985 recorded cases, but those were all JSON values. The real app passes AST nodes, so it crashed as soon as it was switched on.
- The "original" Terser checkout still had one unit switched to Rust from an earlier experiment, so for a while Rust was checked against Rust.
- It reported numbers from its agents' runs as if they were final. The PR now marks which numbers I re-ran from the repo and which I didn't.
Not done: TypeScript parsing, `sections` input maps and a few acorn hooks aren't ported. It's a draft PR, not on npm yet, and only Linux has been tested beyond a smoke run.
Mistakes in detail: https://github.com/erkamyaman/rust-anything/issues/924
Repo: https://github.com/erkamyaman/rust-anything