mirror of
https://github.com/ultraworkers/claw-code.git
synced 2026-05-30 11:45:20 +08:00
fix(#458): add status field to export and diff JSON envelopes
This commit is contained in:
parent
16604a111b
commit
11a6e081a2
@ -4113,6 +4113,7 @@ fn run_resume_command(
|
|||||||
)),
|
)),
|
||||||
json: Some(serde_json::json!({
|
json: Some(serde_json::json!({
|
||||||
"kind": "export",
|
"kind": "export",
|
||||||
|
"status": "ok",
|
||||||
"file": export_path.display().to_string(),
|
"file": export_path.display().to_string(),
|
||||||
"message_count": msg_count,
|
"message_count": msg_count,
|
||||||
})),
|
})),
|
||||||
@ -7560,6 +7561,7 @@ fn render_diff_json_for(cwd: &Path) -> Result<serde_json::Value, Box<dyn std::er
|
|||||||
if !in_git_repo {
|
if !in_git_repo {
|
||||||
return Ok(serde_json::json!({
|
return Ok(serde_json::json!({
|
||||||
"kind": "diff",
|
"kind": "diff",
|
||||||
|
"status": "error",
|
||||||
"result": "no_git_repo",
|
"result": "no_git_repo",
|
||||||
"detail": format!("{} is not inside a git project", cwd.display()),
|
"detail": format!("{} is not inside a git project", cwd.display()),
|
||||||
}));
|
}));
|
||||||
@ -7568,6 +7570,7 @@ fn render_diff_json_for(cwd: &Path) -> Result<serde_json::Value, Box<dyn std::er
|
|||||||
let unstaged = run_git_diff_command_in(cwd, &["diff"])?;
|
let unstaged = run_git_diff_command_in(cwd, &["diff"])?;
|
||||||
Ok(serde_json::json!({
|
Ok(serde_json::json!({
|
||||||
"kind": "diff",
|
"kind": "diff",
|
||||||
|
"status": "ok",
|
||||||
"result": if staged.trim().is_empty() && unstaged.trim().is_empty() { "clean" } else { "changes" },
|
"result": if staged.trim().is_empty() && unstaged.trim().is_empty() { "clean" } else { "changes" },
|
||||||
"staged": staged.trim(),
|
"staged": staged.trim(),
|
||||||
"unstaged": unstaged.trim(),
|
"unstaged": unstaged.trim(),
|
||||||
@ -8090,6 +8093,7 @@ fn run_export(
|
|||||||
"{}",
|
"{}",
|
||||||
serde_json::to_string_pretty(&json!({
|
serde_json::to_string_pretty(&json!({
|
||||||
"kind": "export",
|
"kind": "export",
|
||||||
|
"status": "ok",
|
||||||
"message": report,
|
"message": report,
|
||||||
"session_id": handle.id,
|
"session_id": handle.id,
|
||||||
"file": path.display().to_string(),
|
"file": path.display().to_string(),
|
||||||
@ -8111,6 +8115,7 @@ fn run_export(
|
|||||||
"{}",
|
"{}",
|
||||||
serde_json::to_string_pretty(&json!({
|
serde_json::to_string_pretty(&json!({
|
||||||
"kind": "export",
|
"kind": "export",
|
||||||
|
"status": "ok",
|
||||||
"session_id": handle.id,
|
"session_id": handle.id,
|
||||||
"file": handle.path.display().to_string(),
|
"file": handle.path.display().to_string(),
|
||||||
"messages": session.messages.len(),
|
"messages": session.messages.len(),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user