fix(#458): add status field to version/init/system-prompt JSON envelopes; all 9 subcommands now have uniform status field

This commit is contained in:
YeonGyu-Kim 2026-05-25 14:36:12 +09:00
parent 85e736c73f
commit 5b79413e87

View File

@ -2879,6 +2879,7 @@ fn print_system_prompt(
"{}", "{}",
serde_json::to_string_pretty(&json!({ serde_json::to_string_pretty(&json!({
"kind": "system-prompt", "kind": "system-prompt",
"status": "ok",
"message": message, "message": message,
"sections": sections, "sections": sections,
}))? }))?
@ -2901,6 +2902,7 @@ fn version_json_value() -> serde_json::Value {
let executable_path = env::current_exe().ok().map(|p| p.display().to_string()); let executable_path = env::current_exe().ok().map(|p| p.display().to_string());
json!({ json!({
"kind": "version", "kind": "version",
"status": "ok",
"message": render_version_report(), "message": render_version_report(),
"version": VERSION, "version": VERSION,
"git_sha": GIT_SHA, "git_sha": GIT_SHA,
@ -7478,8 +7480,12 @@ fn run_init(output_format: CliOutputFormat) -> Result<(), Box<dyn std::error::Er
/// string so claws can detect per-artifact state without substring matching. /// string so claws can detect per-artifact state without substring matching.
fn init_json_value(report: &crate::init::InitReport, message: &str) -> serde_json::Value { fn init_json_value(report: &crate::init::InitReport, message: &str) -> serde_json::Value {
use crate::init::InitStatus; use crate::init::InitStatus;
// Derive top-level status: "ok" when all artifacts succeeded (created or
// skipped = idempotent); no failure path exists today so always "ok".
let status = "ok";
json!({ json!({
"kind": "init", "kind": "init",
"status": status,
"project_path": report.project_root.display().to_string(), "project_path": report.project_root.display().to_string(),
"created": report.artifacts_with_status(InitStatus::Created), "created": report.artifacts_with_status(InitStatus::Created),
"updated": report.artifacts_with_status(InitStatus::Updated), "updated": report.artifacts_with_status(InitStatus::Updated),