From 93ee76810b0e4a82ff33d878ee11fca92ebb90fd Mon Sep 17 00:00:00 2001 From: Hunter Bown Date: Sun, 24 May 2026 16:25:17 -0500 Subject: [PATCH] feat(v0.8.44): one-time config migration from ~/.deepseek/ to ~/.codewhale/ migrate_config_if_needed() copies config.toml on first launch. Called in run_interactive after config creation. Non-fatal, never overwrites an existing primary config. --- crates/config/src/lib.rs | 28 ++++++++++++++++++++++++++++ crates/tui/src/main.rs | 6 ++++++ 2 files changed, 34 insertions(+) diff --git a/crates/config/src/lib.rs b/crates/config/src/lib.rs index 938dc616..a687ab81 100644 --- a/crates/config/src/lib.rs +++ b/crates/config/src/lib.rs @@ -1550,6 +1550,34 @@ pub fn default_config_path() -> Result { Ok(primary) } +/// v0.8.44: one-time migration from `~/.deepseek/config.toml` to +/// `~/.codewhale/config.toml`. Called on first launch after the config +/// is loaded; copies the legacy file if the primary doesn't exist yet. +/// Never overwrites an existing primary config. +pub fn migrate_config_if_needed() -> Result<()> { + let primary = codewhale_home()?.join(CONFIG_FILE_NAME); + if primary.exists() { + return Ok(()); + } + let legacy = legacy_deepseek_home()?.join(CONFIG_FILE_NAME); + if !legacy.exists() { + return Ok(()); + } + // Copy the config to the new home. + if let Some(parent) = primary.parent() { + std::fs::create_dir_all(parent) + .context("failed to create codewhale config directory")?; + } + std::fs::copy(&legacy, &primary) + .context("failed to migrate config from deepseek to codewhale home")?; + tracing::info!( + "Migrated config from {} to {}", + legacy.display(), + primary.display() + ); + Ok(()) +} + fn parse_bool(raw: &str) -> Result { match raw.trim().to_ascii_lowercase().as_str() { "1" | "true" | "yes" | "on" | "enabled" => Ok(true), diff --git a/crates/tui/src/main.rs b/crates/tui/src/main.rs index 851dfabe..5c2dbcb2 100644 --- a/crates/tui/src/main.rs +++ b/crates/tui/src/main.rs @@ -4741,6 +4741,12 @@ async fn run_interactive( } } + // v0.8.44: migrate config from ~/.deepseek/ to ~/.codewhale/ on first + // launch. Non-fatal — existing installs keep working either way. + if let Err(err) = codewhale_config::migrate_config_if_needed() { + logging::warn(format!("Config migration skipped: {err}")); + } + let model = config.default_model(); let max_subagents = cli.max_subagents.map_or_else( || config.max_subagents(),