From d04a74cc976b3add0682604d315964501e73df0f Mon Sep 17 00:00:00 2001 From: bellman Date: Fri, 15 May 2026 11:12:10 +0900 Subject: [PATCH] omx(team): auto-checkpoint worker-1 [1] --- rust/crates/rusty-claude-cli/src/main.rs | 60 +++++++++++++----------- 1 file changed, 32 insertions(+), 28 deletions(-) diff --git a/rust/crates/rusty-claude-cli/src/main.rs b/rust/crates/rusty-claude-cli/src/main.rs index 058ec0a9..f9579b02 100644 --- a/rust/crates/rusty-claude-cli/src/main.rs +++ b/rust/crates/rusty-claude-cli/src/main.rs @@ -3791,6 +3791,35 @@ fn run_resume_command( session: &Session, command: &SlashCommand, ) -> Result> { + let session_list_outcome = || -> Result> { + let sessions = list_managed_sessions().unwrap_or_default(); + let session_ids: Vec = sessions.iter().map(|s| s.id.clone()).collect(); + let session_details: Vec = sessions + .iter() + .map(|session| { + serde_json::json!({ + "id": session.id, + "path": session.path.display().to_string(), + "message_count": session.message_count, + "updated_at_ms": session.updated_at_ms, + "lifecycle": session.lifecycle.json_value(), + }) + }) + .collect(); + let active_id = session.session_id.clone(); + let text = render_session_list(&active_id).unwrap_or_else(|e| format!("error: {e}")); + Ok(ResumeCommandOutcome { + session: session.clone(), + message: Some(text), + json: Some(serde_json::json!({ + "kind": "session_list", + "sessions": session_ids, + "session_details": session_details, + "active": active_id, + })), + }) + }; + match command { SlashCommand::Help => Ok(ResumeCommandOutcome { session: session.clone(), @@ -4116,37 +4145,11 @@ fn run_resume_command( }) } // /session list can be served from the sessions directory without a live session. + SlashCommand::Session { action: None, .. } => session_list_outcome(), SlashCommand::Session { action: Some(ref act), .. - } if act == "list" => { - let sessions = list_managed_sessions().unwrap_or_default(); - let session_ids: Vec = sessions.iter().map(|s| s.id.clone()).collect(); - let session_details: Vec = sessions - .iter() - .map(|session| { - serde_json::json!({ - "id": session.id, - "path": session.path.display().to_string(), - "message_count": session.message_count, - "updated_at_ms": session.updated_at_ms, - "lifecycle": session.lifecycle.json_value(), - }) - }) - .collect(); - let active_id = session.session_id.clone(); - let text = render_session_list(&active_id).unwrap_or_else(|e| format!("error: {e}")); - Ok(ResumeCommandOutcome { - session: session.clone(), - message: Some(text), - json: Some(serde_json::json!({ - "kind": "session_list", - "sessions": session_ids, - "session_details": session_details, - "active": active_id, - })), - }) - } + } if act == "list" => session_list_outcome(), SlashCommand::Bughunter { .. } | SlashCommand::Commit { .. } | SlashCommand::Pr { .. } @@ -4167,6 +4170,7 @@ fn run_resume_command( | SlashCommand::Fast | SlashCommand::Exit | SlashCommand::Summary + | SlashCommand::Session { .. } | SlashCommand::Desktop | SlashCommand::Brief | SlashCommand::Advisor