HeadlinesBriefing favicon HeadlinesBriefing.com

AI Code Rewrite: 100k Lines Moved from TypeScript to Rust in a Month

Hacker News: Front Page •
×

On January 25, Frenchy front‑end engineer vjeux announced a month‑long experiment that moved 100 k lines of TypeScript into Rust using Claude Code. The goal mirrored a Microsoft‑style rewrite promise: one engineer, one month, one million lines. The project focused on the open‑source Pokemon Showdown battle engine.

Claude’s sandbox restrictions forced creative workarounds. The author built a local Node.js HTTP server to relay git commands, ran compiles inside Docker to bypass antivirus prompts, and scripted automated key presses to answer permission dialogs. These tricks kept the AI running unattended for hours.

Initial attempts produced fragmented Rust code with duplicated structures and hard‑coded logic. To tighten output, the engineer scripted a mapping that inserted JavaScript source comments beside each Rust function, then split large files into per‑method modules. This approach improved context handling and reduced Claude’s misinterpretations.

After iterative cleanup, the rewritten engine compiled but still required integration testing. The author plans to adopt a staged build strategy, gradually replacing JavaScript modules with Rust equivalents while preserving battle logic. Success would demonstrate AI‑assisted large‑scale rewrites, potentially reshaping how legacy codebases evolve.