mirror of
https://github.com/instructkr/claw-code.git
synced 2026-04-11 02:24:49 +08:00
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:
@@ -2835,14 +2835,19 @@ fn run_resume_command(
|
|||||||
SlashCommand::Export { path } => {
|
SlashCommand::Export { path } => {
|
||||||
let export_path = resolve_export_path(path.as_deref(), session)?;
|
let export_path = resolve_export_path(path.as_deref(), session)?;
|
||||||
fs::write(&export_path, render_export_text(session))?;
|
fs::write(&export_path, render_export_text(session))?;
|
||||||
|
let msg_count = session.messages.len();
|
||||||
Ok(ResumeCommandOutcome {
|
Ok(ResumeCommandOutcome {
|
||||||
session: session.clone(),
|
session: session.clone(),
|
||||||
message: Some(format!(
|
message: Some(format!(
|
||||||
"Export\n Result wrote transcript\n File {}\n Messages {}",
|
"Export\n Result wrote transcript\n File {}\n Messages {}",
|
||||||
export_path.display(),
|
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 } => {
|
SlashCommand::Agents { args } => {
|
||||||
@@ -2850,7 +2855,10 @@ fn run_resume_command(
|
|||||||
Ok(ResumeCommandOutcome {
|
Ok(ResumeCommandOutcome {
|
||||||
session: session.clone(),
|
session: session.clone(),
|
||||||
message: Some(handle_agents_slash_command(args.as_deref(), &cwd)?),
|
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 } => {
|
SlashCommand::Skills { args } => {
|
||||||
|
|||||||
Reference in New Issue
Block a user