mirror of
https://github.com/instructkr/claude-code.git
synced 2026-05-16 10:56:45 +00:00
Route resumed session commands exhaustively
Keep G010 resumed session UX compilable after worker integrations by routing every /session action through the shared resumed-session command handler.\n\nConstraint: Rust exhaustive matching rejected partial /session arms after task integrations introduced action-without-target cases.\nRejected: adding ad hoc match arms per action | the shared handler already owns list, exists, delete, and unsupported action behavior.\nConfidence: high\nScope-risk: narrow\nDirective: Preserve run_resumed_session_command as the single resumed /session dispatch point.\nTested: cargo fmt --manifest-path rust/Cargo.toml --all -- --check; cargo test --manifest-path rust/Cargo.toml -p rusty-claude-cli --bin claw session_exists_resume_command_reports_json_contract -- --nocapture; cargo test --manifest-path rust/Cargo.toml -p rusty-claude-cli --bin claw resumed_session_exists_and_delete_have_json_contracts -- --nocapture; cargo check --manifest-path rust/Cargo.toml --workspace; git diff --check\nNot-tested: full cargo test --workspace not run.
This commit is contained in:
@@ -4121,35 +4121,12 @@ fn run_resume_command(
|
||||
})
|
||||
}
|
||||
SlashCommand::Unknown(name) => Err(format_unknown_slash_command(name).into()),
|
||||
SlashCommand::Session {
|
||||
action: Some(ref act),
|
||||
target: Some(ref target),
|
||||
} if act == "exists" => {
|
||||
let exists = session_reference_exists(target).unwrap_or(false);
|
||||
let resolved = resolve_session_reference(target).ok();
|
||||
Ok(ResumeCommandOutcome {
|
||||
session: session.clone(),
|
||||
message: Some(format!(
|
||||
"Session exists\n Session {target}\n Exists {exists}{}",
|
||||
resolved
|
||||
.as_ref()
|
||||
.map(|handle| format!("\n File {}", handle.path.display()))
|
||||
.unwrap_or_default()
|
||||
)),
|
||||
json: Some(serde_json::json!({
|
||||
"kind": "session_exists",
|
||||
"session": target,
|
||||
"exists": exists,
|
||||
"path": resolved.map(|handle| handle.path.display().to_string()),
|
||||
})),
|
||||
})
|
||||
// /session list/exists/delete can be served from the managed sessions directory
|
||||
// in resume mode without starting an interactive REPL. Mutating delete remains
|
||||
// opt-in through /session delete <id> --force so JSON callers never hang on a prompt.
|
||||
SlashCommand::Session { action, target } => {
|
||||
run_resumed_session_command(session_path, session, action.as_deref(), target.as_deref())
|
||||
}
|
||||
// /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" => session_list_outcome(),
|
||||
SlashCommand::Bughunter { .. }
|
||||
| SlashCommand::Commit { .. }
|
||||
| SlashCommand::Pr { .. }
|
||||
|
||||
Reference in New Issue
Block a user