
ruby-anything
io.github.akkisavi/ruby-anything
Migrate any app to Ruby on Rails one piece at a time, checked against the original's behavior.
Documentation
Ruby Anything
Migrate your app to Ruby on Rails, and prove it still behaves the same.
Website and docs: ruby-anything.vercel.app
Rails 8 · Hotwire (Turbo + Stimulus) · Tailwind CSS · daisyUI
from TypeScript, JavaScript, Python, Go, Java/Spring Boot, Kotlin, C#, PHP, Rust and Swift
Inspired by rust-anything by erkamyaman 🦀 ➜ 💎
Quick start
Paste this into your coding agent:
Install Ruby Anything with npm i -g ruby-anything, then run ruby-anything setup. Run ruby-anything go -- <command that starts this app> and finish the port until ruby-anything gate --app passes.
Or install it yourself:
npm install -g ruby-anything
ruby-anything setup # adds it to Claude Code, Codex, Cursor, Gemini CLI, OpenCode, Windsurf, GitHub Copilot and Cline
ruby-anything doctor # checks Ruby, Rails and the runtimes your original needs
[!WARNING] Recording runs the original's real code. Work on a copy, with a test database (
--db-reset "<command>").
How it works
What counts as done. Behavior, not your tests. record runs the original on generated and given inputs and saves what each call returns, raises and prints; app record saves what each HTTP request answers (status, redirects, JSON, page text), running every request twice so changing values become wildcards. A piece is done when gate passes: every recorded case matches, and the checks for edited recordings, stubs, recorded answers pasted into the port, unrecorded error paths, fewer tests than before, rubocop and brakeman all pass. Your own bin/rails test runs too.
Your tests become cases. record --from-tests -- pytest (or npx jest, node --test) runs the original's own suite with the function instrumented, and every call it makes becomes a recorded case. The source is restored byte for byte afterwards. --pin-clock freezes time at 2026-01-01 for the original and the Ruby port alike, so date-dependent code can match.
Side effects count. A port that forgets to charge the card or send the receipt must fail. app record --effect-env PAYMENT_API_URL=http,SMTP_HOST=smtp_host,SMTP_PORT=smtp_port --db-dump "<cmd>" points the app at local stand-ins that record every outgoing HTTP call and email, and dumps the database after every write; replay checks the Rails app makes the same calls, sends the same mail and leaves the same rows.
Web apps and CLI tools. app record --http records a server; app record --cli --inputs cli.jsonl records a command-line tool (exit code, stdout, stderr, files written, stdin), each run in a throwaway copy of the repo. A CLI's front door is rails/bin/<name>: ported commands run in Rails, the rest exec the original.
The app keeps running. app front-door runs rails new with Tailwind and importmap, adds daisyUI, and puts a small Rack middleware in front that proxies every route Rails does not own yet to the original. Routes move over one at a time with app wire, each with a kill switch (RUBY_ANYTHING_UNIT_<NAME>=original). app replay must stay at 100% while the fallback rate drops to zero; then app lift removes the proxy.
The original keeps changing? ruby-anything drift re-runs the original on every recorded case and lists what now answers differently, plus routes no case records. CI runs the tests on Linux, Windows and macOS, and the bundled GitHub Action runs gate on every pull request.
A new frontend, the same pages. Pages are rebuilt as ERB views with Turbo Frames and Streams, Stimulus controllers and daisyUI components. Replay compares them by visible text, so the markup is new but every heading, label, price and empty state must still be there. JSON responses must match exactly.
Report or migrate, you pick. analyze only reports: languages, frameworks, routes, templates and functions in waves (models, logic, routes, views, jobs), every dependency with its Rails equivalent, and the decisions to settle with you. It is a plain command, so the report costs no tokens. go migrates: each run moves to the next stage and writes the next task to rails/port/TASK.md for your agent.
Your agent writes the Ruby; you make the calls. The agent skill grills you on the decisions (database, auth, equivalence bar, cut-over) and writes them down as ADRs, stops at the checkpoints you choose, and stops to ask when three attempts gain no matching case. Corrections you make become rules every later piece keeps (ruby-anything rules --add).
Agents. ruby-anything setup adds the skill and the MCP server to Claude Code, Codex, OpenCode and GitHub Copilot, and the MCP server to Cursor, Gemini CLI, Windsurf, GitHub Copilot in VS Code and Cline. Any other MCP client can run ruby-anything mcp. As a Claude Code plugin: claude plugin marketplace add akkisavi/ruby-anything, then claude plugin install ruby-anything@ruby-anything.
Everything it writes lives in <repo>/rails/: the Rails app, and rails/port/ with the plan, decisions, glossary, rules, recorded cases and the port map.
Commands
| Command | What it does |
|---|---|
ruby-anything go [-- <start command>] | Move the migration to its next stage and write rails/port/TASK.md |
ruby-anything status [<repo>] | Where the migration stopped: stage, next step, open units (read-only; run it first in a new session) |
ruby-anything analyze <repo> | Plan: routes, templates, functions in waves, dependencies, decisions |
ruby-anything bridge <repo> <unit> | Ruby skeleton for one function in app/services |
ruby-anything record <repo> <unit> | Record the original function on edge cases, --inputs, --from-tests -- <test cmd>, --pin-clock |
ruby-anything diff <repo> <unit> | Replay the cases against the Ruby port (must be N/N) |
ruby-anything gate <repo> <unit> | --all | --app | Done means gate passes |
ruby-anything rules <repo> [--add "<rule>"] | Behavior you corrected, kept by every later piece |
ruby-anything drift <repo> | Has the original changed since it was recorded? |
ruby-anything app record <repo> --http -- <start command> | Record the whole original over HTTP (--effect-env, --db-dump for side effects) |
ruby-anything app record <repo> --cli --inputs cli.jsonl -- <command> | Record a CLI tool |
ruby-anything app front-door <repo> | Rails app that proxies routes not ported yet |
ruby-anything app wire <repo> <unit> --route "GET /path/:id" | Hand a route to Rails (--command <name> for a CLI) |
ruby-anything app replay <repo> | Replay every HTTP case through Rails (--original, --case) |
ruby-anything app status <repo> | Fallback rate, wired routes, units done |
ruby-anything app lift <repo> | Remove the proxy once nothing falls back |
ruby-anything setup | doctor | mcp | Install for agents, check runtimes, MCP server |
Tested
Every push runs the end-to-end suite on Ubuntu, Windows and macOS in
GitHub Actions.
It drives real Python and Node originals through the recorders, real Ruby ports through the
replay harness, and real HTTP, SMTP and SQLite for side effects. It checks both that a correct
port passes and that a wrong one is caught: half-up vs banker's rounding, 1 vs 1.0, a
forgotten email, a wrong exit code, an edited recording, a recorded answer pasted into the port.
25 of 25 pass. Every test, with its result and time: test results
(regenerate with npm run test:report).
In CI
- uses: akkisavi/ruby-anything/packages/ruby-anything@master
with:
app: "true" # also bin/rails test, rubocop, brakeman and the full replay
Inspiration and credits
Ruby Anything is inspired by rust-anything by
erkamyaman, which migrates apps to Rust the same way. The
core ideas come from it: the original's recorded behavior is the spec, a gate that refuses
shortcuts, one piece at a time behind a front door, a go command and an agent skill that guides
the work. Ruby Anything applies them to Ruby on Rails with Hotwire, Tailwind and daisyUI.
If you're moving code to Rust, use rust-anything, and give it a ⭐.
The recorders are PortPilot's language adapters.
License
Licensed under MIT. Ports and generated code in your repository are yours.
Repository layout
| Path | What it is |
|---|---|
| packages/ruby-anything | The ruby-anything CLI, MCP server and agent skill |
| adapters | Language recorders shared by ruby-anything and PortPilot |
| site | The website and docs at ruby-anything.vercel.app |
ruby-anythingnpm install ruby-anything