fix(cli): JSON parity for /export and /agents in resume mode

/export now emits: {kind:export, file:<path>, message_count:<n>}
/agents now emits: {kind:agents, text:<agents report>}

Previously both returned json:None and fell through to prose output even
in --output-format json --resume mode. 159 CLI tests pass.
This commit is contained in:
YeonGyu-Kim
2026-04-10 03:32:24 +09:00
parent 0845705639
commit 11e2353585

View File

@@ -2835,14 +2835,19 @@ fn run_resume_command(
SlashCommand::Export { path } => {
let export_path = resolve_export_path(path.as_deref(), session)?;
fs::write(&export_path, render_export_text(session))?;
let msg_count = session.messages.len();
Ok(ResumeCommandOutcome {
session: session.clone(),
message: Some(format!(
"Export\n Result wrote transcript\n File {}\n Messages {}",
export_path.display(),
session.messages.len(),
msg_count,
)),
json: None,
json: Some(serde_json::json!({
"kind": "export",
"file": export_path.display().to_string(),
"message_count": msg_count,
})),
})
}
SlashCommand::Agents { args } => {
@@ -2850,7 +2855,10 @@ fn run_resume_command(
Ok(ResumeCommandOutcome {
session: session.clone(),
message: Some(handle_agents_slash_command(args.as_deref(), &cwd)?),
json: None,
json: Some(serde_json::json!({
"kind": "agents",
"text": handle_agents_slash_command(args.as_deref(), &cwd)?,
})),
})
}
SlashCommand::Skills { args } => {