mirror of
https://github.com/instructkr/claude-code.git
synced 2026-05-28 00:16:45 +00:00
fix(#715): add action+status fields to resume-path json responses: compact/clear/cost/stats/history/session_exists/session_delete/memory/restored
This commit is contained in:
@@ -7595,3 +7595,5 @@ Original filing (2026-04-18): the session emitted `SessionStart hook (completed)
|
||||
713. **`acp` and `config` (bare and section-show) `--output-format json` responses missing `action` field — continues sweep from #710–#712** — dogfooded 2026-05-26 on `fdde5e45`. `acp` had no action; `config` bare had no action; `config <section>` and the unknown-section error path both had no action. Fix: added `action:"status"` to acp, `action:"list"` to config bare, `action:"show"` to config section-show and unknown-section error path. Source: Jobdori dogfood on `fdde5e45`, 2026-05-26.
|
||||
|
||||
714. **`help --output-format json` missing `action` field; resume `/help` JSON path also missing `action` and `status`** — dogfooded 2026-05-26 on `7d6b2044`. Top-level `claw help --output-format json` returned `{kind:"help", status:"ok"}` with no `action`. The `render_export_help_json` and `render_help_topic_json` resume-path helpers were also missing `action`. The resume REPL help JSON object had neither `action` nor `status`. Fix: added `action:"help"` (and `status:"ok"` where missing) to all 4 help JSON sites. Source: Jobdori dogfood on `7d6b2044`, 2026-05-26.
|
||||
|
||||
715. **Resume-path slash commands (`/compact`, `/clear`, `/cost`, `/stats`, `/history`, `/session exists`, `/session delete`, `memory`) JSON responses missing `action` and `status` fields** — dogfooded 2026-05-26 on `590b5b61`. The `assert_non_empty_action` guardrail added by #3109 only covers `assert_json_command` (top-level CLI surfaces); resume-path commands that emit JSON via `ResumeCommandOutcome.json` were not covered. 8 resume-path JSON sites all lacked `action` and `status`. Fix: added `action` + `status:"ok"` to `compact`, `clear`, `cost`, `stats`, `history`, `session_exists`, `session_delete`, `memory`, and `restored`. Source: Jobdori dogfood on `590b5b61`, 2026-05-26.
|
||||
|
||||
@@ -3026,6 +3026,8 @@ fn resume_session(session_path: &Path, commands: &[String], output_format: CliOu
|
||||
"{}",
|
||||
serde_json::json!({
|
||||
"kind": "restored",
|
||||
"action": "restore",
|
||||
"status": "ok",
|
||||
"session_id": session.session_id,
|
||||
"path": handle.path.display().to_string(),
|
||||
"message_count": session.messages.len(),
|
||||
@@ -4103,6 +4105,8 @@ fn run_resume_command(
|
||||
message: Some(format_cost_report(usage)),
|
||||
json: Some(serde_json::json!({
|
||||
"kind": "cost",
|
||||
"action": "show",
|
||||
"status": "ok",
|
||||
"input_tokens": usage.input_tokens,
|
||||
"output_tokens": usage.output_tokens,
|
||||
"cache_creation_input_tokens": usage.cache_creation_input_tokens,
|
||||
@@ -4272,6 +4276,8 @@ fn run_resume_command(
|
||||
message: Some(format_cost_report(usage)),
|
||||
json: Some(serde_json::json!({
|
||||
"kind": "stats",
|
||||
"action": "show",
|
||||
"status": "ok",
|
||||
"input_tokens": usage.input_tokens,
|
||||
"output_tokens": usage.output_tokens,
|
||||
"cache_creation_input_tokens": usage.cache_creation_input_tokens,
|
||||
@@ -4292,6 +4298,8 @@ fn run_resume_command(
|
||||
message: Some(render_prompt_history_report(&entries, limit)),
|
||||
json: Some(serde_json::json!({
|
||||
"kind": "history",
|
||||
"action": "list",
|
||||
"status": "ok",
|
||||
"total": entries.len(),
|
||||
"showing": shown.len(),
|
||||
"entries": shown.iter().map(|e| serde_json::json!({
|
||||
@@ -6466,6 +6474,8 @@ fn session_exists_json(
|
||||
.map_or(target, |handle| handle.id.as_str());
|
||||
Ok(serde_json::json!({
|
||||
"kind": "session_exists",
|
||||
"action": "exists",
|
||||
"status": "ok",
|
||||
"session_id": resolved_id,
|
||||
"session": target,
|
||||
"requested": target,
|
||||
@@ -6561,6 +6571,8 @@ fn run_resumed_session_command(
|
||||
)),
|
||||
json: Some(serde_json::json!({
|
||||
"kind": "session_delete",
|
||||
"action": "delete",
|
||||
"status": "ok",
|
||||
"deleted": true,
|
||||
"session_id": handle.id,
|
||||
"path": handle.path.display().to_string(),
|
||||
@@ -7584,6 +7596,8 @@ fn render_memory_json() -> Result<serde_json::Value, Box<dyn std::error::Error>>
|
||||
.collect();
|
||||
Ok(json!({
|
||||
"kind": "memory",
|
||||
"action": "list",
|
||||
"status": "ok",
|
||||
"cwd": cwd.display().to_string(),
|
||||
"instruction_files": files.len(),
|
||||
"files": files,
|
||||
|
||||
Reference in New Issue
Block a user