AIsaAIsaStudio English 打开 AIsa Studio

rust-anything 发布:逐块把多语言应用重写为 Rust,每步对照原始行为校验

原标题:erkamyaman/rust-anything: Rewrite your whole app in Rust, one piece at a time, checked against the original's recorded behavior at every step. CLIs, HTTP servers and libraries in TypeScript, Python, C, Go, Ruby and Java.

erkamyaman 发布 rust-anything 开源工具,通过录制应用当前行为并在每一步校验 Rust 重写是否一致,把 TypeScript、Python、C、Go、Ruby 和 Java 应用逐块迁移为 Rust,支持 CLI、HTTP 服务器和库。工具可与 Claude Code、Codex、Cursor 和 Gemini CLI 集成,通过 `cargo install rust-anything` 和 `rust-anything setup` 安装并注册 MCP 服务器和技能。仓库创建 1 天已获 1242 星,基准显示热点路径最高提速 20 倍,重放 38,251 条录制用例 0 不匹配。

为什么值得看

原文给出了行为录制校验的工作流程和多语言基准数字,读者可以据此评估逐块迁移 Rust 的可行路径。

阅读原文 ↗

本页的摘要、推荐理由与解读出自 AIsa Studio 的 AI 风向智能体,原文版权归原作者所有。

原文

GitHub 上的新仓库 erkamyaman/rust-anything,创建 1 天,已有 1242 星(平均每天 832 星)。 Rewrite your whole app in Rust, one piece at a time, checked against the original's recorded behavior at every step. CLIs, HTTP servers and libraries in TypeScript, Python, C, Go, Ruby and Java. 主题:agent-skills, claude-code, cli, code-migration, codex, ffi, golang, java, javascript, mcp, migration, napi, performance, porting, pyo3, python, rewrite, ruby, rust, typescript 语言:Rust

README:

rust-anything

Rewrite your whole app in Rust. Keep it working the whole way.

CLIs, servers and libraries, piece by piece, checked against the original at every step.

up to 20x faster · 38,251 recorded cases replayed · 0 mismatches · one command

Rewrite your whole app in Rust, one piece at a time. rust-anything records what your TypeScript/JavaScript, Python, C, Go, Ruby or Java app does today, then checks every piece of the Rust rewrite against that recording before it moves on, until the app is pure Rust. CLIs, HTTP servers and libraries; your coding agent (or you) writes the Rust. It can only catch what the recording covers: see What it can't catch. Only need the slow part fast? Port just that, one hot path at a time:

Real workload, same results as the original Original With rust-anything
x18n's sidebar search, 50,000 keys (TypeScript, Node) 10 ms per query 0.5 ms: 20x faster
The same search in the browser (wasm, one thread) 10 ms 0.95 ms: 11.5x
slugify over 20,000 strings (Python) 98 ms 17x faster
Shellwords.shellescape from Ruby's standard library, 50,000 values 88 ms 11.8x faster
Slugify over 50,000 strings (Go) 49 ms 4x faster
slugify over 50,000 strings (Java) 43 ms 3x faster

Measured on 4 cores; every number has a benchmark in demo/ that first checks the results are identical. Calling Rust once per small function is usually slower than a JIT; rust-anything finds the loop worth moving, and moves it.

rust-anything is an independent project, not affiliated with or endorsed by the Rust Project or the Rust Foundation. "Rust" is a trademark of the Rust Foundation.

Quick start

Paste this into Claude Code, Codex, Cursor or Gemini CLI and let your agent install it:

Install rust-anything: run `cargo install rust-anything`, then `rust-anything setup`.
Tell me when to restart you.

Or yourself:

cargo install rust-anything   # from crates.io
rust-anything setup           # registers it with Claude Code, Codex, Cursor and Gemini CLI

No Rust toolchain yet? Prebuilt binaries for macOS, Linux and Windows are attached to each GitHub release, and for JavaScript projects npm install -g rust-anything installs the same binary.

In Claude Code you can also install it as a plugin (the MCP server and the skill; the CLI above must be on your PATH):

/plugin install rust-anything --marketplace erkamyaman/rust-anything

setup adds the MCP server to each agent it finds and installs the workflow skill where the agent reads skills. It keeps your other settings, is safe to run again, and --remove undoes it. Then ask your agent, for example:

  • "Rewrite this CLI in Rust with rust-anything, end to end, and prove it behaves the same."
  • "This search feels slow. Profile it with rust-anything and move the hot loop to Rust."
  • "Plan a migration of src/parser/ to Rust with rust-anything; port the first unit and prove it."
  • "Bench the Rust port in rust/text-rs against the original and tell me whether to ship it."

Works with

Agent rust-anything setup adds
Claude Code MCP server in ~/.claude.json, skill in ~/.claude/skills/
Codex MCP server in ~/.codex/config.toml, skill in ~/.codex/skills/
Cursor MCP server in ~/.cursor/mcp.json
Gemini CLI MCP server in ~/.gemini/settings.json
Any other MCP client add rust-anything mcp as a stdio server by hand (see Install)

Before changing a file that exists, setup saves a copy beside it (.rust-anything.bak).

Or run the steps yourself:

rust-anything profile . -- node bench.mjs              # what is hot, and who calls it
rust-anything bridge . src/fuzzy.ts --batch fuzzyScore:text
# write src/port.rs (or let your agent), then:
rust-anything record rust/fuzzy-rs && rust-anything build rust/fuzzy-rs
rust-anything diff rust/fuzzy-rs                       # every recorded case must match
rust-anything bench rust/fuzzy-rs                      # faster? the verdict says

原文版权归 GitHub 爆发仓库 及原作者所有,本站转载仅供阅读。如需删除,请联系 support@aisa.one。