rust-anything 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,6 +10,7 @@
10
10
 
11
11
  <p align="center">
12
12
  <a href="https://crates.io/crates/rust-anything"><img src="https://img.shields.io/crates/v/rust-anything?color=E2862A&label=crates.io" alt="crates.io version"></a>
13
+ <a href="https://www.npmjs.com/package/rust-anything"><img src="https://img.shields.io/npm/v/rust-anything?color=E2862A&label=npm" alt="npm version"></a>
13
14
  <img src="https://img.shields.io/badge/languages-6-E2862A" alt="6 languages">
14
15
  <a href="#works-with"><img src="https://img.shields.io/badge/works%20with-4%20agents-E2862A" alt="Works with 4 agents"></a>
15
16
  <a href="https://github.com/erkamyaman/rust-anything/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/erkamyaman/rust-anything/ci.yml?branch=main&label=tests" alt="Tests"></a>
@@ -127,14 +128,28 @@ done.
127
128
  | 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 |
128
129
  | Ruby | file or folder of module functions | a magnus extension under the original modules | a generated Ruby driver |
129
130
  | Java | package of `public static` methods | typed JNI and a generated binary wire, in wrapper classes with the original methods | a generated reflection driver |
131
+ | PHP (preview) | folder of functions and `public static` methods | coming next: PHP FFI over a C ABI | whole apps today: `app record`, `app replay` and the front door, for CLIs and servers (`php -S`) |
132
+ | C# (preview) | folder of `public static` methods | coming next: P/Invoke over a C ABI | whole apps today: `app record`, `app replay` and the front door, for CLIs and ASP.NET servers (`dotnet <app>.dll`) |
130
133
 
131
134
  Every language except C also gets batch classes (`--batch`): the items cross once and stay in
132
135
  Rust, and each call runs over all of them on all cores.
133
136
 
134
- The language is detected from the repository (`go.mod`, `pom.xml`, `pyproject.toml`, `Gemfile`,
135
- `package.json`, else the most common source files); `--lang` overrides it. Types come from the
136
- source: TS types, Python hints, C and Go and Java signatures, Ruby YARD tags; untyped parameters
137
- used as numbers are inferred as numbers.
137
+ The language is detected from the repository (`go.mod`, `pom.xml`, a `.csproj` or `.sln`,
138
+ `pyproject.toml`, `Gemfile`, `composer.json`, `package.json`, else the most common source files);
139
+ `--lang` overrides it. Types come from the source: TS types, Python hints, C, Go, Java and C#
140
+ signatures, Ruby YARD tags, PHP types and phpdoc; untyped parameters used as numbers are inferred
141
+ as numbers.
142
+
143
+ PHP is in preview: `analyze` plans a PHP app (Composer packages and PSR-4 autoloading, risks
144
+ such as loose comparison and integer overflow into floats, Composer packages mapped to crates),
145
+ and a PHP CLI or server can be recorded, replayed and put behind a Rust front door. Porting its
146
+ units into Rust through PHP's FFI is the next step ([issue #2](https://github.com/erkamyaman/rust-anything/issues/2)).
147
+
148
+ C# is in preview the same way: `analyze` reads `.csproj` projects and their NuGet packages
149
+ (mapped to crates), resolves `using` directives to folders, and flags what C# does differently
150
+ (`decimal`, `dynamic`, LINQ's deferred queries, `Task`, `lock`, reflection). A C# CLI or ASP.NET
151
+ server can be recorded, replayed and put behind a Rust front door; porting units through P/Invoke
152
+ comes next.
138
153
 
139
154
  ## How it works
140
155
 
@@ -531,6 +546,9 @@ usually lives outside the recording, so know where the edges are:
531
546
  - **Anything not in the output.** Timing, memory, concurrency under load, and side effects other
532
547
  than stdout, stderr, exit codes, written files and HTTP responses (network calls, databases,
533
548
  signals) are not compared.
549
+ - **Other platforms.** A recording proves behavior on the machine that ran it. C whose results
550
+ depend on type sizes, endianness or the compiler can behave differently on the target; `analyze`
551
+ keeps hardware-facing C in C for that reason.
534
552
 
535
553
  ## FAQ
536
554
 
@@ -552,6 +570,39 @@ multiply-add and the math library differ between compilers. Record with `--float
552
570
  (`record` or `app record`), and floats match within that share of the larger value (absolute below
553
571
  1). Integers, text and structure still have to match exactly.
554
572
 
573
+ **Can it port an app I only have as an APK, a JAR or an .exe?** No. It ports source code: it
574
+ parses the functions, records what each one does, and checks the Rust against the running
575
+ original. A compiled app has none of that to work with, and `analyze` says so. Writing a new Rust
576
+ app from a binary's visible behavior is a different project.
577
+
578
+ **Should I port battle-tested C?** Often not, and `analyze` tells you where. C that touches
579
+ hardware registers, relies on its compiler's type sizes or memory layout, or uses inline assembly
580
+ (`volatile`, bitfields, packed structs, `__asm__`, integers cast to addresses) is marked "keep in
581
+ C": a recording on your machine proves nothing about the target, and stable driver or firmware
582
+ code gains little from a rewrite. The portable logic around it (parsing, protocols, data handling)
583
+ is what moves well.
584
+
585
+ **Can it port my Electron app?** The logic, yes; the windows stay web pages. `analyze
586
+ --whole-app` spots Electron and plans the main process piece by piece while the renderer stays as
587
+ it is. Moving the UI to Tauri (the same web UI on a Rust backend) is a separate step once the logic
588
+ is Rust.
589
+
590
+ **What about C#, Kotlin or Swift?** C# is in preview (see [Languages](#languages)); Kotlin and
591
+ Swift are not supported yet. Each language needs a parser, a recorder, a bridge and a replay
592
+ driver, all tested end to end. Open an issue (or upvote one) for the language you need.
593
+
594
+ **Won't the Rust be much bigger than the original?** It shouldn't be. `gate` compares the port's
595
+ lines with the original's and fails above 3x (plus 50 lines for imports and signatures): that usually means hand-writing what a crate already
596
+ does, or handling cases one by one. `analyze` lists the crates to use.
597
+
598
+ **Doesn't porting piece by piece lock the Rust into the old app's design?** Only while both run
599
+ side by side. The recordings check behavior at the app's edges (a CLI's output, a server's
600
+ responses, a module's exported functions), not its internals. Mirror the old structure while
601
+ units still cross the bridge; once `app lift` has removed the original, restructure the Rust
602
+ freely, and `app replay` still proves the behavior. Nothing calls back into the original either:
603
+ the front door runs it as a separate process (or forwards HTTP to it), bridged units are called
604
+ by the original and never the other way round, and callbacks stay in the source language.
605
+
555
606
  **Does my code leave my machine?** No: rust-anything runs locally and sends none of your code
556
607
  anywhere. Cargo downloads crates as usual, and your agent's model provider sees what your agent
557
608
  sends it, under its own policy.
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rust-anything",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Rewrite your app in Rust, one piece at a time, checked against the original's recorded behavior at every step. TypeScript, Python, C, Go, Ruby, Java.",
5
5
  "keywords": [
6
6
  "rust",