Rewrite your app in Rust, piece by piece, checked against the original at every step. Works with TypeScript, JavaScript, Python, Go, Ruby, Java, C, PHP, C#, Kotlin, PowerShell and Swift.
Rust agent-skillsclaude-codeclicode-migrationcodexffigolangjavajavascriptmcpmigrationnapiperformanceportingpyo3pythonrewriterubyrusttypescript
//! What a source file declares of the original's surface: the type each language's detectors
//! return.
use std::collections::BTreeSet;
use super::Family;
/// The surface a file declares. Only the `Command`, `Flag`, `Route` and `Env` families come from
/// here: exports and error paths come from the existing analyses.
#[derive(Debug, Default)]
pub struct Surface {
/// The enumerated items.
pub found: Vec<Found>,
/// The places where the surface exists but cannot be enumerated: a dynamic or non-literal
/// site, or a surface with no detector (raw `argv`, unknown parser or framework).
pub unresolved: Vec<UnresolvedInFile>,
/// The detectors that recognised something, for example `(Command, "commander")` or
/// `(Route, "express")`.
pub recognised: BTreeSet<(Family, String)>,
/// The external packages the file imports and the detector cannot classify, with the line of
/// the import: not a module built into the language, not a library the detector already reads
/// or reports, not a package known to declare nothing. Such a package may declare commands,
/// flags or routes, or read the environment: the registry makes it a site.
pub unknown_packages: Vec<(String, u32)>,
}
/// A surface item found in a file.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Found {
pub family: Family,
/// The name as it enters the id: the command, the flag (`--out`), the environment variable,
/// or for a route `METHOD path` (`GET /users/:id`).
pub name: String,
pub line: u32,
/// The command that owns a flag; `None` for a global flag.
pub scope: Option<String>,
/// Free detail: a flag's alias, a route's handler, a default value.
pub detail: Option<String>,
}
/// A surface site that a detector could not enumerate.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct UnresolvedInFile {
pub family: Family,
pub line: u32,
pub reason: String,
}