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
doctor: an ok verdict in --json, and name the failed required checks (#1281)
jakalijey603d6f16ecc2
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex b4124059..c00257ca 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -2,6 +2,9 @@## Unreleased+- `doctor --json` has a top-level `"ok"` that matches the exit code, and the text verdict names the+ required checks that failed (`Something required is missing: Claude Code mcp, Claude Code skill.`)+ instead of listing cargo, the MCP server and agent setup whichever one failed (#1262 by @jakalijey).- `gate` refuses `--held-out-seed` together with `--held-out-cases 0` before running any check(the MCP `gate` tool too), instead of passing and ignoring the seed, and `--held-out-cases 0`says the check is off once, in its `held-out` row, not also in a note above the table (#1250 bydiff --git a/src/doctor.rs b/src/doctor.rsindex 817f1c76..18686683 100644--- a/src/doctor.rs+++ b/src/doctor.rs@@ -47,7 +47,7 @@ pub struct Check {pub fix: Option<String>,}-#[derive(Debug, Serialize)]+#[derive(Debug)]pub struct Report {pub checks: Vec<Check>,}@@ -59,6 +59,26 @@ impl Report {.iter().all(|c| !c.required || c.status == Status::Ok)}++ /// The required checks that did not pass, in report order.+ pub fn missing_required(&self) -> Vec<&str> {+ self.checks+ .iter()+ .filter(|c| c.required && c.status != Status::Ok)+ .map(|c| c.name.as_str())+ .collect()+ }+}++/// `doctor --json`: the verdict the exit code follows (`ok`), then every check.+impl Serialize for Report {+ fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {+ use serde::ser::SerializeStruct;+ let mut s = serializer.serialize_struct("Report", 2)?;+ s.serialize_field("ok", &self.ok())?;+ s.serialize_field("checks", &self.checks)?;+ s.end()+ }}/// A version as `major.minor.patch`.@@ -1146,11 +1166,14 @@ pub fn text(r: &Report) -> String {}}}- out.push_str(if r.ok() {- "\nEverything required is in place. Language runtimes and wasm are optional: each matters only for the languages you port.\n"+ if r.ok() {+ out.push_str("\nEverything required is in place. Language runtimes and wasm are optional: each matters only for the languages you port.\n");} else {- "\nSomething required is missing: cargo, the MCP server, or the setup of an agent found here. Run the fix commands above.\n"- });+ out.push_str(&format!(+ "\nSomething required is missing: {}. Run the fix commands above.\n",+ r.missing_required().join(", ")+ ));+ }out}@@ -1418,6 +1441,41 @@ mod tests {assert!(!required.ok());}+ #[test]+ fn the_verdict_names_the_required_checks_that_failed() {+ let check = |name: &str, status, required| Check {+ name: name.into(),+ status,+ required,+ detail: String::new(),+ fix: None,+ };+ let report = Report {+ checks: vec![+ check("cargo", Status::Ok, true),+ check("mcp server", Status::Ok, true),+ check("Claude Code mcp", Status::Missing, true),+ check("Claude Code skill", Status::Missing, true),+ check("node", Status::Missing, false),+ ],+ };+ let text = text(&report);+ assert!(+ text.ends_with(+ "Something required is missing: Claude Code mcp, Claude Code skill. Run the fix commands above.\n"+ ),+ "{text}"+ );+ let verdict = text.lines().last().unwrap();+ assert!(+ !verdict.contains("cargo") && !verdict.contains("node"),+ "{verdict}"+ );+ let json = serde_json::to_value(&report).unwrap();+ assert_eq!(json["ok"], false);+ assert_eq!(json["checks"].as_array().unwrap().len(), 5);+ }+fn runtime_named(name: &str) -> &'static Runtime {RUNTIMES.iter().find(|r| r.name == name).unwrap()}diff --git a/tests/doctor.rs b/tests/doctor.rsindex 51b3456d..433a7d29 100644--- a/tests/doctor.rs+++ b/tests/doctor.rs@@ -52,6 +52,11 @@ fn doctor_json_lists_every_check_with_a_fix_for_each_problem() {let mcp = checks.iter().find(|c| c["name"] == "mcp server").unwrap();assert_eq!(mcp["status"], "ok", "{mcp}");assert_eq!(out.status.success(), all_required_ok, "{report:#}");+ assert_eq!(+ report["ok"].as_bool(),+ Some(all_required_ok),+ "the top-level verdict follows the required checks: {report:#}"+ );assert!(matches!(out.status.code(), Some(0 | 1)));}diff --git a/website/pages/en/docs/introduction/doctor.md b/website/pages/en/docs/introduction/doctor.mdindex bdcda84f..f3a50208 100644--- a/website/pages/en/docs/introduction/doctor.md+++ b/website/pages/en/docs/introduction/doctor.md@@ -10,7 +10,7 @@ rust-anything doctorrust-anything doctor --json```-`doctor` checks the language runtimes, the agent setup and the MCP server, and prints the command that fixes each problem. It exits 1 when something required is missing.+`doctor` checks the language runtimes, the agent setup and the MCP server, and prints the command that fixes each problem. It exits 1 when something required is missing, and its last line names the required checks that failed. `--json` gives the same verdict as `"ok"`, next to `"checks"`.Run it when a step fails because a runtime, the agent setup or the MCP server is missing or out of date. The workflow skill tells agents to do the same.