Don't rewrite it in Rust. Rewrite the 5% that's slow: profile your app, port the hot functions with your coding agent, prove they behave the same. Python, JS/TS, Ruby, Java, Kotlin, Go, PHP, C/C++, C#, R.
Rust agent-skillsai-agentsclaude-codeclaude-code-plugincodexdeveloper-toolsffimcpmcp-servernapi-rsnodejsoptimizationperformanceprofilerpyo3pythonrewrite-it-in-rustrubyrusttypescript
verify --all: re-check every port at once (#39)
chessMan850a112abf31
diff --git a/src/main.rs b/src/main.rsindex 4c8cca7..ea38a76 100644--- a/src/main.rs+++ b/src/main.rs@@ -81,7 +81,12 @@ enum Cmd {samples: usize,},/// Build the Rust port and replay every recorded call against it- Verify { id: Option<String> },+ Verify {+ id: Option<String>,+ /// Verify every port (after a toolchain or dependency upgrade, or changes to the app)+ #[arg(long, conflicts_with = "id")]+ all: bool,+ },/// Switch your app over to the verified Rust portEnable {id: Option<String>,@@ -152,7 +157,8 @@ fn run(cmd: Cmd, root: &Path) -> Result<()> {}Ok(())}- Cmd::Verify { id } => {+ Cmd::Verify { all: true, .. } => pipeline::verify_all(root),+ Cmd::Verify { id, .. } => {let (id, v) = pipeline::verify(root, id.as_deref())?;show::verify(&id, &v);if !v.ok() {@@ -192,3 +198,19 @@ fn run(cmd: Cmd, root: &Path) -> Result<()> {Cmd::Mcp | Cmd::Replay { .. } => unreachable!(),}}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn verify_all_parses() {+ let cli = Cli::try_parse_from(["fast-anything", "verify", "--all"]).unwrap();+ assert!(matches!(cli.cmd, Cmd::Verify { all: true, id: None }));+ assert!(Cli::try_parse_from(["fast-anything", "verify", "fuzzy.lev", "--all"]).is_err(), "an id or --all");+ assert!(matches!(+ Cli::try_parse_from(["fast-anything", "verify"]).unwrap().cmd,+ Cmd::Verify { all: false, .. }+ ));+ }+}diff --git a/src/pipeline.rs b/src/pipeline.rsindex a7242a6..0702a3e 100644--- a/src/pipeline.rs+++ b/src/pipeline.rs@@ -171,6 +171,23 @@ pub fn verify(root: &Path, id: Option<&str>) -> Result<(String, Verify)> {Ok((id, v))}+/// Verify every port; an enabled one that fails is switched back, as with a single verify.+pub fn verify_all(root: &Path) -> Result<()> {+ let ids: Vec<String> = Ctx::open(root)?.state.ports.keys().cloned().collect();+ ensure!(!ids.is_empty(), "nothing ported yet: run fast-anything port");+ let mut failed = vec![];+ for id in &ids {+ let (id, v) = verify(root, Some(id))?;+ show::verify(&id, &v);+ if !v.ok() {+ failed.push(id);+ }+ }+ ensure!(failed.is_empty(), "{} of {} ports don't match: {}", failed.len(), ids.len(), failed.join(", "));+ ui::ok(format!("all {} ports match the original", ids.len()));+ Ok(())+}+/// What to do about a port that's right but slower than the original.pub fn slower_hint() -> &'static str {"calling into Rust costs more than this function's work, so it won't be switched on. Port its caller instead (fewer, bigger calls), or enable --force"