Add session rename command to CLI (#12236)

Signed-off-by: Lucas Alvares Gomes <lucasagomes@gmail.com>
Co-authored-by: Lifei Zhou <lifei@squareup.com>
This commit is contained in:
Lucas Alvares Gomes
2026-09-28 02:42:33 +00:00
committed by GitHub
parent fdfa2d43b2
commit 91e92ea25c
4 changed files with 87 additions and 4 deletions
+36 -1
View File
@@ -34,7 +34,7 @@ use crate::commands::schedule::{
handle_schedule_run_now, handle_schedule_services_status, handle_schedule_services_stop,
handle_schedule_sessions,
};
use crate::commands::session::{handle_session_list, handle_session_remove};
use crate::commands::session::{handle_session_list, handle_session_remove, handle_session_rename};
use crate::commands::skills::handle_skills_list;
use crate::recipes::extract_from_cli::extract_recipe_info_from_cli;
use crate::recipes::recipe::{explain_recipe, render_recipe_as_yaml};
@@ -610,6 +610,19 @@ enum SessionCommand {
#[arg(short = 'o', long)]
output: Option<PathBuf>,
},
#[command(about = "Rename a session")]
Rename {
#[arg(
long = "session-id",
alias = "id",
value_name = "SESSION_ID",
help = "Session ID to rename (e.g., '20250921_143022'). If omitted, prompts interactively."
)]
session_id: Option<String>,
#[arg(short = 'n', long = "new-name", help = "New name for the session")]
new_name: String,
},
}
#[cfg(feature = "scheduler")]
@@ -1998,6 +2011,28 @@ async fn handle_session_subcommand(command: SessionCommand) -> Result<()> {
};
crate::commands::session::handle_diagnostics(&session_id, output).await?;
}
SessionCommand::Rename {
session_id,
new_name,
} => {
let session_manager = SessionManager::instance();
let session_id = if let Some(id) = session_id {
id
} else {
match crate::commands::session::prompt_interactive_session_selection(
&session_manager,
)
.await
{
Ok(id) => id,
Err(e) => {
eprintln!("Error: {}", e);
return Ok(());
}
}
};
handle_session_rename(session_id, new_name).await?;
}
}
Ok(())
}