Add remove session capacity (#2281)

Co-authored-by: Shou En Hsiao <shouen_hsiao@apple.com>
This commit is contained in:
Shawn Hsiao
2025-04-22 15:51:33 -07:00
committed by GitHub
parent 91f3088af0
commit 36f1c602eb
4 changed files with 76 additions and 2 deletions
+17 -1
View File
@@ -8,7 +8,7 @@ use crate::commands::configure::handle_configure;
use crate::commands::info::handle_info;
use crate::commands::mcp::run_server;
use crate::commands::recipe::{handle_deeplink, handle_validate};
use crate::commands::session::handle_session_list;
use crate::commands::session::{handle_session_list, handle_session_remove};
use crate::logging::setup_logging;
use crate::recipe::load_recipe;
use crate::session;
@@ -74,6 +74,18 @@ enum SessionCommand {
)]
format: String,
},
#[command(about = "Remove sessions")]
Remove {
#[arg(short, long, help = "session id to be removed", default_value = "")]
id: String,
#[arg(
short,
long,
help = "regex for removing matched session",
default_value = ""
)]
regex: String,
},
}
#[derive(Subcommand)]
@@ -385,6 +397,10 @@ pub async fn cli() -> Result<()> {
handle_session_list(verbose, format)?;
Ok(())
}
Some(SessionCommand::Remove { id, regex }) => {
handle_session_remove(id, regex)?;
return Ok(());
}
None => {
// Run session command by default
let mut session = build_session(SessionBuilderConfig {