Skip to content

Commit 4f670e5

Browse files
committed
fix(cli): emit JSON for --resume with no command in --output-format json mode
claw --output-format json --resume <session> (no command) was printing: 'Restored session from <path> (N messages).' to stdout as prose, regardless of output format. Now emits: {"kind":"restored","session_id":"...","path":"...","message_count":N} 159 CLI tests pass.
1 parent 8dcf103 commit 4f670e5

1 file changed

Lines changed: 17 additions & 5 deletions

File tree

  • rust/crates/rusty-claude-cli/src

rust/crates/rusty-claude-cli/src/main.rs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2256,11 +2256,23 @@ fn resume_session(session_path: &Path, commands: &[String], output_format: CliOu
22562256
};
22572257

22582258
if commands.is_empty() {
2259-
println!(
2260-
"Restored session from {} ({} messages).",
2261-
resolved_path.display(),
2262-
session.messages.len()
2263-
);
2259+
if output_format == CliOutputFormat::Json {
2260+
println!(
2261+
"{}",
2262+
serde_json::json!({
2263+
"kind": "restored",
2264+
"session_id": session.session_id,
2265+
"path": resolved_path.display().to_string(),
2266+
"message_count": session.messages.len(),
2267+
})
2268+
);
2269+
} else {
2270+
println!(
2271+
"Restored session from {} ({} messages).",
2272+
resolved_path.display(),
2273+
session.messages.len()
2274+
);
2275+
}
22642276
return;
22652277
}
22662278

0 commit comments

Comments
 (0)