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
setup: say "would add", "would update" and "would remove" in a dry run (#1392)
Hashem Alkhanaizi0056a05dc072
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex cba0e9c3..a7ea9864 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -2,6 +2,9 @@## Unreleased+- `setup --dry-run` and `setup --remove --dry-run` list each file as `would add`, `would update` or+ `would remove`, instead of `added`, `updated` or `removed` as if it had been written; the real+ run and `--json` are unchanged (#1371).- Every command that takes a crate folder (`diff`, `gate`, `record`, `build`, `fuzz`, `bench`,`report`, `shadow`, `enable`, `disable`, `refresh` and `package`) says ``no folder <path> (run`rust-anything bridge` first)`` for a folder that is not there and ``no rust-anything.json indiff --git a/src/setup.rs b/src/setup.rsindex 72cb384f..046e8998 100644--- a/src/setup.rs+++ b/src/setup.rs@@ -690,16 +690,28 @@ pub fn text(r: &Report) -> String {.chain(r.changes.iter().map(|c| c.agent.name().len())).max().unwrap_or(0);+ // A dry run writes nothing, so its rows say what would happen.+ let action = |c: &Change| match (r.dry_run, c.action) {+ (true, "added") => "would add",+ (true, "updated") => "would update",+ (true, "removed") => "would remove",+ (_, a) => a,+ };+ let action_width = r+ .changes+ .iter()+ .map(|c| action(c).len())+ .fold(9, usize::max);for c in &r.changes {out.push_str(&format!(- " {:<width$} {:<9} {}\n",+ " {:<width$} {:<action_width$} {}\n",c.agent.name(),- c.action,+ action(c),c.file.display()));if let Some(b) = &c.backup {out.push_str(&format!(- " {:<width$} {:<9} {}\n",+ " {:<width$} {:<action_width$} {}\n","","backup",b.display()@@ -1308,5 +1320,60 @@ mod tests {assert_eq!(&rows[0][24..], "claude.json", "{printed}");assert_eq!(&rows[1][24..], "claude.json.rust-anything.bak", "{printed}");assert_eq!(&rows[2][24..], "mcp.json", "{printed}");++ // A dry run writes nothing, so its rows say what would happen, and the+ // file column moves over to fit "would remove".+ let printed = text(&report(true, true));+ let rows: Vec<&str> = printed.lines().skip(1).collect();+ assert_eq!(rows.len(), 3, "{printed}");+ assert_eq!(+ rows[0], " Claude Code would remove claude.json",+ "{printed}"+ );+ assert_eq!(&rows[1][27..], "claude.json.rust-anything.bak", "{printed}");+ assert_eq!(rows[2], " Cursor would remove mcp.json", "{printed}");+ }++ #[test]+ fn dry_run_setup_reports_say_would_add_and_line_up() {+ let report = Report {+ command: PathBuf::from("/opt/bin/rust-anything"),+ args: vec!["mcp".into()],+ agents: vec![Agent::Claude, Agent::Codex, Agent::Cursor],+ changes: vec![+ Change {+ agent: Agent::Claude,+ file: PathBuf::from("claude.json"),+ action: "added",+ backup: None,+ },+ Change {+ agent: Agent::Codex,+ file: PathBuf::from("config.toml"),+ action: "updated",+ backup: Some(PathBuf::from("config.toml.rust-anything.bak")),+ },+ Change {+ agent: Agent::Cursor,+ file: PathBuf::from("mcp.json"),+ action: "unchanged",+ backup: None,+ },+ ],+ remove: false,+ dry_run: true,+ };+ let printed = text(&report);+ let rows: Vec<&str> = printed.lines().skip(1).take(4).collect();+ assert_eq!(+ rows,+ [+ " Claude Code would add claude.json",+ " Codex would update config.toml",+ " backup config.toml.rust-anything.bak",+ " Cursor unchanged mcp.json",+ ],+ "{printed}"+ );}}