Skip to content

An agent-managed museum exhibit, built in Rust with Gajae-Code / LazyCodex — developed and maintained with no human intervention.

Rust

fix(cli): emit JSON error for unsupported resumed slash commands in JSON mode

YeonGyu-Kimda4242198ff8
diff --git a/rust/crates/rusty-claude-cli/src/main.rs b/rust/crates/rusty-claude-cli/src/main.rs
index 41777a19..e2c156df 100644
--- a/rust/crates/rusty-claude-cli/src/main.rs
+++ b/rust/crates/rusty-claude-cli/src/main.rs
@@ -2217,11 +2217,33 @@ fn resume_session(session_path: &Path, commands: &[String], output_format: CliOu
let command = match SlashCommand::parse(raw_command) {
Ok(Some(command)) => command,
Ok(None) => {
- eprintln!("unsupported resumed command: {raw_command}");
+ if output_format == CliOutputFormat::Json {
+ eprintln!(
+ "{}",
+ serde_json::json!({
+ "type": "error",
+ "error": format!("unsupported resumed command: {raw_command}"),
+ "command": raw_command,
+ })
+ );
+ } else {
+ eprintln!("unsupported resumed command: {raw_command}");
+ }
std::process::exit(2);
}
Err(error) => {
- eprintln!("{error}");
+ if output_format == CliOutputFormat::Json {
+ eprintln!(
+ "{}",
+ serde_json::json!({
+ "type": "error",
+ "error": error.to_string(),
+ "command": raw_command,
+ })
+ );
+ } else {
+ eprintln!("{error}");
+ }
std::process::exit(2);
}
};
@@ -2247,7 +2269,18 @@ fn resume_session(session_path: &Path, commands: &[String], output_format: CliOu
}
}
Err(error) => {
- eprintln!("{error}");
+ if output_format == CliOutputFormat::Json {
+ eprintln!(
+ "{}",
+ serde_json::json!({
+ "type": "error",
+ "error": error.to_string(),
+ "command": raw_command,
+ })
+ );
+ } else {
+ eprintln!("{error}");
+ }
std::process::exit(2);
}
}