最近推送 2026-12-01 21:54(0 天前),属于活跃维护
erkamyaman/rust-anything
GITHUB中文整理主语言 Rust · 12,474 星 · Apache-2.0 · 创建于 2026-11-16
一个用于把现有应用逐步改写成 Rust 的辅助工具,通过录制原程序行为并比对来验证迁移正确性。
仓库健康度
5 个维度开放 Issue 7 个 · Fork 1,032 个
24 小时 +166 · 7 日 +2,981 · 30 日 积累中
许可证 Apache-2.0 · 12 个 topics · 开了 Wiki
这一项暂无数据,不代表项目没有发布
「证据不足」表示这项数据暂时没有取到,不能读成「项目有问题」;「部分数据」表示只拿到一部分信号。版本发布要额外调 Releases 接口,下一版补。
Star 趋势
15 天记录横轴 2026-11-18 → 2026-12-02,纵轴按这段时间的最小/最大值拉伸。趋势来自站内每天记录一次的星数,页面打开时不会实时请求 GitHub。
它解决什么问题
据 README 归纳将现有应用整体重写为 Rust 风险高、难以保证行为一致;没有它,迁移过程缺乏自动化的行为验证,容易引入隐蔽错误。
核心能力
7 条- 1录制原程序在边界用例和自定义输入下的返回或异常行为
- 2在 Rust 实现上重放用例并比对差异
- 3生成桥接代码,方便在原环境和 Rust 之间对接
- 4提供 gate 检查,全部用例匹配后才允许发布
- 5分析迁移单元并规划迁移步骤
- 6支持通过 MCP 服务与 AI 编码代理集成
- 7保留原 API 不变,可逐步替换内部实现
项目画像
6 个角度项目定位
一个用于把现有应用逐步改写成 Rust 的辅助工具,通过录制原程序行为并比对来验证迁移正确性。
适合谁
需要把 TypeScript、Python、C、Go、Ruby 或 Java 项目逐步迁移到 Rust 的开发者,尤其是关注行为一致性和渐进式重构的团队。
典型场景
将一个 TypeScript 的 CLI 工具逐步迁移到 Rust,并确保每个子命令行为与原版一致。;对性能敏感的 Python 库,定位热点循环并将其改写为 Rust,再通过行为比对验证正确性。;规划并执行一个 Java 或 Go 的 HTTP 服务器模块迁移,按单元逐步替换并验证。;在 AI 编码代理中安装后,让代理自动规划迁移、生成桥接并验证 Rust 实现。
部署难度
安装 Rust 工具链后可通过 cargo install 或 npm 安装预编译二进制;运行 setup 可自动配置 MCP 服务和技能,手动集成时需添加 MCP 配置。
风险限制
需要对应语言的运行时环境(如 Node 22.6+、Python 3.9+、Go 1.21+、Ruby 3+、JDK 17+),C 还需 C 编译器;不自动编写 Rust 代码,需开发者或代理编写 port.rs。
最近维护
最近一次推送是 2026-12-01 21:54。 实现方式:先运行原程序录制其在测试用例上的行为,再对 Rust 实现回放这些用例进行差异比对;通过桥接代码保持调用方 API 不变,逐个单元替换,直到全部用例匹配并通过 gate 检查。
README 原文细节
2 个板块怎么安装从零跑起来的步骤
Install the ports
The ESLint port is an npm command. It runs the Rust port for what it covers and ESLint 10.15.0, pinned as a dependency, for everything else, so the output is ESLint's either way:
The binary comes for macOS (arm64, x64) and Linux (x64, arm64, glibc). On Windows and elsewhere, or with RUSTANYTHINGMODE=old, eslint-rs runs ESLint itself: same output, no speedup. Installed from its tarballs on macOS arm64, eslint-rs matches ESLint 10.15.0 installed beside it on all 10,585 recorded runs (how).
The Prettier port is packaged the same way (prettier-rs, Prettier 3.6.2) and replays 17,224/17,224 recorded runs from its tarballs, 7.9% handed to Prettier, but it is not on npm. rust-anything package makes this kind of package from any CLI front door.
- eslint-rs — --no-config-lookup --rule ... --stdin with the 90 ported rules (stylish and json output, fixes, suggestions) — eslint.config. lookups (eslint .), files and folders, the other 202 core rule
npm install -g eslint-rs # ESLint 10.15.0
Quick start
Paste this into Claude Code, Codex, Cursor, Gemini CLI or OpenCode and let your agent install it:
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):
In Codex, from the agents marketplace in this repo (.agents/plugins/marketplace.json, the same plugin under plugin/, with the skill and MCP server):
- "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."
Install rust-anything: run `cargo install rust-anything`, then `rust-anything setup`.
Tell me when to restart you.
其它说明README 里剩下的内容
概述
English · Türkçe · Українська · 简体中文 · 繁體中文 · Deutsch · Français · Русский · 日本語 · 한국어 · Azərbaycanca · Oʻzbekcha · Қазақша · Кыргызча · Türkmençe · Татарча · ئۇيغۇرچە · Português · Tiếng Việt · Español · Italiano · Bahasa Indonesia · العربية · فارسی · हिन्दी · + add yours
Rewrite your app in Rust, and prove it still behaves the same. Point it at your app: it records what the original does, your coding agent writes the Rust one piece at a time, and every piece is checked against that recording before it moves on. It doesn't translate code; it proves the rewrite.
Install · Releases · Claude Code plugin · MCP Registry · Real-world ports · FAQ Languages · How it works · Whole apps · Sponsors · MIT Made in Türkiye 🇹🇷 by erKam Yaman · ❤️ Sponsor me · Sponsored by CodeRabbit
Also by me: safe-anything, a 100% Rust security scanner for code, secrets, configs and AI agent setups. Find the holes before someone else does.
- Prettier 3.6.2, 2,360 JS/TS files from the command line — 128.6 s — 6.9 s: 19x faster
- Prettier, 6,305 Markdown files from the command line — 352 s — 22.5 s: 15.6x faster
- json-server, a whole Node server: memory at idle — 74 MB — 3.5 MB, one 5.3 MB binary
- json-server, from start to first response — 79 to 85 ms — 8 to 10 ms
- Fuse.js search over 50,000 strings, per query — 91.2 ms — 2.8 ms: 32x faster
Works with
Before changing a file that exists, setup saves a copy beside it (.rust-anything.bak); --no-backup skips the copy.
To wire OpenCode up by hand, put the server in ~/.config/opencode/opencode.json (command is the whole argv) and copy skills/rust-anything/ to ~/.config/opencode/skills/rust-anything/:
rust-anything does not translate code: your coding agent (Claude Code, Codex, Cursor, OpenCode, ...) or you write the Rust. rust-anything supplies what an agent cannot guess reliably: where the time goes, what to port first and in which order, a bridge so the rest of the code calls the Rust with its API unchanged, the exact behavior the port must match, a safe way to ship it, and a gate that says when a port is done.
Same output is not enough. Record what the app sends too, and a rewrite that mails twice fails:
- 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
- OpenCode — MCP server in ~/.config/opencode/opencode.json (mcp.servers), skill in ~/.config/opencode/skills/
- Any other MCP client — add rust-anything mcp as a stdio server by hand (see Install)
Languages
Every language except C, PHP, C# and PowerShell also gets batch classes (--batch): the items cross once and stay in Rust, and each call runs over all of them on all cores.
The language is detected from the repository (go.mod, pom.xml, build.gradle/build.gradle.kts, a .csproj or .sln, pyproject.toml, Gemfile, composer.json, package.json, else the most common source files); a Gradle module with .kt sources and no .java sources is Kotlin, mixed modules stay Java. --lang overrides it. Types come from the source: TS types, Python hints, C, Go, Java, Kotlin and C# signatures, Ruby YARD tags, PHP types and phpdoc; untyped parameters used as numbers are inferred as numbers.
For Android, rust-anything build --profile android builds the same JNI library with the NDK for arm64-v8a, armeabi-v7a and x8664 (or the --abi values you pass) and installs it into /jniLibs//; --api sets the API level (minimum 26, which the generated Java runtime needs). It finds the NDK from ANDROIDNDKHOME/ANDROIDNDKROOT or the SDK, needs the Rust targets (rustup target add aarch64-linux-android armv7-linux-androideabi x8664-linux-android), links 64-bit libraries with 16 KB page alignment, and checks that every JNI entry point is exported. Gradle looks in src/main/jniLibs by default, so pass
For PHP, analyze plans a PHP app (Composer packages and PSR-4 autoloading, risks such as loose comparison and integer overflow into floats, Composer packages mapped to crates), and a PHP CLI or server can be recorded, replayed and put behind a Rust front door. A unit's top-level functions with scalar, string, list and assoc-array parameters are bridged through PHP's FFI extension (php with ext-ffi, on by default for the CLI): once diff passes, require the generated php/.php (the name is the crate with - written as , so foo-rs is php/foors.php) where the app required the original, and leave bot
- TypeScript/JavaScript — folder or file — napi-rs or wasm-bindgen with a generated binary wire; classes and async included — Node, running the .ts sources
- Python — package or module — PyO3 (abi3), direct conversion, typed exceptions — Python, importing the original
- C — .c file — extern "C" functions with the original names and a header — the original compiled to a shared library, called through ctypes, one fork per case
- Go — package — typed cgo calls and a generated binary wire, in a package with the original API — a generated Go driver, built as its own module
- Ruby — file or folder of module functions — a magnus extension under the original modules — a generated Ruby driver
- Java — package of public static methods — typed JNI and a generated binary wire, in wrapper classes with the original methods — a generated reflection driver
- Kotlin — Gradle module of top-level functions and @JvmStatic methods — the Java bridge: typed JNI in Java wrapper classes calling the compiled Kotlin statics — a generated reflection driver, with the
- PHP — file or folder of top-level functions (public static methods stay in PHP) — a JSON dispatcher over ext-ffi, in a file that redeclares the functions with the original parameters — a generated PHP
- PowerShell — .psm1 module or .ps1 script of functions with param() blocks (exported per Export-ModuleMember) — a JSON dispatcher over P/Invoke, declared at load time with Reflection.Emit, in a .ps1 th
- C# — file or folder of public static methods — a JSON dispatcher over P/Invoke, in .Rust classes with the original methods — a generated reflection driver, compiled with the project's sources by dotne
关于 rust-anything 的常见问题
7 个问题rust-anything 是做什么的?
一个用于把现有应用逐步改写成 Rust 的辅助工具,通过录制原程序行为并比对来验证迁移正确性。 将现有应用整体重写为 Rust 风险高、难以保证行为一致;没有它,迁移过程缺乏自动化的行为验证,容易引入隐蔽错误。
rust-anything 有哪些功能?
核心能力:录制原程序在边界用例和自定义输入下的返回或异常行为;在 Rust 实现上重放用例并比对差异;生成桥接代码,方便在原环境和 Rust 之间对接;提供 gate 检查,全部用例匹配后才允许发布;分析迁移单元并规划迁移步骤;支持通过 MCP 服务与 AI 编码代理集成;保留原 API 不变,可逐步替换内部实现。
rust-anything 适合谁用?
需要把 TypeScript、Python、C、Go、Ruby 或 Java 项目逐步迁移到 Rust 的开发者,尤其是关注行为一致性和渐进式重构的团队。
rust-anything 是怎么工作的?
先运行原程序录制其在测试用例上的行为,再对 Rust 实现回放这些用例进行差异比对;通过桥接代码保持调用方 API 不变,逐个单元替换,直到全部用例匹配并通过 gate 检查。
怎么安装 rust-anything?
按项目 README 的说明:eslint-rs — --no-config-lookup --rule ... --stdin with the 90 ported rules (stylish and json output, fixes, suggestions) — eslint.config. lo;"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."。完整命令见下方「怎么安装」一节或 GitHub 仓库的 README。
用 rust-anything 有什么门槛或限制?
需要对应语言的运行时环境(如 Node 22.6+、Python 3.9+、Go 1.21+、Ruby 3+、JDK 17+),C 还需 C 编译器;不自动编写 Rust 代码,需开发者或代理编写 port.rs。
rust-anything 现在还在维护吗?数据怎么样?
目前 12,474 星,1,032 个 Fork,主语言 Rust,创建于 2026-11-16,最近一次推送 2026-12-01 21:54,许可证 Apache-2.0。星数、Fork、推送时间都是 GitHub 返回的实时数据,「最近推送」离现在越近说明越活跃;长期不动要留意是否已停止维护。
这些内容来自哪
读法说明项目数据取自 GitHub 官方接口与项目 README;星数、Fork、语言与时间以 GitHub 页面为准,档案更新于 2026-11-25 11:38。