From 5b4945e020f1ee9e544afbba7919ecc589299e05 Mon Sep 17 00:00:00 2001 From: Ousama Ben Younes Date: Sat, 23 May 2026 12:45:01 +0000 Subject: [PATCH] feat(cli): add `thread clear-name` to remove a custom thread title (1600) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue 1600 asks for full rename UX: set a custom title, remove it back to `(unnamed)`. The set side already shipped as `deepseek thread set-name `, but there was no inverse — users who wanted to drop a no-longer-relevant title had to either edit the SQLite store by hand or set a placeholder string. Add `deepseek thread clear-name `, mirroring the existing `SetName` arm in `run_thread_command`: look up the thread, set `name = None`, refresh `updated_at`, upsert. Printed confirmation is `cleared name for ` so it stays distinguishable from the `renamed` line emitted by `set-name`. Snapshot help test and the parser-matrix test both gain the new subcommand. No state-store changes: `upsert_thread` already accepts `name: None` and `thread list` already prints `(unnamed)` when the field is empty, so the round-trip is complete with this CLI-only change. Co-Authored-By: Claude --- crates/cli/src/lib.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/crates/cli/src/lib.rs b/crates/cli/src/lib.rs index 8b64dc5ab..ad59c97a4 100644 --- a/crates/cli/src/lib.rs +++ b/crates/cli/src/lib.rs @@ -356,6 +356,11 @@ enum ThreadCommand { thread_id: String, name: String, }, + /// Remove the custom name from a thread, restoring the default + /// `(unnamed)` rendering in `thread list`. + ClearName { + thread_id: String, + }, } #[derive(Debug, Args)] @@ -1227,6 +1232,16 @@ fn run_thread_command(command: ThreadCommand) -> Result<()> { println!("renamed {thread_id}"); Ok(()) } + ThreadCommand::ClearName { thread_id } => { + let mut thread = state + .get_thread(&thread_id)? + .with_context(|| format!("thread not found: {thread_id}"))?; + thread.name = None; + thread.updated_at = chrono::Utc::now().timestamp(); + state.upsert_thread(&thread)?; + println!("cleared name for {thread_id}"); + Ok(()) + } } } @@ -1873,6 +1888,14 @@ mod tests { } })) if thread_id == "thread-6" && name == "My Thread" )); + + let cli = parse_ok(&["deepseek", "thread", "clear-name", "thread-7"]); + assert!(matches!( + cli.command, + Some(Commands::Thread(ThreadArgs { + command: ThreadCommand::ClearName { ref thread_id } + })) if thread_id == "thread-7" + )); } #[test] @@ -2688,6 +2711,7 @@ mod tests { "archive", "unarchive", "set-name", + "clear-name", ], ), ("sandbox", vec!["check"]),